1 @c Copyright (C) 1988-2018 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2018 Free Software Foundation, Inc.
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.
21 (a) The FSF's Front-Cover Text is:
25 (b) The FSF's Back-Cover Text is:
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.
31 @c Set file name and title for the man page.
33 @settitle GNU project C and C++ compiler
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{}
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}.
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
53 For instructions on reporting bugs, see
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@.
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
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}.
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.
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.
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.
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
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.
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.
126 @xref{Option Index}, for an index to GCC's options.
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
138 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
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
152 * Developer Options:: Printing GCC configuration info, statistics, and
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.
164 @section Option Summary
166 Here is a summary of all the options, grouped by type. Explanations are
167 in the following sections.
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}}
178 @item C Language Options
179 @xref{C Dialect Options,,Options Controlling C Dialect}.
180 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
181 -fpermitted-flt-eval-methods=@var{standard} @gol
182 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
183 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
184 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
185 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
186 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
187 -fsigned-bitfields -fsigned-char @gol
188 -funsigned-bitfields -funsigned-char}
190 @item C++ Language Options
191 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
192 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
193 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
194 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
195 -ffriend-injection @gol
196 -fno-elide-constructors @gol
197 -fno-enforce-eh-specs @gol
198 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
199 -fno-implicit-templates @gol
200 -fno-implicit-inline-templates @gol
201 -fno-implement-inlines -fms-extensions @gol
202 -fnew-inheriting-ctors @gol
203 -fnew-ttp-matching @gol
204 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
205 -fno-optional-diags -fpermissive @gol
206 -fno-pretty-templates @gol
207 -frepo -fno-rtti -fsized-deallocation @gol
208 -ftemplate-backtrace-limit=@var{n} @gol
209 -ftemplate-depth=@var{n} @gol
210 -fno-threadsafe-statics -fuse-cxa-atexit @gol
211 -fno-weak -nostdinc++ @gol
212 -fvisibility-inlines-hidden @gol
213 -fvisibility-ms-compat @gol
214 -fext-numeric-literals @gol
215 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
216 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
217 -Wnamespaces -Wnarrowing @gol
218 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
219 -Wnon-virtual-dtor -Wreorder -Wregister @gol
220 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
221 -Wno-non-template-friend -Wold-style-cast @gol
222 -Woverloaded-virtual -Wno-pmf-conversions @gol
223 -Wsign-promo -Wvirtual-inheritance}
225 @item Objective-C and Objective-C++ Language Options
226 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
227 Objective-C and Objective-C++ Dialects}.
228 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
229 -fgnu-runtime -fnext-runtime @gol
230 -fno-nil-receivers @gol
231 -fobjc-abi-version=@var{n} @gol
232 -fobjc-call-cxx-cdtors @gol
233 -fobjc-direct-dispatch @gol
234 -fobjc-exceptions @gol
237 -fobjc-std=objc1 @gol
238 -fno-local-ivars @gol
239 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
240 -freplace-objc-classes @gol
243 -Wassign-intercept @gol
244 -Wno-protocol -Wselector @gol
245 -Wstrict-selector-match @gol
246 -Wundeclared-selector}
248 @item Diagnostic Message Formatting Options
249 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
250 @gccoptlist{-fmessage-length=@var{n} @gol
251 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
252 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
253 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
254 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
255 -fdiagnostics-show-template-tree -fno-elide-type @gol
258 @item Warning Options
259 @xref{Warning Options,,Options to Request or Suppress Warnings}.
260 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
261 -pedantic-errors @gol
262 -w -Wextra -Wall -Waddress -Waggregate-return @gol
263 -Walloc-zero -Walloc-size-larger-than=@var{n}
264 -Walloca -Walloca-larger-than=@var{n} @gol
265 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
266 -Wno-attributes -Wbool-compare -Wbool-operation @gol
267 -Wno-builtin-declaration-mismatch @gol
268 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
269 -Wc++-compat -Wc++11-compat -Wc++14-compat @gol
270 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
271 -Wchar-subscripts -Wchkp -Wcatch-value -Wcatch-value=@var{n} @gol
272 -Wclobbered -Wcomment -Wconditionally-supported @gol
273 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
274 -Wdelete-incomplete @gol
275 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
276 -Wdisabled-optimization @gol
277 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
278 -Wno-div-by-zero -Wdouble-promotion @gol
279 -Wduplicated-branches -Wduplicated-cond @gol
280 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
281 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
282 -Wfloat-equal -Wformat -Wformat=2 @gol
283 -Wno-format-contains-nul -Wno-format-extra-args @gol
284 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
285 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
286 -Wformat-y2k -Wframe-address @gol
287 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
288 -Wif-not-aligned @gol
289 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
290 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
291 -Wimplicit-function-declaration -Wimplicit-int @gol
292 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
293 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
294 -Winvalid-pch -Wlarger-than=@var{len} @gol
295 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
296 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
297 -Wmisleading-indentation -Wmissing-braces @gol
298 -Wmissing-field-initializers -Wmissing-include-dirs @gol
299 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
300 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
301 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
302 -Woverride-init-side-effects -Woverlength-strings @gol
303 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
304 -Wparentheses -Wno-pedantic-ms-format @gol
305 -Wplacement-new -Wplacement-new=@var{n} @gol
306 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
307 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
308 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
309 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
310 -Wshift-overflow -Wshift-overflow=@var{n} @gol
311 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
312 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
313 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
314 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
315 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
316 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
317 -Wstringop-overflow=@var{n} -Wstringop-truncation @gol
318 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
319 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
320 -Wmissing-format-attribute -Wsubobject-linkage @gol
321 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
322 -Wswitch-unreachable -Wsync-nand @gol
323 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
324 -Wtype-limits -Wundef @gol
325 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
326 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
327 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
328 -Wunused-parameter -Wno-unused-result @gol
329 -Wunused-value -Wunused-variable @gol
330 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
331 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
332 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
333 -Wvla -Wvla-larger-than=@var{n} -Wvolatile-register-var -Wwrite-strings @gol
334 -Wzero-as-null-pointer-constant -Whsa}
336 @item C and Objective-C-only Warning Options
337 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
338 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
339 -Wold-style-declaration -Wold-style-definition @gol
340 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
341 -Wdeclaration-after-statement -Wpointer-sign}
343 @item Debugging Options
344 @xref{Debugging Options,,Options for Debugging Your Program}.
345 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
346 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
347 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
348 -gcolumn-info -gno-column-info @gol
349 -gstatement-frontiers -gno-statement-frontiers @gol
350 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
351 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
352 -fno-eliminate-unused-debug-types @gol
353 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
354 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
355 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
356 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
357 -fvar-tracking -fvar-tracking-assignments}
359 @item Optimization Options
360 @xref{Optimize Options,,Options that Control Optimization}.
361 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
362 -falign-jumps[=@var{n}] @gol
363 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
364 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
365 -fauto-inc-dec -fbranch-probabilities @gol
366 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
367 -fbtr-bb-exclusive -fcaller-saves @gol
368 -fcombine-stack-adjustments -fconserve-stack @gol
369 -fcompare-elim -fcprop-registers -fcrossjumping @gol
370 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
371 -fcx-limited-range @gol
372 -fdata-sections -fdce -fdelayed-branch @gol
373 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
374 -fdevirtualize-at-ltrans -fdse @gol
375 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
376 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
377 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
378 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
379 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
380 -fif-conversion2 -findirect-inlining @gol
381 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
382 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
383 -fipa-bit-cp -fipa-vrp @gol
384 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
385 -fira-algorithm=@var{algorithm} @gol
386 -fira-region=@var{region} -fira-hoist-pressure @gol
387 -fira-loop-pressure -fno-ira-share-save-slots @gol
388 -fno-ira-share-spill-slots @gol
389 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
390 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
391 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
392 -floop-block -floop-interchange -floop-strip-mine @gol
393 -floop-unroll-and-jam -floop-nest-optimize @gol
394 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
395 -flto-partition=@var{alg} -fmerge-all-constants @gol
396 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
397 -fmove-loop-invariants -fno-branch-count-reg @gol
398 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
399 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
400 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
401 -fno-sched-spec -fno-signed-zeros @gol
402 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
403 -fomit-frame-pointer -foptimize-sibling-calls @gol
404 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
405 -fprefetch-loop-arrays @gol
406 -fprofile-correction @gol
407 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
408 -fprofile-reorder-functions @gol
409 -freciprocal-math -free -frename-registers -freorder-blocks @gol
410 -freorder-blocks-algorithm=@var{algorithm} @gol
411 -freorder-blocks-and-partition -freorder-functions @gol
412 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
413 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
414 -fsched-spec-load -fsched-spec-load-dangerous @gol
415 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
416 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
417 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
418 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
419 -fschedule-fusion @gol
420 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
421 -fselective-scheduling -fselective-scheduling2 @gol
422 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
423 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
424 -fsignaling-nans @gol
425 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
427 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
428 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
429 -fthread-jumps -ftracer -ftree-bit-ccp @gol
430 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
431 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
432 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
433 -ftree-loop-if-convert -ftree-loop-im @gol
434 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
435 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
436 -ftree-loop-vectorize @gol
437 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
438 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
439 -ftree-switch-conversion -ftree-tail-merge @gol
440 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
441 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
442 -funsafe-math-optimizations -funswitch-loops @gol
443 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
444 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
445 --param @var{name}=@var{value}
446 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
448 @item Program Instrumentation Options
449 @xref{Instrumentation Options,,Program Instrumentation Options}.
450 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
451 -fprofile-abs-path @gol
452 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
453 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
454 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
455 -fsanitize-undefined-trap-on-error -fbounds-check @gol
456 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
457 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
458 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
459 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
460 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
461 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
462 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
463 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
464 -fchkp-use-wrappers -fchkp-flexible-struct-trailing-arrays@gol
465 -fcf-protection==@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
466 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
467 -fstack-protector-explicit -fstack-check @gol
468 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
469 -fno-stack-limit -fsplit-stack @gol
470 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
471 -fvtv-counts -fvtv-debug @gol
472 -finstrument-functions @gol
473 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
474 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
476 @item Preprocessor Options
477 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
478 @gccoptlist{-A@var{question}=@var{answer} @gol
479 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
480 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
481 -dD -dI -dM -dN -dU @gol
482 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
483 -fexec-charset=@var{charset} -fextended-identifiers @gol
484 -finput-charset=@var{charset} -fno-canonical-system-headers @gol
485 -fpch-deps -fpch-preprocess -fpreprocessed @gol
486 -ftabstop=@var{width} -ftrack-macro-expansion @gol
487 -fwide-exec-charset=@var{charset} -fworking-directory @gol
488 -H -imacros @var{file} -include @var{file} @gol
489 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
490 -no-integrated-cpp -P -pthread -remap @gol
491 -traditional -traditional-cpp -trigraphs @gol
492 -U@var{macro} -undef @gol
493 -Wp,@var{option} -Xpreprocessor @var{option}}
495 @item Assembler Options
496 @xref{Assembler Options,,Passing Options to the Assembler}.
497 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
500 @xref{Link Options,,Options for Linking}.
501 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
502 -nostartfiles -nodefaultlibs -nostdlib -pie -pthread -rdynamic @gol
503 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
504 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
505 -static-libmpx -static-libmpxwrappers @gol
506 -shared -shared-libgcc -symbolic @gol
507 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
508 -u @var{symbol} -z @var{keyword}}
510 @item Directory Options
511 @xref{Directory Options,,Options for Directory Search}.
512 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
513 -idirafter @var{dir} @gol
514 -imacros @var{file} -imultilib @var{dir} @gol
515 -iplugindir=@var{dir} -iprefix @var{file} @gol
516 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
517 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
518 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
519 -nostdinc -nostdinc++ --sysroot=@var{dir}}
521 @item Code Generation Options
522 @xref{Code Gen Options,,Options for Code Generation Conventions}.
523 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
524 -ffixed-@var{reg} -fexceptions @gol
525 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
526 -fasynchronous-unwind-tables @gol
528 -finhibit-size-directive -fno-common -fno-ident @gol
529 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
530 -fno-jump-tables @gol
531 -frecord-gcc-switches @gol
532 -freg-struct-return -fshort-enums -fshort-wchar @gol
533 -fverbose-asm -fpack-struct[=@var{n}] @gol
534 -fleading-underscore -ftls-model=@var{model} @gol
535 -fstack-reuse=@var{reuse_level} @gol
536 -ftrampolines -ftrapv -fwrapv @gol
537 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
538 -fstrict-volatile-bitfields -fsync-libcalls}
540 @item Developer Options
541 @xref{Developer Options,,GCC Developer Options}.
542 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
543 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
544 -fdbg-cnt=@var{counter-value-list} @gol
545 -fdisable-ipa-@var{pass_name} @gol
546 -fdisable-rtl-@var{pass_name} @gol
547 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
548 -fdisable-tree-@var{pass_name} @gol
549 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
550 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
551 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
552 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
553 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
555 -fdump-lang-@var{switch} @gol
556 -fdump-lang-@var{switch}-@var{options} @gol
557 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
559 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
560 -fdump-statistics @gol
562 -fdump-tree-@var{switch} @gol
563 -fdump-tree-@var{switch}-@var{options} @gol
564 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
565 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
566 -fenable-@var{kind}-@var{pass} @gol
567 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
568 -fira-verbose=@var{n} @gol
569 -flto-report -flto-report-wpa -fmem-report-wpa @gol
570 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
571 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
572 -fprofile-report @gol
573 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
574 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
575 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
576 -fvar-tracking-assignments-toggle -gtoggle @gol
577 -print-file-name=@var{library} -print-libgcc-file-name @gol
578 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
579 -print-prog-name=@var{program} -print-search-dirs -Q @gol
580 -print-sysroot -print-sysroot-headers-suffix @gol
581 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
583 @item Machine-Dependent Options
584 @xref{Submodel Options,,Machine-Dependent Options}.
585 @c This list is ordered alphanumerically by subsection name.
586 @c Try and put the significant identifier (CPU or system) first,
587 @c so users have a clue at guessing where the ones they want will be.
589 @emph{AArch64 Options}
590 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
591 -mgeneral-regs-only @gol
592 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
594 -momit-leaf-frame-pointer @gol
595 -mtls-dialect=desc -mtls-dialect=traditional @gol
596 -mtls-size=@var{size} @gol
597 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
598 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
599 -mpc-relative-literal-loads @gol
600 -msign-return-address=@var{scope} @gol
601 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
602 -moverride=@var{string} -mverbose-cost-dump}
604 @emph{Adapteva Epiphany Options}
605 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
606 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
607 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
608 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
609 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
610 -msplit-vecmove-early -m1reg-@var{reg}}
613 @gccoptlist{-mbarrel-shifter @gol
614 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
615 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
616 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
617 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
618 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
619 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
620 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
621 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
622 -mvolatile-cache -mtp-regno=@var{regno} @gol
623 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
624 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
625 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
626 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
627 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
628 -mtune=@var{cpu} -mmultcost=@var{num} @gol
629 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
630 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
633 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
634 -mabi=@var{name} @gol
635 -mapcs-stack-check -mno-apcs-stack-check @gol
636 -mapcs-reentrant -mno-apcs-reentrant @gol
637 -msched-prolog -mno-sched-prolog @gol
638 -mlittle-endian -mbig-endian @gol
640 -mfloat-abi=@var{name} @gol
641 -mfp16-format=@var{name}
642 -mthumb-interwork -mno-thumb-interwork @gol
643 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
644 -mtune=@var{name} -mprint-tune-info @gol
645 -mstructure-size-boundary=@var{n} @gol
646 -mabort-on-noreturn @gol
647 -mlong-calls -mno-long-calls @gol
648 -msingle-pic-base -mno-single-pic-base @gol
649 -mpic-register=@var{reg} @gol
650 -mnop-fun-dllimport @gol
651 -mpoke-function-name @gol
652 -mthumb -marm -mflip-thumb @gol
653 -mtpcs-frame -mtpcs-leaf-frame @gol
654 -mcaller-super-interworking -mcallee-super-interworking @gol
655 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
656 -mword-relocations @gol
657 -mfix-cortex-m3-ldrd @gol
658 -munaligned-access @gol
659 -mneon-for-64bits @gol
660 -mslow-flash-data @gol
661 -masm-syntax-unified @gol
663 -mverbose-cost-dump @gol
668 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
669 -mbranch-cost=@var{cost} @gol
670 -mcall-prologues -mgas-isr-prologues -mint8 @gol
671 -mn_flash=@var{size} -mno-interrupts @gol
672 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
673 -mfract-convert-truncate @gol
674 -mshort-calls -nodevicelib @gol
675 -Waddr-space-convert -Wmisspelled-isr}
677 @emph{Blackfin Options}
678 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
679 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
680 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
681 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
682 -mno-id-shared-library -mshared-library-id=@var{n} @gol
683 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
684 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
685 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
689 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
690 -msim -msdata=@var{sdata-type}}
693 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
694 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
695 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
696 -mstack-align -mdata-align -mconst-align @gol
697 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
698 -melf -maout -melinux -mlinux -sim -sim2 @gol
699 -mmul-bug-workaround -mno-mul-bug-workaround}
702 @gccoptlist{-mmac @gol
703 -mcr16cplus -mcr16c @gol
704 -msim -mint32 -mbit-ops
705 -mdata-model=@var{model}}
707 @emph{Darwin Options}
708 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
709 -arch_only -bind_at_load -bundle -bundle_loader @gol
710 -client_name -compatibility_version -current_version @gol
712 -dependency-file -dylib_file -dylinker_install_name @gol
713 -dynamic -dynamiclib -exported_symbols_list @gol
714 -filelist -flat_namespace -force_cpusubtype_ALL @gol
715 -force_flat_namespace -headerpad_max_install_names @gol
717 -image_base -init -install_name -keep_private_externs @gol
718 -multi_module -multiply_defined -multiply_defined_unused @gol
719 -noall_load -no_dead_strip_inits_and_terms @gol
720 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
721 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
722 -private_bundle -read_only_relocs -sectalign @gol
723 -sectobjectsymbols -whyload -seg1addr @gol
724 -sectcreate -sectobjectsymbols -sectorder @gol
725 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
726 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
727 -segprot -segs_read_only_addr -segs_read_write_addr @gol
728 -single_module -static -sub_library -sub_umbrella @gol
729 -twolevel_namespace -umbrella -undefined @gol
730 -unexported_symbols_list -weak_reference_mismatches @gol
731 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
732 -mkernel -mone-byte-bool}
734 @emph{DEC Alpha Options}
735 @gccoptlist{-mno-fp-regs -msoft-float @gol
736 -mieee -mieee-with-inexact -mieee-conformant @gol
737 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
738 -mtrap-precision=@var{mode} -mbuild-constants @gol
739 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
740 -mbwx -mmax -mfix -mcix @gol
741 -mfloat-vax -mfloat-ieee @gol
742 -mexplicit-relocs -msmall-data -mlarge-data @gol
743 -msmall-text -mlarge-text @gol
744 -mmemory-latency=@var{time}}
747 @gccoptlist{-msmall-model -mno-lsim}
750 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
753 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
754 -mhard-float -msoft-float @gol
755 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
756 -mdouble -mno-double @gol
757 -mmedia -mno-media -mmuladd -mno-muladd @gol
758 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
759 -mlinked-fp -mlong-calls -malign-labels @gol
760 -mlibrary-pic -macc-4 -macc-8 @gol
761 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
762 -moptimize-membar -mno-optimize-membar @gol
763 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
764 -mvliw-branch -mno-vliw-branch @gol
765 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
766 -mno-nested-cond-exec -mtomcat-stats @gol
770 @emph{GNU/Linux Options}
771 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
772 -tno-android-cc -tno-android-ld}
774 @emph{H8/300 Options}
775 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
778 @gccoptlist{-march=@var{architecture-type} @gol
779 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
780 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
781 -mfixed-range=@var{register-range} @gol
782 -mjump-in-delay -mlinker-opt -mlong-calls @gol
783 -mlong-load-store -mno-disable-fpregs @gol
784 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
785 -mno-jump-in-delay -mno-long-load-store @gol
786 -mno-portable-runtime -mno-soft-float @gol
787 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
788 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
789 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
790 -munix=@var{unix-std} -nolibdld -static -threads}
793 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
794 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
795 -mconstant-gp -mauto-pic -mfused-madd @gol
796 -minline-float-divide-min-latency @gol
797 -minline-float-divide-max-throughput @gol
798 -mno-inline-float-divide @gol
799 -minline-int-divide-min-latency @gol
800 -minline-int-divide-max-throughput @gol
801 -mno-inline-int-divide @gol
802 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
803 -mno-inline-sqrt @gol
804 -mdwarf2-asm -mearly-stop-bits @gol
805 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
806 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
807 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
808 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
809 -msched-spec-ldc -msched-spec-control-ldc @gol
810 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
811 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
812 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
813 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
816 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
817 -msign-extend-enabled -muser-enabled}
819 @emph{M32R/D Options}
820 @gccoptlist{-m32r2 -m32rx -m32r @gol
822 -malign-loops -mno-align-loops @gol
823 -missue-rate=@var{number} @gol
824 -mbranch-cost=@var{number} @gol
825 -mmodel=@var{code-size-model-type} @gol
826 -msdata=@var{sdata-type} @gol
827 -mno-flush-func -mflush-func=@var{name} @gol
828 -mno-flush-trap -mflush-trap=@var{number} @gol
832 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
834 @emph{M680x0 Options}
835 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
836 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
837 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
838 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
839 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
840 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
841 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
842 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
843 -mxgot -mno-xgot -mlong-jump-table-offsets}
846 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
847 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
848 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
849 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
850 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
853 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
854 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
855 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
856 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
859 @emph{MicroBlaze Options}
860 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
861 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
862 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
863 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
864 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
867 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
868 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
869 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
870 -mips16 -mno-mips16 -mflip-mips16 @gol
871 -minterlink-compressed -mno-interlink-compressed @gol
872 -minterlink-mips16 -mno-interlink-mips16 @gol
873 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
874 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
875 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
876 -mno-float -msingle-float -mdouble-float @gol
877 -modd-spreg -mno-odd-spreg @gol
878 -mabs=@var{mode} -mnan=@var{encoding} @gol
879 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
882 -mvirt -mno-virt @gol
884 -mmicromips -mno-micromips @gol
886 -mfpu=@var{fpu-type} @gol
887 -msmartmips -mno-smartmips @gol
888 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
889 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
890 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
891 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
892 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
893 -membedded-data -mno-embedded-data @gol
894 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
895 -mcode-readable=@var{setting} @gol
896 -msplit-addresses -mno-split-addresses @gol
897 -mexplicit-relocs -mno-explicit-relocs @gol
898 -mcheck-zero-division -mno-check-zero-division @gol
899 -mdivide-traps -mdivide-breaks @gol
900 -mload-store-pairs -mno-load-store-pairs @gol
901 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
902 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
903 -mfix-24k -mno-fix-24k @gol
904 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
905 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
906 -mfix-vr4120 -mno-fix-vr4120 @gol
907 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
908 -mflush-func=@var{func} -mno-flush-func @gol
909 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
910 -mcompact-branches=@var{policy} @gol
911 -mfp-exceptions -mno-fp-exceptions @gol
912 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
913 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
914 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
915 -mframe-header-opt -mno-frame-header-opt}
918 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
919 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
920 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
921 -mno-base-addresses -msingle-exit -mno-single-exit}
923 @emph{MN10300 Options}
924 @gccoptlist{-mmult-bug -mno-mult-bug @gol
925 -mno-am33 -mam33 -mam33-2 -mam34 @gol
926 -mtune=@var{cpu-type} @gol
927 -mreturn-pointer-on-d0 @gol
928 -mno-crt0 -mrelax -mliw -msetlb}
931 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
933 @emph{MSP430 Options}
934 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
936 -mcode-region= -mdata-region= @gol
937 -msilicon-errata= -msilicon-errata-warn= @gol
941 @gccoptlist{-mbig-endian -mlittle-endian @gol
942 -mreduced-regs -mfull-regs @gol
943 -mcmov -mno-cmov @gol
944 -mperf-ext -mno-perf-ext @gol
945 -mv3push -mno-v3push @gol
946 -m16bit -mno-16bit @gol
947 -misr-vector-size=@var{num} @gol
948 -mcache-block-size=@var{num} @gol
949 -march=@var{arch} @gol
950 -mcmodel=@var{code-model} @gol
953 @emph{Nios II Options}
954 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
955 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
957 -mno-bypass-cache -mbypass-cache @gol
958 -mno-cache-volatile -mcache-volatile @gol
959 -mno-fast-sw-div -mfast-sw-div @gol
960 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
961 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
962 -mcustom-fpu-cfg=@var{name} @gol
963 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
964 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
966 @emph{Nvidia PTX Options}
967 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
969 @emph{PDP-11 Options}
970 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
971 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
972 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
973 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
974 -mbranch-expensive -mbranch-cheap @gol
975 -munix-asm -mdec-asm}
977 @emph{picoChip Options}
978 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
979 -msymbol-as-address -mno-inefficient-warnings}
981 @emph{PowerPC Options}
982 See RS/6000 and PowerPC Options.
984 @emph{RISC-V Options}
985 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
987 -mabi=@var{ABI-string} @gol
988 -mfdiv -mno-fdiv @gol
990 -march=@var{ISA-string} @gol
991 -mtune=@var{processor-string} @gol
992 -msmall-data-limit=@var{N-bytes} @gol
993 -msave-restore -mno-save-restore @gol
994 -mstrict-align -mno-strict-align @gol
995 -mcmodel=medlow -mcmodel=medany @gol
996 -mexplicit-relocs -mno-explicit-relocs @gol}
999 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1000 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1001 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1003 @emph{RS/6000 and PowerPC Options}
1004 @gccoptlist{-mcpu=@var{cpu-type} @gol
1005 -mtune=@var{cpu-type} @gol
1006 -mcmodel=@var{code-model} @gol
1008 -maltivec -mno-altivec @gol
1009 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1010 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1011 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1012 -mfprnd -mno-fprnd @gol
1013 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1014 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1015 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1016 -malign-power -malign-natural @gol
1017 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1018 -msingle-float -mdouble-float -msimple-fpu @gol
1019 -mstring -mno-string -mupdate -mno-update @gol
1020 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1021 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1022 -mstrict-align -mno-strict-align -mrelocatable @gol
1023 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1024 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1025 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1026 -mprioritize-restricted-insns=@var{priority} @gol
1027 -msched-costly-dep=@var{dependence_type} @gol
1028 -minsert-sched-nops=@var{scheme} @gol
1029 -mcall-sysv -mcall-netbsd @gol
1030 -maix-struct-return -msvr4-struct-return @gol
1031 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1032 -mblock-move-inline-limit=@var{num} @gol
1033 -misel -mno-isel @gol
1034 -misel=yes -misel=no @gol
1036 -mspe=yes -mspe=no @gol
1038 -mvrsave -mno-vrsave @gol
1039 -mmulhw -mno-mulhw @gol
1040 -mdlmzb -mno-dlmzb @gol
1041 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1042 -mprototype -mno-prototype @gol
1043 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1044 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1045 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1046 -mno-recip-precision @gol
1047 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1048 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1049 -msave-toc-indirect -mno-save-toc-indirect @gol
1050 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1051 -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol
1052 -mquad-memory -mno-quad-memory @gol
1053 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1054 -mcompat-align-parm -mno-compat-align-parm @gol
1055 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1056 -mgnu-attribute -mno-gnu-attribute @gol
1057 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1058 -mstack-protector-guard-offset=@var{offset}}
1061 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1063 -mbig-endian-data -mlittle-endian-data @gol
1066 -mas100-syntax -mno-as100-syntax@gol
1068 -mmax-constant-size=@gol
1071 -mallow-string-insns -mno-allow-string-insns@gol
1073 -mno-warn-multiple-fast-interrupts@gol
1074 -msave-acc-in-interrupts}
1076 @emph{S/390 and zSeries Options}
1077 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1078 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1079 -mlong-double-64 -mlong-double-128 @gol
1080 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1081 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1082 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1083 -mhtm -mvx -mzvector @gol
1084 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1085 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1086 -mhotpatch=@var{halfwords},@var{halfwords}}
1088 @emph{Score Options}
1089 @gccoptlist{-meb -mel @gol
1093 -mscore5 -mscore5u -mscore7 -mscore7d}
1096 @gccoptlist{-m1 -m2 -m2e @gol
1097 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1099 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1100 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1101 -mb -ml -mdalign -mrelax @gol
1102 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1103 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1104 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1105 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1106 -maccumulate-outgoing-args @gol
1107 -matomic-model=@var{atomic-model} @gol
1108 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1109 -mcbranch-force-delay-slot @gol
1110 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1111 -mpretend-cmove -mtas}
1113 @emph{Solaris 2 Options}
1114 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1117 @emph{SPARC Options}
1118 @gccoptlist{-mcpu=@var{cpu-type} @gol
1119 -mtune=@var{cpu-type} @gol
1120 -mcmodel=@var{code-model} @gol
1121 -mmemory-model=@var{mem-model} @gol
1122 -m32 -m64 -mapp-regs -mno-app-regs @gol
1123 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1124 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1125 -mhard-quad-float -msoft-quad-float @gol
1126 -mstack-bias -mno-stack-bias @gol
1127 -mstd-struct-return -mno-std-struct-return @gol
1128 -munaligned-doubles -mno-unaligned-doubles @gol
1129 -muser-mode -mno-user-mode @gol
1130 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1131 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1132 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1133 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1134 -mpopc -mno-popc -msubxc -mno-subxc @gol
1135 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1139 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1140 -msafe-dma -munsafe-dma @gol
1142 -msmall-mem -mlarge-mem -mstdmain @gol
1143 -mfixed-range=@var{register-range} @gol
1145 -maddress-space-conversion -mno-address-space-conversion @gol
1146 -mcache-size=@var{cache-size} @gol
1147 -matomic-updates -mno-atomic-updates}
1149 @emph{System V Options}
1150 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1152 @emph{TILE-Gx Options}
1153 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1154 -mcmodel=@var{code-model}}
1156 @emph{TILEPro Options}
1157 @gccoptlist{-mcpu=@var{cpu} -m32}
1160 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1161 -mprolog-function -mno-prolog-function -mspace @gol
1162 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1163 -mapp-regs -mno-app-regs @gol
1164 -mdisable-callt -mno-disable-callt @gol
1165 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1166 -mv850e -mv850 -mv850e3v5 @gol
1177 @gccoptlist{-mg -mgnu -munix}
1179 @emph{Visium Options}
1180 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1181 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1184 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1185 -mpointer-size=@var{size}}
1187 @emph{VxWorks Options}
1188 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1189 -Xbind-lazy -Xbind-now}
1192 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1193 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1194 -mfpmath=@var{unit} @gol
1195 -masm=@var{dialect} -mno-fancy-math-387 @gol
1196 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1197 -mno-wide-multiply -mrtd -malign-double @gol
1198 -mpreferred-stack-boundary=@var{num} @gol
1199 -mincoming-stack-boundary=@var{num} @gol
1200 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1201 -mrecip -mrecip=@var{opt} @gol
1202 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1203 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1204 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1205 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1206 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1207 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1208 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1209 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx @gol
1210 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes @gol
1211 -mcet -mibt -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1212 -mvpclmulqdq -mavx512bitalg -mavx512vpopcntdq @gol
1213 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1214 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1215 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1216 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1217 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1218 -mregparm=@var{num} -msseregparm @gol
1219 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1220 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1221 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1222 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1223 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1224 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1225 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1226 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1227 -mstack-protector-guard-reg=@var{reg} @gol
1228 -mstack-protector-guard-offset=@var{offset} @gol
1229 -mstack-protector-guard-symbol=@var{symbol} -mmitigate-rop @gol
1230 -mgeneral-regs-only -mcall-ms2sysv-xlogues}
1232 @emph{x86 Windows Options}
1233 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1234 -mnop-fun-dllimport -mthread @gol
1235 -municode -mwin32 -mwindows -fno-set-stack-executable}
1237 @emph{Xstormy16 Options}
1240 @emph{Xtensa Options}
1241 @gccoptlist{-mconst16 -mno-const16 @gol
1242 -mfused-madd -mno-fused-madd @gol
1244 -mserialize-volatile -mno-serialize-volatile @gol
1245 -mtext-section-literals -mno-text-section-literals @gol
1246 -mauto-litpools -mno-auto-litpools @gol
1247 -mtarget-align -mno-target-align @gol
1248 -mlongcalls -mno-longcalls}
1250 @emph{zSeries Options}
1251 See S/390 and zSeries Options.
1255 @node Overall Options
1256 @section Options Controlling the Kind of Output
1258 Compilation can involve up to four stages: preprocessing, compilation
1259 proper, assembly and linking, always in that order. GCC is capable of
1260 preprocessing and compiling several files either into several
1261 assembler input files, or into one assembler input file; then each
1262 assembler input file produces an object file, and linking combines all
1263 the object files (those newly compiled, and those specified as input)
1264 into an executable file.
1266 @cindex file name suffix
1267 For any given input file, the file name suffix determines what kind of
1268 compilation is done:
1272 C source code that must be preprocessed.
1275 C source code that should not be preprocessed.
1278 C++ source code that should not be preprocessed.
1281 Objective-C source code. Note that you must link with the @file{libobjc}
1282 library to make an Objective-C program work.
1285 Objective-C source code that should not be preprocessed.
1289 Objective-C++ source code. Note that you must link with the @file{libobjc}
1290 library to make an Objective-C++ program work. Note that @samp{.M} refers
1291 to a literal capital M@.
1293 @item @var{file}.mii
1294 Objective-C++ source code that should not be preprocessed.
1297 C, C++, Objective-C or Objective-C++ header file to be turned into a
1298 precompiled header (default), or C, C++ header file to be turned into an
1299 Ada spec (via the @option{-fdump-ada-spec} switch).
1302 @itemx @var{file}.cp
1303 @itemx @var{file}.cxx
1304 @itemx @var{file}.cpp
1305 @itemx @var{file}.CPP
1306 @itemx @var{file}.c++
1308 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1309 the last two letters must both be literally @samp{x}. Likewise,
1310 @samp{.C} refers to a literal capital C@.
1314 Objective-C++ source code that must be preprocessed.
1316 @item @var{file}.mii
1317 Objective-C++ source code that should not be preprocessed.
1321 @itemx @var{file}.hp
1322 @itemx @var{file}.hxx
1323 @itemx @var{file}.hpp
1324 @itemx @var{file}.HPP
1325 @itemx @var{file}.h++
1326 @itemx @var{file}.tcc
1327 C++ header file to be turned into a precompiled header or Ada spec.
1330 @itemx @var{file}.for
1331 @itemx @var{file}.ftn
1332 Fixed form Fortran source code that should not be preprocessed.
1335 @itemx @var{file}.FOR
1336 @itemx @var{file}.fpp
1337 @itemx @var{file}.FPP
1338 @itemx @var{file}.FTN
1339 Fixed form Fortran source code that must be preprocessed (with the traditional
1342 @item @var{file}.f90
1343 @itemx @var{file}.f95
1344 @itemx @var{file}.f03
1345 @itemx @var{file}.f08
1346 Free form Fortran source code that should not be preprocessed.
1348 @item @var{file}.F90
1349 @itemx @var{file}.F95
1350 @itemx @var{file}.F03
1351 @itemx @var{file}.F08
1352 Free form Fortran source code that must be preprocessed (with the
1353 traditional preprocessor).
1358 @item @var{file}.brig
1359 BRIG files (binary representation of HSAIL).
1361 @item @var{file}.ads
1362 Ada source code file that contains a library unit declaration (a
1363 declaration of a package, subprogram, or generic, or a generic
1364 instantiation), or a library unit renaming declaration (a package,
1365 generic, or subprogram renaming declaration). Such files are also
1368 @item @var{file}.adb
1369 Ada source code file containing a library unit body (a subprogram or
1370 package body). Such files are also called @dfn{bodies}.
1372 @c GCC also knows about some suffixes for languages not yet included:
1383 @itemx @var{file}.sx
1384 Assembler code that must be preprocessed.
1387 An object file to be fed straight into linking.
1388 Any file name with no recognized suffix is treated this way.
1392 You can specify the input language explicitly with the @option{-x} option:
1395 @item -x @var{language}
1396 Specify explicitly the @var{language} for the following input files
1397 (rather than letting the compiler choose a default based on the file
1398 name suffix). This option applies to all following input files until
1399 the next @option{-x} option. Possible values for @var{language} are:
1401 c c-header cpp-output
1402 c++ c++-header c++-cpp-output
1403 objective-c objective-c-header objective-c-cpp-output
1404 objective-c++ objective-c++-header objective-c++-cpp-output
1405 assembler assembler-with-cpp
1407 f77 f77-cpp-input f95 f95-cpp-input
1413 Turn off any specification of a language, so that subsequent files are
1414 handled according to their file name suffixes (as they are if @option{-x}
1415 has not been used at all).
1418 If you only want some of the stages of compilation, you can use
1419 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1420 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1421 @command{gcc} is to stop. Note that some combinations (for example,
1422 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1427 Compile or assemble the source files, but do not link. The linking
1428 stage simply is not done. The ultimate output is in the form of an
1429 object file for each source file.
1431 By default, the object file name for a source file is made by replacing
1432 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1434 Unrecognized input files, not requiring compilation or assembly, are
1439 Stop after the stage of compilation proper; do not assemble. The output
1440 is in the form of an assembler code file for each non-assembler input
1443 By default, the assembler file name for a source file is made by
1444 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1446 Input files that don't require compilation are ignored.
1450 Stop after the preprocessing stage; do not run the compiler proper. The
1451 output is in the form of preprocessed source code, which is sent to the
1454 Input files that don't require preprocessing are ignored.
1456 @cindex output file option
1459 Place output in file @var{file}. This applies to whatever
1460 sort of output is being produced, whether it be an executable file,
1461 an object file, an assembler file or preprocessed C code.
1463 If @option{-o} is not specified, the default is to put an executable
1464 file in @file{a.out}, the object file for
1465 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1466 assembler file in @file{@var{source}.s}, a precompiled header file in
1467 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1472 Print (on standard error output) the commands executed to run the stages
1473 of compilation. Also print the version number of the compiler driver
1474 program and of the preprocessor and the compiler proper.
1478 Like @option{-v} except the commands are not executed and arguments
1479 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1480 This is useful for shell scripts to capture the driver-generated command lines.
1484 Print (on the standard output) a description of the command-line options
1485 understood by @command{gcc}. If the @option{-v} option is also specified
1486 then @option{--help} is also passed on to the various processes
1487 invoked by @command{gcc}, so that they can display the command-line options
1488 they accept. If the @option{-Wextra} option has also been specified
1489 (prior to the @option{--help} option), then command-line options that
1490 have no documentation associated with them are also displayed.
1493 @opindex target-help
1494 Print (on the standard output) a description of target-specific command-line
1495 options for each tool. For some targets extra target-specific
1496 information may also be printed.
1498 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1499 Print (on the standard output) a description of the command-line
1500 options understood by the compiler that fit into all specified classes
1501 and qualifiers. These are the supported classes:
1504 @item @samp{optimizers}
1505 Display all of the optimization options supported by the
1508 @item @samp{warnings}
1509 Display all of the options controlling warning messages
1510 produced by the compiler.
1513 Display target-specific options. Unlike the
1514 @option{--target-help} option however, target-specific options of the
1515 linker and assembler are not displayed. This is because those
1516 tools do not currently support the extended @option{--help=} syntax.
1519 Display the values recognized by the @option{--param}
1522 @item @var{language}
1523 Display the options supported for @var{language}, where
1524 @var{language} is the name of one of the languages supported in this
1528 Display the options that are common to all languages.
1531 These are the supported qualifiers:
1534 @item @samp{undocumented}
1535 Display only those options that are undocumented.
1538 Display options taking an argument that appears after an equal
1539 sign in the same continuous piece of text, such as:
1540 @samp{--help=target}.
1542 @item @samp{separate}
1543 Display options taking an argument that appears as a separate word
1544 following the original option, such as: @samp{-o output-file}.
1547 Thus for example to display all the undocumented target-specific
1548 switches supported by the compiler, use:
1551 --help=target,undocumented
1554 The sense of a qualifier can be inverted by prefixing it with the
1555 @samp{^} character, so for example to display all binary warning
1556 options (i.e., ones that are either on or off and that do not take an
1557 argument) that have a description, use:
1560 --help=warnings,^joined,^undocumented
1563 The argument to @option{--help=} should not consist solely of inverted
1566 Combining several classes is possible, although this usually
1567 restricts the output so much that there is nothing to display. One
1568 case where it does work, however, is when one of the classes is
1569 @var{target}. For example, to display all the target-specific
1570 optimization options, use:
1573 --help=target,optimizers
1576 The @option{--help=} option can be repeated on the command line. Each
1577 successive use displays its requested class of options, skipping
1578 those that have already been displayed.
1580 If the @option{-Q} option appears on the command line before the
1581 @option{--help=} option, then the descriptive text displayed by
1582 @option{--help=} is changed. Instead of describing the displayed
1583 options, an indication is given as to whether the option is enabled,
1584 disabled or set to a specific value (assuming that the compiler
1585 knows this at the point where the @option{--help=} option is used).
1587 Here is a truncated example from the ARM port of @command{gcc}:
1590 % gcc -Q -mabi=2 --help=target -c
1591 The following options are target specific:
1593 -mabort-on-noreturn [disabled]
1597 The output is sensitive to the effects of previous command-line
1598 options, so for example it is possible to find out which optimizations
1599 are enabled at @option{-O2} by using:
1602 -Q -O2 --help=optimizers
1605 Alternatively you can discover which binary optimizations are enabled
1606 by @option{-O3} by using:
1609 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1610 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1611 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1616 Display the version number and copyrights of the invoked GCC@.
1618 @item -pass-exit-codes
1619 @opindex pass-exit-codes
1620 Normally the @command{gcc} program exits with the code of 1 if any
1621 phase of the compiler returns a non-success return code. If you specify
1622 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1623 the numerically highest error produced by any phase returning an error
1624 indication. The C, C++, and Fortran front ends return 4 if an internal
1625 compiler error is encountered.
1629 Use pipes rather than temporary files for communication between the
1630 various stages of compilation. This fails to work on some systems where
1631 the assembler is unable to read from a pipe; but the GNU assembler has
1634 @item -specs=@var{file}
1636 Process @var{file} after the compiler reads in the standard @file{specs}
1637 file, in order to override the defaults which the @command{gcc} driver
1638 program uses when determining what switches to pass to @command{cc1},
1639 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1640 @option{-specs=@var{file}} can be specified on the command line, and they
1641 are processed in order, from left to right. @xref{Spec Files}, for
1642 information about the format of the @var{file}.
1646 Invoke all subcommands under a wrapper program. The name of the
1647 wrapper program and its parameters are passed as a comma separated
1651 gcc -c t.c -wrapper gdb,--args
1655 This invokes all subprograms of @command{gcc} under
1656 @samp{gdb --args}, thus the invocation of @command{cc1} is
1657 @samp{gdb --args cc1 @dots{}}.
1659 @item -fplugin=@var{name}.so
1661 Load the plugin code in file @var{name}.so, assumed to be a
1662 shared object to be dlopen'd by the compiler. The base name of
1663 the shared object file is used to identify the plugin for the
1664 purposes of argument parsing (See
1665 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1666 Each plugin should define the callback functions specified in the
1669 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1670 @opindex fplugin-arg
1671 Define an argument called @var{key} with a value of @var{value}
1672 for the plugin called @var{name}.
1674 @item -fdump-ada-spec@r{[}-slim@r{]}
1675 @opindex fdump-ada-spec
1676 For C and C++ source and include files, generate corresponding Ada specs.
1677 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1678 GNAT User's Guide}, which provides detailed documentation on this feature.
1680 @item -fada-spec-parent=@var{unit}
1681 @opindex fada-spec-parent
1682 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1683 Ada specs as child units of parent @var{unit}.
1685 @item -fdump-go-spec=@var{file}
1686 @opindex fdump-go-spec
1687 For input files in any language, generate corresponding Go
1688 declarations in @var{file}. This generates Go @code{const},
1689 @code{type}, @code{var}, and @code{func} declarations which may be a
1690 useful way to start writing a Go interface to code written in some
1693 @include @value{srcdir}/../libiberty/at-file.texi
1697 @section Compiling C++ Programs
1699 @cindex suffixes for C++ source
1700 @cindex C++ source file suffixes
1701 C++ source files conventionally use one of the suffixes @samp{.C},
1702 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1703 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1704 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1705 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1706 files with these names and compiles them as C++ programs even if you
1707 call the compiler the same way as for compiling C programs (usually
1708 with the name @command{gcc}).
1712 However, the use of @command{gcc} does not add the C++ library.
1713 @command{g++} is a program that calls GCC and automatically specifies linking
1714 against the C++ library. It treats @samp{.c},
1715 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1716 files unless @option{-x} is used. This program is also useful when
1717 precompiling a C header file with a @samp{.h} extension for use in C++
1718 compilations. On many systems, @command{g++} is also installed with
1719 the name @command{c++}.
1721 @cindex invoking @command{g++}
1722 When you compile C++ programs, you may specify many of the same
1723 command-line options that you use for compiling programs in any
1724 language; or command-line options meaningful for C and related
1725 languages; or options that are meaningful only for C++ programs.
1726 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1727 explanations of options for languages related to C@.
1728 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1729 explanations of options that are meaningful only for C++ programs.
1731 @node C Dialect Options
1732 @section Options Controlling C Dialect
1733 @cindex dialect options
1734 @cindex language dialect options
1735 @cindex options, dialect
1737 The following options control the dialect of C (or languages derived
1738 from C, such as C++, Objective-C and Objective-C++) that the compiler
1742 @cindex ANSI support
1746 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1747 equivalent to @option{-std=c++98}.
1749 This turns off certain features of GCC that are incompatible with ISO
1750 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1751 such as the @code{asm} and @code{typeof} keywords, and
1752 predefined macros such as @code{unix} and @code{vax} that identify the
1753 type of system you are using. It also enables the undesirable and
1754 rarely used ISO trigraph feature. For the C compiler,
1755 it disables recognition of C++ style @samp{//} comments as well as
1756 the @code{inline} keyword.
1758 The alternate keywords @code{__asm__}, @code{__extension__},
1759 @code{__inline__} and @code{__typeof__} continue to work despite
1760 @option{-ansi}. You would not want to use them in an ISO C program, of
1761 course, but it is useful to put them in header files that might be included
1762 in compilations done with @option{-ansi}. Alternate predefined macros
1763 such as @code{__unix__} and @code{__vax__} are also available, with or
1764 without @option{-ansi}.
1766 The @option{-ansi} option does not cause non-ISO programs to be
1767 rejected gratuitously. For that, @option{-Wpedantic} is required in
1768 addition to @option{-ansi}. @xref{Warning Options}.
1770 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1771 option is used. Some header files may notice this macro and refrain
1772 from declaring certain functions or defining certain macros that the
1773 ISO standard doesn't call for; this is to avoid interfering with any
1774 programs that might use these names for other things.
1776 Functions that are normally built in but do not have semantics
1777 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1778 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1779 built-in functions provided by GCC}, for details of the functions
1784 Determine the language standard. @xref{Standards,,Language Standards
1785 Supported by GCC}, for details of these standard versions. This option
1786 is currently only supported when compiling C or C++.
1788 The compiler can accept several base standards, such as @samp{c90} or
1789 @samp{c++98}, and GNU dialects of those standards, such as
1790 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1791 compiler accepts all programs following that standard plus those
1792 using GNU extensions that do not contradict it. For example,
1793 @option{-std=c90} turns off certain features of GCC that are
1794 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1795 keywords, but not other GNU extensions that do not have a meaning in
1796 ISO C90, such as omitting the middle term of a @code{?:}
1797 expression. On the other hand, when a GNU dialect of a standard is
1798 specified, all features supported by the compiler are enabled, even when
1799 those features change the meaning of the base standard. As a result, some
1800 strict-conforming programs may be rejected. The particular standard
1801 is used by @option{-Wpedantic} to identify which features are GNU
1802 extensions given that version of the standard. For example
1803 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1804 comments, while @option{-std=gnu99 -Wpedantic} does not.
1806 A value for this option must be provided; possible values are
1812 Support all ISO C90 programs (certain GNU extensions that conflict
1813 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1815 @item iso9899:199409
1816 ISO C90 as modified in amendment 1.
1822 ISO C99. This standard is substantially completely supported, modulo
1823 bugs and floating-point issues
1824 (mainly but not entirely relating to optional C99 features from
1825 Annexes F and G). See
1826 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1827 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1832 ISO C11, the 2011 revision of the ISO C standard. This standard is
1833 substantially completely supported, modulo bugs, floating-point issues
1834 (mainly but not entirely relating to optional C11 features from
1835 Annexes F and G) and the optional Annexes K (Bounds-checking
1836 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1842 ISO C17, the 2017 revision of the ISO C standard (expected to be
1843 published in 2018). This standard is
1844 same as C11 except for corrections of defects (all of which are also
1845 applied with @option{-std=c11}) and a new value of
1846 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1850 GNU dialect of ISO C90 (including some C99 features).
1854 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1858 GNU dialect of ISO C11.
1859 The name @samp{gnu1x} is deprecated.
1863 GNU dialect of ISO C17. This is the default for C code.
1867 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1868 additional defect reports. Same as @option{-ansi} for C++ code.
1872 GNU dialect of @option{-std=c++98}.
1876 The 2011 ISO C++ standard plus amendments.
1877 The name @samp{c++0x} is deprecated.
1881 GNU dialect of @option{-std=c++11}.
1882 The name @samp{gnu++0x} is deprecated.
1886 The 2014 ISO C++ standard plus amendments.
1887 The name @samp{c++1y} is deprecated.
1891 GNU dialect of @option{-std=c++14}.
1892 This is the default for C++ code.
1893 The name @samp{gnu++1y} is deprecated.
1897 The 2017 ISO C++ standard plus amendments.
1898 The name @samp{c++1z} is deprecated.
1902 GNU dialect of @option{-std=c++17}.
1903 The name @samp{gnu++1z} is deprecated.
1906 The next revision of the ISO C++ standard, tentatively planned for
1907 2020. Support is highly experimental, and will almost certainly
1908 change in incompatible ways in future releases.
1911 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
1912 and will almost certainly change in incompatible ways in future
1916 @item -fgnu89-inline
1917 @opindex fgnu89-inline
1918 The option @option{-fgnu89-inline} tells GCC to use the traditional
1919 GNU semantics for @code{inline} functions when in C99 mode.
1920 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1921 Using this option is roughly equivalent to adding the
1922 @code{gnu_inline} function attribute to all inline functions
1923 (@pxref{Function Attributes}).
1925 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1926 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1927 specifies the default behavior).
1928 This option is not supported in @option{-std=c90} or
1929 @option{-std=gnu90} mode.
1931 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1932 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1933 in effect for @code{inline} functions. @xref{Common Predefined
1934 Macros,,,cpp,The C Preprocessor}.
1936 @item -fpermitted-flt-eval-methods=@var{style}
1937 @opindex fpermitted-flt-eval-methods
1938 @opindex fpermitted-flt-eval-methods=c11
1939 @opindex fpermitted-flt-eval-methods=ts-18661-3
1940 ISO/IEC TS 18661-3 defines new permissible values for
1941 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
1942 a semantic type that is an interchange or extended format should be
1943 evaluated to the precision and range of that type. These new values are
1944 a superset of those permitted under C99/C11, which does not specify the
1945 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
1946 conforming to C11 may not have been written expecting the possibility of
1949 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
1950 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
1951 or the extended set of values specified in ISO/IEC TS 18661-3.
1953 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
1955 The default when in a standards compliant mode (@option{-std=c11} or similar)
1956 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
1957 dialect (@option{-std=gnu11} or similar) is
1958 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
1960 @item -aux-info @var{filename}
1962 Output to the given filename prototyped declarations for all functions
1963 declared and/or defined in a translation unit, including those in header
1964 files. This option is silently ignored in any language other than C@.
1966 Besides declarations, the file indicates, in comments, the origin of
1967 each declaration (source file and line), whether the declaration was
1968 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1969 @samp{O} for old, respectively, in the first character after the line
1970 number and the colon), and whether it came from a declaration or a
1971 definition (@samp{C} or @samp{F}, respectively, in the following
1972 character). In the case of function definitions, a K&R-style list of
1973 arguments followed by their declarations is also provided, inside
1974 comments, after the declaration.
1976 @item -fallow-parameterless-variadic-functions
1977 @opindex fallow-parameterless-variadic-functions
1978 Accept variadic functions without named parameters.
1980 Although it is possible to define such a function, this is not very
1981 useful as it is not possible to read the arguments. This is only
1982 supported for C as this construct is allowed by C++.
1986 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1987 keyword, so that code can use these words as identifiers. You can use
1988 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1989 instead. @option{-ansi} implies @option{-fno-asm}.
1991 In C++, this switch only affects the @code{typeof} keyword, since
1992 @code{asm} and @code{inline} are standard keywords. You may want to
1993 use the @option{-fno-gnu-keywords} flag instead, which has the same
1994 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1995 switch only affects the @code{asm} and @code{typeof} keywords, since
1996 @code{inline} is a standard keyword in ISO C99.
1999 @itemx -fno-builtin-@var{function}
2000 @opindex fno-builtin
2001 @cindex built-in functions
2002 Don't recognize built-in functions that do not begin with
2003 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2004 functions provided by GCC}, for details of the functions affected,
2005 including those which are not built-in functions when @option{-ansi} or
2006 @option{-std} options for strict ISO C conformance are used because they
2007 do not have an ISO standard meaning.
2009 GCC normally generates special code to handle certain built-in functions
2010 more efficiently; for instance, calls to @code{alloca} may become single
2011 instructions which adjust the stack directly, and calls to @code{memcpy}
2012 may become inline copy loops. The resulting code is often both smaller
2013 and faster, but since the function calls no longer appear as such, you
2014 cannot set a breakpoint on those calls, nor can you change the behavior
2015 of the functions by linking with a different library. In addition,
2016 when a function is recognized as a built-in function, GCC may use
2017 information about that function to warn about problems with calls to
2018 that function, or to generate more efficient code, even if the
2019 resulting code still contains calls to that function. For example,
2020 warnings are given with @option{-Wformat} for bad calls to
2021 @code{printf} when @code{printf} is built in and @code{strlen} is
2022 known not to modify global memory.
2024 With the @option{-fno-builtin-@var{function}} option
2025 only the built-in function @var{function} is
2026 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2027 function is named that is not built-in in this version of GCC, this
2028 option is ignored. There is no corresponding
2029 @option{-fbuiltin-@var{function}} option; if you wish to enable
2030 built-in functions selectively when using @option{-fno-builtin} or
2031 @option{-ffreestanding}, you may define macros such as:
2034 #define abs(n) __builtin_abs ((n))
2035 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2041 Enable parsing of function definitions marked with @code{__GIMPLE}.
2042 This is an experimental feature that allows unit testing of GIMPLE
2047 @cindex hosted environment
2049 Assert that compilation targets a hosted environment. This implies
2050 @option{-fbuiltin}. A hosted environment is one in which the
2051 entire standard library is available, and in which @code{main} has a return
2052 type of @code{int}. Examples are nearly everything except a kernel.
2053 This is equivalent to @option{-fno-freestanding}.
2055 @item -ffreestanding
2056 @opindex ffreestanding
2057 @cindex hosted environment
2059 Assert that compilation targets a freestanding environment. This
2060 implies @option{-fno-builtin}. A freestanding environment
2061 is one in which the standard library may not exist, and program startup may
2062 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2063 This is equivalent to @option{-fno-hosted}.
2065 @xref{Standards,,Language Standards Supported by GCC}, for details of
2066 freestanding and hosted environments.
2070 @cindex OpenACC accelerator programming
2071 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2072 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2073 compiler generates accelerated code according to the OpenACC Application
2074 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2075 implies @option{-pthread}, and thus is only supported on targets that
2076 have support for @option{-pthread}.
2078 @item -fopenacc-dim=@var{geom}
2079 @opindex fopenacc-dim
2080 @cindex OpenACC accelerator programming
2081 Specify default compute dimensions for parallel offload regions that do
2082 not explicitly specify. The @var{geom} value is a triple of
2083 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2084 can be omitted, to use a target-specific default value.
2088 @cindex OpenMP parallel
2089 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2090 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2091 compiler generates parallel code according to the OpenMP Application
2092 Program Interface v4.5 @w{@uref{http://www.openmp.org/}}. This option
2093 implies @option{-pthread}, and thus is only supported on targets that
2094 have support for @option{-pthread}. @option{-fopenmp} implies
2095 @option{-fopenmp-simd}.
2098 @opindex fopenmp-simd
2101 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2102 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2107 When the option @option{-fgnu-tm} is specified, the compiler
2108 generates code for the Linux variant of Intel's current Transactional
2109 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2110 an experimental feature whose interface may change in future versions
2111 of GCC, as the official specification changes. Please note that not
2112 all architectures are supported for this feature.
2114 For more information on GCC's support for transactional memory,
2115 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2116 Transactional Memory Library}.
2118 Note that the transactional memory feature is not supported with
2119 non-call exceptions (@option{-fnon-call-exceptions}).
2121 @item -fms-extensions
2122 @opindex fms-extensions
2123 Accept some non-standard constructs used in Microsoft header files.
2125 In C++ code, this allows member names in structures to be similar
2126 to previous types declarations.
2135 Some cases of unnamed fields in structures and unions are only
2136 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2137 fields within structs/unions}, for details.
2139 Note that this option is off for all targets but x86
2140 targets using ms-abi.
2142 @item -fplan9-extensions
2143 @opindex fplan9-extensions
2144 Accept some non-standard constructs used in Plan 9 code.
2146 This enables @option{-fms-extensions}, permits passing pointers to
2147 structures with anonymous fields to functions that expect pointers to
2148 elements of the type of the field, and permits referring to anonymous
2149 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2150 struct/union fields within structs/unions}, for details. This is only
2151 supported for C, not C++.
2153 @item -fcond-mismatch
2154 @opindex fcond-mismatch
2155 Allow conditional expressions with mismatched types in the second and
2156 third arguments. The value of such an expression is void. This option
2157 is not supported for C++.
2159 @item -flax-vector-conversions
2160 @opindex flax-vector-conversions
2161 Allow implicit conversions between vectors with differing numbers of
2162 elements and/or incompatible element types. This option should not be
2165 @item -funsigned-char
2166 @opindex funsigned-char
2167 Let the type @code{char} be unsigned, like @code{unsigned char}.
2169 Each kind of machine has a default for what @code{char} should
2170 be. It is either like @code{unsigned char} by default or like
2171 @code{signed char} by default.
2173 Ideally, a portable program should always use @code{signed char} or
2174 @code{unsigned char} when it depends on the signedness of an object.
2175 But many programs have been written to use plain @code{char} and
2176 expect it to be signed, or expect it to be unsigned, depending on the
2177 machines they were written for. This option, and its inverse, let you
2178 make such a program work with the opposite default.
2180 The type @code{char} is always a distinct type from each of
2181 @code{signed char} or @code{unsigned char}, even though its behavior
2182 is always just like one of those two.
2185 @opindex fsigned-char
2186 Let the type @code{char} be signed, like @code{signed char}.
2188 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2189 the negative form of @option{-funsigned-char}. Likewise, the option
2190 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2192 @item -fsigned-bitfields
2193 @itemx -funsigned-bitfields
2194 @itemx -fno-signed-bitfields
2195 @itemx -fno-unsigned-bitfields
2196 @opindex fsigned-bitfields
2197 @opindex funsigned-bitfields
2198 @opindex fno-signed-bitfields
2199 @opindex fno-unsigned-bitfields
2200 These options control whether a bit-field is signed or unsigned, when the
2201 declaration does not use either @code{signed} or @code{unsigned}. By
2202 default, such a bit-field is signed, because this is consistent: the
2203 basic integer types such as @code{int} are signed types.
2205 @item -fsso-struct=@var{endianness}
2206 @opindex fsso-struct
2207 Set the default scalar storage order of structures and unions to the
2208 specified endianness. The accepted values are @samp{big-endian},
2209 @samp{little-endian} and @samp{native} for the native endianness of
2210 the target (the default). This option is not supported for C++.
2212 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2213 code that is not binary compatible with code generated without it if the
2214 specified endianness is not the native endianness of the target.
2217 @node C++ Dialect Options
2218 @section Options Controlling C++ Dialect
2220 @cindex compiler options, C++
2221 @cindex C++ options, command-line
2222 @cindex options, C++
2223 This section describes the command-line options that are only meaningful
2224 for C++ programs. You can also use most of the GNU compiler options
2225 regardless of what language your program is in. For example, you
2226 might compile a file @file{firstClass.C} like this:
2229 g++ -g -fstrict-enums -O -c firstClass.C
2233 In this example, only @option{-fstrict-enums} is an option meant
2234 only for C++ programs; you can use the other options with any
2235 language supported by GCC@.
2237 Some options for compiling C programs, such as @option{-std}, are also
2238 relevant for C++ programs.
2239 @xref{C Dialect Options,,Options Controlling C Dialect}.
2241 Here is a list of options that are @emph{only} for compiling C++ programs:
2245 @item -fabi-version=@var{n}
2246 @opindex fabi-version
2247 Use version @var{n} of the C++ ABI@. The default is version 0.
2249 Version 0 refers to the version conforming most closely to
2250 the C++ ABI specification. Therefore, the ABI obtained using version 0
2251 will change in different versions of G++ as ABI bugs are fixed.
2253 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2255 Version 2 is the version of the C++ ABI that first appeared in G++
2256 3.4, and was the default through G++ 4.9.
2258 Version 3 corrects an error in mangling a constant address as a
2261 Version 4, which first appeared in G++ 4.5, implements a standard
2262 mangling for vector types.
2264 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2265 attribute const/volatile on function pointer types, decltype of a
2266 plain decl, and use of a function parameter in the declaration of
2269 Version 6, which first appeared in G++ 4.7, corrects the promotion
2270 behavior of C++11 scoped enums and the mangling of template argument
2271 packs, const/static_cast, prefix ++ and --, and a class scope function
2272 used as a template argument.
2274 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2275 builtin type and corrects the mangling of lambdas in default argument
2278 Version 8, which first appeared in G++ 4.9, corrects the substitution
2279 behavior of function types with function-cv-qualifiers.
2281 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2284 Version 10, which first appeared in G++ 6.1, adds mangling of
2285 attributes that affect type identity, such as ia32 calling convention
2286 attributes (e.g. @samp{stdcall}).
2288 Version 11, which first appeared in G++ 7, corrects the mangling of
2289 sizeof... expressions and operator names. For multiple entities with
2290 the same name within a function, that are declared in different scopes,
2291 the mangling now changes starting with the twelfth occurrence. It also
2292 implies @option{-fnew-inheriting-ctors}.
2294 See also @option{-Wabi}.
2296 @item -fabi-compat-version=@var{n}
2297 @opindex fabi-compat-version
2298 On targets that support strong aliases, G++
2299 works around mangling changes by creating an alias with the correct
2300 mangled name when defining a symbol with an incorrect mangled name.
2301 This switch specifies which ABI version to use for the alias.
2303 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2304 compatibility). If another ABI version is explicitly selected, this
2305 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2306 use @option{-fabi-compat-version=2}.
2308 If this option is not provided but @option{-Wabi=@var{n}} is, that
2309 version is used for compatibility aliases. If this option is provided
2310 along with @option{-Wabi} (without the version), the version from this
2311 option is used for the warning.
2313 @item -fno-access-control
2314 @opindex fno-access-control
2315 Turn off all access checking. This switch is mainly useful for working
2316 around bugs in the access control code.
2319 @opindex faligned-new
2320 Enable support for C++17 @code{new} of types that require more
2321 alignment than @code{void* ::operator new(std::size_t)} provides. A
2322 numeric argument such as @code{-faligned-new=32} can be used to
2323 specify how much alignment (in bytes) is provided by that function,
2324 but few users will need to override the default of
2325 @code{alignof(std::max_align_t)}.
2327 This flag is enabled by default for @option{-std=c++17}.
2331 Check that the pointer returned by @code{operator new} is non-null
2332 before attempting to modify the storage allocated. This check is
2333 normally unnecessary because the C++ standard specifies that
2334 @code{operator new} only returns @code{0} if it is declared
2335 @code{throw()}, in which case the compiler always checks the
2336 return value even without this option. In all other cases, when
2337 @code{operator new} has a non-empty exception specification, memory
2338 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2339 @samp{new (nothrow)}.
2343 Enable support for the C++ Extensions for Concepts Technical
2344 Specification, ISO 19217 (2015), which allows code like
2347 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2348 template <Addable T> T add (T a, T b) @{ return a + b; @}
2351 @item -fconstexpr-depth=@var{n}
2352 @opindex fconstexpr-depth
2353 Set the maximum nested evaluation depth for C++11 constexpr functions
2354 to @var{n}. A limit is needed to detect endless recursion during
2355 constant expression evaluation. The minimum specified by the standard
2358 @item -fconstexpr-loop-limit=@var{n}
2359 @opindex fconstexpr-loop-limit
2360 Set the maximum number of iterations for a loop in C++14 constexpr functions
2361 to @var{n}. A limit is needed to detect infinite loops during
2362 constant expression evaluation. The default is 262144 (1<<18).
2364 @item -fdeduce-init-list
2365 @opindex fdeduce-init-list
2366 Enable deduction of a template type parameter as
2367 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2370 template <class T> auto forward(T t) -> decltype (realfn (t))
2377 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2381 This deduction was implemented as a possible extension to the
2382 originally proposed semantics for the C++11 standard, but was not part
2383 of the final standard, so it is disabled by default. This option is
2384 deprecated, and may be removed in a future version of G++.
2386 @item -ffriend-injection
2387 @opindex ffriend-injection
2388 Inject friend functions into the enclosing namespace, so that they are
2389 visible outside the scope of the class in which they are declared.
2390 Friend functions were documented to work this way in the old Annotated
2391 C++ Reference Manual.
2392 However, in ISO C++ a friend function that is not declared
2393 in an enclosing scope can only be found using argument dependent
2394 lookup. GCC defaults to the standard behavior.
2396 This option is for compatibility, and may be removed in a future
2399 @item -fno-elide-constructors
2400 @opindex fno-elide-constructors
2401 The C++ standard allows an implementation to omit creating a temporary
2402 that is only used to initialize another object of the same type.
2403 Specifying this option disables that optimization, and forces G++ to
2404 call the copy constructor in all cases. This option also causes G++
2405 to call trivial member functions which otherwise would be expanded inline.
2407 In C++17, the compiler is required to omit these temporaries, but this
2408 option still affects trivial member functions.
2410 @item -fno-enforce-eh-specs
2411 @opindex fno-enforce-eh-specs
2412 Don't generate code to check for violation of exception specifications
2413 at run time. This option violates the C++ standard, but may be useful
2414 for reducing code size in production builds, much like defining
2415 @code{NDEBUG}. This does not give user code permission to throw
2416 exceptions in violation of the exception specifications; the compiler
2417 still optimizes based on the specifications, so throwing an
2418 unexpected exception results in undefined behavior at run time.
2420 @item -fextern-tls-init
2421 @itemx -fno-extern-tls-init
2422 @opindex fextern-tls-init
2423 @opindex fno-extern-tls-init
2424 The C++11 and OpenMP standards allow @code{thread_local} and
2425 @code{threadprivate} variables to have dynamic (runtime)
2426 initialization. To support this, any use of such a variable goes
2427 through a wrapper function that performs any necessary initialization.
2428 When the use and definition of the variable are in the same
2429 translation unit, this overhead can be optimized away, but when the
2430 use is in a different translation unit there is significant overhead
2431 even if the variable doesn't actually need dynamic initialization. If
2432 the programmer can be sure that no use of the variable in a
2433 non-defining TU needs to trigger dynamic initialization (either
2434 because the variable is statically initialized, or a use of the
2435 variable in the defining TU will be executed before any uses in
2436 another TU), they can avoid this overhead with the
2437 @option{-fno-extern-tls-init} option.
2439 On targets that support symbol aliases, the default is
2440 @option{-fextern-tls-init}. On targets that do not support symbol
2441 aliases, the default is @option{-fno-extern-tls-init}.
2444 @itemx -fno-for-scope
2446 @opindex fno-for-scope
2447 If @option{-ffor-scope} is specified, the scope of variables declared in
2448 a @i{for-init-statement} is limited to the @code{for} loop itself,
2449 as specified by the C++ standard.
2450 If @option{-fno-for-scope} is specified, the scope of variables declared in
2451 a @i{for-init-statement} extends to the end of the enclosing scope,
2452 as was the case in old versions of G++, and other (traditional)
2453 implementations of C++.
2455 If neither flag is given, the default is to follow the standard,
2456 but to allow and give a warning for old-style code that would
2457 otherwise be invalid, or have different behavior.
2459 @item -fno-gnu-keywords
2460 @opindex fno-gnu-keywords
2461 Do not recognize @code{typeof} as a keyword, so that code can use this
2462 word as an identifier. You can use the keyword @code{__typeof__} instead.
2463 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2464 @option{-std=c++98}, @option{-std=c++11}, etc.
2466 @item -fno-implicit-templates
2467 @opindex fno-implicit-templates
2468 Never emit code for non-inline templates that are instantiated
2469 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2470 @xref{Template Instantiation}, for more information.
2472 @item -fno-implicit-inline-templates
2473 @opindex fno-implicit-inline-templates
2474 Don't emit code for implicit instantiations of inline templates, either.
2475 The default is to handle inlines differently so that compiles with and
2476 without optimization need the same set of explicit instantiations.
2478 @item -fno-implement-inlines
2479 @opindex fno-implement-inlines
2480 To save space, do not emit out-of-line copies of inline functions
2481 controlled by @code{#pragma implementation}. This causes linker
2482 errors if these functions are not inlined everywhere they are called.
2484 @item -fms-extensions
2485 @opindex fms-extensions
2486 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2487 int and getting a pointer to member function via non-standard syntax.
2489 @item -fnew-inheriting-ctors
2490 @opindex fnew-inheriting-ctors
2491 Enable the P0136 adjustment to the semantics of C++11 constructor
2492 inheritance. This is part of C++17 but also considered to be a Defect
2493 Report against C++11 and C++14. This flag is enabled by default
2494 unless @option{-fabi-version=10} or lower is specified.
2496 @item -fnew-ttp-matching
2497 @opindex fnew-ttp-matching
2498 Enable the P0522 resolution to Core issue 150, template template
2499 parameters and default arguments: this allows a template with default
2500 template arguments as an argument for a template template parameter
2501 with fewer template parameters. This flag is enabled by default for
2502 @option{-std=c++17}.
2504 @item -fno-nonansi-builtins
2505 @opindex fno-nonansi-builtins
2506 Disable built-in declarations of functions that are not mandated by
2507 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2508 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2511 @opindex fnothrow-opt
2512 Treat a @code{throw()} exception specification as if it were a
2513 @code{noexcept} specification to reduce or eliminate the text size
2514 overhead relative to a function with no exception specification. If
2515 the function has local variables of types with non-trivial
2516 destructors, the exception specification actually makes the
2517 function smaller because the EH cleanups for those variables can be
2518 optimized away. The semantic effect is that an exception thrown out of
2519 a function with such an exception specification results in a call
2520 to @code{terminate} rather than @code{unexpected}.
2522 @item -fno-operator-names
2523 @opindex fno-operator-names
2524 Do not treat the operator name keywords @code{and}, @code{bitand},
2525 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2526 synonyms as keywords.
2528 @item -fno-optional-diags
2529 @opindex fno-optional-diags
2530 Disable diagnostics that the standard says a compiler does not need to
2531 issue. Currently, the only such diagnostic issued by G++ is the one for
2532 a name having multiple meanings within a class.
2535 @opindex fpermissive
2536 Downgrade some diagnostics about nonconformant code from errors to
2537 warnings. Thus, using @option{-fpermissive} allows some
2538 nonconforming code to compile.
2540 @item -fno-pretty-templates
2541 @opindex fno-pretty-templates
2542 When an error message refers to a specialization of a function
2543 template, the compiler normally prints the signature of the
2544 template followed by the template arguments and any typedefs or
2545 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2546 rather than @code{void f(int)}) so that it's clear which template is
2547 involved. When an error message refers to a specialization of a class
2548 template, the compiler omits any template arguments that match
2549 the default template arguments for that template. If either of these
2550 behaviors make it harder to understand the error message rather than
2551 easier, you can use @option{-fno-pretty-templates} to disable them.
2555 Enable automatic template instantiation at link time. This option also
2556 implies @option{-fno-implicit-templates}. @xref{Template
2557 Instantiation}, for more information.
2561 Disable generation of information about every class with virtual
2562 functions for use by the C++ run-time type identification features
2563 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2564 of the language, you can save some space by using this flag. Note that
2565 exception handling uses the same information, but G++ generates it as
2566 needed. The @code{dynamic_cast} operator can still be used for casts that
2567 do not require run-time type information, i.e.@: casts to @code{void *} or to
2568 unambiguous base classes.
2570 @item -fsized-deallocation
2571 @opindex fsized-deallocation
2572 Enable the built-in global declarations
2574 void operator delete (void *, std::size_t) noexcept;
2575 void operator delete[] (void *, std::size_t) noexcept;
2577 as introduced in C++14. This is useful for user-defined replacement
2578 deallocation functions that, for example, use the size of the object
2579 to make deallocation faster. Enabled by default under
2580 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2581 warns about places that might want to add a definition.
2583 @item -fstrict-enums
2584 @opindex fstrict-enums
2585 Allow the compiler to optimize using the assumption that a value of
2586 enumerated type can only be one of the values of the enumeration (as
2587 defined in the C++ standard; basically, a value that can be
2588 represented in the minimum number of bits needed to represent all the
2589 enumerators). This assumption may not be valid if the program uses a
2590 cast to convert an arbitrary integer value to the enumerated type.
2592 @item -fstrong-eval-order
2593 @opindex fstrong-eval-order
2594 Evaluate member access, array subscripting, and shift expressions in
2595 left-to-right order, and evaluate assignment in right-to-left order,
2596 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2597 @option{-fstrong-eval-order=some} enables just the ordering of member
2598 access and shift expressions, and is the default without
2599 @option{-std=c++17}.
2601 @item -ftemplate-backtrace-limit=@var{n}
2602 @opindex ftemplate-backtrace-limit
2603 Set the maximum number of template instantiation notes for a single
2604 warning or error to @var{n}. The default value is 10.
2606 @item -ftemplate-depth=@var{n}
2607 @opindex ftemplate-depth
2608 Set the maximum instantiation depth for template classes to @var{n}.
2609 A limit on the template instantiation depth is needed to detect
2610 endless recursions during template class instantiation. ANSI/ISO C++
2611 conforming programs must not rely on a maximum depth greater than 17
2612 (changed to 1024 in C++11). The default value is 900, as the compiler
2613 can run out of stack space before hitting 1024 in some situations.
2615 @item -fno-threadsafe-statics
2616 @opindex fno-threadsafe-statics
2617 Do not emit the extra code to use the routines specified in the C++
2618 ABI for thread-safe initialization of local statics. You can use this
2619 option to reduce code size slightly in code that doesn't need to be
2622 @item -fuse-cxa-atexit
2623 @opindex fuse-cxa-atexit
2624 Register destructors for objects with static storage duration with the
2625 @code{__cxa_atexit} function rather than the @code{atexit} function.
2626 This option is required for fully standards-compliant handling of static
2627 destructors, but only works if your C library supports
2628 @code{__cxa_atexit}.
2630 @item -fno-use-cxa-get-exception-ptr
2631 @opindex fno-use-cxa-get-exception-ptr
2632 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2633 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2634 if the runtime routine is not available.
2636 @item -fvisibility-inlines-hidden
2637 @opindex fvisibility-inlines-hidden
2638 This switch declares that the user does not attempt to compare
2639 pointers to inline functions or methods where the addresses of the two functions
2640 are taken in different shared objects.
2642 The effect of this is that GCC may, effectively, mark inline methods with
2643 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2644 appear in the export table of a DSO and do not require a PLT indirection
2645 when used within the DSO@. Enabling this option can have a dramatic effect
2646 on load and link times of a DSO as it massively reduces the size of the
2647 dynamic export table when the library makes heavy use of templates.
2649 The behavior of this switch is not quite the same as marking the
2650 methods as hidden directly, because it does not affect static variables
2651 local to the function or cause the compiler to deduce that
2652 the function is defined in only one shared object.
2654 You may mark a method as having a visibility explicitly to negate the
2655 effect of the switch for that method. For example, if you do want to
2656 compare pointers to a particular inline method, you might mark it as
2657 having default visibility. Marking the enclosing class with explicit
2658 visibility has no effect.
2660 Explicitly instantiated inline methods are unaffected by this option
2661 as their linkage might otherwise cross a shared library boundary.
2662 @xref{Template Instantiation}.
2664 @item -fvisibility-ms-compat
2665 @opindex fvisibility-ms-compat
2666 This flag attempts to use visibility settings to make GCC's C++
2667 linkage model compatible with that of Microsoft Visual Studio.
2669 The flag makes these changes to GCC's linkage model:
2673 It sets the default visibility to @code{hidden}, like
2674 @option{-fvisibility=hidden}.
2677 Types, but not their members, are not hidden by default.
2680 The One Definition Rule is relaxed for types without explicit
2681 visibility specifications that are defined in more than one
2682 shared object: those declarations are permitted if they are
2683 permitted when this option is not used.
2686 In new code it is better to use @option{-fvisibility=hidden} and
2687 export those classes that are intended to be externally visible.
2688 Unfortunately it is possible for code to rely, perhaps accidentally,
2689 on the Visual Studio behavior.
2691 Among the consequences of these changes are that static data members
2692 of the same type with the same name but defined in different shared
2693 objects are different, so changing one does not change the other;
2694 and that pointers to function members defined in different shared
2695 objects may not compare equal. When this flag is given, it is a
2696 violation of the ODR to define types with the same name differently.
2700 Do not use weak symbol support, even if it is provided by the linker.
2701 By default, G++ uses weak symbols if they are available. This
2702 option exists only for testing, and should not be used by end-users;
2703 it results in inferior code and has no benefits. This option may
2704 be removed in a future release of G++.
2708 Do not search for header files in the standard directories specific to
2709 C++, but do still search the other standard directories. (This option
2710 is used when building the C++ library.)
2713 In addition, these optimization, warning, and code generation options
2714 have meanings only for C++ programs:
2717 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2720 Warn when G++ it generates code that is probably not compatible with
2721 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2722 ABI with each major release, normally @option{-Wabi} will warn only if
2723 there is a check added later in a release series for an ABI issue
2724 discovered since the initial release. @option{-Wabi} will warn about
2725 more things if an older ABI version is selected (with
2726 @option{-fabi-version=@var{n}}).
2728 @option{-Wabi} can also be used with an explicit version number to
2729 warn about compatibility with a particular @option{-fabi-version}
2730 level, e.g. @option{-Wabi=2} to warn about changes relative to
2731 @option{-fabi-version=2}.
2733 If an explicit version number is provided and
2734 @option{-fabi-compat-version} is not specified, the version number
2735 from this option is used for compatibility aliases. If no explicit
2736 version number is provided with this option, but
2737 @option{-fabi-compat-version} is specified, that version number is
2738 used for ABI warnings.
2740 Although an effort has been made to warn about
2741 all such cases, there are probably some cases that are not warned about,
2742 even though G++ is generating incompatible code. There may also be
2743 cases where warnings are emitted even though the code that is generated
2746 You should rewrite your code to avoid these warnings if you are
2747 concerned about the fact that code generated by G++ may not be binary
2748 compatible with code generated by other compilers.
2750 Known incompatibilities in @option{-fabi-version=2} (which was the
2751 default from GCC 3.4 to 4.9) include:
2756 A template with a non-type template parameter of reference type was
2757 mangled incorrectly:
2760 template <int &> struct S @{@};
2764 This was fixed in @option{-fabi-version=3}.
2767 SIMD vector types declared using @code{__attribute ((vector_size))} were
2768 mangled in a non-standard way that does not allow for overloading of
2769 functions taking vectors of different sizes.
2771 The mangling was changed in @option{-fabi-version=4}.
2774 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2775 qualifiers, and @code{decltype} of a plain declaration was folded away.
2777 These mangling issues were fixed in @option{-fabi-version=5}.
2780 Scoped enumerators passed as arguments to a variadic function are
2781 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2782 On most targets this does not actually affect the parameter passing
2783 ABI, as there is no way to pass an argument smaller than @code{int}.
2785 Also, the ABI changed the mangling of template argument packs,
2786 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2787 a class scope function used as a template argument.
2789 These issues were corrected in @option{-fabi-version=6}.
2792 Lambdas in default argument scope were mangled incorrectly, and the
2793 ABI changed the mangling of @code{nullptr_t}.
2795 These issues were corrected in @option{-fabi-version=7}.
2798 When mangling a function type with function-cv-qualifiers, the
2799 un-qualified function type was incorrectly treated as a substitution
2802 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2805 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2806 unaligned accesses. Note that this did not affect the ABI of a
2807 function with a @code{nullptr_t} parameter, as parameters have a
2810 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2813 Target-specific attributes that affect the identity of a type, such as
2814 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2815 did not affect the mangled name, leading to name collisions when
2816 function pointers were used as template arguments.
2818 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2822 It also warns about psABI-related changes. The known psABI changes at this
2828 For SysV/x86-64, unions with @code{long double} members are
2829 passed in memory as specified in psABI. For example:
2839 @code{union U} is always passed in memory.
2843 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2846 Warn when a type with an ABI tag is used in a context that does not
2847 have that ABI tag. See @ref{C++ Attributes} for more information
2850 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2851 @opindex Wctor-dtor-privacy
2852 @opindex Wno-ctor-dtor-privacy
2853 Warn when a class seems unusable because all the constructors or
2854 destructors in that class are private, and it has neither friends nor
2855 public static member functions. Also warn if there are no non-private
2856 methods, and there's at least one private member function that isn't
2857 a constructor or destructor.
2859 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2860 @opindex Wdelete-non-virtual-dtor
2861 @opindex Wno-delete-non-virtual-dtor
2862 Warn when @code{delete} is used to destroy an instance of a class that
2863 has virtual functions and non-virtual destructor. It is unsafe to delete
2864 an instance of a derived class through a pointer to a base class if the
2865 base class does not have a virtual destructor. This warning is enabled
2868 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2869 @opindex Wliteral-suffix
2870 @opindex Wno-literal-suffix
2871 Warn when a string or character literal is followed by a ud-suffix which does
2872 not begin with an underscore. As a conforming extension, GCC treats such
2873 suffixes as separate preprocessing tokens in order to maintain backwards
2874 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2878 #define __STDC_FORMAT_MACROS
2879 #include <inttypes.h>
2884 printf("My int64: %" PRId64"\n", i64);
2888 In this case, @code{PRId64} is treated as a separate preprocessing token.
2890 Additionally, warn when a user-defined literal operator is declared with
2891 a literal suffix identifier that doesn't begin with an underscore. Literal
2892 suffix identifiers that don't begin with an underscore are reserved for
2893 future standardization.
2895 This warning is enabled by default.
2897 @item -Wlto-type-mismatch
2898 @opindex Wlto-type-mismatch
2899 @opindex Wno-lto-type-mismatch
2901 During the link-time optimization warn about type mismatches in
2902 global declarations from different compilation units.
2903 Requires @option{-flto} to be enabled. Enabled by default.
2905 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
2907 @opindex Wno-narrowing
2908 For C++11 and later standards, narrowing conversions are diagnosed by default,
2909 as required by the standard. A narrowing conversion from a constant produces
2910 an error, and a narrowing conversion from a non-constant produces a warning,
2911 but @option{-Wno-narrowing} suppresses the diagnostic.
2912 Note that this does not affect the meaning of well-formed code;
2913 narrowing conversions are still considered ill-formed in SFINAE contexts.
2915 With @option{-Wnarrowing} in C++98, warn when a narrowing
2916 conversion prohibited by C++11 occurs within
2920 int i = @{ 2.2 @}; // error: narrowing from double to int
2923 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2925 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2927 @opindex Wno-noexcept
2928 Warn when a noexcept-expression evaluates to false because of a call
2929 to a function that does not have a non-throwing exception
2930 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2931 the compiler to never throw an exception.
2933 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
2934 @opindex Wnoexcept-type
2935 @opindex Wno-noexcept-type
2936 Warn if the C++17 feature making @code{noexcept} part of a function
2937 type changes the mangled name of a symbol relative to C++14. Enabled
2938 by @option{-Wabi} and @option{-Wc++17-compat}.
2943 template <class T> void f(T t) @{ t(); @};
2945 void h() @{ f(g); @}
2949 In C++14, @code{f} calls calls @code{f<void(*)()>}, but in
2950 C++17 it calls @code{f<void(*)()noexcept>}.
2952 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
2953 @opindex Wclass-memaccess
2954 Warn when the destination of a call to a raw memory function such as
2955 @code{memset} or @code{memcpy} is an object of class type writing into which
2956 might bypass the class non-trivial or deleted constructor or copy assignment,
2957 violate const-correctness or encapsulation, or corrupt the virtual table.
2958 Modifying the representation of such objects may violate invariants maintained
2959 by member functions of the class. For example, the call to @code{memset}
2960 below is undefined because it modifies a non-trivial class object and is,
2961 therefore, diagnosed. The safe way to either initialize or clear the storage
2962 of objects of such types is by using the appropriate constructor or assignment
2963 operator, if one is available.
2965 std::string str = "abc";
2966 memset (&str, 0, 3);
2968 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
2970 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2971 @opindex Wnon-virtual-dtor
2972 @opindex Wno-non-virtual-dtor
2973 Warn when a class has virtual functions and an accessible non-virtual
2974 destructor itself or in an accessible polymorphic base class, in which
2975 case it is possible but unsafe to delete an instance of a derived
2976 class through a pointer to the class itself or base class. This
2977 warning is automatically enabled if @option{-Weffc++} is specified.
2979 @item -Wregister @r{(C++ and Objective-C++ only)}
2981 @opindex Wno-register
2982 Warn on uses of the @code{register} storage class specifier, except
2983 when it is part of the GNU @ref{Explicit Register Variables} extension.
2984 The use of the @code{register} keyword as storage class specifier has
2985 been deprecated in C++11 and removed in C++17.
2986 Enabled by default with @option{-std=c++17}.
2988 @item -Wreorder @r{(C++ and Objective-C++ only)}
2990 @opindex Wno-reorder
2991 @cindex reordering, warning
2992 @cindex warning for reordering of member initializers
2993 Warn when the order of member initializers given in the code does not
2994 match the order in which they must be executed. For instance:
3000 A(): j (0), i (1) @{ @}
3005 The compiler rearranges the member initializers for @code{i}
3006 and @code{j} to match the declaration order of the members, emitting
3007 a warning to that effect. This warning is enabled by @option{-Wall}.
3009 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3010 @opindex fext-numeric-literals
3011 @opindex fno-ext-numeric-literals
3012 Accept imaginary, fixed-point, or machine-defined
3013 literal number suffixes as GNU extensions.
3014 When this option is turned off these suffixes are treated
3015 as C++11 user-defined literal numeric suffixes.
3016 This is on by default for all pre-C++11 dialects and all GNU dialects:
3017 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3018 @option{-std=gnu++14}.
3019 This option is off by default
3020 for ISO C++11 onwards (@option{-std=c++11}, ...).
3023 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3026 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3029 Warn about violations of the following style guidelines from Scott Meyers'
3030 @cite{Effective C++} series of books:
3034 Define a copy constructor and an assignment operator for classes
3035 with dynamically-allocated memory.
3038 Prefer initialization to assignment in constructors.
3041 Have @code{operator=} return a reference to @code{*this}.
3044 Don't try to return a reference when you must return an object.
3047 Distinguish between prefix and postfix forms of increment and
3048 decrement operators.
3051 Never overload @code{&&}, @code{||}, or @code{,}.
3055 This option also enables @option{-Wnon-virtual-dtor}, which is also
3056 one of the effective C++ recommendations. However, the check is
3057 extended to warn about the lack of virtual destructor in accessible
3058 non-polymorphic bases classes too.
3060 When selecting this option, be aware that the standard library
3061 headers do not obey all of these guidelines; use @samp{grep -v}
3062 to filter out those warnings.
3064 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3065 @opindex Wstrict-null-sentinel
3066 @opindex Wno-strict-null-sentinel
3067 Warn about the use of an uncasted @code{NULL} as sentinel. When
3068 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3069 to @code{__null}. Although it is a null pointer constant rather than a
3070 null pointer, it is guaranteed to be of the same size as a pointer.
3071 But this use is not portable across different compilers.
3073 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3074 @opindex Wno-non-template-friend
3075 @opindex Wnon-template-friend
3076 Disable warnings when non-template friend functions are declared
3077 within a template. In very old versions of GCC that predate implementation
3078 of the ISO standard, declarations such as
3079 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3080 could be interpreted as a particular specialization of a template
3081 function; the warning exists to diagnose compatibility problems,
3082 and is enabled by default.
3084 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3085 @opindex Wold-style-cast
3086 @opindex Wno-old-style-cast
3087 Warn if an old-style (C-style) cast to a non-void type is used within
3088 a C++ program. The new-style casts (@code{dynamic_cast},
3089 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3090 less vulnerable to unintended effects and much easier to search for.
3092 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3093 @opindex Woverloaded-virtual
3094 @opindex Wno-overloaded-virtual
3095 @cindex overloaded virtual function, warning
3096 @cindex warning for overloaded virtual function
3097 Warn when a function declaration hides virtual functions from a
3098 base class. For example, in:
3105 struct B: public A @{
3110 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3121 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3122 @opindex Wno-pmf-conversions
3123 @opindex Wpmf-conversions
3124 Disable the diagnostic for converting a bound pointer to member function
3127 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3128 @opindex Wsign-promo
3129 @opindex Wno-sign-promo
3130 Warn when overload resolution chooses a promotion from unsigned or
3131 enumerated type to a signed type, over a conversion to an unsigned type of
3132 the same size. Previous versions of G++ tried to preserve
3133 unsignedness, but the standard mandates the current behavior.
3135 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3137 Warn when a primary template declaration is encountered. Some coding
3138 rules disallow templates, and this may be used to enforce that rule.
3139 The warning is inactive inside a system header file, such as the STL, so
3140 one can still use the STL. One may also instantiate or specialize
3143 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3144 @opindex Wmultiple-inheritance
3145 Warn when a class is defined with multiple direct base classes. Some
3146 coding rules disallow multiple inheritance, and this may be used to
3147 enforce that rule. The warning is inactive inside a system header file,
3148 such as the STL, so one can still use the STL. One may also define
3149 classes that indirectly use multiple inheritance.
3151 @item -Wvirtual-inheritance
3152 @opindex Wvirtual-inheritance
3153 Warn when a class is defined with a virtual direct base class. Some
3154 coding rules disallow multiple inheritance, and this may be used to
3155 enforce that rule. The warning is inactive inside a system header file,
3156 such as the STL, so one can still use the STL. One may also define
3157 classes that indirectly use virtual inheritance.
3160 @opindex Wnamespaces
3161 Warn when a namespace definition is opened. Some coding rules disallow
3162 namespaces, and this may be used to enforce that rule. The warning is
3163 inactive inside a system header file, such as the STL, so one can still
3164 use the STL. One may also use using directives and qualified names.
3166 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3168 @opindex Wno-terminate
3169 Disable the warning about a throw-expression that will immediately
3170 result in a call to @code{terminate}.
3173 @node Objective-C and Objective-C++ Dialect Options
3174 @section Options Controlling Objective-C and Objective-C++ Dialects
3176 @cindex compiler options, Objective-C and Objective-C++
3177 @cindex Objective-C and Objective-C++ options, command-line
3178 @cindex options, Objective-C and Objective-C++
3179 (NOTE: This manual does not describe the Objective-C and Objective-C++
3180 languages themselves. @xref{Standards,,Language Standards
3181 Supported by GCC}, for references.)
3183 This section describes the command-line options that are only meaningful
3184 for Objective-C and Objective-C++ programs. You can also use most of
3185 the language-independent GNU compiler options.
3186 For example, you might compile a file @file{some_class.m} like this:
3189 gcc -g -fgnu-runtime -O -c some_class.m
3193 In this example, @option{-fgnu-runtime} is an option meant only for
3194 Objective-C and Objective-C++ programs; you can use the other options with
3195 any language supported by GCC@.
3197 Note that since Objective-C is an extension of the C language, Objective-C
3198 compilations may also use options specific to the C front-end (e.g.,
3199 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3200 C++-specific options (e.g., @option{-Wabi}).
3202 Here is a list of options that are @emph{only} for compiling Objective-C
3203 and Objective-C++ programs:
3206 @item -fconstant-string-class=@var{class-name}
3207 @opindex fconstant-string-class
3208 Use @var{class-name} as the name of the class to instantiate for each
3209 literal string specified with the syntax @code{@@"@dots{}"}. The default
3210 class name is @code{NXConstantString} if the GNU runtime is being used, and
3211 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3212 @option{-fconstant-cfstrings} option, if also present, overrides the
3213 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3214 to be laid out as constant CoreFoundation strings.
3217 @opindex fgnu-runtime
3218 Generate object code compatible with the standard GNU Objective-C
3219 runtime. This is the default for most types of systems.
3221 @item -fnext-runtime
3222 @opindex fnext-runtime
3223 Generate output compatible with the NeXT runtime. This is the default
3224 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3225 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3228 @item -fno-nil-receivers
3229 @opindex fno-nil-receivers
3230 Assume that all Objective-C message dispatches (@code{[receiver
3231 message:arg]}) in this translation unit ensure that the receiver is
3232 not @code{nil}. This allows for more efficient entry points in the
3233 runtime to be used. This option is only available in conjunction with
3234 the NeXT runtime and ABI version 0 or 1.
3236 @item -fobjc-abi-version=@var{n}
3237 @opindex fobjc-abi-version
3238 Use version @var{n} of the Objective-C ABI for the selected runtime.
3239 This option is currently supported only for the NeXT runtime. In that
3240 case, Version 0 is the traditional (32-bit) ABI without support for
3241 properties and other Objective-C 2.0 additions. Version 1 is the
3242 traditional (32-bit) ABI with support for properties and other
3243 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3244 nothing is specified, the default is Version 0 on 32-bit target
3245 machines, and Version 2 on 64-bit target machines.
3247 @item -fobjc-call-cxx-cdtors
3248 @opindex fobjc-call-cxx-cdtors
3249 For each Objective-C class, check if any of its instance variables is a
3250 C++ object with a non-trivial default constructor. If so, synthesize a
3251 special @code{- (id) .cxx_construct} instance method which runs
3252 non-trivial default constructors on any such instance variables, in order,
3253 and then return @code{self}. Similarly, check if any instance variable
3254 is a C++ object with a non-trivial destructor, and if so, synthesize a
3255 special @code{- (void) .cxx_destruct} method which runs
3256 all such default destructors, in reverse order.
3258 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3259 methods thusly generated only operate on instance variables
3260 declared in the current Objective-C class, and not those inherited
3261 from superclasses. It is the responsibility of the Objective-C
3262 runtime to invoke all such methods in an object's inheritance
3263 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3264 by the runtime immediately after a new object instance is allocated;
3265 the @code{- (void) .cxx_destruct} methods are invoked immediately
3266 before the runtime deallocates an object instance.
3268 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3269 support for invoking the @code{- (id) .cxx_construct} and
3270 @code{- (void) .cxx_destruct} methods.
3272 @item -fobjc-direct-dispatch
3273 @opindex fobjc-direct-dispatch
3274 Allow fast jumps to the message dispatcher. On Darwin this is
3275 accomplished via the comm page.
3277 @item -fobjc-exceptions
3278 @opindex fobjc-exceptions
3279 Enable syntactic support for structured exception handling in
3280 Objective-C, similar to what is offered by C++. This option
3281 is required to use the Objective-C keywords @code{@@try},
3282 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3283 @code{@@synchronized}. This option is available with both the GNU
3284 runtime and the NeXT runtime (but not available in conjunction with
3285 the NeXT runtime on Mac OS X 10.2 and earlier).
3289 Enable garbage collection (GC) in Objective-C and Objective-C++
3290 programs. This option is only available with the NeXT runtime; the
3291 GNU runtime has a different garbage collection implementation that
3292 does not require special compiler flags.
3294 @item -fobjc-nilcheck
3295 @opindex fobjc-nilcheck
3296 For the NeXT runtime with version 2 of the ABI, check for a nil
3297 receiver in method invocations before doing the actual method call.
3298 This is the default and can be disabled using
3299 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3300 checked for nil in this way no matter what this flag is set to.
3301 Currently this flag does nothing when the GNU runtime, or an older
3302 version of the NeXT runtime ABI, is used.
3304 @item -fobjc-std=objc1
3306 Conform to the language syntax of Objective-C 1.0, the language
3307 recognized by GCC 4.0. This only affects the Objective-C additions to
3308 the C/C++ language; it does not affect conformance to C/C++ standards,
3309 which is controlled by the separate C/C++ dialect option flags. When
3310 this option is used with the Objective-C or Objective-C++ compiler,
3311 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3312 This is useful if you need to make sure that your Objective-C code can
3313 be compiled with older versions of GCC@.
3315 @item -freplace-objc-classes
3316 @opindex freplace-objc-classes
3317 Emit a special marker instructing @command{ld(1)} not to statically link in
3318 the resulting object file, and allow @command{dyld(1)} to load it in at
3319 run time instead. This is used in conjunction with the Fix-and-Continue
3320 debugging mode, where the object file in question may be recompiled and
3321 dynamically reloaded in the course of program execution, without the need
3322 to restart the program itself. Currently, Fix-and-Continue functionality
3323 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3328 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3329 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3330 compile time) with static class references that get initialized at load time,
3331 which improves run-time performance. Specifying the @option{-fzero-link} flag
3332 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3333 to be retained. This is useful in Zero-Link debugging mode, since it allows
3334 for individual class implementations to be modified during program execution.
3335 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3336 regardless of command-line options.
3338 @item -fno-local-ivars
3339 @opindex fno-local-ivars
3340 @opindex flocal-ivars
3341 By default instance variables in Objective-C can be accessed as if
3342 they were local variables from within the methods of the class they're
3343 declared in. This can lead to shadowing between instance variables
3344 and other variables declared either locally inside a class method or
3345 globally with the same name. Specifying the @option{-fno-local-ivars}
3346 flag disables this behavior thus avoiding variable shadowing issues.
3348 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3349 @opindex fivar-visibility
3350 Set the default instance variable visibility to the specified option
3351 so that instance variables declared outside the scope of any access
3352 modifier directives default to the specified visibility.
3356 Dump interface declarations for all classes seen in the source file to a
3357 file named @file{@var{sourcename}.decl}.
3359 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3360 @opindex Wassign-intercept
3361 @opindex Wno-assign-intercept
3362 Warn whenever an Objective-C assignment is being intercepted by the
3365 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3366 @opindex Wno-protocol
3368 If a class is declared to implement a protocol, a warning is issued for
3369 every method in the protocol that is not implemented by the class. The
3370 default behavior is to issue a warning for every method not explicitly
3371 implemented in the class, even if a method implementation is inherited
3372 from the superclass. If you use the @option{-Wno-protocol} option, then
3373 methods inherited from the superclass are considered to be implemented,
3374 and no warning is issued for them.
3376 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3378 @opindex Wno-selector
3379 Warn if multiple methods of different types for the same selector are
3380 found during compilation. The check is performed on the list of methods
3381 in the final stage of compilation. Additionally, a check is performed
3382 for each selector appearing in a @code{@@selector(@dots{})}
3383 expression, and a corresponding method for that selector has been found
3384 during compilation. Because these checks scan the method table only at
3385 the end of compilation, these warnings are not produced if the final
3386 stage of compilation is not reached, for example because an error is
3387 found during compilation, or because the @option{-fsyntax-only} option is
3390 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3391 @opindex Wstrict-selector-match
3392 @opindex Wno-strict-selector-match
3393 Warn if multiple methods with differing argument and/or return types are
3394 found for a given selector when attempting to send a message using this
3395 selector to a receiver of type @code{id} or @code{Class}. When this flag
3396 is off (which is the default behavior), the compiler omits such warnings
3397 if any differences found are confined to types that share the same size
3400 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3401 @opindex Wundeclared-selector
3402 @opindex Wno-undeclared-selector
3403 Warn if a @code{@@selector(@dots{})} expression referring to an
3404 undeclared selector is found. A selector is considered undeclared if no
3405 method with that name has been declared before the
3406 @code{@@selector(@dots{})} expression, either explicitly in an
3407 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3408 an @code{@@implementation} section. This option always performs its
3409 checks as soon as a @code{@@selector(@dots{})} expression is found,
3410 while @option{-Wselector} only performs its checks in the final stage of
3411 compilation. This also enforces the coding style convention
3412 that methods and selectors must be declared before being used.
3414 @item -print-objc-runtime-info
3415 @opindex print-objc-runtime-info
3416 Generate C header describing the largest structure that is passed by
3421 @node Diagnostic Message Formatting Options
3422 @section Options to Control Diagnostic Messages Formatting
3423 @cindex options to control diagnostics formatting
3424 @cindex diagnostic messages
3425 @cindex message formatting
3427 Traditionally, diagnostic messages have been formatted irrespective of
3428 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3429 options described below
3430 to control the formatting algorithm for diagnostic messages,
3431 e.g.@: how many characters per line, how often source location
3432 information should be reported. Note that some language front ends may not
3433 honor these options.
3436 @item -fmessage-length=@var{n}
3437 @opindex fmessage-length
3438 Try to format error messages so that they fit on lines of about
3439 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3440 done; each error message appears on a single line. This is the
3441 default for all front ends.
3443 @item -fdiagnostics-show-location=once
3444 @opindex fdiagnostics-show-location
3445 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3446 reporter to emit source location information @emph{once}; that is, in
3447 case the message is too long to fit on a single physical line and has to
3448 be wrapped, the source location won't be emitted (as prefix) again,
3449 over and over, in subsequent continuation lines. This is the default
3452 @item -fdiagnostics-show-location=every-line
3453 Only meaningful in line-wrapping mode. Instructs the diagnostic
3454 messages reporter to emit the same source location information (as
3455 prefix) for physical lines that result from the process of breaking
3456 a message which is too long to fit on a single line.
3458 @item -fdiagnostics-color[=@var{WHEN}]
3459 @itemx -fno-diagnostics-color
3460 @opindex fdiagnostics-color
3461 @cindex highlight, color
3462 @vindex GCC_COLORS @r{environment variable}
3463 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3464 or @samp{auto}. The default depends on how the compiler has been configured,
3465 it can be any of the above @var{WHEN} options or also @samp{never}
3466 if @env{GCC_COLORS} environment variable isn't present in the environment,
3467 and @samp{auto} otherwise.
3468 @samp{auto} means to use color only when the standard error is a terminal.
3469 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3470 aliases for @option{-fdiagnostics-color=always} and
3471 @option{-fdiagnostics-color=never}, respectively.
3473 The colors are defined by the environment variable @env{GCC_COLORS}.
3474 Its value is a colon-separated list of capabilities and Select Graphic
3475 Rendition (SGR) substrings. SGR commands are interpreted by the
3476 terminal or terminal emulator. (See the section in the documentation
3477 of your text terminal for permitted values and their meanings as
3478 character attributes.) These substring values are integers in decimal
3479 representation and can be concatenated with semicolons.
3480 Common values to concatenate include
3482 @samp{4} for underline,
3484 @samp{7} for inverse,
3485 @samp{39} for default foreground color,
3486 @samp{30} to @samp{37} for foreground colors,
3487 @samp{90} to @samp{97} for 16-color mode foreground colors,
3488 @samp{38;5;0} to @samp{38;5;255}
3489 for 88-color and 256-color modes foreground colors,
3490 @samp{49} for default background color,
3491 @samp{40} to @samp{47} for background colors,
3492 @samp{100} to @samp{107} for 16-color mode background colors,
3493 and @samp{48;5;0} to @samp{48;5;255}
3494 for 88-color and 256-color modes background colors.
3496 The default @env{GCC_COLORS} is
3498 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3499 quote=01:fixit-insert=32:fixit-delete=31:\
3500 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3504 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3505 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3506 @samp{01} is bold, and @samp{31} is red.
3507 Setting @env{GCC_COLORS} to the empty string disables colors.
3508 Supported capabilities are as follows.
3512 @vindex error GCC_COLORS @r{capability}
3513 SGR substring for error: markers.
3516 @vindex warning GCC_COLORS @r{capability}
3517 SGR substring for warning: markers.
3520 @vindex note GCC_COLORS @r{capability}
3521 SGR substring for note: markers.
3524 @vindex range1 GCC_COLORS @r{capability}
3525 SGR substring for first additional range.
3528 @vindex range2 GCC_COLORS @r{capability}
3529 SGR substring for second additional range.
3532 @vindex locus GCC_COLORS @r{capability}
3533 SGR substring for location information, @samp{file:line} or
3534 @samp{file:line:column} etc.
3537 @vindex quote GCC_COLORS @r{capability}
3538 SGR substring for information printed within quotes.
3541 @vindex fixit-insert GCC_COLORS @r{capability}
3542 SGR substring for fix-it hints suggesting text to
3543 be inserted or replaced.
3546 @vindex fixit-delete GCC_COLORS @r{capability}
3547 SGR substring for fix-it hints suggesting text to
3550 @item diff-filename=
3551 @vindex diff-filename GCC_COLORS @r{capability}
3552 SGR substring for filename headers within generated patches.
3555 @vindex diff-hunk GCC_COLORS @r{capability}
3556 SGR substring for the starts of hunks within generated patches.
3559 @vindex diff-delete GCC_COLORS @r{capability}
3560 SGR substring for deleted lines within generated patches.
3563 @vindex diff-insert GCC_COLORS @r{capability}
3564 SGR substring for inserted lines within generated patches.
3567 @vindex type-diff GCC_COLORS @r{capability}
3568 SGR substring for highlighting mismatching types within template
3569 arguments in the C++ frontend.
3572 @item -fno-diagnostics-show-option
3573 @opindex fno-diagnostics-show-option
3574 @opindex fdiagnostics-show-option
3575 By default, each diagnostic emitted includes text indicating the
3576 command-line option that directly controls the diagnostic (if such an
3577 option is known to the diagnostic machinery). Specifying the
3578 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3580 @item -fno-diagnostics-show-caret
3581 @opindex fno-diagnostics-show-caret
3582 @opindex fdiagnostics-show-caret
3583 By default, each diagnostic emitted includes the original source line
3584 and a caret @samp{^} indicating the column. This option suppresses this
3585 information. The source line is truncated to @var{n} characters, if
3586 the @option{-fmessage-length=n} option is given. When the output is done
3587 to the terminal, the width is limited to the width given by the
3588 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3590 @item -fdiagnostics-parseable-fixits
3591 @opindex fdiagnostics-parseable-fixits
3592 Emit fix-it hints in a machine-parseable format, suitable for consumption
3593 by IDEs. For each fix-it, a line will be printed after the relevant
3594 diagnostic, starting with the string ``fix-it:''. For example:
3597 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3600 The location is expressed as a half-open range, expressed as a count of
3601 bytes, starting at byte 1 for the initial column. In the above example,
3602 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3606 00000000011111111112222222222
3607 12345678901234567890123456789
3608 gtk_widget_showall (dlg);
3613 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3614 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3615 (e.g. vertical tab as ``\013'').
3617 An empty replacement string indicates that the given range is to be removed.
3618 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3619 be inserted at the given position.
3621 @item -fdiagnostics-generate-patch
3622 @opindex fdiagnostics-generate-patch
3623 Print fix-it hints to stderr in unified diff format, after any diagnostics
3624 are printed. For example:
3631 void show_cb(GtkDialog *dlg)
3633 - gtk_widget_showall(dlg);
3634 + gtk_widget_show_all(dlg);
3639 The diff may or may not be colorized, following the same rules
3640 as for diagnostics (see @option{-fdiagnostics-color}).
3642 @item -fdiagnostics-show-template-tree
3643 @opindex fdiagnostics-show-template-tree
3645 In the C++ frontend, when printing diagnostics showing mismatching
3646 template types, such as:
3649 could not convert 'std::map<int, std::vector<double> >()'
3650 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3653 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3654 tree-like structure showing the common and differing parts of the types,
3664 The parts that differ are highlighted with color (``double'' and
3665 ``float'' in this case).
3667 @item -fno-elide-type
3668 @opindex fno-elide-type
3669 @opindex felide-type
3670 By default when the C++ frontend prints diagnostics showing mismatching
3671 template types, common parts of the types are printed as ``[...]'' to
3672 simplify the error message. For example:
3675 could not convert 'std::map<int, std::vector<double> >()'
3676 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3679 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3680 This flag also affects the output of the
3681 @option{-fdiagnostics-show-template-tree} flag.
3683 @item -fno-show-column
3684 @opindex fno-show-column
3685 Do not print column numbers in diagnostics. This may be necessary if
3686 diagnostics are being scanned by a program that does not understand the
3687 column numbers, such as @command{dejagnu}.
3691 @node Warning Options
3692 @section Options to Request or Suppress Warnings
3693 @cindex options to control warnings
3694 @cindex warning messages
3695 @cindex messages, warning
3696 @cindex suppressing warnings
3698 Warnings are diagnostic messages that report constructions that
3699 are not inherently erroneous but that are risky or suggest there
3700 may have been an error.
3702 The following language-independent options do not enable specific
3703 warnings but control the kinds of diagnostics produced by GCC@.
3706 @cindex syntax checking
3708 @opindex fsyntax-only
3709 Check the code for syntax errors, but don't do anything beyond that.
3711 @item -fmax-errors=@var{n}
3712 @opindex fmax-errors
3713 Limits the maximum number of error messages to @var{n}, at which point
3714 GCC bails out rather than attempting to continue processing the source
3715 code. If @var{n} is 0 (the default), there is no limit on the number
3716 of error messages produced. If @option{-Wfatal-errors} is also
3717 specified, then @option{-Wfatal-errors} takes precedence over this
3722 Inhibit all warning messages.
3727 Make all warnings into errors.
3732 Make the specified warning into an error. The specifier for a warning
3733 is appended; for example @option{-Werror=switch} turns the warnings
3734 controlled by @option{-Wswitch} into errors. This switch takes a
3735 negative form, to be used to negate @option{-Werror} for specific
3736 warnings; for example @option{-Wno-error=switch} makes
3737 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3740 The warning message for each controllable warning includes the
3741 option that controls the warning. That option can then be used with
3742 @option{-Werror=} and @option{-Wno-error=} as described above.
3743 (Printing of the option in the warning message can be disabled using the
3744 @option{-fno-diagnostics-show-option} flag.)
3746 Note that specifying @option{-Werror=}@var{foo} automatically implies
3747 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3750 @item -Wfatal-errors
3751 @opindex Wfatal-errors
3752 @opindex Wno-fatal-errors
3753 This option causes the compiler to abort compilation on the first error
3754 occurred rather than trying to keep going and printing further error
3759 You can request many specific warnings with options beginning with
3760 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3761 implicit declarations. Each of these specific warning options also
3762 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3763 example, @option{-Wno-implicit}. This manual lists only one of the
3764 two forms, whichever is not the default. For further
3765 language-specific options also refer to @ref{C++ Dialect Options} and
3766 @ref{Objective-C and Objective-C++ Dialect Options}.
3768 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3769 options, such as @option{-Wunused}, which may turn on further options,
3770 such as @option{-Wunused-value}. The combined effect of positive and
3771 negative forms is that more specific options have priority over less
3772 specific ones, independently of their position in the command-line. For
3773 options of the same specificity, the last one takes effect. Options
3774 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3775 as if they appeared at the end of the command-line.
3777 When an unrecognized warning option is requested (e.g.,
3778 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3779 that the option is not recognized. However, if the @option{-Wno-} form
3780 is used, the behavior is slightly different: no diagnostic is
3781 produced for @option{-Wno-unknown-warning} unless other diagnostics
3782 are being produced. This allows the use of new @option{-Wno-} options
3783 with old compilers, but if something goes wrong, the compiler
3784 warns that an unrecognized option is present.
3791 Issue all the warnings demanded by strict ISO C and ISO C++;
3792 reject all programs that use forbidden extensions, and some other
3793 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3794 version of the ISO C standard specified by any @option{-std} option used.
3796 Valid ISO C and ISO C++ programs should compile properly with or without
3797 this option (though a rare few require @option{-ansi} or a
3798 @option{-std} option specifying the required version of ISO C)@. However,
3799 without this option, certain GNU extensions and traditional C and C++
3800 features are supported as well. With this option, they are rejected.
3802 @option{-Wpedantic} does not cause warning messages for use of the
3803 alternate keywords whose names begin and end with @samp{__}. Pedantic
3804 warnings are also disabled in the expression that follows
3805 @code{__extension__}. However, only system header files should use
3806 these escape routes; application programs should avoid them.
3807 @xref{Alternate Keywords}.
3809 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3810 C conformance. They soon find that it does not do quite what they want:
3811 it finds some non-ISO practices, but not all---only those for which
3812 ISO C @emph{requires} a diagnostic, and some others for which
3813 diagnostics have been added.
3815 A feature to report any failure to conform to ISO C might be useful in
3816 some instances, but would require considerable additional work and would
3817 be quite different from @option{-Wpedantic}. We don't have plans to
3818 support such a feature in the near future.
3820 Where the standard specified with @option{-std} represents a GNU
3821 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3822 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3823 extended dialect is based. Warnings from @option{-Wpedantic} are given
3824 where they are required by the base standard. (It does not make sense
3825 for such warnings to be given only for features not in the specified GNU
3826 C dialect, since by definition the GNU dialects of C include all
3827 features the compiler supports with the given option, and there would be
3828 nothing to warn about.)
3830 @item -pedantic-errors
3831 @opindex pedantic-errors
3832 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3833 requires a diagnostic, in some cases where there is undefined behavior
3834 at compile-time and in some other cases that do not prevent compilation
3835 of programs that are valid according to the standard. This is not
3836 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3837 by this option and not enabled by the latter and vice versa.
3842 This enables all the warnings about constructions that some users
3843 consider questionable, and that are easy to avoid (or modify to
3844 prevent the warning), even in conjunction with macros. This also
3845 enables some language-specific warnings described in @ref{C++ Dialect
3846 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3848 @option{-Wall} turns on the following warning flags:
3850 @gccoptlist{-Waddress @gol
3851 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3853 -Wbool-operation @gol
3854 -Wc++11-compat -Wc++14-compat @gol
3855 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
3856 -Wchar-subscripts @gol
3858 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3859 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3861 -Wint-in-bool-context @gol
3862 -Wimplicit @r{(C and Objective-C only)} @gol
3863 -Wimplicit-int @r{(C and Objective-C only)} @gol
3864 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3865 -Winit-self @r{(only for C++)} @gol
3866 -Wlogical-not-parentheses @gol
3867 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3868 -Wmaybe-uninitialized @gol
3869 -Wmemset-elt-size @gol
3870 -Wmemset-transposed-args @gol
3871 -Wmisleading-indentation @r{(only for C/C++)} @gol
3872 -Wmissing-braces @r{(only for C/ObjC)} @gol
3873 -Wmultistatement-macros @gol
3874 -Wnarrowing @r{(only for C++)} @gol
3876 -Wnonnull-compare @gol
3883 -Wsequence-point @gol
3884 -Wsign-compare @r{(only in C++)} @gol
3885 -Wsizeof-pointer-div @gol
3886 -Wsizeof-pointer-memaccess @gol
3887 -Wstrict-aliasing @gol
3888 -Wstrict-overflow=1 @gol
3890 -Wtautological-compare @gol
3892 -Wuninitialized @gol
3893 -Wunknown-pragmas @gol
3894 -Wunused-function @gol
3897 -Wunused-variable @gol
3898 -Wvolatile-register-var @gol
3901 Note that some warning flags are not implied by @option{-Wall}. Some of
3902 them warn about constructions that users generally do not consider
3903 questionable, but which occasionally you might wish to check for;
3904 others warn about constructions that are necessary or hard to avoid in
3905 some cases, and there is no simple way to modify the code to suppress
3906 the warning. Some of them are enabled by @option{-Wextra} but many of
3907 them must be enabled individually.
3913 This enables some extra warning flags that are not enabled by
3914 @option{-Wall}. (This option used to be called @option{-W}. The older
3915 name is still supported, but the newer name is more descriptive.)
3917 @gccoptlist{-Wclobbered @gol
3918 -Wcast-function-type @gol
3920 -Wignored-qualifiers @gol
3921 -Wimplicit-fallthrough=3 @gol
3922 -Wmissing-field-initializers @gol
3923 -Wmissing-parameter-type @r{(C only)} @gol
3924 -Wold-style-declaration @r{(C only)} @gol
3925 -Woverride-init @gol
3926 -Wsign-compare @r{(C only)} @gol
3928 -Wuninitialized @gol
3929 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3930 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3931 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3934 The option @option{-Wextra} also prints warning messages for the
3940 A pointer is compared against integer zero with @code{<}, @code{<=},
3941 @code{>}, or @code{>=}.
3944 (C++ only) An enumerator and a non-enumerator both appear in a
3945 conditional expression.
3948 (C++ only) Ambiguous virtual bases.
3951 (C++ only) Subscripting an array that has been declared @code{register}.
3954 (C++ only) Taking the address of a variable that has been declared
3958 (C++ only) A base class is not initialized in the copy constructor
3963 @item -Wchar-subscripts
3964 @opindex Wchar-subscripts
3965 @opindex Wno-char-subscripts
3966 Warn if an array subscript has type @code{char}. This is a common cause
3967 of error, as programmers often forget that this type is signed on some
3969 This warning is enabled by @option{-Wall}.
3973 Warn about an invalid memory access that is found by Pointer Bounds Checker
3974 (@option{-fcheck-pointer-bounds}).
3976 @item -Wno-coverage-mismatch
3977 @opindex Wno-coverage-mismatch
3978 Warn if feedback profiles do not match when using the
3979 @option{-fprofile-use} option.
3980 If a source file is changed between compiling with @option{-fprofile-gen} and
3981 with @option{-fprofile-use}, the files with the profile feedback can fail
3982 to match the source file and GCC cannot use the profile feedback
3983 information. By default, this warning is enabled and is treated as an
3984 error. @option{-Wno-coverage-mismatch} can be used to disable the
3985 warning or @option{-Wno-error=coverage-mismatch} can be used to
3986 disable the error. Disabling the error for this warning can result in
3987 poorly optimized code and is useful only in the
3988 case of very minor changes such as bug fixes to an existing code-base.
3989 Completely disabling the warning is not recommended.
3992 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3994 Suppress warning messages emitted by @code{#warning} directives.
3996 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3997 @opindex Wdouble-promotion
3998 @opindex Wno-double-promotion
3999 Give a warning when a value of type @code{float} is implicitly
4000 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4001 floating-point unit implement @code{float} in hardware, but emulate
4002 @code{double} in software. On such a machine, doing computations
4003 using @code{double} values is much more expensive because of the
4004 overhead required for software emulation.
4006 It is easy to accidentally do computations with @code{double} because
4007 floating-point literals are implicitly of type @code{double}. For
4011 float area(float radius)
4013 return 3.14159 * radius * radius;
4017 the compiler performs the entire computation with @code{double}
4018 because the floating-point literal is a @code{double}.
4020 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4021 @opindex Wduplicate-decl-specifier
4022 @opindex Wno-duplicate-decl-specifier
4023 Warn if a declaration has duplicate @code{const}, @code{volatile},
4024 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4028 @itemx -Wformat=@var{n}
4031 @opindex ffreestanding
4032 @opindex fno-builtin
4034 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4035 the arguments supplied have types appropriate to the format string
4036 specified, and that the conversions specified in the format string make
4037 sense. This includes standard functions, and others specified by format
4038 attributes (@pxref{Function Attributes}), in the @code{printf},
4039 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4040 not in the C standard) families (or other target-specific families).
4041 Which functions are checked without format attributes having been
4042 specified depends on the standard version selected, and such checks of
4043 functions without the attribute specified are disabled by
4044 @option{-ffreestanding} or @option{-fno-builtin}.
4046 The formats are checked against the format features supported by GNU
4047 libc version 2.2. These include all ISO C90 and C99 features, as well
4048 as features from the Single Unix Specification and some BSD and GNU
4049 extensions. Other library implementations may not support all these
4050 features; GCC does not support warning about features that go beyond a
4051 particular library's limitations. However, if @option{-Wpedantic} is used
4052 with @option{-Wformat}, warnings are given about format features not
4053 in the selected standard version (but not for @code{strfmon} formats,
4054 since those are not in any version of the C standard). @xref{C Dialect
4055 Options,,Options Controlling C Dialect}.
4062 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4063 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4064 @option{-Wformat} also checks for null format arguments for several
4065 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4066 aspects of this level of format checking can be disabled by the
4067 options: @option{-Wno-format-contains-nul},
4068 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4069 @option{-Wformat} is enabled by @option{-Wall}.
4071 @item -Wno-format-contains-nul
4072 @opindex Wno-format-contains-nul
4073 @opindex Wformat-contains-nul
4074 If @option{-Wformat} is specified, do not warn about format strings that
4077 @item -Wno-format-extra-args
4078 @opindex Wno-format-extra-args
4079 @opindex Wformat-extra-args
4080 If @option{-Wformat} is specified, do not warn about excess arguments to a
4081 @code{printf} or @code{scanf} format function. The C standard specifies
4082 that such arguments are ignored.
4084 Where the unused arguments lie between used arguments that are
4085 specified with @samp{$} operand number specifications, normally
4086 warnings are still given, since the implementation could not know what
4087 type to pass to @code{va_arg} to skip the unused arguments. However,
4088 in the case of @code{scanf} formats, this option suppresses the
4089 warning if the unused arguments are all pointers, since the Single
4090 Unix Specification says that such unused arguments are allowed.
4092 @item -Wformat-overflow
4093 @itemx -Wformat-overflow=@var{level}
4094 @opindex Wformat-overflow
4095 @opindex Wno-format-overflow
4096 Warn about calls to formatted input/output functions such as @code{sprintf}
4097 and @code{vsprintf} that might overflow the destination buffer. When the
4098 exact number of bytes written by a format directive cannot be determined
4099 at compile-time it is estimated based on heuristics that depend on the
4100 @var{level} argument and on optimization. While enabling optimization
4101 will in most cases improve the accuracy of the warning, it may also
4102 result in false positives.
4105 @item -Wformat-overflow
4106 @item -Wformat-overflow=1
4107 @opindex Wformat-overflow
4108 @opindex Wno-format-overflow
4109 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4110 employs a conservative approach that warns only about calls that most
4111 likely overflow the buffer. At this level, numeric arguments to format
4112 directives with unknown values are assumed to have the value of one, and
4113 strings of unknown length to be empty. Numeric arguments that are known
4114 to be bounded to a subrange of their type, or string arguments whose output
4115 is bounded either by their directive's precision or by a finite set of
4116 string literals, are assumed to take on the value within the range that
4117 results in the most bytes on output. For example, the call to @code{sprintf}
4118 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4119 the terminating NUL character (@code{'\0'}) appended by the function
4120 to the destination buffer will be written past its end. Increasing
4121 the size of the buffer by a single byte is sufficient to avoid the
4122 warning, though it may not be sufficient to avoid the overflow.
4125 void f (int a, int b)
4128 sprintf (buf, "a = %i, b = %i\n", a, b);
4132 @item -Wformat-overflow=2
4133 Level @var{2} warns also about calls that might overflow the destination
4134 buffer given an argument of sufficient length or magnitude. At level
4135 @var{2}, unknown numeric arguments are assumed to have the minimum
4136 representable value for signed types with a precision greater than 1, and
4137 the maximum representable value otherwise. Unknown string arguments whose
4138 length cannot be assumed to be bounded either by the directive's precision,
4139 or by a finite set of string literals they may evaluate to, or the character
4140 array they may point to, are assumed to be 1 character long.
4142 At level @var{2}, the call in the example above is again diagnosed, but
4143 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4144 @code{%i} directive will write some of its digits beyond the end of
4145 the destination buffer. To make the call safe regardless of the values
4146 of the two variables, the size of the destination buffer must be increased
4147 to at least 34 bytes. GCC includes the minimum size of the buffer in
4148 an informational note following the warning.
4150 An alternative to increasing the size of the destination buffer is to
4151 constrain the range of formatted values. The maximum length of string
4152 arguments can be bounded by specifying the precision in the format
4153 directive. When numeric arguments of format directives can be assumed
4154 to be bounded by less than the precision of their type, choosing
4155 an appropriate length modifier to the format specifier will reduce
4156 the required buffer size. For example, if @var{a} and @var{b} in the
4157 example above can be assumed to be within the precision of
4158 the @code{short int} type then using either the @code{%hi} format
4159 directive or casting the argument to @code{short} reduces the maximum
4160 required size of the buffer to 24 bytes.
4163 void f (int a, int b)
4166 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4171 @item -Wno-format-zero-length
4172 @opindex Wno-format-zero-length
4173 @opindex Wformat-zero-length
4174 If @option{-Wformat} is specified, do not warn about zero-length formats.
4175 The C standard specifies that zero-length formats are allowed.
4180 Enable @option{-Wformat} plus additional format checks. Currently
4181 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4184 @item -Wformat-nonliteral
4185 @opindex Wformat-nonliteral
4186 @opindex Wno-format-nonliteral
4187 If @option{-Wformat} is specified, also warn if the format string is not a
4188 string literal and so cannot be checked, unless the format function
4189 takes its format arguments as a @code{va_list}.
4191 @item -Wformat-security
4192 @opindex Wformat-security
4193 @opindex Wno-format-security
4194 If @option{-Wformat} is specified, also warn about uses of format
4195 functions that represent possible security problems. At present, this
4196 warns about calls to @code{printf} and @code{scanf} functions where the
4197 format string is not a string literal and there are no format arguments,
4198 as in @code{printf (foo);}. This may be a security hole if the format
4199 string came from untrusted input and contains @samp{%n}. (This is
4200 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4201 in future warnings may be added to @option{-Wformat-security} that are not
4202 included in @option{-Wformat-nonliteral}.)
4204 @item -Wformat-signedness
4205 @opindex Wformat-signedness
4206 @opindex Wno-format-signedness
4207 If @option{-Wformat} is specified, also warn if the format string
4208 requires an unsigned argument and the argument is signed and vice versa.
4210 @item -Wformat-truncation
4211 @itemx -Wformat-truncation=@var{level}
4212 @opindex Wformat-truncation
4213 @opindex Wno-format-truncation
4214 Warn about calls to formatted input/output functions such as @code{snprintf}
4215 and @code{vsnprintf} that might result in output truncation. When the exact
4216 number of bytes written by a format directive cannot be determined at
4217 compile-time it is estimated based on heuristics that depend on
4218 the @var{level} argument and on optimization. While enabling optimization
4219 will in most cases improve the accuracy of the warning, it may also result
4220 in false positives. Except as noted otherwise, the option uses the same
4221 logic @option{-Wformat-overflow}.
4224 @item -Wformat-truncation
4225 @item -Wformat-truncation=1
4226 @opindex Wformat-truncation
4227 @opindex Wno-format-overflow
4228 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4229 employs a conservative approach that warns only about calls to bounded
4230 functions whose return value is unused and that will most likely result
4231 in output truncation.
4233 @item -Wformat-truncation=2
4234 Level @var{2} warns also about calls to bounded functions whose return
4235 value is used and that might result in truncation given an argument of
4236 sufficient length or magnitude.
4240 @opindex Wformat-y2k
4241 @opindex Wno-format-y2k
4242 If @option{-Wformat} is specified, also warn about @code{strftime}
4243 formats that may yield only a two-digit year.
4248 @opindex Wno-nonnull
4249 Warn about passing a null pointer for arguments marked as
4250 requiring a non-null value by the @code{nonnull} function attribute.
4252 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4253 can be disabled with the @option{-Wno-nonnull} option.
4255 @item -Wnonnull-compare
4256 @opindex Wnonnull-compare
4257 @opindex Wno-nonnull-compare
4258 Warn when comparing an argument marked with the @code{nonnull}
4259 function attribute against null inside the function.
4261 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4262 can be disabled with the @option{-Wno-nonnull-compare} option.
4264 @item -Wnull-dereference
4265 @opindex Wnull-dereference
4266 @opindex Wno-null-dereference
4267 Warn if the compiler detects paths that trigger erroneous or
4268 undefined behavior due to dereferencing a null pointer. This option
4269 is only active when @option{-fdelete-null-pointer-checks} is active,
4270 which is enabled by optimizations in most targets. The precision of
4271 the warnings depends on the optimization options used.
4273 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4275 @opindex Wno-init-self
4276 Warn about uninitialized variables that are initialized with themselves.
4277 Note this option can only be used with the @option{-Wuninitialized} option.
4279 For example, GCC warns about @code{i} being uninitialized in the
4280 following snippet only when @option{-Winit-self} has been specified:
4291 This warning is enabled by @option{-Wall} in C++.
4293 @item -Wimplicit-int @r{(C and Objective-C only)}
4294 @opindex Wimplicit-int
4295 @opindex Wno-implicit-int
4296 Warn when a declaration does not specify a type.
4297 This warning is enabled by @option{-Wall}.
4299 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4300 @opindex Wimplicit-function-declaration
4301 @opindex Wno-implicit-function-declaration
4302 Give a warning whenever a function is used before being declared. In
4303 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4304 enabled by default and it is made into an error by
4305 @option{-pedantic-errors}. This warning is also enabled by
4308 @item -Wimplicit @r{(C and Objective-C only)}
4310 @opindex Wno-implicit
4311 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4312 This warning is enabled by @option{-Wall}.
4314 @item -Wimplicit-fallthrough
4315 @opindex Wimplicit-fallthrough
4316 @opindex Wno-implicit-fallthrough
4317 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4318 and @option{-Wno-implicit-fallthrough} is the same as
4319 @option{-Wimplicit-fallthrough=0}.
4321 @item -Wimplicit-fallthrough=@var{n}
4322 @opindex Wimplicit-fallthrough=
4323 Warn when a switch case falls through. For example:
4341 This warning does not warn when the last statement of a case cannot
4342 fall through, e.g. when there is a return statement or a call to function
4343 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4344 also takes into account control flow statements, such as ifs, and only
4345 warns when appropriate. E.g.@:
4355 @} else if (i < 1) @{
4365 Since there are occasions where a switch case fall through is desirable,
4366 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4367 to be used along with a null statement to suppress this warning that
4368 would normally occur:
4376 __attribute__ ((fallthrough));
4383 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4384 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4385 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4386 Instead of these attributes, it is also possible to add a fallthrough comment
4387 to silence the warning. The whole body of the C or C++ style comment should
4388 match the given regular expressions listed below. The option argument @var{n}
4389 specifies what kind of comments are accepted:
4393 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4395 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4396 expression, any comment is used as fallthrough comment.
4398 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4399 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4401 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4402 following regular expressions:
4406 @item @code{-fallthrough}
4408 @item @code{@@fallthrough@@}
4410 @item @code{lint -fallthrough[ \t]*}
4412 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4414 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4416 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4420 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4421 following regular expressions:
4425 @item @code{-fallthrough}
4427 @item @code{@@fallthrough@@}
4429 @item @code{lint -fallthrough[ \t]*}
4431 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4435 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4436 fallthrough comments, only attributes disable the warning.
4440 The comment needs to be followed after optional whitespace and other comments
4441 by @code{case} or @code{default} keywords or by a user label that precedes some
4442 @code{case} or @code{default} label.
4457 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4459 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4460 @opindex Wif-not-aligned
4461 @opindex Wno-if-not-aligned
4462 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4463 should be issued. This is is enabled by default.
4464 Use @option{-Wno-if-not-aligned} to disable it.
4466 @item -Wignored-qualifiers @r{(C and C++ only)}
4467 @opindex Wignored-qualifiers
4468 @opindex Wno-ignored-qualifiers
4469 Warn if the return type of a function has a type qualifier
4470 such as @code{const}. For ISO C such a type qualifier has no effect,
4471 since the value returned by a function is not an lvalue.
4472 For C++, the warning is only emitted for scalar types or @code{void}.
4473 ISO C prohibits qualified @code{void} return types on function
4474 definitions, so such return types always receive a warning
4475 even without this option.
4477 This warning is also enabled by @option{-Wextra}.
4479 @item -Wignored-attributes @r{(C and C++ only)}
4480 @opindex Wignored-attributes
4481 @opindex Wno-ignored-attributes
4482 Warn when an attribute is ignored. This is different from the
4483 @option{-Wattributes} option in that it warns whenever the compiler decides
4484 to drop an attribute, not that the attribute is either unknown, used in a
4485 wrong place, etc. This warning is enabled by default.
4490 Warn if the type of @code{main} is suspicious. @code{main} should be
4491 a function with external linkage, returning int, taking either zero
4492 arguments, two, or three arguments of appropriate types. This warning
4493 is enabled by default in C++ and is enabled by either @option{-Wall}
4494 or @option{-Wpedantic}.
4496 @item -Wmisleading-indentation @r{(C and C++ only)}
4497 @opindex Wmisleading-indentation
4498 @opindex Wno-misleading-indentation
4499 Warn when the indentation of the code does not reflect the block structure.
4500 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4501 @code{for} clauses with a guarded statement that does not use braces,
4502 followed by an unguarded statement with the same indentation.
4504 In the following example, the call to ``bar'' is misleadingly indented as
4505 if it were guarded by the ``if'' conditional.
4508 if (some_condition ())
4510 bar (); /* Gotcha: this is not guarded by the "if". */
4513 In the case of mixed tabs and spaces, the warning uses the
4514 @option{-ftabstop=} option to determine if the statements line up
4517 The warning is not issued for code involving multiline preprocessor logic
4518 such as the following example.
4523 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4529 The warning is not issued after a @code{#line} directive, since this
4530 typically indicates autogenerated code, and no assumptions can be made
4531 about the layout of the file that the directive references.
4533 This warning is enabled by @option{-Wall} in C and C++.
4535 @item -Wmissing-braces
4536 @opindex Wmissing-braces
4537 @opindex Wno-missing-braces
4538 Warn if an aggregate or union initializer is not fully bracketed. In
4539 the following example, the initializer for @code{a} is not fully
4540 bracketed, but that for @code{b} is fully bracketed. This warning is
4541 enabled by @option{-Wall} in C.
4544 int a[2][2] = @{ 0, 1, 2, 3 @};
4545 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4548 This warning is enabled by @option{-Wall}.
4550 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4551 @opindex Wmissing-include-dirs
4552 @opindex Wno-missing-include-dirs
4553 Warn if a user-supplied include directory does not exist.
4555 @item -Wmultistatement-macros
4556 @opindex Wmultistatement-macros
4557 @opindex Wno-multistatement-macros
4558 Warn about unsafe multiple statement macros that appear to be guarded
4559 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
4560 @code{while}, in which only the first statement is actually guarded after
4561 the macro is expanded.
4566 #define DOIT x++; y++
4571 will increment @code{y} unconditionally, not just when @code{c} holds.
4572 The can usually be fixed by wrapping the macro in a do-while loop:
4574 #define DOIT do @{ x++; y++; @} while (0)
4579 This warning is enabled by @option{-Wall} in C and C++.
4582 @opindex Wparentheses
4583 @opindex Wno-parentheses
4584 Warn if parentheses are omitted in certain contexts, such
4585 as when there is an assignment in a context where a truth value
4586 is expected, or when operators are nested whose precedence people
4587 often get confused about.
4589 Also warn if a comparison like @code{x<=y<=z} appears; this is
4590 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4591 interpretation from that of ordinary mathematical notation.
4593 Also warn for dangerous uses of the GNU extension to
4594 @code{?:} with omitted middle operand. When the condition
4595 in the @code{?}: operator is a boolean expression, the omitted value is
4596 always 1. Often programmers expect it to be a value computed
4597 inside the conditional expression instead.
4599 For C++ this also warns for some cases of unnecessary parentheses in
4600 declarations, which can indicate an attempt at a function call instead
4604 // Declares a local variable called mymutex.
4605 std::unique_lock<std::mutex> (mymutex);
4606 // User meant std::unique_lock<std::mutex> lock (mymutex);
4610 This warning is enabled by @option{-Wall}.
4612 @item -Wsequence-point
4613 @opindex Wsequence-point
4614 @opindex Wno-sequence-point
4615 Warn about code that may have undefined semantics because of violations
4616 of sequence point rules in the C and C++ standards.
4618 The C and C++ standards define the order in which expressions in a C/C++
4619 program are evaluated in terms of @dfn{sequence points}, which represent
4620 a partial ordering between the execution of parts of the program: those
4621 executed before the sequence point, and those executed after it. These
4622 occur after the evaluation of a full expression (one which is not part
4623 of a larger expression), after the evaluation of the first operand of a
4624 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4625 function is called (but after the evaluation of its arguments and the
4626 expression denoting the called function), and in certain other places.
4627 Other than as expressed by the sequence point rules, the order of
4628 evaluation of subexpressions of an expression is not specified. All
4629 these rules describe only a partial order rather than a total order,
4630 since, for example, if two functions are called within one expression
4631 with no sequence point between them, the order in which the functions
4632 are called is not specified. However, the standards committee have
4633 ruled that function calls do not overlap.
4635 It is not specified when between sequence points modifications to the
4636 values of objects take effect. Programs whose behavior depends on this
4637 have undefined behavior; the C and C++ standards specify that ``Between
4638 the previous and next sequence point an object shall have its stored
4639 value modified at most once by the evaluation of an expression.
4640 Furthermore, the prior value shall be read only to determine the value
4641 to be stored.''. If a program breaks these rules, the results on any
4642 particular implementation are entirely unpredictable.
4644 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4645 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4646 diagnosed by this option, and it may give an occasional false positive
4647 result, but in general it has been found fairly effective at detecting
4648 this sort of problem in programs.
4650 The C++17 standard will define the order of evaluation of operands in
4651 more cases: in particular it requires that the right-hand side of an
4652 assignment be evaluated before the left-hand side, so the above
4653 examples are no longer undefined. But this warning will still warn
4654 about them, to help people avoid writing code that is undefined in C
4655 and earlier revisions of C++.
4657 The standard is worded confusingly, therefore there is some debate
4658 over the precise meaning of the sequence point rules in subtle cases.
4659 Links to discussions of the problem, including proposed formal
4660 definitions, may be found on the GCC readings page, at
4661 @uref{http://gcc.gnu.org/@/readings.html}.
4663 This warning is enabled by @option{-Wall} for C and C++.
4665 @item -Wno-return-local-addr
4666 @opindex Wno-return-local-addr
4667 @opindex Wreturn-local-addr
4668 Do not warn about returning a pointer (or in C++, a reference) to a
4669 variable that goes out of scope after the function returns.
4672 @opindex Wreturn-type
4673 @opindex Wno-return-type
4674 Warn whenever a function is defined with a return type that defaults
4675 to @code{int}. Also warn about any @code{return} statement with no
4676 return value in a function whose return type is not @code{void}
4677 (falling off the end of the function body is considered returning
4680 For C only, warn about a @code{return} statement with an expression in a
4681 function whose return type is @code{void}, unless the expression type is
4682 also @code{void}. As a GNU extension, the latter case is accepted
4683 without a warning unless @option{-Wpedantic} is used.
4685 For C++, a function without return type always produces a diagnostic
4686 message, even when @option{-Wno-return-type} is specified. The only
4687 exceptions are @code{main} and functions defined in system headers.
4689 This warning is enabled by @option{-Wall}.
4691 @item -Wshift-count-negative
4692 @opindex Wshift-count-negative
4693 @opindex Wno-shift-count-negative
4694 Warn if shift count is negative. This warning is enabled by default.
4696 @item -Wshift-count-overflow
4697 @opindex Wshift-count-overflow
4698 @opindex Wno-shift-count-overflow
4699 Warn if shift count >= width of type. This warning is enabled by default.
4701 @item -Wshift-negative-value
4702 @opindex Wshift-negative-value
4703 @opindex Wno-shift-negative-value
4704 Warn if left shifting a negative value. This warning is enabled by
4705 @option{-Wextra} in C99 and C++11 modes (and newer).
4707 @item -Wshift-overflow
4708 @itemx -Wshift-overflow=@var{n}
4709 @opindex Wshift-overflow
4710 @opindex Wno-shift-overflow
4711 Warn about left shift overflows. This warning is enabled by
4712 default in C99 and C++11 modes (and newer).
4715 @item -Wshift-overflow=1
4716 This is the warning level of @option{-Wshift-overflow} and is enabled
4717 by default in C99 and C++11 modes (and newer). This warning level does
4718 not warn about left-shifting 1 into the sign bit. (However, in C, such
4719 an overflow is still rejected in contexts where an integer constant expression
4722 @item -Wshift-overflow=2
4723 This warning level also warns about left-shifting 1 into the sign bit,
4724 unless C++14 mode is active.
4730 Warn whenever a @code{switch} statement has an index of enumerated type
4731 and lacks a @code{case} for one or more of the named codes of that
4732 enumeration. (The presence of a @code{default} label prevents this
4733 warning.) @code{case} labels outside the enumeration range also
4734 provoke warnings when this option is used (even if there is a
4735 @code{default} label).
4736 This warning is enabled by @option{-Wall}.
4738 @item -Wswitch-default
4739 @opindex Wswitch-default
4740 @opindex Wno-switch-default
4741 Warn whenever a @code{switch} statement does not have a @code{default}
4745 @opindex Wswitch-enum
4746 @opindex Wno-switch-enum
4747 Warn whenever a @code{switch} statement has an index of enumerated type
4748 and lacks a @code{case} for one or more of the named codes of that
4749 enumeration. @code{case} labels outside the enumeration range also
4750 provoke warnings when this option is used. The only difference
4751 between @option{-Wswitch} and this option is that this option gives a
4752 warning about an omitted enumeration code even if there is a
4753 @code{default} label.
4756 @opindex Wswitch-bool
4757 @opindex Wno-switch-bool
4758 Warn whenever a @code{switch} statement has an index of boolean type
4759 and the case values are outside the range of a boolean type.
4760 It is possible to suppress this warning by casting the controlling
4761 expression to a type other than @code{bool}. For example:
4764 switch ((int) (a == 4))
4770 This warning is enabled by default for C and C++ programs.
4772 @item -Wswitch-unreachable
4773 @opindex Wswitch-unreachable
4774 @opindex Wno-switch-unreachable
4775 Warn whenever a @code{switch} statement contains statements between the
4776 controlling expression and the first case label, which will never be
4777 executed. For example:
4789 @option{-Wswitch-unreachable} does not warn if the statement between the
4790 controlling expression and the first case label is just a declaration:
4803 This warning is enabled by default for C and C++ programs.
4805 @item -Wsync-nand @r{(C and C++ only)}
4807 @opindex Wno-sync-nand
4808 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4809 built-in functions are used. These functions changed semantics in GCC 4.4.
4811 @item -Wunused-but-set-parameter
4812 @opindex Wunused-but-set-parameter
4813 @opindex Wno-unused-but-set-parameter
4814 Warn whenever a function parameter is assigned to, but otherwise unused
4815 (aside from its declaration).
4817 To suppress this warning use the @code{unused} attribute
4818 (@pxref{Variable Attributes}).
4820 This warning is also enabled by @option{-Wunused} together with
4823 @item -Wunused-but-set-variable
4824 @opindex Wunused-but-set-variable
4825 @opindex Wno-unused-but-set-variable
4826 Warn whenever a local variable is assigned to, but otherwise unused
4827 (aside from its declaration).
4828 This warning is enabled by @option{-Wall}.
4830 To suppress this warning use the @code{unused} attribute
4831 (@pxref{Variable Attributes}).
4833 This warning is also enabled by @option{-Wunused}, which is enabled
4836 @item -Wunused-function
4837 @opindex Wunused-function
4838 @opindex Wno-unused-function
4839 Warn whenever a static function is declared but not defined or a
4840 non-inline static function is unused.
4841 This warning is enabled by @option{-Wall}.
4843 @item -Wunused-label
4844 @opindex Wunused-label
4845 @opindex Wno-unused-label
4846 Warn whenever a label is declared but not used.
4847 This warning is enabled by @option{-Wall}.
4849 To suppress this warning use the @code{unused} attribute
4850 (@pxref{Variable Attributes}).
4852 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4853 @opindex Wunused-local-typedefs
4854 Warn when a typedef locally defined in a function is not used.
4855 This warning is enabled by @option{-Wall}.
4857 @item -Wunused-parameter
4858 @opindex Wunused-parameter
4859 @opindex Wno-unused-parameter
4860 Warn whenever a function parameter is unused aside from its declaration.
4862 To suppress this warning use the @code{unused} attribute
4863 (@pxref{Variable Attributes}).
4865 @item -Wno-unused-result
4866 @opindex Wunused-result
4867 @opindex Wno-unused-result
4868 Do not warn if a caller of a function marked with attribute
4869 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4870 its return value. The default is @option{-Wunused-result}.
4872 @item -Wunused-variable
4873 @opindex Wunused-variable
4874 @opindex Wno-unused-variable
4875 Warn whenever a local or static variable is unused aside from its
4876 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4877 but not for C++. This warning is enabled by @option{-Wall}.
4879 To suppress this warning use the @code{unused} attribute
4880 (@pxref{Variable Attributes}).
4882 @item -Wunused-const-variable
4883 @itemx -Wunused-const-variable=@var{n}
4884 @opindex Wunused-const-variable
4885 @opindex Wno-unused-const-variable
4886 Warn whenever a constant static variable is unused aside from its declaration.
4887 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4888 for C, but not for C++. In C this declares variable storage, but in C++ this
4889 is not an error since const variables take the place of @code{#define}s.
4891 To suppress this warning use the @code{unused} attribute
4892 (@pxref{Variable Attributes}).
4895 @item -Wunused-const-variable=1
4896 This is the warning level that is enabled by @option{-Wunused-variable} for
4897 C. It warns only about unused static const variables defined in the main
4898 compilation unit, but not about static const variables declared in any
4901 @item -Wunused-const-variable=2
4902 This warning level also warns for unused constant static variables in
4903 headers (excluding system headers). This is the warning level of
4904 @option{-Wunused-const-variable} and must be explicitly requested since
4905 in C++ this isn't an error and in C it might be harder to clean up all
4909 @item -Wunused-value
4910 @opindex Wunused-value
4911 @opindex Wno-unused-value
4912 Warn whenever a statement computes a result that is explicitly not
4913 used. To suppress this warning cast the unused expression to
4914 @code{void}. This includes an expression-statement or the left-hand
4915 side of a comma expression that contains no side effects. For example,
4916 an expression such as @code{x[i,j]} causes a warning, while
4917 @code{x[(void)i,j]} does not.
4919 This warning is enabled by @option{-Wall}.
4924 All the above @option{-Wunused} options combined.
4926 In order to get a warning about an unused function parameter, you must
4927 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4928 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4930 @item -Wuninitialized
4931 @opindex Wuninitialized
4932 @opindex Wno-uninitialized
4933 Warn if an automatic variable is used without first being initialized
4934 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4935 warn if a non-static reference or non-static @code{const} member
4936 appears in a class without constructors.
4938 If you want to warn about code that uses the uninitialized value of the
4939 variable in its own initializer, use the @option{-Winit-self} option.
4941 These warnings occur for individual uninitialized or clobbered
4942 elements of structure, union or array variables as well as for
4943 variables that are uninitialized or clobbered as a whole. They do
4944 not occur for variables or elements declared @code{volatile}. Because
4945 these warnings depend on optimization, the exact variables or elements
4946 for which there are warnings depends on the precise optimization
4947 options and version of GCC used.
4949 Note that there may be no warning about a variable that is used only
4950 to compute a value that itself is never used, because such
4951 computations may be deleted by data flow analysis before the warnings
4954 @item -Winvalid-memory-model
4955 @opindex Winvalid-memory-model
4956 @opindex Wno-invalid-memory-model
4957 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4958 and the C11 atomic generic functions with a memory consistency argument
4959 that is either invalid for the operation or outside the range of values
4960 of the @code{memory_order} enumeration. For example, since the
4961 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4962 defined for the relaxed, release, and sequentially consistent memory
4963 orders the following code is diagnosed:
4968 __atomic_store_n (i, 0, memory_order_consume);
4972 @option{-Winvalid-memory-model} is enabled by default.
4974 @item -Wmaybe-uninitialized
4975 @opindex Wmaybe-uninitialized
4976 @opindex Wno-maybe-uninitialized
4977 For an automatic (i.e.@ local) variable, if there exists a path from the
4978 function entry to a use of the variable that is initialized, but there exist
4979 some other paths for which the variable is not initialized, the compiler
4980 emits a warning if it cannot prove the uninitialized paths are not
4981 executed at run time.
4983 These warnings are only possible in optimizing compilation, because otherwise
4984 GCC does not keep track of the state of variables.
4986 These warnings are made optional because GCC may not be able to determine when
4987 the code is correct in spite of appearing to have an error. Here is one
4988 example of how this can happen:
5008 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5009 always initialized, but GCC doesn't know this. To suppress the
5010 warning, you need to provide a default case with assert(0) or
5013 @cindex @code{longjmp} warnings
5014 This option also warns when a non-volatile automatic variable might be
5015 changed by a call to @code{longjmp}.
5016 The compiler sees only the calls to @code{setjmp}. It cannot know
5017 where @code{longjmp} will be called; in fact, a signal handler could
5018 call it at any point in the code. As a result, you may get a warning
5019 even when there is in fact no problem because @code{longjmp} cannot
5020 in fact be called at the place that would cause a problem.
5022 Some spurious warnings can be avoided if you declare all the functions
5023 you use that never return as @code{noreturn}. @xref{Function
5026 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5028 @item -Wunknown-pragmas
5029 @opindex Wunknown-pragmas
5030 @opindex Wno-unknown-pragmas
5031 @cindex warning for unknown pragmas
5032 @cindex unknown pragmas, warning
5033 @cindex pragmas, warning of unknown
5034 Warn when a @code{#pragma} directive is encountered that is not understood by
5035 GCC@. If this command-line option is used, warnings are even issued
5036 for unknown pragmas in system header files. This is not the case if
5037 the warnings are only enabled by the @option{-Wall} command-line option.
5040 @opindex Wno-pragmas
5042 Do not warn about misuses of pragmas, such as incorrect parameters,
5043 invalid syntax, or conflicts between pragmas. See also
5044 @option{-Wunknown-pragmas}.
5046 @item -Wstrict-aliasing
5047 @opindex Wstrict-aliasing
5048 @opindex Wno-strict-aliasing
5049 This option is only active when @option{-fstrict-aliasing} is active.
5050 It warns about code that might break the strict aliasing rules that the
5051 compiler is using for optimization. The warning does not catch all
5052 cases, but does attempt to catch the more common pitfalls. It is
5053 included in @option{-Wall}.
5054 It is equivalent to @option{-Wstrict-aliasing=3}
5056 @item -Wstrict-aliasing=n
5057 @opindex Wstrict-aliasing=n
5058 This option is only active when @option{-fstrict-aliasing} is active.
5059 It warns about code that might break the strict aliasing rules that the
5060 compiler is using for optimization.
5061 Higher levels correspond to higher accuracy (fewer false positives).
5062 Higher levels also correspond to more effort, similar to the way @option{-O}
5064 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5066 Level 1: Most aggressive, quick, least accurate.
5067 Possibly useful when higher levels
5068 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5069 false negatives. However, it has many false positives.
5070 Warns for all pointer conversions between possibly incompatible types,
5071 even if never dereferenced. Runs in the front end only.
5073 Level 2: Aggressive, quick, not too precise.
5074 May still have many false positives (not as many as level 1 though),
5075 and few false negatives (but possibly more than level 1).
5076 Unlike level 1, it only warns when an address is taken. Warns about
5077 incomplete types. Runs in the front end only.
5079 Level 3 (default for @option{-Wstrict-aliasing}):
5080 Should have very few false positives and few false
5081 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5082 Takes care of the common pun+dereference pattern in the front end:
5083 @code{*(int*)&some_float}.
5084 If optimization is enabled, it also runs in the back end, where it deals
5085 with multiple statement cases using flow-sensitive points-to information.
5086 Only warns when the converted pointer is dereferenced.
5087 Does not warn about incomplete types.
5089 @item -Wstrict-overflow
5090 @itemx -Wstrict-overflow=@var{n}
5091 @opindex Wstrict-overflow
5092 @opindex Wno-strict-overflow
5093 This option is only active when signed overflow is undefined.
5094 It warns about cases where the compiler optimizes based on the
5095 assumption that signed overflow does not occur. Note that it does not
5096 warn about all cases where the code might overflow: it only warns
5097 about cases where the compiler implements some optimization. Thus
5098 this warning depends on the optimization level.
5100 An optimization that assumes that signed overflow does not occur is
5101 perfectly safe if the values of the variables involved are such that
5102 overflow never does, in fact, occur. Therefore this warning can
5103 easily give a false positive: a warning about code that is not
5104 actually a problem. To help focus on important issues, several
5105 warning levels are defined. No warnings are issued for the use of
5106 undefined signed overflow when estimating how many iterations a loop
5107 requires, in particular when determining whether a loop will be
5111 @item -Wstrict-overflow=1
5112 Warn about cases that are both questionable and easy to avoid. For
5113 example the compiler simplifies
5114 @code{x + 1 > x} to @code{1}. This level of
5115 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5116 are not, and must be explicitly requested.
5118 @item -Wstrict-overflow=2
5119 Also warn about other cases where a comparison is simplified to a
5120 constant. For example: @code{abs (x) >= 0}. This can only be
5121 simplified when signed integer overflow is undefined, because
5122 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5123 zero. @option{-Wstrict-overflow} (with no level) is the same as
5124 @option{-Wstrict-overflow=2}.
5126 @item -Wstrict-overflow=3
5127 Also warn about other cases where a comparison is simplified. For
5128 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5130 @item -Wstrict-overflow=4
5131 Also warn about other simplifications not covered by the above cases.
5132 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5134 @item -Wstrict-overflow=5
5135 Also warn about cases where the compiler reduces the magnitude of a
5136 constant involved in a comparison. For example: @code{x + 2 > y} is
5137 simplified to @code{x + 1 >= y}. This is reported only at the
5138 highest warning level because this simplification applies to many
5139 comparisons, so this warning level gives a very large number of
5143 @item -Wstringop-overflow
5144 @itemx -Wstringop-overflow=@var{type}
5145 @opindex Wstringop-overflow
5146 @opindex Wno-stringop-overflow
5147 Warn for calls to string manipulation functions such as @code{memcpy} and
5148 @code{strcpy} that are determined to overflow the destination buffer. The
5149 optional argument is one greater than the type of Object Size Checking to
5150 perform to determine the size of the destination. @xref{Object Size Checking}.
5151 The argument is meaningful only for functions that operate on character arrays
5152 but not for raw memory functions like @code{memcpy} which always make use
5153 of Object Size type-0. The option also warns for calls that specify a size
5154 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5155 The option produces the best results with optimization enabled but can detect
5156 a small subset of simple buffer overflows even without optimization in
5157 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5158 correspond to the standard functions. In any case, the option warns about
5159 just a subset of buffer overflows detected by the corresponding overflow
5160 checking built-ins. For example, the option will issue a warning for
5161 the @code{strcpy} call below because it copies at least 5 characters
5162 (the string @code{"blue"} including the terminating NUL) into the buffer
5166 enum Color @{ blue, purple, yellow @};
5167 const char* f (enum Color clr)
5169 static char buf [4];
5173 case blue: str = "blue"; break;
5174 case purple: str = "purple"; break;
5175 case yellow: str = "yellow"; break;
5178 return strcpy (buf, str); // warning here
5182 Option @option{-Wstringop-overflow=2} is enabled by default.
5185 @item -Wstringop-overflow
5186 @item -Wstringop-overflow=1
5187 @opindex Wstringop-overflow
5188 @opindex Wno-stringop-overflow
5189 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5190 to determine the sizes of destination objects. This is the default setting
5191 of the option. At this setting the option will not warn for writes past
5192 the end of subobjects of larger objects accessed by pointers unless the
5193 size of the largest surrounding object is known. When the destination may
5194 be one of several objects it is assumed to be the largest one of them. On
5195 Linux systems, when optimization is enabled at this setting the option warns
5196 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5199 @item -Wstringop-overflow=2
5200 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5201 to determine the sizes of destination objects. At this setting the option
5202 will warn about overflows when writing to members of the largest complete
5203 objects whose exact size is known. It will, however, not warn for excessive
5204 writes to the same members of unknown objects referenced by pointers since
5205 they may point to arrays containing unknown numbers of elements.
5207 @item -Wstringop-overflow=3
5208 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5209 to determine the sizes of destination objects. At this setting the option
5210 warns about overflowing the smallest object or data member. This is the
5211 most restrictive setting of the option that may result in warnings for safe
5214 @item -Wstringop-overflow=4
5215 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5216 to determine the sizes of destination objects. At this setting the option
5217 will warn about overflowing any data members, and when the destination is
5218 one of several objects it uses the size of the largest of them to decide
5219 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5220 setting of the option may result in warnings for benign code.
5223 @item -Wstringop-truncation
5224 @opindex Wstringop-truncation
5225 @opindex Wno-stringop-truncation
5226 Warn for calls to bounded string manipulation functions such as @code{strncat},
5227 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5228 or leave the destination unchanged.
5230 In the following example, the call to @code{strncat} specifies a bound that
5231 is less than the length of the source string. As a result, the copy of
5232 the source will be truncated and so the call is diagnosed. To avoid the
5233 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5236 void append (char *buf, size_t bufsize)
5238 strncat (buf, ".txt", 3);
5242 As another example, the following call to @code{strncpy} results in copying
5243 to @code{d} just the characters preceding the terminating NUL, without
5244 appending the NUL to the end. Assuming the result of @code{strncpy} is
5245 necessarily a NUL-terminated string is a common mistake, and so the call
5246 is diagnosed. To avoid the warning when the result is not expected to be
5247 NUL-terminated, call @code{memcpy} instead.
5250 void copy (char *d, const char *s)
5252 strncpy (d, s, strlen (s));
5256 In the following example, the call to @code{strncpy} specifies the size
5257 of the destination buffer as the bound. If the length of the source
5258 string is equal to or greater than this size the result of the copy will
5259 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5260 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5261 element of the buffer to @code{NUL}.
5264 void copy (const char *s)
5267 strncpy (buf, s, sizeof buf);
5272 In situations where a character array is intended to store a sequence
5273 of bytes with no terminating @code{NUL} such an array may be annotated
5274 with attribute @code{nonstring} to avoid this warning. Such arrays,
5275 however, are not suitable arguments to functions that expect
5276 @code{NUL}-terminated strings. To help detect accidental misuses of
5277 such arrays GCC issues warnings unless it can prove that the use is
5278 safe. @xref{Common Variable Attributes}.
5280 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5281 @opindex Wsuggest-attribute=
5282 @opindex Wno-suggest-attribute=
5283 Warn for cases where adding an attribute may be beneficial. The
5284 attributes currently supported are listed below.
5287 @item -Wsuggest-attribute=pure
5288 @itemx -Wsuggest-attribute=const
5289 @itemx -Wsuggest-attribute=noreturn
5290 @itemx -Wsuggest-attribute=malloc
5291 @opindex Wsuggest-attribute=pure
5292 @opindex Wno-suggest-attribute=pure
5293 @opindex Wsuggest-attribute=const
5294 @opindex Wno-suggest-attribute=const
5295 @opindex Wsuggest-attribute=noreturn
5296 @opindex Wno-suggest-attribute=noreturn
5297 @opindex Wsuggest-attribute=malloc
5298 @opindex Wno-suggest-attribute=malloc
5300 Warn about functions that might be candidates for attributes
5301 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5302 only warns for functions visible in other compilation units or (in the case of
5303 @code{pure} and @code{const}) if it cannot prove that the function returns
5304 normally. A function returns normally if it doesn't contain an infinite loop or
5305 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5306 requires option @option{-fipa-pure-const}, which is enabled by default at
5307 @option{-O} and higher. Higher optimization levels improve the accuracy
5310 @item -Wsuggest-attribute=format
5311 @itemx -Wmissing-format-attribute
5312 @opindex Wsuggest-attribute=format
5313 @opindex Wmissing-format-attribute
5314 @opindex Wno-suggest-attribute=format
5315 @opindex Wno-missing-format-attribute
5319 Warn about function pointers that might be candidates for @code{format}
5320 attributes. Note these are only possible candidates, not absolute ones.
5321 GCC guesses that function pointers with @code{format} attributes that
5322 are used in assignment, initialization, parameter passing or return
5323 statements should have a corresponding @code{format} attribute in the
5324 resulting type. I.e.@: the left-hand side of the assignment or
5325 initialization, the type of the parameter variable, or the return type
5326 of the containing function respectively should also have a @code{format}
5327 attribute to avoid the warning.
5329 GCC also warns about function definitions that might be
5330 candidates for @code{format} attributes. Again, these are only
5331 possible candidates. GCC guesses that @code{format} attributes
5332 might be appropriate for any function that calls a function like
5333 @code{vprintf} or @code{vscanf}, but this might not always be the
5334 case, and some functions for which @code{format} attributes are
5335 appropriate may not be detected.
5337 @item -Wsuggest-attribute=cold
5338 @opindex Wsuggest-attribute=cold
5339 @opindex Wno-suggest-attribute=cold
5341 Warn about functions that might be candidates for @code{cold} attribute. This
5342 is based on static detection and generally will only warn about functions which
5343 always leads to a call to another @code{cold} function such as wrappers of
5344 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5347 @item -Wsuggest-final-types
5348 @opindex Wno-suggest-final-types
5349 @opindex Wsuggest-final-types
5350 Warn about types with virtual methods where code quality would be improved
5351 if the type were declared with the C++11 @code{final} specifier,
5353 declared in an anonymous namespace. This allows GCC to more aggressively
5354 devirtualize the polymorphic calls. This warning is more effective with link
5355 time optimization, where the information about the class hierarchy graph is
5358 @item -Wsuggest-final-methods
5359 @opindex Wno-suggest-final-methods
5360 @opindex Wsuggest-final-methods
5361 Warn about virtual methods where code quality would be improved if the method
5362 were declared with the C++11 @code{final} specifier,
5363 or, if possible, its type were
5364 declared in an anonymous namespace or with the @code{final} specifier.
5366 more effective with link-time optimization, where the information about the
5367 class hierarchy graph is more complete. It is recommended to first consider
5368 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5371 @item -Wsuggest-override
5372 Warn about overriding virtual functions that are not marked with the override
5376 @opindex Wno-alloc-zero
5377 @opindex Walloc-zero
5378 Warn about calls to allocation functions decorated with attribute
5379 @code{alloc_size} that specify zero bytes, including those to the built-in
5380 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5381 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5382 when called with a zero size differs among implementations (and in the case
5383 of @code{realloc} has been deprecated) relying on it may result in subtle
5384 portability bugs and should be avoided.
5386 @item -Walloc-size-larger-than=@var{n}
5387 Warn about calls to functions decorated with attribute @code{alloc_size}
5388 that attempt to allocate objects larger than the specified number of bytes,
5389 or where the result of the size computation in an integer type with infinite
5390 precision would exceed @code{SIZE_MAX / 2}. The option argument @var{n}
5391 may end in one of the standard suffixes designating a multiple of bytes
5392 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
5393 @code{MB} and @code{MiB} for megabyte and mebibyte, and so on.
5394 @xref{Function Attributes}.
5399 This option warns on all uses of @code{alloca} in the source.
5401 @item -Walloca-larger-than=@var{n}
5402 This option warns on calls to @code{alloca} that are not bounded by a
5403 controlling predicate limiting its argument of integer type to at most
5404 @var{n} bytes, or calls to @code{alloca} where the bound is unknown.
5405 Arguments of non-integer types are considered unbounded even if they
5406 appear to be constrained to the expected range.
5408 For example, a bounded case of @code{alloca} could be:
5411 void func (size_t n)
5422 In the above example, passing @code{-Walloca-larger-than=1000} would not
5423 issue a warning because the call to @code{alloca} is known to be at most
5424 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5425 the compiler would emit a warning.
5427 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5428 controlling predicate constraining its integer argument. For example:
5433 void *p = alloca (n);
5438 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5439 a warning, but this time because of the lack of bounds checking.
5441 Note, that even seemingly correct code involving signed integers could
5445 void func (signed int n)
5455 In the above example, @var{n} could be negative, causing a larger than
5456 expected argument to be implicitly cast into the @code{alloca} call.
5458 This option also warns when @code{alloca} is used in a loop.
5460 This warning is not enabled by @option{-Wall}, and is only active when
5461 @option{-ftree-vrp} is active (default for @option{-O2} and above).
5463 See also @option{-Wvla-larger-than=@var{n}}.
5465 @item -Warray-bounds
5466 @itemx -Warray-bounds=@var{n}
5467 @opindex Wno-array-bounds
5468 @opindex Warray-bounds
5469 This option is only active when @option{-ftree-vrp} is active
5470 (default for @option{-O2} and above). It warns about subscripts to arrays
5471 that are always out of bounds. This warning is enabled by @option{-Wall}.
5474 @item -Warray-bounds=1
5475 This is the warning level of @option{-Warray-bounds} and is enabled
5476 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5478 @item -Warray-bounds=2
5479 This warning level also warns about out of bounds access for
5480 arrays at the end of a struct and for arrays accessed through
5481 pointers. This warning level may give a larger number of
5482 false positives and is deactivated by default.
5485 @item -Wattribute-alias
5486 Warn about declarations using the @code{alias} and similar attributes whose
5487 target is incompatible with the type of the alias. @xref{Function Attributes,
5488 ,Declaring Attributes of Functions}.
5490 @item -Wbool-compare
5491 @opindex Wno-bool-compare
5492 @opindex Wbool-compare
5493 Warn about boolean expression compared with an integer value different from
5494 @code{true}/@code{false}. For instance, the following comparison is
5499 if ((n > 1) == 2) @{ @dots{} @}
5501 This warning is enabled by @option{-Wall}.
5503 @item -Wbool-operation
5504 @opindex Wno-bool-operation
5505 @opindex Wbool-operation
5506 Warn about suspicious operations on expressions of a boolean type. For
5507 instance, bitwise negation of a boolean is very likely a bug in the program.
5508 For C, this warning also warns about incrementing or decrementing a boolean,
5509 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5510 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
5512 This warning is enabled by @option{-Wall}.
5514 @item -Wduplicated-branches
5515 @opindex Wno-duplicated-branches
5516 @opindex Wduplicated-branches
5517 Warn when an if-else has identical branches. This warning detects cases like
5524 It doesn't warn when both branches contain just a null statement. This warning
5525 also warn for conditional operators:
5527 int i = x ? *p : *p;
5530 @item -Wduplicated-cond
5531 @opindex Wno-duplicated-cond
5532 @opindex Wduplicated-cond
5533 Warn about duplicated conditions in an if-else-if chain. For instance,
5534 warn for the following code:
5536 if (p->q != NULL) @{ @dots{} @}
5537 else if (p->q != NULL) @{ @dots{} @}
5540 @item -Wframe-address
5541 @opindex Wno-frame-address
5542 @opindex Wframe-address
5543 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5544 is called with an argument greater than 0. Such calls may return indeterminate
5545 values or crash the program. The warning is included in @option{-Wall}.
5547 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5548 @opindex Wno-discarded-qualifiers
5549 @opindex Wdiscarded-qualifiers
5550 Do not warn if type qualifiers on pointers are being discarded.
5551 Typically, the compiler warns if a @code{const char *} variable is
5552 passed to a function that takes a @code{char *} parameter. This option
5553 can be used to suppress such a warning.
5555 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5556 @opindex Wno-discarded-array-qualifiers
5557 @opindex Wdiscarded-array-qualifiers
5558 Do not warn if type qualifiers on arrays which are pointer targets
5559 are being discarded. Typically, the compiler warns if a
5560 @code{const int (*)[]} variable is passed to a function that
5561 takes a @code{int (*)[]} parameter. This option can be used to
5562 suppress such a warning.
5564 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5565 @opindex Wno-incompatible-pointer-types
5566 @opindex Wincompatible-pointer-types
5567 Do not warn when there is a conversion between pointers that have incompatible
5568 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5569 which warns for pointer argument passing or assignment with different
5572 @item -Wno-int-conversion @r{(C and Objective-C only)}
5573 @opindex Wno-int-conversion
5574 @opindex Wint-conversion
5575 Do not warn about incompatible integer to pointer and pointer to integer
5576 conversions. This warning is about implicit conversions; for explicit
5577 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5578 @option{-Wno-pointer-to-int-cast} may be used.
5580 @item -Wno-div-by-zero
5581 @opindex Wno-div-by-zero
5582 @opindex Wdiv-by-zero
5583 Do not warn about compile-time integer division by zero. Floating-point
5584 division by zero is not warned about, as it can be a legitimate way of
5585 obtaining infinities and NaNs.
5587 @item -Wsystem-headers
5588 @opindex Wsystem-headers
5589 @opindex Wno-system-headers
5590 @cindex warnings from system headers
5591 @cindex system headers, warnings from
5592 Print warning messages for constructs found in system header files.
5593 Warnings from system headers are normally suppressed, on the assumption
5594 that they usually do not indicate real problems and would only make the
5595 compiler output harder to read. Using this command-line option tells
5596 GCC to emit warnings from system headers as if they occurred in user
5597 code. However, note that using @option{-Wall} in conjunction with this
5598 option does @emph{not} warn about unknown pragmas in system
5599 headers---for that, @option{-Wunknown-pragmas} must also be used.
5601 @item -Wtautological-compare
5602 @opindex Wtautological-compare
5603 @opindex Wno-tautological-compare
5604 Warn if a self-comparison always evaluates to true or false. This
5605 warning detects various mistakes such as:
5609 if (i > i) @{ @dots{} @}
5612 This warning also warns about bitwise comparisons that always evaluate
5613 to true or false, for instance:
5615 if ((a & 16) == 10) @{ @dots{} @}
5617 will always be false.
5619 This warning is enabled by @option{-Wall}.
5622 @opindex Wtrampolines
5623 @opindex Wno-trampolines
5624 Warn about trampolines generated for pointers to nested functions.
5625 A trampoline is a small piece of data or code that is created at run
5626 time on the stack when the address of a nested function is taken, and is
5627 used to call the nested function indirectly. For some targets, it is
5628 made up of data only and thus requires no special treatment. But, for
5629 most targets, it is made up of code and thus requires the stack to be
5630 made executable in order for the program to work properly.
5633 @opindex Wfloat-equal
5634 @opindex Wno-float-equal
5635 Warn if floating-point values are used in equality comparisons.
5637 The idea behind this is that sometimes it is convenient (for the
5638 programmer) to consider floating-point values as approximations to
5639 infinitely precise real numbers. If you are doing this, then you need
5640 to compute (by analyzing the code, or in some other way) the maximum or
5641 likely maximum error that the computation introduces, and allow for it
5642 when performing comparisons (and when producing output, but that's a
5643 different problem). In particular, instead of testing for equality, you
5644 should check to see whether the two values have ranges that overlap; and
5645 this is done with the relational operators, so equality comparisons are
5648 @item -Wtraditional @r{(C and Objective-C only)}
5649 @opindex Wtraditional
5650 @opindex Wno-traditional
5651 Warn about certain constructs that behave differently in traditional and
5652 ISO C@. Also warn about ISO C constructs that have no traditional C
5653 equivalent, and/or problematic constructs that should be avoided.
5657 Macro parameters that appear within string literals in the macro body.
5658 In traditional C macro replacement takes place within string literals,
5659 but in ISO C it does not.
5662 In traditional C, some preprocessor directives did not exist.
5663 Traditional preprocessors only considered a line to be a directive
5664 if the @samp{#} appeared in column 1 on the line. Therefore
5665 @option{-Wtraditional} warns about directives that traditional C
5666 understands but ignores because the @samp{#} does not appear as the
5667 first character on the line. It also suggests you hide directives like
5668 @code{#pragma} not understood by traditional C by indenting them. Some
5669 traditional implementations do not recognize @code{#elif}, so this option
5670 suggests avoiding it altogether.
5673 A function-like macro that appears without arguments.
5676 The unary plus operator.
5679 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5680 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5681 constants.) Note, these suffixes appear in macros defined in the system
5682 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5683 Use of these macros in user code might normally lead to spurious
5684 warnings, however GCC's integrated preprocessor has enough context to
5685 avoid warning in these cases.
5688 A function declared external in one block and then used after the end of
5692 A @code{switch} statement has an operand of type @code{long}.
5695 A non-@code{static} function declaration follows a @code{static} one.
5696 This construct is not accepted by some traditional C compilers.
5699 The ISO type of an integer constant has a different width or
5700 signedness from its traditional type. This warning is only issued if
5701 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5702 typically represent bit patterns, are not warned about.
5705 Usage of ISO string concatenation is detected.
5708 Initialization of automatic aggregates.
5711 Identifier conflicts with labels. Traditional C lacks a separate
5712 namespace for labels.
5715 Initialization of unions. If the initializer is zero, the warning is
5716 omitted. This is done under the assumption that the zero initializer in
5717 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
5718 initializer warnings and relies on default initialization to zero in the
5722 Conversions by prototypes between fixed/floating-point values and vice
5723 versa. The absence of these prototypes when compiling with traditional
5724 C causes serious problems. This is a subset of the possible
5725 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
5728 Use of ISO C style function definitions. This warning intentionally is
5729 @emph{not} issued for prototype declarations or variadic functions
5730 because these ISO C features appear in your code when using
5731 libiberty's traditional C compatibility macros, @code{PARAMS} and
5732 @code{VPARAMS}. This warning is also bypassed for nested functions
5733 because that feature is already a GCC extension and thus not relevant to
5734 traditional C compatibility.
5737 @item -Wtraditional-conversion @r{(C and Objective-C only)}
5738 @opindex Wtraditional-conversion
5739 @opindex Wno-traditional-conversion
5740 Warn if a prototype causes a type conversion that is different from what
5741 would happen to the same argument in the absence of a prototype. This
5742 includes conversions of fixed point to floating and vice versa, and
5743 conversions changing the width or signedness of a fixed-point argument
5744 except when the same as the default promotion.
5746 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
5747 @opindex Wdeclaration-after-statement
5748 @opindex Wno-declaration-after-statement
5749 Warn when a declaration is found after a statement in a block. This
5750 construct, known from C++, was introduced with ISO C99 and is by default
5751 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
5756 Warn whenever a local variable or type declaration shadows another
5757 variable, parameter, type, class member (in C++), or instance variable
5758 (in Objective-C) or whenever a built-in function is shadowed. Note
5759 that in C++, the compiler warns if a local variable shadows an
5760 explicit typedef, but not if it shadows a struct/class/enum.
5761 Same as @option{-Wshadow=global}.
5763 @item -Wno-shadow-ivar @r{(Objective-C only)}
5764 @opindex Wno-shadow-ivar
5765 @opindex Wshadow-ivar
5766 Do not warn whenever a local variable shadows an instance variable in an
5769 @item -Wshadow=global
5770 @opindex Wshadow=local
5771 The default for @option{-Wshadow}. Warns for any (global) shadowing.
5773 @item -Wshadow=local
5774 @opindex Wshadow=local
5775 Warn when a local variable shadows another local variable or parameter.
5776 This warning is enabled by @option{-Wshadow=global}.
5778 @item -Wshadow=compatible-local
5779 @opindex Wshadow=compatible-local
5780 Warn when a local variable shadows another local variable or parameter
5781 whose type is compatible with that of the shadowing variable. In C++,
5782 type compatibility here means the type of the shadowing variable can be
5783 converted to that of the shadowed variable. The creation of this flag
5784 (in addition to @option{-Wshadow=local}) is based on the idea that when
5785 a local variable shadows another one of incompatible type, it is most
5786 likely intentional, not a bug or typo, as shown in the following example:
5790 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5792 for (int i = 0; i < N; ++i)
5801 Since the two variable @code{i} in the example above have incompatible types,
5802 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
5803 Because their types are incompatible, if a programmer accidentally uses one
5804 in place of the other, type checking will catch that and emit an error or
5805 warning. So not warning (about shadowing) in this case will not lead to
5806 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
5807 possibly reduce the number of warnings triggered by intentional shadowing.
5809 This warning is enabled by @option{-Wshadow=local}.
5811 @item -Wlarger-than=@var{len}
5812 @opindex Wlarger-than=@var{len}
5813 @opindex Wlarger-than-@var{len}
5814 Warn whenever an object of larger than @var{len} bytes is defined.
5816 @item -Wframe-larger-than=@var{len}
5817 @opindex Wframe-larger-than
5818 Warn if the size of a function frame is larger than @var{len} bytes.
5819 The computation done to determine the stack frame size is approximate
5820 and not conservative.
5821 The actual requirements may be somewhat greater than @var{len}
5822 even if you do not get a warning. In addition, any space allocated
5823 via @code{alloca}, variable-length arrays, or related constructs
5824 is not included by the compiler when determining
5825 whether or not to issue a warning.
5827 @item -Wno-free-nonheap-object
5828 @opindex Wno-free-nonheap-object
5829 @opindex Wfree-nonheap-object
5830 Do not warn when attempting to free an object that was not allocated
5833 @item -Wstack-usage=@var{len}
5834 @opindex Wstack-usage
5835 Warn if the stack usage of a function might be larger than @var{len} bytes.
5836 The computation done to determine the stack usage is conservative.
5837 Any space allocated via @code{alloca}, variable-length arrays, or related
5838 constructs is included by the compiler when determining whether or not to
5841 The message is in keeping with the output of @option{-fstack-usage}.
5845 If the stack usage is fully static but exceeds the specified amount, it's:
5848 warning: stack usage is 1120 bytes
5851 If the stack usage is (partly) dynamic but bounded, it's:
5854 warning: stack usage might be 1648 bytes
5857 If the stack usage is (partly) dynamic and not bounded, it's:
5860 warning: stack usage might be unbounded
5864 @item -Wunsafe-loop-optimizations
5865 @opindex Wunsafe-loop-optimizations
5866 @opindex Wno-unsafe-loop-optimizations
5867 Warn if the loop cannot be optimized because the compiler cannot
5868 assume anything on the bounds of the loop indices. With
5869 @option{-funsafe-loop-optimizations} warn if the compiler makes
5872 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
5873 @opindex Wno-pedantic-ms-format
5874 @opindex Wpedantic-ms-format
5875 When used in combination with @option{-Wformat}
5876 and @option{-pedantic} without GNU extensions, this option
5877 disables the warnings about non-ISO @code{printf} / @code{scanf} format
5878 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
5879 which depend on the MS runtime.
5882 @opindex Waligned-new
5883 @opindex Wno-aligned-new
5884 Warn about a new-expression of a type that requires greater alignment
5885 than the @code{alignof(std::max_align_t)} but uses an allocation
5886 function without an explicit alignment parameter. This option is
5887 enabled by @option{-Wall}.
5889 Normally this only warns about global allocation functions, but
5890 @option{-Waligned-new=all} also warns about class member allocation
5893 @item -Wplacement-new
5894 @itemx -Wplacement-new=@var{n}
5895 @opindex Wplacement-new
5896 @opindex Wno-placement-new
5897 Warn about placement new expressions with undefined behavior, such as
5898 constructing an object in a buffer that is smaller than the type of
5899 the object. For example, the placement new expression below is diagnosed
5900 because it attempts to construct an array of 64 integers in a buffer only
5906 This warning is enabled by default.
5909 @item -Wplacement-new=1
5910 This is the default warning level of @option{-Wplacement-new}. At this
5911 level the warning is not issued for some strictly undefined constructs that
5912 GCC allows as extensions for compatibility with legacy code. For example,
5913 the following @code{new} expression is not diagnosed at this level even
5914 though it has undefined behavior according to the C++ standard because
5915 it writes past the end of the one-element array.
5917 struct S @{ int n, a[1]; @};
5918 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5919 new (s->a)int [32]();
5922 @item -Wplacement-new=2
5923 At this level, in addition to diagnosing all the same constructs as at level
5924 1, a diagnostic is also issued for placement new expressions that construct
5925 an object in the last member of structure whose type is an array of a single
5926 element and whose size is less than the size of the object being constructed.
5927 While the previous example would be diagnosed, the following construct makes
5928 use of the flexible member array extension to avoid the warning at level 2.
5930 struct S @{ int n, a[]; @};
5931 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5932 new (s->a)int [32]();
5937 @item -Wpointer-arith
5938 @opindex Wpointer-arith
5939 @opindex Wno-pointer-arith
5940 Warn about anything that depends on the ``size of'' a function type or
5941 of @code{void}. GNU C assigns these types a size of 1, for
5942 convenience in calculations with @code{void *} pointers and pointers
5943 to functions. In C++, warn also when an arithmetic operation involves
5944 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
5946 @item -Wpointer-compare
5947 @opindex Wpointer-compare
5948 @opindex Wno-pointer-compare
5949 Warn if a pointer is compared with a zero character constant. This usually
5950 means that the pointer was meant to be dereferenced. For example:
5953 const char *p = foo ();
5958 Note that the code above is invalid in C++11.
5960 This warning is enabled by default.
5963 @opindex Wtype-limits
5964 @opindex Wno-type-limits
5965 Warn if a comparison is always true or always false due to the limited
5966 range of the data type, but do not warn for constant expressions. For
5967 example, warn if an unsigned variable is compared against zero with
5968 @code{<} or @code{>=}. This warning is also enabled by
5971 @include cppwarnopts.texi
5973 @item -Wbad-function-cast @r{(C and Objective-C only)}
5974 @opindex Wbad-function-cast
5975 @opindex Wno-bad-function-cast
5976 Warn when a function call is cast to a non-matching type.
5977 For example, warn if a call to a function returning an integer type
5978 is cast to a pointer type.
5980 @item -Wc90-c99-compat @r{(C and Objective-C only)}
5981 @opindex Wc90-c99-compat
5982 @opindex Wno-c90-c99-compat
5983 Warn about features not present in ISO C90, but present in ISO C99.
5984 For instance, warn about use of variable length arrays, @code{long long}
5985 type, @code{bool} type, compound literals, designated initializers, and so
5986 on. This option is independent of the standards mode. Warnings are disabled
5987 in the expression that follows @code{__extension__}.
5989 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5990 @opindex Wc99-c11-compat
5991 @opindex Wno-c99-c11-compat
5992 Warn about features not present in ISO C99, but present in ISO C11.
5993 For instance, warn about use of anonymous structures and unions,
5994 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5995 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5996 and so on. This option is independent of the standards mode. Warnings are
5997 disabled in the expression that follows @code{__extension__}.
5999 @item -Wc++-compat @r{(C and Objective-C only)}
6000 @opindex Wc++-compat
6001 Warn about ISO C constructs that are outside of the common subset of
6002 ISO C and ISO C++, e.g.@: request for implicit conversion from
6003 @code{void *} to a pointer to non-@code{void} type.
6005 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6006 @opindex Wc++11-compat
6007 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6008 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6009 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6010 enabled by @option{-Wall}.
6012 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6013 @opindex Wc++14-compat
6014 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6015 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6017 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6018 @opindex Wc++17-compat
6019 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6020 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6024 @opindex Wno-cast-qual
6025 Warn whenever a pointer is cast so as to remove a type qualifier from
6026 the target type. For example, warn if a @code{const char *} is cast
6027 to an ordinary @code{char *}.
6029 Also warn when making a cast that introduces a type qualifier in an
6030 unsafe way. For example, casting @code{char **} to @code{const char **}
6031 is unsafe, as in this example:
6034 /* p is char ** value. */
6035 const char **q = (const char **) p;
6036 /* Assignment of readonly string to const char * is OK. */
6038 /* Now char** pointer points to read-only memory. */
6043 @opindex Wcast-align
6044 @opindex Wno-cast-align
6045 Warn whenever a pointer is cast such that the required alignment of the
6046 target is increased. For example, warn if a @code{char *} is cast to
6047 an @code{int *} on machines where integers can only be accessed at
6048 two- or four-byte boundaries.
6050 @item -Wcast-align=strict
6051 @opindex Wcast-align=strict
6052 Warn whenever a pointer is cast such that the required alignment of the
6053 target is increased. For example, warn if a @code{char *} is cast to
6054 an @code{int *} regardless of the target machine.
6056 @item -Wcast-function-type
6057 @opindex Wcast-function-type
6058 @opindex Wno-cast-function-type
6059 Warn when a function pointer is cast to an incompatible function pointer.
6060 In a cast involving function types with a variable argument list only
6061 the types of initial arguments that are provided are considered.
6062 Any parameter of pointer-type matches any other pointer-type. Any benign
6063 differences in integral types are ignored, like @code{int} vs. @code{long}
6064 on ILP32 targets. Likewise type qualifiers are ignored. The function
6065 type @code{void (*) (void)} is special and matches everything, which can
6066 be used to suppress this warning.
6067 In a cast involving pointer to member types this warning warns whenever
6068 the type cast is changing the pointer to member type.
6069 This warning is enabled by @option{-Wextra}.
6071 @item -Wwrite-strings
6072 @opindex Wwrite-strings
6073 @opindex Wno-write-strings
6074 When compiling C, give string constants the type @code{const
6075 char[@var{length}]} so that copying the address of one into a
6076 non-@code{const} @code{char *} pointer produces a warning. These
6077 warnings help you find at compile time code that can try to write
6078 into a string constant, but only if you have been very careful about
6079 using @code{const} in declarations and prototypes. Otherwise, it is
6080 just a nuisance. This is why we did not make @option{-Wall} request
6083 When compiling C++, warn about the deprecated conversion from string
6084 literals to @code{char *}. This warning is enabled by default for C++
6088 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6089 @opindex Wcatch-value
6090 @opindex Wno-catch-value
6091 Warn about catch handlers that do not catch via reference.
6092 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6093 warn about polymorphic class types that are caught by value.
6094 With @option{-Wcatch-value=2} warn about all class types that are caught
6095 by value. With @option{-Wcatch-value=3} warn about all types that are
6096 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6100 @opindex Wno-clobbered
6101 Warn for variables that might be changed by @code{longjmp} or
6102 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6104 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6105 @opindex Wconditionally-supported
6106 @opindex Wno-conditionally-supported
6107 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6110 @opindex Wconversion
6111 @opindex Wno-conversion
6112 Warn for implicit conversions that may alter a value. This includes
6113 conversions between real and integer, like @code{abs (x)} when
6114 @code{x} is @code{double}; conversions between signed and unsigned,
6115 like @code{unsigned ui = -1}; and conversions to smaller types, like
6116 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6117 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6118 changed by the conversion like in @code{abs (2.0)}. Warnings about
6119 conversions between signed and unsigned integers can be disabled by
6120 using @option{-Wno-sign-conversion}.
6122 For C++, also warn for confusing overload resolution for user-defined
6123 conversions; and conversions that never use a type conversion
6124 operator: conversions to @code{void}, the same type, a base class or a
6125 reference to them. Warnings about conversions between signed and
6126 unsigned integers are disabled by default in C++ unless
6127 @option{-Wsign-conversion} is explicitly enabled.
6129 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6130 @opindex Wconversion-null
6131 @opindex Wno-conversion-null
6132 Do not warn for conversions between @code{NULL} and non-pointer
6133 types. @option{-Wconversion-null} is enabled by default.
6135 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6136 @opindex Wzero-as-null-pointer-constant
6137 @opindex Wno-zero-as-null-pointer-constant
6138 Warn when a literal @samp{0} is used as null pointer constant. This can
6139 be useful to facilitate the conversion to @code{nullptr} in C++11.
6141 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6142 @opindex Wsubobject-linkage
6143 @opindex Wno-subobject-linkage
6144 Warn if a class type has a base or a field whose type uses the anonymous
6145 namespace or depends on a type with no linkage. If a type A depends on
6146 a type B with no or internal linkage, defining it in multiple
6147 translation units would be an ODR violation because the meaning of B
6148 is different in each translation unit. If A only appears in a single
6149 translation unit, the best way to silence the warning is to give it
6150 internal linkage by putting it in an anonymous namespace as well. The
6151 compiler doesn't give this warning for types defined in the main .C
6152 file, as those are unlikely to have multiple definitions.
6153 @option{-Wsubobject-linkage} is enabled by default.
6155 @item -Wdangling-else
6156 @opindex Wdangling-else
6157 @opindex Wno-dangling-else
6158 Warn about constructions where there may be confusion to which
6159 @code{if} statement an @code{else} branch belongs. Here is an example of
6174 In C/C++, every @code{else} branch belongs to the innermost possible
6175 @code{if} statement, which in this example is @code{if (b)}. This is
6176 often not what the programmer expected, as illustrated in the above
6177 example by indentation the programmer chose. When there is the
6178 potential for this confusion, GCC issues a warning when this flag
6179 is specified. To eliminate the warning, add explicit braces around
6180 the innermost @code{if} statement so there is no way the @code{else}
6181 can belong to the enclosing @code{if}. The resulting code
6198 This warning is enabled by @option{-Wparentheses}.
6202 @opindex Wno-date-time
6203 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6204 are encountered as they might prevent bit-wise-identical reproducible
6207 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6208 @opindex Wdelete-incomplete
6209 @opindex Wno-delete-incomplete
6210 Warn when deleting a pointer to incomplete type, which may cause
6211 undefined behavior at runtime. This warning is enabled by default.
6213 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6214 @opindex Wuseless-cast
6215 @opindex Wno-useless-cast
6216 Warn when an expression is casted to its own type.
6219 @opindex Wempty-body
6220 @opindex Wno-empty-body
6221 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6222 while} statement. This warning is also enabled by @option{-Wextra}.
6224 @item -Wenum-compare
6225 @opindex Wenum-compare
6226 @opindex Wno-enum-compare
6227 Warn about a comparison between values of different enumerated types.
6228 In C++ enumerated type mismatches in conditional expressions are also
6229 diagnosed and the warning is enabled by default. In C this warning is
6230 enabled by @option{-Wall}.
6232 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6233 @opindex Wextra-semi
6234 @opindex Wno-extra-semi
6235 Warn about redundant semicolon after in-class function definition.
6237 @item -Wjump-misses-init @r{(C, Objective-C only)}
6238 @opindex Wjump-misses-init
6239 @opindex Wno-jump-misses-init
6240 Warn if a @code{goto} statement or a @code{switch} statement jumps
6241 forward across the initialization of a variable, or jumps backward to a
6242 label after the variable has been initialized. This only warns about
6243 variables that are initialized when they are declared. This warning is
6244 only supported for C and Objective-C; in C++ this sort of branch is an
6247 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6248 can be disabled with the @option{-Wno-jump-misses-init} option.
6250 @item -Wsign-compare
6251 @opindex Wsign-compare
6252 @opindex Wno-sign-compare
6253 @cindex warning for comparison of signed and unsigned values
6254 @cindex comparison of signed and unsigned values, warning
6255 @cindex signed and unsigned values, comparison warning
6256 Warn when a comparison between signed and unsigned values could produce
6257 an incorrect result when the signed value is converted to unsigned.
6258 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6259 also enabled by @option{-Wextra}.
6261 @item -Wsign-conversion
6262 @opindex Wsign-conversion
6263 @opindex Wno-sign-conversion
6264 Warn for implicit conversions that may change the sign of an integer
6265 value, like assigning a signed integer expression to an unsigned
6266 integer variable. An explicit cast silences the warning. In C, this
6267 option is enabled also by @option{-Wconversion}.
6269 @item -Wfloat-conversion
6270 @opindex Wfloat-conversion
6271 @opindex Wno-float-conversion
6272 Warn for implicit conversions that reduce the precision of a real value.
6273 This includes conversions from real to integer, and from higher precision
6274 real to lower precision real values. This option is also enabled by
6275 @option{-Wconversion}.
6277 @item -Wno-scalar-storage-order
6278 @opindex -Wno-scalar-storage-order
6279 @opindex -Wscalar-storage-order
6280 Do not warn on suspicious constructs involving reverse scalar storage order.
6282 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6283 @opindex Wsized-deallocation
6284 @opindex Wno-sized-deallocation
6285 Warn about a definition of an unsized deallocation function
6287 void operator delete (void *) noexcept;
6288 void operator delete[] (void *) noexcept;
6290 without a definition of the corresponding sized deallocation function
6292 void operator delete (void *, std::size_t) noexcept;
6293 void operator delete[] (void *, std::size_t) noexcept;
6295 or vice versa. Enabled by @option{-Wextra} along with
6296 @option{-fsized-deallocation}.
6298 @item -Wsizeof-pointer-div
6299 @opindex Wsizeof-pointer-div
6300 @opindex Wno-sizeof-pointer-div
6301 Warn for suspicious divisions of two sizeof expressions that divide
6302 the pointer size by the element size, which is the usual way to compute
6303 the array size but won't work out correctly with pointers. This warning
6304 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6305 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6307 @item -Wsizeof-pointer-memaccess
6308 @opindex Wsizeof-pointer-memaccess
6309 @opindex Wno-sizeof-pointer-memaccess
6310 Warn for suspicious length parameters to certain string and memory built-in
6311 functions if the argument uses @code{sizeof}. This warning triggers for
6312 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6313 an array, but a pointer, and suggests a possible fix, or about
6314 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6315 also warns about calls to bounded string copy functions like @code{strncat}
6316 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6317 the source array. For example, in the following function the call to
6318 @code{strncat} specifies the size of the source string as the bound. That
6319 is almost certainly a mistake and so the call is diagnosed.
6321 void make_file (const char *name)
6323 char path[PATH_MAX];
6324 strncpy (path, name, sizeof path - 1);
6325 strncat (path, ".text", sizeof ".text");
6330 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6332 @item -Wsizeof-array-argument
6333 @opindex Wsizeof-array-argument
6334 @opindex Wno-sizeof-array-argument
6335 Warn when the @code{sizeof} operator is applied to a parameter that is
6336 declared as an array in a function definition. This warning is enabled by
6337 default for C and C++ programs.
6339 @item -Wmemset-elt-size
6340 @opindex Wmemset-elt-size
6341 @opindex Wno-memset-elt-size
6342 Warn for suspicious calls to the @code{memset} built-in function, if the
6343 first argument references an array, and the third argument is a number
6344 equal to the number of elements, but not equal to the size of the array
6345 in memory. This indicates that the user has omitted a multiplication by
6346 the element size. This warning is enabled by @option{-Wall}.
6348 @item -Wmemset-transposed-args
6349 @opindex Wmemset-transposed-args
6350 @opindex Wno-memset-transposed-args
6351 Warn for suspicious calls to the @code{memset} built-in function, if the
6352 second argument is not zero and the third argument is zero. This warns e.g.@
6353 about @code{memset (buf, sizeof buf, 0)} where most probably
6354 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6355 is only emitted if the third argument is literal zero. If it is some
6356 expression that is folded to zero, a cast of zero to some type, etc.,
6357 it is far less likely that the user has mistakenly exchanged the arguments
6358 and no warning is emitted. This warning is enabled by @option{-Wall}.
6362 @opindex Wno-address
6363 Warn about suspicious uses of memory addresses. These include using
6364 the address of a function in a conditional expression, such as
6365 @code{void func(void); if (func)}, and comparisons against the memory
6366 address of a string literal, such as @code{if (x == "abc")}. Such
6367 uses typically indicate a programmer error: the address of a function
6368 always evaluates to true, so their use in a conditional usually
6369 indicate that the programmer forgot the parentheses in a function
6370 call; and comparisons against string literals result in unspecified
6371 behavior and are not portable in C, so they usually indicate that the
6372 programmer intended to use @code{strcmp}. This warning is enabled by
6376 @opindex Wlogical-op
6377 @opindex Wno-logical-op
6378 Warn about suspicious uses of logical operators in expressions.
6379 This includes using logical operators in contexts where a
6380 bit-wise operator is likely to be expected. Also warns when
6381 the operands of a logical operator are the same:
6384 if (a < 0 && a < 0) @{ @dots{} @}
6387 @item -Wlogical-not-parentheses
6388 @opindex Wlogical-not-parentheses
6389 @opindex Wno-logical-not-parentheses
6390 Warn about logical not used on the left hand side operand of a comparison.
6391 This option does not warn if the right operand is considered to be a boolean
6392 expression. Its purpose is to detect suspicious code like the following:
6396 if (!a > 1) @{ @dots{} @}
6399 It is possible to suppress the warning by wrapping the LHS into
6402 if ((!a) > 1) @{ @dots{} @}
6405 This warning is enabled by @option{-Wall}.
6407 @item -Waggregate-return
6408 @opindex Waggregate-return
6409 @opindex Wno-aggregate-return
6410 Warn if any functions that return structures or unions are defined or
6411 called. (In languages where you can return an array, this also elicits
6414 @item -Wno-aggressive-loop-optimizations
6415 @opindex Wno-aggressive-loop-optimizations
6416 @opindex Waggressive-loop-optimizations
6417 Warn if in a loop with constant number of iterations the compiler detects
6418 undefined behavior in some statement during one or more of the iterations.
6420 @item -Wno-attributes
6421 @opindex Wno-attributes
6422 @opindex Wattributes
6423 Do not warn if an unexpected @code{__attribute__} is used, such as
6424 unrecognized attributes, function attributes applied to variables,
6425 etc. This does not stop errors for incorrect use of supported
6428 @item -Wno-builtin-declaration-mismatch
6429 @opindex Wno-builtin-declaration-mismatch
6430 @opindex Wbuiltin-declaration-mismatch
6431 Warn if a built-in function is declared with the wrong signature or
6433 This warning is enabled by default.
6435 @item -Wno-builtin-macro-redefined
6436 @opindex Wno-builtin-macro-redefined
6437 @opindex Wbuiltin-macro-redefined
6438 Do not warn if certain built-in macros are redefined. This suppresses
6439 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6440 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6442 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6443 @opindex Wstrict-prototypes
6444 @opindex Wno-strict-prototypes
6445 Warn if a function is declared or defined without specifying the
6446 argument types. (An old-style function definition is permitted without
6447 a warning if preceded by a declaration that specifies the argument
6450 @item -Wold-style-declaration @r{(C and Objective-C only)}
6451 @opindex Wold-style-declaration
6452 @opindex Wno-old-style-declaration
6453 Warn for obsolescent usages, according to the C Standard, in a
6454 declaration. For example, warn if storage-class specifiers like
6455 @code{static} are not the first things in a declaration. This warning
6456 is also enabled by @option{-Wextra}.
6458 @item -Wold-style-definition @r{(C and Objective-C only)}
6459 @opindex Wold-style-definition
6460 @opindex Wno-old-style-definition
6461 Warn if an old-style function definition is used. A warning is given
6462 even if there is a previous prototype.
6464 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6465 @opindex Wmissing-parameter-type
6466 @opindex Wno-missing-parameter-type
6467 A function parameter is declared without a type specifier in K&R-style
6474 This warning is also enabled by @option{-Wextra}.
6476 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6477 @opindex Wmissing-prototypes
6478 @opindex Wno-missing-prototypes
6479 Warn if a global function is defined without a previous prototype
6480 declaration. This warning is issued even if the definition itself
6481 provides a prototype. Use this option to detect global functions
6482 that do not have a matching prototype declaration in a header file.
6483 This option is not valid for C++ because all function declarations
6484 provide prototypes and a non-matching declaration declares an
6485 overload rather than conflict with an earlier declaration.
6486 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6488 @item -Wmissing-declarations
6489 @opindex Wmissing-declarations
6490 @opindex Wno-missing-declarations
6491 Warn if a global function is defined without a previous declaration.
6492 Do so even if the definition itself provides a prototype.
6493 Use this option to detect global functions that are not declared in
6494 header files. In C, no warnings are issued for functions with previous
6495 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6496 missing prototypes. In C++, no warnings are issued for function templates,
6497 or for inline functions, or for functions in anonymous namespaces.
6499 @item -Wmissing-field-initializers
6500 @opindex Wmissing-field-initializers
6501 @opindex Wno-missing-field-initializers
6505 Warn if a structure's initializer has some fields missing. For
6506 example, the following code causes such a warning, because
6507 @code{x.h} is implicitly zero:
6510 struct s @{ int f, g, h; @};
6511 struct s x = @{ 3, 4 @};
6514 This option does not warn about designated initializers, so the following
6515 modification does not trigger a warning:
6518 struct s @{ int f, g, h; @};
6519 struct s x = @{ .f = 3, .g = 4 @};
6522 In C this option does not warn about the universal zero initializer
6526 struct s @{ int f, g, h; @};
6527 struct s x = @{ 0 @};
6530 Likewise, in C++ this option does not warn about the empty @{ @}
6531 initializer, for example:
6534 struct s @{ int f, g, h; @};
6538 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6539 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6541 @item -Wno-multichar
6542 @opindex Wno-multichar
6544 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6545 Usually they indicate a typo in the user's code, as they have
6546 implementation-defined values, and should not be used in portable code.
6548 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6549 @opindex Wnormalized=
6550 @opindex Wnormalized
6551 @opindex Wno-normalized
6554 @cindex character set, input normalization
6555 In ISO C and ISO C++, two identifiers are different if they are
6556 different sequences of characters. However, sometimes when characters
6557 outside the basic ASCII character set are used, you can have two
6558 different character sequences that look the same. To avoid confusion,
6559 the ISO 10646 standard sets out some @dfn{normalization rules} which
6560 when applied ensure that two sequences that look the same are turned into
6561 the same sequence. GCC can warn you if you are using identifiers that
6562 have not been normalized; this option controls that warning.
6564 There are four levels of warning supported by GCC@. The default is
6565 @option{-Wnormalized=nfc}, which warns about any identifier that is
6566 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6567 recommended form for most uses. It is equivalent to
6568 @option{-Wnormalized}.
6570 Unfortunately, there are some characters allowed in identifiers by
6571 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6572 identifiers. That is, there's no way to use these symbols in portable
6573 ISO C or C++ and have all your identifiers in NFC@.
6574 @option{-Wnormalized=id} suppresses the warning for these characters.
6575 It is hoped that future versions of the standards involved will correct
6576 this, which is why this option is not the default.
6578 You can switch the warning off for all characters by writing
6579 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6580 only do this if you are using some other normalization scheme (like
6581 ``D''), because otherwise you can easily create bugs that are
6582 literally impossible to see.
6584 Some characters in ISO 10646 have distinct meanings but look identical
6585 in some fonts or display methodologies, especially once formatting has
6586 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6587 LETTER N'', displays just like a regular @code{n} that has been
6588 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6589 normalization scheme to convert all these into a standard form as
6590 well, and GCC warns if your code is not in NFKC if you use
6591 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6592 about every identifier that contains the letter O because it might be
6593 confused with the digit 0, and so is not the default, but may be
6594 useful as a local coding convention if the programming environment
6595 cannot be fixed to display these characters distinctly.
6597 @item -Wno-deprecated
6598 @opindex Wno-deprecated
6599 @opindex Wdeprecated
6600 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6602 @item -Wno-deprecated-declarations
6603 @opindex Wno-deprecated-declarations
6604 @opindex Wdeprecated-declarations
6605 Do not warn about uses of functions (@pxref{Function Attributes}),
6606 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6607 Attributes}) marked as deprecated by using the @code{deprecated}
6611 @opindex Wno-overflow
6613 Do not warn about compile-time overflow in constant expressions.
6618 Warn about One Definition Rule violations during link-time optimization.
6619 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6622 @opindex Wopenm-simd
6623 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
6624 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6625 option can be used to relax the cost model.
6627 @item -Woverride-init @r{(C and Objective-C only)}
6628 @opindex Woverride-init
6629 @opindex Wno-override-init
6633 Warn if an initialized field without side effects is overridden when
6634 using designated initializers (@pxref{Designated Inits, , Designated
6637 This warning is included in @option{-Wextra}. To get other
6638 @option{-Wextra} warnings without this one, use @option{-Wextra
6639 -Wno-override-init}.
6641 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6642 @opindex Woverride-init-side-effects
6643 @opindex Wno-override-init-side-effects
6644 Warn if an initialized field with side effects is overridden when
6645 using designated initializers (@pxref{Designated Inits, , Designated
6646 Initializers}). This warning is enabled by default.
6651 Warn if a structure is given the packed attribute, but the packed
6652 attribute has no effect on the layout or size of the structure.
6653 Such structures may be mis-aligned for little benefit. For
6654 instance, in this code, the variable @code{f.x} in @code{struct bar}
6655 is misaligned even though @code{struct bar} does not itself
6656 have the packed attribute:
6663 @} __attribute__((packed));
6671 @item -Wpacked-bitfield-compat
6672 @opindex Wpacked-bitfield-compat
6673 @opindex Wno-packed-bitfield-compat
6674 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
6675 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
6676 the change can lead to differences in the structure layout. GCC
6677 informs you when the offset of such a field has changed in GCC 4.4.
6678 For example there is no longer a 4-bit padding between field @code{a}
6679 and @code{b} in this structure:
6686 @} __attribute__ ((packed));
6689 This warning is enabled by default. Use
6690 @option{-Wno-packed-bitfield-compat} to disable this warning.
6692 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6693 @opindex Wpacked-not-aligned
6694 @opindex Wno-packed-not-aligned
6695 Warn if a structure field with explicitly specified alignment in a
6696 packed struct or union is misaligned. For example, a warning will
6697 be issued on @code{struct S}, like, @code{warning: alignment 1 of
6698 'struct S' is less than 8}, in this code:
6702 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
6703 struct __attribute__ ((packed)) S @{
6709 This warning is enabled by @option{-Wall}.
6714 Warn if padding is included in a structure, either to align an element
6715 of the structure or to align the whole structure. Sometimes when this
6716 happens it is possible to rearrange the fields of the structure to
6717 reduce the padding and so make the structure smaller.
6719 @item -Wredundant-decls
6720 @opindex Wredundant-decls
6721 @opindex Wno-redundant-decls
6722 Warn if anything is declared more than once in the same scope, even in
6723 cases where multiple declaration is valid and changes nothing.
6727 @opindex Wno-restrict
6728 Warn when an object referenced by a @code{restrict}-qualified parameter
6729 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
6730 argument, or when copies between such objects overlap. For example,
6731 the call to the @code{strcpy} function below attempts to truncate the string
6732 by replacing its initial characters with the last four. However, because
6733 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
6734 the call is diagnosed.
6739 char a[] = "abcd1234";
6743 The @option{-Wrestrict} is included in @option{-Wall}.
6745 @item -Wnested-externs @r{(C and Objective-C only)}
6746 @opindex Wnested-externs
6747 @opindex Wno-nested-externs
6748 Warn if an @code{extern} declaration is encountered within a function.
6750 @item -Wno-inherited-variadic-ctor
6751 @opindex Winherited-variadic-ctor
6752 @opindex Wno-inherited-variadic-ctor
6753 Suppress warnings about use of C++11 inheriting constructors when the
6754 base class inherited from has a C variadic constructor; the warning is
6755 on by default because the ellipsis is not inherited.
6760 Warn if a function that is declared as inline cannot be inlined.
6761 Even with this option, the compiler does not warn about failures to
6762 inline functions declared in system headers.
6764 The compiler uses a variety of heuristics to determine whether or not
6765 to inline a function. For example, the compiler takes into account
6766 the size of the function being inlined and the amount of inlining
6767 that has already been done in the current function. Therefore,
6768 seemingly insignificant changes in the source program can cause the
6769 warnings produced by @option{-Winline} to appear or disappear.
6771 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6772 @opindex Wno-invalid-offsetof
6773 @opindex Winvalid-offsetof
6774 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6775 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6776 to a non-standard-layout type is undefined. In existing C++ implementations,
6777 however, @code{offsetof} typically gives meaningful results.
6778 This flag is for users who are aware that they are
6779 writing nonportable code and who have deliberately chosen to ignore the
6782 The restrictions on @code{offsetof} may be relaxed in a future version
6783 of the C++ standard.
6785 @item -Wint-in-bool-context
6786 @opindex Wint-in-bool-context
6787 @opindex Wno-int-in-bool-context
6788 Warn for suspicious use of integer values where boolean values are expected,
6789 such as conditional expressions (?:) using non-boolean integer constants in
6790 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
6791 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
6792 for all kinds of multiplications regardless of the data type.
6793 This warning is enabled by @option{-Wall}.
6795 @item -Wno-int-to-pointer-cast
6796 @opindex Wno-int-to-pointer-cast
6797 @opindex Wint-to-pointer-cast
6798 Suppress warnings from casts to pointer type of an integer of a
6799 different size. In C++, casting to a pointer type of smaller size is
6800 an error. @option{Wint-to-pointer-cast} is enabled by default.
6803 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
6804 @opindex Wno-pointer-to-int-cast
6805 @opindex Wpointer-to-int-cast
6806 Suppress warnings from casts from a pointer to an integer type of a
6810 @opindex Winvalid-pch
6811 @opindex Wno-invalid-pch
6812 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
6813 the search path but cannot be used.
6817 @opindex Wno-long-long
6818 Warn if @code{long long} type is used. This is enabled by either
6819 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
6820 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
6822 @item -Wvariadic-macros
6823 @opindex Wvariadic-macros
6824 @opindex Wno-variadic-macros
6825 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6826 alternate syntax is used in ISO C99 mode. This is enabled by either
6827 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
6828 messages, use @option{-Wno-variadic-macros}.
6832 @opindex Wno-varargs
6833 Warn upon questionable usage of the macros used to handle variable
6834 arguments like @code{va_start}. This is default. To inhibit the
6835 warning messages, use @option{-Wno-varargs}.
6837 @item -Wvector-operation-performance
6838 @opindex Wvector-operation-performance
6839 @opindex Wno-vector-operation-performance
6840 Warn if vector operation is not implemented via SIMD capabilities of the
6841 architecture. Mainly useful for the performance tuning.
6842 Vector operation can be implemented @code{piecewise}, which means that the
6843 scalar operation is performed on every vector element;
6844 @code{in parallel}, which means that the vector operation is implemented
6845 using scalars of wider type, which normally is more performance efficient;
6846 and @code{as a single scalar}, which means that vector fits into a
6849 @item -Wno-virtual-move-assign
6850 @opindex Wvirtual-move-assign
6851 @opindex Wno-virtual-move-assign
6852 Suppress warnings about inheriting from a virtual base with a
6853 non-trivial C++11 move assignment operator. This is dangerous because
6854 if the virtual base is reachable along more than one path, it is
6855 moved multiple times, which can mean both objects end up in the
6856 moved-from state. If the move assignment operator is written to avoid
6857 moving from a moved-from object, this warning can be disabled.
6862 Warn if a variable-length array is used in the code.
6863 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
6864 the variable-length array.
6866 @item -Wvla-larger-than=@var{n}
6867 If this option is used, the compiler will warn on uses of
6868 variable-length arrays where the size is either unbounded, or bounded
6869 by an argument that can be larger than @var{n} bytes. This is similar
6870 to how @option{-Walloca-larger-than=@var{n}} works, but with
6871 variable-length arrays.
6873 Note that GCC may optimize small variable-length arrays of a known
6874 value into plain arrays, so this warning may not get triggered for
6877 This warning is not enabled by @option{-Wall}, and is only active when
6878 @option{-ftree-vrp} is active (default for @option{-O2} and above).
6880 See also @option{-Walloca-larger-than=@var{n}}.
6882 @item -Wvolatile-register-var
6883 @opindex Wvolatile-register-var
6884 @opindex Wno-volatile-register-var
6885 Warn if a register variable is declared volatile. The volatile
6886 modifier does not inhibit all optimizations that may eliminate reads
6887 and/or writes to register variables. This warning is enabled by
6890 @item -Wdisabled-optimization
6891 @opindex Wdisabled-optimization
6892 @opindex Wno-disabled-optimization
6893 Warn if a requested optimization pass is disabled. This warning does
6894 not generally indicate that there is anything wrong with your code; it
6895 merely indicates that GCC's optimizers are unable to handle the code
6896 effectively. Often, the problem is that your code is too big or too
6897 complex; GCC refuses to optimize programs when the optimization
6898 itself is likely to take inordinate amounts of time.
6900 @item -Wpointer-sign @r{(C and Objective-C only)}
6901 @opindex Wpointer-sign
6902 @opindex Wno-pointer-sign
6903 Warn for pointer argument passing or assignment with different signedness.
6904 This option is only supported for C and Objective-C@. It is implied by
6905 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
6906 @option{-Wno-pointer-sign}.
6908 @item -Wstack-protector
6909 @opindex Wstack-protector
6910 @opindex Wno-stack-protector
6911 This option is only active when @option{-fstack-protector} is active. It
6912 warns about functions that are not protected against stack smashing.
6914 @item -Woverlength-strings
6915 @opindex Woverlength-strings
6916 @opindex Wno-overlength-strings
6917 Warn about string constants that are longer than the ``minimum
6918 maximum'' length specified in the C standard. Modern compilers
6919 generally allow string constants that are much longer than the
6920 standard's minimum limit, but very portable programs should avoid
6921 using longer strings.
6923 The limit applies @emph{after} string constant concatenation, and does
6924 not count the trailing NUL@. In C90, the limit was 509 characters; in
6925 C99, it was raised to 4095. C++98 does not specify a normative
6926 minimum maximum, so we do not diagnose overlength strings in C++@.
6928 This option is implied by @option{-Wpedantic}, and can be disabled with
6929 @option{-Wno-overlength-strings}.
6931 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
6932 @opindex Wunsuffixed-float-constants
6934 Issue a warning for any floating constant that does not have
6935 a suffix. When used together with @option{-Wsystem-headers} it
6936 warns about such constants in system header files. This can be useful
6937 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
6938 from the decimal floating-point extension to C99.
6940 @item -Wno-designated-init @r{(C and Objective-C only)}
6941 Suppress warnings when a positional initializer is used to initialize
6942 a structure that has been marked with the @code{designated_init}
6946 Issue a warning when HSAIL cannot be emitted for the compiled function or
6951 @node Debugging Options
6952 @section Options for Debugging Your Program
6953 @cindex options, debugging
6954 @cindex debugging information options
6956 To tell GCC to emit extra information for use by a debugger, in almost
6957 all cases you need only to add @option{-g} to your other options.
6959 GCC allows you to use @option{-g} with
6960 @option{-O}. The shortcuts taken by optimized code may occasionally
6961 be surprising: some variables you declared may not exist
6962 at all; flow of control may briefly move where you did not expect it;
6963 some statements may not be executed because they compute constant
6964 results or their values are already at hand; some statements may
6965 execute in different places because they have been moved out of loops.
6966 Nevertheless it is possible to debug optimized output. This makes
6967 it reasonable to use the optimizer for programs that might have bugs.
6969 If you are not using some other optimization option, consider
6970 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
6971 With no @option{-O} option at all, some compiler passes that collect
6972 information useful for debugging do not run at all, so that
6973 @option{-Og} may result in a better debugging experience.
6978 Produce debugging information in the operating system's native format
6979 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
6982 On most systems that use stabs format, @option{-g} enables use of extra
6983 debugging information that only GDB can use; this extra information
6984 makes debugging work better in GDB but probably makes other debuggers
6986 refuse to read the program. If you want to control for certain whether
6987 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
6988 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
6992 Produce debugging information for use by GDB@. This means to use the
6993 most expressive format available (DWARF, stabs, or the native format
6994 if neither of those are supported), including GDB extensions if at all
6998 @itemx -gdwarf-@var{version}
7000 Produce debugging information in DWARF format (if that is supported).
7001 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7002 for most targets is 4. DWARF Version 5 is only experimental.
7004 Note that with DWARF Version 2, some ports require and always
7005 use some non-conflicting DWARF 3 extensions in the unwind tables.
7007 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7008 for maximum benefit.
7010 GCC no longer supports DWARF Version 1, which is substantially
7011 different than Version 2 and later. For historical reasons, some
7012 other DWARF-related options such as
7013 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7014 in their names, but apply to all currently-supported versions of DWARF.
7018 Produce debugging information in stabs format (if that is supported),
7019 without GDB extensions. This is the format used by DBX on most BSD
7020 systems. On MIPS, Alpha and System V Release 4 systems this option
7021 produces stabs debugging output that is not understood by DBX@.
7022 On System V Release 4 systems this option requires the GNU assembler.
7026 Produce debugging information in stabs format (if that is supported),
7027 using GNU extensions understood only by the GNU debugger (GDB)@. The
7028 use of these extensions is likely to make other debuggers crash or
7029 refuse to read the program.
7033 Produce debugging information in XCOFF format (if that is supported).
7034 This is the format used by the DBX debugger on IBM RS/6000 systems.
7038 Produce debugging information in XCOFF format (if that is supported),
7039 using GNU extensions understood only by the GNU debugger (GDB)@. The
7040 use of these extensions is likely to make other debuggers crash or
7041 refuse to read the program, and may cause assemblers other than the GNU
7042 assembler (GAS) to fail with an error.
7046 Produce debugging information in Alpha/VMS debug format (if that is
7047 supported). This is the format used by DEBUG on Alpha/VMS systems.
7050 @itemx -ggdb@var{level}
7051 @itemx -gstabs@var{level}
7052 @itemx -gxcoff@var{level}
7053 @itemx -gvms@var{level}
7054 Request debugging information and also use @var{level} to specify how
7055 much information. The default level is 2.
7057 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7060 Level 1 produces minimal information, enough for making backtraces in
7061 parts of the program that you don't plan to debug. This includes
7062 descriptions of functions and external variables, and line number
7063 tables, but no information about local variables.
7065 Level 3 includes extra information, such as all the macro definitions
7066 present in the program. Some debuggers support macro expansion when
7067 you use @option{-g3}.
7069 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7070 confusion with @option{-gdwarf-@var{level}}.
7071 Instead use an additional @option{-g@var{level}} option to change the
7072 debug level for DWARF.
7074 @item -feliminate-unused-debug-symbols
7075 @opindex feliminate-unused-debug-symbols
7076 Produce debugging information in stabs format (if that is supported),
7077 for only symbols that are actually used.
7079 @item -femit-class-debug-always
7080 @opindex femit-class-debug-always
7081 Instead of emitting debugging information for a C++ class in only one
7082 object file, emit it in all object files using the class. This option
7083 should be used only with debuggers that are unable to handle the way GCC
7084 normally emits debugging information for classes because using this
7085 option increases the size of debugging information by as much as a
7088 @item -fno-merge-debug-strings
7089 @opindex fmerge-debug-strings
7090 @opindex fno-merge-debug-strings
7091 Direct the linker to not merge together strings in the debugging
7092 information that are identical in different object files. Merging is
7093 not supported by all assemblers or linkers. Merging decreases the size
7094 of the debug information in the output file at the cost of increasing
7095 link processing time. Merging is enabled by default.
7097 @item -fdebug-prefix-map=@var{old}=@var{new}
7098 @opindex fdebug-prefix-map
7099 When compiling files in directory @file{@var{old}}, record debugging
7100 information describing them as in @file{@var{new}} instead. This can be
7101 used to replace a build-time path with an install-time path in the debug info.
7102 It can also be used to change an absolute path to a relative path by using
7103 @file{.} for @var{new}. This can give more reproducible builds, which are
7104 location independent, but may require an extra command to tell GDB where to
7105 find the source files.
7107 @item -fvar-tracking
7108 @opindex fvar-tracking
7109 Run variable tracking pass. It computes where variables are stored at each
7110 position in code. Better debugging information is then generated
7111 (if the debugging information format supports this information).
7113 It is enabled by default when compiling with optimization (@option{-Os},
7114 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7115 the debug info format supports it.
7117 @item -fvar-tracking-assignments
7118 @opindex fvar-tracking-assignments
7119 @opindex fno-var-tracking-assignments
7120 Annotate assignments to user variables early in the compilation and
7121 attempt to carry the annotations over throughout the compilation all the
7122 way to the end, in an attempt to improve debug information while
7123 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7125 It can be enabled even if var-tracking is disabled, in which case
7126 annotations are created and maintained, but discarded at the end.
7127 By default, this flag is enabled together with @option{-fvar-tracking},
7128 except when selective scheduling is enabled.
7131 @opindex gsplit-dwarf
7132 Separate as much DWARF debugging information as possible into a
7133 separate output file with the extension @file{.dwo}. This option allows
7134 the build system to avoid linking files with debug information. To
7135 be useful, this option requires a debugger capable of reading @file{.dwo}
7140 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7142 @item -ggnu-pubnames
7143 @opindex ggnu-pubnames
7144 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7145 suitable for conversion into a GDB@ index. This option is only useful
7146 with a linker that can produce GDB@ index version 7.
7148 @item -fdebug-types-section
7149 @opindex fdebug-types-section
7150 @opindex fno-debug-types-section
7151 When using DWARF Version 4 or higher, type DIEs can be put into
7152 their own @code{.debug_types} section instead of making them part of the
7153 @code{.debug_info} section. It is more efficient to put them in a separate
7154 comdat sections since the linker can then remove duplicates.
7155 But not all DWARF consumers support @code{.debug_types} sections yet
7156 and on some objects @code{.debug_types} produces larger instead of smaller
7157 debugging information.
7159 @item -grecord-gcc-switches
7160 @item -gno-record-gcc-switches
7161 @opindex grecord-gcc-switches
7162 @opindex gno-record-gcc-switches
7163 This switch causes the command-line options used to invoke the
7164 compiler that may affect code generation to be appended to the
7165 DW_AT_producer attribute in DWARF debugging information. The options
7166 are concatenated with spaces separating them from each other and from
7167 the compiler version.
7168 It is enabled by default.
7169 See also @option{-frecord-gcc-switches} for another
7170 way of storing compiler options into the object file.
7172 @item -gstrict-dwarf
7173 @opindex gstrict-dwarf
7174 Disallow using extensions of later DWARF standard version than selected
7175 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7176 DWARF extensions from later standard versions is allowed.
7178 @item -gno-strict-dwarf
7179 @opindex gno-strict-dwarf
7180 Allow using extensions of later DWARF standard version than selected with
7181 @option{-gdwarf-@var{version}}.
7184 @item -gno-column-info
7185 @opindex gcolumn-info
7186 @opindex gno-column-info
7187 Emit location column information into DWARF debugging information, rather
7188 than just file and line.
7189 This option is enabled by default.
7191 @item -gstatement-frontiers
7192 @item -gno-statement-frontiers
7193 @opindex gstatement-frontiers
7194 @opindex gno-statement-frontiers
7195 This option causes GCC to create markers in the internal representation
7196 at the beginning of statements, and to keep them roughly in place
7197 throughout compilation, using them to guide the output of @code{is_stmt}
7198 markers in the line number table. This is enabled by default when
7199 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7200 @dots{}), and outputting DWARF 2 debug information at the normal level.
7202 @item -gz@r{[}=@var{type}@r{]}
7204 Produce compressed debug sections in DWARF format, if that is supported.
7205 If @var{type} is not given, the default type depends on the capabilities
7206 of the assembler and linker used. @var{type} may be one of
7207 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7208 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7209 compression in traditional GNU format). If the linker doesn't support
7210 writing compressed debug sections, the option is rejected. Otherwise,
7211 if the assembler does not support them, @option{-gz} is silently ignored
7212 when producing object files.
7214 @item -femit-struct-debug-baseonly
7215 @opindex femit-struct-debug-baseonly
7216 Emit debug information for struct-like types
7217 only when the base name of the compilation source file
7218 matches the base name of file in which the struct is defined.
7220 This option substantially reduces the size of debugging information,
7221 but at significant potential loss in type information to the debugger.
7222 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7223 See @option{-femit-struct-debug-detailed} for more detailed control.
7225 This option works only with DWARF debug output.
7227 @item -femit-struct-debug-reduced
7228 @opindex femit-struct-debug-reduced
7229 Emit debug information for struct-like types
7230 only when the base name of the compilation source file
7231 matches the base name of file in which the type is defined,
7232 unless the struct is a template or defined in a system header.
7234 This option significantly reduces the size of debugging information,
7235 with some potential loss in type information to the debugger.
7236 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7237 See @option{-femit-struct-debug-detailed} for more detailed control.
7239 This option works only with DWARF debug output.
7241 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7242 @opindex femit-struct-debug-detailed
7243 Specify the struct-like types
7244 for which the compiler generates debug information.
7245 The intent is to reduce duplicate struct debug information
7246 between different object files within the same program.
7248 This option is a detailed version of
7249 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
7250 which serves for most needs.
7252 A specification has the syntax@*
7253 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
7255 The optional first word limits the specification to
7256 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
7257 A struct type is used directly when it is the type of a variable, member.
7258 Indirect uses arise through pointers to structs.
7259 That is, when use of an incomplete struct is valid, the use is indirect.
7261 @samp{struct one direct; struct two * indirect;}.
7263 The optional second word limits the specification to
7264 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
7265 Generic structs are a bit complicated to explain.
7266 For C++, these are non-explicit specializations of template classes,
7267 or non-template classes within the above.
7268 Other programming languages have generics,
7269 but @option{-femit-struct-debug-detailed} does not yet implement them.
7271 The third word specifies the source files for those
7272 structs for which the compiler should emit debug information.
7273 The values @samp{none} and @samp{any} have the normal meaning.
7274 The value @samp{base} means that
7275 the base of name of the file in which the type declaration appears
7276 must match the base of the name of the main compilation file.
7277 In practice, this means that when compiling @file{foo.c}, debug information
7278 is generated for types declared in that file and @file{foo.h},
7279 but not other header files.
7280 The value @samp{sys} means those types satisfying @samp{base}
7281 or declared in system or compiler headers.
7283 You may need to experiment to determine the best settings for your application.
7285 The default is @option{-femit-struct-debug-detailed=all}.
7287 This option works only with DWARF debug output.
7289 @item -fno-dwarf2-cfi-asm
7290 @opindex fdwarf2-cfi-asm
7291 @opindex fno-dwarf2-cfi-asm
7292 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
7293 instead of using GAS @code{.cfi_*} directives.
7295 @item -fno-eliminate-unused-debug-types
7296 @opindex feliminate-unused-debug-types
7297 @opindex fno-eliminate-unused-debug-types
7298 Normally, when producing DWARF output, GCC avoids producing debug symbol
7299 output for types that are nowhere used in the source file being compiled.
7300 Sometimes it is useful to have GCC emit debugging
7301 information for all types declared in a compilation
7302 unit, regardless of whether or not they are actually used
7303 in that compilation unit, for example
7304 if, in the debugger, you want to cast a value to a type that is
7305 not actually used in your program (but is declared). More often,
7306 however, this results in a significant amount of wasted space.
7309 @node Optimize Options
7310 @section Options That Control Optimization
7311 @cindex optimize options
7312 @cindex options, optimization
7314 These options control various sorts of optimizations.
7316 Without any optimization option, the compiler's goal is to reduce the
7317 cost of compilation and to make debugging produce the expected
7318 results. Statements are independent: if you stop the program with a
7319 breakpoint between statements, you can then assign a new value to any
7320 variable or change the program counter to any other statement in the
7321 function and get exactly the results you expect from the source
7324 Turning on optimization flags makes the compiler attempt to improve
7325 the performance and/or code size at the expense of compilation time
7326 and possibly the ability to debug the program.
7328 The compiler performs optimization based on the knowledge it has of the
7329 program. Compiling multiple files at once to a single output file mode allows
7330 the compiler to use information gained from all of the files when compiling
7333 Not all optimizations are controlled directly by a flag. Only
7334 optimizations that have a flag are listed in this section.
7336 Most optimizations are only enabled if an @option{-O} level is set on
7337 the command line. Otherwise they are disabled, even if individual
7338 optimization flags are specified.
7340 Depending on the target and how GCC was configured, a slightly different
7341 set of optimizations may be enabled at each @option{-O} level than
7342 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7343 to find out the exact set of optimizations that are enabled at each level.
7344 @xref{Overall Options}, for examples.
7351 Optimize. Optimizing compilation takes somewhat more time, and a lot
7352 more memory for a large function.
7354 With @option{-O}, the compiler tries to reduce code size and execution
7355 time, without performing any optimizations that take a great deal of
7358 @option{-O} turns on the following optimization flags:
7361 -fbranch-count-reg @gol
7362 -fcombine-stack-adjustments @gol
7364 -fcprop-registers @gol
7367 -fdelayed-branch @gol
7369 -fforward-propagate @gol
7370 -fguess-branch-probability @gol
7371 -fif-conversion2 @gol
7372 -fif-conversion @gol
7373 -finline-functions-called-once @gol
7374 -fipa-pure-const @gol
7376 -fipa-reference @gol
7377 -fmerge-constants @gol
7378 -fmove-loop-invariants @gol
7379 -fomit-frame-pointer @gol
7380 -freorder-blocks @gol
7382 -fshrink-wrap-separate @gol
7383 -fsplit-wide-types @gol
7389 -ftree-coalesce-vars @gol
7390 -ftree-copy-prop @gol
7392 -ftree-dominator-opts @gol
7394 -ftree-forwprop @gol
7406 Optimize even more. GCC performs nearly all supported optimizations
7407 that do not involve a space-speed tradeoff.
7408 As compared to @option{-O}, this option increases both compilation time
7409 and the performance of the generated code.
7411 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7412 also turns on the following optimization flags:
7413 @gccoptlist{-fthread-jumps @gol
7414 -falign-functions -falign-jumps @gol
7415 -falign-loops -falign-labels @gol
7418 -fcse-follow-jumps -fcse-skip-blocks @gol
7419 -fdelete-null-pointer-checks @gol
7420 -fdevirtualize -fdevirtualize-speculatively @gol
7421 -fexpensive-optimizations @gol
7422 -fgcse -fgcse-lm @gol
7423 -fhoist-adjacent-loads @gol
7424 -finline-small-functions @gol
7425 -findirect-inlining @gol
7431 -fisolate-erroneous-paths-dereference @gol
7433 -foptimize-sibling-calls @gol
7434 -foptimize-strlen @gol
7435 -fpartial-inlining @gol
7437 -freorder-blocks-algorithm=stc @gol
7438 -freorder-blocks-and-partition -freorder-functions @gol
7439 -frerun-cse-after-loop @gol
7440 -fsched-interblock -fsched-spec @gol
7441 -fschedule-insns -fschedule-insns2 @gol
7442 -fstore-merging @gol
7443 -fstrict-aliasing @gol
7444 -ftree-builtin-call-dce @gol
7445 -ftree-switch-conversion -ftree-tail-merge @gol
7446 -fcode-hoisting @gol
7451 Please note the warning under @option{-fgcse} about
7452 invoking @option{-O2} on programs that use computed gotos.
7456 Optimize yet more. @option{-O3} turns on all optimizations specified
7457 by @option{-O2} and also turns on the following optimization flags:
7458 @gccoptlist{-finline-functions @gol
7459 -funswitch-loops @gol
7460 -fpredictive-commoning @gol
7461 -fgcse-after-reload @gol
7462 -ftree-loop-vectorize @gol
7463 -ftree-loop-distribution @gol
7464 -ftree-loop-distribute-patterns @gol
7465 -floop-interchange @gol
7467 -ftree-slp-vectorize @gol
7468 -fvect-cost-model @gol
7469 -ftree-partial-pre @gol
7475 Reduce compilation time and make debugging produce the expected
7476 results. This is the default.
7480 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7481 do not typically increase code size. It also performs further
7482 optimizations designed to reduce code size.
7484 @option{-Os} disables the following optimization flags:
7485 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7486 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
7487 -freorder-blocks-and-partition -fprefetch-loop-arrays}
7491 Disregard strict standards compliance. @option{-Ofast} enables all
7492 @option{-O3} optimizations. It also enables optimizations that are not
7493 valid for all standard-compliant programs.
7494 It turns on @option{-ffast-math} and the Fortran-specific
7495 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
7496 specified, and @option{-fno-protect-parens}.
7500 Optimize debugging experience. @option{-Og} enables optimizations
7501 that do not interfere with debugging. It should be the optimization
7502 level of choice for the standard edit-compile-debug cycle, offering
7503 a reasonable level of optimization while maintaining fast compilation
7504 and a good debugging experience.
7507 If you use multiple @option{-O} options, with or without level numbers,
7508 the last such option is the one that is effective.
7510 Options of the form @option{-f@var{flag}} specify machine-independent
7511 flags. Most flags have both positive and negative forms; the negative
7512 form of @option{-ffoo} is @option{-fno-foo}. In the table
7513 below, only one of the forms is listed---the one you typically
7514 use. You can figure out the other form by either removing @samp{no-}
7517 The following options control specific optimizations. They are either
7518 activated by @option{-O} options or are related to ones that are. You
7519 can use the following flags in the rare cases when ``fine-tuning'' of
7520 optimizations to be performed is desired.
7523 @item -fno-defer-pop
7524 @opindex fno-defer-pop
7525 Always pop the arguments to each function call as soon as that function
7526 returns. For machines that must pop arguments after a function call,
7527 the compiler normally lets arguments accumulate on the stack for several
7528 function calls and pops them all at once.
7530 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7532 @item -fforward-propagate
7533 @opindex fforward-propagate
7534 Perform a forward propagation pass on RTL@. The pass tries to combine two
7535 instructions and checks if the result can be simplified. If loop unrolling
7536 is active, two passes are performed and the second is scheduled after
7539 This option is enabled by default at optimization levels @option{-O},
7540 @option{-O2}, @option{-O3}, @option{-Os}.
7542 @item -ffp-contract=@var{style}
7543 @opindex ffp-contract
7544 @option{-ffp-contract=off} disables floating-point expression contraction.
7545 @option{-ffp-contract=fast} enables floating-point expression contraction
7546 such as forming of fused multiply-add operations if the target has
7547 native support for them.
7548 @option{-ffp-contract=on} enables floating-point expression contraction
7549 if allowed by the language standard. This is currently not implemented
7550 and treated equal to @option{-ffp-contract=off}.
7552 The default is @option{-ffp-contract=fast}.
7554 @item -fomit-frame-pointer
7555 @opindex fomit-frame-pointer
7556 Omit the frame pointer in functions that don't need one. This avoids the
7557 instructions to save, set up and restore the frame pointer; on many targets
7558 it also makes an extra register available.
7560 On some targets this flag has no effect because the standard calling sequence
7561 always uses a frame pointer, so it cannot be omitted.
7563 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
7564 is used in all functions. Several targets always omit the frame pointer in
7567 Enabled by default at @option{-O} and higher.
7569 @item -foptimize-sibling-calls
7570 @opindex foptimize-sibling-calls
7571 Optimize sibling and tail recursive calls.
7573 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7575 @item -foptimize-strlen
7576 @opindex foptimize-strlen
7577 Optimize various standard C string functions (e.g. @code{strlen},
7578 @code{strchr} or @code{strcpy}) and
7579 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7581 Enabled at levels @option{-O2}, @option{-O3}.
7585 Do not expand any functions inline apart from those marked with
7586 the @code{always_inline} attribute. This is the default when not
7589 Single functions can be exempted from inlining by marking them
7590 with the @code{noinline} attribute.
7592 @item -finline-small-functions
7593 @opindex finline-small-functions
7594 Integrate functions into their callers when their body is smaller than expected
7595 function call code (so overall size of program gets smaller). The compiler
7596 heuristically decides which functions are simple enough to be worth integrating
7597 in this way. This inlining applies to all functions, even those not declared
7600 Enabled at level @option{-O2}.
7602 @item -findirect-inlining
7603 @opindex findirect-inlining
7604 Inline also indirect calls that are discovered to be known at compile
7605 time thanks to previous inlining. This option has any effect only
7606 when inlining itself is turned on by the @option{-finline-functions}
7607 or @option{-finline-small-functions} options.
7609 Enabled at level @option{-O2}.
7611 @item -finline-functions
7612 @opindex finline-functions
7613 Consider all functions for inlining, even if they are not declared inline.
7614 The compiler heuristically decides which functions are worth integrating
7617 If all calls to a given function are integrated, and the function is
7618 declared @code{static}, then the function is normally not output as
7619 assembler code in its own right.
7621 Enabled at level @option{-O3}.
7623 @item -finline-functions-called-once
7624 @opindex finline-functions-called-once
7625 Consider all @code{static} functions called once for inlining into their
7626 caller even if they are not marked @code{inline}. If a call to a given
7627 function is integrated, then the function is not output as assembler code
7630 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7632 @item -fearly-inlining
7633 @opindex fearly-inlining
7634 Inline functions marked by @code{always_inline} and functions whose body seems
7635 smaller than the function call overhead early before doing
7636 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7637 makes profiling significantly cheaper and usually inlining faster on programs
7638 having large chains of nested wrapper functions.
7644 Perform interprocedural scalar replacement of aggregates, removal of
7645 unused parameters and replacement of parameters passed by reference
7646 by parameters passed by value.
7648 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7650 @item -finline-limit=@var{n}
7651 @opindex finline-limit
7652 By default, GCC limits the size of functions that can be inlined. This flag
7653 allows coarse control of this limit. @var{n} is the size of functions that
7654 can be inlined in number of pseudo instructions.
7656 Inlining is actually controlled by a number of parameters, which may be
7657 specified individually by using @option{--param @var{name}=@var{value}}.
7658 The @option{-finline-limit=@var{n}} option sets some of these parameters
7662 @item max-inline-insns-single
7663 is set to @var{n}/2.
7664 @item max-inline-insns-auto
7665 is set to @var{n}/2.
7668 See below for a documentation of the individual
7669 parameters controlling inlining and for the defaults of these parameters.
7671 @emph{Note:} there may be no value to @option{-finline-limit} that results
7672 in default behavior.
7674 @emph{Note:} pseudo instruction represents, in this particular context, an
7675 abstract measurement of function's size. In no way does it represent a count
7676 of assembly instructions and as such its exact meaning might change from one
7677 release to an another.
7679 @item -fno-keep-inline-dllexport
7680 @opindex fno-keep-inline-dllexport
7681 This is a more fine-grained version of @option{-fkeep-inline-functions},
7682 which applies only to functions that are declared using the @code{dllexport}
7683 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
7686 @item -fkeep-inline-functions
7687 @opindex fkeep-inline-functions
7688 In C, emit @code{static} functions that are declared @code{inline}
7689 into the object file, even if the function has been inlined into all
7690 of its callers. This switch does not affect functions using the
7691 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7692 inline functions into the object file.
7694 @item -fkeep-static-functions
7695 @opindex fkeep-static-functions
7696 Emit @code{static} functions into the object file, even if the function
7699 @item -fkeep-static-consts
7700 @opindex fkeep-static-consts
7701 Emit variables declared @code{static const} when optimization isn't turned
7702 on, even if the variables aren't referenced.
7704 GCC enables this option by default. If you want to force the compiler to
7705 check if a variable is referenced, regardless of whether or not
7706 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7708 @item -fmerge-constants
7709 @opindex fmerge-constants
7710 Attempt to merge identical constants (string constants and floating-point
7711 constants) across compilation units.
7713 This option is the default for optimized compilation if the assembler and
7714 linker support it. Use @option{-fno-merge-constants} to inhibit this
7717 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7719 @item -fmerge-all-constants
7720 @opindex fmerge-all-constants
7721 Attempt to merge identical constants and identical variables.
7723 This option implies @option{-fmerge-constants}. In addition to
7724 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7725 arrays or initialized constant variables with integral or floating-point
7726 types. Languages like C or C++ require each variable, including multiple
7727 instances of the same variable in recursive calls, to have distinct locations,
7728 so using this option results in non-conforming
7731 @item -fmodulo-sched
7732 @opindex fmodulo-sched
7733 Perform swing modulo scheduling immediately before the first scheduling
7734 pass. This pass looks at innermost loops and reorders their
7735 instructions by overlapping different iterations.
7737 @item -fmodulo-sched-allow-regmoves
7738 @opindex fmodulo-sched-allow-regmoves
7739 Perform more aggressive SMS-based modulo scheduling with register moves
7740 allowed. By setting this flag certain anti-dependences edges are
7741 deleted, which triggers the generation of reg-moves based on the
7742 life-range analysis. This option is effective only with
7743 @option{-fmodulo-sched} enabled.
7745 @item -fno-branch-count-reg
7746 @opindex fno-branch-count-reg
7747 Avoid running a pass scanning for opportunities to use ``decrement and
7748 branch'' instructions on a count register instead of generating sequences
7749 of instructions that decrement a register, compare it against zero, and
7750 then branch based upon the result. This option is only meaningful on
7751 architectures that support such instructions, which include x86, PowerPC,
7752 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
7753 doesn't remove the decrement and branch instructions from the generated
7754 instruction stream introduced by other optimization passes.
7756 Enabled by default at @option{-O1} and higher.
7758 The default is @option{-fbranch-count-reg}.
7760 @item -fno-function-cse
7761 @opindex fno-function-cse
7762 Do not put function addresses in registers; make each instruction that
7763 calls a constant function contain the function's address explicitly.
7765 This option results in less efficient code, but some strange hacks
7766 that alter the assembler output may be confused by the optimizations
7767 performed when this option is not used.
7769 The default is @option{-ffunction-cse}
7771 @item -fno-zero-initialized-in-bss
7772 @opindex fno-zero-initialized-in-bss
7773 If the target supports a BSS section, GCC by default puts variables that
7774 are initialized to zero into BSS@. This can save space in the resulting
7777 This option turns off this behavior because some programs explicitly
7778 rely on variables going to the data section---e.g., so that the
7779 resulting executable can find the beginning of that section and/or make
7780 assumptions based on that.
7782 The default is @option{-fzero-initialized-in-bss}.
7784 @item -fthread-jumps
7785 @opindex fthread-jumps
7786 Perform optimizations that check to see if a jump branches to a
7787 location where another comparison subsumed by the first is found. If
7788 so, the first branch is redirected to either the destination of the
7789 second branch or a point immediately following it, depending on whether
7790 the condition is known to be true or false.
7792 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7794 @item -fsplit-wide-types
7795 @opindex fsplit-wide-types
7796 When using a type that occupies multiple registers, such as @code{long
7797 long} on a 32-bit system, split the registers apart and allocate them
7798 independently. This normally generates better code for those types,
7799 but may make debugging more difficult.
7801 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7804 @item -fcse-follow-jumps
7805 @opindex fcse-follow-jumps
7806 In common subexpression elimination (CSE), scan through jump instructions
7807 when the target of the jump is not reached by any other path. For
7808 example, when CSE encounters an @code{if} statement with an
7809 @code{else} clause, CSE follows the jump when the condition
7812 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7814 @item -fcse-skip-blocks
7815 @opindex fcse-skip-blocks
7816 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7817 follow jumps that conditionally skip over blocks. When CSE
7818 encounters a simple @code{if} statement with no else clause,
7819 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7820 body of the @code{if}.
7822 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7824 @item -frerun-cse-after-loop
7825 @opindex frerun-cse-after-loop
7826 Re-run common subexpression elimination after loop optimizations are
7829 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7833 Perform a global common subexpression elimination pass.
7834 This pass also performs global constant and copy propagation.
7836 @emph{Note:} When compiling a program using computed gotos, a GCC
7837 extension, you may get better run-time performance if you disable
7838 the global common subexpression elimination pass by adding
7839 @option{-fno-gcse} to the command line.
7841 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7845 When @option{-fgcse-lm} is enabled, global common subexpression elimination
7846 attempts to move loads that are only killed by stores into themselves. This
7847 allows a loop containing a load/store sequence to be changed to a load outside
7848 the loop, and a copy/store within the loop.
7850 Enabled by default when @option{-fgcse} is enabled.
7854 When @option{-fgcse-sm} is enabled, a store motion pass is run after
7855 global common subexpression elimination. This pass attempts to move
7856 stores out of loops. When used in conjunction with @option{-fgcse-lm},
7857 loops containing a load/store sequence can be changed to a load before
7858 the loop and a store after the loop.
7860 Not enabled at any optimization level.
7864 When @option{-fgcse-las} is enabled, the global common subexpression
7865 elimination pass eliminates redundant loads that come after stores to the
7866 same memory location (both partial and full redundancies).
7868 Not enabled at any optimization level.
7870 @item -fgcse-after-reload
7871 @opindex fgcse-after-reload
7872 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7873 pass is performed after reload. The purpose of this pass is to clean up
7876 @item -faggressive-loop-optimizations
7877 @opindex faggressive-loop-optimizations
7878 This option tells the loop optimizer to use language constraints to
7879 derive bounds for the number of iterations of a loop. This assumes that
7880 loop code does not invoke undefined behavior by for example causing signed
7881 integer overflows or out-of-bound array accesses. The bounds for the
7882 number of iterations of a loop are used to guide loop unrolling and peeling
7883 and loop exit test optimizations.
7884 This option is enabled by default.
7886 @item -funconstrained-commons
7887 @opindex funconstrained-commons
7888 This option tells the compiler that variables declared in common blocks
7889 (e.g. Fortran) may later be overridden with longer trailing arrays. This
7890 prevents certain optimizations that depend on knowing the array bounds.
7892 @item -fcrossjumping
7893 @opindex fcrossjumping
7894 Perform cross-jumping transformation.
7895 This transformation unifies equivalent code and saves code size. The
7896 resulting code may or may not perform better than without cross-jumping.
7898 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7900 @item -fauto-inc-dec
7901 @opindex fauto-inc-dec
7902 Combine increments or decrements of addresses with memory accesses.
7903 This pass is always skipped on architectures that do not have
7904 instructions to support this. Enabled by default at @option{-O} and
7905 higher on architectures that support this.
7909 Perform dead code elimination (DCE) on RTL@.
7910 Enabled by default at @option{-O} and higher.
7914 Perform dead store elimination (DSE) on RTL@.
7915 Enabled by default at @option{-O} and higher.
7917 @item -fif-conversion
7918 @opindex fif-conversion
7919 Attempt to transform conditional jumps into branch-less equivalents. This
7920 includes use of conditional moves, min, max, set flags and abs instructions, and
7921 some tricks doable by standard arithmetics. The use of conditional execution
7922 on chips where it is available is controlled by @option{-fif-conversion2}.
7924 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7926 @item -fif-conversion2
7927 @opindex fif-conversion2
7928 Use conditional execution (where available) to transform conditional jumps into
7929 branch-less equivalents.
7931 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7933 @item -fdeclone-ctor-dtor
7934 @opindex fdeclone-ctor-dtor
7935 The C++ ABI requires multiple entry points for constructors and
7936 destructors: one for a base subobject, one for a complete object, and
7937 one for a virtual destructor that calls operator delete afterwards.
7938 For a hierarchy with virtual bases, the base and complete variants are
7939 clones, which means two copies of the function. With this option, the
7940 base and complete variants are changed to be thunks that call a common
7943 Enabled by @option{-Os}.
7945 @item -fdelete-null-pointer-checks
7946 @opindex fdelete-null-pointer-checks
7947 Assume that programs cannot safely dereference null pointers, and that
7948 no code or data element resides at address zero.
7949 This option enables simple constant
7950 folding optimizations at all optimization levels. In addition, other
7951 optimization passes in GCC use this flag to control global dataflow
7952 analyses that eliminate useless checks for null pointers; these assume
7953 that a memory access to address zero always results in a trap, so
7954 that if a pointer is checked after it has already been dereferenced,
7957 Note however that in some environments this assumption is not true.
7958 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
7959 for programs that depend on that behavior.
7961 This option is enabled by default on most targets. On Nios II ELF, it
7962 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
7964 Passes that use the dataflow information
7965 are enabled independently at different optimization levels.
7967 @item -fdevirtualize
7968 @opindex fdevirtualize
7969 Attempt to convert calls to virtual functions to direct calls. This
7970 is done both within a procedure and interprocedurally as part of
7971 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
7972 propagation (@option{-fipa-cp}).
7973 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7975 @item -fdevirtualize-speculatively
7976 @opindex fdevirtualize-speculatively
7977 Attempt to convert calls to virtual functions to speculative direct calls.
7978 Based on the analysis of the type inheritance graph, determine for a given call
7979 the set of likely targets. If the set is small, preferably of size 1, change
7980 the call into a conditional deciding between direct and indirect calls. The
7981 speculative calls enable more optimizations, such as inlining. When they seem
7982 useless after further optimization, they are converted back into original form.
7984 @item -fdevirtualize-at-ltrans
7985 @opindex fdevirtualize-at-ltrans
7986 Stream extra information needed for aggressive devirtualization when running
7987 the link-time optimizer in local transformation mode.
7988 This option enables more devirtualization but
7989 significantly increases the size of streamed data. For this reason it is
7990 disabled by default.
7992 @item -fexpensive-optimizations
7993 @opindex fexpensive-optimizations
7994 Perform a number of minor optimizations that are relatively expensive.
7996 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8000 Attempt to remove redundant extension instructions. This is especially
8001 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8002 registers after writing to their lower 32-bit half.
8004 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8005 @option{-O3}, @option{-Os}.
8007 @item -fno-lifetime-dse
8008 @opindex fno-lifetime-dse
8009 In C++ the value of an object is only affected by changes within its
8010 lifetime: when the constructor begins, the object has an indeterminate
8011 value, and any changes during the lifetime of the object are dead when
8012 the object is destroyed. Normally dead store elimination will take
8013 advantage of this; if your code relies on the value of the object
8014 storage persisting beyond the lifetime of the object, you can use this
8015 flag to disable this optimization. To preserve stores before the
8016 constructor starts (e.g. because your operator new clears the object
8017 storage) but still treat the object as dead after the destructor you,
8018 can use @option{-flifetime-dse=1}. The default behavior can be
8019 explicitly selected with @option{-flifetime-dse=2}.
8020 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8022 @item -flive-range-shrinkage
8023 @opindex flive-range-shrinkage
8024 Attempt to decrease register pressure through register live range
8025 shrinkage. This is helpful for fast processors with small or moderate
8028 @item -fira-algorithm=@var{algorithm}
8029 @opindex fira-algorithm
8030 Use the specified coloring algorithm for the integrated register
8031 allocator. The @var{algorithm} argument can be @samp{priority}, which
8032 specifies Chow's priority coloring, or @samp{CB}, which specifies
8033 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8034 for all architectures, but for those targets that do support it, it is
8035 the default because it generates better code.
8037 @item -fira-region=@var{region}
8038 @opindex fira-region
8039 Use specified regions for the integrated register allocator. The
8040 @var{region} argument should be one of the following:
8045 Use all loops as register allocation regions.
8046 This can give the best results for machines with a small and/or
8047 irregular register set.
8050 Use all loops except for loops with small register pressure
8051 as the regions. This value usually gives
8052 the best results in most cases and for most architectures,
8053 and is enabled by default when compiling with optimization for speed
8054 (@option{-O}, @option{-O2}, @dots{}).
8057 Use all functions as a single region.
8058 This typically results in the smallest code size, and is enabled by default for
8059 @option{-Os} or @option{-O0}.
8063 @item -fira-hoist-pressure
8064 @opindex fira-hoist-pressure
8065 Use IRA to evaluate register pressure in the code hoisting pass for
8066 decisions to hoist expressions. This option usually results in smaller
8067 code, but it can slow the compiler down.
8069 This option is enabled at level @option{-Os} for all targets.
8071 @item -fira-loop-pressure
8072 @opindex fira-loop-pressure
8073 Use IRA to evaluate register pressure in loops for decisions to move
8074 loop invariants. This option usually results in generation
8075 of faster and smaller code on machines with large register files (>= 32
8076 registers), but it can slow the compiler down.
8078 This option is enabled at level @option{-O3} for some targets.
8080 @item -fno-ira-share-save-slots
8081 @opindex fno-ira-share-save-slots
8082 Disable sharing of stack slots used for saving call-used hard
8083 registers living through a call. Each hard register gets a
8084 separate stack slot, and as a result function stack frames are
8087 @item -fno-ira-share-spill-slots
8088 @opindex fno-ira-share-spill-slots
8089 Disable sharing of stack slots allocated for pseudo-registers. Each
8090 pseudo-register that does not get a hard register gets a separate
8091 stack slot, and as a result function stack frames are larger.
8095 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8096 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8097 values if it is profitable.
8099 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8101 @item -fdelayed-branch
8102 @opindex fdelayed-branch
8103 If supported for the target machine, attempt to reorder instructions
8104 to exploit instruction slots available after delayed branch
8107 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8109 @item -fschedule-insns
8110 @opindex fschedule-insns
8111 If supported for the target machine, attempt to reorder instructions to
8112 eliminate execution stalls due to required data being unavailable. This
8113 helps machines that have slow floating point or memory load instructions
8114 by allowing other instructions to be issued until the result of the load
8115 or floating-point instruction is required.
8117 Enabled at levels @option{-O2}, @option{-O3}.
8119 @item -fschedule-insns2
8120 @opindex fschedule-insns2
8121 Similar to @option{-fschedule-insns}, but requests an additional pass of
8122 instruction scheduling after register allocation has been done. This is
8123 especially useful on machines with a relatively small number of
8124 registers and where memory load instructions take more than one cycle.
8126 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8128 @item -fno-sched-interblock
8129 @opindex fno-sched-interblock
8130 Don't schedule instructions across basic blocks. This is normally
8131 enabled by default when scheduling before register allocation, i.e.@:
8132 with @option{-fschedule-insns} or at @option{-O2} or higher.
8134 @item -fno-sched-spec
8135 @opindex fno-sched-spec
8136 Don't allow speculative motion of non-load instructions. This is normally
8137 enabled by default when scheduling before register allocation, i.e.@:
8138 with @option{-fschedule-insns} or at @option{-O2} or higher.
8140 @item -fsched-pressure
8141 @opindex fsched-pressure
8142 Enable register pressure sensitive insn scheduling before register
8143 allocation. This only makes sense when scheduling before register
8144 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8145 @option{-O2} or higher. Usage of this option can improve the
8146 generated code and decrease its size by preventing register pressure
8147 increase above the number of available hard registers and subsequent
8148 spills in register allocation.
8150 @item -fsched-spec-load
8151 @opindex fsched-spec-load
8152 Allow speculative motion of some load instructions. This only makes
8153 sense when scheduling before register allocation, i.e.@: with
8154 @option{-fschedule-insns} or at @option{-O2} or higher.
8156 @item -fsched-spec-load-dangerous
8157 @opindex fsched-spec-load-dangerous
8158 Allow speculative motion of more load instructions. This only makes
8159 sense when scheduling before register allocation, i.e.@: with
8160 @option{-fschedule-insns} or at @option{-O2} or higher.
8162 @item -fsched-stalled-insns
8163 @itemx -fsched-stalled-insns=@var{n}
8164 @opindex fsched-stalled-insns
8165 Define how many insns (if any) can be moved prematurely from the queue
8166 of stalled insns into the ready list during the second scheduling pass.
8167 @option{-fno-sched-stalled-insns} means that no insns are moved
8168 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8169 on how many queued insns can be moved prematurely.
8170 @option{-fsched-stalled-insns} without a value is equivalent to
8171 @option{-fsched-stalled-insns=1}.
8173 @item -fsched-stalled-insns-dep
8174 @itemx -fsched-stalled-insns-dep=@var{n}
8175 @opindex fsched-stalled-insns-dep
8176 Define how many insn groups (cycles) are examined for a dependency
8177 on a stalled insn that is a candidate for premature removal from the queue
8178 of stalled insns. This has an effect only during the second scheduling pass,
8179 and only if @option{-fsched-stalled-insns} is used.
8180 @option{-fno-sched-stalled-insns-dep} is equivalent to
8181 @option{-fsched-stalled-insns-dep=0}.
8182 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8183 @option{-fsched-stalled-insns-dep=1}.
8185 @item -fsched2-use-superblocks
8186 @opindex fsched2-use-superblocks
8187 When scheduling after register allocation, use superblock scheduling.
8188 This allows motion across basic block boundaries,
8189 resulting in faster schedules. This option is experimental, as not all machine
8190 descriptions used by GCC model the CPU closely enough to avoid unreliable
8191 results from the algorithm.
8193 This only makes sense when scheduling after register allocation, i.e.@: with
8194 @option{-fschedule-insns2} or at @option{-O2} or higher.
8196 @item -fsched-group-heuristic
8197 @opindex fsched-group-heuristic
8198 Enable the group heuristic in the scheduler. This heuristic favors
8199 the instruction that belongs to a schedule group. This is enabled
8200 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8201 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8203 @item -fsched-critical-path-heuristic
8204 @opindex fsched-critical-path-heuristic
8205 Enable the critical-path heuristic in the scheduler. This heuristic favors
8206 instructions on the critical path. This is enabled by default when
8207 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8208 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8210 @item -fsched-spec-insn-heuristic
8211 @opindex fsched-spec-insn-heuristic
8212 Enable the speculative instruction heuristic in the scheduler. This
8213 heuristic favors speculative instructions with greater dependency weakness.
8214 This is enabled by default when scheduling is enabled, i.e.@:
8215 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8216 or at @option{-O2} or higher.
8218 @item -fsched-rank-heuristic
8219 @opindex fsched-rank-heuristic
8220 Enable the rank heuristic in the scheduler. This heuristic favors
8221 the instruction belonging to a basic block with greater size or frequency.
8222 This is enabled by default when scheduling is enabled, i.e.@:
8223 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8224 at @option{-O2} or higher.
8226 @item -fsched-last-insn-heuristic
8227 @opindex fsched-last-insn-heuristic
8228 Enable the last-instruction heuristic in the scheduler. This heuristic
8229 favors the instruction that is less dependent on the last instruction
8230 scheduled. This is enabled by default when scheduling is enabled,
8231 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8232 at @option{-O2} or higher.
8234 @item -fsched-dep-count-heuristic
8235 @opindex fsched-dep-count-heuristic
8236 Enable the dependent-count heuristic in the scheduler. This heuristic
8237 favors the instruction that has more instructions depending on it.
8238 This is enabled by default when scheduling is enabled, i.e.@:
8239 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8240 at @option{-O2} or higher.
8242 @item -freschedule-modulo-scheduled-loops
8243 @opindex freschedule-modulo-scheduled-loops
8244 Modulo scheduling is performed before traditional scheduling. If a loop
8245 is modulo scheduled, later scheduling passes may change its schedule.
8246 Use this option to control that behavior.
8248 @item -fselective-scheduling
8249 @opindex fselective-scheduling
8250 Schedule instructions using selective scheduling algorithm. Selective
8251 scheduling runs instead of the first scheduler pass.
8253 @item -fselective-scheduling2
8254 @opindex fselective-scheduling2
8255 Schedule instructions using selective scheduling algorithm. Selective
8256 scheduling runs instead of the second scheduler pass.
8258 @item -fsel-sched-pipelining
8259 @opindex fsel-sched-pipelining
8260 Enable software pipelining of innermost loops during selective scheduling.
8261 This option has no effect unless one of @option{-fselective-scheduling} or
8262 @option{-fselective-scheduling2} is turned on.
8264 @item -fsel-sched-pipelining-outer-loops
8265 @opindex fsel-sched-pipelining-outer-loops
8266 When pipelining loops during selective scheduling, also pipeline outer loops.
8267 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8269 @item -fsemantic-interposition
8270 @opindex fsemantic-interposition
8271 Some object formats, like ELF, allow interposing of symbols by the
8273 This means that for symbols exported from the DSO, the compiler cannot perform
8274 interprocedural propagation, inlining and other optimizations in anticipation
8275 that the function or variable in question may change. While this feature is
8276 useful, for example, to rewrite memory allocation functions by a debugging
8277 implementation, it is expensive in the terms of code quality.
8278 With @option{-fno-semantic-interposition} the compiler assumes that
8279 if interposition happens for functions the overwriting function will have
8280 precisely the same semantics (and side effects).
8281 Similarly if interposition happens
8282 for variables, the constructor of the variable will be the same. The flag
8283 has no effect for functions explicitly declared inline
8284 (where it is never allowed for interposition to change semantics)
8285 and for symbols explicitly declared weak.
8288 @opindex fshrink-wrap
8289 Emit function prologues only before parts of the function that need it,
8290 rather than at the top of the function. This flag is enabled by default at
8291 @option{-O} and higher.
8293 @item -fshrink-wrap-separate
8294 @opindex fshrink-wrap-separate
8295 Shrink-wrap separate parts of the prologue and epilogue separately, so that
8296 those parts are only executed when needed.
8297 This option is on by default, but has no effect unless @option{-fshrink-wrap}
8298 is also turned on and the target supports this.
8300 @item -fcaller-saves
8301 @opindex fcaller-saves
8302 Enable allocation of values to registers that are clobbered by
8303 function calls, by emitting extra instructions to save and restore the
8304 registers around such calls. Such allocation is done only when it
8305 seems to result in better code.
8307 This option is always enabled by default on certain machines, usually
8308 those which have no call-preserved registers to use instead.
8310 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8312 @item -fcombine-stack-adjustments
8313 @opindex fcombine-stack-adjustments
8314 Tracks stack adjustments (pushes and pops) and stack memory references
8315 and then tries to find ways to combine them.
8317 Enabled by default at @option{-O1} and higher.
8321 Use caller save registers for allocation if those registers are not used by
8322 any called function. In that case it is not necessary to save and restore
8323 them around calls. This is only possible if called functions are part of
8324 same compilation unit as current function and they are compiled before it.
8326 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
8327 is disabled if generated code will be instrumented for profiling
8328 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
8329 exactly (this happens on targets that do not expose prologues
8330 and epilogues in RTL).
8332 @item -fconserve-stack
8333 @opindex fconserve-stack
8334 Attempt to minimize stack usage. The compiler attempts to use less
8335 stack space, even if that makes the program slower. This option
8336 implies setting the @option{large-stack-frame} parameter to 100
8337 and the @option{large-stack-frame-growth} parameter to 400.
8339 @item -ftree-reassoc
8340 @opindex ftree-reassoc
8341 Perform reassociation on trees. This flag is enabled by default
8342 at @option{-O} and higher.
8344 @item -fcode-hoisting
8345 @opindex fcode-hoisting
8346 Perform code hoisting. Code hoisting tries to move the
8347 evaluation of expressions executed on all paths to the function exit
8348 as early as possible. This is especially useful as a code size
8349 optimization, but it often helps for code speed as well.
8350 This flag is enabled by default at @option{-O2} and higher.
8354 Perform partial redundancy elimination (PRE) on trees. This flag is
8355 enabled by default at @option{-O2} and @option{-O3}.
8357 @item -ftree-partial-pre
8358 @opindex ftree-partial-pre
8359 Make partial redundancy elimination (PRE) more aggressive. This flag is
8360 enabled by default at @option{-O3}.
8362 @item -ftree-forwprop
8363 @opindex ftree-forwprop
8364 Perform forward propagation on trees. This flag is enabled by default
8365 at @option{-O} and higher.
8369 Perform full redundancy elimination (FRE) on trees. The difference
8370 between FRE and PRE is that FRE only considers expressions
8371 that are computed on all paths leading to the redundant computation.
8372 This analysis is faster than PRE, though it exposes fewer redundancies.
8373 This flag is enabled by default at @option{-O} and higher.
8375 @item -ftree-phiprop
8376 @opindex ftree-phiprop
8377 Perform hoisting of loads from conditional pointers on trees. This
8378 pass is enabled by default at @option{-O} and higher.
8380 @item -fhoist-adjacent-loads
8381 @opindex fhoist-adjacent-loads
8382 Speculatively hoist loads from both branches of an if-then-else if the
8383 loads are from adjacent locations in the same structure and the target
8384 architecture has a conditional move instruction. This flag is enabled
8385 by default at @option{-O2} and higher.
8387 @item -ftree-copy-prop
8388 @opindex ftree-copy-prop
8389 Perform copy propagation on trees. This pass eliminates unnecessary
8390 copy operations. This flag is enabled by default at @option{-O} and
8393 @item -fipa-pure-const
8394 @opindex fipa-pure-const
8395 Discover which functions are pure or constant.
8396 Enabled by default at @option{-O} and higher.
8398 @item -fipa-reference
8399 @opindex fipa-reference
8400 Discover which static variables do not escape the
8402 Enabled by default at @option{-O} and higher.
8406 Perform interprocedural pointer analysis and interprocedural modification
8407 and reference analysis. This option can cause excessive memory and
8408 compile-time usage on large compilation units. It is not enabled by
8409 default at any optimization level.
8412 @opindex fipa-profile
8413 Perform interprocedural profile propagation. The functions called only from
8414 cold functions are marked as cold. Also functions executed once (such as
8415 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8416 functions and loop less parts of functions executed once are then optimized for
8418 Enabled by default at @option{-O} and higher.
8422 Perform interprocedural constant propagation.
8423 This optimization analyzes the program to determine when values passed
8424 to functions are constants and then optimizes accordingly.
8425 This optimization can substantially increase performance
8426 if the application has constants passed to functions.
8427 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8429 @item -fipa-cp-clone
8430 @opindex fipa-cp-clone
8431 Perform function cloning to make interprocedural constant propagation stronger.
8432 When enabled, interprocedural constant propagation performs function cloning
8433 when externally visible function can be called with constant arguments.
8434 Because this optimization can create multiple copies of functions,
8435 it may significantly increase code size
8436 (see @option{--param ipcp-unit-growth=@var{value}}).
8437 This flag is enabled by default at @option{-O3}.
8440 @opindex -fipa-bit-cp
8441 When enabled, perform interprocedural bitwise constant
8442 propagation. This flag is enabled by default at @option{-O2}. It
8443 requires that @option{-fipa-cp} is enabled.
8447 When enabled, perform interprocedural propagation of value
8448 ranges. This flag is enabled by default at @option{-O2}. It requires
8449 that @option{-fipa-cp} is enabled.
8453 Perform Identical Code Folding for functions and read-only variables.
8454 The optimization reduces code size and may disturb unwind stacks by replacing
8455 a function by equivalent one with a different name. The optimization works
8456 more effectively with link-time optimization enabled.
8458 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8459 works on different levels and thus the optimizations are not same - there are
8460 equivalences that are found only by GCC and equivalences found only by Gold.
8462 This flag is enabled by default at @option{-O2} and @option{-Os}.
8464 @item -fisolate-erroneous-paths-dereference
8465 @opindex fisolate-erroneous-paths-dereference
8466 Detect paths that trigger erroneous or undefined behavior due to
8467 dereferencing a null pointer. Isolate those paths from the main control
8468 flow and turn the statement with erroneous or undefined behavior into a trap.
8469 This flag is enabled by default at @option{-O2} and higher and depends on
8470 @option{-fdelete-null-pointer-checks} also being enabled.
8472 @item -fisolate-erroneous-paths-attribute
8473 @opindex fisolate-erroneous-paths-attribute
8474 Detect paths that trigger erroneous or undefined behavior due a null value
8475 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8476 attribute. Isolate those paths from the main control flow and turn the
8477 statement with erroneous or undefined behavior into a trap. This is not
8478 currently enabled, but may be enabled by @option{-O2} in the future.
8482 Perform forward store motion on trees. This flag is
8483 enabled by default at @option{-O} and higher.
8485 @item -ftree-bit-ccp
8486 @opindex ftree-bit-ccp
8487 Perform sparse conditional bit constant propagation on trees and propagate
8488 pointer alignment information.
8489 This pass only operates on local scalar variables and is enabled by default
8490 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8494 Perform sparse conditional constant propagation (CCP) on trees. This
8495 pass only operates on local scalar variables and is enabled by default
8496 at @option{-O} and higher.
8498 @item -fssa-backprop
8499 @opindex fssa-backprop
8500 Propagate information about uses of a value up the definition chain
8501 in order to simplify the definitions. For example, this pass strips
8502 sign operations if the sign of a value never matters. The flag is
8503 enabled by default at @option{-O} and higher.
8506 @opindex fssa-phiopt
8507 Perform pattern matching on SSA PHI nodes to optimize conditional
8508 code. This pass is enabled by default at @option{-O} and higher.
8510 @item -ftree-switch-conversion
8511 @opindex ftree-switch-conversion
8512 Perform conversion of simple initializations in a switch to
8513 initializations from a scalar array. This flag is enabled by default
8514 at @option{-O2} and higher.
8516 @item -ftree-tail-merge
8517 @opindex ftree-tail-merge
8518 Look for identical code sequences. When found, replace one with a jump to the
8519 other. This optimization is known as tail merging or cross jumping. This flag
8520 is enabled by default at @option{-O2} and higher. The compilation time
8522 be limited using @option{max-tail-merge-comparisons} parameter and
8523 @option{max-tail-merge-iterations} parameter.
8527 Perform dead code elimination (DCE) on trees. This flag is enabled by
8528 default at @option{-O} and higher.
8530 @item -ftree-builtin-call-dce
8531 @opindex ftree-builtin-call-dce
8532 Perform conditional dead code elimination (DCE) for calls to built-in functions
8533 that may set @code{errno} but are otherwise side-effect free. This flag is
8534 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8537 @item -ftree-dominator-opts
8538 @opindex ftree-dominator-opts
8539 Perform a variety of simple scalar cleanups (constant/copy
8540 propagation, redundancy elimination, range propagation and expression
8541 simplification) based on a dominator tree traversal. This also
8542 performs jump threading (to reduce jumps to jumps). This flag is
8543 enabled by default at @option{-O} and higher.
8547 Perform dead store elimination (DSE) on trees. A dead store is a store into
8548 a memory location that is later overwritten by another store without
8549 any intervening loads. In this case the earlier store can be deleted. This
8550 flag is enabled by default at @option{-O} and higher.
8554 Perform loop header copying on trees. This is beneficial since it increases
8555 effectiveness of code motion optimizations. It also saves one jump. This flag
8556 is enabled by default at @option{-O} and higher. It is not enabled
8557 for @option{-Os}, since it usually increases code size.
8559 @item -ftree-loop-optimize
8560 @opindex ftree-loop-optimize
8561 Perform loop optimizations on trees. This flag is enabled by default
8562 at @option{-O} and higher.
8564 @item -ftree-loop-linear
8565 @itemx -floop-strip-mine
8567 @opindex ftree-loop-linear
8568 @opindex floop-strip-mine
8569 @opindex floop-block
8570 Perform loop nest optimizations. Same as
8571 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8572 to be configured with @option{--with-isl} to enable the Graphite loop
8573 transformation infrastructure.
8575 @item -fgraphite-identity
8576 @opindex fgraphite-identity
8577 Enable the identity transformation for graphite. For every SCoP we generate
8578 the polyhedral representation and transform it back to gimple. Using
8579 @option{-fgraphite-identity} we can check the costs or benefits of the
8580 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8581 are also performed by the code generator isl, like index splitting and
8582 dead code elimination in loops.
8584 @item -floop-nest-optimize
8585 @opindex floop-nest-optimize
8586 Enable the isl based loop nest optimizer. This is a generic loop nest
8587 optimizer based on the Pluto optimization algorithms. It calculates a loop
8588 structure optimized for data-locality and parallelism. This option
8591 @item -floop-parallelize-all
8592 @opindex floop-parallelize-all
8593 Use the Graphite data dependence analysis to identify loops that can
8594 be parallelized. Parallelize all the loops that can be analyzed to
8595 not contain loop carried dependences without checking that it is
8596 profitable to parallelize the loops.
8598 @item -ftree-coalesce-vars
8599 @opindex ftree-coalesce-vars
8600 While transforming the program out of the SSA representation, attempt to
8601 reduce copying by coalescing versions of different user-defined
8602 variables, instead of just compiler temporaries. This may severely
8603 limit the ability to debug an optimized program compiled with
8604 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8605 prevents SSA coalescing of user variables. This option is enabled by
8606 default if optimization is enabled, and it does very little otherwise.
8608 @item -ftree-loop-if-convert
8609 @opindex ftree-loop-if-convert
8610 Attempt to transform conditional jumps in the innermost loops to
8611 branch-less equivalents. The intent is to remove control-flow from
8612 the innermost loops in order to improve the ability of the
8613 vectorization pass to handle these loops. This is enabled by default
8614 if vectorization is enabled.
8616 @item -ftree-loop-distribution
8617 @opindex ftree-loop-distribution
8618 Perform loop distribution. This flag can improve cache performance on
8619 big loop bodies and allow further loop optimizations, like
8620 parallelization or vectorization, to take place. For example, the loop
8637 @item -ftree-loop-distribute-patterns
8638 @opindex ftree-loop-distribute-patterns
8639 Perform loop distribution of patterns that can be code generated with
8640 calls to a library. This flag is enabled by default at @option{-O3}.
8642 This pass distributes the initialization loops and generates a call to
8643 memset zero. For example, the loop
8659 and the initialization loop is transformed into a call to memset zero.
8661 @item -floop-interchange
8662 @opindex floop-interchange
8663 Perform loop interchange outside of graphite. This flag can improve cache
8664 performance on loop nest and allow further loop optimizations, like
8665 vectorization, to take place. For example, the loop
8667 for (int i = 0; i < N; i++)
8668 for (int j = 0; j < N; j++)
8669 for (int k = 0; k < N; k++)
8670 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8674 for (int i = 0; i < N; i++)
8675 for (int k = 0; k < N; k++)
8676 for (int j = 0; j < N; j++)
8677 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8680 @item -ftree-loop-im
8681 @opindex ftree-loop-im
8682 Perform loop invariant motion on trees. This pass moves only invariants that
8683 are hard to handle at RTL level (function calls, operations that expand to
8684 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8685 operands of conditions that are invariant out of the loop, so that we can use
8686 just trivial invariantness analysis in loop unswitching. The pass also includes
8689 @item -ftree-loop-ivcanon
8690 @opindex ftree-loop-ivcanon
8691 Create a canonical counter for number of iterations in loops for which
8692 determining number of iterations requires complicated analysis. Later
8693 optimizations then may determine the number easily. Useful especially
8694 in connection with unrolling.
8698 Perform induction variable optimizations (strength reduction, induction
8699 variable merging and induction variable elimination) on trees.
8701 @item -ftree-parallelize-loops=n
8702 @opindex ftree-parallelize-loops
8703 Parallelize loops, i.e., split their iteration space to run in n threads.
8704 This is only possible for loops whose iterations are independent
8705 and can be arbitrarily reordered. The optimization is only
8706 profitable on multiprocessor machines, for loops that are CPU-intensive,
8707 rather than constrained e.g.@: by memory bandwidth. This option
8708 implies @option{-pthread}, and thus is only supported on targets
8709 that have support for @option{-pthread}.
8713 Perform function-local points-to analysis on trees. This flag is
8714 enabled by default at @option{-O} and higher.
8718 Perform scalar replacement of aggregates. This pass replaces structure
8719 references with scalars to prevent committing structures to memory too
8720 early. This flag is enabled by default at @option{-O} and higher.
8722 @item -fstore-merging
8723 @opindex fstore-merging
8724 Perform merging of narrow stores to consecutive memory addresses. This pass
8725 merges contiguous stores of immediate values narrower than a word into fewer
8726 wider stores to reduce the number of instructions. This is enabled by default
8727 at @option{-O2} and higher as well as @option{-Os}.
8731 Perform temporary expression replacement during the SSA->normal phase. Single
8732 use/single def temporaries are replaced at their use location with their
8733 defining expression. This results in non-GIMPLE code, but gives the expanders
8734 much more complex trees to work on resulting in better RTL generation. This is
8735 enabled by default at @option{-O} and higher.
8739 Perform straight-line strength reduction on trees. This recognizes related
8740 expressions involving multiplications and replaces them by less expensive
8741 calculations when possible. This is enabled by default at @option{-O} and
8744 @item -ftree-vectorize
8745 @opindex ftree-vectorize
8746 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8747 and @option{-ftree-slp-vectorize} if not explicitly specified.
8749 @item -ftree-loop-vectorize
8750 @opindex ftree-loop-vectorize
8751 Perform loop vectorization on trees. This flag is enabled by default at
8752 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8754 @item -ftree-slp-vectorize
8755 @opindex ftree-slp-vectorize
8756 Perform basic block vectorization on trees. This flag is enabled by default at
8757 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8759 @item -fvect-cost-model=@var{model}
8760 @opindex fvect-cost-model
8761 Alter the cost model used for vectorization. The @var{model} argument
8762 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
8763 With the @samp{unlimited} model the vectorized code-path is assumed
8764 to be profitable while with the @samp{dynamic} model a runtime check
8765 guards the vectorized code-path to enable it only for iteration
8766 counts that will likely execute faster than when executing the original
8767 scalar loop. The @samp{cheap} model disables vectorization of
8768 loops where doing so would be cost prohibitive for example due to
8769 required runtime checks for data dependence or alignment but otherwise
8770 is equal to the @samp{dynamic} model.
8771 The default cost model depends on other optimization flags and is
8772 either @samp{dynamic} or @samp{cheap}.
8774 @item -fsimd-cost-model=@var{model}
8775 @opindex fsimd-cost-model
8776 Alter the cost model used for vectorization of loops marked with the OpenMP
8777 or Cilk Plus simd directive. The @var{model} argument should be one of
8778 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
8779 have the same meaning as described in @option{-fvect-cost-model} and by
8780 default a cost model defined with @option{-fvect-cost-model} is used.
8784 Perform Value Range Propagation on trees. This is similar to the
8785 constant propagation pass, but instead of values, ranges of values are
8786 propagated. This allows the optimizers to remove unnecessary range
8787 checks like array bound checks and null pointer checks. This is
8788 enabled by default at @option{-O2} and higher. Null pointer check
8789 elimination is only done if @option{-fdelete-null-pointer-checks} is
8793 @opindex fsplit-paths
8794 Split paths leading to loop backedges. This can improve dead code
8795 elimination and common subexpression elimination. This is enabled by
8796 default at @option{-O2} and above.
8798 @item -fsplit-ivs-in-unroller
8799 @opindex fsplit-ivs-in-unroller
8800 Enables expression of values of induction variables in later iterations
8801 of the unrolled loop using the value in the first iteration. This breaks
8802 long dependency chains, thus improving efficiency of the scheduling passes.
8804 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8805 same effect. However, that is not reliable in cases where the loop body
8806 is more complicated than a single basic block. It also does not work at all
8807 on some architectures due to restrictions in the CSE pass.
8809 This optimization is enabled by default.
8811 @item -fvariable-expansion-in-unroller
8812 @opindex fvariable-expansion-in-unroller
8813 With this option, the compiler creates multiple copies of some
8814 local variables when unrolling a loop, which can result in superior code.
8816 @item -fpartial-inlining
8817 @opindex fpartial-inlining
8818 Inline parts of functions. This option has any effect only
8819 when inlining itself is turned on by the @option{-finline-functions}
8820 or @option{-finline-small-functions} options.
8822 Enabled at level @option{-O2}.
8824 @item -fpredictive-commoning
8825 @opindex fpredictive-commoning
8826 Perform predictive commoning optimization, i.e., reusing computations
8827 (especially memory loads and stores) performed in previous
8828 iterations of loops.
8830 This option is enabled at level @option{-O3}.
8832 @item -fprefetch-loop-arrays
8833 @opindex fprefetch-loop-arrays
8834 If supported by the target machine, generate instructions to prefetch
8835 memory to improve the performance of loops that access large arrays.
8837 This option may generate better or worse code; results are highly
8838 dependent on the structure of loops within the source code.
8840 Disabled at level @option{-Os}.
8842 @item -fno-printf-return-value
8843 @opindex fno-printf-return-value
8844 Do not substitute constants for known return value of formatted output
8845 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
8846 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
8847 transformation allows GCC to optimize or even eliminate branches based
8848 on the known return value of these functions called with arguments that
8849 are either constant, or whose values are known to be in a range that
8850 makes determining the exact return value possible. For example, when
8851 @option{-fprintf-return-value} is in effect, both the branch and the
8852 body of the @code{if} statement (but not the call to @code{snprint})
8853 can be optimized away when @code{i} is a 32-bit or smaller integer
8854 because the return value is guaranteed to be at most 8.
8858 if (snprintf (buf, "%08x", i) >= sizeof buf)
8862 The @option{-fprintf-return-value} option relies on other optimizations
8863 and yields best results with @option{-O2}. It works in tandem with the
8864 @option{-Wformat-overflow} and @option{-Wformat-truncation} options.
8865 The @option{-fprintf-return-value} option is enabled by default.
8868 @itemx -fno-peephole2
8869 @opindex fno-peephole
8870 @opindex fno-peephole2
8871 Disable any machine-specific peephole optimizations. The difference
8872 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
8873 are implemented in the compiler; some targets use one, some use the
8874 other, a few use both.
8876 @option{-fpeephole} is enabled by default.
8877 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8879 @item -fno-guess-branch-probability
8880 @opindex fno-guess-branch-probability
8881 Do not guess branch probabilities using heuristics.
8883 GCC uses heuristics to guess branch probabilities if they are
8884 not provided by profiling feedback (@option{-fprofile-arcs}). These
8885 heuristics are based on the control flow graph. If some branch probabilities
8886 are specified by @code{__builtin_expect}, then the heuristics are
8887 used to guess branch probabilities for the rest of the control flow graph,
8888 taking the @code{__builtin_expect} info into account. The interactions
8889 between the heuristics and @code{__builtin_expect} can be complex, and in
8890 some cases, it may be useful to disable the heuristics so that the effects
8891 of @code{__builtin_expect} are easier to understand.
8893 The default is @option{-fguess-branch-probability} at levels
8894 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8896 @item -freorder-blocks
8897 @opindex freorder-blocks
8898 Reorder basic blocks in the compiled function in order to reduce number of
8899 taken branches and improve code locality.
8901 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8903 @item -freorder-blocks-algorithm=@var{algorithm}
8904 @opindex freorder-blocks-algorithm
8905 Use the specified algorithm for basic block reordering. The
8906 @var{algorithm} argument can be @samp{simple}, which does not increase
8907 code size (except sometimes due to secondary effects like alignment),
8908 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
8909 put all often executed code together, minimizing the number of branches
8910 executed by making extra copies of code.
8912 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
8913 @samp{stc} at levels @option{-O2}, @option{-O3}.
8915 @item -freorder-blocks-and-partition
8916 @opindex freorder-blocks-and-partition
8917 In addition to reordering basic blocks in the compiled function, in order
8918 to reduce number of taken branches, partitions hot and cold basic blocks
8919 into separate sections of the assembly and @file{.o} files, to improve
8920 paging and cache locality performance.
8922 This optimization is automatically turned off in the presence of
8923 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
8924 section attribute and on any architecture that does not support named
8925 sections. When @option{-fsplit-stack} is used this option is not
8926 enabled by default (to avoid linker errors), but may be enabled
8927 explicitly (if using a working linker).
8929 Enabled for x86 at levels @option{-O2}, @option{-O3}.
8931 @item -freorder-functions
8932 @opindex freorder-functions
8933 Reorder functions in the object file in order to
8934 improve code locality. This is implemented by using special
8935 subsections @code{.text.hot} for most frequently executed functions and
8936 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
8937 the linker so object file format must support named sections and linker must
8938 place them in a reasonable way.
8940 Also profile feedback must be available to make this option effective. See
8941 @option{-fprofile-arcs} for details.
8943 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8945 @item -fstrict-aliasing
8946 @opindex fstrict-aliasing
8947 Allow the compiler to assume the strictest aliasing rules applicable to
8948 the language being compiled. For C (and C++), this activates
8949 optimizations based on the type of expressions. In particular, an
8950 object of one type is assumed never to reside at the same address as an
8951 object of a different type, unless the types are almost the same. For
8952 example, an @code{unsigned int} can alias an @code{int}, but not a
8953 @code{void*} or a @code{double}. A character type may alias any other
8956 @anchor{Type-punning}Pay special attention to code like this:
8969 The practice of reading from a different union member than the one most
8970 recently written to (called ``type-punning'') is common. Even with
8971 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
8972 is accessed through the union type. So, the code above works as
8973 expected. @xref{Structures unions enumerations and bit-fields
8974 implementation}. However, this code might not:
8985 Similarly, access by taking the address, casting the resulting pointer
8986 and dereferencing the result has undefined behavior, even if the cast
8987 uses a union type, e.g.:
8991 return ((union a_union *) &d)->i;
8995 The @option{-fstrict-aliasing} option is enabled at levels
8996 @option{-O2}, @option{-O3}, @option{-Os}.
8998 @item -falign-functions
8999 @itemx -falign-functions=@var{n}
9000 @opindex falign-functions
9001 Align the start of functions to the next power-of-two greater than
9002 @var{n}, skipping up to @var{n} bytes. For instance,
9003 @option{-falign-functions=32} aligns functions to the next 32-byte
9004 boundary, but @option{-falign-functions=24} aligns to the next
9005 32-byte boundary only if this can be done by skipping 23 bytes or less.
9007 @option{-fno-align-functions} and @option{-falign-functions=1} are
9008 equivalent and mean that functions are not aligned.
9010 Some assemblers only support this flag when @var{n} is a power of two;
9011 in that case, it is rounded up.
9013 If @var{n} is not specified or is zero, use a machine-dependent default.
9015 Enabled at levels @option{-O2}, @option{-O3}.
9017 @item -flimit-function-alignment
9018 If this option is enabled, the compiler tries to avoid unnecessarily
9019 overaligning functions. It attempts to instruct the assembler to align
9020 by the amount specified by @option{-falign-functions}, but not to
9021 skip more bytes than the size of the function.
9023 @item -falign-labels
9024 @itemx -falign-labels=@var{n}
9025 @opindex falign-labels
9026 Align all branch targets to a power-of-two boundary, skipping up to
9027 @var{n} bytes like @option{-falign-functions}. This option can easily
9028 make code slower, because it must insert dummy operations for when the
9029 branch target is reached in the usual flow of the code.
9031 @option{-fno-align-labels} and @option{-falign-labels=1} are
9032 equivalent and mean that labels are not aligned.
9034 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9035 are greater than this value, then their values are used instead.
9037 If @var{n} is not specified or is zero, use a machine-dependent default
9038 which is very likely to be @samp{1}, meaning no alignment.
9040 Enabled at levels @option{-O2}, @option{-O3}.
9043 @itemx -falign-loops=@var{n}
9044 @opindex falign-loops
9045 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
9046 like @option{-falign-functions}. If the loops are
9047 executed many times, this makes up for any execution of the dummy
9050 @option{-fno-align-loops} and @option{-falign-loops=1} are
9051 equivalent and mean that loops are not aligned.
9053 If @var{n} is not specified or is zero, use a machine-dependent default.
9055 Enabled at levels @option{-O2}, @option{-O3}.
9058 @itemx -falign-jumps=@var{n}
9059 @opindex falign-jumps
9060 Align branch targets to a power-of-two boundary, for branch targets
9061 where the targets can only be reached by jumping, skipping up to @var{n}
9062 bytes like @option{-falign-functions}. In this case, no dummy operations
9065 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9066 equivalent and mean that loops are not aligned.
9068 If @var{n} is not specified or is zero, use a machine-dependent default.
9070 Enabled at levels @option{-O2}, @option{-O3}.
9072 @item -funit-at-a-time
9073 @opindex funit-at-a-time
9074 This option is left for compatibility reasons. @option{-funit-at-a-time}
9075 has no effect, while @option{-fno-unit-at-a-time} implies
9076 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9080 @item -fno-toplevel-reorder
9081 @opindex fno-toplevel-reorder
9082 Do not reorder top-level functions, variables, and @code{asm}
9083 statements. Output them in the same order that they appear in the
9084 input file. When this option is used, unreferenced static variables
9085 are not removed. This option is intended to support existing code
9086 that relies on a particular ordering. For new code, it is better to
9087 use attributes when possible.
9089 Enabled at level @option{-O0}. When disabled explicitly, it also implies
9090 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
9095 Constructs webs as commonly used for register allocation purposes and assign
9096 each web individual pseudo register. This allows the register allocation pass
9097 to operate on pseudos directly, but also strengthens several other optimization
9098 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9099 however, make debugging impossible, since variables no longer stay in a
9102 Enabled by default with @option{-funroll-loops}.
9104 @item -fwhole-program
9105 @opindex fwhole-program
9106 Assume that the current compilation unit represents the whole program being
9107 compiled. All public functions and variables with the exception of @code{main}
9108 and those merged by attribute @code{externally_visible} become static functions
9109 and in effect are optimized more aggressively by interprocedural optimizers.
9111 This option should not be used in combination with @option{-flto}.
9112 Instead relying on a linker plugin should provide safer and more precise
9115 @item -flto[=@var{n}]
9117 This option runs the standard link-time optimizer. When invoked
9118 with source code, it generates GIMPLE (one of GCC's internal
9119 representations) and writes it to special ELF sections in the object
9120 file. When the object files are linked together, all the function
9121 bodies are read from these ELF sections and instantiated as if they
9122 had been part of the same translation unit.
9124 To use the link-time optimizer, @option{-flto} and optimization
9125 options should be specified at compile time and during the final link.
9126 It is recommended that you compile all the files participating in the
9127 same link with the same options and also specify those options at
9132 gcc -c -O2 -flto foo.c
9133 gcc -c -O2 -flto bar.c
9134 gcc -o myprog -flto -O2 foo.o bar.o
9137 The first two invocations to GCC save a bytecode representation
9138 of GIMPLE into special ELF sections inside @file{foo.o} and
9139 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9140 @file{foo.o} and @file{bar.o}, merges the two files into a single
9141 internal image, and compiles the result as usual. Since both
9142 @file{foo.o} and @file{bar.o} are merged into a single image, this
9143 causes all the interprocedural analyses and optimizations in GCC to
9144 work across the two files as if they were a single one. This means,
9145 for example, that the inliner is able to inline functions in
9146 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9148 Another (simpler) way to enable link-time optimization is:
9151 gcc -o myprog -flto -O2 foo.c bar.c
9154 The above generates bytecode for @file{foo.c} and @file{bar.c},
9155 merges them together into a single GIMPLE representation and optimizes
9156 them as usual to produce @file{myprog}.
9158 The only important thing to keep in mind is that to enable link-time
9159 optimizations you need to use the GCC driver to perform the link step.
9160 GCC then automatically performs link-time optimization if any of the
9161 objects involved were compiled with the @option{-flto} command-line option.
9163 should specify the optimization options to be used for link-time
9164 optimization though GCC tries to be clever at guessing an
9165 optimization level to use from the options used at compile time
9166 if you fail to specify one at link time. You can always override
9167 the automatic decision to do link-time optimization
9168 by passing @option{-fno-lto} to the link command.
9170 To make whole program optimization effective, it is necessary to make
9171 certain whole program assumptions. The compiler needs to know
9172 what functions and variables can be accessed by libraries and runtime
9173 outside of the link-time optimized unit. When supported by the linker,
9174 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9175 to the compiler about used and externally visible symbols. When
9176 the linker plugin is not available, @option{-fwhole-program} should be
9177 used to allow the compiler to make these assumptions, which leads
9178 to more aggressive optimization decisions.
9180 When @option{-fuse-linker-plugin} is not enabled, when a file is
9181 compiled with @option{-flto}, the generated object file is larger than
9182 a regular object file because it contains GIMPLE bytecodes and the usual
9183 final code (see @option{-ffat-lto-objects}. This means that
9184 object files with LTO information can be linked as normal object
9185 files; if @option{-fno-lto} is passed to the linker, no
9186 interprocedural optimizations are applied. Note that when
9187 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9188 but you cannot perform a regular, non-LTO link on them.
9190 Additionally, the optimization flags used to compile individual files
9191 are not necessarily related to those used at link time. For instance,
9194 gcc -c -O0 -ffat-lto-objects -flto foo.c
9195 gcc -c -O0 -ffat-lto-objects -flto bar.c
9196 gcc -o myprog -O3 foo.o bar.o
9199 This produces individual object files with unoptimized assembler
9200 code, but the resulting binary @file{myprog} is optimized at
9201 @option{-O3}. If, instead, the final binary is generated with
9202 @option{-fno-lto}, then @file{myprog} is not optimized.
9204 When producing the final binary, GCC only
9205 applies link-time optimizations to those files that contain bytecode.
9206 Therefore, you can mix and match object files and libraries with
9207 GIMPLE bytecodes and final object code. GCC automatically selects
9208 which files to optimize in LTO mode and which files to link without
9211 There are some code generation flags preserved by GCC when
9212 generating bytecodes, as they need to be used during the final link
9213 stage. Generally options specified at link time override those
9214 specified at compile time.
9216 If you do not specify an optimization level option @option{-O} at
9217 link time, then GCC uses the highest optimization level
9218 used when compiling the object files.
9220 Currently, the following options and their settings are taken from
9221 the first object file that explicitly specifies them:
9222 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9223 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9224 and all the @option{-m} target flags.
9226 Certain ABI-changing flags are required to match in all compilation units,
9227 and trying to override this at link time with a conflicting value
9228 is ignored. This includes options such as @option{-freg-struct-return}
9229 and @option{-fpcc-struct-return}.
9231 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9232 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9233 are passed through to the link stage and merged conservatively for
9234 conflicting translation units. Specifically
9235 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9236 precedence; and for example @option{-ffp-contract=off} takes precedence
9237 over @option{-ffp-contract=fast}. You can override them at link time.
9239 If LTO encounters objects with C linkage declared with incompatible
9240 types in separate translation units to be linked together (undefined
9241 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9242 issued. The behavior is still undefined at run time. Similar
9243 diagnostics may be raised for other languages.
9245 Another feature of LTO is that it is possible to apply interprocedural
9246 optimizations on files written in different languages:
9251 gfortran -c -flto baz.f90
9252 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9255 Notice that the final link is done with @command{g++} to get the C++
9256 runtime libraries and @option{-lgfortran} is added to get the Fortran
9257 runtime libraries. In general, when mixing languages in LTO mode, you
9258 should use the same link command options as when mixing languages in a
9259 regular (non-LTO) compilation.
9261 If object files containing GIMPLE bytecode are stored in a library archive, say
9262 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9263 are using a linker with plugin support. To create static libraries suitable
9264 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9265 and @command{ranlib};
9266 to show the symbols of object files with GIMPLE bytecode, use
9267 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9268 and @command{nm} have been compiled with plugin support. At link time, use the the
9269 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9270 the LTO optimization process:
9273 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9276 With the linker plugin enabled, the linker extracts the needed
9277 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9278 to make them part of the aggregated GIMPLE image to be optimized.
9280 If you are not using a linker with plugin support and/or do not
9281 enable the linker plugin, then the objects inside @file{libfoo.a}
9282 are extracted and linked as usual, but they do not participate
9283 in the LTO optimization process. In order to make a static library suitable
9284 for both LTO optimization and usual linkage, compile its object files with
9285 @option{-flto} @option{-ffat-lto-objects}.
9287 Link-time optimizations do not require the presence of the whole program to
9288 operate. If the program does not require any symbols to be exported, it is
9289 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9290 the interprocedural optimizers to use more aggressive assumptions which may
9291 lead to improved optimization opportunities.
9292 Use of @option{-fwhole-program} is not needed when linker plugin is
9293 active (see @option{-fuse-linker-plugin}).
9295 The current implementation of LTO makes no
9296 attempt to generate bytecode that is portable between different
9297 types of hosts. The bytecode files are versioned and there is a
9298 strict version check, so bytecode files generated in one version of
9299 GCC do not work with an older or newer version of GCC.
9301 Link-time optimization does not work well with generation of debugging
9302 information. Combining @option{-flto} with
9303 @option{-g} is currently experimental and expected to produce unexpected
9306 If you specify the optional @var{n}, the optimization and code
9307 generation done at link time is executed in parallel using @var{n}
9308 parallel jobs by utilizing an installed @command{make} program. The
9309 environment variable @env{MAKE} may be used to override the program
9310 used. The default value for @var{n} is 1.
9312 You can also specify @option{-flto=jobserver} to use GNU make's
9313 job server mode to determine the number of parallel jobs. This
9314 is useful when the Makefile calling GCC is already executing in parallel.
9315 You must prepend a @samp{+} to the command recipe in the parent Makefile
9316 for this to work. This option likely only works if @env{MAKE} is
9319 @item -flto-partition=@var{alg}
9320 @opindex flto-partition
9321 Specify the partitioning algorithm used by the link-time optimizer.
9322 The value is either @samp{1to1} to specify a partitioning mirroring
9323 the original source files or @samp{balanced} to specify partitioning
9324 into equally sized chunks (whenever possible) or @samp{max} to create
9325 new partition for every symbol where possible. Specifying @samp{none}
9326 as an algorithm disables partitioning and streaming completely.
9327 The default value is @samp{balanced}. While @samp{1to1} can be used
9328 as an workaround for various code ordering issues, the @samp{max}
9329 partitioning is intended for internal testing only.
9330 The value @samp{one} specifies that exactly one partition should be
9331 used while the value @samp{none} bypasses partitioning and executes
9332 the link-time optimization step directly from the WPA phase.
9334 @item -flto-odr-type-merging
9335 @opindex flto-odr-type-merging
9336 Enable streaming of mangled types names of C++ types and their unification
9337 at link time. This increases size of LTO object files, but enables
9338 diagnostics about One Definition Rule violations.
9340 @item -flto-compression-level=@var{n}
9341 @opindex flto-compression-level
9342 This option specifies the level of compression used for intermediate
9343 language written to LTO object files, and is only meaningful in
9344 conjunction with LTO mode (@option{-flto}). Valid
9345 values are 0 (no compression) to 9 (maximum compression). Values
9346 outside this range are clamped to either 0 or 9. If the option is not
9347 given, a default balanced compression setting is used.
9349 @item -fuse-linker-plugin
9350 @opindex fuse-linker-plugin
9351 Enables the use of a linker plugin during link-time optimization. This
9352 option relies on plugin support in the linker, which is available in gold
9353 or in GNU ld 2.21 or newer.
9355 This option enables the extraction of object files with GIMPLE bytecode out
9356 of library archives. This improves the quality of optimization by exposing
9357 more code to the link-time optimizer. This information specifies what
9358 symbols can be accessed externally (by non-LTO object or during dynamic
9359 linking). Resulting code quality improvements on binaries (and shared
9360 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9361 See @option{-flto} for a description of the effect of this flag and how to
9364 This option is enabled by default when LTO support in GCC is enabled
9365 and GCC was configured for use with
9366 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9368 @item -ffat-lto-objects
9369 @opindex ffat-lto-objects
9370 Fat LTO objects are object files that contain both the intermediate language
9371 and the object code. This makes them usable for both LTO linking and normal
9372 linking. This option is effective only when compiling with @option{-flto}
9373 and is ignored at link time.
9375 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9376 requires the complete toolchain to be aware of LTO. It requires a linker with
9377 linker plugin support for basic functionality. Additionally,
9378 @command{nm}, @command{ar} and @command{ranlib}
9379 need to support linker plugins to allow a full-featured build environment
9380 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9381 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9382 to these tools. With non fat LTO makefiles need to be modified to use them.
9384 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9387 @item -fcompare-elim
9388 @opindex fcompare-elim
9389 After register allocation and post-register allocation instruction splitting,
9390 identify arithmetic instructions that compute processor flags similar to a
9391 comparison operation based on that arithmetic. If possible, eliminate the
9392 explicit comparison operation.
9394 This pass only applies to certain targets that cannot explicitly represent
9395 the comparison operation before register allocation is complete.
9397 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9399 @item -fcprop-registers
9400 @opindex fcprop-registers
9401 After register allocation and post-register allocation instruction splitting,
9402 perform a copy-propagation pass to try to reduce scheduling dependencies
9403 and occasionally eliminate the copy.
9405 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9407 @item -fprofile-correction
9408 @opindex fprofile-correction
9409 Profiles collected using an instrumented binary for multi-threaded programs may
9410 be inconsistent due to missed counter updates. When this option is specified,
9411 GCC uses heuristics to correct or smooth out such inconsistencies. By
9412 default, GCC emits an error message when an inconsistent profile is detected.
9415 @itemx -fprofile-use=@var{path}
9416 @opindex fprofile-use
9417 Enable profile feedback-directed optimizations,
9418 and the following optimizations
9419 which are generally profitable only with profile feedback available:
9420 @option{-fbranch-probabilities}, @option{-fvpt},
9421 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9422 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9424 Before you can use this option, you must first generate profiling information.
9425 @xref{Instrumentation Options}, for information about the
9426 @option{-fprofile-generate} option.
9428 By default, GCC emits an error message if the feedback profiles do not
9429 match the source code. This error can be turned into a warning by using
9430 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9433 If @var{path} is specified, GCC looks at the @var{path} to find
9434 the profile feedback data files. See @option{-fprofile-dir}.
9436 @item -fauto-profile
9437 @itemx -fauto-profile=@var{path}
9438 @opindex fauto-profile
9439 Enable sampling-based feedback-directed optimizations,
9440 and the following optimizations
9441 which are generally profitable only with profile feedback available:
9442 @option{-fbranch-probabilities}, @option{-fvpt},
9443 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9444 @option{-ftree-vectorize},
9445 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9446 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9447 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9449 @var{path} is the name of a file containing AutoFDO profile information.
9450 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9452 Producing an AutoFDO profile data file requires running your program
9453 with the @command{perf} utility on a supported GNU/Linux target system.
9454 For more information, see @uref{https://perf.wiki.kernel.org/}.
9458 perf record -e br_inst_retired:near_taken -b -o perf.data \
9462 Then use the @command{create_gcov} tool to convert the raw profile data
9463 to a format that can be used by GCC.@ You must also supply the
9464 unstripped binary for your program to this tool.
9465 See @uref{https://github.com/google/autofdo}.
9469 create_gcov --binary=your_program.unstripped --profile=perf.data \
9474 The following options control compiler behavior regarding floating-point
9475 arithmetic. These options trade off between speed and
9476 correctness. All must be specifically enabled.
9480 @opindex ffloat-store
9481 Do not store floating-point variables in registers, and inhibit other
9482 options that might change whether a floating-point value is taken from a
9485 @cindex floating-point precision
9486 This option prevents undesirable excess precision on machines such as
9487 the 68000 where the floating registers (of the 68881) keep more
9488 precision than a @code{double} is supposed to have. Similarly for the
9489 x86 architecture. For most programs, the excess precision does only
9490 good, but a few programs rely on the precise definition of IEEE floating
9491 point. Use @option{-ffloat-store} for such programs, after modifying
9492 them to store all pertinent intermediate computations into variables.
9494 @item -fexcess-precision=@var{style}
9495 @opindex fexcess-precision
9496 This option allows further control over excess precision on machines
9497 where floating-point operations occur in a format with more precision or
9498 range than the IEEE standard and interchange floating-point types. By
9499 default, @option{-fexcess-precision=fast} is in effect; this means that
9500 operations may be carried out in a wider precision than the types specified
9501 in the source if that would result in faster code, and it is unpredictable
9502 when rounding to the types specified in the source code takes place.
9503 When compiling C, if @option{-fexcess-precision=standard} is specified then
9504 excess precision follows the rules specified in ISO C99; in particular,
9505 both casts and assignments cause values to be rounded to their
9506 semantic types (whereas @option{-ffloat-store} only affects
9507 assignments). This option is enabled by default for C if a strict
9508 conformance option such as @option{-std=c99} is used.
9509 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
9510 regardless of whether a strict conformance option is used.
9513 @option{-fexcess-precision=standard} is not implemented for languages
9514 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
9515 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9516 semantics apply without excess precision, and in the latter, rounding
9521 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9522 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9523 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
9524 @option{-fexcess-precision=fast}.
9526 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9528 This option is not turned on by any @option{-O} option besides
9529 @option{-Ofast} since it can result in incorrect output for programs
9530 that depend on an exact implementation of IEEE or ISO rules/specifications
9531 for math functions. It may, however, yield faster code for programs
9532 that do not require the guarantees of these specifications.
9534 @item -fno-math-errno
9535 @opindex fno-math-errno
9536 Do not set @code{errno} after calling math functions that are executed
9537 with a single instruction, e.g., @code{sqrt}. A program that relies on
9538 IEEE exceptions for math error handling may want to use this flag
9539 for speed while maintaining IEEE arithmetic compatibility.
9541 This option is not turned on by any @option{-O} option since
9542 it can result in incorrect output for programs that depend on
9543 an exact implementation of IEEE or ISO rules/specifications for
9544 math functions. It may, however, yield faster code for programs
9545 that do not require the guarantees of these specifications.
9547 The default is @option{-fmath-errno}.
9549 On Darwin systems, the math library never sets @code{errno}. There is
9550 therefore no reason for the compiler to consider the possibility that
9551 it might, and @option{-fno-math-errno} is the default.
9553 @item -funsafe-math-optimizations
9554 @opindex funsafe-math-optimizations
9556 Allow optimizations for floating-point arithmetic that (a) assume
9557 that arguments and results are valid and (b) may violate IEEE or
9558 ANSI standards. When used at link time, it may include libraries
9559 or startup files that change the default FPU control word or other
9560 similar optimizations.
9562 This option is not turned on by any @option{-O} option since
9563 it can result in incorrect output for programs that depend on
9564 an exact implementation of IEEE or ISO rules/specifications for
9565 math functions. It may, however, yield faster code for programs
9566 that do not require the guarantees of these specifications.
9567 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9568 @option{-fassociative-math} and @option{-freciprocal-math}.
9570 The default is @option{-fno-unsafe-math-optimizations}.
9572 @item -fassociative-math
9573 @opindex fassociative-math
9575 Allow re-association of operands in series of floating-point operations.
9576 This violates the ISO C and C++ language standard by possibly changing
9577 computation result. NOTE: re-ordering may change the sign of zero as
9578 well as ignore NaNs and inhibit or create underflow or overflow (and
9579 thus cannot be used on code that relies on rounding behavior like
9580 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9581 and thus may not be used when ordered comparisons are required.
9582 This option requires that both @option{-fno-signed-zeros} and
9583 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9584 much sense with @option{-frounding-math}. For Fortran the option
9585 is automatically enabled when both @option{-fno-signed-zeros} and
9586 @option{-fno-trapping-math} are in effect.
9588 The default is @option{-fno-associative-math}.
9590 @item -freciprocal-math
9591 @opindex freciprocal-math
9593 Allow the reciprocal of a value to be used instead of dividing by
9594 the value if this enables optimizations. For example @code{x / y}
9595 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9596 is subject to common subexpression elimination. Note that this loses
9597 precision and increases the number of flops operating on the value.
9599 The default is @option{-fno-reciprocal-math}.
9601 @item -ffinite-math-only
9602 @opindex ffinite-math-only
9603 Allow optimizations for floating-point arithmetic that assume
9604 that arguments and results are not NaNs or +-Infs.
9606 This option is not turned on by any @option{-O} option since
9607 it can result in incorrect output for programs that depend on
9608 an exact implementation of IEEE or ISO rules/specifications for
9609 math functions. It may, however, yield faster code for programs
9610 that do not require the guarantees of these specifications.
9612 The default is @option{-fno-finite-math-only}.
9614 @item -fno-signed-zeros
9615 @opindex fno-signed-zeros
9616 Allow optimizations for floating-point arithmetic that ignore the
9617 signedness of zero. IEEE arithmetic specifies the behavior of
9618 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9619 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9620 This option implies that the sign of a zero result isn't significant.
9622 The default is @option{-fsigned-zeros}.
9624 @item -fno-trapping-math
9625 @opindex fno-trapping-math
9626 Compile code assuming that floating-point operations cannot generate
9627 user-visible traps. These traps include division by zero, overflow,
9628 underflow, inexact result and invalid operation. This option requires
9629 that @option{-fno-signaling-nans} be in effect. Setting this option may
9630 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9632 This option should never be turned on by any @option{-O} option since
9633 it can result in incorrect output for programs that depend on
9634 an exact implementation of IEEE or ISO rules/specifications for
9637 The default is @option{-ftrapping-math}.
9639 @item -frounding-math
9640 @opindex frounding-math
9641 Disable transformations and optimizations that assume default floating-point
9642 rounding behavior. This is round-to-zero for all floating point
9643 to integer conversions, and round-to-nearest for all other arithmetic
9644 truncations. This option should be specified for programs that change
9645 the FP rounding mode dynamically, or that may be executed with a
9646 non-default rounding mode. This option disables constant folding of
9647 floating-point expressions at compile time (which may be affected by
9648 rounding mode) and arithmetic transformations that are unsafe in the
9649 presence of sign-dependent rounding modes.
9651 The default is @option{-fno-rounding-math}.
9653 This option is experimental and does not currently guarantee to
9654 disable all GCC optimizations that are affected by rounding mode.
9655 Future versions of GCC may provide finer control of this setting
9656 using C99's @code{FENV_ACCESS} pragma. This command-line option
9657 will be used to specify the default state for @code{FENV_ACCESS}.
9659 @item -fsignaling-nans
9660 @opindex fsignaling-nans
9661 Compile code assuming that IEEE signaling NaNs may generate user-visible
9662 traps during floating-point operations. Setting this option disables
9663 optimizations that may change the number of exceptions visible with
9664 signaling NaNs. This option implies @option{-ftrapping-math}.
9666 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9669 The default is @option{-fno-signaling-nans}.
9671 This option is experimental and does not currently guarantee to
9672 disable all GCC optimizations that affect signaling NaN behavior.
9674 @item -fno-fp-int-builtin-inexact
9675 @opindex fno-fp-int-builtin-inexact
9676 Do not allow the built-in functions @code{ceil}, @code{floor},
9677 @code{round} and @code{trunc}, and their @code{float} and @code{long
9678 double} variants, to generate code that raises the ``inexact''
9679 floating-point exception for noninteger arguments. ISO C99 and C11
9680 allow these functions to raise the ``inexact'' exception, but ISO/IEC
9681 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
9684 The default is @option{-ffp-int-builtin-inexact}, allowing the
9685 exception to be raised. This option does nothing unless
9686 @option{-ftrapping-math} is in effect.
9688 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
9689 generate a call to a library function then the ``inexact'' exception
9690 may be raised if the library implementation does not follow TS 18661.
9692 @item -fsingle-precision-constant
9693 @opindex fsingle-precision-constant
9694 Treat floating-point constants as single precision instead of
9695 implicitly converting them to double-precision constants.
9697 @item -fcx-limited-range
9698 @opindex fcx-limited-range
9699 When enabled, this option states that a range reduction step is not
9700 needed when performing complex division. Also, there is no checking
9701 whether the result of a complex multiplication or division is @code{NaN
9702 + I*NaN}, with an attempt to rescue the situation in that case. The
9703 default is @option{-fno-cx-limited-range}, but is enabled by
9704 @option{-ffast-math}.
9706 This option controls the default setting of the ISO C99
9707 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9710 @item -fcx-fortran-rules
9711 @opindex fcx-fortran-rules
9712 Complex multiplication and division follow Fortran rules. Range
9713 reduction is done as part of complex division, but there is no checking
9714 whether the result of a complex multiplication or division is @code{NaN
9715 + I*NaN}, with an attempt to rescue the situation in that case.
9717 The default is @option{-fno-cx-fortran-rules}.
9721 The following options control optimizations that may improve
9722 performance, but are not enabled by any @option{-O} options. This
9723 section includes experimental options that may produce broken code.
9726 @item -fbranch-probabilities
9727 @opindex fbranch-probabilities
9728 After running a program compiled with @option{-fprofile-arcs}
9729 (@pxref{Instrumentation Options}),
9730 you can compile it a second time using
9731 @option{-fbranch-probabilities}, to improve optimizations based on
9732 the number of times each branch was taken. When a program
9733 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9734 counts to a file called @file{@var{sourcename}.gcda} for each source
9735 file. The information in this data file is very dependent on the
9736 structure of the generated code, so you must use the same source code
9737 and the same optimization options for both compilations.
9739 With @option{-fbranch-probabilities}, GCC puts a
9740 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9741 These can be used to improve optimization. Currently, they are only
9742 used in one place: in @file{reorg.c}, instead of guessing which path a
9743 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9744 exactly determine which path is taken more often.
9746 @item -fprofile-values
9747 @opindex fprofile-values
9748 If combined with @option{-fprofile-arcs}, it adds code so that some
9749 data about values of expressions in the program is gathered.
9751 With @option{-fbranch-probabilities}, it reads back the data gathered
9752 from profiling values of expressions for usage in optimizations.
9754 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9756 @item -fprofile-reorder-functions
9757 @opindex fprofile-reorder-functions
9758 Function reordering based on profile instrumentation collects
9759 first time of execution of a function and orders these functions
9762 Enabled with @option{-fprofile-use}.
9766 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9767 to add code to gather information about values of expressions.
9769 With @option{-fbranch-probabilities}, it reads back the data gathered
9770 and actually performs the optimizations based on them.
9771 Currently the optimizations include specialization of division operations
9772 using the knowledge about the value of the denominator.
9774 @item -frename-registers
9775 @opindex frename-registers
9776 Attempt to avoid false dependencies in scheduled code by making use
9777 of registers left over after register allocation. This optimization
9778 most benefits processors with lots of registers. Depending on the
9779 debug information format adopted by the target, however, it can
9780 make debugging impossible, since variables no longer stay in
9781 a ``home register''.
9783 Enabled by default with @option{-funroll-loops}.
9785 @item -fschedule-fusion
9786 @opindex fschedule-fusion
9787 Performs a target dependent pass over the instruction stream to schedule
9788 instructions of same type together because target machine can execute them
9789 more efficiently if they are adjacent to each other in the instruction flow.
9791 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9795 Perform tail duplication to enlarge superblock size. This transformation
9796 simplifies the control flow of the function allowing other optimizations to do
9799 Enabled with @option{-fprofile-use}.
9801 @item -funroll-loops
9802 @opindex funroll-loops
9803 Unroll loops whose number of iterations can be determined at compile time or
9804 upon entry to the loop. @option{-funroll-loops} implies
9805 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9806 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9807 a small constant number of iterations). This option makes code larger, and may
9808 or may not make it run faster.
9810 Enabled with @option{-fprofile-use}.
9812 @item -funroll-all-loops
9813 @opindex funroll-all-loops
9814 Unroll all loops, even if their number of iterations is uncertain when
9815 the loop is entered. This usually makes programs run more slowly.
9816 @option{-funroll-all-loops} implies the same options as
9817 @option{-funroll-loops}.
9820 @opindex fpeel-loops
9821 Peels loops for which there is enough information that they do not
9822 roll much (from profile feedback or static analysis). It also turns on
9823 complete loop peeling (i.e.@: complete removal of loops with small constant
9824 number of iterations).
9826 Enabled with @option{-O3} and/or @option{-fprofile-use}.
9828 @item -fmove-loop-invariants
9829 @opindex fmove-loop-invariants
9830 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
9831 at level @option{-O1}
9834 @opindex fsplit-loops
9835 Split a loop into two if it contains a condition that's always true
9836 for one side of the iteration space and false for the other.
9838 @item -funswitch-loops
9839 @opindex funswitch-loops
9840 Move branches with loop invariant conditions out of the loop, with duplicates
9841 of the loop on both branches (modified according to result of the condition).
9843 @item -floop-unroll-and-jam
9844 @opindex floop-unroll-and-jam
9845 Apply unroll and jam transformations on feasible loops. In a loop
9846 nest this unrolls the outer loop by some factor and fuses the resulting
9847 multiple inner loops.
9849 @item -ffunction-sections
9850 @itemx -fdata-sections
9851 @opindex ffunction-sections
9852 @opindex fdata-sections
9853 Place each function or data item into its own section in the output
9854 file if the target supports arbitrary sections. The name of the
9855 function or the name of the data item determines the section's name
9858 Use these options on systems where the linker can perform optimizations to
9859 improve locality of reference in the instruction space. Most systems using the
9860 ELF object format have linkers with such optimizations. On AIX, the linker
9861 rearranges sections (CSECTs) based on the call graph. The performance impact
9864 Together with a linker garbage collection (linker @option{--gc-sections}
9865 option) these options may lead to smaller statically-linked executables (after
9868 On ELF/DWARF systems these options do not degenerate the quality of the debug
9869 information. There could be issues with other object files/debug info formats.
9871 Only use these options when there are significant benefits from doing so. When
9872 you specify these options, the assembler and linker create larger object and
9873 executable files and are also slower. These options affect code generation.
9874 They prevent optimizations by the compiler and assembler using relative
9875 locations inside a translation unit since the locations are unknown until
9876 link time. An example of such an optimization is relaxing calls to short call
9879 @item -fbranch-target-load-optimize
9880 @opindex fbranch-target-load-optimize
9881 Perform branch target register load optimization before prologue / epilogue
9883 The use of target registers can typically be exposed only during reload,
9884 thus hoisting loads out of loops and doing inter-block scheduling needs
9885 a separate optimization pass.
9887 @item -fbranch-target-load-optimize2
9888 @opindex fbranch-target-load-optimize2
9889 Perform branch target register load optimization after prologue / epilogue
9892 @item -fbtr-bb-exclusive
9893 @opindex fbtr-bb-exclusive
9894 When performing branch target register load optimization, don't reuse
9895 branch target registers within any basic block.
9898 @opindex fstdarg-opt
9899 Optimize the prologue of variadic argument functions with respect to usage of
9902 @item -fsection-anchors
9903 @opindex fsection-anchors
9904 Try to reduce the number of symbolic address calculations by using
9905 shared ``anchor'' symbols to address nearby objects. This transformation
9906 can help to reduce the number of GOT entries and GOT accesses on some
9909 For example, the implementation of the following function @code{foo}:
9913 int foo (void) @{ return a + b + c; @}
9917 usually calculates the addresses of all three variables, but if you
9918 compile it with @option{-fsection-anchors}, it accesses the variables
9919 from a common anchor point instead. The effect is similar to the
9920 following pseudocode (which isn't valid C):
9925 register int *xr = &x;
9926 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9930 Not all targets support this option.
9932 @item --param @var{name}=@var{value}
9934 In some places, GCC uses various constants to control the amount of
9935 optimization that is done. For example, GCC does not inline functions
9936 that contain more than a certain number of instructions. You can
9937 control some of these constants on the command line using the
9938 @option{--param} option.
9940 The names of specific parameters, and the meaning of the values, are
9941 tied to the internals of the compiler, and are subject to change
9942 without notice in future releases.
9944 In each case, the @var{value} is an integer. The allowable choices for
9948 @item predictable-branch-outcome
9949 When branch is predicted to be taken with probability lower than this threshold
9950 (in percent), then it is considered well predictable. The default is 10.
9952 @item max-rtl-if-conversion-insns
9953 RTL if-conversion tries to remove conditional branches around a block and
9954 replace them with conditionally executed instructions. This parameter
9955 gives the maximum number of instructions in a block which should be
9956 considered for if-conversion. The default is 10, though the compiler will
9957 also use other heuristics to decide whether if-conversion is likely to be
9960 @item max-rtl-if-conversion-predictable-cost
9961 @item max-rtl-if-conversion-unpredictable-cost
9962 RTL if-conversion will try to remove conditional branches around a block
9963 and replace them with conditionally executed instructions. These parameters
9964 give the maximum permissible cost for the sequence that would be generated
9965 by if-conversion depending on whether the branch is statically determined
9966 to be predictable or not. The units for this parameter are the same as
9967 those for the GCC internal seq_cost metric. The compiler will try to
9968 provide a reasonable default for this parameter using the BRANCH_COST
9971 @item max-crossjump-edges
9972 The maximum number of incoming edges to consider for cross-jumping.
9973 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
9974 the number of edges incoming to each block. Increasing values mean
9975 more aggressive optimization, making the compilation time increase with
9976 probably small improvement in executable size.
9978 @item min-crossjump-insns
9979 The minimum number of instructions that must be matched at the end
9980 of two blocks before cross-jumping is performed on them. This
9981 value is ignored in the case where all instructions in the block being
9982 cross-jumped from are matched. The default value is 5.
9984 @item max-grow-copy-bb-insns
9985 The maximum code size expansion factor when copying basic blocks
9986 instead of jumping. The expansion is relative to a jump instruction.
9987 The default value is 8.
9989 @item max-goto-duplication-insns
9990 The maximum number of instructions to duplicate to a block that jumps
9991 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
9992 passes, GCC factors computed gotos early in the compilation process,
9993 and unfactors them as late as possible. Only computed jumps at the
9994 end of a basic blocks with no more than max-goto-duplication-insns are
9995 unfactored. The default value is 8.
9997 @item max-delay-slot-insn-search
9998 The maximum number of instructions to consider when looking for an
9999 instruction to fill a delay slot. If more than this arbitrary number of
10000 instructions are searched, the time savings from filling the delay slot
10001 are minimal, so stop searching. Increasing values mean more
10002 aggressive optimization, making the compilation time increase with probably
10003 small improvement in execution time.
10005 @item max-delay-slot-live-search
10006 When trying to fill delay slots, the maximum number of instructions to
10007 consider when searching for a block with valid live register
10008 information. Increasing this arbitrarily chosen value means more
10009 aggressive optimization, increasing the compilation time. This parameter
10010 should be removed when the delay slot code is rewritten to maintain the
10011 control-flow graph.
10013 @item max-gcse-memory
10014 The approximate maximum amount of memory that can be allocated in
10015 order to perform the global common subexpression elimination
10016 optimization. If more memory than specified is required, the
10017 optimization is not done.
10019 @item max-gcse-insertion-ratio
10020 If the ratio of expression insertions to deletions is larger than this value
10021 for any expression, then RTL PRE inserts or removes the expression and thus
10022 leaves partially redundant computations in the instruction stream. The default value is 20.
10024 @item max-pending-list-length
10025 The maximum number of pending dependencies scheduling allows
10026 before flushing the current state and starting over. Large functions
10027 with few branches or calls can create excessively large lists which
10028 needlessly consume memory and resources.
10030 @item max-modulo-backtrack-attempts
10031 The maximum number of backtrack attempts the scheduler should make
10032 when modulo scheduling a loop. Larger values can exponentially increase
10035 @item max-inline-insns-single
10036 Several parameters control the tree inliner used in GCC@.
10037 This number sets the maximum number of instructions (counted in GCC's
10038 internal representation) in a single function that the tree inliner
10039 considers for inlining. This only affects functions declared
10040 inline and methods implemented in a class declaration (C++).
10041 The default value is 400.
10043 @item max-inline-insns-auto
10044 When you use @option{-finline-functions} (included in @option{-O3}),
10045 a lot of functions that would otherwise not be considered for inlining
10046 by the compiler are investigated. To those functions, a different
10047 (more restrictive) limit compared to functions declared inline can
10049 The default value is 40.
10051 @item inline-min-speedup
10052 When estimated performance improvement of caller + callee runtime exceeds this
10053 threshold (in percent), the function can be inlined regardless of the limit on
10054 @option{--param max-inline-insns-single} and @option{--param
10055 max-inline-insns-auto}.
10057 @item large-function-insns
10058 The limit specifying really large functions. For functions larger than this
10059 limit after inlining, inlining is constrained by
10060 @option{--param large-function-growth}. This parameter is useful primarily
10061 to avoid extreme compilation time caused by non-linear algorithms used by the
10063 The default value is 2700.
10065 @item large-function-growth
10066 Specifies maximal growth of large function caused by inlining in percents.
10067 The default value is 100 which limits large function growth to 2.0 times
10070 @item large-unit-insns
10071 The limit specifying large translation unit. Growth caused by inlining of
10072 units larger than this limit is limited by @option{--param inline-unit-growth}.
10073 For small units this might be too tight.
10074 For example, consider a unit consisting of function A
10075 that is inline and B that just calls A three times. If B is small relative to
10076 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10077 large units consisting of small inlineable functions, however, the overall unit
10078 growth limit is needed to avoid exponential explosion of code size. Thus for
10079 smaller units, the size is increased to @option{--param large-unit-insns}
10080 before applying @option{--param inline-unit-growth}. The default is 10000.
10082 @item inline-unit-growth
10083 Specifies maximal overall growth of the compilation unit caused by inlining.
10084 The default value is 20 which limits unit growth to 1.2 times the original
10085 size. Cold functions (either marked cold via an attribute or by profile
10086 feedback) are not accounted into the unit size.
10088 @item ipcp-unit-growth
10089 Specifies maximal overall growth of the compilation unit caused by
10090 interprocedural constant propagation. The default value is 10 which limits
10091 unit growth to 1.1 times the original size.
10093 @item large-stack-frame
10094 The limit specifying large stack frames. While inlining the algorithm is trying
10095 to not grow past this limit too much. The default value is 256 bytes.
10097 @item large-stack-frame-growth
10098 Specifies maximal growth of large stack frames caused by inlining in percents.
10099 The default value is 1000 which limits large stack frame growth to 11 times
10102 @item max-inline-insns-recursive
10103 @itemx max-inline-insns-recursive-auto
10104 Specifies the maximum number of instructions an out-of-line copy of a
10105 self-recursive inline
10106 function can grow into by performing recursive inlining.
10108 @option{--param max-inline-insns-recursive} applies to functions
10110 For functions not declared inline, recursive inlining
10111 happens only when @option{-finline-functions} (included in @option{-O3}) is
10112 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
10113 default value is 450.
10115 @item max-inline-recursive-depth
10116 @itemx max-inline-recursive-depth-auto
10117 Specifies the maximum recursion depth used for recursive inlining.
10119 @option{--param max-inline-recursive-depth} applies to functions
10120 declared inline. For functions not declared inline, recursive inlining
10121 happens only when @option{-finline-functions} (included in @option{-O3}) is
10122 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
10123 default value is 8.
10125 @item min-inline-recursive-probability
10126 Recursive inlining is profitable only for function having deep recursion
10127 in average and can hurt for function having little recursion depth by
10128 increasing the prologue size or complexity of function body to other
10131 When profile feedback is available (see @option{-fprofile-generate}) the actual
10132 recursion depth can be guessed from the probability that function recurses
10133 via a given call expression. This parameter limits inlining only to call
10134 expressions whose probability exceeds the given threshold (in percents).
10135 The default value is 10.
10137 @item early-inlining-insns
10138 Specify growth that the early inliner can make. In effect it increases
10139 the amount of inlining for code having a large abstraction penalty.
10140 The default value is 14.
10142 @item max-early-inliner-iterations
10143 Limit of iterations of the early inliner. This basically bounds
10144 the number of nested indirect calls the early inliner can resolve.
10145 Deeper chains are still handled by late inlining.
10147 @item comdat-sharing-probability
10148 Probability (in percent) that C++ inline function with comdat visibility
10149 are shared across multiple compilation units. The default value is 20.
10151 @item profile-func-internal-id
10152 A parameter to control whether to use function internal id in profile
10153 database lookup. If the value is 0, the compiler uses an id that
10154 is based on function assembler name and filename, which makes old profile
10155 data more tolerant to source changes such as function reordering etc.
10156 The default value is 0.
10158 @item min-vect-loop-bound
10159 The minimum number of iterations under which loops are not vectorized
10160 when @option{-ftree-vectorize} is used. The number of iterations after
10161 vectorization needs to be greater than the value specified by this option
10162 to allow vectorization. The default value is 0.
10164 @item gcse-cost-distance-ratio
10165 Scaling factor in calculation of maximum distance an expression
10166 can be moved by GCSE optimizations. This is currently supported only in the
10167 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10168 is with simple expressions, i.e., the expressions that have cost
10169 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10170 hoisting of simple expressions. The default value is 10.
10172 @item gcse-unrestricted-cost
10173 Cost, roughly measured as the cost of a single typical machine
10174 instruction, at which GCSE optimizations do not constrain
10175 the distance an expression can travel. This is currently
10176 supported only in the code hoisting pass. The lesser the cost,
10177 the more aggressive code hoisting is. Specifying 0
10178 allows all expressions to travel unrestricted distances.
10179 The default value is 3.
10181 @item max-hoist-depth
10182 The depth of search in the dominator tree for expressions to hoist.
10183 This is used to avoid quadratic behavior in hoisting algorithm.
10184 The value of 0 does not limit on the search, but may slow down compilation
10185 of huge functions. The default value is 30.
10187 @item max-tail-merge-comparisons
10188 The maximum amount of similar bbs to compare a bb with. This is used to
10189 avoid quadratic behavior in tree tail merging. The default value is 10.
10191 @item max-tail-merge-iterations
10192 The maximum amount of iterations of the pass over the function. This is used to
10193 limit compilation time in tree tail merging. The default value is 2.
10195 @item store-merging-allow-unaligned
10196 Allow the store merging pass to introduce unaligned stores if it is legal to
10197 do so. The default value is 1.
10199 @item max-stores-to-merge
10200 The maximum number of stores to attempt to merge into wider stores in the store
10201 merging pass. The minimum value is 2 and the default is 64.
10203 @item max-unrolled-insns
10204 The maximum number of instructions that a loop may have to be unrolled.
10205 If a loop is unrolled, this parameter also determines how many times
10206 the loop code is unrolled.
10208 @item max-average-unrolled-insns
10209 The maximum number of instructions biased by probabilities of their execution
10210 that a loop may have to be unrolled. If a loop is unrolled,
10211 this parameter also determines how many times the loop code is unrolled.
10213 @item max-unroll-times
10214 The maximum number of unrollings of a single loop.
10216 @item max-peeled-insns
10217 The maximum number of instructions that a loop may have to be peeled.
10218 If a loop is peeled, this parameter also determines how many times
10219 the loop code is peeled.
10221 @item max-peel-times
10222 The maximum number of peelings of a single loop.
10224 @item max-peel-branches
10225 The maximum number of branches on the hot path through the peeled sequence.
10227 @item max-completely-peeled-insns
10228 The maximum number of insns of a completely peeled loop.
10230 @item max-completely-peel-times
10231 The maximum number of iterations of a loop to be suitable for complete peeling.
10233 @item max-completely-peel-loop-nest-depth
10234 The maximum depth of a loop nest suitable for complete peeling.
10236 @item max-unswitch-insns
10237 The maximum number of insns of an unswitched loop.
10239 @item max-unswitch-level
10240 The maximum number of branches unswitched in a single loop.
10242 @item max-loop-headers-insns
10243 The maximum number of insns in loop header duplicated by the copy loop headers
10246 @item lim-expensive
10247 The minimum cost of an expensive expression in the loop invariant motion.
10249 @item iv-consider-all-candidates-bound
10250 Bound on number of candidates for induction variables, below which
10251 all candidates are considered for each use in induction variable
10252 optimizations. If there are more candidates than this,
10253 only the most relevant ones are considered to avoid quadratic time complexity.
10255 @item iv-max-considered-uses
10256 The induction variable optimizations give up on loops that contain more
10257 induction variable uses.
10259 @item iv-always-prune-cand-set-bound
10260 If the number of candidates in the set is smaller than this value,
10261 always try to remove unnecessary ivs from the set
10262 when adding a new one.
10264 @item avg-loop-niter
10265 Average number of iterations of a loop.
10267 @item dse-max-object-size
10268 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10269 Larger values may result in larger compilation times.
10271 @item scev-max-expr-size
10272 Bound on size of expressions used in the scalar evolutions analyzer.
10273 Large expressions slow the analyzer.
10275 @item scev-max-expr-complexity
10276 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10277 Complex expressions slow the analyzer.
10279 @item max-tree-if-conversion-phi-args
10280 Maximum number of arguments in a PHI supported by TREE if conversion
10281 unless the loop is marked with simd pragma.
10283 @item vect-max-version-for-alignment-checks
10284 The maximum number of run-time checks that can be performed when
10285 doing loop versioning for alignment in the vectorizer.
10287 @item vect-max-version-for-alias-checks
10288 The maximum number of run-time checks that can be performed when
10289 doing loop versioning for alias in the vectorizer.
10291 @item vect-max-peeling-for-alignment
10292 The maximum number of loop peels to enhance access alignment
10293 for vectorizer. Value -1 means no limit.
10295 @item max-iterations-to-track
10296 The maximum number of iterations of a loop the brute-force algorithm
10297 for analysis of the number of iterations of the loop tries to evaluate.
10299 @item hot-bb-count-ws-permille
10300 A basic block profile count is considered hot if it contributes to
10301 the given permillage (i.e. 0...1000) of the entire profiled execution.
10303 @item hot-bb-frequency-fraction
10304 Select fraction of the entry block frequency of executions of basic block in
10305 function given basic block needs to have to be considered hot.
10307 @item max-predicted-iterations
10308 The maximum number of loop iterations we predict statically. This is useful
10309 in cases where a function contains a single loop with known bound and
10310 another loop with unknown bound.
10311 The known number of iterations is predicted correctly, while
10312 the unknown number of iterations average to roughly 10. This means that the
10313 loop without bounds appears artificially cold relative to the other one.
10315 @item builtin-expect-probability
10316 Control the probability of the expression having the specified value. This
10317 parameter takes a percentage (i.e. 0 ... 100) as input.
10318 The default probability of 90 is obtained empirically.
10320 @item align-threshold
10322 Select fraction of the maximal frequency of executions of a basic block in
10323 a function to align the basic block.
10325 @item align-loop-iterations
10327 A loop expected to iterate at least the selected number of iterations is
10330 @item tracer-dynamic-coverage
10331 @itemx tracer-dynamic-coverage-feedback
10333 This value is used to limit superblock formation once the given percentage of
10334 executed instructions is covered. This limits unnecessary code size
10337 The @option{tracer-dynamic-coverage-feedback} parameter
10338 is used only when profile
10339 feedback is available. The real profiles (as opposed to statically estimated
10340 ones) are much less balanced allowing the threshold to be larger value.
10342 @item tracer-max-code-growth
10343 Stop tail duplication once code growth has reached given percentage. This is
10344 a rather artificial limit, as most of the duplicates are eliminated later in
10345 cross jumping, so it may be set to much higher values than is the desired code
10348 @item tracer-min-branch-ratio
10350 Stop reverse growth when the reverse probability of best edge is less than this
10351 threshold (in percent).
10353 @item tracer-min-branch-probability
10354 @itemx tracer-min-branch-probability-feedback
10356 Stop forward growth if the best edge has probability lower than this
10359 Similarly to @option{tracer-dynamic-coverage} two parameters are
10360 provided. @option{tracer-min-branch-probability-feedback} is used for
10361 compilation with profile feedback and @option{tracer-min-branch-probability}
10362 compilation without. The value for compilation with profile feedback
10363 needs to be more conservative (higher) in order to make tracer
10366 @item stack-clash-protection-guard-size
10367 Specify the size of the operating system provided stack guard as
10368 2 raised to @var{num} bytes. The default value is 12 (4096 bytes).
10369 Acceptable values are between 12 and 30. Higher values may reduce the
10370 number of explicit probes, but a value larger than the operating system
10371 provided guard will leave code vulnerable to stack clash style attacks.
10373 @item stack-clash-protection-probe-interval
10374 Stack clash protection involves probing stack space as it is allocated. This
10375 param controls the maximum distance between probes into the stack as 2 raised
10376 to @var{num} bytes. Acceptable values are between 10 and 16 and defaults to
10377 12. Higher values may reduce the number of explicit probes, but a value
10378 larger than the operating system provided guard will leave code vulnerable to
10379 stack clash style attacks.
10381 @item max-cse-path-length
10383 The maximum number of basic blocks on path that CSE considers.
10386 @item max-cse-insns
10387 The maximum number of instructions CSE processes before flushing.
10388 The default is 1000.
10390 @item ggc-min-expand
10392 GCC uses a garbage collector to manage its own memory allocation. This
10393 parameter specifies the minimum percentage by which the garbage
10394 collector's heap should be allowed to expand between collections.
10395 Tuning this may improve compilation speed; it has no effect on code
10398 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10399 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10400 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10401 GCC is not able to calculate RAM on a particular platform, the lower
10402 bound of 30% is used. Setting this parameter and
10403 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10404 every opportunity. This is extremely slow, but can be useful for
10407 @item ggc-min-heapsize
10409 Minimum size of the garbage collector's heap before it begins bothering
10410 to collect garbage. The first collection occurs after the heap expands
10411 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10412 tuning this may improve compilation speed, and has no effect on code
10415 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10416 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10417 with a lower bound of 4096 (four megabytes) and an upper bound of
10418 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10419 particular platform, the lower bound is used. Setting this parameter
10420 very large effectively disables garbage collection. Setting this
10421 parameter and @option{ggc-min-expand} to zero causes a full collection
10422 to occur at every opportunity.
10424 @item max-reload-search-insns
10425 The maximum number of instruction reload should look backward for equivalent
10426 register. Increasing values mean more aggressive optimization, making the
10427 compilation time increase with probably slightly better performance.
10428 The default value is 100.
10430 @item max-cselib-memory-locations
10431 The maximum number of memory locations cselib should take into account.
10432 Increasing values mean more aggressive optimization, making the compilation time
10433 increase with probably slightly better performance. The default value is 500.
10435 @item max-sched-ready-insns
10436 The maximum number of instructions ready to be issued the scheduler should
10437 consider at any given time during the first scheduling pass. Increasing
10438 values mean more thorough searches, making the compilation time increase
10439 with probably little benefit. The default value is 100.
10441 @item max-sched-region-blocks
10442 The maximum number of blocks in a region to be considered for
10443 interblock scheduling. The default value is 10.
10445 @item max-pipeline-region-blocks
10446 The maximum number of blocks in a region to be considered for
10447 pipelining in the selective scheduler. The default value is 15.
10449 @item max-sched-region-insns
10450 The maximum number of insns in a region to be considered for
10451 interblock scheduling. The default value is 100.
10453 @item max-pipeline-region-insns
10454 The maximum number of insns in a region to be considered for
10455 pipelining in the selective scheduler. The default value is 200.
10457 @item min-spec-prob
10458 The minimum probability (in percents) of reaching a source block
10459 for interblock speculative scheduling. The default value is 40.
10461 @item max-sched-extend-regions-iters
10462 The maximum number of iterations through CFG to extend regions.
10463 A value of 0 (the default) disables region extensions.
10465 @item max-sched-insn-conflict-delay
10466 The maximum conflict delay for an insn to be considered for speculative motion.
10467 The default value is 3.
10469 @item sched-spec-prob-cutoff
10470 The minimal probability of speculation success (in percents), so that
10471 speculative insns are scheduled.
10472 The default value is 40.
10474 @item sched-state-edge-prob-cutoff
10475 The minimum probability an edge must have for the scheduler to save its
10477 The default value is 10.
10479 @item sched-mem-true-dep-cost
10480 Minimal distance (in CPU cycles) between store and load targeting same
10481 memory locations. The default value is 1.
10483 @item selsched-max-lookahead
10484 The maximum size of the lookahead window of selective scheduling. It is a
10485 depth of search for available instructions.
10486 The default value is 50.
10488 @item selsched-max-sched-times
10489 The maximum number of times that an instruction is scheduled during
10490 selective scheduling. This is the limit on the number of iterations
10491 through which the instruction may be pipelined. The default value is 2.
10493 @item selsched-insns-to-rename
10494 The maximum number of best instructions in the ready list that are considered
10495 for renaming in the selective scheduler. The default value is 2.
10498 The minimum value of stage count that swing modulo scheduler
10499 generates. The default value is 2.
10501 @item max-last-value-rtl
10502 The maximum size measured as number of RTLs that can be recorded in an expression
10503 in combiner for a pseudo register as last known value of that register. The default
10506 @item max-combine-insns
10507 The maximum number of instructions the RTL combiner tries to combine.
10508 The default value is 2 at @option{-Og} and 4 otherwise.
10510 @item integer-share-limit
10511 Small integer constants can use a shared data structure, reducing the
10512 compiler's memory usage and increasing its speed. This sets the maximum
10513 value of a shared integer constant. The default value is 256.
10515 @item ssp-buffer-size
10516 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10517 protection when @option{-fstack-protection} is used.
10519 @item min-size-for-stack-sharing
10520 The minimum size of variables taking part in stack slot sharing when not
10521 optimizing. The default value is 32.
10523 @item max-jump-thread-duplication-stmts
10524 Maximum number of statements allowed in a block that needs to be
10525 duplicated when threading jumps.
10527 @item max-fields-for-field-sensitive
10528 Maximum number of fields in a structure treated in
10529 a field sensitive manner during pointer analysis. The default is zero
10530 for @option{-O0} and @option{-O1},
10531 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10533 @item prefetch-latency
10534 Estimate on average number of instructions that are executed before
10535 prefetch finishes. The distance prefetched ahead is proportional
10536 to this constant. Increasing this number may also lead to less
10537 streams being prefetched (see @option{simultaneous-prefetches}).
10539 @item simultaneous-prefetches
10540 Maximum number of prefetches that can run at the same time.
10542 @item l1-cache-line-size
10543 The size of cache line in L1 cache, in bytes.
10545 @item l1-cache-size
10546 The size of L1 cache, in kilobytes.
10548 @item l2-cache-size
10549 The size of L2 cache, in kilobytes.
10551 @item loop-interchange-max-num-stmts
10552 The maximum number of stmts in a loop to be interchanged.
10554 @item loop-interchange-stride-ratio
10555 The minimum ratio between stride of two loops for interchange to be profitable.
10557 @item min-insn-to-prefetch-ratio
10558 The minimum ratio between the number of instructions and the
10559 number of prefetches to enable prefetching in a loop.
10561 @item prefetch-min-insn-to-mem-ratio
10562 The minimum ratio between the number of instructions and the
10563 number of memory references to enable prefetching in a loop.
10565 @item use-canonical-types
10566 Whether the compiler should use the ``canonical'' type system. By
10567 default, this should always be 1, which uses a more efficient internal
10568 mechanism for comparing types in C++ and Objective-C++. However, if
10569 bugs in the canonical type system are causing compilation failures,
10570 set this value to 0 to disable canonical types.
10572 @item switch-conversion-max-branch-ratio
10573 Switch initialization conversion refuses to create arrays that are
10574 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10575 branches in the switch.
10577 @item max-partial-antic-length
10578 Maximum length of the partial antic set computed during the tree
10579 partial redundancy elimination optimization (@option{-ftree-pre}) when
10580 optimizing at @option{-O3} and above. For some sorts of source code
10581 the enhanced partial redundancy elimination optimization can run away,
10582 consuming all of the memory available on the host machine. This
10583 parameter sets a limit on the length of the sets that are computed,
10584 which prevents the runaway behavior. Setting a value of 0 for
10585 this parameter allows an unlimited set length.
10587 @item sccvn-max-scc-size
10588 Maximum size of a strongly connected component (SCC) during SCCVN
10589 processing. If this limit is hit, SCCVN processing for the whole
10590 function is not done and optimizations depending on it are
10591 disabled. The default maximum SCC size is 10000.
10593 @item sccvn-max-alias-queries-per-access
10594 Maximum number of alias-oracle queries we perform when looking for
10595 redundancies for loads and stores. If this limit is hit the search
10596 is aborted and the load or store is not considered redundant. The
10597 number of queries is algorithmically limited to the number of
10598 stores on all paths from the load to the function entry.
10599 The default maximum number of queries is 1000.
10601 @item ira-max-loops-num
10602 IRA uses regional register allocation by default. If a function
10603 contains more loops than the number given by this parameter, only at most
10604 the given number of the most frequently-executed loops form regions
10605 for regional register allocation. The default value of the
10608 @item ira-max-conflict-table-size
10609 Although IRA uses a sophisticated algorithm to compress the conflict
10610 table, the table can still require excessive amounts of memory for
10611 huge functions. If the conflict table for a function could be more
10612 than the size in MB given by this parameter, the register allocator
10613 instead uses a faster, simpler, and lower-quality
10614 algorithm that does not require building a pseudo-register conflict table.
10615 The default value of the parameter is 2000.
10617 @item ira-loop-reserved-regs
10618 IRA can be used to evaluate more accurate register pressure in loops
10619 for decisions to move loop invariants (see @option{-O3}). The number
10620 of available registers reserved for some other purposes is given
10621 by this parameter. The default value of the parameter is 2, which is
10622 the minimal number of registers needed by typical instructions.
10623 This value is the best found from numerous experiments.
10625 @item lra-inheritance-ebb-probability-cutoff
10626 LRA tries to reuse values reloaded in registers in subsequent insns.
10627 This optimization is called inheritance. EBB is used as a region to
10628 do this optimization. The parameter defines a minimal fall-through
10629 edge probability in percentage used to add BB to inheritance EBB in
10630 LRA. The default value of the parameter is 40. The value was chosen
10631 from numerous runs of SPEC2000 on x86-64.
10633 @item loop-invariant-max-bbs-in-loop
10634 Loop invariant motion can be very expensive, both in compilation time and
10635 in amount of needed compile-time memory, with very large loops. Loops
10636 with more basic blocks than this parameter won't have loop invariant
10637 motion optimization performed on them. The default value of the
10638 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10640 @item loop-max-datarefs-for-datadeps
10641 Building data dependencies is expensive for very large loops. This
10642 parameter limits the number of data references in loops that are
10643 considered for data dependence analysis. These large loops are no
10644 handled by the optimizations using loop data dependencies.
10645 The default value is 1000.
10647 @item max-vartrack-size
10648 Sets a maximum number of hash table slots to use during variable
10649 tracking dataflow analysis of any function. If this limit is exceeded
10650 with variable tracking at assignments enabled, analysis for that
10651 function is retried without it, after removing all debug insns from
10652 the function. If the limit is exceeded even without debug insns, var
10653 tracking analysis is completely disabled for the function. Setting
10654 the parameter to zero makes it unlimited.
10656 @item max-vartrack-expr-depth
10657 Sets a maximum number of recursion levels when attempting to map
10658 variable names or debug temporaries to value expressions. This trades
10659 compilation time for more complete debug information. If this is set too
10660 low, value expressions that are available and could be represented in
10661 debug information may end up not being used; setting this higher may
10662 enable the compiler to find more complex debug expressions, but compile
10663 time and memory use may grow. The default is 12.
10665 @item max-debug-marker-count
10666 Sets a threshold on the number of debug markers (e.g. begin stmt
10667 markers) to avoid complexity explosion at inlining or expanding to RTL.
10668 If a function has more such gimple stmts than the set limit, such stmts
10669 will be dropped from the inlined copy of a function, and from its RTL
10670 expansion. The default is 100000.
10672 @item min-nondebug-insn-uid
10673 Use uids starting at this parameter for nondebug insns. The range below
10674 the parameter is reserved exclusively for debug insns created by
10675 @option{-fvar-tracking-assignments}, but debug insns may get
10676 (non-overlapping) uids above it if the reserved range is exhausted.
10678 @item ipa-sra-ptr-growth-factor
10679 IPA-SRA replaces a pointer to an aggregate with one or more new
10680 parameters only when their cumulative size is less or equal to
10681 @option{ipa-sra-ptr-growth-factor} times the size of the original
10684 @item sra-max-scalarization-size-Ospeed
10685 @item sra-max-scalarization-size-Osize
10686 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10687 replace scalar parts of aggregates with uses of independent scalar
10688 variables. These parameters control the maximum size, in storage units,
10689 of aggregate which is considered for replacement when compiling for
10691 (@option{sra-max-scalarization-size-Ospeed}) or size
10692 (@option{sra-max-scalarization-size-Osize}) respectively.
10694 @item tm-max-aggregate-size
10695 When making copies of thread-local variables in a transaction, this
10696 parameter specifies the size in bytes after which variables are
10697 saved with the logging functions as opposed to save/restore code
10698 sequence pairs. This option only applies when using
10701 @item graphite-max-nb-scop-params
10702 To avoid exponential effects in the Graphite loop transforms, the
10703 number of parameters in a Static Control Part (SCoP) is bounded. The
10704 default value is 10 parameters, a value of zero can be used to lift
10705 the bound. A variable whose value is unknown at compilation time and
10706 defined outside a SCoP is a parameter of the SCoP.
10708 @item loop-block-tile-size
10709 Loop blocking or strip mining transforms, enabled with
10710 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10711 loop in the loop nest by a given number of iterations. The strip
10712 length can be changed using the @option{loop-block-tile-size}
10713 parameter. The default value is 51 iterations.
10715 @item loop-unroll-jam-size
10716 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
10717 default value is 4.
10719 @item loop-unroll-jam-depth
10720 Specify the dimension to be unrolled (counting from the most inner loop)
10721 for the @option{-floop-unroll-and-jam}. The default value is 2.
10723 @item ipa-cp-value-list-size
10724 IPA-CP attempts to track all possible values and types passed to a function's
10725 parameter in order to propagate them and perform devirtualization.
10726 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10727 stores per one formal parameter of a function.
10729 @item ipa-cp-eval-threshold
10730 IPA-CP calculates its own score of cloning profitability heuristics
10731 and performs those cloning opportunities with scores that exceed
10732 @option{ipa-cp-eval-threshold}.
10734 @item ipa-cp-recursion-penalty
10735 Percentage penalty the recursive functions will receive when they
10736 are evaluated for cloning.
10738 @item ipa-cp-single-call-penalty
10739 Percentage penalty functions containing a single call to another
10740 function will receive when they are evaluated for cloning.
10743 @item ipa-max-agg-items
10744 IPA-CP is also capable to propagate a number of scalar values passed
10745 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10746 number of such values per one parameter.
10748 @item ipa-cp-loop-hint-bonus
10749 When IPA-CP determines that a cloning candidate would make the number
10750 of iterations of a loop known, it adds a bonus of
10751 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10754 @item ipa-cp-array-index-hint-bonus
10755 When IPA-CP determines that a cloning candidate would make the index of
10756 an array access known, it adds a bonus of
10757 @option{ipa-cp-array-index-hint-bonus} to the profitability
10758 score of the candidate.
10760 @item ipa-max-aa-steps
10761 During its analysis of function bodies, IPA-CP employs alias analysis
10762 in order to track values pointed to by function parameters. In order
10763 not spend too much time analyzing huge functions, it gives up and
10764 consider all memory clobbered after examining
10765 @option{ipa-max-aa-steps} statements modifying memory.
10767 @item lto-partitions
10768 Specify desired number of partitions produced during WHOPR compilation.
10769 The number of partitions should exceed the number of CPUs used for compilation.
10770 The default value is 32.
10772 @item lto-min-partition
10773 Size of minimal partition for WHOPR (in estimated instructions).
10774 This prevents expenses of splitting very small programs into too many
10777 @item lto-max-partition
10778 Size of max partition for WHOPR (in estimated instructions).
10779 to provide an upper bound for individual size of partition.
10780 Meant to be used only with balanced partitioning.
10782 @item cxx-max-namespaces-for-diagnostic-help
10783 The maximum number of namespaces to consult for suggestions when C++
10784 name lookup fails for an identifier. The default is 1000.
10786 @item sink-frequency-threshold
10787 The maximum relative execution frequency (in percents) of the target block
10788 relative to a statement's original block to allow statement sinking of a
10789 statement. Larger numbers result in more aggressive statement sinking.
10790 The default value is 75. A small positive adjustment is applied for
10791 statements with memory operands as those are even more profitable so sink.
10793 @item max-stores-to-sink
10794 The maximum number of conditional store pairs that can be sunk. Set to 0
10795 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10796 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10798 @item allow-store-data-races
10799 Allow optimizers to introduce new data races on stores.
10800 Set to 1 to allow, otherwise to 0. This option is enabled by default
10801 at optimization level @option{-Ofast}.
10803 @item case-values-threshold
10804 The smallest number of different values for which it is best to use a
10805 jump-table instead of a tree of conditional branches. If the value is
10806 0, use the default for the machine. The default is 0.
10808 @item tree-reassoc-width
10809 Set the maximum number of instructions executed in parallel in
10810 reassociated tree. This parameter overrides target dependent
10811 heuristics used by default if has non zero value.
10813 @item sched-pressure-algorithm
10814 Choose between the two available implementations of
10815 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10816 and is the more likely to prevent instructions from being reordered.
10817 Algorithm 2 was designed to be a compromise between the relatively
10818 conservative approach taken by algorithm 1 and the rather aggressive
10819 approach taken by the default scheduler. It relies more heavily on
10820 having a regular register file and accurate register pressure classes.
10821 See @file{haifa-sched.c} in the GCC sources for more details.
10823 The default choice depends on the target.
10825 @item max-slsr-cand-scan
10826 Set the maximum number of existing candidates that are considered when
10827 seeking a basis for a new straight-line strength reduction candidate.
10830 Enable buffer overflow detection for global objects. This kind
10831 of protection is enabled by default if you are using
10832 @option{-fsanitize=address} option.
10833 To disable global objects protection use @option{--param asan-globals=0}.
10836 Enable buffer overflow detection for stack objects. This kind of
10837 protection is enabled by default when using @option{-fsanitize=address}.
10838 To disable stack protection use @option{--param asan-stack=0} option.
10840 @item asan-instrument-reads
10841 Enable buffer overflow detection for memory reads. This kind of
10842 protection is enabled by default when using @option{-fsanitize=address}.
10843 To disable memory reads protection use
10844 @option{--param asan-instrument-reads=0}.
10846 @item asan-instrument-writes
10847 Enable buffer overflow detection for memory writes. This kind of
10848 protection is enabled by default when using @option{-fsanitize=address}.
10849 To disable memory writes protection use
10850 @option{--param asan-instrument-writes=0} option.
10852 @item asan-memintrin
10853 Enable detection for built-in functions. This kind of protection
10854 is enabled by default when using @option{-fsanitize=address}.
10855 To disable built-in functions protection use
10856 @option{--param asan-memintrin=0}.
10858 @item asan-use-after-return
10859 Enable detection of use-after-return. This kind of protection
10860 is enabled by default when using the @option{-fsanitize=address} option.
10861 To disable it use @option{--param asan-use-after-return=0}.
10863 Note: By default the check is disabled at run time. To enable it,
10864 add @code{detect_stack_use_after_return=1} to the environment variable
10865 @env{ASAN_OPTIONS}.
10867 @item asan-instrumentation-with-call-threshold
10868 If number of memory accesses in function being instrumented
10869 is greater or equal to this number, use callbacks instead of inline checks.
10870 E.g. to disable inline code use
10871 @option{--param asan-instrumentation-with-call-threshold=0}.
10873 @item use-after-scope-direct-emission-threshold
10874 If the size of a local variable in bytes is smaller or equal to this
10875 number, directly poison (or unpoison) shadow memory instead of using
10876 run-time callbacks. The default value is 256.
10878 @item chkp-max-ctor-size
10879 Static constructors generated by Pointer Bounds Checker may become very
10880 large and significantly increase compile time at optimization level
10881 @option{-O1} and higher. This parameter is a maximum number of statements
10882 in a single generated constructor. Default value is 5000.
10884 @item max-fsm-thread-path-insns
10885 Maximum number of instructions to copy when duplicating blocks on a
10886 finite state automaton jump thread path. The default is 100.
10888 @item max-fsm-thread-length
10889 Maximum number of basic blocks on a finite state automaton jump thread
10890 path. The default is 10.
10892 @item max-fsm-thread-paths
10893 Maximum number of new jump thread paths to create for a finite state
10894 automaton. The default is 50.
10896 @item parloops-chunk-size
10897 Chunk size of omp schedule for loops parallelized by parloops. The default
10900 @item parloops-schedule
10901 Schedule type of omp schedule for loops parallelized by parloops (static,
10902 dynamic, guided, auto, runtime). The default is static.
10904 @item parloops-min-per-thread
10905 The minimum number of iterations per thread of an innermost parallelized
10906 loop for which the parallelized variant is prefered over the single threaded
10907 one. The default is 100. Note that for a parallelized loop nest the
10908 minimum number of iterations of the outermost loop per thread is two.
10910 @item max-ssa-name-query-depth
10911 Maximum depth of recursion when querying properties of SSA names in things
10912 like fold routines. One level of recursion corresponds to following a
10915 @item hsa-gen-debug-stores
10916 Enable emission of special debug stores within HSA kernels which are
10917 then read and reported by libgomp plugin. Generation of these stores
10918 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
10921 @item max-speculative-devirt-maydefs
10922 The maximum number of may-defs we analyze when looking for a must-def
10923 specifying the dynamic type of an object that invokes a virtual call
10924 we may be able to devirtualize speculatively.
10926 @item max-vrp-switch-assertions
10927 The maximum number of assertions to add along the default edge of a switch
10928 statement during VRP. The default is 10.
10930 @item unroll-jam-min-percent
10931 The minimum percentage of memory references that must be optimized
10932 away for the unroll-and-jam transformation to be considered profitable.
10934 @item unroll-jam-max-unroll
10935 The maximum number of times the outer loop should be unrolled by
10936 the unroll-and-jam transformation.
10940 @node Instrumentation Options
10941 @section Program Instrumentation Options
10942 @cindex instrumentation options
10943 @cindex program instrumentation options
10944 @cindex run-time error checking options
10945 @cindex profiling options
10946 @cindex options, program instrumentation
10947 @cindex options, run-time error checking
10948 @cindex options, profiling
10950 GCC supports a number of command-line options that control adding
10951 run-time instrumentation to the code it normally generates.
10952 For example, one purpose of instrumentation is collect profiling
10953 statistics for use in finding program hot spots, code coverage
10954 analysis, or profile-guided optimizations.
10955 Another class of program instrumentation is adding run-time checking
10956 to detect programming errors like invalid pointer
10957 dereferences or out-of-bounds array accesses, as well as deliberately
10958 hostile attacks such as stack smashing or C++ vtable hijacking.
10959 There is also a general hook which can be used to implement other
10960 forms of tracing or function-level instrumentation for debug or
10961 program analysis purposes.
10964 @cindex @command{prof}
10967 Generate extra code to write profile information suitable for the
10968 analysis program @command{prof}. You must use this option when compiling
10969 the source files you want data about, and you must also use it when
10972 @cindex @command{gprof}
10975 Generate extra code to write profile information suitable for the
10976 analysis program @command{gprof}. You must use this option when compiling
10977 the source files you want data about, and you must also use it when
10980 @item -fprofile-arcs
10981 @opindex fprofile-arcs
10982 Add code so that program flow @dfn{arcs} are instrumented. During
10983 execution the program records how many times each branch and call is
10984 executed and how many times it is taken or returns. On targets that support
10985 constructors with priority support, profiling properly handles constructors,
10986 destructors and C++ constructors (and destructors) of classes which are used
10987 as a type of a global variable.
10990 program exits it saves this data to a file called
10991 @file{@var{auxname}.gcda} for each source file. The data may be used for
10992 profile-directed optimizations (@option{-fbranch-probabilities}), or for
10993 test coverage analysis (@option{-ftest-coverage}). Each object file's
10994 @var{auxname} is generated from the name of the output file, if
10995 explicitly specified and it is not the final executable, otherwise it is
10996 the basename of the source file. In both cases any suffix is removed
10997 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
10998 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
10999 @xref{Cross-profiling}.
11001 @cindex @command{gcov}
11005 This option is used to compile and link code instrumented for coverage
11006 analysis. The option is a synonym for @option{-fprofile-arcs}
11007 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
11008 linking). See the documentation for those options for more details.
11013 Compile the source files with @option{-fprofile-arcs} plus optimization
11014 and code generation options. For test coverage analysis, use the
11015 additional @option{-ftest-coverage} option. You do not need to profile
11016 every source file in a program.
11019 Compile the source files additionally with @option{-fprofile-abs-path}
11020 to create absolute path names in the @file{.gcno} files. This allows
11021 @command{gcov} to find the correct sources in projects where compilations
11022 occur with different working directories.
11025 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
11026 (the latter implies the former).
11029 Run the program on a representative workload to generate the arc profile
11030 information. This may be repeated any number of times. You can run
11031 concurrent instances of your program, and provided that the file system
11032 supports locking, the data files will be correctly updated. Unless
11033 a strict ISO C dialect option is in effect, @code{fork} calls are
11034 detected and correctly handled without double counting.
11037 For profile-directed optimizations, compile the source files again with
11038 the same optimization and code generation options plus
11039 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
11040 Control Optimization}).
11043 For test coverage analysis, use @command{gcov} to produce human readable
11044 information from the @file{.gcno} and @file{.gcda} files. Refer to the
11045 @command{gcov} documentation for further information.
11049 With @option{-fprofile-arcs}, for each function of your program GCC
11050 creates a program flow graph, then finds a spanning tree for the graph.
11051 Only arcs that are not on the spanning tree have to be instrumented: the
11052 compiler adds code to count the number of times that these arcs are
11053 executed. When an arc is the only exit or only entrance to a block, the
11054 instrumentation code can be added to the block; otherwise, a new basic
11055 block must be created to hold the instrumentation code.
11058 @item -ftest-coverage
11059 @opindex ftest-coverage
11060 Produce a notes file that the @command{gcov} code-coverage utility
11061 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
11062 show program coverage. Each source file's note file is called
11063 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
11064 above for a description of @var{auxname} and instructions on how to
11065 generate test coverage data. Coverage data matches the source files
11066 more closely if you do not optimize.
11068 @item -fprofile-abs-path
11069 @opindex fprofile-abs-path
11070 Automatically convert relative source file names to absolute path names
11071 in the @file{.gcno} files. This allows @command{gcov} to find the correct
11072 sources in projects where compilations occur with different working
11075 @item -fprofile-dir=@var{path}
11076 @opindex fprofile-dir
11078 Set the directory to search for the profile data files in to @var{path}.
11079 This option affects only the profile data generated by
11080 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
11081 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
11082 and its related options. Both absolute and relative paths can be used.
11083 By default, GCC uses the current directory as @var{path}, thus the
11084 profile data file appears in the same directory as the object file.
11086 @item -fprofile-generate
11087 @itemx -fprofile-generate=@var{path}
11088 @opindex fprofile-generate
11090 Enable options usually used for instrumenting application to produce
11091 profile useful for later recompilation with profile feedback based
11092 optimization. You must use @option{-fprofile-generate} both when
11093 compiling and when linking your program.
11095 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
11097 If @var{path} is specified, GCC looks at the @var{path} to find
11098 the profile feedback data files. See @option{-fprofile-dir}.
11100 To optimize the program based on the collected profile information, use
11101 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
11103 @item -fprofile-update=@var{method}
11104 @opindex fprofile-update
11106 Alter the update method for an application instrumented for profile
11107 feedback based optimization. The @var{method} argument should be one of
11108 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
11109 The first one is useful for single-threaded applications,
11110 while the second one prevents profile corruption by emitting thread-safe code.
11112 @strong{Warning:} When an application does not properly join all threads
11113 (or creates an detached thread), a profile file can be still corrupted.
11115 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
11116 when supported by a target, or to @samp{single} otherwise. The GCC driver
11117 automatically selects @samp{prefer-atomic} when @option{-pthread}
11118 is present in the command line.
11120 @item -fsanitize=address
11121 @opindex fsanitize=address
11122 Enable AddressSanitizer, a fast memory error detector.
11123 Memory access instructions are instrumented to detect
11124 out-of-bounds and use-after-free bugs.
11125 The option enables @option{-fsanitize-address-use-after-scope}.
11126 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
11127 more details. The run-time behavior can be influenced using the
11128 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
11129 the available options are shown at startup of the instrumented program. See
11130 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
11131 for a list of supported options.
11132 The option cannot be combined with @option{-fsanitize=thread}
11133 and/or @option{-fcheck-pointer-bounds}.
11135 @item -fsanitize=kernel-address
11136 @opindex fsanitize=kernel-address
11137 Enable AddressSanitizer for Linux kernel.
11138 See @uref{https://github.com/google/kasan/wiki} for more details.
11139 The option cannot be combined with @option{-fcheck-pointer-bounds}.
11141 @item -fsanitize=pointer-compare
11142 @opindex fsanitize=pointer-compare
11143 Instrument comparison operation (<, <=, >, >=) with pointer operands.
11144 The option must be combined with either @option{-fsanitize=kernel-address} or
11145 @option{-fsanitize=address}
11146 The option cannot be combined with @option{-fsanitize=thread}
11147 and/or @option{-fcheck-pointer-bounds}.
11148 Note: By default the check is disabled at run time. To enable it,
11149 add @code{detect_invalid_pointer_pairs=1} to the environment variable
11150 @env{ASAN_OPTIONS}.
11152 @item -fsanitize=pointer-subtract
11153 @opindex fsanitize=pointer-subtract
11154 Instrument subtraction with pointer operands.
11155 The option must be combined with either @option{-fsanitize=kernel-address} or
11156 @option{-fsanitize=address}
11157 The option cannot be combined with @option{-fsanitize=thread}
11158 and/or @option{-fcheck-pointer-bounds}.
11159 Note: By default the check is disabled at run time. To enable it,
11160 add @code{detect_invalid_pointer_pairs=1} to the environment variable
11161 @env{ASAN_OPTIONS}.
11163 @item -fsanitize=thread
11164 @opindex fsanitize=thread
11165 Enable ThreadSanitizer, a fast data race detector.
11166 Memory access instructions are instrumented to detect
11167 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
11168 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
11169 environment variable; see
11170 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
11172 The option cannot be combined with @option{-fsanitize=address},
11173 @option{-fsanitize=leak} and/or @option{-fcheck-pointer-bounds}.
11175 Note that sanitized atomic builtins cannot throw exceptions when
11176 operating on invalid memory addresses with non-call exceptions
11177 (@option{-fnon-call-exceptions}).
11179 @item -fsanitize=leak
11180 @opindex fsanitize=leak
11181 Enable LeakSanitizer, a memory leak detector.
11182 This option only matters for linking of executables and
11183 the executable is linked against a library that overrides @code{malloc}
11184 and other allocator functions. See
11185 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
11186 details. The run-time behavior can be influenced using the
11187 @env{LSAN_OPTIONS} environment variable.
11188 The option cannot be combined with @option{-fsanitize=thread}.
11190 @item -fsanitize=undefined
11191 @opindex fsanitize=undefined
11192 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
11193 Various computations are instrumented to detect undefined behavior
11194 at runtime. Current suboptions are:
11198 @item -fsanitize=shift
11199 @opindex fsanitize=shift
11200 This option enables checking that the result of a shift operation is
11201 not undefined. Note that what exactly is considered undefined differs
11202 slightly between C and C++, as well as between ISO C90 and C99, etc.
11203 This option has two suboptions, @option{-fsanitize=shift-base} and
11204 @option{-fsanitize=shift-exponent}.
11206 @item -fsanitize=shift-exponent
11207 @opindex fsanitize=shift-exponent
11208 This option enables checking that the second argument of a shift operation
11209 is not negative and is smaller than the precision of the promoted first
11212 @item -fsanitize=shift-base
11213 @opindex fsanitize=shift-base
11214 If the second argument of a shift operation is within range, check that the
11215 result of a shift operation is not undefined. Note that what exactly is
11216 considered undefined differs slightly between C and C++, as well as between
11217 ISO C90 and C99, etc.
11219 @item -fsanitize=integer-divide-by-zero
11220 @opindex fsanitize=integer-divide-by-zero
11221 Detect integer division by zero as well as @code{INT_MIN / -1} division.
11223 @item -fsanitize=unreachable
11224 @opindex fsanitize=unreachable
11225 With this option, the compiler turns the @code{__builtin_unreachable}
11226 call into a diagnostics message call instead. When reaching the
11227 @code{__builtin_unreachable} call, the behavior is undefined.
11229 @item -fsanitize=vla-bound
11230 @opindex fsanitize=vla-bound
11231 This option instructs the compiler to check that the size of a variable
11232 length array is positive.
11234 @item -fsanitize=null
11235 @opindex fsanitize=null
11236 This option enables pointer checking. Particularly, the application
11237 built with this option turned on will issue an error message when it
11238 tries to dereference a NULL pointer, or if a reference (possibly an
11239 rvalue reference) is bound to a NULL pointer, or if a method is invoked
11240 on an object pointed by a NULL pointer.
11242 @item -fsanitize=return
11243 @opindex fsanitize=return
11244 This option enables return statement checking. Programs
11245 built with this option turned on will issue an error message
11246 when the end of a non-void function is reached without actually
11247 returning a value. This option works in C++ only.
11249 @item -fsanitize=signed-integer-overflow
11250 @opindex fsanitize=signed-integer-overflow
11251 This option enables signed integer overflow checking. We check that
11252 the result of @code{+}, @code{*}, and both unary and binary @code{-}
11253 does not overflow in the signed arithmetics. Note, integer promotion
11254 rules must be taken into account. That is, the following is not an
11257 signed char a = SCHAR_MAX;
11261 @item -fsanitize=bounds
11262 @opindex fsanitize=bounds
11263 This option enables instrumentation of array bounds. Various out of bounds
11264 accesses are detected. Flexible array members, flexible array member-like
11265 arrays, and initializers of variables with static storage are not instrumented.
11266 The option cannot be combined with @option{-fcheck-pointer-bounds}.
11268 @item -fsanitize=bounds-strict
11269 @opindex fsanitize=bounds-strict
11270 This option enables strict instrumentation of array bounds. Most out of bounds
11271 accesses are detected, including flexible array members and flexible array
11272 member-like arrays. Initializers of variables with static storage are not
11273 instrumented. The option cannot be combined
11274 with @option{-fcheck-pointer-bounds}.
11276 @item -fsanitize=alignment
11277 @opindex fsanitize=alignment
11279 This option enables checking of alignment of pointers when they are
11280 dereferenced, or when a reference is bound to insufficiently aligned target,
11281 or when a method or constructor is invoked on insufficiently aligned object.
11283 @item -fsanitize=object-size
11284 @opindex fsanitize=object-size
11285 This option enables instrumentation of memory references using the
11286 @code{__builtin_object_size} function. Various out of bounds pointer
11287 accesses are detected.
11289 @item -fsanitize=float-divide-by-zero
11290 @opindex fsanitize=float-divide-by-zero
11291 Detect floating-point division by zero. Unlike other similar options,
11292 @option{-fsanitize=float-divide-by-zero} is not enabled by
11293 @option{-fsanitize=undefined}, since floating-point division by zero can
11294 be a legitimate way of obtaining infinities and NaNs.
11296 @item -fsanitize=float-cast-overflow
11297 @opindex fsanitize=float-cast-overflow
11298 This option enables floating-point type to integer conversion checking.
11299 We check that the result of the conversion does not overflow.
11300 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
11301 not enabled by @option{-fsanitize=undefined}.
11302 This option does not work well with @code{FE_INVALID} exceptions enabled.
11304 @item -fsanitize=nonnull-attribute
11305 @opindex fsanitize=nonnull-attribute
11307 This option enables instrumentation of calls, checking whether null values
11308 are not passed to arguments marked as requiring a non-null value by the
11309 @code{nonnull} function attribute.
11311 @item -fsanitize=returns-nonnull-attribute
11312 @opindex fsanitize=returns-nonnull-attribute
11314 This option enables instrumentation of return statements in functions
11315 marked with @code{returns_nonnull} function attribute, to detect returning
11316 of null values from such functions.
11318 @item -fsanitize=bool
11319 @opindex fsanitize=bool
11321 This option enables instrumentation of loads from bool. If a value other
11322 than 0/1 is loaded, a run-time error is issued.
11324 @item -fsanitize=enum
11325 @opindex fsanitize=enum
11327 This option enables instrumentation of loads from an enum type. If
11328 a value outside the range of values for the enum type is loaded,
11329 a run-time error is issued.
11331 @item -fsanitize=vptr
11332 @opindex fsanitize=vptr
11334 This option enables instrumentation of C++ member function calls, member
11335 accesses and some conversions between pointers to base and derived classes,
11336 to verify the referenced object has the correct dynamic type.
11338 @item -fsanitize=pointer-overflow
11339 @opindex fsanitize=pointer-overflow
11341 This option enables instrumentation of pointer arithmetics. If the pointer
11342 arithmetics overflows, a run-time error is issued.
11344 @item -fsanitize=builtin
11345 @opindex fsanitize=builtin
11347 This option enables instrumentation of arguments to selected builtin
11348 functions. If an invalid value is passed to such arguments, a run-time
11349 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
11350 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
11355 While @option{-ftrapv} causes traps for signed overflows to be emitted,
11356 @option{-fsanitize=undefined} gives a diagnostic message.
11357 This currently works only for the C family of languages.
11359 @item -fno-sanitize=all
11360 @opindex fno-sanitize=all
11362 This option disables all previously enabled sanitizers.
11363 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
11366 @item -fasan-shadow-offset=@var{number}
11367 @opindex fasan-shadow-offset
11368 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
11369 It is useful for experimenting with different shadow memory layouts in
11370 Kernel AddressSanitizer.
11372 @item -fsanitize-sections=@var{s1},@var{s2},...
11373 @opindex fsanitize-sections
11374 Sanitize global variables in selected user-defined sections. @var{si} may
11377 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
11378 @opindex fsanitize-recover
11379 @opindex fno-sanitize-recover
11380 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
11381 mentioned in comma-separated list of @var{opts}. Enabling this option
11382 for a sanitizer component causes it to attempt to continue
11383 running the program as if no error happened. This means multiple
11384 runtime errors can be reported in a single program run, and the exit
11385 code of the program may indicate success even when errors
11386 have been reported. The @option{-fno-sanitize-recover=} option
11387 can be used to alter
11388 this behavior: only the first detected error is reported
11389 and program then exits with a non-zero exit code.
11391 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
11392 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
11393 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
11394 @option{-fsanitize=bounds-strict},
11395 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
11396 For these sanitizers error recovery is turned on by default,
11397 except @option{-fsanitize=address}, for which this feature is experimental.
11398 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
11399 accepted, the former enables recovery for all sanitizers that support it,
11400 the latter disables recovery for all sanitizers that support it.
11402 Even if a recovery mode is turned on the compiler side, it needs to be also
11403 enabled on the runtime library side, otherwise the failures are still fatal.
11404 The runtime library defaults to @code{halt_on_error=0} for
11405 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
11406 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
11407 setting the @code{halt_on_error} flag in the corresponding environment variable.
11409 Syntax without an explicit @var{opts} parameter is deprecated. It is
11410 equivalent to specifying an @var{opts} list of:
11413 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11416 @item -fsanitize-address-use-after-scope
11417 @opindex fsanitize-address-use-after-scope
11418 Enable sanitization of local variables to detect use-after-scope bugs.
11419 The option sets @option{-fstack-reuse} to @samp{none}.
11421 @item -fsanitize-undefined-trap-on-error
11422 @opindex fsanitize-undefined-trap-on-error
11423 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
11424 report undefined behavior using @code{__builtin_trap} rather than
11425 a @code{libubsan} library routine. The advantage of this is that the
11426 @code{libubsan} library is not needed and is not linked in, so this
11427 is usable even in freestanding environments.
11429 @item -fsanitize-coverage=trace-pc
11430 @opindex fsanitize-coverage=trace-pc
11431 Enable coverage-guided fuzzing code instrumentation.
11432 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
11434 @item -fsanitize-coverage=trace-cmp
11435 @opindex fsanitize-coverage=trace-cmp
11436 Enable dataflow guided fuzzing code instrumentation.
11437 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
11438 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
11439 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
11440 variable or @code{__sanitizer_cov_trace_const_cmp1},
11441 @code{__sanitizer_cov_trace_const_cmp2},
11442 @code{__sanitizer_cov_trace_const_cmp4} or
11443 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
11444 operand constant, @code{__sanitizer_cov_trace_cmpf} or
11445 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
11446 @code{__sanitizer_cov_trace_switch} for switch statements.
11448 @item -fbounds-check
11449 @opindex fbounds-check
11450 For front ends that support it, generate additional code to check that
11451 indices used to access arrays are within the declared range. This is
11452 currently only supported by the Fortran front end, where this option
11455 @item -fcheck-pointer-bounds
11456 @opindex fcheck-pointer-bounds
11457 @opindex fno-check-pointer-bounds
11458 @cindex Pointer Bounds Checker options
11459 Enable Pointer Bounds Checker instrumentation. Each memory reference
11460 is instrumented with checks of the pointer used for memory access against
11461 bounds associated with that pointer.
11464 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
11465 and @option{-mmpx} are required to enable this feature.
11466 MPX-based instrumentation requires
11467 a runtime library to enable MPX in hardware and handle bounds
11468 violation signals. By default when @option{-fcheck-pointer-bounds}
11469 and @option{-mmpx} options are used to link a program, the GCC driver
11470 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
11471 Bounds checking on calls to dynamic libraries requires a linker
11472 with @option{-z bndplt} support; if GCC was configured with a linker
11473 without support for this option (including the Gold linker and older
11474 versions of ld), a warning is given if you link with @option{-mmpx}
11475 without also specifying @option{-static}, since the overall effectiveness
11476 of the bounds checking protection is reduced.
11477 See also @option{-static-libmpxwrappers}.
11479 MPX-based instrumentation
11480 may be used for debugging and also may be included in production code
11481 to increase program security. Depending on usage, you may
11482 have different requirements for the runtime library. The current version
11483 of the MPX runtime library is more oriented for use as a debugging
11484 tool. MPX runtime library usage implies @option{-lpthread}. See
11485 also @option{-static-libmpx}. The runtime library behavior can be
11486 influenced using various @env{CHKP_RT_*} environment variables. See
11487 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
11490 Generated instrumentation may be controlled by various
11491 @option{-fchkp-*} options and by the @code{bnd_variable_size}
11492 structure field attribute (@pxref{Type Attributes}) and
11493 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
11494 (@pxref{Function Attributes}). GCC also provides a number of built-in
11495 functions for controlling the Pointer Bounds Checker. @xref{Pointer
11496 Bounds Checker builtins}, for more information.
11498 @item -fchkp-check-incomplete-type
11499 @opindex fchkp-check-incomplete-type
11500 @opindex fno-chkp-check-incomplete-type
11501 Generate pointer bounds checks for variables with incomplete type.
11502 Enabled by default.
11504 @item -fchkp-narrow-bounds
11505 @opindex fchkp-narrow-bounds
11506 @opindex fno-chkp-narrow-bounds
11507 Controls bounds used by Pointer Bounds Checker for pointers to object
11508 fields. If narrowing is enabled then field bounds are used. Otherwise
11509 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
11510 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
11512 @item -fchkp-first-field-has-own-bounds
11513 @opindex fchkp-first-field-has-own-bounds
11514 @opindex fno-chkp-first-field-has-own-bounds
11515 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
11516 first field in the structure. By default a pointer to the first field has
11517 the same bounds as a pointer to the whole structure.
11519 @item -fchkp-flexible-struct-trailing-arrays
11520 @opindex fchkp-flexible-struct-trailing-arrays
11521 @opindex fno-chkp-flexible-struct-trailing-arrays
11522 Forces Pointer Bounds Checker to treat all trailing arrays in structures as
11523 possibly flexible. By default only array fields with zero length or that are
11524 marked with attribute bnd_variable_size are treated as flexible.
11526 @item -fchkp-narrow-to-innermost-array
11527 @opindex fchkp-narrow-to-innermost-array
11528 @opindex fno-chkp-narrow-to-innermost-array
11529 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
11530 case of nested static array access. By default this option is disabled and
11531 bounds of the outermost array are used.
11533 @item -fchkp-optimize
11534 @opindex fchkp-optimize
11535 @opindex fno-chkp-optimize
11536 Enables Pointer Bounds Checker optimizations. Enabled by default at
11537 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
11539 @item -fchkp-use-fast-string-functions
11540 @opindex fchkp-use-fast-string-functions
11541 @opindex fno-chkp-use-fast-string-functions
11542 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
11543 by Pointer Bounds Checker. Disabled by default.
11545 @item -fchkp-use-nochk-string-functions
11546 @opindex fchkp-use-nochk-string-functions
11547 @opindex fno-chkp-use-nochk-string-functions
11548 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
11549 by Pointer Bounds Checker. Disabled by default.
11551 @item -fchkp-use-static-bounds
11552 @opindex fchkp-use-static-bounds
11553 @opindex fno-chkp-use-static-bounds
11554 Allow Pointer Bounds Checker to generate static bounds holding
11555 bounds of static variables. Enabled by default.
11557 @item -fchkp-use-static-const-bounds
11558 @opindex fchkp-use-static-const-bounds
11559 @opindex fno-chkp-use-static-const-bounds
11560 Use statically-initialized bounds for constant bounds instead of
11561 generating them each time they are required. By default enabled when
11562 @option{-fchkp-use-static-bounds} is enabled.
11564 @item -fchkp-treat-zero-dynamic-size-as-infinite
11565 @opindex fchkp-treat-zero-dynamic-size-as-infinite
11566 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
11567 With this option, objects with incomplete type whose
11568 dynamically-obtained size is zero are treated as having infinite size
11569 instead by Pointer Bounds
11570 Checker. This option may be helpful if a program is linked with a library
11571 missing size information for some symbols. Disabled by default.
11573 @item -fchkp-check-read
11574 @opindex fchkp-check-read
11575 @opindex fno-chkp-check-read
11576 Instructs Pointer Bounds Checker to generate checks for all read
11577 accesses to memory. Enabled by default.
11579 @item -fchkp-check-write
11580 @opindex fchkp-check-write
11581 @opindex fno-chkp-check-write
11582 Instructs Pointer Bounds Checker to generate checks for all write
11583 accesses to memory. Enabled by default.
11585 @item -fchkp-store-bounds
11586 @opindex fchkp-store-bounds
11587 @opindex fno-chkp-store-bounds
11588 Instructs Pointer Bounds Checker to generate bounds stores for
11589 pointer writes. Enabled by default.
11591 @item -fchkp-instrument-calls
11592 @opindex fchkp-instrument-calls
11593 @opindex fno-chkp-instrument-calls
11594 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
11595 Enabled by default.
11597 @item -fchkp-instrument-marked-only
11598 @opindex fchkp-instrument-marked-only
11599 @opindex fno-chkp-instrument-marked-only
11600 Instructs Pointer Bounds Checker to instrument only functions
11601 marked with the @code{bnd_instrument} attribute
11602 (@pxref{Function Attributes}). Disabled by default.
11604 @item -fchkp-use-wrappers
11605 @opindex fchkp-use-wrappers
11606 @opindex fno-chkp-use-wrappers
11607 Allows Pointer Bounds Checker to replace calls to built-in functions
11608 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
11609 is used to link a program, the GCC driver automatically links
11610 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
11611 Enabled by default.
11613 @item -fcf-protection==@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
11614 @opindex fcf-protection
11615 Enable code instrumentation of control-flow transfers to increase
11616 program security by checking that target addresses of control-flow
11617 transfer instructions (such as indirect function call, function return,
11618 indirect jump) are valid. This prevents diverting the flow of control
11619 to an unexpected target. This is intended to protect against such
11620 threats as Return-oriented Programming (ROP), and similarly
11621 call/jmp-oriented programming (COP/JOP).
11623 The value @code{branch} tells the compiler to implement checking of
11624 validity of control-flow transfer at the point of indirect branch
11625 instructions, i.e. call/jmp instructions. The value @code{return}
11626 implements checking of validity at the point of returning from a
11627 function. The value @code{full} is an alias for specifying both
11628 @code{branch} and @code{return}. The value @code{none} turns off
11631 You can also use the @code{nocf_check} attribute to identify
11632 which functions and calls should be skipped from instrumentation
11633 (@pxref{Function Attributes}).
11635 Currently the x86 GNU/Linux target provides an implementation based
11636 on Intel Control-flow Enforcement Technology (CET). Instrumentation
11637 for x86 is controlled by target-specific options @option{-mcet},
11638 @option{-mibt} and @option{-mshstk} (@pxref{x86 Options}).
11640 @item -fstack-protector
11641 @opindex fstack-protector
11642 Emit extra code to check for buffer overflows, such as stack smashing
11643 attacks. This is done by adding a guard variable to functions with
11644 vulnerable objects. This includes functions that call @code{alloca}, and
11645 functions with buffers larger than 8 bytes. The guards are initialized
11646 when a function is entered and then checked when the function exits.
11647 If a guard check fails, an error message is printed and the program exits.
11649 @item -fstack-protector-all
11650 @opindex fstack-protector-all
11651 Like @option{-fstack-protector} except that all functions are protected.
11653 @item -fstack-protector-strong
11654 @opindex fstack-protector-strong
11655 Like @option{-fstack-protector} but includes additional functions to
11656 be protected --- those that have local array definitions, or have
11657 references to local frame addresses.
11659 @item -fstack-protector-explicit
11660 @opindex fstack-protector-explicit
11661 Like @option{-fstack-protector} but only protects those functions which
11662 have the @code{stack_protect} attribute.
11664 @item -fstack-check
11665 @opindex fstack-check
11666 Generate code to verify that you do not go beyond the boundary of the
11667 stack. You should specify this flag if you are running in an
11668 environment with multiple threads, but you only rarely need to specify it in
11669 a single-threaded environment since stack overflow is automatically
11670 detected on nearly all systems if there is only one stack.
11672 Note that this switch does not actually cause checking to be done; the
11673 operating system or the language runtime must do that. The switch causes
11674 generation of code to ensure that they see the stack being extended.
11676 You can additionally specify a string parameter: @samp{no} means no
11677 checking, @samp{generic} means force the use of old-style checking,
11678 @samp{specific} means use the best checking method and is equivalent
11679 to bare @option{-fstack-check}.
11681 Old-style checking is a generic mechanism that requires no specific
11682 target support in the compiler but comes with the following drawbacks:
11686 Modified allocation strategy for large objects: they are always
11687 allocated dynamically if their size exceeds a fixed threshold. Note this
11688 may change the semantics of some code.
11691 Fixed limit on the size of the static frame of functions: when it is
11692 topped by a particular function, stack checking is not reliable and
11693 a warning is issued by the compiler.
11696 Inefficiency: because of both the modified allocation strategy and the
11697 generic implementation, code performance is hampered.
11700 Note that old-style stack checking is also the fallback method for
11701 @samp{specific} if no target support has been added in the compiler.
11703 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
11704 and stack overflows. @samp{specific} is an excellent choice when compiling
11705 Ada code. It is not generally sufficient to protect against stack-clash
11706 attacks. To protect against those you want @samp{-fstack-clash-protection}.
11708 @item -fstack-clash-protection
11709 @opindex fstack-clash-protection
11710 Generate code to prevent stack clash style attacks. When this option is
11711 enabled, the compiler will only allocate one page of stack space at a time
11712 and each page is accessed immediately after allocation. Thus, it prevents
11713 allocations from jumping over any stack guard page provided by the
11716 Most targets do not fully support stack clash protection. However, on
11717 those targets @option{-fstack-clash-protection} will protect dynamic stack
11718 allocations. @option{-fstack-clash-protection} may also provide limited
11719 protection for static stack allocations if the target supports
11720 @option{-fstack-check=specific}.
11722 @item -fstack-limit-register=@var{reg}
11723 @itemx -fstack-limit-symbol=@var{sym}
11724 @itemx -fno-stack-limit
11725 @opindex fstack-limit-register
11726 @opindex fstack-limit-symbol
11727 @opindex fno-stack-limit
11728 Generate code to ensure that the stack does not grow beyond a certain value,
11729 either the value of a register or the address of a symbol. If a larger
11730 stack is required, a signal is raised at run time. For most targets,
11731 the signal is raised before the stack overruns the boundary, so
11732 it is possible to catch the signal without taking special precautions.
11734 For instance, if the stack starts at absolute address @samp{0x80000000}
11735 and grows downwards, you can use the flags
11736 @option{-fstack-limit-symbol=__stack_limit} and
11737 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11738 of 128KB@. Note that this may only work with the GNU linker.
11740 You can locally override stack limit checking by using the
11741 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11743 @item -fsplit-stack
11744 @opindex fsplit-stack
11745 Generate code to automatically split the stack before it overflows.
11746 The resulting program has a discontiguous stack which can only
11747 overflow if the program is unable to allocate any more memory. This
11748 is most useful when running threaded programs, as it is no longer
11749 necessary to calculate a good stack size to use for each thread. This
11750 is currently only implemented for the x86 targets running
11753 When code compiled with @option{-fsplit-stack} calls code compiled
11754 without @option{-fsplit-stack}, there may not be much stack space
11755 available for the latter code to run. If compiling all code,
11756 including library code, with @option{-fsplit-stack} is not an option,
11757 then the linker can fix up these calls so that the code compiled
11758 without @option{-fsplit-stack} always has a large stack. Support for
11759 this is implemented in the gold linker in GNU binutils release 2.21
11762 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
11763 @opindex fvtable-verify
11764 This option is only available when compiling C++ code.
11765 It turns on (or off, if using @option{-fvtable-verify=none}) the security
11766 feature that verifies at run time, for every virtual call, that
11767 the vtable pointer through which the call is made is valid for the type of
11768 the object, and has not been corrupted or overwritten. If an invalid vtable
11769 pointer is detected at run time, an error is reported and execution of the
11770 program is immediately halted.
11772 This option causes run-time data structures to be built at program startup,
11773 which are used for verifying the vtable pointers.
11774 The options @samp{std} and @samp{preinit}
11775 control the timing of when these data structures are built. In both cases the
11776 data structures are built before execution reaches @code{main}. Using
11777 @option{-fvtable-verify=std} causes the data structures to be built after
11778 shared libraries have been loaded and initialized.
11779 @option{-fvtable-verify=preinit} causes them to be built before shared
11780 libraries have been loaded and initialized.
11782 If this option appears multiple times in the command line with different
11783 values specified, @samp{none} takes highest priority over both @samp{std} and
11784 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
11787 @opindex fvtv-debug
11788 When used in conjunction with @option{-fvtable-verify=std} or
11789 @option{-fvtable-verify=preinit}, causes debug versions of the
11790 runtime functions for the vtable verification feature to be called.
11791 This flag also causes the compiler to log information about which
11792 vtable pointers it finds for each class.
11793 This information is written to a file named @file{vtv_set_ptr_data.log}
11794 in the directory named by the environment variable @env{VTV_LOGS_DIR}
11795 if that is defined or the current working directory otherwise.
11797 Note: This feature @emph{appends} data to the log file. If you want a fresh log
11798 file, be sure to delete any existing one.
11801 @opindex fvtv-counts
11802 This is a debugging flag. When used in conjunction with
11803 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
11804 causes the compiler to keep track of the total number of virtual calls
11805 it encounters and the number of verifications it inserts. It also
11806 counts the number of calls to certain run-time library functions
11807 that it inserts and logs this information for each compilation unit.
11808 The compiler writes this information to a file named
11809 @file{vtv_count_data.log} in the directory named by the environment
11810 variable @env{VTV_LOGS_DIR} if that is defined or the current working
11811 directory otherwise. It also counts the size of the vtable pointer sets
11812 for each class, and writes this information to @file{vtv_class_set_sizes.log}
11813 in the same directory.
11815 Note: This feature @emph{appends} data to the log files. To get fresh log
11816 files, be sure to delete any existing ones.
11818 @item -finstrument-functions
11819 @opindex finstrument-functions
11820 Generate instrumentation calls for entry and exit to functions. Just
11821 after function entry and just before function exit, the following
11822 profiling functions are called with the address of the current
11823 function and its call site. (On some platforms,
11824 @code{__builtin_return_address} does not work beyond the current
11825 function, so the call site information may not be available to the
11826 profiling functions otherwise.)
11829 void __cyg_profile_func_enter (void *this_fn,
11831 void __cyg_profile_func_exit (void *this_fn,
11835 The first argument is the address of the start of the current function,
11836 which may be looked up exactly in the symbol table.
11838 This instrumentation is also done for functions expanded inline in other
11839 functions. The profiling calls indicate where, conceptually, the
11840 inline function is entered and exited. This means that addressable
11841 versions of such functions must be available. If all your uses of a
11842 function are expanded inline, this may mean an additional expansion of
11843 code size. If you use @code{extern inline} in your C code, an
11844 addressable version of such functions must be provided. (This is
11845 normally the case anyway, but if you get lucky and the optimizer always
11846 expands the functions inline, you might have gotten away without
11847 providing static copies.)
11849 A function may be given the attribute @code{no_instrument_function}, in
11850 which case this instrumentation is not done. This can be used, for
11851 example, for the profiling functions listed above, high-priority
11852 interrupt routines, and any functions from which the profiling functions
11853 cannot safely be called (perhaps signal handlers, if the profiling
11854 routines generate output or allocate memory).
11856 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
11857 @opindex finstrument-functions-exclude-file-list
11859 Set the list of functions that are excluded from instrumentation (see
11860 the description of @option{-finstrument-functions}). If the file that
11861 contains a function definition matches with one of @var{file}, then
11862 that function is not instrumented. The match is done on substrings:
11863 if the @var{file} parameter is a substring of the file name, it is
11864 considered to be a match.
11869 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
11873 excludes any inline function defined in files whose pathnames
11874 contain @file{/bits/stl} or @file{include/sys}.
11876 If, for some reason, you want to include letter @samp{,} in one of
11877 @var{sym}, write @samp{\,}. For example,
11878 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
11879 (note the single quote surrounding the option).
11881 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
11882 @opindex finstrument-functions-exclude-function-list
11884 This is similar to @option{-finstrument-functions-exclude-file-list},
11885 but this option sets the list of function names to be excluded from
11886 instrumentation. The function name to be matched is its user-visible
11887 name, such as @code{vector<int> blah(const vector<int> &)}, not the
11888 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
11889 match is done on substrings: if the @var{sym} parameter is a substring
11890 of the function name, it is considered to be a match. For C99 and C++
11891 extended identifiers, the function name must be given in UTF-8, not
11892 using universal character names.
11894 @item -fpatchable-function-entry=@var{N}[,@var{M}]
11895 @opindex fpatchable-function-entry
11896 Generate @var{N} NOPs right at the beginning
11897 of each function, with the function entry point before the @var{M}th NOP.
11898 If @var{M} is omitted, it defaults to @code{0} so the
11899 function entry points to the address just at the first NOP.
11900 The NOP instructions reserve extra space which can be used to patch in
11901 any desired instrumentation at run time, provided that the code segment
11902 is writable. The amount of space is controllable indirectly via
11903 the number of NOPs; the NOP instruction used corresponds to the instruction
11904 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
11905 is target-specific and may also depend on the architecture variant and/or
11906 other compilation options.
11908 For run-time identification, the starting addresses of these areas,
11909 which correspond to their respective function entries minus @var{M},
11910 are additionally collected in the @code{__patchable_function_entries}
11911 section of the resulting binary.
11913 Note that the value of @code{__attribute__ ((patchable_function_entry
11914 (N,M)))} takes precedence over command-line option
11915 @option{-fpatchable-function-entry=N,M}. This can be used to increase
11916 the area size or to remove it completely on a single function.
11917 If @code{N=0}, no pad location is recorded.
11919 The NOP instructions are inserted at---and maybe before, depending on
11920 @var{M}---the function entry address, even before the prologue.
11925 @node Preprocessor Options
11926 @section Options Controlling the Preprocessor
11927 @cindex preprocessor options
11928 @cindex options, preprocessor
11930 These options control the C preprocessor, which is run on each C source
11931 file before actual compilation.
11933 If you use the @option{-E} option, nothing is done except preprocessing.
11934 Some of these options make sense only together with @option{-E} because
11935 they cause the preprocessor output to be unsuitable for actual
11938 In addition to the options listed here, there are a number of options
11939 to control search paths for include files documented in
11940 @ref{Directory Options}.
11941 Options to control preprocessor diagnostics are listed in
11942 @ref{Warning Options}.
11945 @include cppopts.texi
11947 @item -Wp,@var{option}
11949 You can use @option{-Wp,@var{option}} to bypass the compiler driver
11950 and pass @var{option} directly through to the preprocessor. If
11951 @var{option} contains commas, it is split into multiple options at the
11952 commas. However, many options are modified, translated or interpreted
11953 by the compiler driver before being passed to the preprocessor, and
11954 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
11955 interface is undocumented and subject to change, so whenever possible
11956 you should avoid using @option{-Wp} and let the driver handle the
11959 @item -Xpreprocessor @var{option}
11960 @opindex Xpreprocessor
11961 Pass @var{option} as an option to the preprocessor. You can use this to
11962 supply system-specific preprocessor options that GCC does not
11965 If you want to pass an option that takes an argument, you must use
11966 @option{-Xpreprocessor} twice, once for the option and once for the argument.
11968 @item -no-integrated-cpp
11969 @opindex no-integrated-cpp
11970 Perform preprocessing as a separate pass before compilation.
11971 By default, GCC performs preprocessing as an integrated part of
11972 input tokenization and parsing.
11973 If this option is provided, the appropriate language front end
11974 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
11975 and Objective-C, respectively) is instead invoked twice,
11976 once for preprocessing only and once for actual compilation
11977 of the preprocessed input.
11978 This option may be useful in conjunction with the @option{-B} or
11979 @option{-wrapper} options to specify an alternate preprocessor or
11980 perform additional processing of the program source between
11981 normal preprocessing and compilation.
11985 @node Assembler Options
11986 @section Passing Options to the Assembler
11988 @c prevent bad page break with this line
11989 You can pass options to the assembler.
11992 @item -Wa,@var{option}
11994 Pass @var{option} as an option to the assembler. If @var{option}
11995 contains commas, it is split into multiple options at the commas.
11997 @item -Xassembler @var{option}
11998 @opindex Xassembler
11999 Pass @var{option} as an option to the assembler. You can use this to
12000 supply system-specific assembler options that GCC does not
12003 If you want to pass an option that takes an argument, you must use
12004 @option{-Xassembler} twice, once for the option and once for the argument.
12009 @section Options for Linking
12010 @cindex link options
12011 @cindex options, linking
12013 These options come into play when the compiler links object files into
12014 an executable output file. They are meaningless if the compiler is
12015 not doing a link step.
12019 @item @var{object-file-name}
12020 A file name that does not end in a special recognized suffix is
12021 considered to name an object file or library. (Object files are
12022 distinguished from libraries by the linker according to the file
12023 contents.) If linking is done, these object files are used as input
12032 If any of these options is used, then the linker is not run, and
12033 object file names should not be used as arguments. @xref{Overall
12037 @opindex fuse-ld=bfd
12038 Use the @command{bfd} linker instead of the default linker.
12040 @item -fuse-ld=gold
12041 @opindex fuse-ld=gold
12042 Use the @command{gold} linker instead of the default linker.
12045 @item -l@var{library}
12046 @itemx -l @var{library}
12048 Search the library named @var{library} when linking. (The second
12049 alternative with the library as a separate argument is only for
12050 POSIX compliance and is not recommended.)
12052 It makes a difference where in the command you write this option; the
12053 linker searches and processes libraries and object files in the order they
12054 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
12055 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
12056 to functions in @samp{z}, those functions may not be loaded.
12058 The linker searches a standard list of directories for the library,
12059 which is actually a file named @file{lib@var{library}.a}. The linker
12060 then uses this file as if it had been specified precisely by name.
12062 The directories searched include several standard system directories
12063 plus any that you specify with @option{-L}.
12065 Normally the files found this way are library files---archive files
12066 whose members are object files. The linker handles an archive file by
12067 scanning through it for members which define symbols that have so far
12068 been referenced but not defined. But if the file that is found is an
12069 ordinary object file, it is linked in the usual fashion. The only
12070 difference between using an @option{-l} option and specifying a file name
12071 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
12072 and searches several directories.
12076 You need this special case of the @option{-l} option in order to
12077 link an Objective-C or Objective-C++ program.
12079 @item -nostartfiles
12080 @opindex nostartfiles
12081 Do not use the standard system startup files when linking.
12082 The standard system libraries are used normally, unless @option{-nostdlib}
12083 or @option{-nodefaultlibs} is used.
12085 @item -nodefaultlibs
12086 @opindex nodefaultlibs
12087 Do not use the standard system libraries when linking.
12088 Only the libraries you specify are passed to the linker, and options
12089 specifying linkage of the system libraries, such as @option{-static-libgcc}
12090 or @option{-shared-libgcc}, are ignored.
12091 The standard startup files are used normally, unless @option{-nostartfiles}
12094 The compiler may generate calls to @code{memcmp},
12095 @code{memset}, @code{memcpy} and @code{memmove}.
12096 These entries are usually resolved by entries in
12097 libc. These entry points should be supplied through some other
12098 mechanism when this option is specified.
12102 Do not use the standard system startup files or libraries when linking.
12103 No startup files and only the libraries you specify are passed to
12104 the linker, and options specifying linkage of the system libraries, such as
12105 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
12107 The compiler may generate calls to @code{memcmp}, @code{memset},
12108 @code{memcpy} and @code{memmove}.
12109 These entries are usually resolved by entries in
12110 libc. These entry points should be supplied through some other
12111 mechanism when this option is specified.
12113 @cindex @option{-lgcc}, use with @option{-nostdlib}
12114 @cindex @option{-nostdlib} and unresolved references
12115 @cindex unresolved references and @option{-nostdlib}
12116 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
12117 @cindex @option{-nodefaultlibs} and unresolved references
12118 @cindex unresolved references and @option{-nodefaultlibs}
12119 One of the standard libraries bypassed by @option{-nostdlib} and
12120 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
12121 which GCC uses to overcome shortcomings of particular machines, or special
12122 needs for some languages.
12123 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
12124 Collection (GCC) Internals},
12125 for more discussion of @file{libgcc.a}.)
12126 In most cases, you need @file{libgcc.a} even when you want to avoid
12127 other standard libraries. In other words, when you specify @option{-nostdlib}
12128 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
12129 This ensures that you have no unresolved references to internal GCC
12130 library subroutines.
12131 (An example of such an internal subroutine is @code{__main}, used to ensure C++
12132 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
12133 GNU Compiler Collection (GCC) Internals}.)
12137 Produce a dynamically linked position independent executable on targets
12138 that support it. For predictable results, you must also specify the same
12139 set of options used for compilation (@option{-fpie}, @option{-fPIE},
12140 or model suboptions) when you specify this linker option.
12144 Don't produce a dynamically linked position independent executable.
12147 @opindex static-pie
12148 Produce a static position independent executable on targets that support
12149 it. A static position independent executable is similar to a static
12150 executable, but can be loaded at any address without a dynamic linker.
12151 For predictable results, you must also specify the same set of options
12152 used for compilation (@option{-fpie}, @option{-fPIE}, or model
12153 suboptions) when you specify this linker option.
12157 Link with the POSIX threads library. This option is supported on
12158 GNU/Linux targets, most other Unix derivatives, and also on
12159 x86 Cygwin and MinGW targets. On some targets this option also sets
12160 flags for the preprocessor, so it should be used consistently for both
12161 compilation and linking.
12165 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
12166 that support it. This instructs the linker to add all symbols, not
12167 only used ones, to the dynamic symbol table. This option is needed
12168 for some uses of @code{dlopen} or to allow obtaining backtraces
12169 from within a program.
12173 Remove all symbol table and relocation information from the executable.
12177 On systems that support dynamic linking, this overrides @option{-pie}
12178 and prevents linking with the shared libraries. On other systems, this
12179 option has no effect.
12183 Produce a shared object which can then be linked with other objects to
12184 form an executable. Not all systems support this option. For predictable
12185 results, you must also specify the same set of options used for compilation
12186 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
12187 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
12188 needs to build supplementary stub code for constructors to work. On
12189 multi-libbed systems, @samp{gcc -shared} must select the correct support
12190 libraries to link against. Failing to supply the correct flags may lead
12191 to subtle defects. Supplying them in cases where they are not necessary
12194 @item -shared-libgcc
12195 @itemx -static-libgcc
12196 @opindex shared-libgcc
12197 @opindex static-libgcc
12198 On systems that provide @file{libgcc} as a shared library, these options
12199 force the use of either the shared or static version, respectively.
12200 If no shared version of @file{libgcc} was built when the compiler was
12201 configured, these options have no effect.
12203 There are several situations in which an application should use the
12204 shared @file{libgcc} instead of the static version. The most common
12205 of these is when the application wishes to throw and catch exceptions
12206 across different shared libraries. In that case, each of the libraries
12207 as well as the application itself should use the shared @file{libgcc}.
12209 Therefore, the G++ and driver automatically adds @option{-shared-libgcc}
12210 whenever you build a shared library or a main executable, because C++
12211 programs typically use exceptions, so this is the right thing to do.
12213 If, instead, you use the GCC driver to create shared libraries, you may
12214 find that they are not always linked with the shared @file{libgcc}.
12215 If GCC finds, at its configuration time, that you have a non-GNU linker
12216 or a GNU linker that does not support option @option{--eh-frame-hdr},
12217 it links the shared version of @file{libgcc} into shared libraries
12218 by default. Otherwise, it takes advantage of the linker and optimizes
12219 away the linking with the shared version of @file{libgcc}, linking with
12220 the static version of libgcc by default. This allows exceptions to
12221 propagate through such shared libraries, without incurring relocation
12222 costs at library load time.
12224 However, if a library or main executable is supposed to throw or catch
12225 exceptions, you must link it using the G++ driver, as appropriate
12226 for the languages used in the program, or using the option
12227 @option{-shared-libgcc}, such that it is linked with the shared
12230 @item -static-libasan
12231 @opindex static-libasan
12232 When the @option{-fsanitize=address} option is used to link a program,
12233 the GCC driver automatically links against @option{libasan}. If
12234 @file{libasan} is available as a shared library, and the @option{-static}
12235 option is not used, then this links against the shared version of
12236 @file{libasan}. The @option{-static-libasan} option directs the GCC
12237 driver to link @file{libasan} statically, without necessarily linking
12238 other libraries statically.
12240 @item -static-libtsan
12241 @opindex static-libtsan
12242 When the @option{-fsanitize=thread} option is used to link a program,
12243 the GCC driver automatically links against @option{libtsan}. If
12244 @file{libtsan} is available as a shared library, and the @option{-static}
12245 option is not used, then this links against the shared version of
12246 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
12247 driver to link @file{libtsan} statically, without necessarily linking
12248 other libraries statically.
12250 @item -static-liblsan
12251 @opindex static-liblsan
12252 When the @option{-fsanitize=leak} option is used to link a program,
12253 the GCC driver automatically links against @option{liblsan}. If
12254 @file{liblsan} is available as a shared library, and the @option{-static}
12255 option is not used, then this links against the shared version of
12256 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
12257 driver to link @file{liblsan} statically, without necessarily linking
12258 other libraries statically.
12260 @item -static-libubsan
12261 @opindex static-libubsan
12262 When the @option{-fsanitize=undefined} option is used to link a program,
12263 the GCC driver automatically links against @option{libubsan}. If
12264 @file{libubsan} is available as a shared library, and the @option{-static}
12265 option is not used, then this links against the shared version of
12266 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
12267 driver to link @file{libubsan} statically, without necessarily linking
12268 other libraries statically.
12270 @item -static-libmpx
12271 @opindex static-libmpx
12272 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
12273 used to link a program, the GCC driver automatically links against
12274 @file{libmpx}. If @file{libmpx} is available as a shared library,
12275 and the @option{-static} option is not used, then this links against
12276 the shared version of @file{libmpx}. The @option{-static-libmpx}
12277 option directs the GCC driver to link @file{libmpx} statically,
12278 without necessarily linking other libraries statically.
12280 @item -static-libmpxwrappers
12281 @opindex static-libmpxwrappers
12282 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
12283 to link a program without also using @option{-fno-chkp-use-wrappers}, the
12284 GCC driver automatically links against @file{libmpxwrappers}. If
12285 @file{libmpxwrappers} is available as a shared library, and the
12286 @option{-static} option is not used, then this links against the shared
12287 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
12288 option directs the GCC driver to link @file{libmpxwrappers} statically,
12289 without necessarily linking other libraries statically.
12291 @item -static-libstdc++
12292 @opindex static-libstdc++
12293 When the @command{g++} program is used to link a C++ program, it
12294 normally automatically links against @option{libstdc++}. If
12295 @file{libstdc++} is available as a shared library, and the
12296 @option{-static} option is not used, then this links against the
12297 shared version of @file{libstdc++}. That is normally fine. However, it
12298 is sometimes useful to freeze the version of @file{libstdc++} used by
12299 the program without going all the way to a fully static link. The
12300 @option{-static-libstdc++} option directs the @command{g++} driver to
12301 link @file{libstdc++} statically, without necessarily linking other
12302 libraries statically.
12306 Bind references to global symbols when building a shared object. Warn
12307 about any unresolved references (unless overridden by the link editor
12308 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
12311 @item -T @var{script}
12313 @cindex linker script
12314 Use @var{script} as the linker script. This option is supported by most
12315 systems using the GNU linker. On some targets, such as bare-board
12316 targets without an operating system, the @option{-T} option may be required
12317 when linking to avoid references to undefined symbols.
12319 @item -Xlinker @var{option}
12321 Pass @var{option} as an option to the linker. You can use this to
12322 supply system-specific linker options that GCC does not recognize.
12324 If you want to pass an option that takes a separate argument, you must use
12325 @option{-Xlinker} twice, once for the option and once for the argument.
12326 For example, to pass @option{-assert definitions}, you must write
12327 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
12328 @option{-Xlinker "-assert definitions"}, because this passes the entire
12329 string as a single argument, which is not what the linker expects.
12331 When using the GNU linker, it is usually more convenient to pass
12332 arguments to linker options using the @option{@var{option}=@var{value}}
12333 syntax than as separate arguments. For example, you can specify
12334 @option{-Xlinker -Map=output.map} rather than
12335 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
12336 this syntax for command-line options.
12338 @item -Wl,@var{option}
12340 Pass @var{option} as an option to the linker. If @var{option} contains
12341 commas, it is split into multiple options at the commas. You can use this
12342 syntax to pass an argument to the option.
12343 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
12344 linker. When using the GNU linker, you can also get the same effect with
12345 @option{-Wl,-Map=output.map}.
12347 @item -u @var{symbol}
12349 Pretend the symbol @var{symbol} is undefined, to force linking of
12350 library modules to define it. You can use @option{-u} multiple times with
12351 different symbols to force loading of additional library modules.
12353 @item -z @var{keyword}
12355 @option{-z} is passed directly on to the linker along with the keyword
12356 @var{keyword}. See the section in the documentation of your linker for
12357 permitted values and their meanings.
12360 @node Directory Options
12361 @section Options for Directory Search
12362 @cindex directory options
12363 @cindex options, directory search
12364 @cindex search path
12366 These options specify directories to search for header files, for
12367 libraries and for parts of the compiler:
12370 @include cppdiropts.texi
12372 @item -iplugindir=@var{dir}
12373 @opindex iplugindir=
12374 Set the directory to search for plugins that are passed
12375 by @option{-fplugin=@var{name}} instead of
12376 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
12377 to be used by the user, but only passed by the driver.
12381 Add directory @var{dir} to the list of directories to be searched
12384 @item -B@var{prefix}
12386 This option specifies where to find the executables, libraries,
12387 include files, and data files of the compiler itself.
12389 The compiler driver program runs one or more of the subprograms
12390 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
12391 @var{prefix} as a prefix for each program it tries to run, both with and
12392 without @samp{@var{machine}/@var{version}/} for the corresponding target
12393 machine and compiler version.
12395 For each subprogram to be run, the compiler driver first tries the
12396 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
12397 is not specified, the driver tries two standard prefixes,
12398 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
12399 those results in a file name that is found, the unmodified program
12400 name is searched for using the directories specified in your
12401 @env{PATH} environment variable.
12403 The compiler checks to see if the path provided by @option{-B}
12404 refers to a directory, and if necessary it adds a directory
12405 separator character at the end of the path.
12407 @option{-B} prefixes that effectively specify directory names also apply
12408 to libraries in the linker, because the compiler translates these
12409 options into @option{-L} options for the linker. They also apply to
12410 include files in the preprocessor, because the compiler translates these
12411 options into @option{-isystem} options for the preprocessor. In this case,
12412 the compiler appends @samp{include} to the prefix.
12414 The runtime support file @file{libgcc.a} can also be searched for using
12415 the @option{-B} prefix, if needed. If it is not found there, the two
12416 standard prefixes above are tried, and that is all. The file is left
12417 out of the link if it is not found by those means.
12419 Another way to specify a prefix much like the @option{-B} prefix is to use
12420 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
12423 As a special kludge, if the path provided by @option{-B} is
12424 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
12425 9, then it is replaced by @file{[dir/]include}. This is to help
12426 with boot-strapping the compiler.
12428 @item -no-canonical-prefixes
12429 @opindex no-canonical-prefixes
12430 Do not expand any symbolic links, resolve references to @samp{/../}
12431 or @samp{/./}, or make the path absolute when generating a relative
12434 @item --sysroot=@var{dir}
12436 Use @var{dir} as the logical root directory for headers and libraries.
12437 For example, if the compiler normally searches for headers in
12438 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
12439 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
12441 If you use both this option and the @option{-isysroot} option, then
12442 the @option{--sysroot} option applies to libraries, but the
12443 @option{-isysroot} option applies to header files.
12445 The GNU linker (beginning with version 2.16) has the necessary support
12446 for this option. If your linker does not support this option, the
12447 header file aspect of @option{--sysroot} still works, but the
12448 library aspect does not.
12450 @item --no-sysroot-suffix
12451 @opindex no-sysroot-suffix
12452 For some targets, a suffix is added to the root directory specified
12453 with @option{--sysroot}, depending on the other options used, so that
12454 headers may for example be found in
12455 @file{@var{dir}/@var{suffix}/usr/include} instead of
12456 @file{@var{dir}/usr/include}. This option disables the addition of
12461 @node Code Gen Options
12462 @section Options for Code Generation Conventions
12463 @cindex code generation conventions
12464 @cindex options, code generation
12465 @cindex run-time options
12467 These machine-independent options control the interface conventions
12468 used in code generation.
12470 Most of them have both positive and negative forms; the negative form
12471 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
12472 one of the forms is listed---the one that is not the default. You
12473 can figure out the other form by either removing @samp{no-} or adding
12477 @item -fstack-reuse=@var{reuse-level}
12478 @opindex fstack_reuse
12479 This option controls stack space reuse for user declared local/auto variables
12480 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
12481 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
12482 local variables and temporaries, @samp{named_vars} enables the reuse only for
12483 user defined local variables with names, and @samp{none} disables stack reuse
12484 completely. The default value is @samp{all}. The option is needed when the
12485 program extends the lifetime of a scoped local variable or a compiler generated
12486 temporary beyond the end point defined by the language. When a lifetime of
12487 a variable ends, and if the variable lives in memory, the optimizing compiler
12488 has the freedom to reuse its stack space with other temporaries or scoped
12489 local variables whose live range does not overlap with it. Legacy code extending
12490 local lifetime is likely to break with the stack reuse optimization.
12509 if (*p == 10) // out of scope use of local1
12520 A(int k) : i(k), j(k) @{ @}
12527 void foo(const A& ar)
12534 foo(A(10)); // temp object's lifetime ends when foo returns
12540 ap->i+= 10; // ap references out of scope temp whose space
12541 // is reused with a. What is the value of ap->i?
12546 The lifetime of a compiler generated temporary is well defined by the C++
12547 standard. When a lifetime of a temporary ends, and if the temporary lives
12548 in memory, the optimizing compiler has the freedom to reuse its stack
12549 space with other temporaries or scoped local variables whose live range
12550 does not overlap with it. However some of the legacy code relies on
12551 the behavior of older compilers in which temporaries' stack space is
12552 not reused, the aggressive stack reuse can lead to runtime errors. This
12553 option is used to control the temporary stack reuse optimization.
12557 This option generates traps for signed overflow on addition, subtraction,
12558 multiplication operations.
12559 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12560 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12561 @option{-fwrapv} being effective. Note that only active options override, so
12562 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12563 results in @option{-ftrapv} being effective.
12567 This option instructs the compiler to assume that signed arithmetic
12568 overflow of addition, subtraction and multiplication wraps around
12569 using twos-complement representation. This flag enables some optimizations
12570 and disables others.
12571 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12572 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12573 @option{-fwrapv} being effective. Note that only active options override, so
12574 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12575 results in @option{-ftrapv} being effective.
12578 @opindex fexceptions
12579 Enable exception handling. Generates extra code needed to propagate
12580 exceptions. For some targets, this implies GCC generates frame
12581 unwind information for all functions, which can produce significant data
12582 size overhead, although it does not affect execution. If you do not
12583 specify this option, GCC enables it by default for languages like
12584 C++ that normally require exception handling, and disables it for
12585 languages like C that do not normally require it. However, you may need
12586 to enable this option when compiling C code that needs to interoperate
12587 properly with exception handlers written in C++. You may also wish to
12588 disable this option if you are compiling older C++ programs that don't
12589 use exception handling.
12591 @item -fnon-call-exceptions
12592 @opindex fnon-call-exceptions
12593 Generate code that allows trapping instructions to throw exceptions.
12594 Note that this requires platform-specific runtime support that does
12595 not exist everywhere. Moreover, it only allows @emph{trapping}
12596 instructions to throw exceptions, i.e.@: memory references or floating-point
12597 instructions. It does not allow exceptions to be thrown from
12598 arbitrary signal handlers such as @code{SIGALRM}.
12600 @item -fdelete-dead-exceptions
12601 @opindex fdelete-dead-exceptions
12602 Consider that instructions that may throw exceptions but don't otherwise
12603 contribute to the execution of the program can be optimized away.
12604 This option is enabled by default for the Ada front end, as permitted by
12605 the Ada language specification.
12606 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
12608 @item -funwind-tables
12609 @opindex funwind-tables
12610 Similar to @option{-fexceptions}, except that it just generates any needed
12611 static data, but does not affect the generated code in any other way.
12612 You normally do not need to enable this option; instead, a language processor
12613 that needs this handling enables it on your behalf.
12615 @item -fasynchronous-unwind-tables
12616 @opindex fasynchronous-unwind-tables
12617 Generate unwind table in DWARF format, if supported by target machine. The
12618 table is exact at each instruction boundary, so it can be used for stack
12619 unwinding from asynchronous events (such as debugger or garbage collector).
12621 @item -fno-gnu-unique
12622 @opindex fno-gnu-unique
12623 On systems with recent GNU assembler and C library, the C++ compiler
12624 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
12625 of template static data members and static local variables in inline
12626 functions are unique even in the presence of @code{RTLD_LOCAL}; this
12627 is necessary to avoid problems with a library used by two different
12628 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
12629 therefore disagreeing with the other one about the binding of the
12630 symbol. But this causes @code{dlclose} to be ignored for affected
12631 DSOs; if your program relies on reinitialization of a DSO via
12632 @code{dlclose} and @code{dlopen}, you can use
12633 @option{-fno-gnu-unique}.
12635 @item -fpcc-struct-return
12636 @opindex fpcc-struct-return
12637 Return ``short'' @code{struct} and @code{union} values in memory like
12638 longer ones, rather than in registers. This convention is less
12639 efficient, but it has the advantage of allowing intercallability between
12640 GCC-compiled files and files compiled with other compilers, particularly
12641 the Portable C Compiler (pcc).
12643 The precise convention for returning structures in memory depends
12644 on the target configuration macros.
12646 Short structures and unions are those whose size and alignment match
12647 that of some integer type.
12649 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
12650 switch is not binary compatible with code compiled with the
12651 @option{-freg-struct-return} switch.
12652 Use it to conform to a non-default application binary interface.
12654 @item -freg-struct-return
12655 @opindex freg-struct-return
12656 Return @code{struct} and @code{union} values in registers when possible.
12657 This is more efficient for small structures than
12658 @option{-fpcc-struct-return}.
12660 If you specify neither @option{-fpcc-struct-return} nor
12661 @option{-freg-struct-return}, GCC defaults to whichever convention is
12662 standard for the target. If there is no standard convention, GCC
12663 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
12664 the principal compiler. In those cases, we can choose the standard, and
12665 we chose the more efficient register return alternative.
12667 @strong{Warning:} code compiled with the @option{-freg-struct-return}
12668 switch is not binary compatible with code compiled with the
12669 @option{-fpcc-struct-return} switch.
12670 Use it to conform to a non-default application binary interface.
12672 @item -fshort-enums
12673 @opindex fshort-enums
12674 Allocate to an @code{enum} type only as many bytes as it needs for the
12675 declared range of possible values. Specifically, the @code{enum} type
12676 is equivalent to the smallest integer type that has enough room.
12678 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
12679 code that is not binary compatible with code generated without that switch.
12680 Use it to conform to a non-default application binary interface.
12682 @item -fshort-wchar
12683 @opindex fshort-wchar
12684 Override the underlying type for @code{wchar_t} to be @code{short
12685 unsigned int} instead of the default for the target. This option is
12686 useful for building programs to run under WINE@.
12688 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
12689 code that is not binary compatible with code generated without that switch.
12690 Use it to conform to a non-default application binary interface.
12693 @opindex fno-common
12694 @cindex tentative definitions
12695 In C code, this option controls the placement of global variables
12696 defined without an initializer, known as @dfn{tentative definitions}
12697 in the C standard. Tentative definitions are distinct from declarations
12698 of a variable with the @code{extern} keyword, which do not allocate storage.
12700 Unix C compilers have traditionally allocated storage for
12701 uninitialized global variables in a common block. This allows the
12702 linker to resolve all tentative definitions of the same variable
12703 in different compilation units to the same object, or to a non-tentative
12705 This is the behavior specified by @option{-fcommon}, and is the default for
12706 GCC on most targets.
12707 On the other hand, this behavior is not required by ISO
12708 C, and on some targets may carry a speed or code size penalty on
12709 variable references.
12711 The @option{-fno-common} option specifies that the compiler should instead
12712 place uninitialized global variables in the data section of the object file.
12713 This inhibits the merging of tentative definitions by the linker so
12714 you get a multiple-definition error if the same
12715 variable is defined in more than one compilation unit.
12716 Compiling with @option{-fno-common} is useful on targets for which
12717 it provides better performance, or if you wish to verify that the
12718 program will work on other systems that always treat uninitialized
12719 variable definitions this way.
12723 Ignore the @code{#ident} directive.
12725 @item -finhibit-size-directive
12726 @opindex finhibit-size-directive
12727 Don't output a @code{.size} assembler directive, or anything else that
12728 would cause trouble if the function is split in the middle, and the
12729 two halves are placed at locations far apart in memory. This option is
12730 used when compiling @file{crtstuff.c}; you should not need to use it
12733 @item -fverbose-asm
12734 @opindex fverbose-asm
12735 Put extra commentary information in the generated assembly code to
12736 make it more readable. This option is generally only of use to those
12737 who actually need to read the generated assembly code (perhaps while
12738 debugging the compiler itself).
12740 @option{-fno-verbose-asm}, the default, causes the
12741 extra information to be omitted and is useful when comparing two assembler
12744 The added comments include:
12749 information on the compiler version and command-line options,
12752 the source code lines associated with the assembly instructions,
12753 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12756 hints on which high-level expressions correspond to
12757 the various assembly instruction operands.
12761 For example, given this C source file:
12769 for (i = 0; i < n; i++)
12776 compiling to (x86_64) assembly via @option{-S} and emitting the result
12777 direct to stdout via @option{-o} @option{-}
12780 gcc -S test.c -fverbose-asm -Os -o -
12783 gives output similar to this:
12787 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12794 .type test, @@function
12798 # test.c:4: int total = 0;
12799 xorl %eax, %eax # <retval>
12800 # test.c:6: for (i = 0; i < n; i++)
12801 xorl %edx, %edx # i
12803 # test.c:6: for (i = 0; i < n; i++)
12804 cmpl %edi, %edx # n, i
12806 # test.c:7: total += i * i;
12807 movl %edx, %ecx # i, tmp92
12808 imull %edx, %ecx # i, tmp92
12809 # test.c:6: for (i = 0; i < n; i++)
12811 # test.c:7: total += i * i;
12812 addl %ecx, %eax # tmp92, <retval>
12820 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
12821 .section .note.GNU-stack,"",@@progbits
12824 The comments are intended for humans rather than machines and hence the
12825 precise format of the comments is subject to change.
12827 @item -frecord-gcc-switches
12828 @opindex frecord-gcc-switches
12829 This switch causes the command line used to invoke the
12830 compiler to be recorded into the object file that is being created.
12831 This switch is only implemented on some targets and the exact format
12832 of the recording is target and binary file format dependent, but it
12833 usually takes the form of a section containing ASCII text. This
12834 switch is related to the @option{-fverbose-asm} switch, but that
12835 switch only records information in the assembler output file as
12836 comments, so it never reaches the object file.
12837 See also @option{-grecord-gcc-switches} for another
12838 way of storing compiler options into the object file.
12842 @cindex global offset table
12844 Generate position-independent code (PIC) suitable for use in a shared
12845 library, if supported for the target machine. Such code accesses all
12846 constant addresses through a global offset table (GOT)@. The dynamic
12847 loader resolves the GOT entries when the program starts (the dynamic
12848 loader is not part of GCC; it is part of the operating system). If
12849 the GOT size for the linked executable exceeds a machine-specific
12850 maximum size, you get an error message from the linker indicating that
12851 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
12852 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
12853 on the m68k and RS/6000. The x86 has no such limit.)
12855 Position-independent code requires special support, and therefore works
12856 only on certain machines. For the x86, GCC supports PIC for System V
12857 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
12858 position-independent.
12860 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12865 If supported for the target machine, emit position-independent code,
12866 suitable for dynamic linking and avoiding any limit on the size of the
12867 global offset table. This option makes a difference on AArch64, m68k,
12868 PowerPC and SPARC@.
12870 Position-independent code requires special support, and therefore works
12871 only on certain machines.
12873 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12880 These options are similar to @option{-fpic} and @option{-fPIC}, but
12881 generated position independent code can be only linked into executables.
12882 Usually these options are used when @option{-pie} GCC option is
12883 used during linking.
12885 @option{-fpie} and @option{-fPIE} both define the macros
12886 @code{__pie__} and @code{__PIE__}. The macros have the value 1
12887 for @option{-fpie} and 2 for @option{-fPIE}.
12891 Do not use the PLT for external function calls in position-independent code.
12892 Instead, load the callee address at call sites from the GOT and branch to it.
12893 This leads to more efficient code by eliminating PLT stubs and exposing
12894 GOT loads to optimizations. On architectures such as 32-bit x86 where
12895 PLT stubs expect the GOT pointer in a specific register, this gives more
12896 register allocation freedom to the compiler.
12897 Lazy binding requires use of the PLT;
12898 with @option{-fno-plt} all external symbols are resolved at load time.
12900 Alternatively, the function attribute @code{noplt} can be used to avoid calls
12901 through the PLT for specific external functions.
12903 In position-dependent code, a few targets also convert calls to
12904 functions that are marked to not use the PLT to use the GOT instead.
12906 @item -fno-jump-tables
12907 @opindex fno-jump-tables
12908 Do not use jump tables for switch statements even where it would be
12909 more efficient than other code generation strategies. This option is
12910 of use in conjunction with @option{-fpic} or @option{-fPIC} for
12911 building code that forms part of a dynamic linker and cannot
12912 reference the address of a jump table. On some targets, jump tables
12913 do not require a GOT and this option is not needed.
12915 @item -ffixed-@var{reg}
12917 Treat the register named @var{reg} as a fixed register; generated code
12918 should never refer to it (except perhaps as a stack pointer, frame
12919 pointer or in some other fixed role).
12921 @var{reg} must be the name of a register. The register names accepted
12922 are machine-specific and are defined in the @code{REGISTER_NAMES}
12923 macro in the machine description macro file.
12925 This flag does not have a negative form, because it specifies a
12928 @item -fcall-used-@var{reg}
12929 @opindex fcall-used
12930 Treat the register named @var{reg} as an allocable register that is
12931 clobbered by function calls. It may be allocated for temporaries or
12932 variables that do not live across a call. Functions compiled this way
12933 do not save and restore the register @var{reg}.
12935 It is an error to use this flag with the frame pointer or stack pointer.
12936 Use of this flag for other registers that have fixed pervasive roles in
12937 the machine's execution model produces disastrous results.
12939 This flag does not have a negative form, because it specifies a
12942 @item -fcall-saved-@var{reg}
12943 @opindex fcall-saved
12944 Treat the register named @var{reg} as an allocable register saved by
12945 functions. It may be allocated even for temporaries or variables that
12946 live across a call. Functions compiled this way save and restore
12947 the register @var{reg} if they use it.
12949 It is an error to use this flag with the frame pointer or stack pointer.
12950 Use of this flag for other registers that have fixed pervasive roles in
12951 the machine's execution model produces disastrous results.
12953 A different sort of disaster results from the use of this flag for
12954 a register in which function values may be returned.
12956 This flag does not have a negative form, because it specifies a
12959 @item -fpack-struct[=@var{n}]
12960 @opindex fpack-struct
12961 Without a value specified, pack all structure members together without
12962 holes. When a value is specified (which must be a small power of two), pack
12963 structure members according to this value, representing the maximum
12964 alignment (that is, objects with default alignment requirements larger than
12965 this are output potentially unaligned at the next fitting location.
12967 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
12968 code that is not binary compatible with code generated without that switch.
12969 Additionally, it makes the code suboptimal.
12970 Use it to conform to a non-default application binary interface.
12972 @item -fleading-underscore
12973 @opindex fleading-underscore
12974 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
12975 change the way C symbols are represented in the object file. One use
12976 is to help link with legacy assembly code.
12978 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
12979 generate code that is not binary compatible with code generated without that
12980 switch. Use it to conform to a non-default application binary interface.
12981 Not all targets provide complete support for this switch.
12983 @item -ftls-model=@var{model}
12984 @opindex ftls-model
12985 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
12986 The @var{model} argument should be one of @samp{global-dynamic},
12987 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
12988 Note that the choice is subject to optimization: the compiler may use
12989 a more efficient model for symbols not visible outside of the translation
12990 unit, or if @option{-fpic} is not given on the command line.
12992 The default without @option{-fpic} is @samp{initial-exec}; with
12993 @option{-fpic} the default is @samp{global-dynamic}.
12995 @item -ftrampolines
12996 @opindex ftrampolines
12997 For targets that normally need trampolines for nested functions, always
12998 generate them instead of using descriptors. Otherwise, for targets that
12999 do not need them, like for example HP-PA or IA-64, do nothing.
13001 A trampoline is a small piece of code that is created at run time on the
13002 stack when the address of a nested function is taken, and is used to call
13003 the nested function indirectly. Therefore, it requires the stack to be
13004 made executable in order for the program to work properly.
13006 @option{-fno-trampolines} is enabled by default on a language by language
13007 basis to let the compiler avoid generating them, if it computes that this
13008 is safe, and replace them with descriptors. Descriptors are made up of data
13009 only, but the generated code must be prepared to deal with them. As of this
13010 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13012 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13013 @option{-fno-trampolines} are not binary compatible if nested functions are
13014 present. This option must therefore be used on a program-wide basis and be
13015 manipulated with extreme care.
13017 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13018 @opindex fvisibility
13019 Set the default ELF image symbol visibility to the specified option---all
13020 symbols are marked with this unless overridden within the code.
13021 Using this feature can very substantially improve linking and
13022 load times of shared object libraries, produce more optimized
13023 code, provide near-perfect API export and prevent symbol clashes.
13024 It is @strong{strongly} recommended that you use this in any shared objects
13027 Despite the nomenclature, @samp{default} always means public; i.e.,
13028 available to be linked against from outside the shared object.
13029 @samp{protected} and @samp{internal} are pretty useless in real-world
13030 usage so the only other commonly used option is @samp{hidden}.
13031 The default if @option{-fvisibility} isn't specified is
13032 @samp{default}, i.e., make every symbol public.
13034 A good explanation of the benefits offered by ensuring ELF
13035 symbols have the correct visibility is given by ``How To Write
13036 Shared Libraries'' by Ulrich Drepper (which can be found at
13037 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
13038 solution made possible by this option to marking things hidden when
13039 the default is public is to make the default hidden and mark things
13040 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
13041 and @code{__attribute__ ((visibility("default")))} instead of
13042 @code{__declspec(dllexport)} you get almost identical semantics with
13043 identical syntax. This is a great boon to those working with
13044 cross-platform projects.
13046 For those adding visibility support to existing code, you may find
13047 @code{#pragma GCC visibility} of use. This works by you enclosing
13048 the declarations you wish to set visibility for with (for example)
13049 @code{#pragma GCC visibility push(hidden)} and
13050 @code{#pragma GCC visibility pop}.
13051 Bear in mind that symbol visibility should be viewed @strong{as
13052 part of the API interface contract} and thus all new code should
13053 always specify visibility when it is not the default; i.e., declarations
13054 only for use within the local DSO should @strong{always} be marked explicitly
13055 as hidden as so to avoid PLT indirection overheads---making this
13056 abundantly clear also aids readability and self-documentation of the code.
13057 Note that due to ISO C++ specification requirements, @code{operator new} and
13058 @code{operator delete} must always be of default visibility.
13060 Be aware that headers from outside your project, in particular system
13061 headers and headers from any other library you use, may not be
13062 expecting to be compiled with visibility other than the default. You
13063 may need to explicitly say @code{#pragma GCC visibility push(default)}
13064 before including any such headers.
13066 @code{extern} declarations are not affected by @option{-fvisibility}, so
13067 a lot of code can be recompiled with @option{-fvisibility=hidden} with
13068 no modifications. However, this means that calls to @code{extern}
13069 functions with no explicit visibility use the PLT, so it is more
13070 effective to use @code{__attribute ((visibility))} and/or
13071 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
13072 declarations should be treated as hidden.
13074 Note that @option{-fvisibility} does affect C++ vague linkage
13075 entities. This means that, for instance, an exception class that is
13076 be thrown between DSOs must be explicitly marked with default
13077 visibility so that the @samp{type_info} nodes are unified between
13080 An overview of these techniques, their benefits and how to use them
13081 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
13083 @item -fstrict-volatile-bitfields
13084 @opindex fstrict-volatile-bitfields
13085 This option should be used if accesses to volatile bit-fields (or other
13086 structure fields, although the compiler usually honors those types
13087 anyway) should use a single access of the width of the
13088 field's type, aligned to a natural alignment if possible. For
13089 example, targets with memory-mapped peripheral registers might require
13090 all such accesses to be 16 bits wide; with this flag you can
13091 declare all peripheral bit-fields as @code{unsigned short} (assuming short
13092 is 16 bits on these targets) to force GCC to use 16-bit accesses
13093 instead of, perhaps, a more efficient 32-bit access.
13095 If this option is disabled, the compiler uses the most efficient
13096 instruction. In the previous example, that might be a 32-bit load
13097 instruction, even though that accesses bytes that do not contain
13098 any portion of the bit-field, or memory-mapped registers unrelated to
13099 the one being updated.
13101 In some cases, such as when the @code{packed} attribute is applied to a
13102 structure field, it may not be possible to access the field with a single
13103 read or write that is correctly aligned for the target machine. In this
13104 case GCC falls back to generating multiple accesses rather than code that
13105 will fault or truncate the result at run time.
13107 Note: Due to restrictions of the C/C++11 memory model, write accesses are
13108 not allowed to touch non bit-field members. It is therefore recommended
13109 to define all bits of the field's type as bit-field members.
13111 The default value of this option is determined by the application binary
13112 interface for the target processor.
13114 @item -fsync-libcalls
13115 @opindex fsync-libcalls
13116 This option controls whether any out-of-line instance of the @code{__sync}
13117 family of functions may be used to implement the C++11 @code{__atomic}
13118 family of functions.
13120 The default value of this option is enabled, thus the only useful form
13121 of the option is @option{-fno-sync-libcalls}. This option is used in
13122 the implementation of the @file{libatomic} runtime library.
13126 @node Developer Options
13127 @section GCC Developer Options
13128 @cindex developer options
13129 @cindex debugging GCC
13130 @cindex debug dump options
13131 @cindex dump options
13132 @cindex compilation statistics
13134 This section describes command-line options that are primarily of
13135 interest to GCC developers, including options to support compiler
13136 testing and investigation of compiler bugs and compile-time
13137 performance problems. This includes options that produce debug dumps
13138 at various points in the compilation; that print statistics such as
13139 memory use and execution time; and that print information about GCC's
13140 configuration, such as where it searches for libraries. You should
13141 rarely need to use any of these options for ordinary compilation and
13146 @item -d@var{letters}
13147 @itemx -fdump-rtl-@var{pass}
13148 @itemx -fdump-rtl-@var{pass}=@var{filename}
13150 @opindex fdump-rtl-@var{pass}
13151 Says to make debugging dumps during compilation at times specified by
13152 @var{letters}. This is used for debugging the RTL-based passes of the
13153 compiler. The file names for most of the dumps are made by appending
13154 a pass number and a word to the @var{dumpname}, and the files are
13155 created in the directory of the output file. In case of
13156 @option{=@var{filename}} option, the dump is output on the given file
13157 instead of the pass numbered dump files. Note that the pass number is
13158 assigned as passes are registered into the pass manager. Most passes
13159 are registered in the order that they will execute and for these passes
13160 the number corresponds to the pass execution order. However, passes
13161 registered by plugins, passes specific to compilation targets, or
13162 passes that are otherwise registered after all the other passes are
13163 numbered higher than a pass named "final", even if they are executed
13164 earlier. @var{dumpname} is generated from the name of the output
13165 file if explicitly specified and not an executable, otherwise it is
13166 the basename of the source file.
13168 Some @option{-d@var{letters}} switches have different meaning when
13169 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
13170 for information about preprocessor-specific dump options.
13172 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
13173 @option{-d} option @var{letters}. Here are the possible
13174 letters for use in @var{pass} and @var{letters}, and their meanings:
13178 @item -fdump-rtl-alignments
13179 @opindex fdump-rtl-alignments
13180 Dump after branch alignments have been computed.
13182 @item -fdump-rtl-asmcons
13183 @opindex fdump-rtl-asmcons
13184 Dump after fixing rtl statements that have unsatisfied in/out constraints.
13186 @item -fdump-rtl-auto_inc_dec
13187 @opindex fdump-rtl-auto_inc_dec
13188 Dump after auto-inc-dec discovery. This pass is only run on
13189 architectures that have auto inc or auto dec instructions.
13191 @item -fdump-rtl-barriers
13192 @opindex fdump-rtl-barriers
13193 Dump after cleaning up the barrier instructions.
13195 @item -fdump-rtl-bbpart
13196 @opindex fdump-rtl-bbpart
13197 Dump after partitioning hot and cold basic blocks.
13199 @item -fdump-rtl-bbro
13200 @opindex fdump-rtl-bbro
13201 Dump after block reordering.
13203 @item -fdump-rtl-btl1
13204 @itemx -fdump-rtl-btl2
13205 @opindex fdump-rtl-btl2
13206 @opindex fdump-rtl-btl2
13207 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
13208 after the two branch
13209 target load optimization passes.
13211 @item -fdump-rtl-bypass
13212 @opindex fdump-rtl-bypass
13213 Dump after jump bypassing and control flow optimizations.
13215 @item -fdump-rtl-combine
13216 @opindex fdump-rtl-combine
13217 Dump after the RTL instruction combination pass.
13219 @item -fdump-rtl-compgotos
13220 @opindex fdump-rtl-compgotos
13221 Dump after duplicating the computed gotos.
13223 @item -fdump-rtl-ce1
13224 @itemx -fdump-rtl-ce2
13225 @itemx -fdump-rtl-ce3
13226 @opindex fdump-rtl-ce1
13227 @opindex fdump-rtl-ce2
13228 @opindex fdump-rtl-ce3
13229 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
13230 @option{-fdump-rtl-ce3} enable dumping after the three
13231 if conversion passes.
13233 @item -fdump-rtl-cprop_hardreg
13234 @opindex fdump-rtl-cprop_hardreg
13235 Dump after hard register copy propagation.
13237 @item -fdump-rtl-csa
13238 @opindex fdump-rtl-csa
13239 Dump after combining stack adjustments.
13241 @item -fdump-rtl-cse1
13242 @itemx -fdump-rtl-cse2
13243 @opindex fdump-rtl-cse1
13244 @opindex fdump-rtl-cse2
13245 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
13246 the two common subexpression elimination passes.
13248 @item -fdump-rtl-dce
13249 @opindex fdump-rtl-dce
13250 Dump after the standalone dead code elimination passes.
13252 @item -fdump-rtl-dbr
13253 @opindex fdump-rtl-dbr
13254 Dump after delayed branch scheduling.
13256 @item -fdump-rtl-dce1
13257 @itemx -fdump-rtl-dce2
13258 @opindex fdump-rtl-dce1
13259 @opindex fdump-rtl-dce2
13260 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
13261 the two dead store elimination passes.
13263 @item -fdump-rtl-eh
13264 @opindex fdump-rtl-eh
13265 Dump after finalization of EH handling code.
13267 @item -fdump-rtl-eh_ranges
13268 @opindex fdump-rtl-eh_ranges
13269 Dump after conversion of EH handling range regions.
13271 @item -fdump-rtl-expand
13272 @opindex fdump-rtl-expand
13273 Dump after RTL generation.
13275 @item -fdump-rtl-fwprop1
13276 @itemx -fdump-rtl-fwprop2
13277 @opindex fdump-rtl-fwprop1
13278 @opindex fdump-rtl-fwprop2
13279 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
13280 dumping after the two forward propagation passes.
13282 @item -fdump-rtl-gcse1
13283 @itemx -fdump-rtl-gcse2
13284 @opindex fdump-rtl-gcse1
13285 @opindex fdump-rtl-gcse2
13286 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
13287 after global common subexpression elimination.
13289 @item -fdump-rtl-init-regs
13290 @opindex fdump-rtl-init-regs
13291 Dump after the initialization of the registers.
13293 @item -fdump-rtl-initvals
13294 @opindex fdump-rtl-initvals
13295 Dump after the computation of the initial value sets.
13297 @item -fdump-rtl-into_cfglayout
13298 @opindex fdump-rtl-into_cfglayout
13299 Dump after converting to cfglayout mode.
13301 @item -fdump-rtl-ira
13302 @opindex fdump-rtl-ira
13303 Dump after iterated register allocation.
13305 @item -fdump-rtl-jump
13306 @opindex fdump-rtl-jump
13307 Dump after the second jump optimization.
13309 @item -fdump-rtl-loop2
13310 @opindex fdump-rtl-loop2
13311 @option{-fdump-rtl-loop2} enables dumping after the rtl
13312 loop optimization passes.
13314 @item -fdump-rtl-mach
13315 @opindex fdump-rtl-mach
13316 Dump after performing the machine dependent reorganization pass, if that
13319 @item -fdump-rtl-mode_sw
13320 @opindex fdump-rtl-mode_sw
13321 Dump after removing redundant mode switches.
13323 @item -fdump-rtl-rnreg
13324 @opindex fdump-rtl-rnreg
13325 Dump after register renumbering.
13327 @item -fdump-rtl-outof_cfglayout
13328 @opindex fdump-rtl-outof_cfglayout
13329 Dump after converting from cfglayout mode.
13331 @item -fdump-rtl-peephole2
13332 @opindex fdump-rtl-peephole2
13333 Dump after the peephole pass.
13335 @item -fdump-rtl-postreload
13336 @opindex fdump-rtl-postreload
13337 Dump after post-reload optimizations.
13339 @item -fdump-rtl-pro_and_epilogue
13340 @opindex fdump-rtl-pro_and_epilogue
13341 Dump after generating the function prologues and epilogues.
13343 @item -fdump-rtl-sched1
13344 @itemx -fdump-rtl-sched2
13345 @opindex fdump-rtl-sched1
13346 @opindex fdump-rtl-sched2
13347 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
13348 after the basic block scheduling passes.
13350 @item -fdump-rtl-ree
13351 @opindex fdump-rtl-ree
13352 Dump after sign/zero extension elimination.
13354 @item -fdump-rtl-seqabstr
13355 @opindex fdump-rtl-seqabstr
13356 Dump after common sequence discovery.
13358 @item -fdump-rtl-shorten
13359 @opindex fdump-rtl-shorten
13360 Dump after shortening branches.
13362 @item -fdump-rtl-sibling
13363 @opindex fdump-rtl-sibling
13364 Dump after sibling call optimizations.
13366 @item -fdump-rtl-split1
13367 @itemx -fdump-rtl-split2
13368 @itemx -fdump-rtl-split3
13369 @itemx -fdump-rtl-split4
13370 @itemx -fdump-rtl-split5
13371 @opindex fdump-rtl-split1
13372 @opindex fdump-rtl-split2
13373 @opindex fdump-rtl-split3
13374 @opindex fdump-rtl-split4
13375 @opindex fdump-rtl-split5
13376 These options enable dumping after five rounds of
13377 instruction splitting.
13379 @item -fdump-rtl-sms
13380 @opindex fdump-rtl-sms
13381 Dump after modulo scheduling. This pass is only run on some
13384 @item -fdump-rtl-stack
13385 @opindex fdump-rtl-stack
13386 Dump after conversion from GCC's ``flat register file'' registers to the
13387 x87's stack-like registers. This pass is only run on x86 variants.
13389 @item -fdump-rtl-subreg1
13390 @itemx -fdump-rtl-subreg2
13391 @opindex fdump-rtl-subreg1
13392 @opindex fdump-rtl-subreg2
13393 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
13394 the two subreg expansion passes.
13396 @item -fdump-rtl-unshare
13397 @opindex fdump-rtl-unshare
13398 Dump after all rtl has been unshared.
13400 @item -fdump-rtl-vartrack
13401 @opindex fdump-rtl-vartrack
13402 Dump after variable tracking.
13404 @item -fdump-rtl-vregs
13405 @opindex fdump-rtl-vregs
13406 Dump after converting virtual registers to hard registers.
13408 @item -fdump-rtl-web
13409 @opindex fdump-rtl-web
13410 Dump after live range splitting.
13412 @item -fdump-rtl-regclass
13413 @itemx -fdump-rtl-subregs_of_mode_init
13414 @itemx -fdump-rtl-subregs_of_mode_finish
13415 @itemx -fdump-rtl-dfinit
13416 @itemx -fdump-rtl-dfinish
13417 @opindex fdump-rtl-regclass
13418 @opindex fdump-rtl-subregs_of_mode_init
13419 @opindex fdump-rtl-subregs_of_mode_finish
13420 @opindex fdump-rtl-dfinit
13421 @opindex fdump-rtl-dfinish
13422 These dumps are defined but always produce empty files.
13425 @itemx -fdump-rtl-all
13427 @opindex fdump-rtl-all
13428 Produce all the dumps listed above.
13432 Annotate the assembler output with miscellaneous debugging information.
13436 Dump all macro definitions, at the end of preprocessing, in addition to
13441 Produce a core dump whenever an error occurs.
13445 Annotate the assembler output with a comment indicating which
13446 pattern and alternative is used. The length and cost of each instruction are
13451 Dump the RTL in the assembler output as a comment before each instruction.
13452 Also turns on @option{-dp} annotation.
13456 Just generate RTL for a function instead of compiling it. Usually used
13457 with @option{-fdump-rtl-expand}.
13460 @item -fdump-noaddr
13461 @opindex fdump-noaddr
13462 When doing debugging dumps, suppress address output. This makes it more
13463 feasible to use diff on debugging dumps for compiler invocations with
13464 different compiler binaries and/or different
13465 text / bss / data / heap / stack / dso start locations.
13468 @opindex freport-bug
13469 Collect and dump debug information into a temporary file if an
13470 internal compiler error (ICE) occurs.
13472 @item -fdump-unnumbered
13473 @opindex fdump-unnumbered
13474 When doing debugging dumps, suppress instruction numbers and address output.
13475 This makes it more feasible to use diff on debugging dumps for compiler
13476 invocations with different options, in particular with and without
13479 @item -fdump-unnumbered-links
13480 @opindex fdump-unnumbered-links
13481 When doing debugging dumps (see @option{-d} option above), suppress
13482 instruction numbers for the links to the previous and next instructions
13485 @item -fdump-ipa-@var{switch}
13487 Control the dumping at various stages of inter-procedural analysis
13488 language tree to a file. The file name is generated by appending a
13489 switch specific suffix to the source file name, and the file is created
13490 in the same directory as the output file. The following dumps are
13495 Enables all inter-procedural analysis dumps.
13498 Dumps information about call-graph optimization, unused function removal,
13499 and inlining decisions.
13502 Dump after function inlining.
13506 @item -fdump-lang-all
13507 @itemx -fdump-lang-@var{switch}
13508 @itemx -fdump-lang-@var{switch}-@var{options}
13509 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
13510 @opindex fdump-lang-all
13511 @opindex fdump-lang
13512 Control the dumping of language-specific information. The @var{options}
13513 and @var{filename} portions behave as described in the
13514 @option{-fdump-tree} option. The following @var{switch} values are
13520 Enable all language-specific dumps.
13523 Dump class hierarchy information. Virtual table information is emitted
13524 unless '@option{slim}' is specified. This option is applicable to C++ only.
13527 Dump the raw internal tree data. This option is applicable to C++ only.
13531 @item -fdump-passes
13532 @opindex fdump-passes
13533 Print on @file{stderr} the list of optimization passes that are turned
13534 on and off by the current command-line options.
13536 @item -fdump-statistics-@var{option}
13537 @opindex fdump-statistics
13538 Enable and control dumping of pass statistics in a separate file. The
13539 file name is generated by appending a suffix ending in
13540 @samp{.statistics} to the source file name, and the file is created in
13541 the same directory as the output file. If the @samp{-@var{option}}
13542 form is used, @samp{-stats} causes counters to be summed over the
13543 whole compilation unit while @samp{-details} dumps every event as
13544 the passes generate them. The default with no option is to sum
13545 counters for each function compiled.
13547 @item -fdump-tree-all
13548 @itemx -fdump-tree-@var{switch}
13549 @itemx -fdump-tree-@var{switch}-@var{options}
13550 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
13551 @opindex fdump-tree-all
13552 @opindex fdump-tree
13553 Control the dumping at various stages of processing the intermediate
13554 language tree to a file. The file name is generated by appending a
13555 switch-specific suffix to the source file name, and the file is
13556 created in the same directory as the output file. In case of
13557 @option{=@var{filename}} option, the dump is output on the given file
13558 instead of the auto named dump files. If the @samp{-@var{options}}
13559 form is used, @var{options} is a list of @samp{-} separated options
13560 which control the details of the dump. Not all options are applicable
13561 to all dumps; those that are not meaningful are ignored. The
13562 following options are available
13566 Print the address of each node. Usually this is not meaningful as it
13567 changes according to the environment and source file. Its primary use
13568 is for tying up a dump file with a debug environment.
13570 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
13571 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
13572 use working backward from mangled names in the assembly file.
13574 When dumping front-end intermediate representations, inhibit dumping
13575 of members of a scope or body of a function merely because that scope
13576 has been reached. Only dump such items when they are directly reachable
13577 by some other path.
13579 When dumping pretty-printed trees, this option inhibits dumping the
13580 bodies of control structures.
13582 When dumping RTL, print the RTL in slim (condensed) form instead of
13583 the default LISP-like representation.
13585 Print a raw representation of the tree. By default, trees are
13586 pretty-printed into a C-like representation.
13588 Enable more detailed dumps (not honored by every dump option). Also
13589 include information from the optimization passes.
13591 Enable dumping various statistics about the pass (not honored by every dump
13594 Enable showing basic block boundaries (disabled in raw dumps).
13596 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
13597 dump a representation of the control flow graph suitable for viewing with
13598 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
13599 the file is pretty-printed as a subgraph, so that GraphViz can render them
13600 all in a single plot.
13602 This option currently only works for RTL dumps, and the RTL is always
13603 dumped in slim form.
13605 Enable showing virtual operands for every statement.
13607 Enable showing line numbers for statements.
13609 Enable showing the unique ID (@code{DECL_UID}) for each variable.
13611 Enable showing the tree dump for each statement.
13613 Enable showing the EH region number holding each statement.
13615 Enable showing scalar evolution analysis details.
13617 Enable showing optimization information (only available in certain
13620 Enable showing missed optimization information (only available in certain
13623 Enable other detailed optimization information (only available in
13625 @item =@var{filename}
13626 Instead of an auto named dump file, output into the given file
13627 name. The file names @file{stdout} and @file{stderr} are treated
13628 specially and are considered already open standard streams. For
13632 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
13633 -fdump-tree-pre=/dev/stderr file.c
13636 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
13637 output on to @file{stderr}. If two conflicting dump filenames are
13638 given for the same pass, then the latter option overrides the earlier
13642 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
13643 and @option{lineno}.
13646 Turn on all optimization options, i.e., @option{optimized},
13647 @option{missed}, and @option{note}.
13650 To determine what tree dumps are available or find the dump for a pass
13651 of interest follow the steps below.
13655 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
13656 look for a code that corresponds to the pass you are interested in.
13657 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
13658 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
13659 The number at the end distinguishes distinct invocations of the same pass.
13661 To enable the creation of the dump file, append the pass code to
13662 the @option{-fdump-} option prefix and invoke GCC with it. For example,
13663 to enable the dump from the Early Value Range Propagation pass, invoke
13664 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
13665 specify the name of the dump file. If you don't specify one, GCC
13666 creates as described below.
13668 Find the pass dump in a file whose name is composed of three components
13669 separated by a period: the name of the source file GCC was invoked to
13670 compile, a numeric suffix indicating the pass number followed by the
13671 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
13672 and finally the pass code. For example, the Early VRP pass dump might
13673 be in a file named @file{myfile.c.038t.evrp} in the current working
13674 directory. Note that the numeric codes are not stable and may change
13675 from one version of GCC to another.
13679 @itemx -fopt-info-@var{options}
13680 @itemx -fopt-info-@var{options}=@var{filename}
13682 Controls optimization dumps from various optimization passes. If the
13683 @samp{-@var{options}} form is used, @var{options} is a list of
13684 @samp{-} separated option keywords to select the dump details and
13687 The @var{options} can be divided into two groups: options describing the
13688 verbosity of the dump, and options describing which optimizations
13689 should be included. The options from both the groups can be freely
13690 mixed as they are non-overlapping. However, in case of any conflicts,
13691 the later options override the earlier options on the command
13694 The following options control the dump verbosity:
13698 Print information when an optimization is successfully applied. It is
13699 up to a pass to decide which information is relevant. For example, the
13700 vectorizer passes print the source location of loops which are
13701 successfully vectorized.
13703 Print information about missed optimizations. Individual passes
13704 control which information to include in the output.
13706 Print verbose information about optimizations, such as certain
13707 transformations, more detailed messages about decisions etc.
13709 Print detailed optimization information. This includes
13710 @samp{optimized}, @samp{missed}, and @samp{note}.
13713 One or more of the following option keywords can be used to describe a
13714 group of optimizations:
13718 Enable dumps from all interprocedural optimizations.
13720 Enable dumps from all loop optimizations.
13722 Enable dumps from all inlining optimizations.
13724 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
13726 Enable dumps from all vectorization optimizations.
13728 Enable dumps from all optimizations. This is a superset of
13729 the optimization groups listed above.
13732 If @var{options} is
13733 omitted, it defaults to @samp{optimized-optall}, which means to dump all
13734 info about successful optimizations from all the passes.
13736 If the @var{filename} is provided, then the dumps from all the
13737 applicable optimizations are concatenated into the @var{filename}.
13738 Otherwise the dump is output onto @file{stderr}. Though multiple
13739 @option{-fopt-info} options are accepted, only one of them can include
13740 a @var{filename}. If other filenames are provided then all but the
13741 first such option are ignored.
13743 Note that the output @var{filename} is overwritten
13744 in case of multiple translation units. If a combined output from
13745 multiple translation units is desired, @file{stderr} should be used
13748 In the following example, the optimization info is output to
13757 gcc -O3 -fopt-info-missed=missed.all
13761 outputs missed optimization report from all the passes into
13762 @file{missed.all}, and this one:
13765 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13769 prints information about missed optimization opportunities from
13770 vectorization passes on @file{stderr}.
13771 Note that @option{-fopt-info-vec-missed} is equivalent to
13772 @option{-fopt-info-missed-vec}. The order of the optimization group
13773 names and message types listed after @option{-fopt-info} does not matter.
13775 As another example,
13777 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13781 outputs information about missed optimizations as well as
13782 optimized locations from all the inlining passes into
13788 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13792 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
13793 in conflict since only one output file is allowed. In this case, only
13794 the first option takes effect and the subsequent options are
13795 ignored. Thus only @file{vec.miss} is produced which contains
13796 dumps from the vectorizer about missed opportunities.
13798 @item -fsched-verbose=@var{n}
13799 @opindex fsched-verbose
13800 On targets that use instruction scheduling, this option controls the
13801 amount of debugging output the scheduler prints to the dump files.
13803 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
13804 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
13805 For @var{n} greater than one, it also output basic block probabilities,
13806 detailed ready list information and unit/insn info. For @var{n} greater
13807 than two, it includes RTL at abort point, control-flow and regions info.
13808 And for @var{n} over four, @option{-fsched-verbose} also includes
13813 @item -fenable-@var{kind}-@var{pass}
13814 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
13818 This is a set of options that are used to explicitly disable/enable
13819 optimization passes. These options are intended for use for debugging GCC.
13820 Compiler users should use regular options for enabling/disabling
13825 @item -fdisable-ipa-@var{pass}
13826 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13827 statically invoked in the compiler multiple times, the pass name should be
13828 appended with a sequential number starting from 1.
13830 @item -fdisable-rtl-@var{pass}
13831 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
13832 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
13833 statically invoked in the compiler multiple times, the pass name should be
13834 appended with a sequential number starting from 1. @var{range-list} is a
13835 comma-separated list of function ranges or assembler names. Each range is a number
13836 pair separated by a colon. The range is inclusive in both ends. If the range
13837 is trivial, the number pair can be simplified as a single number. If the
13838 function's call graph node's @var{uid} falls within one of the specified ranges,
13839 the @var{pass} is disabled for that function. The @var{uid} is shown in the
13840 function header of a dump file, and the pass names can be dumped by using
13841 option @option{-fdump-passes}.
13843 @item -fdisable-tree-@var{pass}
13844 @itemx -fdisable-tree-@var{pass}=@var{range-list}
13845 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
13848 @item -fenable-ipa-@var{pass}
13849 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13850 statically invoked in the compiler multiple times, the pass name should be
13851 appended with a sequential number starting from 1.
13853 @item -fenable-rtl-@var{pass}
13854 @itemx -fenable-rtl-@var{pass}=@var{range-list}
13855 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
13856 description and examples.
13858 @item -fenable-tree-@var{pass}
13859 @itemx -fenable-tree-@var{pass}=@var{range-list}
13860 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
13861 of option arguments.
13865 Here are some examples showing uses of these options.
13869 # disable ccp1 for all functions
13870 -fdisable-tree-ccp1
13871 # disable complete unroll for function whose cgraph node uid is 1
13872 -fenable-tree-cunroll=1
13873 # disable gcse2 for functions at the following ranges [1,1],
13874 # [300,400], and [400,1000]
13875 # disable gcse2 for functions foo and foo2
13876 -fdisable-rtl-gcse2=foo,foo2
13877 # disable early inlining
13878 -fdisable-tree-einline
13879 # disable ipa inlining
13880 -fdisable-ipa-inline
13881 # enable tree full unroll
13882 -fenable-tree-unroll
13887 @itemx -fchecking=@var{n}
13889 @opindex fno-checking
13890 Enable internal consistency checking. The default depends on
13891 the compiler configuration. @option{-fchecking=2} enables further
13892 internal consistency checking that might affect code generation.
13894 @item -frandom-seed=@var{string}
13895 @opindex frandom-seed
13896 This option provides a seed that GCC uses in place of
13897 random numbers in generating certain symbol names
13898 that have to be different in every compiled file. It is also used to
13899 place unique stamps in coverage data files and the object files that
13900 produce them. You can use the @option{-frandom-seed} option to produce
13901 reproducibly identical object files.
13903 The @var{string} can either be a number (decimal, octal or hex) or an
13904 arbitrary string (in which case it's converted to a number by
13907 The @var{string} should be different for every file you compile.
13910 @itemx -save-temps=cwd
13911 @opindex save-temps
13912 Store the usual ``temporary'' intermediate files permanently; place them
13913 in the current directory and name them based on the source file. Thus,
13914 compiling @file{foo.c} with @option{-c -save-temps} produces files
13915 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
13916 preprocessed @file{foo.i} output file even though the compiler now
13917 normally uses an integrated preprocessor.
13919 When used in combination with the @option{-x} command-line option,
13920 @option{-save-temps} is sensible enough to avoid over writing an
13921 input source file with the same extension as an intermediate file.
13922 The corresponding intermediate file may be obtained by renaming the
13923 source file before using @option{-save-temps}.
13925 If you invoke GCC in parallel, compiling several different source
13926 files that share a common base name in different subdirectories or the
13927 same source file compiled for multiple output destinations, it is
13928 likely that the different parallel compilers will interfere with each
13929 other, and overwrite the temporary files. For instance:
13932 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
13933 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
13936 may result in @file{foo.i} and @file{foo.o} being written to
13937 simultaneously by both compilers.
13939 @item -save-temps=obj
13940 @opindex save-temps=obj
13941 Store the usual ``temporary'' intermediate files permanently. If the
13942 @option{-o} option is used, the temporary files are based on the
13943 object file. If the @option{-o} option is not used, the
13944 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
13949 gcc -save-temps=obj -c foo.c
13950 gcc -save-temps=obj -c bar.c -o dir/xbar.o
13951 gcc -save-temps=obj foobar.c -o dir2/yfoobar
13955 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
13956 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
13957 @file{dir2/yfoobar.o}.
13959 @item -time@r{[}=@var{file}@r{]}
13961 Report the CPU time taken by each subprocess in the compilation
13962 sequence. For C source files, this is the compiler proper and assembler
13963 (plus the linker if linking is done).
13965 Without the specification of an output file, the output looks like this:
13972 The first number on each line is the ``user time'', that is time spent
13973 executing the program itself. The second number is ``system time'',
13974 time spent executing operating system routines on behalf of the program.
13975 Both numbers are in seconds.
13977 With the specification of an output file, the output is appended to the
13978 named file, and it looks like this:
13981 0.12 0.01 cc1 @var{options}
13982 0.00 0.01 as @var{options}
13985 The ``user time'' and the ``system time'' are moved before the program
13986 name, and the options passed to the program are displayed, so that one
13987 can later tell what file was being compiled, and with which options.
13989 @item -fdump-final-insns@r{[}=@var{file}@r{]}
13990 @opindex fdump-final-insns
13991 Dump the final internal representation (RTL) to @var{file}. If the
13992 optional argument is omitted (or if @var{file} is @code{.}), the name
13993 of the dump file is determined by appending @code{.gkd} to the
13994 compilation output file name.
13996 @item -fcompare-debug@r{[}=@var{opts}@r{]}
13997 @opindex fcompare-debug
13998 @opindex fno-compare-debug
13999 If no error occurs during compilation, run the compiler a second time,
14000 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
14001 passed to the second compilation. Dump the final internal
14002 representation in both compilations, and print an error if they differ.
14004 If the equal sign is omitted, the default @option{-gtoggle} is used.
14006 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
14007 and nonzero, implicitly enables @option{-fcompare-debug}. If
14008 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
14009 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
14012 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
14013 is equivalent to @option{-fno-compare-debug}, which disables the dumping
14014 of the final representation and the second compilation, preventing even
14015 @env{GCC_COMPARE_DEBUG} from taking effect.
14017 To verify full coverage during @option{-fcompare-debug} testing, set
14018 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
14019 which GCC rejects as an invalid option in any actual compilation
14020 (rather than preprocessing, assembly or linking). To get just a
14021 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
14022 not overridden} will do.
14024 @item -fcompare-debug-second
14025 @opindex fcompare-debug-second
14026 This option is implicitly passed to the compiler for the second
14027 compilation requested by @option{-fcompare-debug}, along with options to
14028 silence warnings, and omitting other options that would cause
14029 side-effect compiler outputs to files or to the standard output. Dump
14030 files and preserved temporary files are renamed so as to contain the
14031 @code{.gk} additional extension during the second compilation, to avoid
14032 overwriting those generated by the first.
14034 When this option is passed to the compiler driver, it causes the
14035 @emph{first} compilation to be skipped, which makes it useful for little
14036 other than debugging the compiler proper.
14040 Turn off generation of debug info, if leaving out this option
14041 generates it, or turn it on at level 2 otherwise. The position of this
14042 argument in the command line does not matter; it takes effect after all
14043 other options are processed, and it does so only once, no matter how
14044 many times it is given. This is mainly intended to be used with
14045 @option{-fcompare-debug}.
14047 @item -fvar-tracking-assignments-toggle
14048 @opindex fvar-tracking-assignments-toggle
14049 @opindex fno-var-tracking-assignments-toggle
14050 Toggle @option{-fvar-tracking-assignments}, in the same way that
14051 @option{-gtoggle} toggles @option{-g}.
14055 Makes the compiler print out each function name as it is compiled, and
14056 print some statistics about each pass when it finishes.
14058 @item -ftime-report
14059 @opindex ftime-report
14060 Makes the compiler print some statistics about the time consumed by each
14061 pass when it finishes.
14063 @item -ftime-report-details
14064 @opindex ftime-report-details
14065 Record the time consumed by infrastructure parts separately for each pass.
14067 @item -fira-verbose=@var{n}
14068 @opindex fira-verbose
14069 Control the verbosity of the dump file for the integrated register allocator.
14070 The default value is 5. If the value @var{n} is greater or equal to 10,
14071 the dump output is sent to stderr using the same format as @var{n} minus 10.
14074 @opindex flto-report
14075 Prints a report with internal details on the workings of the link-time
14076 optimizer. The contents of this report vary from version to version.
14077 It is meant to be useful to GCC developers when processing object
14078 files in LTO mode (via @option{-flto}).
14080 Disabled by default.
14082 @item -flto-report-wpa
14083 @opindex flto-report-wpa
14084 Like @option{-flto-report}, but only print for the WPA phase of Link
14088 @opindex fmem-report
14089 Makes the compiler print some statistics about permanent memory
14090 allocation when it finishes.
14092 @item -fmem-report-wpa
14093 @opindex fmem-report-wpa
14094 Makes the compiler print some statistics about permanent memory
14095 allocation for the WPA phase only.
14097 @item -fpre-ipa-mem-report
14098 @opindex fpre-ipa-mem-report
14099 @item -fpost-ipa-mem-report
14100 @opindex fpost-ipa-mem-report
14101 Makes the compiler print some statistics about permanent memory
14102 allocation before or after interprocedural optimization.
14104 @item -fprofile-report
14105 @opindex fprofile-report
14106 Makes the compiler print some statistics about consistency of the
14107 (estimated) profile and effect of individual passes.
14109 @item -fstack-usage
14110 @opindex fstack-usage
14111 Makes the compiler output stack usage information for the program, on a
14112 per-function basis. The filename for the dump is made by appending
14113 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
14114 the output file, if explicitly specified and it is not an executable,
14115 otherwise it is the basename of the source file. An entry is made up
14120 The name of the function.
14124 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
14127 The qualifier @code{static} means that the function manipulates the stack
14128 statically: a fixed number of bytes are allocated for the frame on function
14129 entry and released on function exit; no stack adjustments are otherwise made
14130 in the function. The second field is this fixed number of bytes.
14132 The qualifier @code{dynamic} means that the function manipulates the stack
14133 dynamically: in addition to the static allocation described above, stack
14134 adjustments are made in the body of the function, for example to push/pop
14135 arguments around function calls. If the qualifier @code{bounded} is also
14136 present, the amount of these adjustments is bounded at compile time and
14137 the second field is an upper bound of the total amount of stack used by
14138 the function. If it is not present, the amount of these adjustments is
14139 not bounded at compile time and the second field only represents the
14144 Emit statistics about front-end processing at the end of the compilation.
14145 This option is supported only by the C++ front end, and
14146 the information is generally only useful to the G++ development team.
14148 @item -fdbg-cnt-list
14149 @opindex fdbg-cnt-list
14150 Print the name and the counter upper bound for all debug counters.
14153 @item -fdbg-cnt=@var{counter-value-list}
14155 Set the internal debug counter upper bound. @var{counter-value-list}
14156 is a comma-separated list of @var{name}:@var{value} pairs
14157 which sets the upper bound of each debug counter @var{name} to @var{value}.
14158 All debug counters have the initial upper bound of @code{UINT_MAX};
14159 thus @code{dbg_cnt} returns true always unless the upper bound
14160 is set by this option.
14161 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
14162 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
14164 @item -print-file-name=@var{library}
14165 @opindex print-file-name
14166 Print the full absolute name of the library file @var{library} that
14167 would be used when linking---and don't do anything else. With this
14168 option, GCC does not compile or link anything; it just prints the
14171 @item -print-multi-directory
14172 @opindex print-multi-directory
14173 Print the directory name corresponding to the multilib selected by any
14174 other switches present in the command line. This directory is supposed
14175 to exist in @env{GCC_EXEC_PREFIX}.
14177 @item -print-multi-lib
14178 @opindex print-multi-lib
14179 Print the mapping from multilib directory names to compiler switches
14180 that enable them. The directory name is separated from the switches by
14181 @samp{;}, and each switch starts with an @samp{@@} instead of the
14182 @samp{-}, without spaces between multiple switches. This is supposed to
14183 ease shell processing.
14185 @item -print-multi-os-directory
14186 @opindex print-multi-os-directory
14187 Print the path to OS libraries for the selected
14188 multilib, relative to some @file{lib} subdirectory. If OS libraries are
14189 present in the @file{lib} subdirectory and no multilibs are used, this is
14190 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
14191 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
14192 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
14193 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
14195 @item -print-multiarch
14196 @opindex print-multiarch
14197 Print the path to OS libraries for the selected multiarch,
14198 relative to some @file{lib} subdirectory.
14200 @item -print-prog-name=@var{program}
14201 @opindex print-prog-name
14202 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
14204 @item -print-libgcc-file-name
14205 @opindex print-libgcc-file-name
14206 Same as @option{-print-file-name=libgcc.a}.
14208 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
14209 but you do want to link with @file{libgcc.a}. You can do:
14212 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
14215 @item -print-search-dirs
14216 @opindex print-search-dirs
14217 Print the name of the configured installation directory and a list of
14218 program and library directories @command{gcc} searches---and don't do anything else.
14220 This is useful when @command{gcc} prints the error message
14221 @samp{installation problem, cannot exec cpp0: No such file or directory}.
14222 To resolve this you either need to put @file{cpp0} and the other compiler
14223 components where @command{gcc} expects to find them, or you can set the environment
14224 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
14225 Don't forget the trailing @samp{/}.
14226 @xref{Environment Variables}.
14228 @item -print-sysroot
14229 @opindex print-sysroot
14230 Print the target sysroot directory that is used during
14231 compilation. This is the target sysroot specified either at configure
14232 time or using the @option{--sysroot} option, possibly with an extra
14233 suffix that depends on compilation options. If no target sysroot is
14234 specified, the option prints nothing.
14236 @item -print-sysroot-headers-suffix
14237 @opindex print-sysroot-headers-suffix
14238 Print the suffix added to the target sysroot when searching for
14239 headers, or give an error if the compiler is not configured with such
14240 a suffix---and don't do anything else.
14243 @opindex dumpmachine
14244 Print the compiler's target machine (for example,
14245 @samp{i686-pc-linux-gnu})---and don't do anything else.
14248 @opindex dumpversion
14249 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
14250 anything else. This is the compiler version used in filesystem paths,
14251 specs, can be depending on how the compiler has been configured just
14252 a single number (major version), two numbers separated by dot (major and
14253 minor version) or three numbers separated by dots (major, minor and patchlevel
14256 @item -dumpfullversion
14257 @opindex dumpfullversion
14258 Print the full compiler version, always 3 numbers separated by dots,
14259 major, minor and patchlevel version.
14263 Print the compiler's built-in specs---and don't do anything else. (This
14264 is used when GCC itself is being built.) @xref{Spec Files}.
14267 @node Submodel Options
14268 @section Machine-Dependent Options
14269 @cindex submodel options
14270 @cindex specifying hardware config
14271 @cindex hardware models and configurations, specifying
14272 @cindex target-dependent options
14273 @cindex machine-dependent options
14275 Each target machine supported by GCC can have its own options---for
14276 example, to allow you to compile for a particular processor variant or
14277 ABI, or to control optimizations specific to that machine. By
14278 convention, the names of machine-specific options start with
14281 Some configurations of the compiler also support additional target-specific
14282 options, usually for compatibility with other compilers on the same
14285 @c This list is ordered alphanumerically by subsection name.
14286 @c It should be the same order and spelling as these options are listed
14287 @c in Machine Dependent Options
14290 * AArch64 Options::
14291 * Adapteva Epiphany Options::
14295 * Blackfin Options::
14300 * DEC Alpha Options::
14304 * GNU/Linux Options::
14314 * MicroBlaze Options::
14317 * MN10300 Options::
14321 * Nios II Options::
14322 * Nvidia PTX Options::
14324 * picoChip Options::
14325 * PowerPC Options::
14328 * RS/6000 and PowerPC Options::
14330 * S/390 and zSeries Options::
14333 * Solaris 2 Options::
14336 * System V Options::
14337 * TILE-Gx Options::
14338 * TILEPro Options::
14343 * VxWorks Options::
14345 * x86 Windows Options::
14346 * Xstormy16 Options::
14348 * zSeries Options::
14351 @node AArch64 Options
14352 @subsection AArch64 Options
14353 @cindex AArch64 Options
14355 These options are defined for AArch64 implementations:
14359 @item -mabi=@var{name}
14361 Generate code for the specified data model. Permissible values
14362 are @samp{ilp32} for SysV-like data model where int, long int and pointers
14363 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
14364 but long int and pointers are 64 bits.
14366 The default depends on the specific target configuration. Note that
14367 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
14368 entire program with the same ABI, and link with a compatible set of libraries.
14371 @opindex mbig-endian
14372 Generate big-endian code. This is the default when GCC is configured for an
14373 @samp{aarch64_be-*-*} target.
14375 @item -mgeneral-regs-only
14376 @opindex mgeneral-regs-only
14377 Generate code which uses only the general-purpose registers. This will prevent
14378 the compiler from using floating-point and Advanced SIMD registers but will not
14379 impose any restrictions on the assembler.
14381 @item -mlittle-endian
14382 @opindex mlittle-endian
14383 Generate little-endian code. This is the default when GCC is configured for an
14384 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
14386 @item -mcmodel=tiny
14387 @opindex mcmodel=tiny
14388 Generate code for the tiny code model. The program and its statically defined
14389 symbols must be within 1MB of each other. Programs can be statically or
14390 dynamically linked.
14392 @item -mcmodel=small
14393 @opindex mcmodel=small
14394 Generate code for the small code model. The program and its statically defined
14395 symbols must be within 4GB of each other. Programs can be statically or
14396 dynamically linked. This is the default code model.
14398 @item -mcmodel=large
14399 @opindex mcmodel=large
14400 Generate code for the large code model. This makes no assumptions about
14401 addresses and sizes of sections. Programs can be statically linked only.
14403 @item -mstrict-align
14404 @opindex mstrict-align
14405 Avoid generating memory accesses that may not be aligned on a natural object
14406 boundary as described in the architecture specification.
14408 @item -momit-leaf-frame-pointer
14409 @itemx -mno-omit-leaf-frame-pointer
14410 @opindex momit-leaf-frame-pointer
14411 @opindex mno-omit-leaf-frame-pointer
14412 Omit or keep the frame pointer in leaf functions. The former behavior is the
14415 @item -mtls-dialect=desc
14416 @opindex mtls-dialect=desc
14417 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
14418 of TLS variables. This is the default.
14420 @item -mtls-dialect=traditional
14421 @opindex mtls-dialect=traditional
14422 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
14425 @item -mtls-size=@var{size}
14427 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
14428 This option requires binutils 2.26 or newer.
14430 @item -mfix-cortex-a53-835769
14431 @itemx -mno-fix-cortex-a53-835769
14432 @opindex mfix-cortex-a53-835769
14433 @opindex mno-fix-cortex-a53-835769
14434 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
14435 This involves inserting a NOP instruction between memory instructions and
14436 64-bit integer multiply-accumulate instructions.
14438 @item -mfix-cortex-a53-843419
14439 @itemx -mno-fix-cortex-a53-843419
14440 @opindex mfix-cortex-a53-843419
14441 @opindex mno-fix-cortex-a53-843419
14442 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
14443 This erratum workaround is made at link time and this will only pass the
14444 corresponding flag to the linker.
14446 @item -mlow-precision-recip-sqrt
14447 @item -mno-low-precision-recip-sqrt
14448 @opindex mlow-precision-recip-sqrt
14449 @opindex mno-low-precision-recip-sqrt
14450 Enable or disable the reciprocal square root approximation.
14451 This option only has an effect if @option{-ffast-math} or
14452 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14453 precision of reciprocal square root results to about 16 bits for
14454 single precision and to 32 bits for double precision.
14456 @item -mlow-precision-sqrt
14457 @item -mno-low-precision-sqrt
14458 @opindex -mlow-precision-sqrt
14459 @opindex -mno-low-precision-sqrt
14460 Enable or disable the square root approximation.
14461 This option only has an effect if @option{-ffast-math} or
14462 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14463 precision of square root results to about 16 bits for
14464 single precision and to 32 bits for double precision.
14465 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
14467 @item -mlow-precision-div
14468 @item -mno-low-precision-div
14469 @opindex -mlow-precision-div
14470 @opindex -mno-low-precision-div
14471 Enable or disable the division approximation.
14472 This option only has an effect if @option{-ffast-math} or
14473 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14474 precision of division results to about 16 bits for
14475 single precision and to 32 bits for double precision.
14477 @item -march=@var{name}
14479 Specify the name of the target architecture and, optionally, one or
14480 more feature modifiers. This option has the form
14481 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
14483 The permissible values for @var{arch} are @samp{armv8-a},
14484 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @var{native}.
14486 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
14487 support for the ARMv8.3-A architecture extensions.
14489 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
14490 support for the ARMv8.2-A architecture extensions.
14492 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
14493 support for the ARMv8.1-A architecture extension. In particular, it
14494 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
14496 The value @samp{native} is available on native AArch64 GNU/Linux and
14497 causes the compiler to pick the architecture of the host system. This
14498 option has no effect if the compiler is unable to recognize the
14499 architecture of the host system,
14501 The permissible values for @var{feature} are listed in the sub-section
14502 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14503 Feature Modifiers}. Where conflicting feature modifiers are
14504 specified, the right-most feature is used.
14506 GCC uses @var{name} to determine what kind of instructions it can emit
14507 when generating assembly code. If @option{-march} is specified
14508 without either of @option{-mtune} or @option{-mcpu} also being
14509 specified, the code is tuned to perform well across a range of target
14510 processors implementing the target architecture.
14512 @item -mtune=@var{name}
14514 Specify the name of the target processor for which GCC should tune the
14515 performance of the code. Permissible values for this option are:
14516 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
14517 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
14518 @samp{exynos-m1}, @samp{falkor}, @samp{qdf24xx}, @samp{saphira},
14519 @samp{xgene1}, @samp{vulcan}, @samp{thunderx},
14520 @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
14521 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53},
14522 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
14523 @samp{cortex-a73.cortex-a53}, @samp{cortex-a75.cortex-a55},
14526 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14527 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
14528 @samp{cortex-a75.cortex-a55} specify that GCC should tune for a
14531 Additionally on native AArch64 GNU/Linux systems the value
14532 @samp{native} tunes performance to the host system. This option has no effect
14533 if the compiler is unable to recognize the processor of the host system.
14535 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
14536 are specified, the code is tuned to perform well across a range
14537 of target processors.
14539 This option cannot be suffixed by feature modifiers.
14541 @item -mcpu=@var{name}
14543 Specify the name of the target processor, optionally suffixed by one
14544 or more feature modifiers. This option has the form
14545 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
14546 the permissible values for @var{cpu} are the same as those available
14547 for @option{-mtune}. The permissible values for @var{feature} are
14548 documented in the sub-section on
14549 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14550 Feature Modifiers}. Where conflicting feature modifiers are
14551 specified, the right-most feature is used.
14553 GCC uses @var{name} to determine what kind of instructions it can emit when
14554 generating assembly code (as if by @option{-march}) and to determine
14555 the target processor for which to tune for performance (as if
14556 by @option{-mtune}). Where this option is used in conjunction
14557 with @option{-march} or @option{-mtune}, those options take precedence
14558 over the appropriate part of this option.
14560 @item -moverride=@var{string}
14562 Override tuning decisions made by the back-end in response to a
14563 @option{-mtune=} switch. The syntax, semantics, and accepted values
14564 for @var{string} in this option are not guaranteed to be consistent
14567 This option is only intended to be useful when developing GCC.
14569 @item -mverbose-cost-dump
14570 @opindex mverbose-cost-dump
14571 Enable verbose cost model dumping in the debug dump files. This option is
14572 provided for use in debugging the compiler.
14574 @item -mpc-relative-literal-loads
14575 @itemx -mno-pc-relative-literal-loads
14576 @opindex mpc-relative-literal-loads
14577 @opindex mno-pc-relative-literal-loads
14578 Enable or disable PC-relative literal loads. With this option literal pools are
14579 accessed using a single instruction and emitted after each function. This
14580 limits the maximum size of functions to 1MB. This is enabled by default for
14581 @option{-mcmodel=tiny}.
14583 @item -msign-return-address=@var{scope}
14584 @opindex msign-return-address
14585 Select the function scope on which return address signing will be applied.
14586 Permissible values are @samp{none}, which disables return address signing,
14587 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
14588 functions, and @samp{all}, which enables pointer signing for all functions. The
14589 default value is @samp{none}.
14593 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
14594 @anchor{aarch64-feature-modifiers}
14595 @cindex @option{-march} feature modifiers
14596 @cindex @option{-mcpu} feature modifiers
14597 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
14598 the following and their inverses @option{no@var{feature}}:
14602 Enable CRC extension. This is on by default for
14603 @option{-march=armv8.1-a}.
14605 Enable Crypto extension. This also enables Advanced SIMD and floating-point
14608 Enable floating-point instructions. This is on by default for all possible
14609 values for options @option{-march} and @option{-mcpu}.
14611 Enable Advanced SIMD instructions. This also enables floating-point
14612 instructions. This is on by default for all possible values for options
14613 @option{-march} and @option{-mcpu}.
14615 Enable Large System Extension instructions. This is on by default for
14616 @option{-march=armv8.1-a}.
14618 Enable Round Double Multiply Accumulate instructions. This is on by default
14619 for @option{-march=armv8.1-a}.
14621 Enable FP16 extension. This also enables floating-point instructions.
14623 Enable the RcPc extension. This does not change code generation from GCC,
14624 but is passed on to the assembler, enabling inline asm statements to use
14625 instructions from the RcPc extension.
14627 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
14631 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
14632 Conversely, @option{nofp} implies @option{nosimd}, which implies
14635 @node Adapteva Epiphany Options
14636 @subsection Adapteva Epiphany Options
14638 These @samp{-m} options are defined for Adapteva Epiphany:
14641 @item -mhalf-reg-file
14642 @opindex mhalf-reg-file
14643 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
14644 That allows code to run on hardware variants that lack these registers.
14646 @item -mprefer-short-insn-regs
14647 @opindex mprefer-short-insn-regs
14648 Preferentially allocate registers that allow short instruction generation.
14649 This can result in increased instruction count, so this may either reduce or
14650 increase overall code size.
14652 @item -mbranch-cost=@var{num}
14653 @opindex mbranch-cost
14654 Set the cost of branches to roughly @var{num} ``simple'' instructions.
14655 This cost is only a heuristic and is not guaranteed to produce
14656 consistent results across releases.
14660 Enable the generation of conditional moves.
14662 @item -mnops=@var{num}
14664 Emit @var{num} NOPs before every other generated instruction.
14666 @item -mno-soft-cmpsf
14667 @opindex mno-soft-cmpsf
14668 For single-precision floating-point comparisons, emit an @code{fsub} instruction
14669 and test the flags. This is faster than a software comparison, but can
14670 get incorrect results in the presence of NaNs, or when two different small
14671 numbers are compared such that their difference is calculated as zero.
14672 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
14673 software comparisons.
14675 @item -mstack-offset=@var{num}
14676 @opindex mstack-offset
14677 Set the offset between the top of the stack and the stack pointer.
14678 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
14679 can be used by leaf functions without stack allocation.
14680 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
14681 Note also that this option changes the ABI; compiling a program with a
14682 different stack offset than the libraries have been compiled with
14683 generally does not work.
14684 This option can be useful if you want to evaluate if a different stack
14685 offset would give you better code, but to actually use a different stack
14686 offset to build working programs, it is recommended to configure the
14687 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
14689 @item -mno-round-nearest
14690 @opindex mno-round-nearest
14691 Make the scheduler assume that the rounding mode has been set to
14692 truncating. The default is @option{-mround-nearest}.
14695 @opindex mlong-calls
14696 If not otherwise specified by an attribute, assume all calls might be beyond
14697 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
14698 function address into a register before performing a (otherwise direct) call.
14699 This is the default.
14701 @item -mshort-calls
14702 @opindex short-calls
14703 If not otherwise specified by an attribute, assume all direct calls are
14704 in the range of the @code{b} / @code{bl} instructions, so use these instructions
14705 for direct calls. The default is @option{-mlong-calls}.
14709 Assume addresses can be loaded as 16-bit unsigned values. This does not
14710 apply to function addresses for which @option{-mlong-calls} semantics
14713 @item -mfp-mode=@var{mode}
14715 Set the prevailing mode of the floating-point unit.
14716 This determines the floating-point mode that is provided and expected
14717 at function call and return time. Making this mode match the mode you
14718 predominantly need at function start can make your programs smaller and
14719 faster by avoiding unnecessary mode switches.
14721 @var{mode} can be set to one the following values:
14725 Any mode at function entry is valid, and retained or restored when
14726 the function returns, and when it calls other functions.
14727 This mode is useful for compiling libraries or other compilation units
14728 you might want to incorporate into different programs with different
14729 prevailing FPU modes, and the convenience of being able to use a single
14730 object file outweighs the size and speed overhead for any extra
14731 mode switching that might be needed, compared with what would be needed
14732 with a more specific choice of prevailing FPU mode.
14735 This is the mode used for floating-point calculations with
14736 truncating (i.e.@: round towards zero) rounding mode. That includes
14737 conversion from floating point to integer.
14739 @item round-nearest
14740 This is the mode used for floating-point calculations with
14741 round-to-nearest-or-even rounding mode.
14744 This is the mode used to perform integer calculations in the FPU, e.g.@:
14745 integer multiply, or integer multiply-and-accumulate.
14748 The default is @option{-mfp-mode=caller}
14750 @item -mnosplit-lohi
14751 @itemx -mno-postinc
14752 @itemx -mno-postmodify
14753 @opindex mnosplit-lohi
14754 @opindex mno-postinc
14755 @opindex mno-postmodify
14756 Code generation tweaks that disable, respectively, splitting of 32-bit
14757 loads, generation of post-increment addresses, and generation of
14758 post-modify addresses. The defaults are @option{msplit-lohi},
14759 @option{-mpost-inc}, and @option{-mpost-modify}.
14761 @item -mnovect-double
14762 @opindex mno-vect-double
14763 Change the preferred SIMD mode to SImode. The default is
14764 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
14766 @item -max-vect-align=@var{num}
14767 @opindex max-vect-align
14768 The maximum alignment for SIMD vector mode types.
14769 @var{num} may be 4 or 8. The default is 8.
14770 Note that this is an ABI change, even though many library function
14771 interfaces are unaffected if they don't use SIMD vector modes
14772 in places that affect size and/or alignment of relevant types.
14774 @item -msplit-vecmove-early
14775 @opindex msplit-vecmove-early
14776 Split vector moves into single word moves before reload. In theory this
14777 can give better register allocation, but so far the reverse seems to be
14778 generally the case.
14780 @item -m1reg-@var{reg}
14782 Specify a register to hold the constant @minus{}1, which makes loading small negative
14783 constants and certain bitmasks faster.
14784 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
14785 which specify use of that register as a fixed register,
14786 and @samp{none}, which means that no register is used for this
14787 purpose. The default is @option{-m1reg-none}.
14792 @subsection ARC Options
14793 @cindex ARC options
14795 The following options control the architecture variant for which code
14798 @c architecture variants
14801 @item -mbarrel-shifter
14802 @opindex mbarrel-shifter
14803 Generate instructions supported by barrel shifter. This is the default
14804 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
14806 @item -mcpu=@var{cpu}
14808 Set architecture type, register usage, and instruction scheduling
14809 parameters for @var{cpu}. There are also shortcut alias options
14810 available for backward compatibility and convenience. Supported
14811 values for @var{cpu} are
14817 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
14821 Compile for ARC601. Alias: @option{-mARC601}.
14826 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
14827 This is the default when configured with @option{--with-cpu=arc700}@.
14830 Compile for ARC EM.
14833 Compile for ARC HS.
14836 Compile for ARC EM CPU with no hardware extensions.
14839 Compile for ARC EM4 CPU.
14842 Compile for ARC EM4 DMIPS CPU.
14845 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
14849 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
14850 double assist instructions.
14853 Compile for ARC HS CPU with no hardware extensions except the atomic
14857 Compile for ARC HS34 CPU.
14860 Compile for ARC HS38 CPU.
14863 Compile for ARC HS38 CPU with all hardware extensions on.
14866 Compile for ARC 600 CPU with @code{norm} instructions enabled.
14868 @item arc600_mul32x16
14869 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
14870 instructions enabled.
14873 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
14874 instructions enabled.
14877 Compile for ARC 601 CPU with @code{norm} instructions enabled.
14879 @item arc601_mul32x16
14880 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
14881 instructions enabled.
14884 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
14885 instructions enabled.
14888 Compile for ARC 700 on NPS400 chip.
14894 @itemx -mdpfp-compact
14895 @opindex mdpfp-compact
14896 Generate double-precision FPX instructions, tuned for the compact
14900 @opindex mdpfp-fast
14901 Generate double-precision FPX instructions, tuned for the fast
14904 @item -mno-dpfp-lrsr
14905 @opindex mno-dpfp-lrsr
14906 Disable @code{lr} and @code{sr} instructions from using FPX extension
14911 Generate extended arithmetic instructions. Currently only
14912 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
14913 supported. This is always enabled for @option{-mcpu=ARC700}.
14917 Do not generate @code{mpy}-family instructions for ARC700. This option is
14922 Generate 32x16-bit multiply and multiply-accumulate instructions.
14926 Generate @code{mul64} and @code{mulu64} instructions.
14927 Only valid for @option{-mcpu=ARC600}.
14931 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
14936 @itemx -mspfp-compact
14937 @opindex mspfp-compact
14938 Generate single-precision FPX instructions, tuned for the compact
14942 @opindex mspfp-fast
14943 Generate single-precision FPX instructions, tuned for the fast
14948 Enable generation of ARC SIMD instructions via target-specific
14949 builtins. Only valid for @option{-mcpu=ARC700}.
14952 @opindex msoft-float
14953 This option ignored; it is provided for compatibility purposes only.
14954 Software floating-point code is emitted by default, and this default
14955 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
14956 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
14957 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
14961 Generate @code{swap} instructions.
14965 This enables use of the locked load/store conditional extension to implement
14966 atomic memory built-in functions. Not available for ARC 6xx or ARC
14971 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
14973 @item -mcode-density
14974 @opindex mcode-density
14975 Enable code density instructions for ARC EM.
14976 This option is on by default for ARC HS.
14980 Enable double load/store operations for ARC HS cores.
14982 @item -mtp-regno=@var{regno}
14984 Specify thread pointer register number.
14986 @item -mmpy-option=@var{multo}
14987 @opindex mmpy-option
14988 Compile ARCv2 code with a multiplier design option. You can specify
14989 the option using either a string or numeric value for @var{multo}.
14990 @samp{wlh1} is the default value. The recognized values are:
14995 No multiplier available.
14999 16x16 multiplier, fully pipelined.
15000 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
15004 32x32 multiplier, fully
15005 pipelined (1 stage). The following instructions are additionally
15006 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15010 32x32 multiplier, fully pipelined
15011 (2 stages). The following instructions are additionally enabled: @code{mpy},
15012 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15016 Two 16x16 multipliers, blocking,
15017 sequential. The following instructions are additionally enabled: @code{mpy},
15018 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15022 One 16x16 multiplier, blocking,
15023 sequential. The following instructions are additionally enabled: @code{mpy},
15024 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15028 One 32x4 multiplier, blocking,
15029 sequential. The following instructions are additionally enabled: @code{mpy},
15030 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15034 ARC HS SIMD support.
15038 ARC HS SIMD support.
15042 ARC HS SIMD support.
15046 This option is only available for ARCv2 cores@.
15048 @item -mfpu=@var{fpu}
15050 Enables support for specific floating-point hardware extensions for ARCv2
15051 cores. Supported values for @var{fpu} are:
15056 Enables support for single-precision floating-point hardware
15060 Enables support for double-precision floating-point hardware
15061 extensions. The single-precision floating-point extension is also
15062 enabled. Not available for ARC EM@.
15065 Enables support for double-precision floating-point hardware
15066 extensions using double-precision assist instructions. The single-precision
15067 floating-point extension is also enabled. This option is
15068 only available for ARC EM@.
15071 Enables support for double-precision floating-point hardware
15072 extensions using double-precision assist instructions.
15073 The single-precision floating-point, square-root, and divide
15074 extensions are also enabled. This option is
15075 only available for ARC EM@.
15078 Enables support for double-precision floating-point hardware
15079 extensions using double-precision assist instructions.
15080 The single-precision floating-point and fused multiply and add
15081 hardware extensions are also enabled. This option is
15082 only available for ARC EM@.
15085 Enables support for double-precision floating-point hardware
15086 extensions using double-precision assist instructions.
15087 All single-precision floating-point hardware extensions are also
15088 enabled. This option is only available for ARC EM@.
15091 Enables support for single-precision floating-point, square-root and divide
15092 hardware extensions@.
15095 Enables support for double-precision floating-point, square-root and divide
15096 hardware extensions. This option
15097 includes option @samp{fpus_div}. Not available for ARC EM@.
15100 Enables support for single-precision floating-point and
15101 fused multiply and add hardware extensions@.
15104 Enables support for double-precision floating-point and
15105 fused multiply and add hardware extensions. This option
15106 includes option @samp{fpus_fma}. Not available for ARC EM@.
15109 Enables support for all single-precision floating-point hardware
15113 Enables support for all single- and double-precision floating-point
15114 hardware extensions. Not available for ARC EM@.
15118 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
15119 @opindex mirq-ctrl-saved
15120 Specifies general-purposes registers that the processor automatically
15121 saves/restores on interrupt entry and exit. @var{register-range} is
15122 specified as two registers separated by a dash. The register range
15123 always starts with @code{r0}, the upper limit is @code{fp} register.
15124 @var{blink} and @var{lp_count} are optional. This option is only
15125 valid for ARC EM and ARC HS cores.
15127 @item -mrgf-banked-regs=@var{number}
15128 @opindex mrgf-banked-regs
15129 Specifies the number of registers replicated in second register bank
15130 on entry to fast interrupt. Fast interrupts are interrupts with the
15131 highest priority level P0. These interrupts save only PC and STATUS32
15132 registers to avoid memory transactions during interrupt entry and exit
15133 sequences. Use this option when you are using fast interrupts in an
15134 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
15136 @item -mlpc-width=@var{width}
15137 @opindex mlpc-width
15138 Specify the width of the @code{lp_count} register. Valid values for
15139 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
15140 fixed to 32 bits. If the width is less than 32, the compiler does not
15141 attempt to transform loops in your program to use the zero-delay loop
15142 mechanism unless it is known that the @code{lp_count} register can
15143 hold the required loop-counter value. Depending on the width
15144 specified, the compiler and run-time library might continue to use the
15145 loop mechanism for various needs. This option defines macro
15146 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
15150 The following options are passed through to the assembler, and also
15151 define preprocessor macro symbols.
15153 @c Flags used by the assembler, but for which we define preprocessor
15154 @c macro symbols as well.
15157 @opindex mdsp-packa
15158 Passed down to the assembler to enable the DSP Pack A extensions.
15159 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
15164 Passed down to the assembler to enable the dual Viterbi butterfly
15165 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
15166 option is deprecated.
15168 @c ARC700 4.10 extension instruction
15171 Passed down to the assembler to enable the locked load/store
15172 conditional extension. Also sets the preprocessor symbol
15177 Passed down to the assembler. Also sets the preprocessor symbol
15178 @code{__Xxmac_d16}. This option is deprecated.
15182 Passed down to the assembler. Also sets the preprocessor symbol
15183 @code{__Xxmac_24}. This option is deprecated.
15185 @c ARC700 4.10 extension instruction
15188 Passed down to the assembler to enable the 64-bit time-stamp counter
15189 extension instruction. Also sets the preprocessor symbol
15190 @code{__Xrtsc}. This option is deprecated.
15192 @c ARC700 4.10 extension instruction
15195 Passed down to the assembler to enable the swap byte ordering
15196 extension instruction. Also sets the preprocessor symbol
15200 @opindex mtelephony
15201 Passed down to the assembler to enable dual- and single-operand
15202 instructions for telephony. Also sets the preprocessor symbol
15203 @code{__Xtelephony}. This option is deprecated.
15207 Passed down to the assembler to enable the XY memory extension. Also
15208 sets the preprocessor symbol @code{__Xxy}.
15212 The following options control how the assembly code is annotated:
15214 @c Assembly annotation options
15218 Annotate assembler instructions with estimated addresses.
15220 @item -mannotate-align
15221 @opindex mannotate-align
15222 Explain what alignment considerations lead to the decision to make an
15223 instruction short or long.
15227 The following options are passed through to the linker:
15229 @c options passed through to the linker
15233 Passed through to the linker, to specify use of the @code{arclinux} emulation.
15234 This option is enabled by default in tool chains built for
15235 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
15236 when profiling is not requested.
15238 @item -marclinux_prof
15239 @opindex marclinux_prof
15240 Passed through to the linker, to specify use of the
15241 @code{arclinux_prof} emulation. This option is enabled by default in
15242 tool chains built for @w{@code{arc-linux-uclibc}} and
15243 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
15247 The following options control the semantics of generated code:
15249 @c semantically relevant code generation options
15252 @opindex mlong-calls
15253 Generate calls as register indirect calls, thus providing access
15254 to the full 32-bit address range.
15256 @item -mmedium-calls
15257 @opindex mmedium-calls
15258 Don't use less than 25-bit addressing range for calls, which is the
15259 offset available for an unconditional branch-and-link
15260 instruction. Conditional execution of function calls is suppressed, to
15261 allow use of the 25-bit range, rather than the 21-bit range with
15262 conditional branch-and-link. This is the default for tool chains built
15263 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
15267 Put definitions of externally-visible data in a small data section if
15268 that data is no bigger than @var{num} bytes. The default value of
15269 @var{num} is 4 for any ARC configuration, or 8 when we have double
15270 load/store operations.
15274 Do not generate sdata references. This is the default for tool chains
15275 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
15278 @item -mvolatile-cache
15279 @opindex mvolatile-cache
15280 Use ordinarily cached memory accesses for volatile references. This is the
15283 @item -mno-volatile-cache
15284 @opindex mno-volatile-cache
15285 Enable cache bypass for volatile references.
15289 The following options fine tune code generation:
15290 @c code generation tuning options
15293 @opindex malign-call
15294 Do alignment optimizations for call instructions.
15296 @item -mauto-modify-reg
15297 @opindex mauto-modify-reg
15298 Enable the use of pre/post modify with register displacement.
15300 @item -mbbit-peephole
15301 @opindex mbbit-peephole
15302 Enable bbit peephole2.
15306 This option disables a target-specific pass in @file{arc_reorg} to
15307 generate compare-and-branch (@code{br@var{cc}}) instructions.
15308 It has no effect on
15309 generation of these instructions driven by the combiner pass.
15311 @item -mcase-vector-pcrel
15312 @opindex mcase-vector-pcrel
15313 Use PC-relative switch case tables to enable case table shortening.
15314 This is the default for @option{-Os}.
15316 @item -mcompact-casesi
15317 @opindex mcompact-casesi
15318 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
15319 and only available for ARCv1 cores.
15321 @item -mno-cond-exec
15322 @opindex mno-cond-exec
15323 Disable the ARCompact-specific pass to generate conditional
15324 execution instructions.
15326 Due to delay slot scheduling and interactions between operand numbers,
15327 literal sizes, instruction lengths, and the support for conditional execution,
15328 the target-independent pass to generate conditional execution is often lacking,
15329 so the ARC port has kept a special pass around that tries to find more
15330 conditional execution generation opportunities after register allocation,
15331 branch shortening, and delay slot scheduling have been done. This pass
15332 generally, but not always, improves performance and code size, at the cost of
15333 extra compilation time, which is why there is an option to switch it off.
15334 If you have a problem with call instructions exceeding their allowable
15335 offset range because they are conditionalized, you should consider using
15336 @option{-mmedium-calls} instead.
15338 @item -mearly-cbranchsi
15339 @opindex mearly-cbranchsi
15340 Enable pre-reload use of the @code{cbranchsi} pattern.
15342 @item -mexpand-adddi
15343 @opindex mexpand-adddi
15344 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
15345 @code{add.f}, @code{adc} etc. This option is deprecated.
15347 @item -mindexed-loads
15348 @opindex mindexed-loads
15349 Enable the use of indexed loads. This can be problematic because some
15350 optimizers then assume that indexed stores exist, which is not
15355 Enable Local Register Allocation. This is still experimental for ARC,
15356 so by default the compiler uses standard reload
15357 (i.e. @option{-mno-lra}).
15359 @item -mlra-priority-none
15360 @opindex mlra-priority-none
15361 Don't indicate any priority for target registers.
15363 @item -mlra-priority-compact
15364 @opindex mlra-priority-compact
15365 Indicate target register priority for r0..r3 / r12..r15.
15367 @item -mlra-priority-noncompact
15368 @opindex mlra-priority-noncompact
15369 Reduce target register priority for r0..r3 / r12..r15.
15371 @item -mno-millicode
15372 @opindex mno-millicode
15373 When optimizing for size (using @option{-Os}), prologues and epilogues
15374 that have to save or restore a large number of registers are often
15375 shortened by using call to a special function in libgcc; this is
15376 referred to as a @emph{millicode} call. As these calls can pose
15377 performance issues, and/or cause linking issues when linking in a
15378 nonstandard way, this option is provided to turn off millicode call
15382 @opindex mmixed-code
15383 Tweak register allocation to help 16-bit instruction generation.
15384 This generally has the effect of decreasing the average instruction size
15385 while increasing the instruction count.
15389 Enable @samp{q} instruction alternatives.
15390 This is the default for @option{-Os}.
15394 Enable @samp{Rcq} constraint handling.
15395 Most short code generation depends on this.
15396 This is the default.
15400 Enable @samp{Rcw} constraint handling.
15401 Most ccfsm condexec mostly depends on this.
15402 This is the default.
15404 @item -msize-level=@var{level}
15405 @opindex msize-level
15406 Fine-tune size optimization with regards to instruction lengths and alignment.
15407 The recognized values for @var{level} are:
15410 No size optimization. This level is deprecated and treated like @samp{1}.
15413 Short instructions are used opportunistically.
15416 In addition, alignment of loops and of code after barriers are dropped.
15419 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
15423 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
15424 the behavior when this is not set is equivalent to level @samp{1}.
15426 @item -mtune=@var{cpu}
15428 Set instruction scheduling parameters for @var{cpu}, overriding any implied
15429 by @option{-mcpu=}.
15431 Supported values for @var{cpu} are
15435 Tune for ARC600 CPU.
15438 Tune for ARC601 CPU.
15441 Tune for ARC700 CPU with standard multiplier block.
15444 Tune for ARC700 CPU with XMAC block.
15447 Tune for ARC725D CPU.
15450 Tune for ARC750D CPU.
15454 @item -mmultcost=@var{num}
15456 Cost to assume for a multiply instruction, with @samp{4} being equal to a
15457 normal instruction.
15459 @item -munalign-prob-threshold=@var{probability}
15460 @opindex munalign-prob-threshold
15461 Set probability threshold for unaligning branches.
15462 When tuning for @samp{ARC700} and optimizing for speed, branches without
15463 filled delay slot are preferably emitted unaligned and long, unless
15464 profiling indicates that the probability for the branch to be taken
15465 is below @var{probability}. @xref{Cross-profiling}.
15466 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
15470 The following options are maintained for backward compatibility, but
15471 are now deprecated and will be removed in a future release:
15473 @c Deprecated options
15481 @opindex mbig-endian
15484 Compile code for big-endian targets. Use of these options is now
15485 deprecated. Big-endian code is supported by configuring GCC to build
15486 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
15487 for which big endian is the default.
15489 @item -mlittle-endian
15490 @opindex mlittle-endian
15493 Compile code for little-endian targets. Use of these options is now
15494 deprecated. Little-endian code is supported by configuring GCC to build
15495 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
15496 for which little endian is the default.
15498 @item -mbarrel_shifter
15499 @opindex mbarrel_shifter
15500 Replaced by @option{-mbarrel-shifter}.
15502 @item -mdpfp_compact
15503 @opindex mdpfp_compact
15504 Replaced by @option{-mdpfp-compact}.
15507 @opindex mdpfp_fast
15508 Replaced by @option{-mdpfp-fast}.
15511 @opindex mdsp_packa
15512 Replaced by @option{-mdsp-packa}.
15516 Replaced by @option{-mea}.
15520 Replaced by @option{-mmac-24}.
15524 Replaced by @option{-mmac-d16}.
15526 @item -mspfp_compact
15527 @opindex mspfp_compact
15528 Replaced by @option{-mspfp-compact}.
15531 @opindex mspfp_fast
15532 Replaced by @option{-mspfp-fast}.
15534 @item -mtune=@var{cpu}
15536 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
15537 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
15538 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
15540 @item -multcost=@var{num}
15542 Replaced by @option{-mmultcost}.
15547 @subsection ARM Options
15548 @cindex ARM options
15550 These @samp{-m} options are defined for the ARM port:
15553 @item -mabi=@var{name}
15555 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
15556 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
15559 @opindex mapcs-frame
15560 Generate a stack frame that is compliant with the ARM Procedure Call
15561 Standard for all functions, even if this is not strictly necessary for
15562 correct execution of the code. Specifying @option{-fomit-frame-pointer}
15563 with this option causes the stack frames not to be generated for
15564 leaf functions. The default is @option{-mno-apcs-frame}.
15565 This option is deprecated.
15569 This is a synonym for @option{-mapcs-frame} and is deprecated.
15572 @c not currently implemented
15573 @item -mapcs-stack-check
15574 @opindex mapcs-stack-check
15575 Generate code to check the amount of stack space available upon entry to
15576 every function (that actually uses some stack space). If there is
15577 insufficient space available then either the function
15578 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
15579 called, depending upon the amount of stack space required. The runtime
15580 system is required to provide these functions. The default is
15581 @option{-mno-apcs-stack-check}, since this produces smaller code.
15583 @c not currently implemented
15584 @item -mapcs-reentrant
15585 @opindex mapcs-reentrant
15586 Generate reentrant, position-independent code. The default is
15587 @option{-mno-apcs-reentrant}.
15590 @item -mthumb-interwork
15591 @opindex mthumb-interwork
15592 Generate code that supports calling between the ARM and Thumb
15593 instruction sets. Without this option, on pre-v5 architectures, the
15594 two instruction sets cannot be reliably used inside one program. The
15595 default is @option{-mno-thumb-interwork}, since slightly larger code
15596 is generated when @option{-mthumb-interwork} is specified. In AAPCS
15597 configurations this option is meaningless.
15599 @item -mno-sched-prolog
15600 @opindex mno-sched-prolog
15601 Prevent the reordering of instructions in the function prologue, or the
15602 merging of those instruction with the instructions in the function's
15603 body. This means that all functions start with a recognizable set
15604 of instructions (or in fact one of a choice from a small set of
15605 different function prologues), and this information can be used to
15606 locate the start of functions inside an executable piece of code. The
15607 default is @option{-msched-prolog}.
15609 @item -mfloat-abi=@var{name}
15610 @opindex mfloat-abi
15611 Specifies which floating-point ABI to use. Permissible values
15612 are: @samp{soft}, @samp{softfp} and @samp{hard}.
15614 Specifying @samp{soft} causes GCC to generate output containing
15615 library calls for floating-point operations.
15616 @samp{softfp} allows the generation of code using hardware floating-point
15617 instructions, but still uses the soft-float calling conventions.
15618 @samp{hard} allows generation of floating-point instructions
15619 and uses FPU-specific calling conventions.
15621 The default depends on the specific target configuration. Note that
15622 the hard-float and soft-float ABIs are not link-compatible; you must
15623 compile your entire program with the same ABI, and link with a
15624 compatible set of libraries.
15626 @item -mlittle-endian
15627 @opindex mlittle-endian
15628 Generate code for a processor running in little-endian mode. This is
15629 the default for all standard configurations.
15632 @opindex mbig-endian
15633 Generate code for a processor running in big-endian mode; the default is
15634 to compile code for a little-endian processor.
15639 When linking a big-endian image select between BE8 and BE32 formats.
15640 The option has no effect for little-endian images and is ignored. The
15641 default is dependent on the selected target architecture. For ARMv6
15642 and later architectures the default is BE8, for older architectures
15643 the default is BE32. BE32 format has been deprecated by ARM.
15645 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
15647 This specifies the name of the target ARM architecture. GCC uses this
15648 name to determine what kind of instructions it can emit when generating
15649 assembly code. This option can be used in conjunction with or instead
15650 of the @option{-mcpu=} option.
15652 Permissible names are:
15654 @samp{armv5t}, @samp{armv5te},
15655 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
15656 @samp{armv6z}, @samp{armv6zk},
15657 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
15658 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
15661 @samp{armv6-m}, @samp{armv6s-m},
15662 @samp{armv7-m}, @samp{armv7e-m},
15663 @samp{armv8-m.base}, @samp{armv8-m.main},
15664 @samp{iwmmxt} and @samp{iwmmxt2}.
15666 Additionally, the following architectures, which lack support for the
15667 Thumb execution state, are recognized but support is deprecated:
15668 @samp{armv2}, @samp{armv2a}, @samp{armv3}, @samp{armv3m},
15669 @samp{armv4}, @samp{armv5} and @samp{armv5e}.
15671 Many of the architectures support extensions. These can be added by
15672 appending @samp{+@var{extension}} to the architecture name. Extension
15673 options are processed in order and capabilities accumulate. An extension
15674 will also enable any necessary base extensions
15675 upon which it depends. For example, the @samp{+crypto} extension
15676 will always enable the @samp{+simd} extension. The exception to the
15677 additive construction is for extensions that are prefixed with
15678 @samp{+no@dots{}}: these extensions disable the specified option and
15679 any other extensions that may depend on the presence of that
15682 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
15683 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
15684 entirely disabled by the @samp{+nofp} option that follows it.
15686 Most extension names are generically named, but have an effect that is
15687 dependent upon the architecture to which it is applied. For example,
15688 the @samp{+simd} option can be applied to both @samp{armv7-a} and
15689 @samp{armv8-a} architectures, but will enable the original ARMv7-A
15690 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
15691 variant for @samp{armv8-a}.
15693 The table below lists the supported extensions for each architecture.
15694 Architectures not mentioned do not support any extensions.
15708 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
15709 used as an alias for this extension.
15712 Disable the floating-point instructions.
15716 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
15719 The VFPv3 floating-point instructions, with 16 double-precision
15720 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15721 for this extension. Note that floating-point is not supported by the
15722 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
15723 ARMv7-R architectures.
15726 Disable the floating-point instructions.
15732 The VFPv3 floating-point instructions, with 16 double-precision
15733 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15734 for this extension.
15737 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
15738 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
15739 for this extension.
15742 The VFPv3 floating-point instructions, with 32 double-precision
15745 @item +vfpv3-d16-fp16
15746 The VFPv3 floating-point instructions, with 16 double-precision
15747 registers and the half-precision floating-point conversion operations.
15750 The VFPv3 floating-point instructions, with 32 double-precision
15751 registers and the half-precision floating-point conversion operations.
15754 The VFPv4 floating-point instructions, with 16 double-precision
15758 The VFPv4 floating-point instructions, with 32 double-precision
15762 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
15763 the half-precision floating-point conversion operations.
15766 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
15769 Disable the Advanced SIMD instructions (does not disable floating point).
15772 Disable the floating-point and Advanced SIMD instructions.
15776 The extended version of the ARMv7-A architecture with support for
15780 The VFPv4 floating-point instructions, with 16 double-precision registers.
15781 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
15784 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
15785 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
15788 The VFPv3 floating-point instructions, with 16 double-precision
15792 The VFPv3 floating-point instructions, with 32 double-precision
15795 @item +vfpv3-d16-fp16
15796 The VFPv3 floating-point instructions, with 16 double-precision
15797 registers and the half-precision floating-point conversion operations.
15800 The VFPv3 floating-point instructions, with 32 double-precision
15801 registers and the half-precision floating-point conversion operations.
15804 The VFPv4 floating-point instructions, with 16 double-precision
15808 The VFPv4 floating-point instructions, with 32 double-precision
15812 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
15813 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
15816 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
15817 the half-precision floating-point conversion operations.
15820 Disable the Advanced SIMD instructions (does not disable floating point).
15823 Disable the floating-point and Advanced SIMD instructions.
15829 The Cyclic Redundancy Check (CRC) instructions.
15831 The ARMv8-A Advanced SIMD and floating-point instructions.
15833 The cryptographic instructions.
15835 Disable the cryptographic instructions.
15837 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15843 The ARMv8.1-A Advanced SIMD and floating-point instructions.
15846 The cryptographic instructions. This also enables the Advanced SIMD and
15847 floating-point instructions.
15850 Disable the cryptographic instructions.
15853 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15860 The half-precision floating-point data processing instructions.
15861 This also enables the Advanced SIMD and floating-point instructions.
15864 The ARMv8.1-A Advanced SIMD and floating-point instructions.
15867 The cryptographic instructions. This also enables the Advanced SIMD and
15868 floating-point instructions.
15871 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
15874 Disable the cryptographic extension.
15877 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15883 The single-precision VFPv3 floating-point instructions. The extension
15884 @samp{+vfpv3xd} can be used as an alias for this extension.
15887 The VFPv3 floating-point instructions with 16 double-precision registers.
15888 The extension +vfpv3-d16 can be used as an alias for this extension.
15891 Disable the floating-point extension.
15894 The ARM-state integer division instructions.
15897 Disable the ARM-state integer division extension.
15903 The single-precision VFPv4 floating-point instructions.
15906 The single-precision FPv5 floating-point instructions.
15909 The single- and double-precision FPv5 floating-point instructions.
15912 Disable the floating-point extensions.
15918 The DSP instructions.
15921 Disable the DSP extension.
15924 The single-precision floating-point instructions.
15927 The single- and double-precision floating-point instructions.
15930 Disable the floating-point extension.
15936 The Cyclic Redundancy Check (CRC) instructions.
15938 The single-precision FPv5 floating-point instructions.
15940 The ARMv8-A Advanced SIMD and floating-point instructions.
15942 The cryptographic instructions.
15944 Disable the cryptographic instructions.
15946 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15951 @option{-march=native} causes the compiler to auto-detect the architecture
15952 of the build computer. At present, this feature is only supported on
15953 GNU/Linux, and not all architectures are recognized. If the auto-detect
15954 is unsuccessful the option has no effect.
15956 @item -mtune=@var{name}
15958 This option specifies the name of the target ARM processor for
15959 which GCC should tune the performance of the code.
15960 For some ARM implementations better performance can be obtained by using
15962 Permissible names are: @samp{arm2}, @samp{arm250},
15963 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
15964 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
15965 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
15966 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
15968 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
15969 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
15970 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
15971 @samp{strongarm1110},
15972 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
15973 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
15974 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
15975 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
15976 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
15977 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
15978 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
15979 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
15980 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
15981 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15982 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15983 @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7},
15984 @samp{cortex-r8}, @samp{cortex-r52},
15992 @samp{cortex-m0plus},
15993 @samp{cortex-m1.small-multiply},
15994 @samp{cortex-m0.small-multiply},
15995 @samp{cortex-m0plus.small-multiply},
15997 @samp{marvell-pj4},
15998 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
15999 @samp{fa526}, @samp{fa626},
16000 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
16003 Additionally, this option can specify that GCC should tune the performance
16004 of the code for a big.LITTLE system. Permissible names are:
16005 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
16006 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16007 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
16008 @samp{cortex-a75.cortex-a55}.
16010 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
16011 performance for a blend of processors within architecture @var{arch}.
16012 The aim is to generate code that run well on the current most popular
16013 processors, balancing between optimizations that benefit some CPUs in the
16014 range, and avoiding performance pitfalls of other CPUs. The effects of
16015 this option may change in future GCC versions as CPU models come and go.
16017 @option{-mtune} permits the same extension options as @option{-mcpu}, but
16018 the extension options do not affect the tuning of the generated code.
16020 @option{-mtune=native} causes the compiler to auto-detect the CPU
16021 of the build computer. At present, this feature is only supported on
16022 GNU/Linux, and not all architectures are recognized. If the auto-detect is
16023 unsuccessful the option has no effect.
16025 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
16027 This specifies the name of the target ARM processor. GCC uses this name
16028 to derive the name of the target ARM architecture (as if specified
16029 by @option{-march}) and the ARM processor type for which to tune for
16030 performance (as if specified by @option{-mtune}). Where this option
16031 is used in conjunction with @option{-march} or @option{-mtune},
16032 those options take precedence over the appropriate part of this option.
16034 Many of the supported CPUs implement optional architectural
16035 extensions. Where this is so the architectural extensions are
16036 normally enabled by default. If implementations that lack the
16037 extension exist, then the extension syntax can be used to disable
16038 those extensions that have been omitted. For floating-point and
16039 Advanced SIMD (Neon) instructions, the settings of the options
16040 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
16041 floating-point and Advanced SIMD instructions will only be used if
16042 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
16043 @option{-mfpu} other than @samp{auto} will override the available
16044 floating-point and SIMD extension instructions.
16046 For example, @samp{cortex-a9} can be found in three major
16047 configurations: integer only, with just a floating-point unit or with
16048 floating-point and Advanced SIMD. The default is to enable all the
16049 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
16050 be used to disable just the SIMD or both the SIMD and floating-point
16051 instructions respectively.
16053 Permissible names for this option are the same as those for
16056 The following extension options are common to the listed CPUs:
16060 Disable the DSP instructions on @samp{cortex-m33}.
16063 Disables the floating-point instructions on @samp{arm9e},
16064 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
16065 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
16066 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
16067 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
16068 Disables the floating-point and SIMD instructions on
16069 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
16070 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
16071 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
16072 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
16073 @samp{cortex-a53} and @samp{cortex-a55}.
16076 Disables the double-precision component of the floating-point instructions
16077 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
16080 Disables the SIMD (but not floating-point) instructions on
16081 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
16082 and @samp{cortex-a9}.
16085 Enables the cryptographic instructions on @samp{cortex-a32},
16086 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
16087 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
16088 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16089 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
16090 @samp{cortex-a75.cortex-a55}.
16093 Additionally the @samp{generic-armv7-a} pseudo target defaults to
16094 VFPv3 with 16 double-precision registers. It supports the following
16095 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
16096 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
16097 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
16098 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
16099 @option{-march=armv7-a}.
16101 @option{-mcpu=generic-@var{arch}} is also permissible, and is
16102 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
16103 See @option{-mtune} for more information.
16105 @option{-mcpu=native} causes the compiler to auto-detect the CPU
16106 of the build computer. At present, this feature is only supported on
16107 GNU/Linux, and not all architectures are recognized. If the auto-detect
16108 is unsuccessful the option has no effect.
16110 @item -mfpu=@var{name}
16112 This specifies what floating-point hardware (or hardware emulation) is
16113 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
16115 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
16116 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
16117 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
16118 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
16119 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
16120 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
16121 is an alias for @samp{vfpv2}.
16123 The setting @samp{auto} is the default and is special. It causes the
16124 compiler to select the floating-point and Advanced SIMD instructions
16125 based on the settings of @option{-mcpu} and @option{-march}.
16127 If the selected floating-point hardware includes the NEON extension
16128 (e.g. @option{-mfpu=neon}), note that floating-point
16129 operations are not generated by GCC's auto-vectorization pass unless
16130 @option{-funsafe-math-optimizations} is also specified. This is
16131 because NEON hardware does not fully implement the IEEE 754 standard for
16132 floating-point arithmetic (in particular denormal values are treated as
16133 zero), so the use of NEON instructions may lead to a loss of precision.
16135 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}).
16137 @item -mfp16-format=@var{name}
16138 @opindex mfp16-format
16139 Specify the format of the @code{__fp16} half-precision floating-point type.
16140 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
16141 the default is @samp{none}, in which case the @code{__fp16} type is not
16142 defined. @xref{Half-Precision}, for more information.
16144 @item -mstructure-size-boundary=@var{n}
16145 @opindex mstructure-size-boundary
16146 The sizes of all structures and unions are rounded up to a multiple
16147 of the number of bits set by this option. Permissible values are 8, 32
16148 and 64. The default value varies for different toolchains. For the COFF
16149 targeted toolchain the default value is 8. A value of 64 is only allowed
16150 if the underlying ABI supports it.
16152 Specifying a larger number can produce faster, more efficient code, but
16153 can also increase the size of the program. Different values are potentially
16154 incompatible. Code compiled with one value cannot necessarily expect to
16155 work with code or libraries compiled with another value, if they exchange
16156 information using structures or unions.
16158 This option is deprecated.
16160 @item -mabort-on-noreturn
16161 @opindex mabort-on-noreturn
16162 Generate a call to the function @code{abort} at the end of a
16163 @code{noreturn} function. It is executed if the function tries to
16167 @itemx -mno-long-calls
16168 @opindex mlong-calls
16169 @opindex mno-long-calls
16170 Tells the compiler to perform function calls by first loading the
16171 address of the function into a register and then performing a subroutine
16172 call on this register. This switch is needed if the target function
16173 lies outside of the 64-megabyte addressing range of the offset-based
16174 version of subroutine call instruction.
16176 Even if this switch is enabled, not all function calls are turned
16177 into long calls. The heuristic is that static functions, functions
16178 that have the @code{short_call} attribute, functions that are inside
16179 the scope of a @code{#pragma no_long_calls} directive, and functions whose
16180 definitions have already been compiled within the current compilation
16181 unit are not turned into long calls. The exceptions to this rule are
16182 that weak function definitions, functions with the @code{long_call}
16183 attribute or the @code{section} attribute, and functions that are within
16184 the scope of a @code{#pragma long_calls} directive are always
16185 turned into long calls.
16187 This feature is not enabled by default. Specifying
16188 @option{-mno-long-calls} restores the default behavior, as does
16189 placing the function calls within the scope of a @code{#pragma
16190 long_calls_off} directive. Note these switches have no effect on how
16191 the compiler generates code to handle function calls via function
16194 @item -msingle-pic-base
16195 @opindex msingle-pic-base
16196 Treat the register used for PIC addressing as read-only, rather than
16197 loading it in the prologue for each function. The runtime system is
16198 responsible for initializing this register with an appropriate value
16199 before execution begins.
16201 @item -mpic-register=@var{reg}
16202 @opindex mpic-register
16203 Specify the register to be used for PIC addressing.
16204 For standard PIC base case, the default is any suitable register
16205 determined by compiler. For single PIC base case, the default is
16206 @samp{R9} if target is EABI based or stack-checking is enabled,
16207 otherwise the default is @samp{R10}.
16209 @item -mpic-data-is-text-relative
16210 @opindex mpic-data-is-text-relative
16211 Assume that the displacement between the text and data segments is fixed
16212 at static link time. This permits using PC-relative addressing
16213 operations to access data known to be in the data segment. For
16214 non-VxWorks RTP targets, this option is enabled by default. When
16215 disabled on such targets, it will enable @option{-msingle-pic-base} by
16218 @item -mpoke-function-name
16219 @opindex mpoke-function-name
16220 Write the name of each function into the text section, directly
16221 preceding the function prologue. The generated code is similar to this:
16225 .ascii "arm_poke_function_name", 0
16228 .word 0xff000000 + (t1 - t0)
16229 arm_poke_function_name
16231 stmfd sp!, @{fp, ip, lr, pc@}
16235 When performing a stack backtrace, code can inspect the value of
16236 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
16237 location @code{pc - 12} and the top 8 bits are set, then we know that
16238 there is a function name embedded immediately preceding this location
16239 and has length @code{((pc[-3]) & 0xff000000)}.
16246 Select between generating code that executes in ARM and Thumb
16247 states. The default for most configurations is to generate code
16248 that executes in ARM state, but the default can be changed by
16249 configuring GCC with the @option{--with-mode=}@var{state}
16252 You can also override the ARM and Thumb mode for each function
16253 by using the @code{target("thumb")} and @code{target("arm")} function attributes
16254 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
16257 @opindex mflip-thumb
16258 Switch ARM/Thumb modes on alternating functions.
16259 This option is provided for regression testing of mixed Thumb/ARM code
16260 generation, and is not intended for ordinary use in compiling code.
16263 @opindex mtpcs-frame
16264 Generate a stack frame that is compliant with the Thumb Procedure Call
16265 Standard for all non-leaf functions. (A leaf function is one that does
16266 not call any other functions.) The default is @option{-mno-tpcs-frame}.
16268 @item -mtpcs-leaf-frame
16269 @opindex mtpcs-leaf-frame
16270 Generate a stack frame that is compliant with the Thumb Procedure Call
16271 Standard for all leaf functions. (A leaf function is one that does
16272 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
16274 @item -mcallee-super-interworking
16275 @opindex mcallee-super-interworking
16276 Gives all externally visible functions in the file being compiled an ARM
16277 instruction set header which switches to Thumb mode before executing the
16278 rest of the function. This allows these functions to be called from
16279 non-interworking code. This option is not valid in AAPCS configurations
16280 because interworking is enabled by default.
16282 @item -mcaller-super-interworking
16283 @opindex mcaller-super-interworking
16284 Allows calls via function pointers (including virtual functions) to
16285 execute correctly regardless of whether the target code has been
16286 compiled for interworking or not. There is a small overhead in the cost
16287 of executing a function pointer if this option is enabled. This option
16288 is not valid in AAPCS configurations because interworking is enabled
16291 @item -mtp=@var{name}
16293 Specify the access model for the thread local storage pointer. The valid
16294 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
16295 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
16296 (supported in the arm6k architecture), and @samp{auto}, which uses the
16297 best available method for the selected processor. The default setting is
16300 @item -mtls-dialect=@var{dialect}
16301 @opindex mtls-dialect
16302 Specify the dialect to use for accessing thread local storage. Two
16303 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
16304 @samp{gnu} dialect selects the original GNU scheme for supporting
16305 local and global dynamic TLS models. The @samp{gnu2} dialect
16306 selects the GNU descriptor scheme, which provides better performance
16307 for shared libraries. The GNU descriptor scheme is compatible with
16308 the original scheme, but does require new assembler, linker and
16309 library support. Initial and local exec TLS models are unaffected by
16310 this option and always use the original scheme.
16312 @item -mword-relocations
16313 @opindex mword-relocations
16314 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
16315 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
16316 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
16319 @item -mfix-cortex-m3-ldrd
16320 @opindex mfix-cortex-m3-ldrd
16321 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
16322 with overlapping destination and base registers are used. This option avoids
16323 generating these instructions. This option is enabled by default when
16324 @option{-mcpu=cortex-m3} is specified.
16326 @item -munaligned-access
16327 @itemx -mno-unaligned-access
16328 @opindex munaligned-access
16329 @opindex mno-unaligned-access
16330 Enables (or disables) reading and writing of 16- and 32- bit values
16331 from addresses that are not 16- or 32- bit aligned. By default
16332 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
16333 ARMv8-M Baseline architectures, and enabled for all other
16334 architectures. If unaligned access is not enabled then words in packed
16335 data structures are accessed a byte at a time.
16337 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
16338 generated object file to either true or false, depending upon the
16339 setting of this option. If unaligned access is enabled then the
16340 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
16343 @item -mneon-for-64bits
16344 @opindex mneon-for-64bits
16345 Enables using Neon to handle scalar 64-bits operations. This is
16346 disabled by default since the cost of moving data from core registers
16349 @item -mslow-flash-data
16350 @opindex mslow-flash-data
16351 Assume loading data from flash is slower than fetching instruction.
16352 Therefore literal load is minimized for better performance.
16353 This option is only supported when compiling for ARMv7 M-profile and
16356 @item -masm-syntax-unified
16357 @opindex masm-syntax-unified
16358 Assume inline assembler is using unified asm syntax. The default is
16359 currently off which implies divided syntax. This option has no impact
16360 on Thumb2. However, this may change in future releases of GCC.
16361 Divided syntax should be considered deprecated.
16363 @item -mrestrict-it
16364 @opindex mrestrict-it
16365 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
16366 IT blocks can only contain a single 16-bit instruction from a select
16367 set of instructions. This option is on by default for ARMv8-A Thumb mode.
16369 @item -mprint-tune-info
16370 @opindex mprint-tune-info
16371 Print CPU tuning information as comment in assembler file. This is
16372 an option used only for regression testing of the compiler and not
16373 intended for ordinary use in compiling code. This option is disabled
16376 @item -mverbose-cost-dump
16377 @opindex mverbose-cost-dump
16378 Enable verbose cost model dumping in the debug dump files. This option is
16379 provided for use in debugging the compiler.
16382 @opindex mpure-code
16383 Do not allow constant data to be placed in code sections.
16384 Additionally, when compiling for ELF object format give all text sections the
16385 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
16386 is only available when generating non-pic code for M-profile targets with the
16391 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
16392 Development Tools Engineering Specification", which can be found on
16393 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
16397 @subsection AVR Options
16398 @cindex AVR Options
16400 These options are defined for AVR implementations:
16403 @item -mmcu=@var{mcu}
16405 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16407 The default for this option is@tie{}@samp{avr2}.
16409 GCC supports the following AVR devices and ISAs:
16411 @include avr-mmcu.texi
16416 Assume that all data in static storage can be accessed by LDS / STS
16417 instructions. This option has only an effect on reduced Tiny devices like
16418 ATtiny40. See also the @code{absdata}
16419 @ref{AVR Variable Attributes,variable attribute}.
16421 @item -maccumulate-args
16422 @opindex maccumulate-args
16423 Accumulate outgoing function arguments and acquire/release the needed
16424 stack space for outgoing function arguments once in function
16425 prologue/epilogue. Without this option, outgoing arguments are pushed
16426 before calling a function and popped afterwards.
16428 Popping the arguments after the function call can be expensive on
16429 AVR so that accumulating the stack space might lead to smaller
16430 executables because arguments need not be removed from the
16431 stack after such a function call.
16433 This option can lead to reduced code size for functions that perform
16434 several calls to functions that get their arguments on the stack like
16435 calls to printf-like functions.
16437 @item -mbranch-cost=@var{cost}
16438 @opindex mbranch-cost
16439 Set the branch costs for conditional branch instructions to
16440 @var{cost}. Reasonable values for @var{cost} are small, non-negative
16441 integers. The default branch cost is 0.
16443 @item -mcall-prologues
16444 @opindex mcall-prologues
16445 Functions prologues/epilogues are expanded as calls to appropriate
16446 subroutines. Code size is smaller.
16448 @item -mgas-isr-prologues
16449 @opindex mgas-isr-prologues
16450 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
16451 instruction supported by GNU Binutils.
16452 If this option is on, the feature can still be disabled for individual
16453 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
16454 function attribute. This feature is activated per default
16455 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
16456 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
16460 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
16461 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
16462 and @code{long long} is 4 bytes. Please note that this option does not
16463 conform to the C standards, but it results in smaller code
16466 @item -mmain-is-OS_task
16467 @opindex mmain-is-OS_task
16468 Do not save registers in @code{main}. The effect is the same like
16469 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
16470 to @code{main}. It is activated per default if optimization is on.
16472 @item -mn-flash=@var{num}
16474 Assume that the flash memory has a size of
16475 @var{num} times 64@tie{}KiB.
16477 @item -mno-interrupts
16478 @opindex mno-interrupts
16479 Generated code is not compatible with hardware interrupts.
16480 Code size is smaller.
16484 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
16485 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
16486 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
16487 the assembler's command line and the @option{--relax} option to the
16488 linker's command line.
16490 Jump relaxing is performed by the linker because jump offsets are not
16491 known before code is located. Therefore, the assembler code generated by the
16492 compiler is the same, but the instructions in the executable may
16493 differ from instructions in the assembler code.
16495 Relaxing must be turned on if linker stubs are needed, see the
16496 section on @code{EIND} and linker stubs below.
16500 Assume that the device supports the Read-Modify-Write
16501 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
16503 @item -mshort-calls
16504 @opindex mshort-calls
16506 Assume that @code{RJMP} and @code{RCALL} can target the whole
16509 This option is used internally for multilib selection. It is
16510 not an optimization option, and you don't need to set it by hand.
16514 Treat the stack pointer register as an 8-bit register,
16515 i.e.@: assume the high byte of the stack pointer is zero.
16516 In general, you don't need to set this option by hand.
16518 This option is used internally by the compiler to select and
16519 build multilibs for architectures @code{avr2} and @code{avr25}.
16520 These architectures mix devices with and without @code{SPH}.
16521 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
16522 the compiler driver adds or removes this option from the compiler
16523 proper's command line, because the compiler then knows if the device
16524 or architecture has an 8-bit stack pointer and thus no @code{SPH}
16529 Use address register @code{X} in a way proposed by the hardware. This means
16530 that @code{X} is only used in indirect, post-increment or
16531 pre-decrement addressing.
16533 Without this option, the @code{X} register may be used in the same way
16534 as @code{Y} or @code{Z} which then is emulated by additional
16536 For example, loading a value with @code{X+const} addressing with a
16537 small non-negative @code{const < 64} to a register @var{Rn} is
16541 adiw r26, const ; X += const
16542 ld @var{Rn}, X ; @var{Rn} = *X
16543 sbiw r26, const ; X -= const
16547 @opindex mtiny-stack
16548 Only change the lower 8@tie{}bits of the stack pointer.
16550 @item -mfract-convert-truncate
16551 @opindex mfract-convert-truncate
16552 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
16555 @opindex nodevicelib
16556 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
16558 @item -Waddr-space-convert
16559 @opindex Waddr-space-convert
16560 Warn about conversions between address spaces in the case where the
16561 resulting address space is not contained in the incoming address space.
16563 @item -Wmisspelled-isr
16564 @opindex Wmisspelled-isr
16565 Warn if the ISR is misspelled, i.e. without __vector prefix.
16566 Enabled by default.
16569 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
16570 @cindex @code{EIND}
16571 Pointers in the implementation are 16@tie{}bits wide.
16572 The address of a function or label is represented as word address so
16573 that indirect jumps and calls can target any code address in the
16574 range of 64@tie{}Ki words.
16576 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
16577 bytes of program memory space, there is a special function register called
16578 @code{EIND} that serves as most significant part of the target address
16579 when @code{EICALL} or @code{EIJMP} instructions are used.
16581 Indirect jumps and calls on these devices are handled as follows by
16582 the compiler and are subject to some limitations:
16587 The compiler never sets @code{EIND}.
16590 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
16591 instructions or might read @code{EIND} directly in order to emulate an
16592 indirect call/jump by means of a @code{RET} instruction.
16595 The compiler assumes that @code{EIND} never changes during the startup
16596 code or during the application. In particular, @code{EIND} is not
16597 saved/restored in function or interrupt service routine
16601 For indirect calls to functions and computed goto, the linker
16602 generates @emph{stubs}. Stubs are jump pads sometimes also called
16603 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
16604 The stub contains a direct jump to the desired address.
16607 Linker relaxation must be turned on so that the linker generates
16608 the stubs correctly in all situations. See the compiler option
16609 @option{-mrelax} and the linker option @option{--relax}.
16610 There are corner cases where the linker is supposed to generate stubs
16611 but aborts without relaxation and without a helpful error message.
16614 The default linker script is arranged for code with @code{EIND = 0}.
16615 If code is supposed to work for a setup with @code{EIND != 0}, a custom
16616 linker script has to be used in order to place the sections whose
16617 name start with @code{.trampolines} into the segment where @code{EIND}
16621 The startup code from libgcc never sets @code{EIND}.
16622 Notice that startup code is a blend of code from libgcc and AVR-LibC.
16623 For the impact of AVR-LibC on @code{EIND}, see the
16624 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
16627 It is legitimate for user-specific startup code to set up @code{EIND}
16628 early, for example by means of initialization code located in
16629 section @code{.init3}. Such code runs prior to general startup code
16630 that initializes RAM and calls constructors, but after the bit
16631 of startup code from AVR-LibC that sets @code{EIND} to the segment
16632 where the vector table is located.
16634 #include <avr/io.h>
16637 __attribute__((section(".init3"),naked,used,no_instrument_function))
16638 init3_set_eind (void)
16640 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
16641 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
16646 The @code{__trampolines_start} symbol is defined in the linker script.
16649 Stubs are generated automatically by the linker if
16650 the following two conditions are met:
16653 @item The address of a label is taken by means of the @code{gs} modifier
16654 (short for @emph{generate stubs}) like so:
16656 LDI r24, lo8(gs(@var{func}))
16657 LDI r25, hi8(gs(@var{func}))
16659 @item The final location of that label is in a code segment
16660 @emph{outside} the segment where the stubs are located.
16664 The compiler emits such @code{gs} modifiers for code labels in the
16665 following situations:
16667 @item Taking address of a function or code label.
16668 @item Computed goto.
16669 @item If prologue-save function is used, see @option{-mcall-prologues}
16670 command-line option.
16671 @item Switch/case dispatch tables. If you do not want such dispatch
16672 tables you can specify the @option{-fno-jump-tables} command-line option.
16673 @item C and C++ constructors/destructors called during startup/shutdown.
16674 @item If the tools hit a @code{gs()} modifier explained above.
16678 Jumping to non-symbolic addresses like so is @emph{not} supported:
16683 /* Call function at word address 0x2 */
16684 return ((int(*)(void)) 0x2)();
16688 Instead, a stub has to be set up, i.e.@: the function has to be called
16689 through a symbol (@code{func_4} in the example):
16694 extern int func_4 (void);
16696 /* Call function at byte address 0x4 */
16701 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
16702 Alternatively, @code{func_4} can be defined in the linker script.
16705 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
16706 @cindex @code{RAMPD}
16707 @cindex @code{RAMPX}
16708 @cindex @code{RAMPY}
16709 @cindex @code{RAMPZ}
16710 Some AVR devices support memories larger than the 64@tie{}KiB range
16711 that can be accessed with 16-bit pointers. To access memory locations
16712 outside this 64@tie{}KiB range, the content of a @code{RAMP}
16713 register is used as high part of the address:
16714 The @code{X}, @code{Y}, @code{Z} address register is concatenated
16715 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
16716 register, respectively, to get a wide address. Similarly,
16717 @code{RAMPD} is used together with direct addressing.
16721 The startup code initializes the @code{RAMP} special function
16722 registers with zero.
16725 If a @ref{AVR Named Address Spaces,named address space} other than
16726 generic or @code{__flash} is used, then @code{RAMPZ} is set
16727 as needed before the operation.
16730 If the device supports RAM larger than 64@tie{}KiB and the compiler
16731 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
16732 is reset to zero after the operation.
16735 If the device comes with a specific @code{RAMP} register, the ISR
16736 prologue/epilogue saves/restores that SFR and initializes it with
16737 zero in case the ISR code might (implicitly) use it.
16740 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
16741 If you use inline assembler to read from locations outside the
16742 16-bit address range and change one of the @code{RAMP} registers,
16743 you must reset it to zero after the access.
16747 @subsubsection AVR Built-in Macros
16749 GCC defines several built-in macros so that the user code can test
16750 for the presence or absence of features. Almost any of the following
16751 built-in macros are deduced from device capabilities and thus
16752 triggered by the @option{-mmcu=} command-line option.
16754 For even more AVR-specific built-in macros see
16755 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
16760 Build-in macro that resolves to a decimal number that identifies the
16761 architecture and depends on the @option{-mmcu=@var{mcu}} option.
16762 Possible values are:
16764 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
16765 @code{4}, @code{5}, @code{51}, @code{6}
16767 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
16768 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
16773 @code{102}, @code{103}, @code{104},
16774 @code{105}, @code{106}, @code{107}
16776 for @var{mcu}=@code{avrtiny},
16777 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
16778 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
16779 If @var{mcu} specifies a device, this built-in macro is set
16780 accordingly. For example, with @option{-mmcu=atmega8} the macro is
16781 defined to @code{4}.
16783 @item __AVR_@var{Device}__
16784 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
16785 the device's name. For example, @option{-mmcu=atmega8} defines the
16786 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
16787 @code{__AVR_ATtiny261A__}, etc.
16789 The built-in macros' names follow
16790 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
16791 the device name as from the AVR user manual. The difference between
16792 @var{Device} in the built-in macro and @var{device} in
16793 @option{-mmcu=@var{device}} is that the latter is always lowercase.
16795 If @var{device} is not a device but only a core architecture like
16796 @samp{avr51}, this macro is not defined.
16798 @item __AVR_DEVICE_NAME__
16799 Setting @option{-mmcu=@var{device}} defines this built-in macro to
16800 the device's name. For example, with @option{-mmcu=atmega8} the macro
16801 is defined to @code{atmega8}.
16803 If @var{device} is not a device but only a core architecture like
16804 @samp{avr51}, this macro is not defined.
16806 @item __AVR_XMEGA__
16807 The device / architecture belongs to the XMEGA family of devices.
16809 @item __AVR_HAVE_ELPM__
16810 The device has the @code{ELPM} instruction.
16812 @item __AVR_HAVE_ELPMX__
16813 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
16814 R@var{n},Z+} instructions.
16816 @item __AVR_HAVE_MOVW__
16817 The device has the @code{MOVW} instruction to perform 16-bit
16818 register-register moves.
16820 @item __AVR_HAVE_LPMX__
16821 The device has the @code{LPM R@var{n},Z} and
16822 @code{LPM R@var{n},Z+} instructions.
16824 @item __AVR_HAVE_MUL__
16825 The device has a hardware multiplier.
16827 @item __AVR_HAVE_JMP_CALL__
16828 The device has the @code{JMP} and @code{CALL} instructions.
16829 This is the case for devices with more than 8@tie{}KiB of program
16832 @item __AVR_HAVE_EIJMP_EICALL__
16833 @itemx __AVR_3_BYTE_PC__
16834 The device has the @code{EIJMP} and @code{EICALL} instructions.
16835 This is the case for devices with more than 128@tie{}KiB of program memory.
16836 This also means that the program counter
16837 (PC) is 3@tie{}bytes wide.
16839 @item __AVR_2_BYTE_PC__
16840 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
16841 with up to 128@tie{}KiB of program memory.
16843 @item __AVR_HAVE_8BIT_SP__
16844 @itemx __AVR_HAVE_16BIT_SP__
16845 The stack pointer (SP) register is treated as 8-bit respectively
16846 16-bit register by the compiler.
16847 The definition of these macros is affected by @option{-mtiny-stack}.
16849 @item __AVR_HAVE_SPH__
16851 The device has the SPH (high part of stack pointer) special function
16852 register or has an 8-bit stack pointer, respectively.
16853 The definition of these macros is affected by @option{-mmcu=} and
16854 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
16857 @item __AVR_HAVE_RAMPD__
16858 @itemx __AVR_HAVE_RAMPX__
16859 @itemx __AVR_HAVE_RAMPY__
16860 @itemx __AVR_HAVE_RAMPZ__
16861 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
16862 @code{RAMPZ} special function register, respectively.
16864 @item __NO_INTERRUPTS__
16865 This macro reflects the @option{-mno-interrupts} command-line option.
16867 @item __AVR_ERRATA_SKIP__
16868 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
16869 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
16870 instructions because of a hardware erratum. Skip instructions are
16871 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
16872 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
16875 @item __AVR_ISA_RMW__
16876 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
16878 @item __AVR_SFR_OFFSET__=@var{offset}
16879 Instructions that can address I/O special function registers directly
16880 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
16881 address as if addressed by an instruction to access RAM like @code{LD}
16882 or @code{STS}. This offset depends on the device architecture and has
16883 to be subtracted from the RAM address in order to get the
16884 respective I/O@tie{}address.
16886 @item __AVR_SHORT_CALLS__
16887 The @option{-mshort-calls} command line option is set.
16889 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
16890 Some devices support reading from flash memory by means of @code{LD*}
16891 instructions. The flash memory is seen in the data address space
16892 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
16893 is not defined, this feature is not available. If defined,
16894 the address space is linear and there is no need to put
16895 @code{.rodata} into RAM. This is handled by the default linker
16896 description file, and is currently available for
16897 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
16898 there is no need to use address spaces like @code{__flash} or
16899 features like attribute @code{progmem} and @code{pgm_read_*}.
16901 @item __WITH_AVRLIBC__
16902 The compiler is configured to be used together with AVR-Libc.
16903 See the @option{--with-avrlibc} configure option.
16907 @node Blackfin Options
16908 @subsection Blackfin Options
16909 @cindex Blackfin Options
16912 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
16914 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
16915 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
16916 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
16917 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
16918 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
16919 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
16920 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
16921 @samp{bf561}, @samp{bf592}.
16923 The optional @var{sirevision} specifies the silicon revision of the target
16924 Blackfin processor. Any workarounds available for the targeted silicon revision
16925 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
16926 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
16927 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
16928 hexadecimal digits representing the major and minor numbers in the silicon
16929 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
16930 is not defined. If @var{sirevision} is @samp{any}, the
16931 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
16932 If this optional @var{sirevision} is not used, GCC assumes the latest known
16933 silicon revision of the targeted Blackfin processor.
16935 GCC defines a preprocessor macro for the specified @var{cpu}.
16936 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
16937 provided by libgloss to be linked in if @option{-msim} is not given.
16939 Without this option, @samp{bf532} is used as the processor by default.
16941 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
16942 only the preprocessor macro is defined.
16946 Specifies that the program will be run on the simulator. This causes
16947 the simulator BSP provided by libgloss to be linked in. This option
16948 has effect only for @samp{bfin-elf} toolchain.
16949 Certain other options, such as @option{-mid-shared-library} and
16950 @option{-mfdpic}, imply @option{-msim}.
16952 @item -momit-leaf-frame-pointer
16953 @opindex momit-leaf-frame-pointer
16954 Don't keep the frame pointer in a register for leaf functions. This
16955 avoids the instructions to save, set up and restore frame pointers and
16956 makes an extra register available in leaf functions.
16958 @item -mspecld-anomaly
16959 @opindex mspecld-anomaly
16960 When enabled, the compiler ensures that the generated code does not
16961 contain speculative loads after jump instructions. If this option is used,
16962 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
16964 @item -mno-specld-anomaly
16965 @opindex mno-specld-anomaly
16966 Don't generate extra code to prevent speculative loads from occurring.
16968 @item -mcsync-anomaly
16969 @opindex mcsync-anomaly
16970 When enabled, the compiler ensures that the generated code does not
16971 contain CSYNC or SSYNC instructions too soon after conditional branches.
16972 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
16974 @item -mno-csync-anomaly
16975 @opindex mno-csync-anomaly
16976 Don't generate extra code to prevent CSYNC or SSYNC instructions from
16977 occurring too soon after a conditional branch.
16981 When enabled, the compiler is free to take advantage of the knowledge that
16982 the entire program fits into the low 64k of memory.
16985 @opindex mno-low-64k
16986 Assume that the program is arbitrarily large. This is the default.
16988 @item -mstack-check-l1
16989 @opindex mstack-check-l1
16990 Do stack checking using information placed into L1 scratchpad memory by the
16993 @item -mid-shared-library
16994 @opindex mid-shared-library
16995 Generate code that supports shared libraries via the library ID method.
16996 This allows for execute in place and shared libraries in an environment
16997 without virtual memory management. This option implies @option{-fPIC}.
16998 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17000 @item -mno-id-shared-library
17001 @opindex mno-id-shared-library
17002 Generate code that doesn't assume ID-based shared libraries are being used.
17003 This is the default.
17005 @item -mleaf-id-shared-library
17006 @opindex mleaf-id-shared-library
17007 Generate code that supports shared libraries via the library ID method,
17008 but assumes that this library or executable won't link against any other
17009 ID shared libraries. That allows the compiler to use faster code for jumps
17012 @item -mno-leaf-id-shared-library
17013 @opindex mno-leaf-id-shared-library
17014 Do not assume that the code being compiled won't link against any ID shared
17015 libraries. Slower code is generated for jump and call insns.
17017 @item -mshared-library-id=n
17018 @opindex mshared-library-id
17019 Specifies the identification number of the ID-based shared library being
17020 compiled. Specifying a value of 0 generates more compact code; specifying
17021 other values forces the allocation of that number to the current
17022 library but is no more space- or time-efficient than omitting this option.
17026 Generate code that allows the data segment to be located in a different
17027 area of memory from the text segment. This allows for execute in place in
17028 an environment without virtual memory management by eliminating relocations
17029 against the text section.
17031 @item -mno-sep-data
17032 @opindex mno-sep-data
17033 Generate code that assumes that the data segment follows the text segment.
17034 This is the default.
17037 @itemx -mno-long-calls
17038 @opindex mlong-calls
17039 @opindex mno-long-calls
17040 Tells the compiler to perform function calls by first loading the
17041 address of the function into a register and then performing a subroutine
17042 call on this register. This switch is needed if the target function
17043 lies outside of the 24-bit addressing range of the offset-based
17044 version of subroutine call instruction.
17046 This feature is not enabled by default. Specifying
17047 @option{-mno-long-calls} restores the default behavior. Note these
17048 switches have no effect on how the compiler generates code to handle
17049 function calls via function pointers.
17053 Link with the fast floating-point library. This library relaxes some of
17054 the IEEE floating-point standard's rules for checking inputs against
17055 Not-a-Number (NAN), in the interest of performance.
17058 @opindex minline-plt
17059 Enable inlining of PLT entries in function calls to functions that are
17060 not known to bind locally. It has no effect without @option{-mfdpic}.
17063 @opindex mmulticore
17064 Build a standalone application for multicore Blackfin processors.
17065 This option causes proper start files and link scripts supporting
17066 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
17067 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
17069 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
17070 selects the one-application-per-core programming model. Without
17071 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
17072 programming model is used. In this model, the main function of Core B
17073 should be named as @code{coreb_main}.
17075 If this option is not used, the single-core application programming
17080 Build a standalone application for Core A of BF561 when using
17081 the one-application-per-core programming model. Proper start files
17082 and link scripts are used to support Core A, and the macro
17083 @code{__BFIN_COREA} is defined.
17084 This option can only be used in conjunction with @option{-mmulticore}.
17088 Build a standalone application for Core B of BF561 when using
17089 the one-application-per-core programming model. Proper start files
17090 and link scripts are used to support Core B, and the macro
17091 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
17092 should be used instead of @code{main}.
17093 This option can only be used in conjunction with @option{-mmulticore}.
17097 Build a standalone application for SDRAM. Proper start files and
17098 link scripts are used to put the application into SDRAM, and the macro
17099 @code{__BFIN_SDRAM} is defined.
17100 The loader should initialize SDRAM before loading the application.
17104 Assume that ICPLBs are enabled at run time. This has an effect on certain
17105 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
17106 are enabled; for standalone applications the default is off.
17110 @subsection C6X Options
17111 @cindex C6X Options
17114 @item -march=@var{name}
17116 This specifies the name of the target architecture. GCC uses this
17117 name to determine what kind of instructions it can emit when generating
17118 assembly code. Permissible names are: @samp{c62x},
17119 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
17122 @opindex mbig-endian
17123 Generate code for a big-endian target.
17125 @item -mlittle-endian
17126 @opindex mlittle-endian
17127 Generate code for a little-endian target. This is the default.
17131 Choose startup files and linker script suitable for the simulator.
17133 @item -msdata=default
17134 @opindex msdata=default
17135 Put small global and static data in the @code{.neardata} section,
17136 which is pointed to by register @code{B14}. Put small uninitialized
17137 global and static data in the @code{.bss} section, which is adjacent
17138 to the @code{.neardata} section. Put small read-only data into the
17139 @code{.rodata} section. The corresponding sections used for large
17140 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
17143 @opindex msdata=all
17144 Put all data, not just small objects, into the sections reserved for
17145 small data, and use addressing relative to the @code{B14} register to
17149 @opindex msdata=none
17150 Make no use of the sections reserved for small data, and use absolute
17151 addresses to access all data. Put all initialized global and static
17152 data in the @code{.fardata} section, and all uninitialized data in the
17153 @code{.far} section. Put all constant data into the @code{.const}
17158 @subsection CRIS Options
17159 @cindex CRIS Options
17161 These options are defined specifically for the CRIS ports.
17164 @item -march=@var{architecture-type}
17165 @itemx -mcpu=@var{architecture-type}
17168 Generate code for the specified architecture. The choices for
17169 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
17170 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
17171 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
17174 @item -mtune=@var{architecture-type}
17176 Tune to @var{architecture-type} everything applicable about the generated
17177 code, except for the ABI and the set of available instructions. The
17178 choices for @var{architecture-type} are the same as for
17179 @option{-march=@var{architecture-type}}.
17181 @item -mmax-stack-frame=@var{n}
17182 @opindex mmax-stack-frame
17183 Warn when the stack frame of a function exceeds @var{n} bytes.
17189 The options @option{-metrax4} and @option{-metrax100} are synonyms for
17190 @option{-march=v3} and @option{-march=v8} respectively.
17192 @item -mmul-bug-workaround
17193 @itemx -mno-mul-bug-workaround
17194 @opindex mmul-bug-workaround
17195 @opindex mno-mul-bug-workaround
17196 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
17197 models where it applies. This option is active by default.
17201 Enable CRIS-specific verbose debug-related information in the assembly
17202 code. This option also has the effect of turning off the @samp{#NO_APP}
17203 formatted-code indicator to the assembler at the beginning of the
17208 Do not use condition-code results from previous instruction; always emit
17209 compare and test instructions before use of condition codes.
17211 @item -mno-side-effects
17212 @opindex mno-side-effects
17213 Do not emit instructions with side effects in addressing modes other than
17216 @item -mstack-align
17217 @itemx -mno-stack-align
17218 @itemx -mdata-align
17219 @itemx -mno-data-align
17220 @itemx -mconst-align
17221 @itemx -mno-const-align
17222 @opindex mstack-align
17223 @opindex mno-stack-align
17224 @opindex mdata-align
17225 @opindex mno-data-align
17226 @opindex mconst-align
17227 @opindex mno-const-align
17228 These options (@samp{no-} options) arrange (eliminate arrangements) for the
17229 stack frame, individual data and constants to be aligned for the maximum
17230 single data access size for the chosen CPU model. The default is to
17231 arrange for 32-bit alignment. ABI details such as structure layout are
17232 not affected by these options.
17240 Similar to the stack- data- and const-align options above, these options
17241 arrange for stack frame, writable data and constants to all be 32-bit,
17242 16-bit or 8-bit aligned. The default is 32-bit alignment.
17244 @item -mno-prologue-epilogue
17245 @itemx -mprologue-epilogue
17246 @opindex mno-prologue-epilogue
17247 @opindex mprologue-epilogue
17248 With @option{-mno-prologue-epilogue}, the normal function prologue and
17249 epilogue which set up the stack frame are omitted and no return
17250 instructions or return sequences are generated in the code. Use this
17251 option only together with visual inspection of the compiled code: no
17252 warnings or errors are generated when call-saved registers must be saved,
17253 or storage for local variables needs to be allocated.
17257 @opindex mno-gotplt
17259 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
17260 instruction sequences that load addresses for functions from the PLT part
17261 of the GOT rather than (traditional on other architectures) calls to the
17262 PLT@. The default is @option{-mgotplt}.
17266 Legacy no-op option only recognized with the cris-axis-elf and
17267 cris-axis-linux-gnu targets.
17271 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
17275 This option, recognized for the cris-axis-elf, arranges
17276 to link with input-output functions from a simulator library. Code,
17277 initialized data and zero-initialized data are allocated consecutively.
17281 Like @option{-sim}, but pass linker options to locate initialized data at
17282 0x40000000 and zero-initialized data at 0x80000000.
17286 @subsection CR16 Options
17287 @cindex CR16 Options
17289 These options are defined specifically for the CR16 ports.
17295 Enable the use of multiply-accumulate instructions. Disabled by default.
17299 @opindex mcr16cplus
17301 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
17306 Links the library libsim.a which is in compatible with simulator. Applicable
17307 to ELF compiler only.
17311 Choose integer type as 32-bit wide.
17315 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
17317 @item -mdata-model=@var{model}
17318 @opindex mdata-model
17319 Choose a data model. The choices for @var{model} are @samp{near},
17320 @samp{far} or @samp{medium}. @samp{medium} is default.
17321 However, @samp{far} is not valid with @option{-mcr16c}, as the
17322 CR16C architecture does not support the far data model.
17325 @node Darwin Options
17326 @subsection Darwin Options
17327 @cindex Darwin options
17329 These options are defined for all architectures running the Darwin operating
17332 FSF GCC on Darwin does not create ``fat'' object files; it creates
17333 an object file for the single architecture that GCC was built to
17334 target. Apple's GCC on Darwin does create ``fat'' files if multiple
17335 @option{-arch} options are used; it does so by running the compiler or
17336 linker multiple times and joining the results together with
17339 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
17340 @samp{i686}) is determined by the flags that specify the ISA
17341 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
17342 @option{-force_cpusubtype_ALL} option can be used to override this.
17344 The Darwin tools vary in their behavior when presented with an ISA
17345 mismatch. The assembler, @file{as}, only permits instructions to
17346 be used that are valid for the subtype of the file it is generating,
17347 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
17348 The linker for shared libraries, @file{/usr/bin/libtool}, fails
17349 and prints an error if asked to create a shared library with a less
17350 restrictive subtype than its input files (for instance, trying to put
17351 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
17352 for executables, @command{ld}, quietly gives the executable the most
17353 restrictive subtype of any of its input files.
17358 Add the framework directory @var{dir} to the head of the list of
17359 directories to be searched for header files. These directories are
17360 interleaved with those specified by @option{-I} options and are
17361 scanned in a left-to-right order.
17363 A framework directory is a directory with frameworks in it. A
17364 framework is a directory with a @file{Headers} and/or
17365 @file{PrivateHeaders} directory contained directly in it that ends
17366 in @file{.framework}. The name of a framework is the name of this
17367 directory excluding the @file{.framework}. Headers associated with
17368 the framework are found in one of those two directories, with
17369 @file{Headers} being searched first. A subframework is a framework
17370 directory that is in a framework's @file{Frameworks} directory.
17371 Includes of subframework headers can only appear in a header of a
17372 framework that contains the subframework, or in a sibling subframework
17373 header. Two subframeworks are siblings if they occur in the same
17374 framework. A subframework should not have the same name as a
17375 framework; a warning is issued if this is violated. Currently a
17376 subframework cannot have subframeworks; in the future, the mechanism
17377 may be extended to support this. The standard frameworks can be found
17378 in @file{/System/Library/Frameworks} and
17379 @file{/Library/Frameworks}. An example include looks like
17380 @code{#include <Framework/header.h>}, where @file{Framework} denotes
17381 the name of the framework and @file{header.h} is found in the
17382 @file{PrivateHeaders} or @file{Headers} directory.
17384 @item -iframework@var{dir}
17385 @opindex iframework
17386 Like @option{-F} except the directory is a treated as a system
17387 directory. The main difference between this @option{-iframework} and
17388 @option{-F} is that with @option{-iframework} the compiler does not
17389 warn about constructs contained within header files found via
17390 @var{dir}. This option is valid only for the C family of languages.
17394 Emit debugging information for symbols that are used. For stabs
17395 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
17396 This is by default ON@.
17400 Emit debugging information for all symbols and types.
17402 @item -mmacosx-version-min=@var{version}
17403 The earliest version of MacOS X that this executable will run on
17404 is @var{version}. Typical values of @var{version} include @code{10.1},
17405 @code{10.2}, and @code{10.3.9}.
17407 If the compiler was built to use the system's headers by default,
17408 then the default for this option is the system version on which the
17409 compiler is running, otherwise the default is to make choices that
17410 are compatible with as many systems and code bases as possible.
17414 Enable kernel development mode. The @option{-mkernel} option sets
17415 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
17416 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
17417 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
17418 applicable. This mode also sets @option{-mno-altivec},
17419 @option{-msoft-float}, @option{-fno-builtin} and
17420 @option{-mlong-branch} for PowerPC targets.
17422 @item -mone-byte-bool
17423 @opindex mone-byte-bool
17424 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
17425 By default @code{sizeof(bool)} is @code{4} when compiling for
17426 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
17427 option has no effect on x86.
17429 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
17430 to generate code that is not binary compatible with code generated
17431 without that switch. Using this switch may require recompiling all
17432 other modules in a program, including system libraries. Use this
17433 switch to conform to a non-default data model.
17435 @item -mfix-and-continue
17436 @itemx -ffix-and-continue
17437 @itemx -findirect-data
17438 @opindex mfix-and-continue
17439 @opindex ffix-and-continue
17440 @opindex findirect-data
17441 Generate code suitable for fast turnaround development, such as to
17442 allow GDB to dynamically load @file{.o} files into already-running
17443 programs. @option{-findirect-data} and @option{-ffix-and-continue}
17444 are provided for backwards compatibility.
17448 Loads all members of static archive libraries.
17449 See man ld(1) for more information.
17451 @item -arch_errors_fatal
17452 @opindex arch_errors_fatal
17453 Cause the errors having to do with files that have the wrong architecture
17456 @item -bind_at_load
17457 @opindex bind_at_load
17458 Causes the output file to be marked such that the dynamic linker will
17459 bind all undefined references when the file is loaded or launched.
17463 Produce a Mach-o bundle format file.
17464 See man ld(1) for more information.
17466 @item -bundle_loader @var{executable}
17467 @opindex bundle_loader
17468 This option specifies the @var{executable} that will load the build
17469 output file being linked. See man ld(1) for more information.
17472 @opindex dynamiclib
17473 When passed this option, GCC produces a dynamic library instead of
17474 an executable when linking, using the Darwin @file{libtool} command.
17476 @item -force_cpusubtype_ALL
17477 @opindex force_cpusubtype_ALL
17478 This causes GCC's output file to have the @samp{ALL} subtype, instead of
17479 one controlled by the @option{-mcpu} or @option{-march} option.
17481 @item -allowable_client @var{client_name}
17482 @itemx -client_name
17483 @itemx -compatibility_version
17484 @itemx -current_version
17486 @itemx -dependency-file
17488 @itemx -dylinker_install_name
17490 @itemx -exported_symbols_list
17493 @itemx -flat_namespace
17494 @itemx -force_flat_namespace
17495 @itemx -headerpad_max_install_names
17498 @itemx -install_name
17499 @itemx -keep_private_externs
17500 @itemx -multi_module
17501 @itemx -multiply_defined
17502 @itemx -multiply_defined_unused
17505 @itemx -no_dead_strip_inits_and_terms
17506 @itemx -nofixprebinding
17507 @itemx -nomultidefs
17509 @itemx -noseglinkedit
17510 @itemx -pagezero_size
17512 @itemx -prebind_all_twolevel_modules
17513 @itemx -private_bundle
17515 @itemx -read_only_relocs
17517 @itemx -sectobjectsymbols
17521 @itemx -sectobjectsymbols
17524 @itemx -segs_read_only_addr
17526 @itemx -segs_read_write_addr
17527 @itemx -seg_addr_table
17528 @itemx -seg_addr_table_filename
17529 @itemx -seglinkedit
17531 @itemx -segs_read_only_addr
17532 @itemx -segs_read_write_addr
17533 @itemx -single_module
17535 @itemx -sub_library
17537 @itemx -sub_umbrella
17538 @itemx -twolevel_namespace
17541 @itemx -unexported_symbols_list
17542 @itemx -weak_reference_mismatches
17543 @itemx -whatsloaded
17544 @opindex allowable_client
17545 @opindex client_name
17546 @opindex compatibility_version
17547 @opindex current_version
17548 @opindex dead_strip
17549 @opindex dependency-file
17550 @opindex dylib_file
17551 @opindex dylinker_install_name
17553 @opindex exported_symbols_list
17555 @opindex flat_namespace
17556 @opindex force_flat_namespace
17557 @opindex headerpad_max_install_names
17558 @opindex image_base
17560 @opindex install_name
17561 @opindex keep_private_externs
17562 @opindex multi_module
17563 @opindex multiply_defined
17564 @opindex multiply_defined_unused
17565 @opindex noall_load
17566 @opindex no_dead_strip_inits_and_terms
17567 @opindex nofixprebinding
17568 @opindex nomultidefs
17570 @opindex noseglinkedit
17571 @opindex pagezero_size
17573 @opindex prebind_all_twolevel_modules
17574 @opindex private_bundle
17575 @opindex read_only_relocs
17577 @opindex sectobjectsymbols
17580 @opindex sectcreate
17581 @opindex sectobjectsymbols
17584 @opindex segs_read_only_addr
17585 @opindex segs_read_write_addr
17586 @opindex seg_addr_table
17587 @opindex seg_addr_table_filename
17588 @opindex seglinkedit
17590 @opindex segs_read_only_addr
17591 @opindex segs_read_write_addr
17592 @opindex single_module
17594 @opindex sub_library
17595 @opindex sub_umbrella
17596 @opindex twolevel_namespace
17599 @opindex unexported_symbols_list
17600 @opindex weak_reference_mismatches
17601 @opindex whatsloaded
17602 These options are passed to the Darwin linker. The Darwin linker man page
17603 describes them in detail.
17606 @node DEC Alpha Options
17607 @subsection DEC Alpha Options
17609 These @samp{-m} options are defined for the DEC Alpha implementations:
17612 @item -mno-soft-float
17613 @itemx -msoft-float
17614 @opindex mno-soft-float
17615 @opindex msoft-float
17616 Use (do not use) the hardware floating-point instructions for
17617 floating-point operations. When @option{-msoft-float} is specified,
17618 functions in @file{libgcc.a} are used to perform floating-point
17619 operations. Unless they are replaced by routines that emulate the
17620 floating-point operations, or compiled in such a way as to call such
17621 emulations routines, these routines issue floating-point
17622 operations. If you are compiling for an Alpha without floating-point
17623 operations, you must ensure that the library is built so as not to call
17626 Note that Alpha implementations without floating-point operations are
17627 required to have floating-point registers.
17630 @itemx -mno-fp-regs
17632 @opindex mno-fp-regs
17633 Generate code that uses (does not use) the floating-point register set.
17634 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
17635 register set is not used, floating-point operands are passed in integer
17636 registers as if they were integers and floating-point results are passed
17637 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
17638 so any function with a floating-point argument or return value called by code
17639 compiled with @option{-mno-fp-regs} must also be compiled with that
17642 A typical use of this option is building a kernel that does not use,
17643 and hence need not save and restore, any floating-point registers.
17647 The Alpha architecture implements floating-point hardware optimized for
17648 maximum performance. It is mostly compliant with the IEEE floating-point
17649 standard. However, for full compliance, software assistance is
17650 required. This option generates code fully IEEE-compliant code
17651 @emph{except} that the @var{inexact-flag} is not maintained (see below).
17652 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
17653 defined during compilation. The resulting code is less efficient but is
17654 able to correctly support denormalized numbers and exceptional IEEE
17655 values such as not-a-number and plus/minus infinity. Other Alpha
17656 compilers call this option @option{-ieee_with_no_inexact}.
17658 @item -mieee-with-inexact
17659 @opindex mieee-with-inexact
17660 This is like @option{-mieee} except the generated code also maintains
17661 the IEEE @var{inexact-flag}. Turning on this option causes the
17662 generated code to implement fully-compliant IEEE math. In addition to
17663 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
17664 macro. On some Alpha implementations the resulting code may execute
17665 significantly slower than the code generated by default. Since there is
17666 very little code that depends on the @var{inexact-flag}, you should
17667 normally not specify this option. Other Alpha compilers call this
17668 option @option{-ieee_with_inexact}.
17670 @item -mfp-trap-mode=@var{trap-mode}
17671 @opindex mfp-trap-mode
17672 This option controls what floating-point related traps are enabled.
17673 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
17674 The trap mode can be set to one of four values:
17678 This is the default (normal) setting. The only traps that are enabled
17679 are the ones that cannot be disabled in software (e.g., division by zero
17683 In addition to the traps enabled by @samp{n}, underflow traps are enabled
17687 Like @samp{u}, but the instructions are marked to be safe for software
17688 completion (see Alpha architecture manual for details).
17691 Like @samp{su}, but inexact traps are enabled as well.
17694 @item -mfp-rounding-mode=@var{rounding-mode}
17695 @opindex mfp-rounding-mode
17696 Selects the IEEE rounding mode. Other Alpha compilers call this option
17697 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
17702 Normal IEEE rounding mode. Floating-point numbers are rounded towards
17703 the nearest machine number or towards the even machine number in case
17707 Round towards minus infinity.
17710 Chopped rounding mode. Floating-point numbers are rounded towards zero.
17713 Dynamic rounding mode. A field in the floating-point control register
17714 (@var{fpcr}, see Alpha architecture reference manual) controls the
17715 rounding mode in effect. The C library initializes this register for
17716 rounding towards plus infinity. Thus, unless your program modifies the
17717 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
17720 @item -mtrap-precision=@var{trap-precision}
17721 @opindex mtrap-precision
17722 In the Alpha architecture, floating-point traps are imprecise. This
17723 means without software assistance it is impossible to recover from a
17724 floating trap and program execution normally needs to be terminated.
17725 GCC can generate code that can assist operating system trap handlers
17726 in determining the exact location that caused a floating-point trap.
17727 Depending on the requirements of an application, different levels of
17728 precisions can be selected:
17732 Program precision. This option is the default and means a trap handler
17733 can only identify which program caused a floating-point exception.
17736 Function precision. The trap handler can determine the function that
17737 caused a floating-point exception.
17740 Instruction precision. The trap handler can determine the exact
17741 instruction that caused a floating-point exception.
17744 Other Alpha compilers provide the equivalent options called
17745 @option{-scope_safe} and @option{-resumption_safe}.
17747 @item -mieee-conformant
17748 @opindex mieee-conformant
17749 This option marks the generated code as IEEE conformant. You must not
17750 use this option unless you also specify @option{-mtrap-precision=i} and either
17751 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
17752 is to emit the line @samp{.eflag 48} in the function prologue of the
17753 generated assembly file.
17755 @item -mbuild-constants
17756 @opindex mbuild-constants
17757 Normally GCC examines a 32- or 64-bit integer constant to
17758 see if it can construct it from smaller constants in two or three
17759 instructions. If it cannot, it outputs the constant as a literal and
17760 generates code to load it from the data segment at run time.
17762 Use this option to require GCC to construct @emph{all} integer constants
17763 using code, even if it takes more instructions (the maximum is six).
17765 You typically use this option to build a shared library dynamic
17766 loader. Itself a shared library, it must relocate itself in memory
17767 before it can find the variables and constants in its own data segment.
17785 Indicate whether GCC should generate code to use the optional BWX,
17786 CIX, FIX and MAX instruction sets. The default is to use the instruction
17787 sets supported by the CPU type specified via @option{-mcpu=} option or that
17788 of the CPU on which GCC was built if none is specified.
17791 @itemx -mfloat-ieee
17792 @opindex mfloat-vax
17793 @opindex mfloat-ieee
17794 Generate code that uses (does not use) VAX F and G floating-point
17795 arithmetic instead of IEEE single and double precision.
17797 @item -mexplicit-relocs
17798 @itemx -mno-explicit-relocs
17799 @opindex mexplicit-relocs
17800 @opindex mno-explicit-relocs
17801 Older Alpha assemblers provided no way to generate symbol relocations
17802 except via assembler macros. Use of these macros does not allow
17803 optimal instruction scheduling. GNU binutils as of version 2.12
17804 supports a new syntax that allows the compiler to explicitly mark
17805 which relocations should apply to which instructions. This option
17806 is mostly useful for debugging, as GCC detects the capabilities of
17807 the assembler when it is built and sets the default accordingly.
17810 @itemx -mlarge-data
17811 @opindex msmall-data
17812 @opindex mlarge-data
17813 When @option{-mexplicit-relocs} is in effect, static data is
17814 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
17815 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
17816 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
17817 16-bit relocations off of the @code{$gp} register. This limits the
17818 size of the small data area to 64KB, but allows the variables to be
17819 directly accessed via a single instruction.
17821 The default is @option{-mlarge-data}. With this option the data area
17822 is limited to just below 2GB@. Programs that require more than 2GB of
17823 data must use @code{malloc} or @code{mmap} to allocate the data in the
17824 heap instead of in the program's data segment.
17826 When generating code for shared libraries, @option{-fpic} implies
17827 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
17830 @itemx -mlarge-text
17831 @opindex msmall-text
17832 @opindex mlarge-text
17833 When @option{-msmall-text} is used, the compiler assumes that the
17834 code of the entire program (or shared library) fits in 4MB, and is
17835 thus reachable with a branch instruction. When @option{-msmall-data}
17836 is used, the compiler can assume that all local symbols share the
17837 same @code{$gp} value, and thus reduce the number of instructions
17838 required for a function call from 4 to 1.
17840 The default is @option{-mlarge-text}.
17842 @item -mcpu=@var{cpu_type}
17844 Set the instruction set and instruction scheduling parameters for
17845 machine type @var{cpu_type}. You can specify either the @samp{EV}
17846 style name or the corresponding chip number. GCC supports scheduling
17847 parameters for the EV4, EV5 and EV6 family of processors and
17848 chooses the default values for the instruction set from the processor
17849 you specify. If you do not specify a processor type, GCC defaults
17850 to the processor on which the compiler was built.
17852 Supported values for @var{cpu_type} are
17858 Schedules as an EV4 and has no instruction set extensions.
17862 Schedules as an EV5 and has no instruction set extensions.
17866 Schedules as an EV5 and supports the BWX extension.
17871 Schedules as an EV5 and supports the BWX and MAX extensions.
17875 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
17879 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
17882 Native toolchains also support the value @samp{native},
17883 which selects the best architecture option for the host processor.
17884 @option{-mcpu=native} has no effect if GCC does not recognize
17887 @item -mtune=@var{cpu_type}
17889 Set only the instruction scheduling parameters for machine type
17890 @var{cpu_type}. The instruction set is not changed.
17892 Native toolchains also support the value @samp{native},
17893 which selects the best architecture option for the host processor.
17894 @option{-mtune=native} has no effect if GCC does not recognize
17897 @item -mmemory-latency=@var{time}
17898 @opindex mmemory-latency
17899 Sets the latency the scheduler should assume for typical memory
17900 references as seen by the application. This number is highly
17901 dependent on the memory access patterns used by the application
17902 and the size of the external cache on the machine.
17904 Valid options for @var{time} are
17908 A decimal number representing clock cycles.
17914 The compiler contains estimates of the number of clock cycles for
17915 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
17916 (also called Dcache, Scache, and Bcache), as well as to main memory.
17917 Note that L3 is only valid for EV5.
17923 @subsection FR30 Options
17924 @cindex FR30 Options
17926 These options are defined specifically for the FR30 port.
17930 @item -msmall-model
17931 @opindex msmall-model
17932 Use the small address space model. This can produce smaller code, but
17933 it does assume that all symbolic values and addresses fit into a
17938 Assume that runtime support has been provided and so there is no need
17939 to include the simulator library (@file{libsim.a}) on the linker
17945 @subsection FT32 Options
17946 @cindex FT32 Options
17948 These options are defined specifically for the FT32 port.
17954 Specifies that the program will be run on the simulator. This causes
17955 an alternate runtime startup and library to be linked.
17956 You must not use this option when generating programs that will run on
17957 real hardware; you must provide your own runtime library for whatever
17958 I/O functions are needed.
17962 Enable Local Register Allocation. This is still experimental for FT32,
17963 so by default the compiler uses standard reload.
17967 Do not use div and mod instructions.
17971 Enable use of the extended instructions of the FT32B processor.
17975 Compress all code using the Ft32B code compression scheme.
17979 Do not generate code that reads program memory.
17984 @subsection FRV Options
17985 @cindex FRV Options
17991 Only use the first 32 general-purpose registers.
17996 Use all 64 general-purpose registers.
18001 Use only the first 32 floating-point registers.
18006 Use all 64 floating-point registers.
18009 @opindex mhard-float
18011 Use hardware instructions for floating-point operations.
18014 @opindex msoft-float
18016 Use library routines for floating-point operations.
18021 Dynamically allocate condition code registers.
18026 Do not try to dynamically allocate condition code registers, only
18027 use @code{icc0} and @code{fcc0}.
18032 Change ABI to use double word insns.
18037 Do not use double word instructions.
18042 Use floating-point double instructions.
18045 @opindex mno-double
18047 Do not use floating-point double instructions.
18052 Use media instructions.
18057 Do not use media instructions.
18062 Use multiply and add/subtract instructions.
18065 @opindex mno-muladd
18067 Do not use multiply and add/subtract instructions.
18072 Select the FDPIC ABI, which uses function descriptors to represent
18073 pointers to functions. Without any PIC/PIE-related options, it
18074 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
18075 assumes GOT entries and small data are within a 12-bit range from the
18076 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
18077 are computed with 32 bits.
18078 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18081 @opindex minline-plt
18083 Enable inlining of PLT entries in function calls to functions that are
18084 not known to bind locally. It has no effect without @option{-mfdpic}.
18085 It's enabled by default if optimizing for speed and compiling for
18086 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
18087 optimization option such as @option{-O3} or above is present in the
18093 Assume a large TLS segment when generating thread-local code.
18098 Do not assume a large TLS segment when generating thread-local code.
18103 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
18104 that is known to be in read-only sections. It's enabled by default,
18105 except for @option{-fpic} or @option{-fpie}: even though it may help
18106 make the global offset table smaller, it trades 1 instruction for 4.
18107 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
18108 one of which may be shared by multiple symbols, and it avoids the need
18109 for a GOT entry for the referenced symbol, so it's more likely to be a
18110 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
18112 @item -multilib-library-pic
18113 @opindex multilib-library-pic
18115 Link with the (library, not FD) pic libraries. It's implied by
18116 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
18117 @option{-fpic} without @option{-mfdpic}. You should never have to use
18121 @opindex mlinked-fp
18123 Follow the EABI requirement of always creating a frame pointer whenever
18124 a stack frame is allocated. This option is enabled by default and can
18125 be disabled with @option{-mno-linked-fp}.
18128 @opindex mlong-calls
18130 Use indirect addressing to call functions outside the current
18131 compilation unit. This allows the functions to be placed anywhere
18132 within the 32-bit address space.
18134 @item -malign-labels
18135 @opindex malign-labels
18137 Try to align labels to an 8-byte boundary by inserting NOPs into the
18138 previous packet. This option only has an effect when VLIW packing
18139 is enabled. It doesn't create new packets; it merely adds NOPs to
18142 @item -mlibrary-pic
18143 @opindex mlibrary-pic
18145 Generate position-independent EABI code.
18150 Use only the first four media accumulator registers.
18155 Use all eight media accumulator registers.
18160 Pack VLIW instructions.
18165 Do not pack VLIW instructions.
18168 @opindex mno-eflags
18170 Do not mark ABI switches in e_flags.
18173 @opindex mcond-move
18175 Enable the use of conditional-move instructions (default).
18177 This switch is mainly for debugging the compiler and will likely be removed
18178 in a future version.
18180 @item -mno-cond-move
18181 @opindex mno-cond-move
18183 Disable the use of conditional-move instructions.
18185 This switch is mainly for debugging the compiler and will likely be removed
18186 in a future version.
18191 Enable the use of conditional set instructions (default).
18193 This switch is mainly for debugging the compiler and will likely be removed
18194 in a future version.
18199 Disable the use of conditional set instructions.
18201 This switch is mainly for debugging the compiler and will likely be removed
18202 in a future version.
18205 @opindex mcond-exec
18207 Enable the use of conditional execution (default).
18209 This switch is mainly for debugging the compiler and will likely be removed
18210 in a future version.
18212 @item -mno-cond-exec
18213 @opindex mno-cond-exec
18215 Disable the use of conditional execution.
18217 This switch is mainly for debugging the compiler and will likely be removed
18218 in a future version.
18220 @item -mvliw-branch
18221 @opindex mvliw-branch
18223 Run a pass to pack branches into VLIW instructions (default).
18225 This switch is mainly for debugging the compiler and will likely be removed
18226 in a future version.
18228 @item -mno-vliw-branch
18229 @opindex mno-vliw-branch
18231 Do not run a pass to pack branches into VLIW instructions.
18233 This switch is mainly for debugging the compiler and will likely be removed
18234 in a future version.
18236 @item -mmulti-cond-exec
18237 @opindex mmulti-cond-exec
18239 Enable optimization of @code{&&} and @code{||} in conditional execution
18242 This switch is mainly for debugging the compiler and will likely be removed
18243 in a future version.
18245 @item -mno-multi-cond-exec
18246 @opindex mno-multi-cond-exec
18248 Disable optimization of @code{&&} and @code{||} in conditional execution.
18250 This switch is mainly for debugging the compiler and will likely be removed
18251 in a future version.
18253 @item -mnested-cond-exec
18254 @opindex mnested-cond-exec
18256 Enable nested conditional execution optimizations (default).
18258 This switch is mainly for debugging the compiler and will likely be removed
18259 in a future version.
18261 @item -mno-nested-cond-exec
18262 @opindex mno-nested-cond-exec
18264 Disable nested conditional execution optimizations.
18266 This switch is mainly for debugging the compiler and will likely be removed
18267 in a future version.
18269 @item -moptimize-membar
18270 @opindex moptimize-membar
18272 This switch removes redundant @code{membar} instructions from the
18273 compiler-generated code. It is enabled by default.
18275 @item -mno-optimize-membar
18276 @opindex mno-optimize-membar
18278 This switch disables the automatic removal of redundant @code{membar}
18279 instructions from the generated code.
18281 @item -mtomcat-stats
18282 @opindex mtomcat-stats
18284 Cause gas to print out tomcat statistics.
18286 @item -mcpu=@var{cpu}
18289 Select the processor type for which to generate code. Possible values are
18290 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
18291 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
18295 @node GNU/Linux Options
18296 @subsection GNU/Linux Options
18298 These @samp{-m} options are defined for GNU/Linux targets:
18303 Use the GNU C library. This is the default except
18304 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
18305 @samp{*-*-linux-*android*} targets.
18309 Use uClibc C library. This is the default on
18310 @samp{*-*-linux-*uclibc*} targets.
18314 Use the musl C library. This is the default on
18315 @samp{*-*-linux-*musl*} targets.
18319 Use Bionic C library. This is the default on
18320 @samp{*-*-linux-*android*} targets.
18324 Compile code compatible with Android platform. This is the default on
18325 @samp{*-*-linux-*android*} targets.
18327 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
18328 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
18329 this option makes the GCC driver pass Android-specific options to the linker.
18330 Finally, this option causes the preprocessor macro @code{__ANDROID__}
18333 @item -tno-android-cc
18334 @opindex tno-android-cc
18335 Disable compilation effects of @option{-mandroid}, i.e., do not enable
18336 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
18337 @option{-fno-rtti} by default.
18339 @item -tno-android-ld
18340 @opindex tno-android-ld
18341 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
18342 linking options to the linker.
18346 @node H8/300 Options
18347 @subsection H8/300 Options
18349 These @samp{-m} options are defined for the H8/300 implementations:
18354 Shorten some address references at link time, when possible; uses the
18355 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
18356 ld, Using ld}, for a fuller description.
18360 Generate code for the H8/300H@.
18364 Generate code for the H8S@.
18368 Generate code for the H8S and H8/300H in the normal mode. This switch
18369 must be used either with @option{-mh} or @option{-ms}.
18373 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
18377 Extended registers are stored on stack before execution of function
18378 with monitor attribute. Default option is @option{-mexr}.
18379 This option is valid only for H8S targets.
18383 Extended registers are not stored on stack before execution of function
18384 with monitor attribute. Default option is @option{-mno-exr}.
18385 This option is valid only for H8S targets.
18389 Make @code{int} data 32 bits by default.
18392 @opindex malign-300
18393 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
18394 The default for the H8/300H and H8S is to align longs and floats on
18396 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
18397 This option has no effect on the H8/300.
18401 @subsection HPPA Options
18402 @cindex HPPA Options
18404 These @samp{-m} options are defined for the HPPA family of computers:
18407 @item -march=@var{architecture-type}
18409 Generate code for the specified architecture. The choices for
18410 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
18411 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
18412 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
18413 architecture option for your machine. Code compiled for lower numbered
18414 architectures runs on higher numbered architectures, but not the
18417 @item -mpa-risc-1-0
18418 @itemx -mpa-risc-1-1
18419 @itemx -mpa-risc-2-0
18420 @opindex mpa-risc-1-0
18421 @opindex mpa-risc-1-1
18422 @opindex mpa-risc-2-0
18423 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
18425 @item -mcaller-copies
18426 @opindex mcaller-copies
18427 The caller copies function arguments passed by hidden reference. This
18428 option should be used with care as it is not compatible with the default
18429 32-bit runtime. However, only aggregates larger than eight bytes are
18430 passed by hidden reference and the option provides better compatibility
18433 @item -mjump-in-delay
18434 @opindex mjump-in-delay
18435 This option is ignored and provided for compatibility purposes only.
18437 @item -mdisable-fpregs
18438 @opindex mdisable-fpregs
18439 Prevent floating-point registers from being used in any manner. This is
18440 necessary for compiling kernels that perform lazy context switching of
18441 floating-point registers. If you use this option and attempt to perform
18442 floating-point operations, the compiler aborts.
18444 @item -mdisable-indexing
18445 @opindex mdisable-indexing
18446 Prevent the compiler from using indexing address modes. This avoids some
18447 rather obscure problems when compiling MIG generated code under MACH@.
18449 @item -mno-space-regs
18450 @opindex mno-space-regs
18451 Generate code that assumes the target has no space registers. This allows
18452 GCC to generate faster indirect calls and use unscaled index address modes.
18454 Such code is suitable for level 0 PA systems and kernels.
18456 @item -mfast-indirect-calls
18457 @opindex mfast-indirect-calls
18458 Generate code that assumes calls never cross space boundaries. This
18459 allows GCC to emit code that performs faster indirect calls.
18461 This option does not work in the presence of shared libraries or nested
18464 @item -mfixed-range=@var{register-range}
18465 @opindex mfixed-range
18466 Generate code treating the given register range as fixed registers.
18467 A fixed register is one that the register allocator cannot use. This is
18468 useful when compiling kernel code. A register range is specified as
18469 two registers separated by a dash. Multiple register ranges can be
18470 specified separated by a comma.
18472 @item -mlong-load-store
18473 @opindex mlong-load-store
18474 Generate 3-instruction load and store sequences as sometimes required by
18475 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
18478 @item -mportable-runtime
18479 @opindex mportable-runtime
18480 Use the portable calling conventions proposed by HP for ELF systems.
18484 Enable the use of assembler directives only GAS understands.
18486 @item -mschedule=@var{cpu-type}
18488 Schedule code according to the constraints for the machine type
18489 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
18490 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
18491 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
18492 proper scheduling option for your machine. The default scheduling is
18496 @opindex mlinker-opt
18497 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
18498 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
18499 linkers in which they give bogus error messages when linking some programs.
18502 @opindex msoft-float
18503 Generate output containing library calls for floating point.
18504 @strong{Warning:} the requisite libraries are not available for all HPPA
18505 targets. Normally the facilities of the machine's usual C compiler are
18506 used, but this cannot be done directly in cross-compilation. You must make
18507 your own arrangements to provide suitable library functions for
18510 @option{-msoft-float} changes the calling convention in the output file;
18511 therefore, it is only useful if you compile @emph{all} of a program with
18512 this option. In particular, you need to compile @file{libgcc.a}, the
18513 library that comes with GCC, with @option{-msoft-float} in order for
18518 Generate the predefine, @code{_SIO}, for server IO@. The default is
18519 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
18520 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
18521 options are available under HP-UX and HI-UX@.
18525 Use options specific to GNU @command{ld}.
18526 This passes @option{-shared} to @command{ld} when
18527 building a shared library. It is the default when GCC is configured,
18528 explicitly or implicitly, with the GNU linker. This option does not
18529 affect which @command{ld} is called; it only changes what parameters
18530 are passed to that @command{ld}.
18531 The @command{ld} that is called is determined by the
18532 @option{--with-ld} configure option, GCC's program search path, and
18533 finally by the user's @env{PATH}. The linker used by GCC can be printed
18534 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
18535 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18539 Use options specific to HP @command{ld}.
18540 This passes @option{-b} to @command{ld} when building
18541 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
18542 links. It is the default when GCC is configured, explicitly or
18543 implicitly, with the HP linker. This option does not affect
18544 which @command{ld} is called; it only changes what parameters are passed to that
18546 The @command{ld} that is called is determined by the @option{--with-ld}
18547 configure option, GCC's program search path, and finally by the user's
18548 @env{PATH}. The linker used by GCC can be printed using @samp{which
18549 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
18550 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18553 @opindex mno-long-calls
18554 Generate code that uses long call sequences. This ensures that a call
18555 is always able to reach linker generated stubs. The default is to generate
18556 long calls only when the distance from the call site to the beginning
18557 of the function or translation unit, as the case may be, exceeds a
18558 predefined limit set by the branch type being used. The limits for
18559 normal calls are 7,600,000 and 240,000 bytes, respectively for the
18560 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
18563 Distances are measured from the beginning of functions when using the
18564 @option{-ffunction-sections} option, or when using the @option{-mgas}
18565 and @option{-mno-portable-runtime} options together under HP-UX with
18568 It is normally not desirable to use this option as it degrades
18569 performance. However, it may be useful in large applications,
18570 particularly when partial linking is used to build the application.
18572 The types of long calls used depends on the capabilities of the
18573 assembler and linker, and the type of code being generated. The
18574 impact on systems that support long absolute calls, and long pic
18575 symbol-difference or pc-relative calls should be relatively small.
18576 However, an indirect call is used on 32-bit ELF systems in pic code
18577 and it is quite long.
18579 @item -munix=@var{unix-std}
18581 Generate compiler predefines and select a startfile for the specified
18582 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
18583 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
18584 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
18585 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
18586 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
18589 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
18590 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
18591 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
18592 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
18593 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
18594 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
18596 It is @emph{important} to note that this option changes the interfaces
18597 for various library routines. It also affects the operational behavior
18598 of the C library. Thus, @emph{extreme} care is needed in using this
18601 Library code that is intended to operate with more than one UNIX
18602 standard must test, set and restore the variable @code{__xpg4_extended_mask}
18603 as appropriate. Most GNU software doesn't provide this capability.
18607 Suppress the generation of link options to search libdld.sl when the
18608 @option{-static} option is specified on HP-UX 10 and later.
18612 The HP-UX implementation of setlocale in libc has a dependency on
18613 libdld.sl. There isn't an archive version of libdld.sl. Thus,
18614 when the @option{-static} option is specified, special link options
18615 are needed to resolve this dependency.
18617 On HP-UX 10 and later, the GCC driver adds the necessary options to
18618 link with libdld.sl when the @option{-static} option is specified.
18619 This causes the resulting binary to be dynamic. On the 64-bit port,
18620 the linkers generate dynamic binaries by default in any case. The
18621 @option{-nolibdld} option can be used to prevent the GCC driver from
18622 adding these link options.
18626 Add support for multithreading with the @dfn{dce thread} library
18627 under HP-UX@. This option sets flags for both the preprocessor and
18631 @node IA-64 Options
18632 @subsection IA-64 Options
18633 @cindex IA-64 Options
18635 These are the @samp{-m} options defined for the Intel IA-64 architecture.
18639 @opindex mbig-endian
18640 Generate code for a big-endian target. This is the default for HP-UX@.
18642 @item -mlittle-endian
18643 @opindex mlittle-endian
18644 Generate code for a little-endian target. This is the default for AIX5
18650 @opindex mno-gnu-as
18651 Generate (or don't) code for the GNU assembler. This is the default.
18652 @c Also, this is the default if the configure option @option{--with-gnu-as}
18658 @opindex mno-gnu-ld
18659 Generate (or don't) code for the GNU linker. This is the default.
18660 @c Also, this is the default if the configure option @option{--with-gnu-ld}
18665 Generate code that does not use a global pointer register. The result
18666 is not position independent code, and violates the IA-64 ABI@.
18668 @item -mvolatile-asm-stop
18669 @itemx -mno-volatile-asm-stop
18670 @opindex mvolatile-asm-stop
18671 @opindex mno-volatile-asm-stop
18672 Generate (or don't) a stop bit immediately before and after volatile asm
18675 @item -mregister-names
18676 @itemx -mno-register-names
18677 @opindex mregister-names
18678 @opindex mno-register-names
18679 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
18680 the stacked registers. This may make assembler output more readable.
18686 Disable (or enable) optimizations that use the small data section. This may
18687 be useful for working around optimizer bugs.
18689 @item -mconstant-gp
18690 @opindex mconstant-gp
18691 Generate code that uses a single constant global pointer value. This is
18692 useful when compiling kernel code.
18696 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
18697 This is useful when compiling firmware code.
18699 @item -minline-float-divide-min-latency
18700 @opindex minline-float-divide-min-latency
18701 Generate code for inline divides of floating-point values
18702 using the minimum latency algorithm.
18704 @item -minline-float-divide-max-throughput
18705 @opindex minline-float-divide-max-throughput
18706 Generate code for inline divides of floating-point values
18707 using the maximum throughput algorithm.
18709 @item -mno-inline-float-divide
18710 @opindex mno-inline-float-divide
18711 Do not generate inline code for divides of floating-point values.
18713 @item -minline-int-divide-min-latency
18714 @opindex minline-int-divide-min-latency
18715 Generate code for inline divides of integer values
18716 using the minimum latency algorithm.
18718 @item -minline-int-divide-max-throughput
18719 @opindex minline-int-divide-max-throughput
18720 Generate code for inline divides of integer values
18721 using the maximum throughput algorithm.
18723 @item -mno-inline-int-divide
18724 @opindex mno-inline-int-divide
18725 Do not generate inline code for divides of integer values.
18727 @item -minline-sqrt-min-latency
18728 @opindex minline-sqrt-min-latency
18729 Generate code for inline square roots
18730 using the minimum latency algorithm.
18732 @item -minline-sqrt-max-throughput
18733 @opindex minline-sqrt-max-throughput
18734 Generate code for inline square roots
18735 using the maximum throughput algorithm.
18737 @item -mno-inline-sqrt
18738 @opindex mno-inline-sqrt
18739 Do not generate inline code for @code{sqrt}.
18742 @itemx -mno-fused-madd
18743 @opindex mfused-madd
18744 @opindex mno-fused-madd
18745 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
18746 instructions. The default is to use these instructions.
18748 @item -mno-dwarf2-asm
18749 @itemx -mdwarf2-asm
18750 @opindex mno-dwarf2-asm
18751 @opindex mdwarf2-asm
18752 Don't (or do) generate assembler code for the DWARF line number debugging
18753 info. This may be useful when not using the GNU assembler.
18755 @item -mearly-stop-bits
18756 @itemx -mno-early-stop-bits
18757 @opindex mearly-stop-bits
18758 @opindex mno-early-stop-bits
18759 Allow stop bits to be placed earlier than immediately preceding the
18760 instruction that triggered the stop bit. This can improve instruction
18761 scheduling, but does not always do so.
18763 @item -mfixed-range=@var{register-range}
18764 @opindex mfixed-range
18765 Generate code treating the given register range as fixed registers.
18766 A fixed register is one that the register allocator cannot use. This is
18767 useful when compiling kernel code. A register range is specified as
18768 two registers separated by a dash. Multiple register ranges can be
18769 specified separated by a comma.
18771 @item -mtls-size=@var{tls-size}
18773 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
18776 @item -mtune=@var{cpu-type}
18778 Tune the instruction scheduling for a particular CPU, Valid values are
18779 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
18780 and @samp{mckinley}.
18786 Generate code for a 32-bit or 64-bit environment.
18787 The 32-bit environment sets int, long and pointer to 32 bits.
18788 The 64-bit environment sets int to 32 bits and long and pointer
18789 to 64 bits. These are HP-UX specific flags.
18791 @item -mno-sched-br-data-spec
18792 @itemx -msched-br-data-spec
18793 @opindex mno-sched-br-data-spec
18794 @opindex msched-br-data-spec
18795 (Dis/En)able data speculative scheduling before reload.
18796 This results in generation of @code{ld.a} instructions and
18797 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
18798 The default setting is disabled.
18800 @item -msched-ar-data-spec
18801 @itemx -mno-sched-ar-data-spec
18802 @opindex msched-ar-data-spec
18803 @opindex mno-sched-ar-data-spec
18804 (En/Dis)able data speculative scheduling after reload.
18805 This results in generation of @code{ld.a} instructions and
18806 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
18807 The default setting is enabled.
18809 @item -mno-sched-control-spec
18810 @itemx -msched-control-spec
18811 @opindex mno-sched-control-spec
18812 @opindex msched-control-spec
18813 (Dis/En)able control speculative scheduling. This feature is
18814 available only during region scheduling (i.e.@: before reload).
18815 This results in generation of the @code{ld.s} instructions and
18816 the corresponding check instructions @code{chk.s}.
18817 The default setting is disabled.
18819 @item -msched-br-in-data-spec
18820 @itemx -mno-sched-br-in-data-spec
18821 @opindex msched-br-in-data-spec
18822 @opindex mno-sched-br-in-data-spec
18823 (En/Dis)able speculative scheduling of the instructions that
18824 are dependent on the data speculative loads before reload.
18825 This is effective only with @option{-msched-br-data-spec} enabled.
18826 The default setting is enabled.
18828 @item -msched-ar-in-data-spec
18829 @itemx -mno-sched-ar-in-data-spec
18830 @opindex msched-ar-in-data-spec
18831 @opindex mno-sched-ar-in-data-spec
18832 (En/Dis)able speculative scheduling of the instructions that
18833 are dependent on the data speculative loads after reload.
18834 This is effective only with @option{-msched-ar-data-spec} enabled.
18835 The default setting is enabled.
18837 @item -msched-in-control-spec
18838 @itemx -mno-sched-in-control-spec
18839 @opindex msched-in-control-spec
18840 @opindex mno-sched-in-control-spec
18841 (En/Dis)able speculative scheduling of the instructions that
18842 are dependent on the control speculative loads.
18843 This is effective only with @option{-msched-control-spec} enabled.
18844 The default setting is enabled.
18846 @item -mno-sched-prefer-non-data-spec-insns
18847 @itemx -msched-prefer-non-data-spec-insns
18848 @opindex mno-sched-prefer-non-data-spec-insns
18849 @opindex msched-prefer-non-data-spec-insns
18850 If enabled, data-speculative instructions are chosen for schedule
18851 only if there are no other choices at the moment. This makes
18852 the use of the data speculation much more conservative.
18853 The default setting is disabled.
18855 @item -mno-sched-prefer-non-control-spec-insns
18856 @itemx -msched-prefer-non-control-spec-insns
18857 @opindex mno-sched-prefer-non-control-spec-insns
18858 @opindex msched-prefer-non-control-spec-insns
18859 If enabled, control-speculative instructions are chosen for schedule
18860 only if there are no other choices at the moment. This makes
18861 the use of the control speculation much more conservative.
18862 The default setting is disabled.
18864 @item -mno-sched-count-spec-in-critical-path
18865 @itemx -msched-count-spec-in-critical-path
18866 @opindex mno-sched-count-spec-in-critical-path
18867 @opindex msched-count-spec-in-critical-path
18868 If enabled, speculative dependencies are considered during
18869 computation of the instructions priorities. This makes the use of the
18870 speculation a bit more conservative.
18871 The default setting is disabled.
18873 @item -msched-spec-ldc
18874 @opindex msched-spec-ldc
18875 Use a simple data speculation check. This option is on by default.
18877 @item -msched-control-spec-ldc
18878 @opindex msched-spec-ldc
18879 Use a simple check for control speculation. This option is on by default.
18881 @item -msched-stop-bits-after-every-cycle
18882 @opindex msched-stop-bits-after-every-cycle
18883 Place a stop bit after every cycle when scheduling. This option is on
18886 @item -msched-fp-mem-deps-zero-cost
18887 @opindex msched-fp-mem-deps-zero-cost
18888 Assume that floating-point stores and loads are not likely to cause a conflict
18889 when placed into the same instruction group. This option is disabled by
18892 @item -msel-sched-dont-check-control-spec
18893 @opindex msel-sched-dont-check-control-spec
18894 Generate checks for control speculation in selective scheduling.
18895 This flag is disabled by default.
18897 @item -msched-max-memory-insns=@var{max-insns}
18898 @opindex msched-max-memory-insns
18899 Limit on the number of memory insns per instruction group, giving lower
18900 priority to subsequent memory insns attempting to schedule in the same
18901 instruction group. Frequently useful to prevent cache bank conflicts.
18902 The default value is 1.
18904 @item -msched-max-memory-insns-hard-limit
18905 @opindex msched-max-memory-insns-hard-limit
18906 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
18907 disallowing more than that number in an instruction group.
18908 Otherwise, the limit is ``soft'', meaning that non-memory operations
18909 are preferred when the limit is reached, but memory operations may still
18915 @subsection LM32 Options
18916 @cindex LM32 options
18918 These @option{-m} options are defined for the LatticeMico32 architecture:
18921 @item -mbarrel-shift-enabled
18922 @opindex mbarrel-shift-enabled
18923 Enable barrel-shift instructions.
18925 @item -mdivide-enabled
18926 @opindex mdivide-enabled
18927 Enable divide and modulus instructions.
18929 @item -mmultiply-enabled
18930 @opindex multiply-enabled
18931 Enable multiply instructions.
18933 @item -msign-extend-enabled
18934 @opindex msign-extend-enabled
18935 Enable sign extend instructions.
18937 @item -muser-enabled
18938 @opindex muser-enabled
18939 Enable user-defined instructions.
18944 @subsection M32C Options
18945 @cindex M32C options
18948 @item -mcpu=@var{name}
18950 Select the CPU for which code is generated. @var{name} may be one of
18951 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
18952 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
18953 the M32C/80 series.
18957 Specifies that the program will be run on the simulator. This causes
18958 an alternate runtime library to be linked in which supports, for
18959 example, file I/O@. You must not use this option when generating
18960 programs that will run on real hardware; you must provide your own
18961 runtime library for whatever I/O functions are needed.
18963 @item -memregs=@var{number}
18965 Specifies the number of memory-based pseudo-registers GCC uses
18966 during code generation. These pseudo-registers are used like real
18967 registers, so there is a tradeoff between GCC's ability to fit the
18968 code into available registers, and the performance penalty of using
18969 memory instead of registers. Note that all modules in a program must
18970 be compiled with the same value for this option. Because of that, you
18971 must not use this option with GCC's default runtime libraries.
18975 @node M32R/D Options
18976 @subsection M32R/D Options
18977 @cindex M32R/D options
18979 These @option{-m} options are defined for Renesas M32R/D architectures:
18984 Generate code for the M32R/2@.
18988 Generate code for the M32R/X@.
18992 Generate code for the M32R@. This is the default.
18994 @item -mmodel=small
18995 @opindex mmodel=small
18996 Assume all objects live in the lower 16MB of memory (so that their addresses
18997 can be loaded with the @code{ld24} instruction), and assume all subroutines
18998 are reachable with the @code{bl} instruction.
18999 This is the default.
19001 The addressability of a particular object can be set with the
19002 @code{model} attribute.
19004 @item -mmodel=medium
19005 @opindex mmodel=medium
19006 Assume objects may be anywhere in the 32-bit address space (the compiler
19007 generates @code{seth/add3} instructions to load their addresses), and
19008 assume all subroutines are reachable with the @code{bl} instruction.
19010 @item -mmodel=large
19011 @opindex mmodel=large
19012 Assume objects may be anywhere in the 32-bit address space (the compiler
19013 generates @code{seth/add3} instructions to load their addresses), and
19014 assume subroutines may not be reachable with the @code{bl} instruction
19015 (the compiler generates the much slower @code{seth/add3/jl}
19016 instruction sequence).
19019 @opindex msdata=none
19020 Disable use of the small data area. Variables are put into
19021 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
19022 @code{section} attribute has been specified).
19023 This is the default.
19025 The small data area consists of sections @code{.sdata} and @code{.sbss}.
19026 Objects may be explicitly put in the small data area with the
19027 @code{section} attribute using one of these sections.
19029 @item -msdata=sdata
19030 @opindex msdata=sdata
19031 Put small global and static data in the small data area, but do not
19032 generate special code to reference them.
19035 @opindex msdata=use
19036 Put small global and static data in the small data area, and generate
19037 special instructions to reference them.
19041 @cindex smaller data references
19042 Put global and static objects less than or equal to @var{num} bytes
19043 into the small data or BSS sections instead of the normal data or BSS
19044 sections. The default value of @var{num} is 8.
19045 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
19046 for this option to have any effect.
19048 All modules should be compiled with the same @option{-G @var{num}} value.
19049 Compiling with different values of @var{num} may or may not work; if it
19050 doesn't the linker gives an error message---incorrect code is not
19055 Makes the M32R-specific code in the compiler display some statistics
19056 that might help in debugging programs.
19058 @item -malign-loops
19059 @opindex malign-loops
19060 Align all loops to a 32-byte boundary.
19062 @item -mno-align-loops
19063 @opindex mno-align-loops
19064 Do not enforce a 32-byte alignment for loops. This is the default.
19066 @item -missue-rate=@var{number}
19067 @opindex missue-rate=@var{number}
19068 Issue @var{number} instructions per cycle. @var{number} can only be 1
19071 @item -mbranch-cost=@var{number}
19072 @opindex mbranch-cost=@var{number}
19073 @var{number} can only be 1 or 2. If it is 1 then branches are
19074 preferred over conditional code, if it is 2, then the opposite applies.
19076 @item -mflush-trap=@var{number}
19077 @opindex mflush-trap=@var{number}
19078 Specifies the trap number to use to flush the cache. The default is
19079 12. Valid numbers are between 0 and 15 inclusive.
19081 @item -mno-flush-trap
19082 @opindex mno-flush-trap
19083 Specifies that the cache cannot be flushed by using a trap.
19085 @item -mflush-func=@var{name}
19086 @opindex mflush-func=@var{name}
19087 Specifies the name of the operating system function to call to flush
19088 the cache. The default is @samp{_flush_cache}, but a function call
19089 is only used if a trap is not available.
19091 @item -mno-flush-func
19092 @opindex mno-flush-func
19093 Indicates that there is no OS function for flushing the cache.
19097 @node M680x0 Options
19098 @subsection M680x0 Options
19099 @cindex M680x0 options
19101 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
19102 The default settings depend on which architecture was selected when
19103 the compiler was configured; the defaults for the most common choices
19107 @item -march=@var{arch}
19109 Generate code for a specific M680x0 or ColdFire instruction set
19110 architecture. Permissible values of @var{arch} for M680x0
19111 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
19112 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
19113 architectures are selected according to Freescale's ISA classification
19114 and the permissible values are: @samp{isaa}, @samp{isaaplus},
19115 @samp{isab} and @samp{isac}.
19117 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
19118 code for a ColdFire target. The @var{arch} in this macro is one of the
19119 @option{-march} arguments given above.
19121 When used together, @option{-march} and @option{-mtune} select code
19122 that runs on a family of similar processors but that is optimized
19123 for a particular microarchitecture.
19125 @item -mcpu=@var{cpu}
19127 Generate code for a specific M680x0 or ColdFire processor.
19128 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
19129 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
19130 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
19131 below, which also classifies the CPUs into families:
19133 @multitable @columnfractions 0.20 0.80
19134 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
19135 @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}
19136 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
19137 @item @samp{5206e} @tab @samp{5206e}
19138 @item @samp{5208} @tab @samp{5207} @samp{5208}
19139 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
19140 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
19141 @item @samp{5216} @tab @samp{5214} @samp{5216}
19142 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
19143 @item @samp{5225} @tab @samp{5224} @samp{5225}
19144 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
19145 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
19146 @item @samp{5249} @tab @samp{5249}
19147 @item @samp{5250} @tab @samp{5250}
19148 @item @samp{5271} @tab @samp{5270} @samp{5271}
19149 @item @samp{5272} @tab @samp{5272}
19150 @item @samp{5275} @tab @samp{5274} @samp{5275}
19151 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
19152 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
19153 @item @samp{5307} @tab @samp{5307}
19154 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
19155 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
19156 @item @samp{5407} @tab @samp{5407}
19157 @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}
19160 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
19161 @var{arch} is compatible with @var{cpu}. Other combinations of
19162 @option{-mcpu} and @option{-march} are rejected.
19164 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
19165 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
19166 where the value of @var{family} is given by the table above.
19168 @item -mtune=@var{tune}
19170 Tune the code for a particular microarchitecture within the
19171 constraints set by @option{-march} and @option{-mcpu}.
19172 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
19173 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
19174 and @samp{cpu32}. The ColdFire microarchitectures
19175 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
19177 You can also use @option{-mtune=68020-40} for code that needs
19178 to run relatively well on 68020, 68030 and 68040 targets.
19179 @option{-mtune=68020-60} is similar but includes 68060 targets
19180 as well. These two options select the same tuning decisions as
19181 @option{-m68020-40} and @option{-m68020-60} respectively.
19183 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
19184 when tuning for 680x0 architecture @var{arch}. It also defines
19185 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
19186 option is used. If GCC is tuning for a range of architectures,
19187 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
19188 it defines the macros for every architecture in the range.
19190 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
19191 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
19192 of the arguments given above.
19198 Generate output for a 68000. This is the default
19199 when the compiler is configured for 68000-based systems.
19200 It is equivalent to @option{-march=68000}.
19202 Use this option for microcontrollers with a 68000 or EC000 core,
19203 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
19207 Generate output for a 68010. This is the default
19208 when the compiler is configured for 68010-based systems.
19209 It is equivalent to @option{-march=68010}.
19215 Generate output for a 68020. This is the default
19216 when the compiler is configured for 68020-based systems.
19217 It is equivalent to @option{-march=68020}.
19221 Generate output for a 68030. This is the default when the compiler is
19222 configured for 68030-based systems. It is equivalent to
19223 @option{-march=68030}.
19227 Generate output for a 68040. This is the default when the compiler is
19228 configured for 68040-based systems. It is equivalent to
19229 @option{-march=68040}.
19231 This option inhibits the use of 68881/68882 instructions that have to be
19232 emulated by software on the 68040. Use this option if your 68040 does not
19233 have code to emulate those instructions.
19237 Generate output for a 68060. This is the default when the compiler is
19238 configured for 68060-based systems. It is equivalent to
19239 @option{-march=68060}.
19241 This option inhibits the use of 68020 and 68881/68882 instructions that
19242 have to be emulated by software on the 68060. Use this option if your 68060
19243 does not have code to emulate those instructions.
19247 Generate output for a CPU32. This is the default
19248 when the compiler is configured for CPU32-based systems.
19249 It is equivalent to @option{-march=cpu32}.
19251 Use this option for microcontrollers with a
19252 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
19253 68336, 68340, 68341, 68349 and 68360.
19257 Generate output for a 520X ColdFire CPU@. This is the default
19258 when the compiler is configured for 520X-based systems.
19259 It is equivalent to @option{-mcpu=5206}, and is now deprecated
19260 in favor of that option.
19262 Use this option for microcontroller with a 5200 core, including
19263 the MCF5202, MCF5203, MCF5204 and MCF5206.
19267 Generate output for a 5206e ColdFire CPU@. The option is now
19268 deprecated in favor of the equivalent @option{-mcpu=5206e}.
19272 Generate output for a member of the ColdFire 528X family.
19273 The option is now deprecated in favor of the equivalent
19274 @option{-mcpu=528x}.
19278 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
19279 in favor of the equivalent @option{-mcpu=5307}.
19283 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
19284 in favor of the equivalent @option{-mcpu=5407}.
19288 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
19289 This includes use of hardware floating-point instructions.
19290 The option is equivalent to @option{-mcpu=547x}, and is now
19291 deprecated in favor of that option.
19295 Generate output for a 68040, without using any of the new instructions.
19296 This results in code that can run relatively efficiently on either a
19297 68020/68881 or a 68030 or a 68040. The generated code does use the
19298 68881 instructions that are emulated on the 68040.
19300 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
19304 Generate output for a 68060, without using any of the new instructions.
19305 This results in code that can run relatively efficiently on either a
19306 68020/68881 or a 68030 or a 68040. The generated code does use the
19307 68881 instructions that are emulated on the 68060.
19309 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
19313 @opindex mhard-float
19315 Generate floating-point instructions. This is the default for 68020
19316 and above, and for ColdFire devices that have an FPU@. It defines the
19317 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
19318 on ColdFire targets.
19321 @opindex msoft-float
19322 Do not generate floating-point instructions; use library calls instead.
19323 This is the default for 68000, 68010, and 68832 targets. It is also
19324 the default for ColdFire devices that have no FPU.
19330 Generate (do not generate) ColdFire hardware divide and remainder
19331 instructions. If @option{-march} is used without @option{-mcpu},
19332 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
19333 architectures. Otherwise, the default is taken from the target CPU
19334 (either the default CPU, or the one specified by @option{-mcpu}). For
19335 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
19336 @option{-mcpu=5206e}.
19338 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
19342 Consider type @code{int} to be 16 bits wide, like @code{short int}.
19343 Additionally, parameters passed on the stack are also aligned to a
19344 16-bit boundary even on targets whose API mandates promotion to 32-bit.
19348 Do not consider type @code{int} to be 16 bits wide. This is the default.
19351 @itemx -mno-bitfield
19352 @opindex mnobitfield
19353 @opindex mno-bitfield
19354 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
19355 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
19359 Do use the bit-field instructions. The @option{-m68020} option implies
19360 @option{-mbitfield}. This is the default if you use a configuration
19361 designed for a 68020.
19365 Use a different function-calling convention, in which functions
19366 that take a fixed number of arguments return with the @code{rtd}
19367 instruction, which pops their arguments while returning. This
19368 saves one instruction in the caller since there is no need to pop
19369 the arguments there.
19371 This calling convention is incompatible with the one normally
19372 used on Unix, so you cannot use it if you need to call libraries
19373 compiled with the Unix compiler.
19375 Also, you must provide function prototypes for all functions that
19376 take variable numbers of arguments (including @code{printf});
19377 otherwise incorrect code is generated for calls to those
19380 In addition, seriously incorrect code results if you call a
19381 function with too many arguments. (Normally, extra arguments are
19382 harmlessly ignored.)
19384 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
19385 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
19389 Do not use the calling conventions selected by @option{-mrtd}.
19390 This is the default.
19393 @itemx -mno-align-int
19394 @opindex malign-int
19395 @opindex mno-align-int
19396 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
19397 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
19398 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
19399 Aligning variables on 32-bit boundaries produces code that runs somewhat
19400 faster on processors with 32-bit busses at the expense of more memory.
19402 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
19403 aligns structures containing the above types differently than
19404 most published application binary interface specifications for the m68k.
19408 Use the pc-relative addressing mode of the 68000 directly, instead of
19409 using a global offset table. At present, this option implies @option{-fpic},
19410 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
19411 not presently supported with @option{-mpcrel}, though this could be supported for
19412 68020 and higher processors.
19414 @item -mno-strict-align
19415 @itemx -mstrict-align
19416 @opindex mno-strict-align
19417 @opindex mstrict-align
19418 Do not (do) assume that unaligned memory references are handled by
19422 Generate code that allows the data segment to be located in a different
19423 area of memory from the text segment. This allows for execute-in-place in
19424 an environment without virtual memory management. This option implies
19427 @item -mno-sep-data
19428 Generate code that assumes that the data segment follows the text segment.
19429 This is the default.
19431 @item -mid-shared-library
19432 Generate code that supports shared libraries via the library ID method.
19433 This allows for execute-in-place and shared libraries in an environment
19434 without virtual memory management. This option implies @option{-fPIC}.
19436 @item -mno-id-shared-library
19437 Generate code that doesn't assume ID-based shared libraries are being used.
19438 This is the default.
19440 @item -mshared-library-id=n
19441 Specifies the identification number of the ID-based shared library being
19442 compiled. Specifying a value of 0 generates more compact code; specifying
19443 other values forces the allocation of that number to the current
19444 library, but is no more space- or time-efficient than omitting this option.
19450 When generating position-independent code for ColdFire, generate code
19451 that works if the GOT has more than 8192 entries. This code is
19452 larger and slower than code generated without this option. On M680x0
19453 processors, this option is not needed; @option{-fPIC} suffices.
19455 GCC normally uses a single instruction to load values from the GOT@.
19456 While this is relatively efficient, it only works if the GOT
19457 is smaller than about 64k. Anything larger causes the linker
19458 to report an error such as:
19460 @cindex relocation truncated to fit (ColdFire)
19462 relocation truncated to fit: R_68K_GOT16O foobar
19465 If this happens, you should recompile your code with @option{-mxgot}.
19466 It should then work with very large GOTs. However, code generated with
19467 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
19468 the value of a global symbol.
19470 Note that some linkers, including newer versions of the GNU linker,
19471 can create multiple GOTs and sort GOT entries. If you have such a linker,
19472 you should only need to use @option{-mxgot} when compiling a single
19473 object file that accesses more than 8192 GOT entries. Very few do.
19475 These options have no effect unless GCC is generating
19476 position-independent code.
19478 @item -mlong-jump-table-offsets
19479 @opindex mlong-jump-table-offsets
19480 Use 32-bit offsets in @code{switch} tables. The default is to use
19485 @node MCore Options
19486 @subsection MCore Options
19487 @cindex MCore options
19489 These are the @samp{-m} options defined for the Motorola M*Core
19495 @itemx -mno-hardlit
19497 @opindex mno-hardlit
19498 Inline constants into the code stream if it can be done in two
19499 instructions or less.
19505 Use the divide instruction. (Enabled by default).
19507 @item -mrelax-immediate
19508 @itemx -mno-relax-immediate
19509 @opindex mrelax-immediate
19510 @opindex mno-relax-immediate
19511 Allow arbitrary-sized immediates in bit operations.
19513 @item -mwide-bitfields
19514 @itemx -mno-wide-bitfields
19515 @opindex mwide-bitfields
19516 @opindex mno-wide-bitfields
19517 Always treat bit-fields as @code{int}-sized.
19519 @item -m4byte-functions
19520 @itemx -mno-4byte-functions
19521 @opindex m4byte-functions
19522 @opindex mno-4byte-functions
19523 Force all functions to be aligned to a 4-byte boundary.
19525 @item -mcallgraph-data
19526 @itemx -mno-callgraph-data
19527 @opindex mcallgraph-data
19528 @opindex mno-callgraph-data
19529 Emit callgraph information.
19532 @itemx -mno-slow-bytes
19533 @opindex mslow-bytes
19534 @opindex mno-slow-bytes
19535 Prefer word access when reading byte quantities.
19537 @item -mlittle-endian
19538 @itemx -mbig-endian
19539 @opindex mlittle-endian
19540 @opindex mbig-endian
19541 Generate code for a little-endian target.
19547 Generate code for the 210 processor.
19551 Assume that runtime support has been provided and so omit the
19552 simulator library (@file{libsim.a)} from the linker command line.
19554 @item -mstack-increment=@var{size}
19555 @opindex mstack-increment
19556 Set the maximum amount for a single stack increment operation. Large
19557 values can increase the speed of programs that contain functions
19558 that need a large amount of stack space, but they can also trigger a
19559 segmentation fault if the stack is extended too much. The default
19565 @subsection MeP Options
19566 @cindex MeP options
19572 Enables the @code{abs} instruction, which is the absolute difference
19573 between two registers.
19577 Enables all the optional instructions---average, multiply, divide, bit
19578 operations, leading zero, absolute difference, min/max, clip, and
19584 Enables the @code{ave} instruction, which computes the average of two
19587 @item -mbased=@var{n}
19589 Variables of size @var{n} bytes or smaller are placed in the
19590 @code{.based} section by default. Based variables use the @code{$tp}
19591 register as a base register, and there is a 128-byte limit to the
19592 @code{.based} section.
19596 Enables the bit operation instructions---bit test (@code{btstm}), set
19597 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
19598 test-and-set (@code{tas}).
19600 @item -mc=@var{name}
19602 Selects which section constant data is placed in. @var{name} may
19603 be @samp{tiny}, @samp{near}, or @samp{far}.
19607 Enables the @code{clip} instruction. Note that @option{-mclip} is not
19608 useful unless you also provide @option{-mminmax}.
19610 @item -mconfig=@var{name}
19612 Selects one of the built-in core configurations. Each MeP chip has
19613 one or more modules in it; each module has a core CPU and a variety of
19614 coprocessors, optional instructions, and peripherals. The
19615 @code{MeP-Integrator} tool, not part of GCC, provides these
19616 configurations through this option; using this option is the same as
19617 using all the corresponding command-line options. The default
19618 configuration is @samp{default}.
19622 Enables the coprocessor instructions. By default, this is a 32-bit
19623 coprocessor. Note that the coprocessor is normally enabled via the
19624 @option{-mconfig=} option.
19628 Enables the 32-bit coprocessor's instructions.
19632 Enables the 64-bit coprocessor's instructions.
19636 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
19640 Causes constant variables to be placed in the @code{.near} section.
19644 Enables the @code{div} and @code{divu} instructions.
19648 Generate big-endian code.
19652 Generate little-endian code.
19654 @item -mio-volatile
19655 @opindex mio-volatile
19656 Tells the compiler that any variable marked with the @code{io}
19657 attribute is to be considered volatile.
19661 Causes variables to be assigned to the @code{.far} section by default.
19665 Enables the @code{leadz} (leading zero) instruction.
19669 Causes variables to be assigned to the @code{.near} section by default.
19673 Enables the @code{min} and @code{max} instructions.
19677 Enables the multiplication and multiply-accumulate instructions.
19681 Disables all the optional instructions enabled by @option{-mall-opts}.
19685 Enables the @code{repeat} and @code{erepeat} instructions, used for
19686 low-overhead looping.
19690 Causes all variables to default to the @code{.tiny} section. Note
19691 that there is a 65536-byte limit to this section. Accesses to these
19692 variables use the @code{%gp} base register.
19696 Enables the saturation instructions. Note that the compiler does not
19697 currently generate these itself, but this option is included for
19698 compatibility with other tools, like @code{as}.
19702 Link the SDRAM-based runtime instead of the default ROM-based runtime.
19706 Link the simulator run-time libraries.
19710 Link the simulator runtime libraries, excluding built-in support
19711 for reset and exception vectors and tables.
19715 Causes all functions to default to the @code{.far} section. Without
19716 this option, functions default to the @code{.near} section.
19718 @item -mtiny=@var{n}
19720 Variables that are @var{n} bytes or smaller are allocated to the
19721 @code{.tiny} section. These variables use the @code{$gp} base
19722 register. The default for this option is 4, but note that there's a
19723 65536-byte limit to the @code{.tiny} section.
19727 @node MicroBlaze Options
19728 @subsection MicroBlaze Options
19729 @cindex MicroBlaze Options
19734 @opindex msoft-float
19735 Use software emulation for floating point (default).
19738 @opindex mhard-float
19739 Use hardware floating-point instructions.
19743 Do not optimize block moves, use @code{memcpy}.
19745 @item -mno-clearbss
19746 @opindex mno-clearbss
19747 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
19749 @item -mcpu=@var{cpu-type}
19751 Use features of, and schedule code for, the given CPU.
19752 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
19753 where @var{X} is a major version, @var{YY} is the minor version, and
19754 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
19755 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
19757 @item -mxl-soft-mul
19758 @opindex mxl-soft-mul
19759 Use software multiply emulation (default).
19761 @item -mxl-soft-div
19762 @opindex mxl-soft-div
19763 Use software emulation for divides (default).
19765 @item -mxl-barrel-shift
19766 @opindex mxl-barrel-shift
19767 Use the hardware barrel shifter.
19769 @item -mxl-pattern-compare
19770 @opindex mxl-pattern-compare
19771 Use pattern compare instructions.
19773 @item -msmall-divides
19774 @opindex msmall-divides
19775 Use table lookup optimization for small signed integer divisions.
19777 @item -mxl-stack-check
19778 @opindex mxl-stack-check
19779 This option is deprecated. Use @option{-fstack-check} instead.
19782 @opindex mxl-gp-opt
19783 Use GP-relative @code{.sdata}/@code{.sbss} sections.
19785 @item -mxl-multiply-high
19786 @opindex mxl-multiply-high
19787 Use multiply high instructions for high part of 32x32 multiply.
19789 @item -mxl-float-convert
19790 @opindex mxl-float-convert
19791 Use hardware floating-point conversion instructions.
19793 @item -mxl-float-sqrt
19794 @opindex mxl-float-sqrt
19795 Use hardware floating-point square root instruction.
19798 @opindex mbig-endian
19799 Generate code for a big-endian target.
19801 @item -mlittle-endian
19802 @opindex mlittle-endian
19803 Generate code for a little-endian target.
19806 @opindex mxl-reorder
19807 Use reorder instructions (swap and byte reversed load/store).
19809 @item -mxl-mode-@var{app-model}
19810 Select application model @var{app-model}. Valid models are
19813 normal executable (default), uses startup code @file{crt0.o}.
19816 for use with Xilinx Microprocessor Debugger (XMD) based
19817 software intrusive debug agent called xmdstub. This uses startup file
19818 @file{crt1.o} and sets the start address of the program to 0x800.
19821 for applications that are loaded using a bootloader.
19822 This model uses startup file @file{crt2.o} which does not contain a processor
19823 reset vector handler. This is suitable for transferring control on a
19824 processor reset to the bootloader rather than the application.
19827 for applications that do not require any of the
19828 MicroBlaze vectors. This option may be useful for applications running
19829 within a monitoring application. This model uses @file{crt3.o} as a startup file.
19832 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
19833 @option{-mxl-mode-@var{app-model}}.
19838 @subsection MIPS Options
19839 @cindex MIPS options
19845 Generate big-endian code.
19849 Generate little-endian code. This is the default for @samp{mips*el-*-*}
19852 @item -march=@var{arch}
19854 Generate code that runs on @var{arch}, which can be the name of a
19855 generic MIPS ISA, or the name of a particular processor.
19857 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
19858 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
19859 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
19860 @samp{mips64r5} and @samp{mips64r6}.
19861 The processor names are:
19862 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
19863 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
19864 @samp{5kc}, @samp{5kf},
19866 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
19867 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
19868 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
19869 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
19870 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
19873 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
19875 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
19876 @samp{m5100}, @samp{m5101},
19877 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
19880 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
19881 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
19882 @samp{rm7000}, @samp{rm9000},
19883 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
19886 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
19887 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
19888 @samp{xlr} and @samp{xlp}.
19889 The special value @samp{from-abi} selects the
19890 most compatible architecture for the selected ABI (that is,
19891 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
19893 The native Linux/GNU toolchain also supports the value @samp{native},
19894 which selects the best architecture option for the host processor.
19895 @option{-march=native} has no effect if GCC does not recognize
19898 In processor names, a final @samp{000} can be abbreviated as @samp{k}
19899 (for example, @option{-march=r2k}). Prefixes are optional, and
19900 @samp{vr} may be written @samp{r}.
19902 Names of the form @samp{@var{n}f2_1} refer to processors with
19903 FPUs clocked at half the rate of the core, names of the form
19904 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
19905 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
19906 processors with FPUs clocked a ratio of 3:2 with respect to the core.
19907 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
19908 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
19909 accepted as synonyms for @samp{@var{n}f1_1}.
19911 GCC defines two macros based on the value of this option. The first
19912 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
19913 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
19914 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
19915 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
19916 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
19918 Note that the @code{_MIPS_ARCH} macro uses the processor names given
19919 above. In other words, it has the full prefix and does not
19920 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
19921 the macro names the resolved architecture (either @code{"mips1"} or
19922 @code{"mips3"}). It names the default architecture when no
19923 @option{-march} option is given.
19925 @item -mtune=@var{arch}
19927 Optimize for @var{arch}. Among other things, this option controls
19928 the way instructions are scheduled, and the perceived cost of arithmetic
19929 operations. The list of @var{arch} values is the same as for
19932 When this option is not used, GCC optimizes for the processor
19933 specified by @option{-march}. By using @option{-march} and
19934 @option{-mtune} together, it is possible to generate code that
19935 runs on a family of processors, but optimize the code for one
19936 particular member of that family.
19938 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
19939 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
19940 @option{-march} ones described above.
19944 Equivalent to @option{-march=mips1}.
19948 Equivalent to @option{-march=mips2}.
19952 Equivalent to @option{-march=mips3}.
19956 Equivalent to @option{-march=mips4}.
19960 Equivalent to @option{-march=mips32}.
19964 Equivalent to @option{-march=mips32r3}.
19968 Equivalent to @option{-march=mips32r5}.
19972 Equivalent to @option{-march=mips32r6}.
19976 Equivalent to @option{-march=mips64}.
19980 Equivalent to @option{-march=mips64r2}.
19984 Equivalent to @option{-march=mips64r3}.
19988 Equivalent to @option{-march=mips64r5}.
19992 Equivalent to @option{-march=mips64r6}.
19997 @opindex mno-mips16
19998 Generate (do not generate) MIPS16 code. If GCC is targeting a
19999 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
20001 MIPS16 code generation can also be controlled on a per-function basis
20002 by means of @code{mips16} and @code{nomips16} attributes.
20003 @xref{Function Attributes}, for more information.
20005 @item -mflip-mips16
20006 @opindex mflip-mips16
20007 Generate MIPS16 code on alternating functions. This option is provided
20008 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
20009 not intended for ordinary use in compiling user code.
20011 @item -minterlink-compressed
20012 @item -mno-interlink-compressed
20013 @opindex minterlink-compressed
20014 @opindex mno-interlink-compressed
20015 Require (do not require) that code using the standard (uncompressed) MIPS ISA
20016 be link-compatible with MIPS16 and microMIPS code, and vice versa.
20018 For example, code using the standard ISA encoding cannot jump directly
20019 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
20020 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
20021 knows that the target of the jump is not compressed.
20023 @item -minterlink-mips16
20024 @itemx -mno-interlink-mips16
20025 @opindex minterlink-mips16
20026 @opindex mno-interlink-mips16
20027 Aliases of @option{-minterlink-compressed} and
20028 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
20029 and are retained for backwards compatibility.
20041 Generate code for the given ABI@.
20043 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
20044 generates 64-bit code when you select a 64-bit architecture, but you
20045 can use @option{-mgp32} to get 32-bit code instead.
20047 For information about the O64 ABI, see
20048 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
20050 GCC supports a variant of the o32 ABI in which floating-point registers
20051 are 64 rather than 32 bits wide. You can select this combination with
20052 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
20053 and @code{mfhc1} instructions and is therefore only supported for
20054 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
20056 The register assignments for arguments and return values remain the
20057 same, but each scalar value is passed in a single 64-bit register
20058 rather than a pair of 32-bit registers. For example, scalar
20059 floating-point values are returned in @samp{$f0} only, not a
20060 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
20061 remains the same in that the even-numbered double-precision registers
20064 Two additional variants of the o32 ABI are supported to enable
20065 a transition from 32-bit to 64-bit registers. These are FPXX
20066 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
20067 The FPXX extension mandates that all code must execute correctly
20068 when run using 32-bit or 64-bit registers. The code can be interlinked
20069 with either FP32 or FP64, but not both.
20070 The FP64A extension is similar to the FP64 extension but forbids the
20071 use of odd-numbered single-precision registers. This can be used
20072 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
20073 processors and allows both FP32 and FP64A code to interlink and
20074 run in the same process without changing FPU modes.
20077 @itemx -mno-abicalls
20079 @opindex mno-abicalls
20080 Generate (do not generate) code that is suitable for SVR4-style
20081 dynamic objects. @option{-mabicalls} is the default for SVR4-based
20086 Generate (do not generate) code that is fully position-independent,
20087 and that can therefore be linked into shared libraries. This option
20088 only affects @option{-mabicalls}.
20090 All @option{-mabicalls} code has traditionally been position-independent,
20091 regardless of options like @option{-fPIC} and @option{-fpic}. However,
20092 as an extension, the GNU toolchain allows executables to use absolute
20093 accesses for locally-binding symbols. It can also use shorter GP
20094 initialization sequences and generate direct calls to locally-defined
20095 functions. This mode is selected by @option{-mno-shared}.
20097 @option{-mno-shared} depends on binutils 2.16 or higher and generates
20098 objects that can only be linked by the GNU linker. However, the option
20099 does not affect the ABI of the final executable; it only affects the ABI
20100 of relocatable objects. Using @option{-mno-shared} generally makes
20101 executables both smaller and quicker.
20103 @option{-mshared} is the default.
20109 Assume (do not assume) that the static and dynamic linkers
20110 support PLTs and copy relocations. This option only affects
20111 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
20112 has no effect without @option{-msym32}.
20114 You can make @option{-mplt} the default by configuring
20115 GCC with @option{--with-mips-plt}. The default is
20116 @option{-mno-plt} otherwise.
20122 Lift (do not lift) the usual restrictions on the size of the global
20125 GCC normally uses a single instruction to load values from the GOT@.
20126 While this is relatively efficient, it only works if the GOT
20127 is smaller than about 64k. Anything larger causes the linker
20128 to report an error such as:
20130 @cindex relocation truncated to fit (MIPS)
20132 relocation truncated to fit: R_MIPS_GOT16 foobar
20135 If this happens, you should recompile your code with @option{-mxgot}.
20136 This works with very large GOTs, although the code is also
20137 less efficient, since it takes three instructions to fetch the
20138 value of a global symbol.
20140 Note that some linkers can create multiple GOTs. If you have such a
20141 linker, you should only need to use @option{-mxgot} when a single object
20142 file accesses more than 64k's worth of GOT entries. Very few do.
20144 These options have no effect unless GCC is generating position
20149 Assume that general-purpose registers are 32 bits wide.
20153 Assume that general-purpose registers are 64 bits wide.
20157 Assume that floating-point registers are 32 bits wide.
20161 Assume that floating-point registers are 64 bits wide.
20165 Do not assume the width of floating-point registers.
20168 @opindex mhard-float
20169 Use floating-point coprocessor instructions.
20172 @opindex msoft-float
20173 Do not use floating-point coprocessor instructions. Implement
20174 floating-point calculations using library calls instead.
20178 Equivalent to @option{-msoft-float}, but additionally asserts that the
20179 program being compiled does not perform any floating-point operations.
20180 This option is presently supported only by some bare-metal MIPS
20181 configurations, where it may select a special set of libraries
20182 that lack all floating-point support (including, for example, the
20183 floating-point @code{printf} formats).
20184 If code compiled with @option{-mno-float} accidentally contains
20185 floating-point operations, it is likely to suffer a link-time
20186 or run-time failure.
20188 @item -msingle-float
20189 @opindex msingle-float
20190 Assume that the floating-point coprocessor only supports single-precision
20193 @item -mdouble-float
20194 @opindex mdouble-float
20195 Assume that the floating-point coprocessor supports double-precision
20196 operations. This is the default.
20199 @itemx -mno-odd-spreg
20200 @opindex modd-spreg
20201 @opindex mno-odd-spreg
20202 Enable the use of odd-numbered single-precision floating-point registers
20203 for the o32 ABI. This is the default for processors that are known to
20204 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
20208 @itemx -mabs=legacy
20210 @opindex mabs=legacy
20211 These options control the treatment of the special not-a-number (NaN)
20212 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
20213 @code{neg.@i{fmt}} machine instructions.
20215 By default or when @option{-mabs=legacy} is used the legacy
20216 treatment is selected. In this case these instructions are considered
20217 arithmetic and avoided where correct operation is required and the
20218 input operand might be a NaN. A longer sequence of instructions that
20219 manipulate the sign bit of floating-point datum manually is used
20220 instead unless the @option{-ffinite-math-only} option has also been
20223 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
20224 this case these instructions are considered non-arithmetic and therefore
20225 operating correctly in all cases, including in particular where the
20226 input operand is a NaN. These instructions are therefore always used
20227 for the respective operations.
20230 @itemx -mnan=legacy
20232 @opindex mnan=legacy
20233 These options control the encoding of the special not-a-number (NaN)
20234 IEEE 754 floating-point data.
20236 The @option{-mnan=legacy} option selects the legacy encoding. In this
20237 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
20238 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
20239 by the first bit of their trailing significand field being 1.
20241 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
20242 this case qNaNs are denoted by the first bit of their trailing
20243 significand field being 1, whereas sNaNs are denoted by the first bit of
20244 their trailing significand field being 0.
20246 The default is @option{-mnan=legacy} unless GCC has been configured with
20247 @option{--with-nan=2008}.
20253 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
20254 implement atomic memory built-in functions. When neither option is
20255 specified, GCC uses the instructions if the target architecture
20258 @option{-mllsc} is useful if the runtime environment can emulate the
20259 instructions and @option{-mno-llsc} can be useful when compiling for
20260 nonstandard ISAs. You can make either option the default by
20261 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
20262 respectively. @option{--with-llsc} is the default for some
20263 configurations; see the installation documentation for details.
20269 Use (do not use) revision 1 of the MIPS DSP ASE@.
20270 @xref{MIPS DSP Built-in Functions}. This option defines the
20271 preprocessor macro @code{__mips_dsp}. It also defines
20272 @code{__mips_dsp_rev} to 1.
20278 Use (do not use) revision 2 of the MIPS DSP ASE@.
20279 @xref{MIPS DSP Built-in Functions}. This option defines the
20280 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
20281 It also defines @code{__mips_dsp_rev} to 2.
20284 @itemx -mno-smartmips
20285 @opindex msmartmips
20286 @opindex mno-smartmips
20287 Use (do not use) the MIPS SmartMIPS ASE.
20289 @item -mpaired-single
20290 @itemx -mno-paired-single
20291 @opindex mpaired-single
20292 @opindex mno-paired-single
20293 Use (do not use) paired-single floating-point instructions.
20294 @xref{MIPS Paired-Single Support}. This option requires
20295 hardware floating-point support to be enabled.
20301 Use (do not use) MIPS Digital Media Extension instructions.
20302 This option can only be used when generating 64-bit code and requires
20303 hardware floating-point support to be enabled.
20308 @opindex mno-mips3d
20309 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
20310 The option @option{-mips3d} implies @option{-mpaired-single}.
20313 @itemx -mno-micromips
20314 @opindex mmicromips
20315 @opindex mno-mmicromips
20316 Generate (do not generate) microMIPS code.
20318 MicroMIPS code generation can also be controlled on a per-function basis
20319 by means of @code{micromips} and @code{nomicromips} attributes.
20320 @xref{Function Attributes}, for more information.
20326 Use (do not use) MT Multithreading instructions.
20332 Use (do not use) the MIPS MCU ASE instructions.
20338 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
20344 Use (do not use) the MIPS Virtualization (VZ) instructions.
20350 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
20354 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
20355 an explanation of the default and the way that the pointer size is
20360 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
20362 The default size of @code{int}s, @code{long}s and pointers depends on
20363 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
20364 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
20365 32-bit @code{long}s. Pointers are the same size as @code{long}s,
20366 or the same size as integer registers, whichever is smaller.
20372 Assume (do not assume) that all symbols have 32-bit values, regardless
20373 of the selected ABI@. This option is useful in combination with
20374 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
20375 to generate shorter and faster references to symbolic addresses.
20379 Put definitions of externally-visible data in a small data section
20380 if that data is no bigger than @var{num} bytes. GCC can then generate
20381 more efficient accesses to the data; see @option{-mgpopt} for details.
20383 The default @option{-G} option depends on the configuration.
20385 @item -mlocal-sdata
20386 @itemx -mno-local-sdata
20387 @opindex mlocal-sdata
20388 @opindex mno-local-sdata
20389 Extend (do not extend) the @option{-G} behavior to local data too,
20390 such as to static variables in C@. @option{-mlocal-sdata} is the
20391 default for all configurations.
20393 If the linker complains that an application is using too much small data,
20394 you might want to try rebuilding the less performance-critical parts with
20395 @option{-mno-local-sdata}. You might also want to build large
20396 libraries with @option{-mno-local-sdata}, so that the libraries leave
20397 more room for the main program.
20399 @item -mextern-sdata
20400 @itemx -mno-extern-sdata
20401 @opindex mextern-sdata
20402 @opindex mno-extern-sdata
20403 Assume (do not assume) that externally-defined data is in
20404 a small data section if the size of that data is within the @option{-G} limit.
20405 @option{-mextern-sdata} is the default for all configurations.
20407 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
20408 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
20409 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
20410 is placed in a small data section. If @var{Var} is defined by another
20411 module, you must either compile that module with a high-enough
20412 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
20413 definition. If @var{Var} is common, you must link the application
20414 with a high-enough @option{-G} setting.
20416 The easiest way of satisfying these restrictions is to compile
20417 and link every module with the same @option{-G} option. However,
20418 you may wish to build a library that supports several different
20419 small data limits. You can do this by compiling the library with
20420 the highest supported @option{-G} setting and additionally using
20421 @option{-mno-extern-sdata} to stop the library from making assumptions
20422 about externally-defined data.
20428 Use (do not use) GP-relative accesses for symbols that are known to be
20429 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
20430 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
20433 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
20434 might not hold the value of @code{_gp}. For example, if the code is
20435 part of a library that might be used in a boot monitor, programs that
20436 call boot monitor routines pass an unknown value in @code{$gp}.
20437 (In such situations, the boot monitor itself is usually compiled
20438 with @option{-G0}.)
20440 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
20441 @option{-mno-extern-sdata}.
20443 @item -membedded-data
20444 @itemx -mno-embedded-data
20445 @opindex membedded-data
20446 @opindex mno-embedded-data
20447 Allocate variables to the read-only data section first if possible, then
20448 next in the small data section if possible, otherwise in data. This gives
20449 slightly slower code than the default, but reduces the amount of RAM required
20450 when executing, and thus may be preferred for some embedded systems.
20452 @item -muninit-const-in-rodata
20453 @itemx -mno-uninit-const-in-rodata
20454 @opindex muninit-const-in-rodata
20455 @opindex mno-uninit-const-in-rodata
20456 Put uninitialized @code{const} variables in the read-only data section.
20457 This option is only meaningful in conjunction with @option{-membedded-data}.
20459 @item -mcode-readable=@var{setting}
20460 @opindex mcode-readable
20461 Specify whether GCC may generate code that reads from executable sections.
20462 There are three possible settings:
20465 @item -mcode-readable=yes
20466 Instructions may freely access executable sections. This is the
20469 @item -mcode-readable=pcrel
20470 MIPS16 PC-relative load instructions can access executable sections,
20471 but other instructions must not do so. This option is useful on 4KSc
20472 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
20473 It is also useful on processors that can be configured to have a dual
20474 instruction/data SRAM interface and that, like the M4K, automatically
20475 redirect PC-relative loads to the instruction RAM.
20477 @item -mcode-readable=no
20478 Instructions must not access executable sections. This option can be
20479 useful on targets that are configured to have a dual instruction/data
20480 SRAM interface but that (unlike the M4K) do not automatically redirect
20481 PC-relative loads to the instruction RAM.
20484 @item -msplit-addresses
20485 @itemx -mno-split-addresses
20486 @opindex msplit-addresses
20487 @opindex mno-split-addresses
20488 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
20489 relocation operators. This option has been superseded by
20490 @option{-mexplicit-relocs} but is retained for backwards compatibility.
20492 @item -mexplicit-relocs
20493 @itemx -mno-explicit-relocs
20494 @opindex mexplicit-relocs
20495 @opindex mno-explicit-relocs
20496 Use (do not use) assembler relocation operators when dealing with symbolic
20497 addresses. The alternative, selected by @option{-mno-explicit-relocs},
20498 is to use assembler macros instead.
20500 @option{-mexplicit-relocs} is the default if GCC was configured
20501 to use an assembler that supports relocation operators.
20503 @item -mcheck-zero-division
20504 @itemx -mno-check-zero-division
20505 @opindex mcheck-zero-division
20506 @opindex mno-check-zero-division
20507 Trap (do not trap) on integer division by zero.
20509 The default is @option{-mcheck-zero-division}.
20511 @item -mdivide-traps
20512 @itemx -mdivide-breaks
20513 @opindex mdivide-traps
20514 @opindex mdivide-breaks
20515 MIPS systems check for division by zero by generating either a
20516 conditional trap or a break instruction. Using traps results in
20517 smaller code, but is only supported on MIPS II and later. Also, some
20518 versions of the Linux kernel have a bug that prevents trap from
20519 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
20520 allow conditional traps on architectures that support them and
20521 @option{-mdivide-breaks} to force the use of breaks.
20523 The default is usually @option{-mdivide-traps}, but this can be
20524 overridden at configure time using @option{--with-divide=breaks}.
20525 Divide-by-zero checks can be completely disabled using
20526 @option{-mno-check-zero-division}.
20528 @item -mload-store-pairs
20529 @itemx -mno-load-store-pairs
20530 @opindex mload-store-pairs
20531 @opindex mno-load-store-pairs
20532 Enable (disable) an optimization that pairs consecutive load or store
20533 instructions to enable load/store bonding. This option is enabled by
20534 default but only takes effect when the selected architecture is known
20535 to support bonding.
20540 @opindex mno-memcpy
20541 Force (do not force) the use of @code{memcpy} for non-trivial block
20542 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
20543 most constant-sized copies.
20546 @itemx -mno-long-calls
20547 @opindex mlong-calls
20548 @opindex mno-long-calls
20549 Disable (do not disable) use of the @code{jal} instruction. Calling
20550 functions using @code{jal} is more efficient but requires the caller
20551 and callee to be in the same 256 megabyte segment.
20553 This option has no effect on abicalls code. The default is
20554 @option{-mno-long-calls}.
20560 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
20561 instructions, as provided by the R4650 ISA@.
20567 Enable (disable) use of the @code{madd} and @code{msub} integer
20568 instructions. The default is @option{-mimadd} on architectures
20569 that support @code{madd} and @code{msub} except for the 74k
20570 architecture where it was found to generate slower code.
20573 @itemx -mno-fused-madd
20574 @opindex mfused-madd
20575 @opindex mno-fused-madd
20576 Enable (disable) use of the floating-point multiply-accumulate
20577 instructions, when they are available. The default is
20578 @option{-mfused-madd}.
20580 On the R8000 CPU when multiply-accumulate instructions are used,
20581 the intermediate product is calculated to infinite precision
20582 and is not subject to the FCSR Flush to Zero bit. This may be
20583 undesirable in some circumstances. On other processors the result
20584 is numerically identical to the equivalent computation using
20585 separate multiply, add, subtract and negate instructions.
20589 Tell the MIPS assembler to not run its preprocessor over user
20590 assembler files (with a @samp{.s} suffix) when assembling them.
20595 @opindex mno-fix-24k
20596 Work around the 24K E48 (lost data on stores during refill) errata.
20597 The workarounds are implemented by the assembler rather than by GCC@.
20600 @itemx -mno-fix-r4000
20601 @opindex mfix-r4000
20602 @opindex mno-fix-r4000
20603 Work around certain R4000 CPU errata:
20606 A double-word or a variable shift may give an incorrect result if executed
20607 immediately after starting an integer division.
20609 A double-word or a variable shift may give an incorrect result if executed
20610 while an integer multiplication is in progress.
20612 An integer division may give an incorrect result if started in a delay slot
20613 of a taken branch or a jump.
20617 @itemx -mno-fix-r4400
20618 @opindex mfix-r4400
20619 @opindex mno-fix-r4400
20620 Work around certain R4400 CPU errata:
20623 A double-word or a variable shift may give an incorrect result if executed
20624 immediately after starting an integer division.
20628 @itemx -mno-fix-r10000
20629 @opindex mfix-r10000
20630 @opindex mno-fix-r10000
20631 Work around certain R10000 errata:
20634 @code{ll}/@code{sc} sequences may not behave atomically on revisions
20635 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
20638 This option can only be used if the target architecture supports
20639 branch-likely instructions. @option{-mfix-r10000} is the default when
20640 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
20644 @itemx -mno-fix-rm7000
20645 @opindex mfix-rm7000
20646 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
20647 workarounds are implemented by the assembler rather than by GCC@.
20650 @itemx -mno-fix-vr4120
20651 @opindex mfix-vr4120
20652 Work around certain VR4120 errata:
20655 @code{dmultu} does not always produce the correct result.
20657 @code{div} and @code{ddiv} do not always produce the correct result if one
20658 of the operands is negative.
20660 The workarounds for the division errata rely on special functions in
20661 @file{libgcc.a}. At present, these functions are only provided by
20662 the @code{mips64vr*-elf} configurations.
20664 Other VR4120 errata require a NOP to be inserted between certain pairs of
20665 instructions. These errata are handled by the assembler, not by GCC itself.
20668 @opindex mfix-vr4130
20669 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
20670 workarounds are implemented by the assembler rather than by GCC,
20671 although GCC avoids using @code{mflo} and @code{mfhi} if the
20672 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
20673 instructions are available instead.
20676 @itemx -mno-fix-sb1
20678 Work around certain SB-1 CPU core errata.
20679 (This flag currently works around the SB-1 revision 2
20680 ``F1'' and ``F2'' floating-point errata.)
20682 @item -mr10k-cache-barrier=@var{setting}
20683 @opindex mr10k-cache-barrier
20684 Specify whether GCC should insert cache barriers to avoid the
20685 side-effects of speculation on R10K processors.
20687 In common with many processors, the R10K tries to predict the outcome
20688 of a conditional branch and speculatively executes instructions from
20689 the ``taken'' branch. It later aborts these instructions if the
20690 predicted outcome is wrong. However, on the R10K, even aborted
20691 instructions can have side effects.
20693 This problem only affects kernel stores and, depending on the system,
20694 kernel loads. As an example, a speculatively-executed store may load
20695 the target memory into cache and mark the cache line as dirty, even if
20696 the store itself is later aborted. If a DMA operation writes to the
20697 same area of memory before the ``dirty'' line is flushed, the cached
20698 data overwrites the DMA-ed data. See the R10K processor manual
20699 for a full description, including other potential problems.
20701 One workaround is to insert cache barrier instructions before every memory
20702 access that might be speculatively executed and that might have side
20703 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
20704 controls GCC's implementation of this workaround. It assumes that
20705 aborted accesses to any byte in the following regions does not have
20710 the memory occupied by the current function's stack frame;
20713 the memory occupied by an incoming stack argument;
20716 the memory occupied by an object with a link-time-constant address.
20719 It is the kernel's responsibility to ensure that speculative
20720 accesses to these regions are indeed safe.
20722 If the input program contains a function declaration such as:
20728 then the implementation of @code{foo} must allow @code{j foo} and
20729 @code{jal foo} to be executed speculatively. GCC honors this
20730 restriction for functions it compiles itself. It expects non-GCC
20731 functions (such as hand-written assembly code) to do the same.
20733 The option has three forms:
20736 @item -mr10k-cache-barrier=load-store
20737 Insert a cache barrier before a load or store that might be
20738 speculatively executed and that might have side effects even
20741 @item -mr10k-cache-barrier=store
20742 Insert a cache barrier before a store that might be speculatively
20743 executed and that might have side effects even if aborted.
20745 @item -mr10k-cache-barrier=none
20746 Disable the insertion of cache barriers. This is the default setting.
20749 @item -mflush-func=@var{func}
20750 @itemx -mno-flush-func
20751 @opindex mflush-func
20752 Specifies the function to call to flush the I and D caches, or to not
20753 call any such function. If called, the function must take the same
20754 arguments as the common @code{_flush_func}, that is, the address of the
20755 memory range for which the cache is being flushed, the size of the
20756 memory range, and the number 3 (to flush both caches). The default
20757 depends on the target GCC was configured for, but commonly is either
20758 @code{_flush_func} or @code{__cpu_flush}.
20760 @item mbranch-cost=@var{num}
20761 @opindex mbranch-cost
20762 Set the cost of branches to roughly @var{num} ``simple'' instructions.
20763 This cost is only a heuristic and is not guaranteed to produce
20764 consistent results across releases. A zero cost redundantly selects
20765 the default, which is based on the @option{-mtune} setting.
20767 @item -mbranch-likely
20768 @itemx -mno-branch-likely
20769 @opindex mbranch-likely
20770 @opindex mno-branch-likely
20771 Enable or disable use of Branch Likely instructions, regardless of the
20772 default for the selected architecture. By default, Branch Likely
20773 instructions may be generated if they are supported by the selected
20774 architecture. An exception is for the MIPS32 and MIPS64 architectures
20775 and processors that implement those architectures; for those, Branch
20776 Likely instructions are not be generated by default because the MIPS32
20777 and MIPS64 architectures specifically deprecate their use.
20779 @item -mcompact-branches=never
20780 @itemx -mcompact-branches=optimal
20781 @itemx -mcompact-branches=always
20782 @opindex mcompact-branches=never
20783 @opindex mcompact-branches=optimal
20784 @opindex mcompact-branches=always
20785 These options control which form of branches will be generated. The
20786 default is @option{-mcompact-branches=optimal}.
20788 The @option{-mcompact-branches=never} option ensures that compact branch
20789 instructions will never be generated.
20791 The @option{-mcompact-branches=always} option ensures that a compact
20792 branch instruction will be generated if available. If a compact branch
20793 instruction is not available, a delay slot form of the branch will be
20796 This option is supported from MIPS Release 6 onwards.
20798 The @option{-mcompact-branches=optimal} option will cause a delay slot
20799 branch to be used if one is available in the current ISA and the delay
20800 slot is successfully filled. If the delay slot is not filled, a compact
20801 branch will be chosen if one is available.
20803 @item -mfp-exceptions
20804 @itemx -mno-fp-exceptions
20805 @opindex mfp-exceptions
20806 Specifies whether FP exceptions are enabled. This affects how
20807 FP instructions are scheduled for some processors.
20808 The default is that FP exceptions are
20811 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
20812 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
20815 @item -mvr4130-align
20816 @itemx -mno-vr4130-align
20817 @opindex mvr4130-align
20818 The VR4130 pipeline is two-way superscalar, but can only issue two
20819 instructions together if the first one is 8-byte aligned. When this
20820 option is enabled, GCC aligns pairs of instructions that it
20821 thinks should execute in parallel.
20823 This option only has an effect when optimizing for the VR4130.
20824 It normally makes code faster, but at the expense of making it bigger.
20825 It is enabled by default at optimization level @option{-O3}.
20830 Enable (disable) generation of @code{synci} instructions on
20831 architectures that support it. The @code{synci} instructions (if
20832 enabled) are generated when @code{__builtin___clear_cache} is
20835 This option defaults to @option{-mno-synci}, but the default can be
20836 overridden by configuring GCC with @option{--with-synci}.
20838 When compiling code for single processor systems, it is generally safe
20839 to use @code{synci}. However, on many multi-core (SMP) systems, it
20840 does not invalidate the instruction caches on all cores and may lead
20841 to undefined behavior.
20843 @item -mrelax-pic-calls
20844 @itemx -mno-relax-pic-calls
20845 @opindex mrelax-pic-calls
20846 Try to turn PIC calls that are normally dispatched via register
20847 @code{$25} into direct calls. This is only possible if the linker can
20848 resolve the destination at link time and if the destination is within
20849 range for a direct call.
20851 @option{-mrelax-pic-calls} is the default if GCC was configured to use
20852 an assembler and a linker that support the @code{.reloc} assembly
20853 directive and @option{-mexplicit-relocs} is in effect. With
20854 @option{-mno-explicit-relocs}, this optimization can be performed by the
20855 assembler and the linker alone without help from the compiler.
20857 @item -mmcount-ra-address
20858 @itemx -mno-mcount-ra-address
20859 @opindex mmcount-ra-address
20860 @opindex mno-mcount-ra-address
20861 Emit (do not emit) code that allows @code{_mcount} to modify the
20862 calling function's return address. When enabled, this option extends
20863 the usual @code{_mcount} interface with a new @var{ra-address}
20864 parameter, which has type @code{intptr_t *} and is passed in register
20865 @code{$12}. @code{_mcount} can then modify the return address by
20866 doing both of the following:
20869 Returning the new address in register @code{$31}.
20871 Storing the new address in @code{*@var{ra-address}},
20872 if @var{ra-address} is nonnull.
20875 The default is @option{-mno-mcount-ra-address}.
20877 @item -mframe-header-opt
20878 @itemx -mno-frame-header-opt
20879 @opindex mframe-header-opt
20880 Enable (disable) frame header optimization in the o32 ABI. When using the
20881 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
20882 function to write out register arguments. When enabled, this optimization
20883 will suppress the allocation of the frame header if it can be determined that
20886 This optimization is off by default at all optimization levels.
20889 @itemx -mno-lxc1-sxc1
20890 @opindex mlxc1-sxc1
20891 When applicable, enable (disable) the generation of @code{lwxc1},
20892 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
20897 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
20898 @code{madd.d} and related instructions. Enabled by default.
20903 @subsection MMIX Options
20904 @cindex MMIX Options
20906 These options are defined for the MMIX:
20910 @itemx -mno-libfuncs
20912 @opindex mno-libfuncs
20913 Specify that intrinsic library functions are being compiled, passing all
20914 values in registers, no matter the size.
20917 @itemx -mno-epsilon
20919 @opindex mno-epsilon
20920 Generate floating-point comparison instructions that compare with respect
20921 to the @code{rE} epsilon register.
20923 @item -mabi=mmixware
20925 @opindex mabi=mmixware
20927 Generate code that passes function parameters and return values that (in
20928 the called function) are seen as registers @code{$0} and up, as opposed to
20929 the GNU ABI which uses global registers @code{$231} and up.
20931 @item -mzero-extend
20932 @itemx -mno-zero-extend
20933 @opindex mzero-extend
20934 @opindex mno-zero-extend
20935 When reading data from memory in sizes shorter than 64 bits, use (do not
20936 use) zero-extending load instructions by default, rather than
20937 sign-extending ones.
20940 @itemx -mno-knuthdiv
20942 @opindex mno-knuthdiv
20943 Make the result of a division yielding a remainder have the same sign as
20944 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
20945 remainder follows the sign of the dividend. Both methods are
20946 arithmetically valid, the latter being almost exclusively used.
20948 @item -mtoplevel-symbols
20949 @itemx -mno-toplevel-symbols
20950 @opindex mtoplevel-symbols
20951 @opindex mno-toplevel-symbols
20952 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
20953 code can be used with the @code{PREFIX} assembly directive.
20957 Generate an executable in the ELF format, rather than the default
20958 @samp{mmo} format used by the @command{mmix} simulator.
20960 @item -mbranch-predict
20961 @itemx -mno-branch-predict
20962 @opindex mbranch-predict
20963 @opindex mno-branch-predict
20964 Use (do not use) the probable-branch instructions, when static branch
20965 prediction indicates a probable branch.
20967 @item -mbase-addresses
20968 @itemx -mno-base-addresses
20969 @opindex mbase-addresses
20970 @opindex mno-base-addresses
20971 Generate (do not generate) code that uses @emph{base addresses}. Using a
20972 base address automatically generates a request (handled by the assembler
20973 and the linker) for a constant to be set up in a global register. The
20974 register is used for one or more base address requests within the range 0
20975 to 255 from the value held in the register. The generally leads to short
20976 and fast code, but the number of different data items that can be
20977 addressed is limited. This means that a program that uses lots of static
20978 data may require @option{-mno-base-addresses}.
20980 @item -msingle-exit
20981 @itemx -mno-single-exit
20982 @opindex msingle-exit
20983 @opindex mno-single-exit
20984 Force (do not force) generated code to have a single exit point in each
20988 @node MN10300 Options
20989 @subsection MN10300 Options
20990 @cindex MN10300 options
20992 These @option{-m} options are defined for Matsushita MN10300 architectures:
20997 Generate code to avoid bugs in the multiply instructions for the MN10300
20998 processors. This is the default.
21000 @item -mno-mult-bug
21001 @opindex mno-mult-bug
21002 Do not generate code to avoid bugs in the multiply instructions for the
21003 MN10300 processors.
21007 Generate code using features specific to the AM33 processor.
21011 Do not generate code using features specific to the AM33 processor. This
21016 Generate code using features specific to the AM33/2.0 processor.
21020 Generate code using features specific to the AM34 processor.
21022 @item -mtune=@var{cpu-type}
21024 Use the timing characteristics of the indicated CPU type when
21025 scheduling instructions. This does not change the targeted processor
21026 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
21027 @samp{am33-2} or @samp{am34}.
21029 @item -mreturn-pointer-on-d0
21030 @opindex mreturn-pointer-on-d0
21031 When generating a function that returns a pointer, return the pointer
21032 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
21033 only in @code{a0}, and attempts to call such functions without a prototype
21034 result in errors. Note that this option is on by default; use
21035 @option{-mno-return-pointer-on-d0} to disable it.
21039 Do not link in the C run-time initialization object file.
21043 Indicate to the linker that it should perform a relaxation optimization pass
21044 to shorten branches, calls and absolute memory addresses. This option only
21045 has an effect when used on the command line for the final link step.
21047 This option makes symbolic debugging impossible.
21051 Allow the compiler to generate @emph{Long Instruction Word}
21052 instructions if the target is the @samp{AM33} or later. This is the
21053 default. This option defines the preprocessor macro @code{__LIW__}.
21057 Do not allow the compiler to generate @emph{Long Instruction Word}
21058 instructions. This option defines the preprocessor macro
21063 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
21064 instructions if the target is the @samp{AM33} or later. This is the
21065 default. This option defines the preprocessor macro @code{__SETLB__}.
21069 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
21070 instructions. This option defines the preprocessor macro
21071 @code{__NO_SETLB__}.
21075 @node Moxie Options
21076 @subsection Moxie Options
21077 @cindex Moxie Options
21083 Generate big-endian code. This is the default for @samp{moxie-*-*}
21088 Generate little-endian code.
21092 Generate mul.x and umul.x instructions. This is the default for
21093 @samp{moxiebox-*-*} configurations.
21097 Do not link in the C run-time initialization object file.
21101 @node MSP430 Options
21102 @subsection MSP430 Options
21103 @cindex MSP430 Options
21105 These options are defined for the MSP430:
21111 Force assembly output to always use hex constants. Normally such
21112 constants are signed decimals, but this option is available for
21113 testsuite and/or aesthetic purposes.
21117 Select the MCU to target. This is used to create a C preprocessor
21118 symbol based upon the MCU name, converted to upper case and pre- and
21119 post-fixed with @samp{__}. This in turn is used by the
21120 @file{msp430.h} header file to select an MCU-specific supplementary
21123 The option also sets the ISA to use. If the MCU name is one that is
21124 known to only support the 430 ISA then that is selected, otherwise the
21125 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
21126 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
21127 name selects the 430X ISA.
21129 In addition an MCU-specific linker script is added to the linker
21130 command line. The script's name is the name of the MCU with
21131 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
21132 command line defines the C preprocessor symbol @code{__XXX__} and
21133 cause the linker to search for a script called @file{xxx.ld}.
21135 This option is also passed on to the assembler.
21138 @itemx -mno-warn-mcu
21140 @opindex mno-warn-mcu
21141 This option enables or disables warnings about conflicts between the
21142 MCU name specified by the @option{-mmcu} option and the ISA set by the
21143 @option{-mcpu} option and/or the hardware multiply support set by the
21144 @option{-mhwmult} option. It also toggles warnings about unrecognized
21145 MCU names. This option is on by default.
21149 Specifies the ISA to use. Accepted values are @samp{msp430},
21150 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
21151 @option{-mmcu=} option should be used to select the ISA.
21155 Link to the simulator runtime libraries and linker script. Overrides
21156 any scripts that would be selected by the @option{-mmcu=} option.
21160 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
21164 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
21168 This option is passed to the assembler and linker, and allows the
21169 linker to perform certain optimizations that cannot be done until
21174 Describes the type of hardware multiply supported by the target.
21175 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
21176 for the original 16-bit-only multiply supported by early MCUs.
21177 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
21178 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
21179 A value of @samp{auto} can also be given. This tells GCC to deduce
21180 the hardware multiply support based upon the MCU name provided by the
21181 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
21182 the MCU name is not recognized then no hardware multiply support is
21183 assumed. @code{auto} is the default setting.
21185 Hardware multiplies are normally performed by calling a library
21186 routine. This saves space in the generated code. When compiling at
21187 @option{-O3} or higher however the hardware multiplier is invoked
21188 inline. This makes for bigger, but faster code.
21190 The hardware multiply routines disable interrupts whilst running and
21191 restore the previous interrupt state when they finish. This makes
21192 them safe to use inside interrupt handlers as well as in normal code.
21196 Enable the use of a minimum runtime environment - no static
21197 initializers or constructors. This is intended for memory-constrained
21198 devices. The compiler includes special symbols in some objects
21199 that tell the linker and runtime which code fragments are required.
21201 @item -mcode-region=
21202 @itemx -mdata-region=
21203 @opindex mcode-region
21204 @opindex mdata-region
21205 These options tell the compiler where to place functions and data that
21206 do not have one of the @code{lower}, @code{upper}, @code{either} or
21207 @code{section} attributes. Possible values are @code{lower},
21208 @code{upper}, @code{either} or @code{any}. The first three behave
21209 like the corresponding attribute. The fourth possible value -
21210 @code{any} - is the default. It leaves placement entirely up to the
21211 linker script and how it assigns the standard sections
21212 (@code{.text}, @code{.data}, etc) to the memory regions.
21214 @item -msilicon-errata=
21215 @opindex msilicon-errata
21216 This option passes on a request to assembler to enable the fixes for
21217 the named silicon errata.
21219 @item -msilicon-errata-warn=
21220 @opindex msilicon-errata-warn
21221 This option passes on a request to the assembler to enable warning
21222 messages when a silicon errata might need to be applied.
21226 @node NDS32 Options
21227 @subsection NDS32 Options
21228 @cindex NDS32 Options
21230 These options are defined for NDS32 implementations:
21235 @opindex mbig-endian
21236 Generate code in big-endian mode.
21238 @item -mlittle-endian
21239 @opindex mlittle-endian
21240 Generate code in little-endian mode.
21242 @item -mreduced-regs
21243 @opindex mreduced-regs
21244 Use reduced-set registers for register allocation.
21247 @opindex mfull-regs
21248 Use full-set registers for register allocation.
21252 Generate conditional move instructions.
21256 Do not generate conditional move instructions.
21260 Generate performance extension instructions.
21262 @item -mno-perf-ext
21263 @opindex mno-perf-ext
21264 Do not generate performance extension instructions.
21268 Generate v3 push25/pop25 instructions.
21271 @opindex mno-v3push
21272 Do not generate v3 push25/pop25 instructions.
21276 Generate 16-bit instructions.
21279 @opindex mno-16-bit
21280 Do not generate 16-bit instructions.
21282 @item -misr-vector-size=@var{num}
21283 @opindex misr-vector-size
21284 Specify the size of each interrupt vector, which must be 4 or 16.
21286 @item -mcache-block-size=@var{num}
21287 @opindex mcache-block-size
21288 Specify the size of each cache block,
21289 which must be a power of 2 between 4 and 512.
21291 @item -march=@var{arch}
21293 Specify the name of the target architecture.
21295 @item -mcmodel=@var{code-model}
21297 Set the code model to one of
21300 All the data and read-only data segments must be within 512KB addressing space.
21301 The text segment must be within 16MB addressing space.
21302 @item @samp{medium}
21303 The data segment must be within 512KB while the read-only data segment can be
21304 within 4GB addressing space. The text segment should be still within 16MB
21307 All the text and data segments can be within 4GB addressing space.
21311 @opindex mctor-dtor
21312 Enable constructor/destructor feature.
21316 Guide linker to relax instructions.
21320 @node Nios II Options
21321 @subsection Nios II Options
21322 @cindex Nios II options
21323 @cindex Altera Nios II options
21325 These are the options defined for the Altera Nios II processor.
21331 @cindex smaller data references
21332 Put global and static objects less than or equal to @var{num} bytes
21333 into the small data or BSS sections instead of the normal data or BSS
21334 sections. The default value of @var{num} is 8.
21336 @item -mgpopt=@var{option}
21341 Generate (do not generate) GP-relative accesses. The following
21342 @var{option} names are recognized:
21347 Do not generate GP-relative accesses.
21350 Generate GP-relative accesses for small data objects that are not
21351 external, weak, or uninitialized common symbols.
21352 Also use GP-relative addressing for objects that
21353 have been explicitly placed in a small data section via a @code{section}
21357 As for @samp{local}, but also generate GP-relative accesses for
21358 small data objects that are external, weak, or common. If you use this option,
21359 you must ensure that all parts of your program (including libraries) are
21360 compiled with the same @option{-G} setting.
21363 Generate GP-relative accesses for all data objects in the program. If you
21364 use this option, the entire data and BSS segments
21365 of your program must fit in 64K of memory and you must use an appropriate
21366 linker script to allocate them within the addressable range of the
21370 Generate GP-relative addresses for function pointers as well as data
21371 pointers. If you use this option, the entire text, data, and BSS segments
21372 of your program must fit in 64K of memory and you must use an appropriate
21373 linker script to allocate them within the addressable range of the
21378 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
21379 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
21381 The default is @option{-mgpopt} except when @option{-fpic} or
21382 @option{-fPIC} is specified to generate position-independent code.
21383 Note that the Nios II ABI does not permit GP-relative accesses from
21386 You may need to specify @option{-mno-gpopt} explicitly when building
21387 programs that include large amounts of small data, including large
21388 GOT data sections. In this case, the 16-bit offset for GP-relative
21389 addressing may not be large enough to allow access to the entire
21390 small data section.
21392 @item -mgprel-sec=@var{regexp}
21393 @opindex mgprel-sec
21394 This option specifies additional section names that can be accessed via
21395 GP-relative addressing. It is most useful in conjunction with
21396 @code{section} attributes on variable declarations
21397 (@pxref{Common Variable Attributes}) and a custom linker script.
21398 The @var{regexp} is a POSIX Extended Regular Expression.
21400 This option does not affect the behavior of the @option{-G} option, and
21401 and the specified sections are in addition to the standard @code{.sdata}
21402 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
21404 @item -mr0rel-sec=@var{regexp}
21405 @opindex mr0rel-sec
21406 This option specifies names of sections that can be accessed via a
21407 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
21408 of the 32-bit address space. It is most useful in conjunction with
21409 @code{section} attributes on variable declarations
21410 (@pxref{Common Variable Attributes}) and a custom linker script.
21411 The @var{regexp} is a POSIX Extended Regular Expression.
21413 In contrast to the use of GP-relative addressing for small data,
21414 zero-based addressing is never generated by default and there are no
21415 conventional section names used in standard linker scripts for sections
21416 in the low or high areas of memory.
21422 Generate little-endian (default) or big-endian (experimental) code,
21425 @item -march=@var{arch}
21427 This specifies the name of the target Nios II architecture. GCC uses this
21428 name to determine what kind of instructions it can emit when generating
21429 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
21431 The preprocessor macro @code{__nios2_arch__} is available to programs,
21432 with value 1 or 2, indicating the targeted ISA level.
21434 @item -mbypass-cache
21435 @itemx -mno-bypass-cache
21436 @opindex mno-bypass-cache
21437 @opindex mbypass-cache
21438 Force all load and store instructions to always bypass cache by
21439 using I/O variants of the instructions. The default is not to
21442 @item -mno-cache-volatile
21443 @itemx -mcache-volatile
21444 @opindex mcache-volatile
21445 @opindex mno-cache-volatile
21446 Volatile memory access bypass the cache using the I/O variants of
21447 the load and store instructions. The default is not to bypass the cache.
21449 @item -mno-fast-sw-div
21450 @itemx -mfast-sw-div
21451 @opindex mno-fast-sw-div
21452 @opindex mfast-sw-div
21453 Do not use table-based fast divide for small numbers. The default
21454 is to use the fast divide at @option{-O3} and above.
21458 @itemx -mno-hw-mulx
21462 @opindex mno-hw-mul
21464 @opindex mno-hw-mulx
21466 @opindex mno-hw-div
21468 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
21469 instructions by the compiler. The default is to emit @code{mul}
21470 and not emit @code{div} and @code{mulx}.
21476 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
21477 CDX (code density) instructions. Enabling these instructions also
21478 requires @option{-march=r2}. Since these instructions are optional
21479 extensions to the R2 architecture, the default is not to emit them.
21481 @item -mcustom-@var{insn}=@var{N}
21482 @itemx -mno-custom-@var{insn}
21483 @opindex mcustom-@var{insn}
21484 @opindex mno-custom-@var{insn}
21485 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
21486 custom instruction with encoding @var{N} when generating code that uses
21487 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
21488 instruction 253 for single-precision floating-point add operations instead
21489 of the default behavior of using a library call.
21491 The following values of @var{insn} are supported. Except as otherwise
21492 noted, floating-point operations are expected to be implemented with
21493 normal IEEE 754 semantics and correspond directly to the C operators or the
21494 equivalent GCC built-in functions (@pxref{Other Builtins}).
21496 Single-precision floating point:
21499 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
21500 Binary arithmetic operations.
21506 Unary absolute value.
21508 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
21509 Comparison operations.
21511 @item @samp{fmins}, @samp{fmaxs}
21512 Floating-point minimum and maximum. These instructions are only
21513 generated if @option{-ffinite-math-only} is specified.
21515 @item @samp{fsqrts}
21516 Unary square root operation.
21518 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
21519 Floating-point trigonometric and exponential functions. These instructions
21520 are only generated if @option{-funsafe-math-optimizations} is also specified.
21524 Double-precision floating point:
21527 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
21528 Binary arithmetic operations.
21534 Unary absolute value.
21536 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
21537 Comparison operations.
21539 @item @samp{fmind}, @samp{fmaxd}
21540 Double-precision minimum and maximum. These instructions are only
21541 generated if @option{-ffinite-math-only} is specified.
21543 @item @samp{fsqrtd}
21544 Unary square root operation.
21546 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
21547 Double-precision trigonometric and exponential functions. These instructions
21548 are only generated if @option{-funsafe-math-optimizations} is also specified.
21554 @item @samp{fextsd}
21555 Conversion from single precision to double precision.
21557 @item @samp{ftruncds}
21558 Conversion from double precision to single precision.
21560 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
21561 Conversion from floating point to signed or unsigned integer types, with
21562 truncation towards zero.
21565 Conversion from single-precision floating point to signed integer,
21566 rounding to the nearest integer and ties away from zero.
21567 This corresponds to the @code{__builtin_lroundf} function when
21568 @option{-fno-math-errno} is used.
21570 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
21571 Conversion from signed or unsigned integer types to floating-point types.
21575 In addition, all of the following transfer instructions for internal
21576 registers X and Y must be provided to use any of the double-precision
21577 floating-point instructions. Custom instructions taking two
21578 double-precision source operands expect the first operand in the
21579 64-bit register X. The other operand (or only operand of a unary
21580 operation) is given to the custom arithmetic instruction with the
21581 least significant half in source register @var{src1} and the most
21582 significant half in @var{src2}. A custom instruction that returns a
21583 double-precision result returns the most significant 32 bits in the
21584 destination register and the other half in 32-bit register Y.
21585 GCC automatically generates the necessary code sequences to write
21586 register X and/or read register Y when double-precision floating-point
21587 instructions are used.
21592 Write @var{src1} into the least significant half of X and @var{src2} into
21593 the most significant half of X.
21596 Write @var{src1} into Y.
21598 @item @samp{frdxhi}, @samp{frdxlo}
21599 Read the most or least (respectively) significant half of X and store it in
21603 Read the value of Y and store it into @var{dest}.
21606 Note that you can gain more local control over generation of Nios II custom
21607 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
21608 and @code{target("no-custom-@var{insn}")} function attributes
21609 (@pxref{Function Attributes})
21610 or pragmas (@pxref{Function Specific Option Pragmas}).
21612 @item -mcustom-fpu-cfg=@var{name}
21613 @opindex mcustom-fpu-cfg
21615 This option enables a predefined, named set of custom instruction encodings
21616 (see @option{-mcustom-@var{insn}} above).
21617 Currently, the following sets are defined:
21619 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
21620 @gccoptlist{-mcustom-fmuls=252 @gol
21621 -mcustom-fadds=253 @gol
21622 -mcustom-fsubs=254 @gol
21623 -fsingle-precision-constant}
21625 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
21626 @gccoptlist{-mcustom-fmuls=252 @gol
21627 -mcustom-fadds=253 @gol
21628 -mcustom-fsubs=254 @gol
21629 -mcustom-fdivs=255 @gol
21630 -fsingle-precision-constant}
21632 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
21633 @gccoptlist{-mcustom-floatus=243 @gol
21634 -mcustom-fixsi=244 @gol
21635 -mcustom-floatis=245 @gol
21636 -mcustom-fcmpgts=246 @gol
21637 -mcustom-fcmples=249 @gol
21638 -mcustom-fcmpeqs=250 @gol
21639 -mcustom-fcmpnes=251 @gol
21640 -mcustom-fmuls=252 @gol
21641 -mcustom-fadds=253 @gol
21642 -mcustom-fsubs=254 @gol
21643 -mcustom-fdivs=255 @gol
21644 -fsingle-precision-constant}
21646 Custom instruction assignments given by individual
21647 @option{-mcustom-@var{insn}=} options override those given by
21648 @option{-mcustom-fpu-cfg=}, regardless of the
21649 order of the options on the command line.
21651 Note that you can gain more local control over selection of a FPU
21652 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
21653 function attribute (@pxref{Function Attributes})
21654 or pragma (@pxref{Function Specific Option Pragmas}).
21658 These additional @samp{-m} options are available for the Altera Nios II
21659 ELF (bare-metal) target:
21665 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
21666 startup and termination code, and is typically used in conjunction with
21667 @option{-msys-crt0=} to specify the location of the alternate startup code
21668 provided by the HAL BSP.
21672 Link with a limited version of the C library, @option{-lsmallc}, rather than
21675 @item -msys-crt0=@var{startfile}
21677 @var{startfile} is the file name of the startfile (crt0) to use
21678 when linking. This option is only useful in conjunction with @option{-mhal}.
21680 @item -msys-lib=@var{systemlib}
21682 @var{systemlib} is the library name of the library that provides
21683 low-level system calls required by the C library,
21684 e.g. @code{read} and @code{write}.
21685 This option is typically used to link with a library provided by a HAL BSP.
21689 @node Nvidia PTX Options
21690 @subsection Nvidia PTX Options
21691 @cindex Nvidia PTX options
21692 @cindex nvptx options
21694 These options are defined for Nvidia PTX:
21702 Generate code for 32-bit or 64-bit ABI.
21705 @opindex mmainkernel
21706 Link in code for a __main kernel. This is for stand-alone instead of
21707 offloading execution.
21711 Apply partitioned execution optimizations. This is the default when any
21712 level of optimization is selected.
21715 @opindex msoft-stack
21716 Generate code that does not use @code{.local} memory
21717 directly for stack storage. Instead, a per-warp stack pointer is
21718 maintained explicitly. This enables variable-length stack allocation (with
21719 variable-length arrays or @code{alloca}), and when global memory is used for
21720 underlying storage, makes it possible to access automatic variables from other
21721 threads, or with atomic instructions. This code generation variant is used
21722 for OpenMP offloading, but the option is exposed on its own for the purpose
21723 of testing the compiler; to generate code suitable for linking into programs
21724 using OpenMP offloading, use option @option{-mgomp}.
21726 @item -muniform-simt
21727 @opindex muniform-simt
21728 Switch to code generation variant that allows to execute all threads in each
21729 warp, while maintaining memory state and side effects as if only one thread
21730 in each warp was active outside of OpenMP SIMD regions. All atomic operations
21731 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
21732 current lane index equals the master lane index), and the register being
21733 assigned is copied via a shuffle instruction from the master lane. Outside of
21734 SIMD regions lane 0 is the master; inside, each thread sees itself as the
21735 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
21736 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
21737 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
21738 with current lane index to compute the master lane index.
21742 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
21743 @option{-muniform-simt} options, and selects corresponding multilib variant.
21747 @node PDP-11 Options
21748 @subsection PDP-11 Options
21749 @cindex PDP-11 Options
21751 These options are defined for the PDP-11:
21756 Use hardware FPP floating point. This is the default. (FIS floating
21757 point on the PDP-11/40 is not supported.)
21760 @opindex msoft-float
21761 Do not use hardware floating point.
21765 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
21769 Return floating-point results in memory. This is the default.
21773 Generate code for a PDP-11/40.
21777 Generate code for a PDP-11/45. This is the default.
21781 Generate code for a PDP-11/10.
21783 @item -mbcopy-builtin
21784 @opindex mbcopy-builtin
21785 Use inline @code{movmemhi} patterns for copying memory. This is the
21790 Do not use inline @code{movmemhi} patterns for copying memory.
21796 Use 16-bit @code{int}. This is the default.
21802 Use 32-bit @code{int}.
21805 @itemx -mno-float32
21807 @opindex mno-float32
21808 Use 64-bit @code{float}. This is the default.
21811 @itemx -mno-float64
21813 @opindex mno-float64
21814 Use 32-bit @code{float}.
21818 Use @code{abshi2} pattern. This is the default.
21822 Do not use @code{abshi2} pattern.
21824 @item -mbranch-expensive
21825 @opindex mbranch-expensive
21826 Pretend that branches are expensive. This is for experimenting with
21827 code generation only.
21829 @item -mbranch-cheap
21830 @opindex mbranch-cheap
21831 Do not pretend that branches are expensive. This is the default.
21835 Use Unix assembler syntax. This is the default when configured for
21836 @samp{pdp11-*-bsd}.
21840 Use DEC assembler syntax. This is the default when configured for any
21841 PDP-11 target other than @samp{pdp11-*-bsd}.
21844 @node picoChip Options
21845 @subsection picoChip Options
21846 @cindex picoChip options
21848 These @samp{-m} options are defined for picoChip implementations:
21852 @item -mae=@var{ae_type}
21854 Set the instruction set, register set, and instruction scheduling
21855 parameters for array element type @var{ae_type}. Supported values
21856 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
21858 @option{-mae=ANY} selects a completely generic AE type. Code
21859 generated with this option runs on any of the other AE types. The
21860 code is not as efficient as it would be if compiled for a specific
21861 AE type, and some types of operation (e.g., multiplication) do not
21862 work properly on all types of AE.
21864 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
21865 for compiled code, and is the default.
21867 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
21868 option may suffer from poor performance of byte (char) manipulation,
21869 since the DSP AE does not provide hardware support for byte load/stores.
21871 @item -msymbol-as-address
21872 Enable the compiler to directly use a symbol name as an address in a
21873 load/store instruction, without first loading it into a
21874 register. Typically, the use of this option generates larger
21875 programs, which run faster than when the option isn't used. However, the
21876 results vary from program to program, so it is left as a user option,
21877 rather than being permanently enabled.
21879 @item -mno-inefficient-warnings
21880 Disables warnings about the generation of inefficient code. These
21881 warnings can be generated, for example, when compiling code that
21882 performs byte-level memory operations on the MAC AE type. The MAC AE has
21883 no hardware support for byte-level memory operations, so all byte
21884 load/stores must be synthesized from word load/store operations. This is
21885 inefficient and a warning is generated to indicate
21886 that you should rewrite the code to avoid byte operations, or to target
21887 an AE type that has the necessary hardware support. This option disables
21892 @node PowerPC Options
21893 @subsection PowerPC Options
21894 @cindex PowerPC options
21896 These are listed under @xref{RS/6000 and PowerPC Options}.
21898 @node RISC-V Options
21899 @subsection RISC-V Options
21900 @cindex RISC-V Options
21902 These command-line options are defined for RISC-V targets:
21905 @item -mbranch-cost=@var{n}
21906 @opindex mbranch-cost
21907 Set the cost of branches to roughly @var{n} instructions.
21912 When generating PIC code, do or don't allow the use of PLTs. Ignored for
21913 non-PIC. The default is @option{-mplt}.
21915 @item -mabi=@var{ABI-string}
21917 Specify integer and floating-point calling convention. @var{ABI-string}
21918 contains two parts: the size of integer types and the registers used for
21919 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
21920 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
21921 32-bit), and that floating-point values up to 64 bits wide are passed in F
21922 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
21923 allows the compiler to generate code that uses the F and D extensions but only
21924 allows floating-point values up to 32 bits long to be passed in registers; or
21925 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
21926 passed in registers.
21928 The default for this argument is system dependent, users who want a specific
21929 calling convention should specify one explicitly. The valid calling
21930 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
21931 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
21932 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
21933 invalid because the ABI requires 64-bit values be passed in F registers, but F
21934 registers are only 32 bits wide.
21939 Do or don't use hardware floating-point divide and square root instructions.
21940 This requires the F or D extensions for floating-point registers. The default
21941 is to use them if the specified architecture has these instructions.
21946 Do or don't use hardware instructions for integer division. This requires the
21947 M extension. The default is to use them if the specified architecture has
21948 these instructions.
21950 @item -march=@var{ISA-string}
21952 Generate code for given RISC-V ISA (e.g.@ @samp{rv64im}). ISA strings must be
21953 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, and @samp{rv32imaf}.
21955 @item -mtune=@var{processor-string}
21957 Optimize the output for the given processor, specified by microarchitecture
21960 @item -msmall-data-limit=@var{n}
21961 @opindex msmall-data-limit
21962 Put global and static data smaller than @var{n} bytes into a special section
21965 @item -msave-restore
21966 @itemx -mno-save-restore
21967 @opindex msave-restore
21968 Do or don't use smaller but slower prologue and epilogue code that uses
21969 library function calls. The default is to use fast inline prologues and
21972 @item -mstrict-align
21973 @itemx -mno-strict-align
21974 @opindex mstrict-align
21975 Do not or do generate unaligned memory accesses. The default is set depending
21976 on whether the processor we are optimizing for supports fast unaligned access
21979 @item -mcmodel=medlow
21980 @opindex mcmodel=medlow
21981 Generate code for the medium-low code model. The program and its statically
21982 defined symbols must lie within a single 2 GiB address range and must lie
21983 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
21984 statically or dynamically linked. This is the default code model.
21986 @item -mcmodel=medany
21987 @opindex mcmodel=medany
21988 Generate code for the medium-any code model. The program and its statically
21989 defined symbols must be within any single 2 GiB address range. Programs can be
21990 statically or dynamically linked.
21992 @item -mexplicit-relocs
21993 @itemx -mno-exlicit-relocs
21994 Use or do not use assembler relocation operators when dealing with symbolic
21995 addresses. The alternative is to use assembler macros instead, which may
21996 limit optimization.
22001 @subsection RL78 Options
22002 @cindex RL78 Options
22008 Links in additional target libraries to support operation within a
22017 Specifies the type of hardware multiplication and division support to
22018 be used. The simplest is @code{none}, which uses software for both
22019 multiplication and division. This is the default. The @code{g13}
22020 value is for the hardware multiply/divide peripheral found on the
22021 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
22022 the multiplication and division instructions supported by the RL78/G14
22023 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
22024 the value @code{mg10} is an alias for @code{none}.
22026 In addition a C preprocessor macro is defined, based upon the setting
22027 of this option. Possible values are: @code{__RL78_MUL_NONE__},
22028 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
22035 Specifies the RL78 core to target. The default is the G14 core, also
22036 known as an S3 core or just RL78. The G13 or S2 core does not have
22037 multiply or divide instructions, instead it uses a hardware peripheral
22038 for these operations. The G10 or S1 core does not have register
22039 banks, so it uses a different calling convention.
22041 If this option is set it also selects the type of hardware multiply
22042 support to use, unless this is overridden by an explicit
22043 @option{-mmul=none} option on the command line. Thus specifying
22044 @option{-mcpu=g13} enables the use of the G13 hardware multiply
22045 peripheral and specifying @option{-mcpu=g10} disables the use of
22046 hardware multiplications altogether.
22048 Note, although the RL78/G14 core is the default target, specifying
22049 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
22050 change the behavior of the toolchain since it also enables G14
22051 hardware multiply support. If these options are not specified on the
22052 command line then software multiplication routines will be used even
22053 though the code targets the RL78 core. This is for backwards
22054 compatibility with older toolchains which did not have hardware
22055 multiply and divide support.
22057 In addition a C preprocessor macro is defined, based upon the setting
22058 of this option. Possible values are: @code{__RL78_G10__},
22059 @code{__RL78_G13__} or @code{__RL78_G14__}.
22069 These are aliases for the corresponding @option{-mcpu=} option. They
22070 are provided for backwards compatibility.
22074 Allow the compiler to use all of the available registers. By default
22075 registers @code{r24..r31} are reserved for use in interrupt handlers.
22076 With this option enabled these registers can be used in ordinary
22079 @item -m64bit-doubles
22080 @itemx -m32bit-doubles
22081 @opindex m64bit-doubles
22082 @opindex m32bit-doubles
22083 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
22084 or 32 bits (@option{-m32bit-doubles}) in size. The default is
22085 @option{-m32bit-doubles}.
22087 @item -msave-mduc-in-interrupts
22088 @item -mno-save-mduc-in-interrupts
22089 @opindex msave-mduc-in-interrupts
22090 @opindex mno-save-mduc-in-interrupts
22091 Specifies that interrupt handler functions should preserve the
22092 MDUC registers. This is only necessary if normal code might use
22093 the MDUC registers, for example because it performs multiplication
22094 and division operations. The default is to ignore the MDUC registers
22095 as this makes the interrupt handlers faster. The target option -mg13
22096 needs to be passed for this to work as this feature is only available
22097 on the G13 target (S2 core). The MDUC registers will only be saved
22098 if the interrupt handler performs a multiplication or division
22099 operation or it calls another function.
22103 @node RS/6000 and PowerPC Options
22104 @subsection IBM RS/6000 and PowerPC Options
22105 @cindex RS/6000 and PowerPC Options
22106 @cindex IBM RS/6000 and PowerPC Options
22108 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
22110 @item -mpowerpc-gpopt
22111 @itemx -mno-powerpc-gpopt
22112 @itemx -mpowerpc-gfxopt
22113 @itemx -mno-powerpc-gfxopt
22116 @itemx -mno-powerpc64
22120 @itemx -mno-popcntb
22122 @itemx -mno-popcntd
22131 @itemx -mno-hard-dfp
22132 @opindex mpowerpc-gpopt
22133 @opindex mno-powerpc-gpopt
22134 @opindex mpowerpc-gfxopt
22135 @opindex mno-powerpc-gfxopt
22136 @opindex mpowerpc64
22137 @opindex mno-powerpc64
22141 @opindex mno-popcntb
22143 @opindex mno-popcntd
22149 @opindex mno-mfpgpr
22151 @opindex mno-hard-dfp
22152 You use these options to specify which instructions are available on the
22153 processor you are using. The default value of these options is
22154 determined when configuring GCC@. Specifying the
22155 @option{-mcpu=@var{cpu_type}} overrides the specification of these
22156 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
22157 rather than the options listed above.
22159 Specifying @option{-mpowerpc-gpopt} allows
22160 GCC to use the optional PowerPC architecture instructions in the
22161 General Purpose group, including floating-point square root. Specifying
22162 @option{-mpowerpc-gfxopt} allows GCC to
22163 use the optional PowerPC architecture instructions in the Graphics
22164 group, including floating-point select.
22166 The @option{-mmfcrf} option allows GCC to generate the move from
22167 condition register field instruction implemented on the POWER4
22168 processor and other processors that support the PowerPC V2.01
22170 The @option{-mpopcntb} option allows GCC to generate the popcount and
22171 double-precision FP reciprocal estimate instruction implemented on the
22172 POWER5 processor and other processors that support the PowerPC V2.02
22174 The @option{-mpopcntd} option allows GCC to generate the popcount
22175 instruction implemented on the POWER7 processor and other processors
22176 that support the PowerPC V2.06 architecture.
22177 The @option{-mfprnd} option allows GCC to generate the FP round to
22178 integer instructions implemented on the POWER5+ processor and other
22179 processors that support the PowerPC V2.03 architecture.
22180 The @option{-mcmpb} option allows GCC to generate the compare bytes
22181 instruction implemented on the POWER6 processor and other processors
22182 that support the PowerPC V2.05 architecture.
22183 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
22184 general-purpose register instructions implemented on the POWER6X
22185 processor and other processors that support the extended PowerPC V2.05
22187 The @option{-mhard-dfp} option allows GCC to generate the decimal
22188 floating-point instructions implemented on some POWER processors.
22190 The @option{-mpowerpc64} option allows GCC to generate the additional
22191 64-bit instructions that are found in the full PowerPC64 architecture
22192 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
22193 @option{-mno-powerpc64}.
22195 @item -mcpu=@var{cpu_type}
22197 Set architecture type, register usage, and
22198 instruction scheduling parameters for machine type @var{cpu_type}.
22199 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
22200 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
22201 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
22202 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
22203 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
22204 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
22205 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
22206 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
22207 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
22208 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
22209 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
22212 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
22213 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
22214 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
22215 architecture machine types, with an appropriate, generic processor
22216 model assumed for scheduling purposes.
22218 The other options specify a specific processor. Code generated under
22219 those options runs best on that processor, and may not run at all on
22222 The @option{-mcpu} options automatically enable or disable the
22225 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
22226 -mpopcntb -mpopcntd -mpowerpc64 @gol
22227 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
22228 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
22229 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
22230 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
22232 The particular options set for any particular CPU varies between
22233 compiler versions, depending on what setting seems to produce optimal
22234 code for that CPU; it doesn't necessarily reflect the actual hardware's
22235 capabilities. If you wish to set an individual option to a particular
22236 value, you may specify it after the @option{-mcpu} option, like
22237 @option{-mcpu=970 -mno-altivec}.
22239 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
22240 not enabled or disabled by the @option{-mcpu} option at present because
22241 AIX does not have full support for these options. You may still
22242 enable or disable them individually if you're sure it'll work in your
22245 @item -mtune=@var{cpu_type}
22247 Set the instruction scheduling parameters for machine type
22248 @var{cpu_type}, but do not set the architecture type or register usage,
22249 as @option{-mcpu=@var{cpu_type}} does. The same
22250 values for @var{cpu_type} are used for @option{-mtune} as for
22251 @option{-mcpu}. If both are specified, the code generated uses the
22252 architecture and registers set by @option{-mcpu}, but the
22253 scheduling parameters set by @option{-mtune}.
22255 @item -mcmodel=small
22256 @opindex mcmodel=small
22257 Generate PowerPC64 code for the small model: The TOC is limited to
22260 @item -mcmodel=medium
22261 @opindex mcmodel=medium
22262 Generate PowerPC64 code for the medium model: The TOC and other static
22263 data may be up to a total of 4G in size. This is the default for 64-bit
22266 @item -mcmodel=large
22267 @opindex mcmodel=large
22268 Generate PowerPC64 code for the large model: The TOC may be up to 4G
22269 in size. Other data and code is only limited by the 64-bit address
22273 @itemx -mno-altivec
22275 @opindex mno-altivec
22276 Generate code that uses (does not use) AltiVec instructions, and also
22277 enable the use of built-in functions that allow more direct access to
22278 the AltiVec instruction set. You may also need to set
22279 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
22282 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
22283 @option{-maltivec=be}, the element order for AltiVec intrinsics such
22284 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
22285 match array element order corresponding to the endianness of the
22286 target. That is, element zero identifies the leftmost element in a
22287 vector register when targeting a big-endian platform, and identifies
22288 the rightmost element in a vector register when targeting a
22289 little-endian platform.
22292 @opindex maltivec=be
22293 Generate AltiVec instructions using big-endian element order,
22294 regardless of whether the target is big- or little-endian. This is
22295 the default when targeting a big-endian platform.
22297 The element order is used to interpret element numbers in AltiVec
22298 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
22299 @code{vec_insert}. By default, these match array element order
22300 corresponding to the endianness for the target.
22303 @opindex maltivec=le
22304 Generate AltiVec instructions using little-endian element order,
22305 regardless of whether the target is big- or little-endian. This is
22306 the default when targeting a little-endian platform. This option is
22307 currently ignored when targeting a big-endian platform.
22309 The element order is used to interpret element numbers in AltiVec
22310 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
22311 @code{vec_insert}. By default, these match array element order
22312 corresponding to the endianness for the target.
22317 @opindex mno-vrsave
22318 Generate VRSAVE instructions when generating AltiVec code.
22321 @opindex msecure-plt
22322 Generate code that allows @command{ld} and @command{ld.so}
22323 to build executables and shared
22324 libraries with non-executable @code{.plt} and @code{.got} sections.
22326 32-bit SYSV ABI option.
22330 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
22332 requires @code{.plt} and @code{.got}
22333 sections that are both writable and executable.
22334 This is a PowerPC 32-bit SYSV ABI option.
22340 This switch enables or disables the generation of ISEL instructions.
22342 @item -misel=@var{yes/no}
22343 This switch has been deprecated. Use @option{-misel} and
22344 @option{-mno-isel} instead.
22350 This switch enables or disables the generation of SPE simd
22356 @opindex mno-paired
22357 This switch enables or disables the generation of PAIRED simd
22360 @item -mspe=@var{yes/no}
22361 This option has been deprecated. Use @option{-mspe} and
22362 @option{-mno-spe} instead.
22368 Generate code that uses (does not use) vector/scalar (VSX)
22369 instructions, and also enable the use of built-in functions that allow
22370 more direct access to the VSX instruction set.
22375 @opindex mno-crypto
22376 Enable the use (disable) of the built-in functions that allow direct
22377 access to the cryptographic instructions that were added in version
22378 2.07 of the PowerPC ISA.
22380 @item -mdirect-move
22381 @itemx -mno-direct-move
22382 @opindex mdirect-move
22383 @opindex mno-direct-move
22384 Generate code that uses (does not use) the instructions to move data
22385 between the general purpose registers and the vector/scalar (VSX)
22386 registers that were added in version 2.07 of the PowerPC ISA.
22392 Enable (disable) the use of the built-in functions that allow direct
22393 access to the Hardware Transactional Memory (HTM) instructions that
22394 were added in version 2.07 of the PowerPC ISA.
22396 @item -mpower8-fusion
22397 @itemx -mno-power8-fusion
22398 @opindex mpower8-fusion
22399 @opindex mno-power8-fusion
22400 Generate code that keeps (does not keeps) some integer operations
22401 adjacent so that the instructions can be fused together on power8 and
22404 @item -mpower8-vector
22405 @itemx -mno-power8-vector
22406 @opindex mpower8-vector
22407 @opindex mno-power8-vector
22408 Generate code that uses (does not use) the vector and scalar
22409 instructions that were added in version 2.07 of the PowerPC ISA. Also
22410 enable the use of built-in functions that allow more direct access to
22411 the vector instructions.
22413 @item -mquad-memory
22414 @itemx -mno-quad-memory
22415 @opindex mquad-memory
22416 @opindex mno-quad-memory
22417 Generate code that uses (does not use) the non-atomic quad word memory
22418 instructions. The @option{-mquad-memory} option requires use of
22421 @item -mquad-memory-atomic
22422 @itemx -mno-quad-memory-atomic
22423 @opindex mquad-memory-atomic
22424 @opindex mno-quad-memory-atomic
22425 Generate code that uses (does not use) the atomic quad word memory
22426 instructions. The @option{-mquad-memory-atomic} option requires use of
22430 @itemx -mno-float128
22432 @opindex mno-float128
22433 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
22434 and use either software emulation for IEEE 128-bit floating point or
22435 hardware instructions.
22437 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
22438 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
22439 use the IEEE 128-bit floating point support. The IEEE 128-bit
22440 floating point support only works on PowerPC Linux systems.
22442 The default for @option{-mfloat128} is enabled on PowerPC Linux
22443 systems using the VSX instruction set, and disabled on other systems.
22445 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
22446 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
22447 point support will also enable the generation of ISA 3.0 IEEE 128-bit
22448 floating point instructions. Otherwise, if you do not specify to
22449 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
22450 system, IEEE 128-bit floating point will be done with software
22453 @item -mfloat128-hardware
22454 @itemx -mno-float128-hardware
22455 @opindex mfloat128-hardware
22456 @opindex mno-float128-hardware
22457 Enable/disable using ISA 3.0 hardware instructions to support the
22458 @var{__float128} data type.
22460 The default for @option{-mfloat128-hardware} is enabled on PowerPC
22461 Linux systems using the ISA 3.0 instruction set, and disabled on other
22464 @item -mfloat-gprs=@var{yes/single/double/no}
22465 @itemx -mfloat-gprs
22466 @opindex mfloat-gprs
22467 This switch enables or disables the generation of floating-point
22468 operations on the general-purpose registers for architectures that
22471 The argument @samp{yes} or @samp{single} enables the use of
22472 single-precision floating-point operations.
22474 The argument @samp{double} enables the use of single and
22475 double-precision floating-point operations.
22477 The argument @samp{no} disables floating-point operations on the
22478 general-purpose registers.
22480 This option is currently only available on the MPC854x.
22486 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
22487 targets (including GNU/Linux). The 32-bit environment sets int, long
22488 and pointer to 32 bits and generates code that runs on any PowerPC
22489 variant. The 64-bit environment sets int to 32 bits and long and
22490 pointer to 64 bits, and generates code for PowerPC64, as for
22491 @option{-mpowerpc64}.
22494 @itemx -mno-fp-in-toc
22495 @itemx -mno-sum-in-toc
22496 @itemx -mminimal-toc
22498 @opindex mno-fp-in-toc
22499 @opindex mno-sum-in-toc
22500 @opindex mminimal-toc
22501 Modify generation of the TOC (Table Of Contents), which is created for
22502 every executable file. The @option{-mfull-toc} option is selected by
22503 default. In that case, GCC allocates at least one TOC entry for
22504 each unique non-automatic variable reference in your program. GCC
22505 also places floating-point constants in the TOC@. However, only
22506 16,384 entries are available in the TOC@.
22508 If you receive a linker error message that saying you have overflowed
22509 the available TOC space, you can reduce the amount of TOC space used
22510 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
22511 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
22512 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
22513 generate code to calculate the sum of an address and a constant at
22514 run time instead of putting that sum into the TOC@. You may specify one
22515 or both of these options. Each causes GCC to produce very slightly
22516 slower and larger code at the expense of conserving TOC space.
22518 If you still run out of space in the TOC even when you specify both of
22519 these options, specify @option{-mminimal-toc} instead. This option causes
22520 GCC to make only one TOC entry for every file. When you specify this
22521 option, GCC produces code that is slower and larger but which
22522 uses extremely little TOC space. You may wish to use this option
22523 only on files that contain less frequently-executed code.
22529 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
22530 @code{long} type, and the infrastructure needed to support them.
22531 Specifying @option{-maix64} implies @option{-mpowerpc64},
22532 while @option{-maix32} disables the 64-bit ABI and
22533 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
22536 @itemx -mno-xl-compat
22537 @opindex mxl-compat
22538 @opindex mno-xl-compat
22539 Produce code that conforms more closely to IBM XL compiler semantics
22540 when using AIX-compatible ABI@. Pass floating-point arguments to
22541 prototyped functions beyond the register save area (RSA) on the stack
22542 in addition to argument FPRs. Do not assume that most significant
22543 double in 128-bit long double value is properly rounded when comparing
22544 values and converting to double. Use XL symbol names for long double
22547 The AIX calling convention was extended but not initially documented to
22548 handle an obscure K&R C case of calling a function that takes the
22549 address of its arguments with fewer arguments than declared. IBM XL
22550 compilers access floating-point arguments that do not fit in the
22551 RSA from the stack when a subroutine is compiled without
22552 optimization. Because always storing floating-point arguments on the
22553 stack is inefficient and rarely needed, this option is not enabled by
22554 default and only is necessary when calling subroutines compiled by IBM
22555 XL compilers without optimization.
22559 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
22560 application written to use message passing with special startup code to
22561 enable the application to run. The system must have PE installed in the
22562 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
22563 must be overridden with the @option{-specs=} option to specify the
22564 appropriate directory location. The Parallel Environment does not
22565 support threads, so the @option{-mpe} option and the @option{-pthread}
22566 option are incompatible.
22568 @item -malign-natural
22569 @itemx -malign-power
22570 @opindex malign-natural
22571 @opindex malign-power
22572 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22573 @option{-malign-natural} overrides the ABI-defined alignment of larger
22574 types, such as floating-point doubles, on their natural size-based boundary.
22575 The option @option{-malign-power} instructs GCC to follow the ABI-specified
22576 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
22578 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
22582 @itemx -mhard-float
22583 @opindex msoft-float
22584 @opindex mhard-float
22585 Generate code that does not use (uses) the floating-point register set.
22586 Software floating-point emulation is provided if you use the
22587 @option{-msoft-float} option, and pass the option to GCC when linking.
22589 @item -msingle-float
22590 @itemx -mdouble-float
22591 @opindex msingle-float
22592 @opindex mdouble-float
22593 Generate code for single- or double-precision floating-point operations.
22594 @option{-mdouble-float} implies @option{-msingle-float}.
22597 @opindex msimple-fpu
22598 Do not generate @code{sqrt} and @code{div} instructions for hardware
22599 floating-point unit.
22601 @item -mfpu=@var{name}
22603 Specify type of floating-point unit. Valid values for @var{name} are
22604 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
22605 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
22606 @samp{sp_full} (equivalent to @option{-msingle-float}),
22607 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
22610 @opindex mxilinx-fpu
22611 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
22614 @itemx -mno-multiple
22616 @opindex mno-multiple
22617 Generate code that uses (does not use) the load multiple word
22618 instructions and the store multiple word instructions. These
22619 instructions are generated by default on POWER systems, and not
22620 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
22621 PowerPC systems, since those instructions do not work when the
22622 processor is in little-endian mode. The exceptions are PPC740 and
22623 PPC750 which permit these instructions in little-endian mode.
22628 @opindex mno-string
22629 Generate code that uses (does not use) the load string instructions
22630 and the store string word instructions to save multiple registers and
22631 do small block moves. These instructions are generated by default on
22632 POWER systems, and not generated on PowerPC systems. Do not use
22633 @option{-mstring} on little-endian PowerPC systems, since those
22634 instructions do not work when the processor is in little-endian mode.
22635 The exceptions are PPC740 and PPC750 which permit these instructions
22636 in little-endian mode.
22641 @opindex mno-update
22642 Generate code that uses (does not use) the load or store instructions
22643 that update the base register to the address of the calculated memory
22644 location. These instructions are generated by default. If you use
22645 @option{-mno-update}, there is a small window between the time that the
22646 stack pointer is updated and the address of the previous frame is
22647 stored, which means code that walks the stack frame across interrupts or
22648 signals may get corrupted data.
22650 @item -mavoid-indexed-addresses
22651 @itemx -mno-avoid-indexed-addresses
22652 @opindex mavoid-indexed-addresses
22653 @opindex mno-avoid-indexed-addresses
22654 Generate code that tries to avoid (not avoid) the use of indexed load
22655 or store instructions. These instructions can incur a performance
22656 penalty on Power6 processors in certain situations, such as when
22657 stepping through large arrays that cross a 16M boundary. This option
22658 is enabled by default when targeting Power6 and disabled otherwise.
22661 @itemx -mno-fused-madd
22662 @opindex mfused-madd
22663 @opindex mno-fused-madd
22664 Generate code that uses (does not use) the floating-point multiply and
22665 accumulate instructions. These instructions are generated by default
22666 if hardware floating point is used. The machine-dependent
22667 @option{-mfused-madd} option is now mapped to the machine-independent
22668 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22669 mapped to @option{-ffp-contract=off}.
22675 Generate code that uses (does not use) the half-word multiply and
22676 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
22677 These instructions are generated by default when targeting those
22684 Generate code that uses (does not use) the string-search @samp{dlmzb}
22685 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
22686 generated by default when targeting those processors.
22688 @item -mno-bit-align
22690 @opindex mno-bit-align
22691 @opindex mbit-align
22692 On System V.4 and embedded PowerPC systems do not (do) force structures
22693 and unions that contain bit-fields to be aligned to the base type of the
22696 For example, by default a structure containing nothing but 8
22697 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
22698 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
22699 the structure is aligned to a 1-byte boundary and is 1 byte in
22702 @item -mno-strict-align
22703 @itemx -mstrict-align
22704 @opindex mno-strict-align
22705 @opindex mstrict-align
22706 On System V.4 and embedded PowerPC systems do not (do) assume that
22707 unaligned memory references are handled by the system.
22709 @item -mrelocatable
22710 @itemx -mno-relocatable
22711 @opindex mrelocatable
22712 @opindex mno-relocatable
22713 Generate code that allows (does not allow) a static executable to be
22714 relocated to a different address at run time. A simple embedded
22715 PowerPC system loader should relocate the entire contents of
22716 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
22717 a table of 32-bit addresses generated by this option. For this to
22718 work, all objects linked together must be compiled with
22719 @option{-mrelocatable} or @option{-mrelocatable-lib}.
22720 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
22722 @item -mrelocatable-lib
22723 @itemx -mno-relocatable-lib
22724 @opindex mrelocatable-lib
22725 @opindex mno-relocatable-lib
22726 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
22727 @code{.fixup} section to allow static executables to be relocated at
22728 run time, but @option{-mrelocatable-lib} does not use the smaller stack
22729 alignment of @option{-mrelocatable}. Objects compiled with
22730 @option{-mrelocatable-lib} may be linked with objects compiled with
22731 any combination of the @option{-mrelocatable} options.
22737 On System V.4 and embedded PowerPC systems do not (do) assume that
22738 register 2 contains a pointer to a global area pointing to the addresses
22739 used in the program.
22742 @itemx -mlittle-endian
22744 @opindex mlittle-endian
22745 On System V.4 and embedded PowerPC systems compile code for the
22746 processor in little-endian mode. The @option{-mlittle-endian} option is
22747 the same as @option{-mlittle}.
22750 @itemx -mbig-endian
22752 @opindex mbig-endian
22753 On System V.4 and embedded PowerPC systems compile code for the
22754 processor in big-endian mode. The @option{-mbig-endian} option is
22755 the same as @option{-mbig}.
22757 @item -mdynamic-no-pic
22758 @opindex mdynamic-no-pic
22759 On Darwin and Mac OS X systems, compile code so that it is not
22760 relocatable, but that its external references are relocatable. The
22761 resulting code is suitable for applications, but not shared
22764 @item -msingle-pic-base
22765 @opindex msingle-pic-base
22766 Treat the register used for PIC addressing as read-only, rather than
22767 loading it in the prologue for each function. The runtime system is
22768 responsible for initializing this register with an appropriate value
22769 before execution begins.
22771 @item -mprioritize-restricted-insns=@var{priority}
22772 @opindex mprioritize-restricted-insns
22773 This option controls the priority that is assigned to
22774 dispatch-slot restricted instructions during the second scheduling
22775 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
22776 or @samp{2} to assign no, highest, or second-highest (respectively)
22777 priority to dispatch-slot restricted
22780 @item -msched-costly-dep=@var{dependence_type}
22781 @opindex msched-costly-dep
22782 This option controls which dependences are considered costly
22783 by the target during instruction scheduling. The argument
22784 @var{dependence_type} takes one of the following values:
22788 No dependence is costly.
22791 All dependences are costly.
22793 @item @samp{true_store_to_load}
22794 A true dependence from store to load is costly.
22796 @item @samp{store_to_load}
22797 Any dependence from store to load is costly.
22800 Any dependence for which the latency is greater than or equal to
22801 @var{number} is costly.
22804 @item -minsert-sched-nops=@var{scheme}
22805 @opindex minsert-sched-nops
22806 This option controls which NOP insertion scheme is used during
22807 the second scheduling pass. The argument @var{scheme} takes one of the
22815 Pad with NOPs any dispatch group that has vacant issue slots,
22816 according to the scheduler's grouping.
22818 @item @samp{regroup_exact}
22819 Insert NOPs to force costly dependent insns into
22820 separate groups. Insert exactly as many NOPs as needed to force an insn
22821 to a new group, according to the estimated processor grouping.
22824 Insert NOPs to force costly dependent insns into
22825 separate groups. Insert @var{number} NOPs to force an insn to a new group.
22829 @opindex mcall-sysv
22830 On System V.4 and embedded PowerPC systems compile code using calling
22831 conventions that adhere to the March 1995 draft of the System V
22832 Application Binary Interface, PowerPC processor supplement. This is the
22833 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
22835 @item -mcall-sysv-eabi
22837 @opindex mcall-sysv-eabi
22838 @opindex mcall-eabi
22839 Specify both @option{-mcall-sysv} and @option{-meabi} options.
22841 @item -mcall-sysv-noeabi
22842 @opindex mcall-sysv-noeabi
22843 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
22845 @item -mcall-aixdesc
22847 On System V.4 and embedded PowerPC systems compile code for the AIX
22851 @opindex mcall-linux
22852 On System V.4 and embedded PowerPC systems compile code for the
22853 Linux-based GNU system.
22855 @item -mcall-freebsd
22856 @opindex mcall-freebsd
22857 On System V.4 and embedded PowerPC systems compile code for the
22858 FreeBSD operating system.
22860 @item -mcall-netbsd
22861 @opindex mcall-netbsd
22862 On System V.4 and embedded PowerPC systems compile code for the
22863 NetBSD operating system.
22865 @item -mcall-openbsd
22866 @opindex mcall-netbsd
22867 On System V.4 and embedded PowerPC systems compile code for the
22868 OpenBSD operating system.
22870 @item -maix-struct-return
22871 @opindex maix-struct-return
22872 Return all structures in memory (as specified by the AIX ABI)@.
22874 @item -msvr4-struct-return
22875 @opindex msvr4-struct-return
22876 Return structures smaller than 8 bytes in registers (as specified by the
22879 @item -mabi=@var{abi-type}
22881 Extend the current ABI with a particular extension, or remove such extension.
22882 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
22883 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
22884 @samp{elfv1}, @samp{elfv2}@.
22888 Extend the current ABI with SPE ABI extensions. This does not change
22889 the default ABI, instead it adds the SPE ABI extensions to the current
22893 @opindex mabi=no-spe
22894 Disable Book-E SPE ABI extensions for the current ABI@.
22896 @item -mabi=ibmlongdouble
22897 @opindex mabi=ibmlongdouble
22898 Change the current ABI to use IBM extended-precision long double.
22899 This is not likely to work if your system defaults to using IEEE
22900 extended-precision long double. If you change the long double type
22901 from IEEE extended-precision, the compiler will issue a warning unless
22902 you use the @option{-Wno-psabi} option.
22904 @item -mabi=ieeelongdouble
22905 @opindex mabi=ieeelongdouble
22906 Change the current ABI to use IEEE extended-precision long double.
22907 This is not likely to work if your system defaults to using IBM
22908 extended-precision long double. If you change the long double type
22909 from IBM extended-precision, the compiler will issue a warning unless
22910 you use the @option{-Wno-psabi} option.
22913 @opindex mabi=elfv1
22914 Change the current ABI to use the ELFv1 ABI.
22915 This is the default ABI for big-endian PowerPC 64-bit Linux.
22916 Overriding the default ABI requires special system support and is
22917 likely to fail in spectacular ways.
22920 @opindex mabi=elfv2
22921 Change the current ABI to use the ELFv2 ABI.
22922 This is the default ABI for little-endian PowerPC 64-bit Linux.
22923 Overriding the default ABI requires special system support and is
22924 likely to fail in spectacular ways.
22926 @item -mgnu-attribute
22927 @itemx -mno-gnu-attribute
22928 @opindex mgnu-attribute
22929 @opindex mno-gnu-attribute
22930 Emit .gnu_attribute assembly directives to set tag/value pairs in a
22931 .gnu.attributes section that specify ABI variations in function
22932 parameters or return values.
22935 @itemx -mno-prototype
22936 @opindex mprototype
22937 @opindex mno-prototype
22938 On System V.4 and embedded PowerPC systems assume that all calls to
22939 variable argument functions are properly prototyped. Otherwise, the
22940 compiler must insert an instruction before every non-prototyped call to
22941 set or clear bit 6 of the condition code register (@code{CR}) to
22942 indicate whether floating-point values are passed in the floating-point
22943 registers in case the function takes variable arguments. With
22944 @option{-mprototype}, only calls to prototyped variable argument functions
22945 set or clear the bit.
22949 On embedded PowerPC systems, assume that the startup module is called
22950 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
22951 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
22956 On embedded PowerPC systems, assume that the startup module is called
22957 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
22962 On embedded PowerPC systems, assume that the startup module is called
22963 @file{crt0.o} and the standard C libraries are @file{libads.a} and
22966 @item -myellowknife
22967 @opindex myellowknife
22968 On embedded PowerPC systems, assume that the startup module is called
22969 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
22974 On System V.4 and embedded PowerPC systems, specify that you are
22975 compiling for a VxWorks system.
22979 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
22980 header to indicate that @samp{eabi} extended relocations are used.
22986 On System V.4 and embedded PowerPC systems do (do not) adhere to the
22987 Embedded Applications Binary Interface (EABI), which is a set of
22988 modifications to the System V.4 specifications. Selecting @option{-meabi}
22989 means that the stack is aligned to an 8-byte boundary, a function
22990 @code{__eabi} is called from @code{main} to set up the EABI
22991 environment, and the @option{-msdata} option can use both @code{r2} and
22992 @code{r13} to point to two separate small data areas. Selecting
22993 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
22994 no EABI initialization function is called from @code{main}, and the
22995 @option{-msdata} option only uses @code{r13} to point to a single
22996 small data area. The @option{-meabi} option is on by default if you
22997 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
23000 @opindex msdata=eabi
23001 On System V.4 and embedded PowerPC systems, put small initialized
23002 @code{const} global and static data in the @code{.sdata2} section, which
23003 is pointed to by register @code{r2}. Put small initialized
23004 non-@code{const} global and static data in the @code{.sdata} section,
23005 which is pointed to by register @code{r13}. Put small uninitialized
23006 global and static data in the @code{.sbss} section, which is adjacent to
23007 the @code{.sdata} section. The @option{-msdata=eabi} option is
23008 incompatible with the @option{-mrelocatable} option. The
23009 @option{-msdata=eabi} option also sets the @option{-memb} option.
23012 @opindex msdata=sysv
23013 On System V.4 and embedded PowerPC systems, put small global and static
23014 data in the @code{.sdata} section, which is pointed to by register
23015 @code{r13}. Put small uninitialized global and static data in the
23016 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
23017 The @option{-msdata=sysv} option is incompatible with the
23018 @option{-mrelocatable} option.
23020 @item -msdata=default
23022 @opindex msdata=default
23024 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
23025 compile code the same as @option{-msdata=eabi}, otherwise compile code the
23026 same as @option{-msdata=sysv}.
23029 @opindex msdata=data
23030 On System V.4 and embedded PowerPC systems, put small global
23031 data in the @code{.sdata} section. Put small uninitialized global
23032 data in the @code{.sbss} section. Do not use register @code{r13}
23033 to address small data however. This is the default behavior unless
23034 other @option{-msdata} options are used.
23038 @opindex msdata=none
23040 On embedded PowerPC systems, put all initialized global and static data
23041 in the @code{.data} section, and all uninitialized data in the
23042 @code{.bss} section.
23044 @item -mblock-move-inline-limit=@var{num}
23045 @opindex mblock-move-inline-limit
23046 Inline all block moves (such as calls to @code{memcpy} or structure
23047 copies) less than or equal to @var{num} bytes. The minimum value for
23048 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
23049 targets. The default value is target-specific.
23053 @cindex smaller data references (PowerPC)
23054 @cindex .sdata/.sdata2 references (PowerPC)
23055 On embedded PowerPC systems, put global and static items less than or
23056 equal to @var{num} bytes into the small data or BSS sections instead of
23057 the normal data or BSS section. By default, @var{num} is 8. The
23058 @option{-G @var{num}} switch is also passed to the linker.
23059 All modules should be compiled with the same @option{-G @var{num}} value.
23062 @itemx -mno-regnames
23064 @opindex mno-regnames
23065 On System V.4 and embedded PowerPC systems do (do not) emit register
23066 names in the assembly language output using symbolic forms.
23069 @itemx -mno-longcall
23071 @opindex mno-longcall
23072 By default assume that all calls are far away so that a longer and more
23073 expensive calling sequence is required. This is required for calls
23074 farther than 32 megabytes (33,554,432 bytes) from the current location.
23075 A short call is generated if the compiler knows
23076 the call cannot be that far away. This setting can be overridden by
23077 the @code{shortcall} function attribute, or by @code{#pragma
23080 Some linkers are capable of detecting out-of-range calls and generating
23081 glue code on the fly. On these systems, long calls are unnecessary and
23082 generate slower code. As of this writing, the AIX linker can do this,
23083 as can the GNU linker for PowerPC/64. It is planned to add this feature
23084 to the GNU linker for 32-bit PowerPC systems as well.
23086 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
23087 callee, L42}, plus a @dfn{branch island} (glue code). The two target
23088 addresses represent the callee and the branch island. The
23089 Darwin/PPC linker prefers the first address and generates a @code{bl
23090 callee} if the PPC @code{bl} instruction reaches the callee directly;
23091 otherwise, the linker generates @code{bl L42} to call the branch
23092 island. The branch island is appended to the body of the
23093 calling function; it computes the full 32-bit address of the callee
23096 On Mach-O (Darwin) systems, this option directs the compiler emit to
23097 the glue for every direct call, and the Darwin linker decides whether
23098 to use or discard it.
23100 In the future, GCC may ignore all longcall specifications
23101 when the linker is known to generate glue.
23103 @item -mtls-markers
23104 @itemx -mno-tls-markers
23105 @opindex mtls-markers
23106 @opindex mno-tls-markers
23107 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
23108 specifying the function argument. The relocation allows the linker to
23109 reliably associate function call with argument setup instructions for
23110 TLS optimization, which in turn allows GCC to better schedule the
23116 This option enables use of the reciprocal estimate and
23117 reciprocal square root estimate instructions with additional
23118 Newton-Raphson steps to increase precision instead of doing a divide or
23119 square root and divide for floating-point arguments. You should use
23120 the @option{-ffast-math} option when using @option{-mrecip} (or at
23121 least @option{-funsafe-math-optimizations},
23122 @option{-ffinite-math-only}, @option{-freciprocal-math} and
23123 @option{-fno-trapping-math}). Note that while the throughput of the
23124 sequence is generally higher than the throughput of the non-reciprocal
23125 instruction, the precision of the sequence can be decreased by up to 2
23126 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
23129 @item -mrecip=@var{opt}
23130 @opindex mrecip=opt
23131 This option controls which reciprocal estimate instructions
23132 may be used. @var{opt} is a comma-separated list of options, which may
23133 be preceded by a @code{!} to invert the option:
23138 Enable all estimate instructions.
23141 Enable the default instructions, equivalent to @option{-mrecip}.
23144 Disable all estimate instructions, equivalent to @option{-mno-recip}.
23147 Enable the reciprocal approximation instructions for both
23148 single and double precision.
23151 Enable the single-precision reciprocal approximation instructions.
23154 Enable the double-precision reciprocal approximation instructions.
23157 Enable the reciprocal square root approximation instructions for both
23158 single and double precision.
23161 Enable the single-precision reciprocal square root approximation instructions.
23164 Enable the double-precision reciprocal square root approximation instructions.
23168 So, for example, @option{-mrecip=all,!rsqrtd} enables
23169 all of the reciprocal estimate instructions, except for the
23170 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
23171 which handle the double-precision reciprocal square root calculations.
23173 @item -mrecip-precision
23174 @itemx -mno-recip-precision
23175 @opindex mrecip-precision
23176 Assume (do not assume) that the reciprocal estimate instructions
23177 provide higher-precision estimates than is mandated by the PowerPC
23178 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
23179 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
23180 The double-precision square root estimate instructions are not generated by
23181 default on low-precision machines, since they do not provide an
23182 estimate that converges after three steps.
23184 @item -mveclibabi=@var{type}
23185 @opindex mveclibabi
23186 Specifies the ABI type to use for vectorizing intrinsics using an
23187 external library. The only type supported at present is @samp{mass},
23188 which specifies to use IBM's Mathematical Acceleration Subsystem
23189 (MASS) libraries for vectorizing intrinsics using external libraries.
23190 GCC currently emits calls to @code{acosd2}, @code{acosf4},
23191 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
23192 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
23193 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
23194 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
23195 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
23196 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
23197 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
23198 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
23199 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
23200 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
23201 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
23202 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
23203 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
23204 for power7. Both @option{-ftree-vectorize} and
23205 @option{-funsafe-math-optimizations} must also be enabled. The MASS
23206 libraries must be specified at link time.
23211 Generate (do not generate) the @code{friz} instruction when the
23212 @option{-funsafe-math-optimizations} option is used to optimize
23213 rounding of floating-point values to 64-bit integer and back to floating
23214 point. The @code{friz} instruction does not return the same value if
23215 the floating-point number is too large to fit in an integer.
23217 @item -mpointers-to-nested-functions
23218 @itemx -mno-pointers-to-nested-functions
23219 @opindex mpointers-to-nested-functions
23220 Generate (do not generate) code to load up the static chain register
23221 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
23222 systems where a function pointer points to a 3-word descriptor giving
23223 the function address, TOC value to be loaded in register @code{r2}, and
23224 static chain value to be loaded in register @code{r11}. The
23225 @option{-mpointers-to-nested-functions} is on by default. You cannot
23226 call through pointers to nested functions or pointers
23227 to functions compiled in other languages that use the static chain if
23228 you use @option{-mno-pointers-to-nested-functions}.
23230 @item -msave-toc-indirect
23231 @itemx -mno-save-toc-indirect
23232 @opindex msave-toc-indirect
23233 Generate (do not generate) code to save the TOC value in the reserved
23234 stack location in the function prologue if the function calls through
23235 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
23236 saved in the prologue, it is saved just before the call through the
23237 pointer. The @option{-mno-save-toc-indirect} option is the default.
23239 @item -mcompat-align-parm
23240 @itemx -mno-compat-align-parm
23241 @opindex mcompat-align-parm
23242 Generate (do not generate) code to pass structure parameters with a
23243 maximum alignment of 64 bits, for compatibility with older versions
23246 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
23247 structure parameter on a 128-bit boundary when that structure contained
23248 a member requiring 128-bit alignment. This is corrected in more
23249 recent versions of GCC. This option may be used to generate code
23250 that is compatible with functions compiled with older versions of
23253 The @option{-mno-compat-align-parm} option is the default.
23255 @item -mstack-protector-guard=@var{guard}
23256 @itemx -mstack-protector-guard-reg=@var{reg}
23257 @itemx -mstack-protector-guard-offset=@var{offset}
23258 @itemx -mstack-protector-guard-symbol=@var{symbol}
23259 @opindex mstack-protector-guard
23260 @opindex mstack-protector-guard-reg
23261 @opindex mstack-protector-guard-offset
23262 @opindex mstack-protector-guard-symbol
23263 Generate stack protection code using canary at @var{guard}. Supported
23264 locations are @samp{global} for global canary or @samp{tls} for per-thread
23265 canary in the TLS block (the default with GNU libc version 2.4 or later).
23267 With the latter choice the options
23268 @option{-mstack-protector-guard-reg=@var{reg}} and
23269 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
23270 which register to use as base register for reading the canary, and from what
23271 offset from that base register. The default for those is as specified in the
23272 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
23273 the offset with a symbol reference to a canary in the TLS block.
23277 @subsection RX Options
23280 These command-line options are defined for RX targets:
23283 @item -m64bit-doubles
23284 @itemx -m32bit-doubles
23285 @opindex m64bit-doubles
23286 @opindex m32bit-doubles
23287 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23288 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23289 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
23290 works on 32-bit values, which is why the default is
23291 @option{-m32bit-doubles}.
23297 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
23298 floating-point hardware. The default is enabled for the RX600
23299 series and disabled for the RX200 series.
23301 Floating-point instructions are only generated for 32-bit floating-point
23302 values, however, so the FPU hardware is not used for doubles if the
23303 @option{-m64bit-doubles} option is used.
23305 @emph{Note} If the @option{-fpu} option is enabled then
23306 @option{-funsafe-math-optimizations} is also enabled automatically.
23307 This is because the RX FPU instructions are themselves unsafe.
23309 @item -mcpu=@var{name}
23311 Selects the type of RX CPU to be targeted. Currently three types are
23312 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
23313 the specific @samp{RX610} CPU. The default is @samp{RX600}.
23315 The only difference between @samp{RX600} and @samp{RX610} is that the
23316 @samp{RX610} does not support the @code{MVTIPL} instruction.
23318 The @samp{RX200} series does not have a hardware floating-point unit
23319 and so @option{-nofpu} is enabled by default when this type is
23322 @item -mbig-endian-data
23323 @itemx -mlittle-endian-data
23324 @opindex mbig-endian-data
23325 @opindex mlittle-endian-data
23326 Store data (but not code) in the big-endian format. The default is
23327 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
23330 @item -msmall-data-limit=@var{N}
23331 @opindex msmall-data-limit
23332 Specifies the maximum size in bytes of global and static variables
23333 which can be placed into the small data area. Using the small data
23334 area can lead to smaller and faster code, but the size of area is
23335 limited and it is up to the programmer to ensure that the area does
23336 not overflow. Also when the small data area is used one of the RX's
23337 registers (usually @code{r13}) is reserved for use pointing to this
23338 area, so it is no longer available for use by the compiler. This
23339 could result in slower and/or larger code if variables are pushed onto
23340 the stack instead of being held in this register.
23342 Note, common variables (variables that have not been initialized) and
23343 constants are not placed into the small data area as they are assigned
23344 to other sections in the output executable.
23346 The default value is zero, which disables this feature. Note, this
23347 feature is not enabled by default with higher optimization levels
23348 (@option{-O2} etc) because of the potentially detrimental effects of
23349 reserving a register. It is up to the programmer to experiment and
23350 discover whether this feature is of benefit to their program. See the
23351 description of the @option{-mpid} option for a description of how the
23352 actual register to hold the small data area pointer is chosen.
23358 Use the simulator runtime. The default is to use the libgloss
23359 board-specific runtime.
23361 @item -mas100-syntax
23362 @itemx -mno-as100-syntax
23363 @opindex mas100-syntax
23364 @opindex mno-as100-syntax
23365 When generating assembler output use a syntax that is compatible with
23366 Renesas's AS100 assembler. This syntax can also be handled by the GAS
23367 assembler, but it has some restrictions so it is not generated by default.
23369 @item -mmax-constant-size=@var{N}
23370 @opindex mmax-constant-size
23371 Specifies the maximum size, in bytes, of a constant that can be used as
23372 an operand in a RX instruction. Although the RX instruction set does
23373 allow constants of up to 4 bytes in length to be used in instructions,
23374 a longer value equates to a longer instruction. Thus in some
23375 circumstances it can be beneficial to restrict the size of constants
23376 that are used in instructions. Constants that are too big are instead
23377 placed into a constant pool and referenced via register indirection.
23379 The value @var{N} can be between 0 and 4. A value of 0 (the default)
23380 or 4 means that constants of any size are allowed.
23384 Enable linker relaxation. Linker relaxation is a process whereby the
23385 linker attempts to reduce the size of a program by finding shorter
23386 versions of various instructions. Disabled by default.
23388 @item -mint-register=@var{N}
23389 @opindex mint-register
23390 Specify the number of registers to reserve for fast interrupt handler
23391 functions. The value @var{N} can be between 0 and 4. A value of 1
23392 means that register @code{r13} is reserved for the exclusive use
23393 of fast interrupt handlers. A value of 2 reserves @code{r13} and
23394 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
23395 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
23396 A value of 0, the default, does not reserve any registers.
23398 @item -msave-acc-in-interrupts
23399 @opindex msave-acc-in-interrupts
23400 Specifies that interrupt handler functions should preserve the
23401 accumulator register. This is only necessary if normal code might use
23402 the accumulator register, for example because it performs 64-bit
23403 multiplications. The default is to ignore the accumulator as this
23404 makes the interrupt handlers faster.
23410 Enables the generation of position independent data. When enabled any
23411 access to constant data is done via an offset from a base address
23412 held in a register. This allows the location of constant data to be
23413 determined at run time without requiring the executable to be
23414 relocated, which is a benefit to embedded applications with tight
23415 memory constraints. Data that can be modified is not affected by this
23418 Note, using this feature reserves a register, usually @code{r13}, for
23419 the constant data base address. This can result in slower and/or
23420 larger code, especially in complicated functions.
23422 The actual register chosen to hold the constant data base address
23423 depends upon whether the @option{-msmall-data-limit} and/or the
23424 @option{-mint-register} command-line options are enabled. Starting
23425 with register @code{r13} and proceeding downwards, registers are
23426 allocated first to satisfy the requirements of @option{-mint-register},
23427 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
23428 is possible for the small data area register to be @code{r8} if both
23429 @option{-mint-register=4} and @option{-mpid} are specified on the
23432 By default this feature is not enabled. The default can be restored
23433 via the @option{-mno-pid} command-line option.
23435 @item -mno-warn-multiple-fast-interrupts
23436 @itemx -mwarn-multiple-fast-interrupts
23437 @opindex mno-warn-multiple-fast-interrupts
23438 @opindex mwarn-multiple-fast-interrupts
23439 Prevents GCC from issuing a warning message if it finds more than one
23440 fast interrupt handler when it is compiling a file. The default is to
23441 issue a warning for each extra fast interrupt handler found, as the RX
23442 only supports one such interrupt.
23444 @item -mallow-string-insns
23445 @itemx -mno-allow-string-insns
23446 @opindex mallow-string-insns
23447 @opindex mno-allow-string-insns
23448 Enables or disables the use of the string manipulation instructions
23449 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
23450 @code{SWHILE} and also the @code{RMPA} instruction. These
23451 instructions may prefetch data, which is not safe to do if accessing
23452 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
23453 for more information).
23455 The default is to allow these instructions, but it is not possible for
23456 GCC to reliably detect all circumstances where a string instruction
23457 might be used to access an I/O register, so their use cannot be
23458 disabled automatically. Instead it is reliant upon the programmer to
23459 use the @option{-mno-allow-string-insns} option if their program
23460 accesses I/O space.
23462 When the instructions are enabled GCC defines the C preprocessor
23463 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
23464 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
23470 Use only (or not only) @code{JSR} instructions to access functions.
23471 This option can be used when code size exceeds the range of @code{BSR}
23472 instructions. Note that @option{-mno-jsr} does not mean to not use
23473 @code{JSR} but instead means that any type of branch may be used.
23476 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
23477 has special significance to the RX port when used with the
23478 @code{interrupt} function attribute. This attribute indicates a
23479 function intended to process fast interrupts. GCC ensures
23480 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
23481 and/or @code{r13} and only provided that the normal use of the
23482 corresponding registers have been restricted via the
23483 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
23486 @node S/390 and zSeries Options
23487 @subsection S/390 and zSeries Options
23488 @cindex S/390 and zSeries Options
23490 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
23494 @itemx -msoft-float
23495 @opindex mhard-float
23496 @opindex msoft-float
23497 Use (do not use) the hardware floating-point instructions and registers
23498 for floating-point operations. When @option{-msoft-float} is specified,
23499 functions in @file{libgcc.a} are used to perform floating-point
23500 operations. When @option{-mhard-float} is specified, the compiler
23501 generates IEEE floating-point instructions. This is the default.
23504 @itemx -mno-hard-dfp
23506 @opindex mno-hard-dfp
23507 Use (do not use) the hardware decimal-floating-point instructions for
23508 decimal-floating-point operations. When @option{-mno-hard-dfp} is
23509 specified, functions in @file{libgcc.a} are used to perform
23510 decimal-floating-point operations. When @option{-mhard-dfp} is
23511 specified, the compiler generates decimal-floating-point hardware
23512 instructions. This is the default for @option{-march=z9-ec} or higher.
23514 @item -mlong-double-64
23515 @itemx -mlong-double-128
23516 @opindex mlong-double-64
23517 @opindex mlong-double-128
23518 These switches control the size of @code{long double} type. A size
23519 of 64 bits makes the @code{long double} type equivalent to the @code{double}
23520 type. This is the default.
23523 @itemx -mno-backchain
23524 @opindex mbackchain
23525 @opindex mno-backchain
23526 Store (do not store) the address of the caller's frame as backchain pointer
23527 into the callee's stack frame.
23528 A backchain may be needed to allow debugging using tools that do not understand
23529 DWARF call frame information.
23530 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
23531 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
23532 the backchain is placed into the topmost word of the 96/160 byte register
23535 In general, code compiled with @option{-mbackchain} is call-compatible with
23536 code compiled with @option{-mmo-backchain}; however, use of the backchain
23537 for debugging purposes usually requires that the whole binary is built with
23538 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
23539 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
23540 to build a linux kernel use @option{-msoft-float}.
23542 The default is to not maintain the backchain.
23544 @item -mpacked-stack
23545 @itemx -mno-packed-stack
23546 @opindex mpacked-stack
23547 @opindex mno-packed-stack
23548 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
23549 specified, the compiler uses the all fields of the 96/160 byte register save
23550 area only for their default purpose; unused fields still take up stack space.
23551 When @option{-mpacked-stack} is specified, register save slots are densely
23552 packed at the top of the register save area; unused space is reused for other
23553 purposes, allowing for more efficient use of the available stack space.
23554 However, when @option{-mbackchain} is also in effect, the topmost word of
23555 the save area is always used to store the backchain, and the return address
23556 register is always saved two words below the backchain.
23558 As long as the stack frame backchain is not used, code generated with
23559 @option{-mpacked-stack} is call-compatible with code generated with
23560 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
23561 S/390 or zSeries generated code that uses the stack frame backchain at run
23562 time, not just for debugging purposes. Such code is not call-compatible
23563 with code compiled with @option{-mpacked-stack}. Also, note that the
23564 combination of @option{-mbackchain},
23565 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
23566 to build a linux kernel use @option{-msoft-float}.
23568 The default is to not use the packed stack layout.
23571 @itemx -mno-small-exec
23572 @opindex msmall-exec
23573 @opindex mno-small-exec
23574 Generate (or do not generate) code using the @code{bras} instruction
23575 to do subroutine calls.
23576 This only works reliably if the total executable size does not
23577 exceed 64k. The default is to use the @code{basr} instruction instead,
23578 which does not have this limitation.
23584 When @option{-m31} is specified, generate code compliant to the
23585 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
23586 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
23587 particular to generate 64-bit instructions. For the @samp{s390}
23588 targets, the default is @option{-m31}, while the @samp{s390x}
23589 targets default to @option{-m64}.
23595 When @option{-mzarch} is specified, generate code using the
23596 instructions available on z/Architecture.
23597 When @option{-mesa} is specified, generate code using the
23598 instructions available on ESA/390. Note that @option{-mesa} is
23599 not possible with @option{-m64}.
23600 When generating code compliant to the GNU/Linux for S/390 ABI,
23601 the default is @option{-mesa}. When generating code compliant
23602 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
23608 The @option{-mhtm} option enables a set of builtins making use of
23609 instructions available with the transactional execution facility
23610 introduced with the IBM zEnterprise EC12 machine generation
23611 @ref{S/390 System z Built-in Functions}.
23612 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
23618 When @option{-mvx} is specified, generate code using the instructions
23619 available with the vector extension facility introduced with the IBM
23620 z13 machine generation.
23621 This option changes the ABI for some vector type values with regard to
23622 alignment and calling conventions. In case vector type values are
23623 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
23624 command will be added to mark the resulting binary with the ABI used.
23625 @option{-mvx} is enabled by default when using @option{-march=z13}.
23628 @itemx -mno-zvector
23630 @opindex mno-zvector
23631 The @option{-mzvector} option enables vector language extensions and
23632 builtins using instructions available with the vector extension
23633 facility introduced with the IBM z13 machine generation.
23634 This option adds support for @samp{vector} to be used as a keyword to
23635 define vector type variables and arguments. @samp{vector} is only
23636 available when GNU extensions are enabled. It will not be expanded
23637 when requesting strict standard compliance e.g. with @option{-std=c99}.
23638 In addition to the GCC low-level builtins @option{-mzvector} enables
23639 a set of builtins added for compatibility with AltiVec-style
23640 implementations like Power and Cell. In order to make use of these
23641 builtins the header file @file{vecintrin.h} needs to be included.
23642 @option{-mzvector} is disabled by default.
23648 Generate (or do not generate) code using the @code{mvcle} instruction
23649 to perform block moves. When @option{-mno-mvcle} is specified,
23650 use a @code{mvc} loop instead. This is the default unless optimizing for
23657 Print (or do not print) additional debug information when compiling.
23658 The default is to not print debug information.
23660 @item -march=@var{cpu-type}
23662 Generate code that runs on @var{cpu-type}, which is the name of a
23663 system representing a certain processor type. Possible values for
23664 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
23665 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
23666 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
23669 The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and
23670 @samp{g6} are deprecated and will be removed with future releases.
23672 Specifying @samp{native} as cpu type can be used to select the best
23673 architecture option for the host processor.
23674 @option{-march=native} has no effect if GCC does not recognize the
23677 @item -mtune=@var{cpu-type}
23679 Tune to @var{cpu-type} everything applicable about the generated code,
23680 except for the ABI and the set of available instructions.
23681 The list of @var{cpu-type} values is the same as for @option{-march}.
23682 The default is the value used for @option{-march}.
23685 @itemx -mno-tpf-trace
23686 @opindex mtpf-trace
23687 @opindex mno-tpf-trace
23688 Generate code that adds (does not add) in TPF OS specific branches to trace
23689 routines in the operating system. This option is off by default, even
23690 when compiling for the TPF OS@.
23693 @itemx -mno-fused-madd
23694 @opindex mfused-madd
23695 @opindex mno-fused-madd
23696 Generate code that uses (does not use) the floating-point multiply and
23697 accumulate instructions. These instructions are generated by default if
23698 hardware floating point is used.
23700 @item -mwarn-framesize=@var{framesize}
23701 @opindex mwarn-framesize
23702 Emit a warning if the current function exceeds the given frame size. Because
23703 this is a compile-time check it doesn't need to be a real problem when the program
23704 runs. It is intended to identify functions that most probably cause
23705 a stack overflow. It is useful to be used in an environment with limited stack
23706 size e.g.@: the linux kernel.
23708 @item -mwarn-dynamicstack
23709 @opindex mwarn-dynamicstack
23710 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
23711 arrays. This is generally a bad idea with a limited stack size.
23713 @item -mstack-guard=@var{stack-guard}
23714 @itemx -mstack-size=@var{stack-size}
23715 @opindex mstack-guard
23716 @opindex mstack-size
23717 If these options are provided the S/390 back end emits additional instructions in
23718 the function prologue that trigger a trap if the stack size is @var{stack-guard}
23719 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
23720 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
23721 the frame size of the compiled function is chosen.
23722 These options are intended to be used to help debugging stack overflow problems.
23723 The additionally emitted code causes only little overhead and hence can also be
23724 used in production-like systems without greater performance degradation. The given
23725 values have to be exact powers of 2 and @var{stack-size} has to be greater than
23726 @var{stack-guard} without exceeding 64k.
23727 In order to be efficient the extra code makes the assumption that the stack starts
23728 at an address aligned to the value given by @var{stack-size}.
23729 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
23731 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
23733 If the hotpatch option is enabled, a ``hot-patching'' function
23734 prologue is generated for all functions in the compilation unit.
23735 The funtion label is prepended with the given number of two-byte
23736 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
23737 the label, 2 * @var{post-halfwords} bytes are appended, using the
23738 largest NOP like instructions the architecture allows (maximum
23741 If both arguments are zero, hotpatching is disabled.
23743 This option can be overridden for individual functions with the
23744 @code{hotpatch} attribute.
23747 @node Score Options
23748 @subsection Score Options
23749 @cindex Score Options
23751 These options are defined for Score implementations:
23756 Compile code for big-endian mode. This is the default.
23760 Compile code for little-endian mode.
23764 Disable generation of @code{bcnz} instructions.
23768 Enable generation of unaligned load and store instructions.
23772 Enable the use of multiply-accumulate instructions. Disabled by default.
23776 Specify the SCORE5 as the target architecture.
23780 Specify the SCORE5U of the target architecture.
23784 Specify the SCORE7 as the target architecture. This is the default.
23788 Specify the SCORE7D as the target architecture.
23792 @subsection SH Options
23794 These @samp{-m} options are defined for the SH implementations:
23799 Generate code for the SH1.
23803 Generate code for the SH2.
23806 Generate code for the SH2e.
23810 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
23811 that the floating-point unit is not used.
23813 @item -m2a-single-only
23814 @opindex m2a-single-only
23815 Generate code for the SH2a-FPU, in such a way that no double-precision
23816 floating-point operations are used.
23819 @opindex m2a-single
23820 Generate code for the SH2a-FPU assuming the floating-point unit is in
23821 single-precision mode by default.
23825 Generate code for the SH2a-FPU assuming the floating-point unit is in
23826 double-precision mode by default.
23830 Generate code for the SH3.
23834 Generate code for the SH3e.
23838 Generate code for the SH4 without a floating-point unit.
23840 @item -m4-single-only
23841 @opindex m4-single-only
23842 Generate code for the SH4 with a floating-point unit that only
23843 supports single-precision arithmetic.
23847 Generate code for the SH4 assuming the floating-point unit is in
23848 single-precision mode by default.
23852 Generate code for the SH4.
23856 Generate code for SH4-100.
23858 @item -m4-100-nofpu
23859 @opindex m4-100-nofpu
23860 Generate code for SH4-100 in such a way that the
23861 floating-point unit is not used.
23863 @item -m4-100-single
23864 @opindex m4-100-single
23865 Generate code for SH4-100 assuming the floating-point unit is in
23866 single-precision mode by default.
23868 @item -m4-100-single-only
23869 @opindex m4-100-single-only
23870 Generate code for SH4-100 in such a way that no double-precision
23871 floating-point operations are used.
23875 Generate code for SH4-200.
23877 @item -m4-200-nofpu
23878 @opindex m4-200-nofpu
23879 Generate code for SH4-200 without in such a way that the
23880 floating-point unit is not used.
23882 @item -m4-200-single
23883 @opindex m4-200-single
23884 Generate code for SH4-200 assuming the floating-point unit is in
23885 single-precision mode by default.
23887 @item -m4-200-single-only
23888 @opindex m4-200-single-only
23889 Generate code for SH4-200 in such a way that no double-precision
23890 floating-point operations are used.
23894 Generate code for SH4-300.
23896 @item -m4-300-nofpu
23897 @opindex m4-300-nofpu
23898 Generate code for SH4-300 without in such a way that the
23899 floating-point unit is not used.
23901 @item -m4-300-single
23902 @opindex m4-300-single
23903 Generate code for SH4-300 in such a way that no double-precision
23904 floating-point operations are used.
23906 @item -m4-300-single-only
23907 @opindex m4-300-single-only
23908 Generate code for SH4-300 in such a way that no double-precision
23909 floating-point operations are used.
23913 Generate code for SH4-340 (no MMU, no FPU).
23917 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
23922 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
23923 floating-point unit is not used.
23925 @item -m4a-single-only
23926 @opindex m4a-single-only
23927 Generate code for the SH4a, in such a way that no double-precision
23928 floating-point operations are used.
23931 @opindex m4a-single
23932 Generate code for the SH4a assuming the floating-point unit is in
23933 single-precision mode by default.
23937 Generate code for the SH4a.
23941 Same as @option{-m4a-nofpu}, except that it implicitly passes
23942 @option{-dsp} to the assembler. GCC doesn't generate any DSP
23943 instructions at the moment.
23947 Compile code for the processor in big-endian mode.
23951 Compile code for the processor in little-endian mode.
23955 Align doubles at 64-bit boundaries. Note that this changes the calling
23956 conventions, and thus some functions from the standard C library do
23957 not work unless you recompile it first with @option{-mdalign}.
23961 Shorten some address references at link time, when possible; uses the
23962 linker option @option{-relax}.
23966 Use 32-bit offsets in @code{switch} tables. The default is to use
23971 Enable the use of bit manipulation instructions on SH2A.
23975 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
23976 alignment constraints.
23980 Comply with the calling conventions defined by Renesas.
23983 @opindex mno-renesas
23984 Comply with the calling conventions defined for GCC before the Renesas
23985 conventions were available. This option is the default for all
23986 targets of the SH toolchain.
23989 @opindex mnomacsave
23990 Mark the @code{MAC} register as call-clobbered, even if
23991 @option{-mrenesas} is given.
23997 Control the IEEE compliance of floating-point comparisons, which affects the
23998 handling of cases where the result of a comparison is unordered. By default
23999 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
24000 enabled @option{-mno-ieee} is implicitly set, which results in faster
24001 floating-point greater-equal and less-equal comparisons. The implicit settings
24002 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
24004 @item -minline-ic_invalidate
24005 @opindex minline-ic_invalidate
24006 Inline code to invalidate instruction cache entries after setting up
24007 nested function trampolines.
24008 This option has no effect if @option{-musermode} is in effect and the selected
24009 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
24011 If the selected code generation option does not allow the use of the @code{icbi}
24012 instruction, and @option{-musermode} is not in effect, the inlined code
24013 manipulates the instruction cache address array directly with an associative
24014 write. This not only requires privileged mode at run time, but it also
24015 fails if the cache line had been mapped via the TLB and has become unmapped.
24019 Dump instruction size and location in the assembly code.
24022 @opindex mpadstruct
24023 This option is deprecated. It pads structures to multiple of 4 bytes,
24024 which is incompatible with the SH ABI@.
24026 @item -matomic-model=@var{model}
24027 @opindex matomic-model=@var{model}
24028 Sets the model of atomic operations and additional parameters as a comma
24029 separated list. For details on the atomic built-in functions see
24030 @ref{__atomic Builtins}. The following models and parameters are supported:
24035 Disable compiler generated atomic sequences and emit library calls for atomic
24036 operations. This is the default if the target is not @code{sh*-*-linux*}.
24039 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
24040 built-in functions. The generated atomic sequences require additional support
24041 from the interrupt/exception handling code of the system and are only suitable
24042 for SH3* and SH4* single-core systems. This option is enabled by default when
24043 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
24044 this option also partially utilizes the hardware atomic instructions
24045 @code{movli.l} and @code{movco.l} to create more efficient code, unless
24046 @samp{strict} is specified.
24049 Generate software atomic sequences that use a variable in the thread control
24050 block. This is a variation of the gUSA sequences which can also be used on
24051 SH1* and SH2* targets. The generated atomic sequences require additional
24052 support from the interrupt/exception handling code of the system and are only
24053 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
24054 parameter has to be specified as well.
24057 Generate software atomic sequences that temporarily disable interrupts by
24058 setting @code{SR.IMASK = 1111}. This model works only when the program runs
24059 in privileged mode and is only suitable for single-core systems. Additional
24060 support from the interrupt/exception handling code of the system is not
24061 required. This model is enabled by default when the target is
24062 @code{sh*-*-linux*} and SH1* or SH2*.
24065 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
24066 instructions only. This is only available on SH4A and is suitable for
24067 multi-core systems. Since the hardware instructions support only 32 bit atomic
24068 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
24069 Code compiled with this option is also compatible with other software
24070 atomic model interrupt/exception handling systems if executed on an SH4A
24071 system. Additional support from the interrupt/exception handling code of the
24072 system is not required for this model.
24075 This parameter specifies the offset in bytes of the variable in the thread
24076 control block structure that should be used by the generated atomic sequences
24077 when the @samp{soft-tcb} model has been selected. For other models this
24078 parameter is ignored. The specified value must be an integer multiple of four
24079 and in the range 0-1020.
24082 This parameter prevents mixed usage of multiple atomic models, even if they
24083 are compatible, and makes the compiler generate atomic sequences of the
24084 specified model only.
24090 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
24091 Notice that depending on the particular hardware and software configuration
24092 this can degrade overall performance due to the operand cache line flushes
24093 that are implied by the @code{tas.b} instruction. On multi-core SH4A
24094 processors the @code{tas.b} instruction must be used with caution since it
24095 can result in data corruption for certain cache configurations.
24098 @opindex mprefergot
24099 When generating position-independent code, emit function calls using
24100 the Global Offset Table instead of the Procedure Linkage Table.
24103 @itemx -mno-usermode
24105 @opindex mno-usermode
24106 Don't allow (allow) the compiler generating privileged mode code. Specifying
24107 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
24108 inlined code would not work in user mode. @option{-musermode} is the default
24109 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
24110 @option{-musermode} has no effect, since there is no user mode.
24112 @item -multcost=@var{number}
24113 @opindex multcost=@var{number}
24114 Set the cost to assume for a multiply insn.
24116 @item -mdiv=@var{strategy}
24117 @opindex mdiv=@var{strategy}
24118 Set the division strategy to be used for integer division operations.
24119 @var{strategy} can be one of:
24124 Calls a library function that uses the single-step division instruction
24125 @code{div1} to perform the operation. Division by zero calculates an
24126 unspecified result and does not trap. This is the default except for SH4,
24127 SH2A and SHcompact.
24130 Calls a library function that performs the operation in double precision
24131 floating point. Division by zero causes a floating-point exception. This is
24132 the default for SHcompact with FPU. Specifying this for targets that do not
24133 have a double precision FPU defaults to @code{call-div1}.
24136 Calls a library function that uses a lookup table for small divisors and
24137 the @code{div1} instruction with case distinction for larger divisors. Division
24138 by zero calculates an unspecified result and does not trap. This is the default
24139 for SH4. Specifying this for targets that do not have dynamic shift
24140 instructions defaults to @code{call-div1}.
24144 When a division strategy has not been specified the default strategy is
24145 selected based on the current target. For SH2A the default strategy is to
24146 use the @code{divs} and @code{divu} instructions instead of library function
24149 @item -maccumulate-outgoing-args
24150 @opindex maccumulate-outgoing-args
24151 Reserve space once for outgoing arguments in the function prologue rather
24152 than around each call. Generally beneficial for performance and size. Also
24153 needed for unwinding to avoid changing the stack frame around conditional code.
24155 @item -mdivsi3_libfunc=@var{name}
24156 @opindex mdivsi3_libfunc=@var{name}
24157 Set the name of the library function used for 32-bit signed division to
24159 This only affects the name used in the @samp{call} division strategies, and
24160 the compiler still expects the same sets of input/output/clobbered registers as
24161 if this option were not present.
24163 @item -mfixed-range=@var{register-range}
24164 @opindex mfixed-range
24165 Generate code treating the given register range as fixed registers.
24166 A fixed register is one that the register allocator can not use. This is
24167 useful when compiling kernel code. A register range is specified as
24168 two registers separated by a dash. Multiple register ranges can be
24169 specified separated by a comma.
24171 @item -mbranch-cost=@var{num}
24172 @opindex mbranch-cost=@var{num}
24173 Assume @var{num} to be the cost for a branch instruction. Higher numbers
24174 make the compiler try to generate more branch-free code if possible.
24175 If not specified the value is selected depending on the processor type that
24176 is being compiled for.
24179 @itemx -mno-zdcbranch
24180 @opindex mzdcbranch
24181 @opindex mno-zdcbranch
24182 Assume (do not assume) that zero displacement conditional branch instructions
24183 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
24184 compiler prefers zero displacement branch code sequences. This is
24185 enabled by default when generating code for SH4 and SH4A. It can be explicitly
24186 disabled by specifying @option{-mno-zdcbranch}.
24188 @item -mcbranch-force-delay-slot
24189 @opindex mcbranch-force-delay-slot
24190 Force the usage of delay slots for conditional branches, which stuffs the delay
24191 slot with a @code{nop} if a suitable instruction cannot be found. By default
24192 this option is disabled. It can be enabled to work around hardware bugs as
24193 found in the original SH7055.
24196 @itemx -mno-fused-madd
24197 @opindex mfused-madd
24198 @opindex mno-fused-madd
24199 Generate code that uses (does not use) the floating-point multiply and
24200 accumulate instructions. These instructions are generated by default
24201 if hardware floating point is used. The machine-dependent
24202 @option{-mfused-madd} option is now mapped to the machine-independent
24203 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24204 mapped to @option{-ffp-contract=off}.
24210 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
24211 and cosine approximations. The option @option{-mfsca} must be used in
24212 combination with @option{-funsafe-math-optimizations}. It is enabled by default
24213 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
24214 approximations even if @option{-funsafe-math-optimizations} is in effect.
24220 Allow or disallow the compiler to emit the @code{fsrra} instruction for
24221 reciprocal square root approximations. The option @option{-mfsrra} must be used
24222 in combination with @option{-funsafe-math-optimizations} and
24223 @option{-ffinite-math-only}. It is enabled by default when generating code for
24224 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
24225 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
24228 @item -mpretend-cmove
24229 @opindex mpretend-cmove
24230 Prefer zero-displacement conditional branches for conditional move instruction
24231 patterns. This can result in faster code on the SH4 processor.
24235 Generate code using the FDPIC ABI.
24239 @node Solaris 2 Options
24240 @subsection Solaris 2 Options
24241 @cindex Solaris 2 options
24243 These @samp{-m} options are supported on Solaris 2:
24246 @item -mclear-hwcap
24247 @opindex mclear-hwcap
24248 @option{-mclear-hwcap} tells the compiler to remove the hardware
24249 capabilities generated by the Solaris assembler. This is only necessary
24250 when object files use ISA extensions not supported by the current
24251 machine, but check at runtime whether or not to use them.
24253 @item -mimpure-text
24254 @opindex mimpure-text
24255 @option{-mimpure-text}, used in addition to @option{-shared}, tells
24256 the compiler to not pass @option{-z text} to the linker when linking a
24257 shared object. Using this option, you can link position-dependent
24258 code into a shared object.
24260 @option{-mimpure-text} suppresses the ``relocations remain against
24261 allocatable but non-writable sections'' linker error message.
24262 However, the necessary relocations trigger copy-on-write, and the
24263 shared object is not actually shared across processes. Instead of
24264 using @option{-mimpure-text}, you should compile all source code with
24265 @option{-fpic} or @option{-fPIC}.
24269 These switches are supported in addition to the above on Solaris 2:
24274 This is a synonym for @option{-pthread}.
24277 @node SPARC Options
24278 @subsection SPARC Options
24279 @cindex SPARC options
24281 These @samp{-m} options are supported on the SPARC:
24284 @item -mno-app-regs
24286 @opindex mno-app-regs
24288 Specify @option{-mapp-regs} to generate output using the global registers
24289 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
24290 global register 1, each global register 2 through 4 is then treated as an
24291 allocable register that is clobbered by function calls. This is the default.
24293 To be fully SVR4 ABI-compliant at the cost of some performance loss,
24294 specify @option{-mno-app-regs}. You should compile libraries and system
24295 software with this option.
24301 With @option{-mflat}, the compiler does not generate save/restore instructions
24302 and uses a ``flat'' or single register window model. This model is compatible
24303 with the regular register window model. The local registers and the input
24304 registers (0--5) are still treated as ``call-saved'' registers and are
24305 saved on the stack as needed.
24307 With @option{-mno-flat} (the default), the compiler generates save/restore
24308 instructions (except for leaf functions). This is the normal operating mode.
24311 @itemx -mhard-float
24313 @opindex mhard-float
24314 Generate output containing floating-point instructions. This is the
24318 @itemx -msoft-float
24320 @opindex msoft-float
24321 Generate output containing library calls for floating point.
24322 @strong{Warning:} the requisite libraries are not available for all SPARC
24323 targets. Normally the facilities of the machine's usual C compiler are
24324 used, but this cannot be done directly in cross-compilation. You must make
24325 your own arrangements to provide suitable library functions for
24326 cross-compilation. The embedded targets @samp{sparc-*-aout} and
24327 @samp{sparclite-*-*} do provide software floating-point support.
24329 @option{-msoft-float} changes the calling convention in the output file;
24330 therefore, it is only useful if you compile @emph{all} of a program with
24331 this option. In particular, you need to compile @file{libgcc.a}, the
24332 library that comes with GCC, with @option{-msoft-float} in order for
24335 @item -mhard-quad-float
24336 @opindex mhard-quad-float
24337 Generate output containing quad-word (long double) floating-point
24340 @item -msoft-quad-float
24341 @opindex msoft-quad-float
24342 Generate output containing library calls for quad-word (long double)
24343 floating-point instructions. The functions called are those specified
24344 in the SPARC ABI@. This is the default.
24346 As of this writing, there are no SPARC implementations that have hardware
24347 support for the quad-word floating-point instructions. They all invoke
24348 a trap handler for one of these instructions, and then the trap handler
24349 emulates the effect of the instruction. Because of the trap handler overhead,
24350 this is much slower than calling the ABI library routines. Thus the
24351 @option{-msoft-quad-float} option is the default.
24353 @item -mno-unaligned-doubles
24354 @itemx -munaligned-doubles
24355 @opindex mno-unaligned-doubles
24356 @opindex munaligned-doubles
24357 Assume that doubles have 8-byte alignment. This is the default.
24359 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
24360 alignment only if they are contained in another type, or if they have an
24361 absolute address. Otherwise, it assumes they have 4-byte alignment.
24362 Specifying this option avoids some rare compatibility problems with code
24363 generated by other compilers. It is not the default because it results
24364 in a performance loss, especially for floating-point code.
24367 @itemx -mno-user-mode
24368 @opindex muser-mode
24369 @opindex mno-user-mode
24370 Do not generate code that can only run in supervisor mode. This is relevant
24371 only for the @code{casa} instruction emitted for the LEON3 processor. This
24374 @item -mfaster-structs
24375 @itemx -mno-faster-structs
24376 @opindex mfaster-structs
24377 @opindex mno-faster-structs
24378 With @option{-mfaster-structs}, the compiler assumes that structures
24379 should have 8-byte alignment. This enables the use of pairs of
24380 @code{ldd} and @code{std} instructions for copies in structure
24381 assignment, in place of twice as many @code{ld} and @code{st} pairs.
24382 However, the use of this changed alignment directly violates the SPARC
24383 ABI@. Thus, it's intended only for use on targets where the developer
24384 acknowledges that their resulting code is not directly in line with
24385 the rules of the ABI@.
24387 @item -mstd-struct-return
24388 @itemx -mno-std-struct-return
24389 @opindex mstd-struct-return
24390 @opindex mno-std-struct-return
24391 With @option{-mstd-struct-return}, the compiler generates checking code
24392 in functions returning structures or unions to detect size mismatches
24393 between the two sides of function calls, as per the 32-bit ABI@.
24395 The default is @option{-mno-std-struct-return}. This option has no effect
24402 Enable Local Register Allocation. This is the default for SPARC since GCC 7
24403 so @option{-mno-lra} needs to be passed to get old Reload.
24405 @item -mcpu=@var{cpu_type}
24407 Set the instruction set, register set, and instruction scheduling parameters
24408 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
24409 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
24410 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
24411 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
24412 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
24413 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
24415 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
24416 which selects the best architecture option for the host processor.
24417 @option{-mcpu=native} has no effect if GCC does not recognize
24420 Default instruction scheduling parameters are used for values that select
24421 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
24422 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
24424 Here is a list of each supported architecture and their supported
24432 supersparc, hypersparc, leon, leon3
24435 f930, f934, sparclite86x
24441 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
24445 By default (unless configured otherwise), GCC generates code for the V7
24446 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
24447 additionally optimizes it for the Cypress CY7C602 chip, as used in the
24448 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
24449 SPARCStation 1, 2, IPX etc.
24451 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
24452 architecture. The only difference from V7 code is that the compiler emits
24453 the integer multiply and integer divide instructions which exist in SPARC-V8
24454 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
24455 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
24458 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
24459 the SPARC architecture. This adds the integer multiply, integer divide step
24460 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
24461 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
24462 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
24463 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
24464 MB86934 chip, which is the more recent SPARClite with FPU@.
24466 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
24467 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
24468 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
24469 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
24470 optimizes it for the TEMIC SPARClet chip.
24472 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
24473 architecture. This adds 64-bit integer and floating-point move instructions,
24474 3 additional floating-point condition code registers and conditional move
24475 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
24476 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
24477 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
24478 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
24479 @option{-mcpu=niagara}, the compiler additionally optimizes it for
24480 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
24481 additionally optimizes it for Sun UltraSPARC T2 chips. With
24482 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
24483 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
24484 additionally optimizes it for Sun UltraSPARC T4 chips. With
24485 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
24486 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
24487 additionally optimizes it for Oracle M8 chips.
24489 @item -mtune=@var{cpu_type}
24491 Set the instruction scheduling parameters for machine type
24492 @var{cpu_type}, but do not set the instruction set or register set that the
24493 option @option{-mcpu=@var{cpu_type}} does.
24495 The same values for @option{-mcpu=@var{cpu_type}} can be used for
24496 @option{-mtune=@var{cpu_type}}, but the only useful values are those
24497 that select a particular CPU implementation. Those are
24498 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
24499 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
24500 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
24501 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
24502 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
24503 and GNU/Linux toolchains, @samp{native} can also be used.
24508 @opindex mno-v8plus
24509 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
24510 difference from the V8 ABI is that the global and out registers are
24511 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
24512 mode for all SPARC-V9 processors.
24518 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
24519 Visual Instruction Set extensions. The default is @option{-mno-vis}.
24525 With @option{-mvis2}, GCC generates code that takes advantage of
24526 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
24527 default is @option{-mvis2} when targeting a cpu that supports such
24528 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
24529 also sets @option{-mvis}.
24535 With @option{-mvis3}, GCC generates code that takes advantage of
24536 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
24537 default is @option{-mvis3} when targeting a cpu that supports such
24538 instructions, such as niagara-3 and later. Setting @option{-mvis3}
24539 also sets @option{-mvis2} and @option{-mvis}.
24545 With @option{-mvis4}, GCC generates code that takes advantage of
24546 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
24547 default is @option{-mvis4} when targeting a cpu that supports such
24548 instructions, such as niagara-7 and later. Setting @option{-mvis4}
24549 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
24555 With @option{-mvis4b}, GCC generates code that takes advantage of
24556 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
24557 the additional VIS instructions introduced in the Oracle SPARC
24558 Architecture 2017. The default is @option{-mvis4b} when targeting a
24559 cpu that supports such instructions, such as m8 and later. Setting
24560 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
24561 @option{-mvis2} and @option{-mvis}.
24566 @opindex mno-cbcond
24567 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
24568 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
24569 when targeting a CPU that supports such instructions, such as Niagara-4 and
24576 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
24577 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
24578 when targeting a CPU that supports such instructions, such as Niagara-3 and
24584 @opindex mno-fsmuld
24585 With @option{-mfsmuld}, GCC generates code that takes advantage of the
24586 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
24587 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
24588 or V9 with FPU except @option{-mcpu=leon}.
24594 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
24595 Population Count instruction. The default is @option{-mpopc}
24596 when targeting a CPU that supports such an instruction, such as Niagara-2 and
24603 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
24604 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
24605 when targeting a CPU that supports such an instruction, such as Niagara-7 and
24609 @opindex mfix-at697f
24610 Enable the documented workaround for the single erratum of the Atmel AT697F
24611 processor (which corresponds to erratum #13 of the AT697E processor).
24614 @opindex mfix-ut699
24615 Enable the documented workarounds for the floating-point errata and the data
24616 cache nullify errata of the UT699 processor.
24619 @opindex mfix-ut700
24620 Enable the documented workaround for the back-to-back store errata of
24621 the UT699E/UT700 processor.
24623 @item -mfix-gr712rc
24624 @opindex mfix-gr712rc
24625 Enable the documented workaround for the back-to-back store errata of
24626 the GR712RC processor.
24629 These @samp{-m} options are supported in addition to the above
24630 on SPARC-V9 processors in 64-bit environments:
24637 Generate code for a 32-bit or 64-bit environment.
24638 The 32-bit environment sets int, long and pointer to 32 bits.
24639 The 64-bit environment sets int to 32 bits and long and pointer
24642 @item -mcmodel=@var{which}
24644 Set the code model to one of
24648 The Medium/Low code model: 64-bit addresses, programs
24649 must be linked in the low 32 bits of memory. Programs can be statically
24650 or dynamically linked.
24653 The Medium/Middle code model: 64-bit addresses, programs
24654 must be linked in the low 44 bits of memory, the text and data segments must
24655 be less than 2GB in size and the data segment must be located within 2GB of
24659 The Medium/Anywhere code model: 64-bit addresses, programs
24660 may be linked anywhere in memory, the text and data segments must be less
24661 than 2GB in size and the data segment must be located within 2GB of the
24665 The Medium/Anywhere code model for embedded systems:
24666 64-bit addresses, the text and data segments must be less than 2GB in
24667 size, both starting anywhere in memory (determined at link time). The
24668 global register %g4 points to the base of the data segment. Programs
24669 are statically linked and PIC is not supported.
24672 @item -mmemory-model=@var{mem-model}
24673 @opindex mmemory-model
24674 Set the memory model in force on the processor to one of
24678 The default memory model for the processor and operating system.
24681 Relaxed Memory Order
24684 Partial Store Order
24690 Sequential Consistency
24693 These memory models are formally defined in Appendix D of the SPARC-V9
24694 architecture manual, as set in the processor's @code{PSTATE.MM} field.
24697 @itemx -mno-stack-bias
24698 @opindex mstack-bias
24699 @opindex mno-stack-bias
24700 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
24701 frame pointer if present, are offset by @minus{}2047 which must be added back
24702 when making stack frame references. This is the default in 64-bit mode.
24703 Otherwise, assume no such offset is present.
24707 @subsection SPU Options
24708 @cindex SPU options
24710 These @samp{-m} options are supported on the SPU:
24714 @itemx -merror-reloc
24715 @opindex mwarn-reloc
24716 @opindex merror-reloc
24718 The loader for SPU does not handle dynamic relocations. By default, GCC
24719 gives an error when it generates code that requires a dynamic
24720 relocation. @option{-mno-error-reloc} disables the error,
24721 @option{-mwarn-reloc} generates a warning instead.
24724 @itemx -munsafe-dma
24726 @opindex munsafe-dma
24728 Instructions that initiate or test completion of DMA must not be
24729 reordered with respect to loads and stores of the memory that is being
24731 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
24732 memory accesses, but that can lead to inefficient code in places where the
24733 memory is known to not change. Rather than mark the memory as volatile,
24734 you can use @option{-msafe-dma} to tell the compiler to treat
24735 the DMA instructions as potentially affecting all memory.
24737 @item -mbranch-hints
24738 @opindex mbranch-hints
24740 By default, GCC generates a branch hint instruction to avoid
24741 pipeline stalls for always-taken or probably-taken branches. A hint
24742 is not generated closer than 8 instructions away from its branch.
24743 There is little reason to disable them, except for debugging purposes,
24744 or to make an object a little bit smaller.
24748 @opindex msmall-mem
24749 @opindex mlarge-mem
24751 By default, GCC generates code assuming that addresses are never larger
24752 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
24753 a full 32-bit address.
24758 By default, GCC links against startup code that assumes the SPU-style
24759 main function interface (which has an unconventional parameter list).
24760 With @option{-mstdmain}, GCC links your program against startup
24761 code that assumes a C99-style interface to @code{main}, including a
24762 local copy of @code{argv} strings.
24764 @item -mfixed-range=@var{register-range}
24765 @opindex mfixed-range
24766 Generate code treating the given register range as fixed registers.
24767 A fixed register is one that the register allocator cannot use. This is
24768 useful when compiling kernel code. A register range is specified as
24769 two registers separated by a dash. Multiple register ranges can be
24770 specified separated by a comma.
24776 Compile code assuming that pointers to the PPU address space accessed
24777 via the @code{__ea} named address space qualifier are either 32 or 64
24778 bits wide. The default is 32 bits. As this is an ABI-changing option,
24779 all object code in an executable must be compiled with the same setting.
24781 @item -maddress-space-conversion
24782 @itemx -mno-address-space-conversion
24783 @opindex maddress-space-conversion
24784 @opindex mno-address-space-conversion
24785 Allow/disallow treating the @code{__ea} address space as superset
24786 of the generic address space. This enables explicit type casts
24787 between @code{__ea} and generic pointer as well as implicit
24788 conversions of generic pointers to @code{__ea} pointers. The
24789 default is to allow address space pointer conversions.
24791 @item -mcache-size=@var{cache-size}
24792 @opindex mcache-size
24793 This option controls the version of libgcc that the compiler links to an
24794 executable and selects a software-managed cache for accessing variables
24795 in the @code{__ea} address space with a particular cache size. Possible
24796 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
24797 and @samp{128}. The default cache size is 64KB.
24799 @item -matomic-updates
24800 @itemx -mno-atomic-updates
24801 @opindex matomic-updates
24802 @opindex mno-atomic-updates
24803 This option controls the version of libgcc that the compiler links to an
24804 executable and selects whether atomic updates to the software-managed
24805 cache of PPU-side variables are used. If you use atomic updates, changes
24806 to a PPU variable from SPU code using the @code{__ea} named address space
24807 qualifier do not interfere with changes to other PPU variables residing
24808 in the same cache line from PPU code. If you do not use atomic updates,
24809 such interference may occur; however, writing back cache lines is
24810 more efficient. The default behavior is to use atomic updates.
24813 @itemx -mdual-nops=@var{n}
24814 @opindex mdual-nops
24815 By default, GCC inserts NOPs to increase dual issue when it expects
24816 it to increase performance. @var{n} can be a value from 0 to 10. A
24817 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
24818 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
24820 @item -mhint-max-nops=@var{n}
24821 @opindex mhint-max-nops
24822 Maximum number of NOPs to insert for a branch hint. A branch hint must
24823 be at least 8 instructions away from the branch it is affecting. GCC
24824 inserts up to @var{n} NOPs to enforce this, otherwise it does not
24825 generate the branch hint.
24827 @item -mhint-max-distance=@var{n}
24828 @opindex mhint-max-distance
24829 The encoding of the branch hint instruction limits the hint to be within
24830 256 instructions of the branch it is affecting. By default, GCC makes
24831 sure it is within 125.
24834 @opindex msafe-hints
24835 Work around a hardware bug that causes the SPU to stall indefinitely.
24836 By default, GCC inserts the @code{hbrp} instruction to make sure
24837 this stall won't happen.
24841 @node System V Options
24842 @subsection Options for System V
24844 These additional options are available on System V Release 4 for
24845 compatibility with other compilers on those systems:
24850 Create a shared object.
24851 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
24855 Identify the versions of each tool used by the compiler, in a
24856 @code{.ident} assembler directive in the output.
24860 Refrain from adding @code{.ident} directives to the output file (this is
24863 @item -YP,@var{dirs}
24865 Search the directories @var{dirs}, and no others, for libraries
24866 specified with @option{-l}.
24868 @item -Ym,@var{dir}
24870 Look in the directory @var{dir} to find the M4 preprocessor.
24871 The assembler uses this option.
24872 @c This is supposed to go with a -Yd for predefined M4 macro files, but
24873 @c the generic assembler that comes with Solaris takes just -Ym.
24876 @node TILE-Gx Options
24877 @subsection TILE-Gx Options
24878 @cindex TILE-Gx options
24880 These @samp{-m} options are supported on the TILE-Gx:
24883 @item -mcmodel=small
24884 @opindex mcmodel=small
24885 Generate code for the small model. The distance for direct calls is
24886 limited to 500M in either direction. PC-relative addresses are 32
24887 bits. Absolute addresses support the full address range.
24889 @item -mcmodel=large
24890 @opindex mcmodel=large
24891 Generate code for the large model. There is no limitation on call
24892 distance, pc-relative addresses, or absolute addresses.
24894 @item -mcpu=@var{name}
24896 Selects the type of CPU to be targeted. Currently the only supported
24897 type is @samp{tilegx}.
24903 Generate code for a 32-bit or 64-bit environment. The 32-bit
24904 environment sets int, long, and pointer to 32 bits. The 64-bit
24905 environment sets int to 32 bits and long and pointer to 64 bits.
24908 @itemx -mlittle-endian
24909 @opindex mbig-endian
24910 @opindex mlittle-endian
24911 Generate code in big/little endian mode, respectively.
24914 @node TILEPro Options
24915 @subsection TILEPro Options
24916 @cindex TILEPro options
24918 These @samp{-m} options are supported on the TILEPro:
24921 @item -mcpu=@var{name}
24923 Selects the type of CPU to be targeted. Currently the only supported
24924 type is @samp{tilepro}.
24928 Generate code for a 32-bit environment, which sets int, long, and
24929 pointer to 32 bits. This is the only supported behavior so the flag
24930 is essentially ignored.
24934 @subsection V850 Options
24935 @cindex V850 Options
24937 These @samp{-m} options are defined for V850 implementations:
24941 @itemx -mno-long-calls
24942 @opindex mlong-calls
24943 @opindex mno-long-calls
24944 Treat all calls as being far away (near). If calls are assumed to be
24945 far away, the compiler always loads the function's address into a
24946 register, and calls indirect through the pointer.
24952 Do not optimize (do optimize) basic blocks that use the same index
24953 pointer 4 or more times to copy pointer into the @code{ep} register, and
24954 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
24955 option is on by default if you optimize.
24957 @item -mno-prolog-function
24958 @itemx -mprolog-function
24959 @opindex mno-prolog-function
24960 @opindex mprolog-function
24961 Do not use (do use) external functions to save and restore registers
24962 at the prologue and epilogue of a function. The external functions
24963 are slower, but use less code space if more than one function saves
24964 the same number of registers. The @option{-mprolog-function} option
24965 is on by default if you optimize.
24969 Try to make the code as small as possible. At present, this just turns
24970 on the @option{-mep} and @option{-mprolog-function} options.
24972 @item -mtda=@var{n}
24974 Put static or global variables whose size is @var{n} bytes or less into
24975 the tiny data area that register @code{ep} points to. The tiny data
24976 area can hold up to 256 bytes in total (128 bytes for byte references).
24978 @item -msda=@var{n}
24980 Put static or global variables whose size is @var{n} bytes or less into
24981 the small data area that register @code{gp} points to. The small data
24982 area can hold up to 64 kilobytes.
24984 @item -mzda=@var{n}
24986 Put static or global variables whose size is @var{n} bytes or less into
24987 the first 32 kilobytes of memory.
24991 Specify that the target processor is the V850.
24995 Specify that the target processor is the V850E3V5. The preprocessor
24996 constant @code{__v850e3v5__} is defined if this option is used.
25000 Specify that the target processor is the V850E3V5. This is an alias for
25001 the @option{-mv850e3v5} option.
25005 Specify that the target processor is the V850E2V3. The preprocessor
25006 constant @code{__v850e2v3__} is defined if this option is used.
25010 Specify that the target processor is the V850E2. The preprocessor
25011 constant @code{__v850e2__} is defined if this option is used.
25015 Specify that the target processor is the V850E1. The preprocessor
25016 constants @code{__v850e1__} and @code{__v850e__} are defined if
25017 this option is used.
25021 Specify that the target processor is the V850ES. This is an alias for
25022 the @option{-mv850e1} option.
25026 Specify that the target processor is the V850E@. The preprocessor
25027 constant @code{__v850e__} is defined if this option is used.
25029 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
25030 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
25031 are defined then a default target processor is chosen and the
25032 relevant @samp{__v850*__} preprocessor constant is defined.
25034 The preprocessor constants @code{__v850} and @code{__v851__} are always
25035 defined, regardless of which processor variant is the target.
25037 @item -mdisable-callt
25038 @itemx -mno-disable-callt
25039 @opindex mdisable-callt
25040 @opindex mno-disable-callt
25041 This option suppresses generation of the @code{CALLT} instruction for the
25042 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
25045 This option is enabled by default when the RH850 ABI is
25046 in use (see @option{-mrh850-abi}), and disabled by default when the
25047 GCC ABI is in use. If @code{CALLT} instructions are being generated
25048 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
25054 Pass on (or do not pass on) the @option{-mrelax} command-line option
25058 @itemx -mno-long-jumps
25059 @opindex mlong-jumps
25060 @opindex mno-long-jumps
25061 Disable (or re-enable) the generation of PC-relative jump instructions.
25064 @itemx -mhard-float
25065 @opindex msoft-float
25066 @opindex mhard-float
25067 Disable (or re-enable) the generation of hardware floating point
25068 instructions. This option is only significant when the target
25069 architecture is @samp{V850E2V3} or higher. If hardware floating point
25070 instructions are being generated then the C preprocessor symbol
25071 @code{__FPU_OK__} is defined, otherwise the symbol
25072 @code{__NO_FPU__} is defined.
25076 Enables the use of the e3v5 LOOP instruction. The use of this
25077 instruction is not enabled by default when the e3v5 architecture is
25078 selected because its use is still experimental.
25082 @opindex mrh850-abi
25084 Enables support for the RH850 version of the V850 ABI. This is the
25085 default. With this version of the ABI the following rules apply:
25089 Integer sized structures and unions are returned via a memory pointer
25090 rather than a register.
25093 Large structures and unions (more than 8 bytes in size) are passed by
25097 Functions are aligned to 16-bit boundaries.
25100 The @option{-m8byte-align} command-line option is supported.
25103 The @option{-mdisable-callt} command-line option is enabled by
25104 default. The @option{-mno-disable-callt} command-line option is not
25108 When this version of the ABI is enabled the C preprocessor symbol
25109 @code{__V850_RH850_ABI__} is defined.
25113 Enables support for the old GCC version of the V850 ABI. With this
25114 version of the ABI the following rules apply:
25118 Integer sized structures and unions are returned in register @code{r10}.
25121 Large structures and unions (more than 8 bytes in size) are passed by
25125 Functions are aligned to 32-bit boundaries, unless optimizing for
25129 The @option{-m8byte-align} command-line option is not supported.
25132 The @option{-mdisable-callt} command-line option is supported but not
25133 enabled by default.
25136 When this version of the ABI is enabled the C preprocessor symbol
25137 @code{__V850_GCC_ABI__} is defined.
25139 @item -m8byte-align
25140 @itemx -mno-8byte-align
25141 @opindex m8byte-align
25142 @opindex mno-8byte-align
25143 Enables support for @code{double} and @code{long long} types to be
25144 aligned on 8-byte boundaries. The default is to restrict the
25145 alignment of all objects to at most 4-bytes. When
25146 @option{-m8byte-align} is in effect the C preprocessor symbol
25147 @code{__V850_8BYTE_ALIGN__} is defined.
25150 @opindex mbig-switch
25151 Generate code suitable for big switch tables. Use this option only if
25152 the assembler/linker complain about out of range branches within a switch
25157 This option causes r2 and r5 to be used in the code generated by
25158 the compiler. This setting is the default.
25160 @item -mno-app-regs
25161 @opindex mno-app-regs
25162 This option causes r2 and r5 to be treated as fixed registers.
25167 @subsection VAX Options
25168 @cindex VAX options
25170 These @samp{-m} options are defined for the VAX:
25175 Do not output certain jump instructions (@code{aobleq} and so on)
25176 that the Unix assembler for the VAX cannot handle across long
25181 Do output those jump instructions, on the assumption that the
25182 GNU assembler is being used.
25186 Output code for G-format floating-point numbers instead of D-format.
25189 @node Visium Options
25190 @subsection Visium Options
25191 @cindex Visium options
25197 A program which performs file I/O and is destined to run on an MCM target
25198 should be linked with this option. It causes the libraries libc.a and
25199 libdebug.a to be linked. The program should be run on the target under
25200 the control of the GDB remote debugging stub.
25204 A program which performs file I/O and is destined to run on the simulator
25205 should be linked with option. This causes libraries libc.a and libsim.a to
25209 @itemx -mhard-float
25211 @opindex mhard-float
25212 Generate code containing floating-point instructions. This is the
25216 @itemx -msoft-float
25218 @opindex msoft-float
25219 Generate code containing library calls for floating-point.
25221 @option{-msoft-float} changes the calling convention in the output file;
25222 therefore, it is only useful if you compile @emph{all} of a program with
25223 this option. In particular, you need to compile @file{libgcc.a}, the
25224 library that comes with GCC, with @option{-msoft-float} in order for
25227 @item -mcpu=@var{cpu_type}
25229 Set the instruction set, register set, and instruction scheduling parameters
25230 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
25231 @samp{mcm}, @samp{gr5} and @samp{gr6}.
25233 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
25235 By default (unless configured otherwise), GCC generates code for the GR5
25236 variant of the Visium architecture.
25238 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
25239 architecture. The only difference from GR5 code is that the compiler will
25240 generate block move instructions.
25242 @item -mtune=@var{cpu_type}
25244 Set the instruction scheduling parameters for machine type @var{cpu_type},
25245 but do not set the instruction set or register set that the option
25246 @option{-mcpu=@var{cpu_type}} would.
25250 Generate code for the supervisor mode, where there are no restrictions on
25251 the access to general registers. This is the default.
25254 @opindex muser-mode
25255 Generate code for the user mode, where the access to some general registers
25256 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
25257 mode; on the GR6, only registers r29 to r31 are affected.
25261 @subsection VMS Options
25263 These @samp{-m} options are defined for the VMS implementations:
25266 @item -mvms-return-codes
25267 @opindex mvms-return-codes
25268 Return VMS condition codes from @code{main}. The default is to return POSIX-style
25269 condition (e.g.@ error) codes.
25271 @item -mdebug-main=@var{prefix}
25272 @opindex mdebug-main=@var{prefix}
25273 Flag the first routine whose name starts with @var{prefix} as the main
25274 routine for the debugger.
25278 Default to 64-bit memory allocation routines.
25280 @item -mpointer-size=@var{size}
25281 @opindex mpointer-size=@var{size}
25282 Set the default size of pointers. Possible options for @var{size} are
25283 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
25284 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
25285 The later option disables @code{pragma pointer_size}.
25288 @node VxWorks Options
25289 @subsection VxWorks Options
25290 @cindex VxWorks Options
25292 The options in this section are defined for all VxWorks targets.
25293 Options specific to the target hardware are listed with the other
25294 options for that target.
25299 GCC can generate code for both VxWorks kernels and real time processes
25300 (RTPs). This option switches from the former to the latter. It also
25301 defines the preprocessor macro @code{__RTP__}.
25304 @opindex non-static
25305 Link an RTP executable against shared libraries rather than static
25306 libraries. The options @option{-static} and @option{-shared} can
25307 also be used for RTPs (@pxref{Link Options}); @option{-static}
25314 These options are passed down to the linker. They are defined for
25315 compatibility with Diab.
25318 @opindex Xbind-lazy
25319 Enable lazy binding of function calls. This option is equivalent to
25320 @option{-Wl,-z,now} and is defined for compatibility with Diab.
25324 Disable lazy binding of function calls. This option is the default and
25325 is defined for compatibility with Diab.
25329 @subsection x86 Options
25330 @cindex x86 Options
25332 These @samp{-m} options are defined for the x86 family of computers.
25336 @item -march=@var{cpu-type}
25338 Generate instructions for the machine type @var{cpu-type}. In contrast to
25339 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
25340 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
25341 to generate code that may not run at all on processors other than the one
25342 indicated. Specifying @option{-march=@var{cpu-type}} implies
25343 @option{-mtune=@var{cpu-type}}.
25345 The choices for @var{cpu-type} are:
25349 This selects the CPU to generate code for at compilation time by determining
25350 the processor type of the compiling machine. Using @option{-march=native}
25351 enables all instruction subsets supported by the local machine (hence
25352 the result might not run on different machines). Using @option{-mtune=native}
25353 produces code optimized for the local machine under the constraints
25354 of the selected instruction set.
25357 Original Intel i386 CPU@.
25360 Intel i486 CPU@. (No scheduling is implemented for this chip.)
25364 Intel Pentium CPU with no MMX support.
25367 Intel Lakemont MCU, based on Intel Pentium CPU.
25370 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
25373 Intel Pentium Pro CPU@.
25376 When used with @option{-march}, the Pentium Pro
25377 instruction set is used, so the code runs on all i686 family chips.
25378 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
25381 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
25386 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
25390 Intel Pentium M; low-power version of Intel Pentium III CPU
25391 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
25395 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
25398 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
25402 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
25403 SSE2 and SSE3 instruction set support.
25406 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
25407 instruction set support.
25410 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
25411 SSE4.1, SSE4.2 and POPCNT instruction set support.
25414 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
25415 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
25418 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
25419 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
25422 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
25423 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
25424 instruction set support.
25427 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
25428 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
25429 BMI, BMI2 and F16C instruction set support.
25432 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
25433 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
25434 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
25437 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
25438 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
25439 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
25440 XSAVES instruction set support.
25443 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
25444 instruction set support.
25447 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
25448 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
25451 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
25452 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
25453 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
25454 AVX512CD instruction set support.
25457 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
25458 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
25459 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
25460 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
25462 @item skylake-avx512
25463 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
25464 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
25465 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
25466 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
25469 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
25470 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
25471 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
25472 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
25473 AVX512IFMA, SHA, CLWB and UMIP instruction set support.
25476 AMD K6 CPU with MMX instruction set support.
25480 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
25483 @itemx athlon-tbird
25484 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
25490 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
25491 instruction set support.
25497 Processors based on the AMD K8 core with x86-64 instruction set support,
25498 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
25499 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
25500 instruction set extensions.)
25503 @itemx opteron-sse3
25504 @itemx athlon64-sse3
25505 Improved versions of AMD K8 cores with SSE3 instruction set support.
25509 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
25510 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
25511 instruction set extensions.)
25514 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
25515 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
25516 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
25518 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
25519 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
25520 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
25523 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
25524 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
25525 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
25526 64-bit instruction set extensions.
25528 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
25529 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
25530 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
25531 SSE4.2, ABM and 64-bit instruction set extensions.
25534 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
25535 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
25536 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
25537 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
25538 instruction set extensions.
25541 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
25542 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
25543 instruction set extensions.)
25546 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
25547 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
25548 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
25551 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
25555 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
25556 instruction set support.
25559 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
25560 (No scheduling is implemented for this chip.)
25563 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
25564 (No scheduling is implemented for this chip.)
25567 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
25568 (No scheduling is implemented for this chip.)
25571 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
25572 (No scheduling is implemented for this chip.)
25575 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
25576 (No scheduling is implemented for this chip.)
25579 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
25580 (No scheduling is implemented for this chip.)
25583 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
25584 (No scheduling is implemented for this chip.)
25587 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
25588 AVX and AVX2 instruction set support.
25589 (No scheduling is implemented for this chip.)
25592 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25593 instruction set support.
25594 (No scheduling is implemented for this chip.)
25597 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25598 instruction set support.
25599 (No scheduling is implemented for this chip.)
25602 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25603 instruction set support.
25604 (No scheduling is implemented for this chip.)
25607 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
25608 instruction set support.
25609 (No scheduling is implemented for this chip.)
25612 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
25613 instruction set support.
25614 (No scheduling is implemented for this chip.)
25617 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
25618 instruction set support.
25619 (No scheduling is implemented for this chip.)
25622 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
25625 @item -mtune=@var{cpu-type}
25627 Tune to @var{cpu-type} everything applicable about the generated code, except
25628 for the ABI and the set of available instructions.
25629 While picking a specific @var{cpu-type} schedules things appropriately
25630 for that particular chip, the compiler does not generate any code that
25631 cannot run on the default machine type unless you use a
25632 @option{-march=@var{cpu-type}} option.
25633 For example, if GCC is configured for i686-pc-linux-gnu
25634 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
25635 but still runs on i686 machines.
25637 The choices for @var{cpu-type} are the same as for @option{-march}.
25638 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
25642 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
25643 If you know the CPU on which your code will run, then you should use
25644 the corresponding @option{-mtune} or @option{-march} option instead of
25645 @option{-mtune=generic}. But, if you do not know exactly what CPU users
25646 of your application will have, then you should use this option.
25648 As new processors are deployed in the marketplace, the behavior of this
25649 option will change. Therefore, if you upgrade to a newer version of
25650 GCC, code generation controlled by this option will change to reflect
25652 that are most common at the time that version of GCC is released.
25654 There is no @option{-march=generic} option because @option{-march}
25655 indicates the instruction set the compiler can use, and there is no
25656 generic instruction set applicable to all processors. In contrast,
25657 @option{-mtune} indicates the processor (or, in this case, collection of
25658 processors) for which the code is optimized.
25661 Produce code optimized for the most current Intel processors, which are
25662 Haswell and Silvermont for this version of GCC. If you know the CPU
25663 on which your code will run, then you should use the corresponding
25664 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
25665 But, if you want your application performs better on both Haswell and
25666 Silvermont, then you should use this option.
25668 As new Intel processors are deployed in the marketplace, the behavior of
25669 this option will change. Therefore, if you upgrade to a newer version of
25670 GCC, code generation controlled by this option will change to reflect
25671 the most current Intel processors at the time that version of GCC is
25674 There is no @option{-march=intel} option because @option{-march} indicates
25675 the instruction set the compiler can use, and there is no common
25676 instruction set applicable to all processors. In contrast,
25677 @option{-mtune} indicates the processor (or, in this case, collection of
25678 processors) for which the code is optimized.
25681 @item -mcpu=@var{cpu-type}
25683 A deprecated synonym for @option{-mtune}.
25685 @item -mfpmath=@var{unit}
25687 Generate floating-point arithmetic for selected unit @var{unit}. The choices
25688 for @var{unit} are:
25692 Use the standard 387 floating-point coprocessor present on the majority of chips and
25693 emulated otherwise. Code compiled with this option runs almost everywhere.
25694 The temporary results are computed in 80-bit precision instead of the precision
25695 specified by the type, resulting in slightly different results compared to most
25696 of other chips. See @option{-ffloat-store} for more detailed description.
25698 This is the default choice for non-Darwin x86-32 targets.
25701 Use scalar floating-point instructions present in the SSE instruction set.
25702 This instruction set is supported by Pentium III and newer chips,
25703 and in the AMD line
25704 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
25705 instruction set supports only single-precision arithmetic, thus the double and
25706 extended-precision arithmetic are still done using 387. A later version, present
25707 only in Pentium 4 and AMD x86-64 chips, supports double-precision
25710 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
25711 or @option{-msse2} switches to enable SSE extensions and make this option
25712 effective. For the x86-64 compiler, these extensions are enabled by default.
25714 The resulting code should be considerably faster in the majority of cases and avoid
25715 the numerical instability problems of 387 code, but may break some existing
25716 code that expects temporaries to be 80 bits.
25718 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
25719 and the default choice for x86-32 targets with the SSE2 instruction set
25720 when @option{-ffast-math} is enabled.
25725 Attempt to utilize both instruction sets at once. This effectively doubles the
25726 amount of available registers, and on chips with separate execution units for
25727 387 and SSE the execution resources too. Use this option with care, as it is
25728 still experimental, because the GCC register allocator does not model separate
25729 functional units well, resulting in unstable performance.
25732 @item -masm=@var{dialect}
25733 @opindex masm=@var{dialect}
25734 Output assembly instructions using selected @var{dialect}. Also affects
25735 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
25736 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
25737 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
25738 not support @samp{intel}.
25741 @itemx -mno-ieee-fp
25743 @opindex mno-ieee-fp
25744 Control whether or not the compiler uses IEEE floating-point
25745 comparisons. These correctly handle the case where the result of a
25746 comparison is unordered.
25751 @opindex mhard-float
25752 Generate output containing 80387 instructions for floating point.
25757 @opindex msoft-float
25758 Generate output containing library calls for floating point.
25760 @strong{Warning:} the requisite libraries are not part of GCC@.
25761 Normally the facilities of the machine's usual C compiler are used, but
25762 this cannot be done directly in cross-compilation. You must make your
25763 own arrangements to provide suitable library functions for
25766 On machines where a function returns floating-point results in the 80387
25767 register stack, some floating-point opcodes may be emitted even if
25768 @option{-msoft-float} is used.
25770 @item -mno-fp-ret-in-387
25771 @opindex mno-fp-ret-in-387
25772 Do not use the FPU registers for return values of functions.
25774 The usual calling convention has functions return values of types
25775 @code{float} and @code{double} in an FPU register, even if there
25776 is no FPU@. The idea is that the operating system should emulate
25779 The option @option{-mno-fp-ret-in-387} causes such values to be returned
25780 in ordinary CPU registers instead.
25782 @item -mno-fancy-math-387
25783 @opindex mno-fancy-math-387
25784 Some 387 emulators do not support the @code{sin}, @code{cos} and
25785 @code{sqrt} instructions for the 387. Specify this option to avoid
25786 generating those instructions. This option is the default on
25787 OpenBSD and NetBSD@. This option is overridden when @option{-march}
25788 indicates that the target CPU always has an FPU and so the
25789 instruction does not need emulation. These
25790 instructions are not generated unless you also use the
25791 @option{-funsafe-math-optimizations} switch.
25793 @item -malign-double
25794 @itemx -mno-align-double
25795 @opindex malign-double
25796 @opindex mno-align-double
25797 Control whether GCC aligns @code{double}, @code{long double}, and
25798 @code{long long} variables on a two-word boundary or a one-word
25799 boundary. Aligning @code{double} variables on a two-word boundary
25800 produces code that runs somewhat faster on a Pentium at the
25801 expense of more memory.
25803 On x86-64, @option{-malign-double} is enabled by default.
25805 @strong{Warning:} if you use the @option{-malign-double} switch,
25806 structures containing the above types are aligned differently than
25807 the published application binary interface specifications for the x86-32
25808 and are not binary compatible with structures in code compiled
25809 without that switch.
25811 @item -m96bit-long-double
25812 @itemx -m128bit-long-double
25813 @opindex m96bit-long-double
25814 @opindex m128bit-long-double
25815 These switches control the size of @code{long double} type. The x86-32
25816 application binary interface specifies the size to be 96 bits,
25817 so @option{-m96bit-long-double} is the default in 32-bit mode.
25819 Modern architectures (Pentium and newer) prefer @code{long double}
25820 to be aligned to an 8- or 16-byte boundary. In arrays or structures
25821 conforming to the ABI, this is not possible. So specifying
25822 @option{-m128bit-long-double} aligns @code{long double}
25823 to a 16-byte boundary by padding the @code{long double} with an additional
25826 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
25827 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
25829 Notice that neither of these options enable any extra precision over the x87
25830 standard of 80 bits for a @code{long double}.
25832 @strong{Warning:} if you override the default value for your target ABI, this
25833 changes the size of
25834 structures and arrays containing @code{long double} variables,
25835 as well as modifying the function calling convention for functions taking
25836 @code{long double}. Hence they are not binary-compatible
25837 with code compiled without that switch.
25839 @item -mlong-double-64
25840 @itemx -mlong-double-80
25841 @itemx -mlong-double-128
25842 @opindex mlong-double-64
25843 @opindex mlong-double-80
25844 @opindex mlong-double-128
25845 These switches control the size of @code{long double} type. A size
25846 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25847 type. This is the default for 32-bit Bionic C library. A size
25848 of 128 bits makes the @code{long double} type equivalent to the
25849 @code{__float128} type. This is the default for 64-bit Bionic C library.
25851 @strong{Warning:} if you override the default value for your target ABI, this
25852 changes the size of
25853 structures and arrays containing @code{long double} variables,
25854 as well as modifying the function calling convention for functions taking
25855 @code{long double}. Hence they are not binary-compatible
25856 with code compiled without that switch.
25858 @item -malign-data=@var{type}
25859 @opindex malign-data
25860 Control how GCC aligns variables. Supported values for @var{type} are
25861 @samp{compat} uses increased alignment value compatible uses GCC 4.8
25862 and earlier, @samp{abi} uses alignment value as specified by the
25863 psABI, and @samp{cacheline} uses increased alignment value to match
25864 the cache line size. @samp{compat} is the default.
25866 @item -mlarge-data-threshold=@var{threshold}
25867 @opindex mlarge-data-threshold
25868 When @option{-mcmodel=medium} is specified, data objects larger than
25869 @var{threshold} are placed in the large data section. This value must be the
25870 same across all objects linked into the binary, and defaults to 65535.
25874 Use a different function-calling convention, in which functions that
25875 take a fixed number of arguments return with the @code{ret @var{num}}
25876 instruction, which pops their arguments while returning. This saves one
25877 instruction in the caller since there is no need to pop the arguments
25880 You can specify that an individual function is called with this calling
25881 sequence with the function attribute @code{stdcall}. You can also
25882 override the @option{-mrtd} option by using the function attribute
25883 @code{cdecl}. @xref{Function Attributes}.
25885 @strong{Warning:} this calling convention is incompatible with the one
25886 normally used on Unix, so you cannot use it if you need to call
25887 libraries compiled with the Unix compiler.
25889 Also, you must provide function prototypes for all functions that
25890 take variable numbers of arguments (including @code{printf});
25891 otherwise incorrect code is generated for calls to those
25894 In addition, seriously incorrect code results if you call a
25895 function with too many arguments. (Normally, extra arguments are
25896 harmlessly ignored.)
25898 @item -mregparm=@var{num}
25900 Control how many registers are used to pass integer arguments. By
25901 default, no registers are used to pass arguments, and at most 3
25902 registers can be used. You can control this behavior for a specific
25903 function by using the function attribute @code{regparm}.
25904 @xref{Function Attributes}.
25906 @strong{Warning:} if you use this switch, and
25907 @var{num} is nonzero, then you must build all modules with the same
25908 value, including any libraries. This includes the system libraries and
25912 @opindex msseregparm
25913 Use SSE register passing conventions for float and double arguments
25914 and return values. You can control this behavior for a specific
25915 function by using the function attribute @code{sseregparm}.
25916 @xref{Function Attributes}.
25918 @strong{Warning:} if you use this switch then you must build all
25919 modules with the same value, including any libraries. This includes
25920 the system libraries and startup modules.
25922 @item -mvect8-ret-in-mem
25923 @opindex mvect8-ret-in-mem
25924 Return 8-byte vectors in memory instead of MMX registers. This is the
25925 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
25926 Studio compilers until version 12. Later compiler versions (starting
25927 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
25928 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
25929 you need to remain compatible with existing code produced by those
25930 previous compiler versions or older versions of GCC@.
25939 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
25940 is specified, the significands of results of floating-point operations are
25941 rounded to 24 bits (single precision); @option{-mpc64} rounds the
25942 significands of results of floating-point operations to 53 bits (double
25943 precision) and @option{-mpc80} rounds the significands of results of
25944 floating-point operations to 64 bits (extended double precision), which is
25945 the default. When this option is used, floating-point operations in higher
25946 precisions are not available to the programmer without setting the FPU
25947 control word explicitly.
25949 Setting the rounding of floating-point operations to less than the default
25950 80 bits can speed some programs by 2% or more. Note that some mathematical
25951 libraries assume that extended-precision (80-bit) floating-point operations
25952 are enabled by default; routines in such libraries could suffer significant
25953 loss of accuracy, typically through so-called ``catastrophic cancellation'',
25954 when this option is used to set the precision to less than extended precision.
25956 @item -mstackrealign
25957 @opindex mstackrealign
25958 Realign the stack at entry. On the x86, the @option{-mstackrealign}
25959 option generates an alternate prologue and epilogue that realigns the
25960 run-time stack if necessary. This supports mixing legacy codes that keep
25961 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
25962 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
25963 applicable to individual functions.
25965 @item -mpreferred-stack-boundary=@var{num}
25966 @opindex mpreferred-stack-boundary
25967 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
25968 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
25969 the default is 4 (16 bytes or 128 bits).
25971 @strong{Warning:} When generating code for the x86-64 architecture with
25972 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
25973 used to keep the stack boundary aligned to 8 byte boundary. Since
25974 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
25975 intended to be used in controlled environment where stack space is
25976 important limitation. This option leads to wrong code when functions
25977 compiled with 16 byte stack alignment (such as functions from a standard
25978 library) are called with misaligned stack. In this case, SSE
25979 instructions may lead to misaligned memory access traps. In addition,
25980 variable arguments are handled incorrectly for 16 byte aligned
25981 objects (including x87 long double and __int128), leading to wrong
25982 results. You must build all modules with
25983 @option{-mpreferred-stack-boundary=3}, including any libraries. This
25984 includes the system libraries and startup modules.
25986 @item -mincoming-stack-boundary=@var{num}
25987 @opindex mincoming-stack-boundary
25988 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
25989 boundary. If @option{-mincoming-stack-boundary} is not specified,
25990 the one specified by @option{-mpreferred-stack-boundary} is used.
25992 On Pentium and Pentium Pro, @code{double} and @code{long double} values
25993 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
25994 suffer significant run time performance penalties. On Pentium III, the
25995 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
25996 properly if it is not 16-byte aligned.
25998 To ensure proper alignment of this values on the stack, the stack boundary
25999 must be as aligned as that required by any value stored on the stack.
26000 Further, every function must be generated such that it keeps the stack
26001 aligned. Thus calling a function compiled with a higher preferred
26002 stack boundary from a function compiled with a lower preferred stack
26003 boundary most likely misaligns the stack. It is recommended that
26004 libraries that use callbacks always use the default setting.
26006 This extra alignment does consume extra stack space, and generally
26007 increases code size. Code that is sensitive to stack space usage, such
26008 as embedded systems and operating system kernels, may want to reduce the
26009 preferred alignment to @option{-mpreferred-stack-boundary=2}.
26066 @itemx -mavx512ifma
26067 @opindex mavx512ifma
26069 @itemx -mavx512vbmi
26070 @opindex mavx512vbmi
26082 @opindex mclfushopt
26099 @itemx -mprefetchwt1
26100 @opindex mprefetchwt1
26164 @itemx -mavx512vbmi2
26165 @opindex mavx512vbmi2
26173 @itemx -mvpclmulqdq
26174 @opindex mvpclmulqdq
26176 @itemx -mavx512bitalg
26177 @opindex mavx512bitalg
26179 @itemx -mavx512vpopcntdq
26180 @opindex mavx512vpopcntdq
26181 These switches enable the use of instructions in the MMX, SSE,
26182 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
26183 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
26184 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES,
26185 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
26186 GFNI, VPCLMULQDQ, AVX512BITALG, AVX512VPOPCNTDQ3DNow!@: or enhanced 3DNow!@:
26187 extended instruction sets.
26188 Each has a corresponding @option{-mno-} option to disable use of these
26191 These extensions are also available as built-in functions: see
26192 @ref{x86 Built-in Functions}, for details of the functions enabled and
26193 disabled by these switches.
26195 To generate SSE/SSE2 instructions automatically from floating-point
26196 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
26198 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
26199 generates new AVX instructions or AVX equivalence for all SSEx instructions
26202 These options enable GCC to use these extended instructions in
26203 generated code, even without @option{-mfpmath=sse}. Applications that
26204 perform run-time CPU detection must compile separate files for each
26205 supported architecture, using the appropriate flags. In particular,
26206 the file containing the CPU detection code should be compiled without
26209 The @option{-mcet} option turns on the @option{-mibt} and @option{-mshstk}
26210 options. The @option{-mibt} option enables indirect branch tracking support
26211 and the @option{-mshstk} option enables shadow stack support from
26212 Intel Control-flow Enforcement Technology (CET). The compiler also provides
26213 a number of built-in functions for fine-grained control in a CET-based
26214 application. See @xref{x86 Built-in Functions}, for more information.
26216 @item -mdump-tune-features
26217 @opindex mdump-tune-features
26218 This option instructs GCC to dump the names of the x86 performance
26219 tuning features and default settings. The names can be used in
26220 @option{-mtune-ctrl=@var{feature-list}}.
26222 @item -mtune-ctrl=@var{feature-list}
26223 @opindex mtune-ctrl=@var{feature-list}
26224 This option is used to do fine grain control of x86 code generation features.
26225 @var{feature-list} is a comma separated list of @var{feature} names. See also
26226 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
26227 on if it is not preceded with @samp{^}, otherwise, it is turned off.
26228 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
26229 developers. Using it may lead to code paths not covered by testing and can
26230 potentially result in compiler ICEs or runtime errors.
26233 @opindex mno-default
26234 This option instructs GCC to turn off all tunable features. See also
26235 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
26239 This option instructs GCC to emit a @code{cld} instruction in the prologue
26240 of functions that use string instructions. String instructions depend on
26241 the DF flag to select between autoincrement or autodecrement mode. While the
26242 ABI specifies the DF flag to be cleared on function entry, some operating
26243 systems violate this specification by not clearing the DF flag in their
26244 exception dispatchers. The exception handler can be invoked with the DF flag
26245 set, which leads to wrong direction mode when string instructions are used.
26246 This option can be enabled by default on 32-bit x86 targets by configuring
26247 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
26248 instructions can be suppressed with the @option{-mno-cld} compiler option
26252 @opindex mvzeroupper
26253 This option instructs GCC to emit a @code{vzeroupper} instruction
26254 before a transfer of control flow out of the function to minimize
26255 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
26258 @item -mprefer-avx128
26259 @opindex mprefer-avx128
26260 This option instructs GCC to use 128-bit AVX instructions instead of
26261 256-bit AVX instructions in the auto-vectorizer.
26263 @item -mprefer-vector-width=@var{opt}
26264 @opindex mprefer-vector-width
26265 This option instructs GCC to use @var{opt}-bit vector width in instructions
26266 instead of default on the selected platform.
26270 No extra limitations applied to GCC other than defined by the selected platform.
26273 Prefer 128-bit vector width for instructions.
26276 Prefer 256-bit vector width for instructions.
26279 Prefer 512-bit vector width for instructions.
26284 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
26285 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
26286 objects. This is useful for atomic updates of data structures exceeding one
26287 machine word in size. The compiler uses this instruction to implement
26288 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
26289 128-bit integers, a library call is always used.
26293 This option enables generation of @code{SAHF} instructions in 64-bit code.
26294 Early Intel Pentium 4 CPUs with Intel 64 support,
26295 prior to the introduction of Pentium 4 G1 step in December 2005,
26296 lacked the @code{LAHF} and @code{SAHF} instructions
26297 which are supported by AMD64.
26298 These are load and store instructions, respectively, for certain status flags.
26299 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
26300 @code{drem}, and @code{remainder} built-in functions;
26301 see @ref{Other Builtins} for details.
26305 This option enables use of the @code{movbe} instruction to implement
26306 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
26310 This option tells the compiler to use indirect branch tracking support
26311 (for indirect calls and jumps) from x86 Control-flow Enforcement
26312 Technology (CET). The option has effect only if the
26313 @option{-fcf-protection=full} or @option{-fcf-protection=branch} option
26314 is specified. The option @option{-mibt} is on by default when the
26315 @code{-mcet} option is specified.
26319 This option tells the compiler to use shadow stack support (return
26320 address tracking) from x86 Control-flow Enforcement Technology (CET).
26321 The option has effect only if the @option{-fcf-protection=full} or
26322 @option{-fcf-protection=return} option is specified. The option
26323 @option{-mshstk} is on by default when the @option{-mcet} option is
26328 This option enables built-in functions @code{__builtin_ia32_crc32qi},
26329 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
26330 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
26334 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
26335 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
26336 with an additional Newton-Raphson step
26337 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
26338 (and their vectorized
26339 variants) for single-precision floating-point arguments. These instructions
26340 are generated only when @option{-funsafe-math-optimizations} is enabled
26341 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
26342 Note that while the throughput of the sequence is higher than the throughput
26343 of the non-reciprocal instruction, the precision of the sequence can be
26344 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
26346 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
26347 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
26348 combination), and doesn't need @option{-mrecip}.
26350 Also note that GCC emits the above sequence with additional Newton-Raphson step
26351 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
26352 already with @option{-ffast-math} (or the above option combination), and
26353 doesn't need @option{-mrecip}.
26355 @item -mrecip=@var{opt}
26356 @opindex mrecip=opt
26357 This option controls which reciprocal estimate instructions
26358 may be used. @var{opt} is a comma-separated list of options, which may
26359 be preceded by a @samp{!} to invert the option:
26363 Enable all estimate instructions.
26366 Enable the default instructions, equivalent to @option{-mrecip}.
26369 Disable all estimate instructions, equivalent to @option{-mno-recip}.
26372 Enable the approximation for scalar division.
26375 Enable the approximation for vectorized division.
26378 Enable the approximation for scalar square root.
26381 Enable the approximation for vectorized square root.
26384 So, for example, @option{-mrecip=all,!sqrt} enables
26385 all of the reciprocal approximations, except for square root.
26387 @item -mveclibabi=@var{type}
26388 @opindex mveclibabi
26389 Specifies the ABI type to use for vectorizing intrinsics using an
26390 external library. Supported values for @var{type} are @samp{svml}
26391 for the Intel short
26392 vector math library and @samp{acml} for the AMD math core library.
26393 To use this option, both @option{-ftree-vectorize} and
26394 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
26395 ABI-compatible library must be specified at link time.
26397 GCC currently emits calls to @code{vmldExp2},
26398 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
26399 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
26400 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
26401 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
26402 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
26403 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
26404 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
26405 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
26406 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
26407 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
26408 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
26409 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
26410 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
26411 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
26412 when @option{-mveclibabi=acml} is used.
26414 @item -mabi=@var{name}
26416 Generate code for the specified calling convention. Permissible values
26417 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
26418 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
26419 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
26420 You can control this behavior for specific functions by
26421 using the function attributes @code{ms_abi} and @code{sysv_abi}.
26422 @xref{Function Attributes}.
26424 @item -mforce-indirect-call
26425 @opindex mforce-indirect-call
26426 Force all calls to functions to be indirect. This is useful
26427 when using Intel Processor Trace where it generates more precise timing
26428 information for function calls.
26430 @item -mcall-ms2sysv-xlogues
26431 @opindex mcall-ms2sysv-xlogues
26432 @opindex mno-call-ms2sysv-xlogues
26433 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
26434 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
26435 default, the code for saving and restoring these registers is emitted inline,
26436 resulting in fairly lengthy prologues and epilogues. Using
26437 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
26438 use stubs in the static portion of libgcc to perform these saves and restores,
26439 thus reducing function size at the cost of a few extra instructions.
26441 @item -mtls-dialect=@var{type}
26442 @opindex mtls-dialect
26443 Generate code to access thread-local storage using the @samp{gnu} or
26444 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
26445 @samp{gnu2} is more efficient, but it may add compile- and run-time
26446 requirements that cannot be satisfied on all systems.
26449 @itemx -mno-push-args
26450 @opindex mpush-args
26451 @opindex mno-push-args
26452 Use PUSH operations to store outgoing parameters. This method is shorter
26453 and usually equally fast as method using SUB/MOV operations and is enabled
26454 by default. In some cases disabling it may improve performance because of
26455 improved scheduling and reduced dependencies.
26457 @item -maccumulate-outgoing-args
26458 @opindex maccumulate-outgoing-args
26459 If enabled, the maximum amount of space required for outgoing arguments is
26460 computed in the function prologue. This is faster on most modern CPUs
26461 because of reduced dependencies, improved scheduling and reduced stack usage
26462 when the preferred stack boundary is not equal to 2. The drawback is a notable
26463 increase in code size. This switch implies @option{-mno-push-args}.
26467 Support thread-safe exception handling on MinGW. Programs that rely
26468 on thread-safe exception handling must compile and link all code with the
26469 @option{-mthreads} option. When compiling, @option{-mthreads} defines
26470 @option{-D_MT}; when linking, it links in a special thread helper library
26471 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
26473 @item -mms-bitfields
26474 @itemx -mno-ms-bitfields
26475 @opindex mms-bitfields
26476 @opindex mno-ms-bitfields
26478 Enable/disable bit-field layout compatible with the native Microsoft
26481 If @code{packed} is used on a structure, or if bit-fields are used,
26482 it may be that the Microsoft ABI lays out the structure differently
26483 than the way GCC normally does. Particularly when moving packed
26484 data between functions compiled with GCC and the native Microsoft compiler
26485 (either via function call or as data in a file), it may be necessary to access
26488 This option is enabled by default for Microsoft Windows
26489 targets. This behavior can also be controlled locally by use of variable
26490 or type attributes. For more information, see @ref{x86 Variable Attributes}
26491 and @ref{x86 Type Attributes}.
26493 The Microsoft structure layout algorithm is fairly simple with the exception
26494 of the bit-field packing.
26495 The padding and alignment of members of structures and whether a bit-field
26496 can straddle a storage-unit boundary are determine by these rules:
26499 @item Structure members are stored sequentially in the order in which they are
26500 declared: the first member has the lowest memory address and the last member
26503 @item Every data object has an alignment requirement. The alignment requirement
26504 for all data except structures, unions, and arrays is either the size of the
26505 object or the current packing size (specified with either the
26506 @code{aligned} attribute or the @code{pack} pragma),
26507 whichever is less. For structures, unions, and arrays,
26508 the alignment requirement is the largest alignment requirement of its members.
26509 Every object is allocated an offset so that:
26512 offset % alignment_requirement == 0
26515 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
26516 unit if the integral types are the same size and if the next bit-field fits
26517 into the current allocation unit without crossing the boundary imposed by the
26518 common alignment requirements of the bit-fields.
26521 MSVC interprets zero-length bit-fields in the following ways:
26524 @item If a zero-length bit-field is inserted between two bit-fields that
26525 are normally coalesced, the bit-fields are not coalesced.
26532 unsigned long bf_1 : 12;
26534 unsigned long bf_2 : 12;
26539 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
26540 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
26542 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
26543 alignment of the zero-length bit-field is greater than the member that follows it,
26544 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
26565 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
26566 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
26567 bit-field does not affect the alignment of @code{bar} or, as a result, the size
26570 Taking this into account, it is important to note the following:
26573 @item If a zero-length bit-field follows a normal bit-field, the type of the
26574 zero-length bit-field may affect the alignment of the structure as whole. For
26575 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
26576 normal bit-field, and is of type short.
26578 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
26579 still affect the alignment of the structure:
26590 Here, @code{t4} takes up 4 bytes.
26593 @item Zero-length bit-fields following non-bit-field members are ignored:
26605 Here, @code{t5} takes up 2 bytes.
26609 @item -mno-align-stringops
26610 @opindex mno-align-stringops
26611 Do not align the destination of inlined string operations. This switch reduces
26612 code size and improves performance in case the destination is already aligned,
26613 but GCC doesn't know about it.
26615 @item -minline-all-stringops
26616 @opindex minline-all-stringops
26617 By default GCC inlines string operations only when the destination is
26618 known to be aligned to least a 4-byte boundary.
26619 This enables more inlining and increases code
26620 size, but may improve performance of code that depends on fast
26621 @code{memcpy}, @code{strlen},
26622 and @code{memset} for short lengths.
26624 @item -minline-stringops-dynamically
26625 @opindex minline-stringops-dynamically
26626 For string operations of unknown size, use run-time checks with
26627 inline code for small blocks and a library call for large blocks.
26629 @item -mstringop-strategy=@var{alg}
26630 @opindex mstringop-strategy=@var{alg}
26631 Override the internal decision heuristic for the particular algorithm to use
26632 for inlining string operations. The allowed values for @var{alg} are:
26638 Expand using i386 @code{rep} prefix of the specified size.
26642 @itemx unrolled_loop
26643 Expand into an inline loop.
26646 Always use a library call.
26649 @item -mmemcpy-strategy=@var{strategy}
26650 @opindex mmemcpy-strategy=@var{strategy}
26651 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
26652 should be inlined and what inline algorithm to use when the expected size
26653 of the copy operation is known. @var{strategy}
26654 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
26655 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
26656 the max byte size with which inline algorithm @var{alg} is allowed. For the last
26657 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
26658 in the list must be specified in increasing order. The minimal byte size for
26659 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
26662 @item -mmemset-strategy=@var{strategy}
26663 @opindex mmemset-strategy=@var{strategy}
26664 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
26665 @code{__builtin_memset} expansion.
26667 @item -momit-leaf-frame-pointer
26668 @opindex momit-leaf-frame-pointer
26669 Don't keep the frame pointer in a register for leaf functions. This
26670 avoids the instructions to save, set up, and restore frame pointers and
26671 makes an extra register available in leaf functions. The option
26672 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
26673 which might make debugging harder.
26675 @item -mtls-direct-seg-refs
26676 @itemx -mno-tls-direct-seg-refs
26677 @opindex mtls-direct-seg-refs
26678 Controls whether TLS variables may be accessed with offsets from the
26679 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
26680 or whether the thread base pointer must be added. Whether or not this
26681 is valid depends on the operating system, and whether it maps the
26682 segment to cover the entire TLS area.
26684 For systems that use the GNU C Library, the default is on.
26687 @itemx -mno-sse2avx
26689 Specify that the assembler should encode SSE instructions with VEX
26690 prefix. The option @option{-mavx} turns this on by default.
26695 If profiling is active (@option{-pg}), put the profiling
26696 counter call before the prologue.
26697 Note: On x86 architectures the attribute @code{ms_hook_prologue}
26698 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
26700 @item -mrecord-mcount
26701 @itemx -mno-record-mcount
26702 @opindex mrecord-mcount
26703 If profiling is active (@option{-pg}), generate a __mcount_loc section
26704 that contains pointers to each profiling call. This is useful for
26705 automatically patching and out calls.
26708 @itemx -mno-nop-mcount
26709 @opindex mnop-mcount
26710 If profiling is active (@option{-pg}), generate the calls to
26711 the profiling functions as NOPs. This is useful when they
26712 should be patched in later dynamically. This is likely only
26713 useful together with @option{-mrecord-mcount}.
26715 @item -mskip-rax-setup
26716 @itemx -mno-skip-rax-setup
26717 @opindex mskip-rax-setup
26718 When generating code for the x86-64 architecture with SSE extensions
26719 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
26720 register when there are no variable arguments passed in vector registers.
26722 @strong{Warning:} Since RAX register is used to avoid unnecessarily
26723 saving vector registers on stack when passing variable arguments, the
26724 impacts of this option are callees may waste some stack space,
26725 misbehave or jump to a random location. GCC 4.4 or newer don't have
26726 those issues, regardless the RAX register value.
26729 @itemx -mno-8bit-idiv
26730 @opindex m8bit-idiv
26731 On some processors, like Intel Atom, 8-bit unsigned integer divide is
26732 much faster than 32-bit/64-bit integer divide. This option generates a
26733 run-time check. If both dividend and divisor are within range of 0
26734 to 255, 8-bit unsigned integer divide is used instead of
26735 32-bit/64-bit integer divide.
26737 @item -mavx256-split-unaligned-load
26738 @itemx -mavx256-split-unaligned-store
26739 @opindex mavx256-split-unaligned-load
26740 @opindex mavx256-split-unaligned-store
26741 Split 32-byte AVX unaligned load and store.
26743 @item -mstack-protector-guard=@var{guard}
26744 @itemx -mstack-protector-guard-reg=@var{reg}
26745 @itemx -mstack-protector-guard-offset=@var{offset}
26746 @opindex mstack-protector-guard
26747 @opindex mstack-protector-guard-reg
26748 @opindex mstack-protector-guard-offset
26749 Generate stack protection code using canary at @var{guard}. Supported
26750 locations are @samp{global} for global canary or @samp{tls} for per-thread
26751 canary in the TLS block (the default). This option has effect only when
26752 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
26754 With the latter choice the options
26755 @option{-mstack-protector-guard-reg=@var{reg}} and
26756 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
26757 which segment register (@code{%fs} or @code{%gs}) to use as base register
26758 for reading the canary, and from what offset from that base register.
26759 The default for those is as specified in the relevant ABI.
26761 @item -mmitigate-rop
26762 @opindex mmitigate-rop
26763 Try to avoid generating code sequences that contain unintended return
26764 opcodes, to mitigate against certain forms of attack. At the moment,
26765 this option is limited in what it can do and should not be relied
26766 on to provide serious protection.
26768 @item -mgeneral-regs-only
26769 @opindex mgeneral-regs-only
26770 Generate code that uses only the general-purpose registers. This
26771 prevents the compiler from using floating-point, vector, mask and bound
26776 These @samp{-m} switches are supported in addition to the above
26777 on x86-64 processors in 64-bit environments.
26790 Generate code for a 16-bit, 32-bit or 64-bit environment.
26791 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
26793 generates code that runs on any i386 system.
26795 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
26796 types to 64 bits, and generates code for the x86-64 architecture.
26797 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
26798 and @option{-mdynamic-no-pic} options.
26800 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
26802 generates code for the x86-64 architecture.
26804 The @option{-m16} option is the same as @option{-m32}, except for that
26805 it outputs the @code{.code16gcc} assembly directive at the beginning of
26806 the assembly output so that the binary can run in 16-bit mode.
26808 The @option{-miamcu} option generates code which conforms to Intel MCU
26809 psABI. It requires the @option{-m32} option to be turned on.
26811 @item -mno-red-zone
26812 @opindex mno-red-zone
26813 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
26814 by the x86-64 ABI; it is a 128-byte area beyond the location of the
26815 stack pointer that is not modified by signal or interrupt handlers
26816 and therefore can be used for temporary data without adjusting the stack
26817 pointer. The flag @option{-mno-red-zone} disables this red zone.
26819 @item -mcmodel=small
26820 @opindex mcmodel=small
26821 Generate code for the small code model: the program and its symbols must
26822 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
26823 Programs can be statically or dynamically linked. This is the default
26826 @item -mcmodel=kernel
26827 @opindex mcmodel=kernel
26828 Generate code for the kernel code model. The kernel runs in the
26829 negative 2 GB of the address space.
26830 This model has to be used for Linux kernel code.
26832 @item -mcmodel=medium
26833 @opindex mcmodel=medium
26834 Generate code for the medium model: the program is linked in the lower 2
26835 GB of the address space. Small symbols are also placed there. Symbols
26836 with sizes larger than @option{-mlarge-data-threshold} are put into
26837 large data or BSS sections and can be located above 2GB. Programs can
26838 be statically or dynamically linked.
26840 @item -mcmodel=large
26841 @opindex mcmodel=large
26842 Generate code for the large model. This model makes no assumptions
26843 about addresses and sizes of sections.
26845 @item -maddress-mode=long
26846 @opindex maddress-mode=long
26847 Generate code for long address mode. This is only supported for 64-bit
26848 and x32 environments. It is the default address mode for 64-bit
26851 @item -maddress-mode=short
26852 @opindex maddress-mode=short
26853 Generate code for short address mode. This is only supported for 32-bit
26854 and x32 environments. It is the default address mode for 32-bit and
26858 @node x86 Windows Options
26859 @subsection x86 Windows Options
26860 @cindex x86 Windows Options
26861 @cindex Windows Options for x86
26863 These additional options are available for Microsoft Windows targets:
26869 specifies that a console application is to be generated, by
26870 instructing the linker to set the PE header subsystem type
26871 required for console applications.
26872 This option is available for Cygwin and MinGW targets and is
26873 enabled by default on those targets.
26877 This option is available for Cygwin and MinGW targets. It
26878 specifies that a DLL---a dynamic link library---is to be
26879 generated, enabling the selection of the required runtime
26880 startup object and entry point.
26882 @item -mnop-fun-dllimport
26883 @opindex mnop-fun-dllimport
26884 This option is available for Cygwin and MinGW targets. It
26885 specifies that the @code{dllimport} attribute should be ignored.
26889 This option is available for MinGW targets. It specifies
26890 that MinGW-specific thread support is to be used.
26894 This option is available for MinGW-w64 targets. It causes
26895 the @code{UNICODE} preprocessor macro to be predefined, and
26896 chooses Unicode-capable runtime startup code.
26900 This option is available for Cygwin and MinGW targets. It
26901 specifies that the typical Microsoft Windows predefined macros are to
26902 be set in the pre-processor, but does not influence the choice
26903 of runtime library/startup code.
26907 This option is available for Cygwin and MinGW targets. It
26908 specifies that a GUI application is to be generated by
26909 instructing the linker to set the PE header subsystem type
26912 @item -fno-set-stack-executable
26913 @opindex fno-set-stack-executable
26914 This option is available for MinGW targets. It specifies that
26915 the executable flag for the stack used by nested functions isn't
26916 set. This is necessary for binaries running in kernel mode of
26917 Microsoft Windows, as there the User32 API, which is used to set executable
26918 privileges, isn't available.
26920 @item -fwritable-relocated-rdata
26921 @opindex fno-writable-relocated-rdata
26922 This option is available for MinGW and Cygwin targets. It specifies
26923 that relocated-data in read-only section is put into the @code{.data}
26924 section. This is a necessary for older runtimes not supporting
26925 modification of @code{.rdata} sections for pseudo-relocation.
26927 @item -mpe-aligned-commons
26928 @opindex mpe-aligned-commons
26929 This option is available for Cygwin and MinGW targets. It
26930 specifies that the GNU extension to the PE file format that
26931 permits the correct alignment of COMMON variables should be
26932 used when generating code. It is enabled by default if
26933 GCC detects that the target assembler found during configuration
26934 supports the feature.
26937 See also under @ref{x86 Options} for standard options.
26939 @node Xstormy16 Options
26940 @subsection Xstormy16 Options
26941 @cindex Xstormy16 Options
26943 These options are defined for Xstormy16:
26948 Choose startup files and linker script suitable for the simulator.
26951 @node Xtensa Options
26952 @subsection Xtensa Options
26953 @cindex Xtensa Options
26955 These options are supported for Xtensa targets:
26959 @itemx -mno-const16
26961 @opindex mno-const16
26962 Enable or disable use of @code{CONST16} instructions for loading
26963 constant values. The @code{CONST16} instruction is currently not a
26964 standard option from Tensilica. When enabled, @code{CONST16}
26965 instructions are always used in place of the standard @code{L32R}
26966 instructions. The use of @code{CONST16} is enabled by default only if
26967 the @code{L32R} instruction is not available.
26970 @itemx -mno-fused-madd
26971 @opindex mfused-madd
26972 @opindex mno-fused-madd
26973 Enable or disable use of fused multiply/add and multiply/subtract
26974 instructions in the floating-point option. This has no effect if the
26975 floating-point option is not also enabled. Disabling fused multiply/add
26976 and multiply/subtract instructions forces the compiler to use separate
26977 instructions for the multiply and add/subtract operations. This may be
26978 desirable in some cases where strict IEEE 754-compliant results are
26979 required: the fused multiply add/subtract instructions do not round the
26980 intermediate result, thereby producing results with @emph{more} bits of
26981 precision than specified by the IEEE standard. Disabling fused multiply
26982 add/subtract instructions also ensures that the program output is not
26983 sensitive to the compiler's ability to combine multiply and add/subtract
26986 @item -mserialize-volatile
26987 @itemx -mno-serialize-volatile
26988 @opindex mserialize-volatile
26989 @opindex mno-serialize-volatile
26990 When this option is enabled, GCC inserts @code{MEMW} instructions before
26991 @code{volatile} memory references to guarantee sequential consistency.
26992 The default is @option{-mserialize-volatile}. Use
26993 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
26995 @item -mforce-no-pic
26996 @opindex mforce-no-pic
26997 For targets, like GNU/Linux, where all user-mode Xtensa code must be
26998 position-independent code (PIC), this option disables PIC for compiling
27001 @item -mtext-section-literals
27002 @itemx -mno-text-section-literals
27003 @opindex mtext-section-literals
27004 @opindex mno-text-section-literals
27005 These options control the treatment of literal pools. The default is
27006 @option{-mno-text-section-literals}, which places literals in a separate
27007 section in the output file. This allows the literal pool to be placed
27008 in a data RAM/ROM, and it also allows the linker to combine literal
27009 pools from separate object files to remove redundant literals and
27010 improve code size. With @option{-mtext-section-literals}, the literals
27011 are interspersed in the text section in order to keep them as close as
27012 possible to their references. This may be necessary for large assembly
27013 files. Literals for each function are placed right before that function.
27015 @item -mauto-litpools
27016 @itemx -mno-auto-litpools
27017 @opindex mauto-litpools
27018 @opindex mno-auto-litpools
27019 These options control the treatment of literal pools. The default is
27020 @option{-mno-auto-litpools}, which places literals in a separate
27021 section in the output file unless @option{-mtext-section-literals} is
27022 used. With @option{-mauto-litpools} the literals are interspersed in
27023 the text section by the assembler. Compiler does not produce explicit
27024 @code{.literal} directives and loads literals into registers with
27025 @code{MOVI} instructions instead of @code{L32R} to let the assembler
27026 do relaxation and place literals as necessary. This option allows
27027 assembler to create several literal pools per function and assemble
27028 very big functions, which may not be possible with
27029 @option{-mtext-section-literals}.
27031 @item -mtarget-align
27032 @itemx -mno-target-align
27033 @opindex mtarget-align
27034 @opindex mno-target-align
27035 When this option is enabled, GCC instructs the assembler to
27036 automatically align instructions to reduce branch penalties at the
27037 expense of some code density. The assembler attempts to widen density
27038 instructions to align branch targets and the instructions following call
27039 instructions. If there are not enough preceding safe density
27040 instructions to align a target, no widening is performed. The
27041 default is @option{-mtarget-align}. These options do not affect the
27042 treatment of auto-aligned instructions like @code{LOOP}, which the
27043 assembler always aligns, either by widening density instructions or
27044 by inserting NOP instructions.
27047 @itemx -mno-longcalls
27048 @opindex mlongcalls
27049 @opindex mno-longcalls
27050 When this option is enabled, GCC instructs the assembler to translate
27051 direct calls to indirect calls unless it can determine that the target
27052 of a direct call is in the range allowed by the call instruction. This
27053 translation typically occurs for calls to functions in other source
27054 files. Specifically, the assembler translates a direct @code{CALL}
27055 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
27056 The default is @option{-mno-longcalls}. This option should be used in
27057 programs where the call target can potentially be out of range. This
27058 option is implemented in the assembler, not the compiler, so the
27059 assembly code generated by GCC still shows direct call
27060 instructions---look at the disassembled object code to see the actual
27061 instructions. Note that the assembler uses an indirect call for
27062 every cross-file call, not just those that really are out of range.
27065 @node zSeries Options
27066 @subsection zSeries Options
27067 @cindex zSeries options
27069 These are listed under @xref{S/390 and zSeries Options}.
27075 @section Specifying Subprocesses and the Switches to Pass to Them
27078 @command{gcc} is a driver program. It performs its job by invoking a
27079 sequence of other programs to do the work of compiling, assembling and
27080 linking. GCC interprets its command-line parameters and uses these to
27081 deduce which programs it should invoke, and which command-line options
27082 it ought to place on their command lines. This behavior is controlled
27083 by @dfn{spec strings}. In most cases there is one spec string for each
27084 program that GCC can invoke, but a few programs have multiple spec
27085 strings to control their behavior. The spec strings built into GCC can
27086 be overridden by using the @option{-specs=} command-line switch to specify
27089 @dfn{Spec files} are plain-text files that are used to construct spec
27090 strings. They consist of a sequence of directives separated by blank
27091 lines. The type of directive is determined by the first non-whitespace
27092 character on the line, which can be one of the following:
27095 @item %@var{command}
27096 Issues a @var{command} to the spec file processor. The commands that can
27100 @item %include <@var{file}>
27101 @cindex @code{%include}
27102 Search for @var{file} and insert its text at the current point in the
27105 @item %include_noerr <@var{file}>
27106 @cindex @code{%include_noerr}
27107 Just like @samp{%include}, but do not generate an error message if the include
27108 file cannot be found.
27110 @item %rename @var{old_name} @var{new_name}
27111 @cindex @code{%rename}
27112 Rename the spec string @var{old_name} to @var{new_name}.
27116 @item *[@var{spec_name}]:
27117 This tells the compiler to create, override or delete the named spec
27118 string. All lines after this directive up to the next directive or
27119 blank line are considered to be the text for the spec string. If this
27120 results in an empty string then the spec is deleted. (Or, if the
27121 spec did not exist, then nothing happens.) Otherwise, if the spec
27122 does not currently exist a new spec is created. If the spec does
27123 exist then its contents are overridden by the text of this
27124 directive, unless the first character of that text is the @samp{+}
27125 character, in which case the text is appended to the spec.
27127 @item [@var{suffix}]:
27128 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
27129 and up to the next directive or blank line are considered to make up the
27130 spec string for the indicated suffix. When the compiler encounters an
27131 input file with the named suffix, it processes the spec string in
27132 order to work out how to compile that file. For example:
27136 z-compile -input %i
27139 This says that any input file whose name ends in @samp{.ZZ} should be
27140 passed to the program @samp{z-compile}, which should be invoked with the
27141 command-line switch @option{-input} and with the result of performing the
27142 @samp{%i} substitution. (See below.)
27144 As an alternative to providing a spec string, the text following a
27145 suffix directive can be one of the following:
27148 @item @@@var{language}
27149 This says that the suffix is an alias for a known @var{language}. This is
27150 similar to using the @option{-x} command-line switch to GCC to specify a
27151 language explicitly. For example:
27158 Says that .ZZ files are, in fact, C++ source files.
27161 This causes an error messages saying:
27164 @var{name} compiler not installed on this system.
27168 GCC already has an extensive list of suffixes built into it.
27169 This directive adds an entry to the end of the list of suffixes, but
27170 since the list is searched from the end backwards, it is effectively
27171 possible to override earlier entries using this technique.
27175 GCC has the following spec strings built into it. Spec files can
27176 override these strings or create their own. Note that individual
27177 targets can also add their own spec strings to this list.
27180 asm Options to pass to the assembler
27181 asm_final Options to pass to the assembler post-processor
27182 cpp Options to pass to the C preprocessor
27183 cc1 Options to pass to the C compiler
27184 cc1plus Options to pass to the C++ compiler
27185 endfile Object files to include at the end of the link
27186 link Options to pass to the linker
27187 lib Libraries to include on the command line to the linker
27188 libgcc Decides which GCC support library to pass to the linker
27189 linker Sets the name of the linker
27190 predefines Defines to be passed to the C preprocessor
27191 signed_char Defines to pass to CPP to say whether @code{char} is signed
27193 startfile Object files to include at the start of the link
27196 Here is a small example of a spec file:
27199 %rename lib old_lib
27202 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
27205 This example renames the spec called @samp{lib} to @samp{old_lib} and
27206 then overrides the previous definition of @samp{lib} with a new one.
27207 The new definition adds in some extra command-line options before
27208 including the text of the old definition.
27210 @dfn{Spec strings} are a list of command-line options to be passed to their
27211 corresponding program. In addition, the spec strings can contain
27212 @samp{%}-prefixed sequences to substitute variable text or to
27213 conditionally insert text into the command line. Using these constructs
27214 it is possible to generate quite complex command lines.
27216 Here is a table of all defined @samp{%}-sequences for spec
27217 strings. Note that spaces are not generated automatically around the
27218 results of expanding these sequences. Therefore you can concatenate them
27219 together or combine them with constant text in a single argument.
27223 Substitute one @samp{%} into the program name or argument.
27226 Substitute the name of the input file being processed.
27229 Substitute the basename of the input file being processed.
27230 This is the substring up to (and not including) the last period
27231 and not including the directory.
27234 This is the same as @samp{%b}, but include the file suffix (text after
27238 Marks the argument containing or following the @samp{%d} as a
27239 temporary file name, so that that file is deleted if GCC exits
27240 successfully. Unlike @samp{%g}, this contributes no text to the
27243 @item %g@var{suffix}
27244 Substitute a file name that has suffix @var{suffix} and is chosen
27245 once per compilation, and mark the argument in the same way as
27246 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
27247 name is now chosen in a way that is hard to predict even when previously
27248 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
27249 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
27250 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
27251 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
27252 was simply substituted with a file name chosen once per compilation,
27253 without regard to any appended suffix (which was therefore treated
27254 just like ordinary text), making such attacks more likely to succeed.
27256 @item %u@var{suffix}
27257 Like @samp{%g}, but generates a new temporary file name
27258 each time it appears instead of once per compilation.
27260 @item %U@var{suffix}
27261 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
27262 new one if there is no such last file name. In the absence of any
27263 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
27264 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
27265 involves the generation of two distinct file names, one
27266 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
27267 simply substituted with a file name chosen for the previous @samp{%u},
27268 without regard to any appended suffix.
27270 @item %j@var{suffix}
27271 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
27272 writable, and if @option{-save-temps} is not used;
27273 otherwise, substitute the name
27274 of a temporary file, just like @samp{%u}. This temporary file is not
27275 meant for communication between processes, but rather as a junk
27276 disposal mechanism.
27278 @item %|@var{suffix}
27279 @itemx %m@var{suffix}
27280 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
27281 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
27282 all. These are the two most common ways to instruct a program that it
27283 should read from standard input or write to standard output. If you
27284 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
27285 construct: see for example @file{f/lang-specs.h}.
27287 @item %.@var{SUFFIX}
27288 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
27289 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
27290 terminated by the next space or %.
27293 Marks the argument containing or following the @samp{%w} as the
27294 designated output file of this compilation. This puts the argument
27295 into the sequence of arguments that @samp{%o} substitutes.
27298 Substitutes the names of all the output files, with spaces
27299 automatically placed around them. You should write spaces
27300 around the @samp{%o} as well or the results are undefined.
27301 @samp{%o} is for use in the specs for running the linker.
27302 Input files whose names have no recognized suffix are not compiled
27303 at all, but they are included among the output files, so they are
27307 Substitutes the suffix for object files. Note that this is
27308 handled specially when it immediately follows @samp{%g, %u, or %U},
27309 because of the need for those to form complete file names. The
27310 handling is such that @samp{%O} is treated exactly as if it had already
27311 been substituted, except that @samp{%g, %u, and %U} do not currently
27312 support additional @var{suffix} characters following @samp{%O} as they do
27313 following, for example, @samp{.o}.
27316 Substitutes the standard macro predefinitions for the
27317 current target machine. Use this when running @command{cpp}.
27320 Like @samp{%p}, but puts @samp{__} before and after the name of each
27321 predefined macro, except for macros that start with @samp{__} or with
27322 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
27326 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
27327 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
27328 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
27329 and @option{-imultilib} as necessary.
27332 Current argument is the name of a library or startup file of some sort.
27333 Search for that file in a standard list of directories and substitute
27334 the full name found. The current working directory is included in the
27335 list of directories scanned.
27338 Current argument is the name of a linker script. Search for that file
27339 in the current list of directories to scan for libraries. If the file
27340 is located insert a @option{--script} option into the command line
27341 followed by the full path name found. If the file is not found then
27342 generate an error message. Note: the current working directory is not
27346 Print @var{str} as an error message. @var{str} is terminated by a newline.
27347 Use this when inconsistent options are detected.
27349 @item %(@var{name})
27350 Substitute the contents of spec string @var{name} at this point.
27352 @item %x@{@var{option}@}
27353 Accumulate an option for @samp{%X}.
27356 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
27360 Output the accumulated assembler options specified by @option{-Wa}.
27363 Output the accumulated preprocessor options specified by @option{-Wp}.
27366 Process the @code{asm} spec. This is used to compute the
27367 switches to be passed to the assembler.
27370 Process the @code{asm_final} spec. This is a spec string for
27371 passing switches to an assembler post-processor, if such a program is
27375 Process the @code{link} spec. This is the spec for computing the
27376 command line passed to the linker. Typically it makes use of the
27377 @samp{%L %G %S %D and %E} sequences.
27380 Dump out a @option{-L} option for each directory that GCC believes might
27381 contain startup files. If the target supports multilibs then the
27382 current multilib directory is prepended to each of these paths.
27385 Process the @code{lib} spec. This is a spec string for deciding which
27386 libraries are included on the command line to the linker.
27389 Process the @code{libgcc} spec. This is a spec string for deciding
27390 which GCC support library is included on the command line to the linker.
27393 Process the @code{startfile} spec. This is a spec for deciding which
27394 object files are the first ones passed to the linker. Typically
27395 this might be a file named @file{crt0.o}.
27398 Process the @code{endfile} spec. This is a spec string that specifies
27399 the last object files that are passed to the linker.
27402 Process the @code{cpp} spec. This is used to construct the arguments
27403 to be passed to the C preprocessor.
27406 Process the @code{cc1} spec. This is used to construct the options to be
27407 passed to the actual C compiler (@command{cc1}).
27410 Process the @code{cc1plus} spec. This is used to construct the options to be
27411 passed to the actual C++ compiler (@command{cc1plus}).
27414 Substitute the variable part of a matched option. See below.
27415 Note that each comma in the substituted string is replaced by
27419 Remove all occurrences of @code{-S} from the command line. Note---this
27420 command is position dependent. @samp{%} commands in the spec string
27421 before this one see @code{-S}, @samp{%} commands in the spec string
27422 after this one do not.
27424 @item %:@var{function}(@var{args})
27425 Call the named function @var{function}, passing it @var{args}.
27426 @var{args} is first processed as a nested spec string, then split
27427 into an argument vector in the usual fashion. The function returns
27428 a string which is processed as if it had appeared literally as part
27429 of the current spec.
27431 The following built-in spec functions are provided:
27434 @item @code{getenv}
27435 The @code{getenv} spec function takes two arguments: an environment
27436 variable name and a string. If the environment variable is not
27437 defined, a fatal error is issued. Otherwise, the return value is the
27438 value of the environment variable concatenated with the string. For
27439 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
27442 %:getenv(TOPDIR /include)
27445 expands to @file{/path/to/top/include}.
27447 @item @code{if-exists}
27448 The @code{if-exists} spec function takes one argument, an absolute
27449 pathname to a file. If the file exists, @code{if-exists} returns the
27450 pathname. Here is a small example of its usage:
27454 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
27457 @item @code{if-exists-else}
27458 The @code{if-exists-else} spec function is similar to the @code{if-exists}
27459 spec function, except that it takes two arguments. The first argument is
27460 an absolute pathname to a file. If the file exists, @code{if-exists-else}
27461 returns the pathname. If it does not exist, it returns the second argument.
27462 This way, @code{if-exists-else} can be used to select one file or another,
27463 based on the existence of the first. Here is a small example of its usage:
27467 crt0%O%s %:if-exists(crti%O%s) \
27468 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
27471 @item @code{replace-outfile}
27472 The @code{replace-outfile} spec function takes two arguments. It looks for the
27473 first argument in the outfiles array and replaces it with the second argument. Here
27474 is a small example of its usage:
27477 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
27480 @item @code{remove-outfile}
27481 The @code{remove-outfile} spec function takes one argument. It looks for the
27482 first argument in the outfiles array and removes it. Here is a small example
27486 %:remove-outfile(-lm)
27489 @item @code{pass-through-libs}
27490 The @code{pass-through-libs} spec function takes any number of arguments. It
27491 finds any @option{-l} options and any non-options ending in @file{.a} (which it
27492 assumes are the names of linker input library archive files) and returns a
27493 result containing all the found arguments each prepended by
27494 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
27495 intended to be passed to the LTO linker plugin.
27498 %:pass-through-libs(%G %L %G)
27501 @item @code{print-asm-header}
27502 The @code{print-asm-header} function takes no arguments and simply
27503 prints a banner like:
27509 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
27512 It is used to separate compiler options from assembler options
27513 in the @option{--target-help} output.
27517 Substitutes the @code{-S} switch, if that switch is given to GCC@.
27518 If that switch is not specified, this substitutes nothing. Note that
27519 the leading dash is omitted when specifying this option, and it is
27520 automatically inserted if the substitution is performed. Thus the spec
27521 string @samp{%@{foo@}} matches the command-line option @option{-foo}
27522 and outputs the command-line option @option{-foo}.
27525 Like %@{@code{S}@} but mark last argument supplied within as a file to be
27526 deleted on failure.
27529 Substitutes all the switches specified to GCC whose names start
27530 with @code{-S}, but which also take an argument. This is used for
27531 switches like @option{-o}, @option{-D}, @option{-I}, etc.
27532 GCC considers @option{-o foo} as being
27533 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
27534 text, including the space. Thus two arguments are generated.
27537 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
27538 (the order of @code{S} and @code{T} in the spec is not significant).
27539 There can be any number of ampersand-separated variables; for each the
27540 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
27543 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
27546 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
27549 Substitutes @code{X} if one or more switches whose names start with
27550 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
27551 once, no matter how many such switches appeared. However, if @code{%*}
27552 appears somewhere in @code{X}, then @code{X} is substituted once
27553 for each matching switch, with the @code{%*} replaced by the part of
27554 that switch matching the @code{*}.
27556 If @code{%*} appears as the last part of a spec sequence then a space
27557 is added after the end of the last substitution. If there is more
27558 text in the sequence, however, then a space is not generated. This
27559 allows the @code{%*} substitution to be used as part of a larger
27560 string. For example, a spec string like this:
27563 %@{mcu=*:--script=%*/memory.ld@}
27567 when matching an option like @option{-mcu=newchip} produces:
27570 --script=newchip/memory.ld
27574 Substitutes @code{X}, if processing a file with suffix @code{S}.
27577 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
27580 Substitutes @code{X}, if processing a file for language @code{S}.
27583 Substitutes @code{X}, if not processing a file for language @code{S}.
27586 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
27587 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
27588 @code{*} sequences as well, although they have a stronger binding than
27589 the @samp{|}. If @code{%*} appears in @code{X}, all of the
27590 alternatives must be starred, and only the first matching alternative
27593 For example, a spec string like this:
27596 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
27600 outputs the following command-line options from the following input
27601 command-line options:
27606 -d fred.c -foo -baz -boggle
27607 -d jim.d -bar -baz -boggle
27610 @item %@{S:X; T:Y; :D@}
27612 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
27613 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
27614 be as many clauses as you need. This may be combined with @code{.},
27615 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
27620 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
27621 or similar construct can use a backslash to ignore the special meaning
27622 of the character following it, thus allowing literal matching of a
27623 character that is otherwise specially treated. For example,
27624 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
27625 @option{-std=iso9899:1999} option is given.
27627 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
27628 construct may contain other nested @samp{%} constructs or spaces, or
27629 even newlines. They are processed as usual, as described above.
27630 Trailing white space in @code{X} is ignored. White space may also
27631 appear anywhere on the left side of the colon in these constructs,
27632 except between @code{.} or @code{*} and the corresponding word.
27634 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
27635 handled specifically in these constructs. If another value of
27636 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
27637 @option{-W} switch is found later in the command line, the earlier
27638 switch value is ignored, except with @{@code{S}*@} where @code{S} is
27639 just one letter, which passes all matching options.
27641 The character @samp{|} at the beginning of the predicate text is used to
27642 indicate that a command should be piped to the following command, but
27643 only if @option{-pipe} is specified.
27645 It is built into GCC which switches take arguments and which do not.
27646 (You might think it would be useful to generalize this to allow each
27647 compiler's spec to say which switches take arguments. But this cannot
27648 be done in a consistent fashion. GCC cannot even decide which input
27649 files have been specified without knowing which switches take arguments,
27650 and it must know which input files to compile in order to tell which
27653 GCC also knows implicitly that arguments starting in @option{-l} are to be
27654 treated as compiler output files, and passed to the linker in their
27655 proper position among the other output files.
27657 @node Environment Variables
27658 @section Environment Variables Affecting GCC
27659 @cindex environment variables
27661 @c man begin ENVIRONMENT
27662 This section describes several environment variables that affect how GCC
27663 operates. Some of them work by specifying directories or prefixes to use
27664 when searching for various kinds of files. Some are used to specify other
27665 aspects of the compilation environment.
27667 Note that you can also specify places to search using options such as
27668 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
27669 take precedence over places specified using environment variables, which
27670 in turn take precedence over those specified by the configuration of GCC@.
27671 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
27672 GNU Compiler Collection (GCC) Internals}.
27677 @c @itemx LC_COLLATE
27679 @c @itemx LC_MONETARY
27680 @c @itemx LC_NUMERIC
27685 @c @findex LC_COLLATE
27686 @findex LC_MESSAGES
27687 @c @findex LC_MONETARY
27688 @c @findex LC_NUMERIC
27692 These environment variables control the way that GCC uses
27693 localization information which allows GCC to work with different
27694 national conventions. GCC inspects the locale categories
27695 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
27696 so. These locale categories can be set to any value supported by your
27697 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
27698 Kingdom encoded in UTF-8.
27700 The @env{LC_CTYPE} environment variable specifies character
27701 classification. GCC uses it to determine the character boundaries in
27702 a string; this is needed for some multibyte encodings that contain quote
27703 and escape characters that are otherwise interpreted as a string
27706 The @env{LC_MESSAGES} environment variable specifies the language to
27707 use in diagnostic messages.
27709 If the @env{LC_ALL} environment variable is set, it overrides the value
27710 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
27711 and @env{LC_MESSAGES} default to the value of the @env{LANG}
27712 environment variable. If none of these variables are set, GCC
27713 defaults to traditional C English behavior.
27717 If @env{TMPDIR} is set, it specifies the directory to use for temporary
27718 files. GCC uses temporary files to hold the output of one stage of
27719 compilation which is to be used as input to the next stage: for example,
27720 the output of the preprocessor, which is the input to the compiler
27723 @item GCC_COMPARE_DEBUG
27724 @findex GCC_COMPARE_DEBUG
27725 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
27726 @option{-fcompare-debug} to the compiler driver. See the documentation
27727 of this option for more details.
27729 @item GCC_EXEC_PREFIX
27730 @findex GCC_EXEC_PREFIX
27731 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
27732 names of the subprograms executed by the compiler. No slash is added
27733 when this prefix is combined with the name of a subprogram, but you can
27734 specify a prefix that ends with a slash if you wish.
27736 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
27737 an appropriate prefix to use based on the pathname it is invoked with.
27739 If GCC cannot find the subprogram using the specified prefix, it
27740 tries looking in the usual places for the subprogram.
27742 The default value of @env{GCC_EXEC_PREFIX} is
27743 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
27744 the installed compiler. In many cases @var{prefix} is the value
27745 of @code{prefix} when you ran the @file{configure} script.
27747 Other prefixes specified with @option{-B} take precedence over this prefix.
27749 This prefix is also used for finding files such as @file{crt0.o} that are
27752 In addition, the prefix is used in an unusual way in finding the
27753 directories to search for header files. For each of the standard
27754 directories whose name normally begins with @samp{/usr/local/lib/gcc}
27755 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
27756 replacing that beginning with the specified prefix to produce an
27757 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
27758 @file{foo/bar} just before it searches the standard directory
27759 @file{/usr/local/lib/bar}.
27760 If a standard directory begins with the configured
27761 @var{prefix} then the value of @var{prefix} is replaced by
27762 @env{GCC_EXEC_PREFIX} when looking for header files.
27764 @item COMPILER_PATH
27765 @findex COMPILER_PATH
27766 The value of @env{COMPILER_PATH} is a colon-separated list of
27767 directories, much like @env{PATH}. GCC tries the directories thus
27768 specified when searching for subprograms, if it cannot find the
27769 subprograms using @env{GCC_EXEC_PREFIX}.
27772 @findex LIBRARY_PATH
27773 The value of @env{LIBRARY_PATH} is a colon-separated list of
27774 directories, much like @env{PATH}. When configured as a native compiler,
27775 GCC tries the directories thus specified when searching for special
27776 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
27777 using GCC also uses these directories when searching for ordinary
27778 libraries for the @option{-l} option (but directories specified with
27779 @option{-L} come first).
27783 @cindex locale definition
27784 This variable is used to pass locale information to the compiler. One way in
27785 which this information is used is to determine the character set to be used
27786 when character literals, string literals and comments are parsed in C and C++.
27787 When the compiler is configured to allow multibyte characters,
27788 the following values for @env{LANG} are recognized:
27792 Recognize JIS characters.
27794 Recognize SJIS characters.
27796 Recognize EUCJP characters.
27799 If @env{LANG} is not defined, or if it has some other value, then the
27800 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
27801 recognize and translate multibyte characters.
27805 Some additional environment variables affect the behavior of the
27808 @include cppenv.texi
27812 @node Precompiled Headers
27813 @section Using Precompiled Headers
27814 @cindex precompiled headers
27815 @cindex speed of compilation
27817 Often large projects have many header files that are included in every
27818 source file. The time the compiler takes to process these header files
27819 over and over again can account for nearly all of the time required to
27820 build the project. To make builds faster, GCC allows you to
27821 @dfn{precompile} a header file.
27823 To create a precompiled header file, simply compile it as you would any
27824 other file, if necessary using the @option{-x} option to make the driver
27825 treat it as a C or C++ header file. You may want to use a
27826 tool like @command{make} to keep the precompiled header up-to-date when
27827 the headers it contains change.
27829 A precompiled header file is searched for when @code{#include} is
27830 seen in the compilation. As it searches for the included file
27831 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
27832 compiler looks for a precompiled header in each directory just before it
27833 looks for the include file in that directory. The name searched for is
27834 the name specified in the @code{#include} with @samp{.gch} appended. If
27835 the precompiled header file cannot be used, it is ignored.
27837 For instance, if you have @code{#include "all.h"}, and you have
27838 @file{all.h.gch} in the same directory as @file{all.h}, then the
27839 precompiled header file is used if possible, and the original
27840 header is used otherwise.
27842 Alternatively, you might decide to put the precompiled header file in a
27843 directory and use @option{-I} to ensure that directory is searched
27844 before (or instead of) the directory containing the original header.
27845 Then, if you want to check that the precompiled header file is always
27846 used, you can put a file of the same name as the original header in this
27847 directory containing an @code{#error} command.
27849 This also works with @option{-include}. So yet another way to use
27850 precompiled headers, good for projects not designed with precompiled
27851 header files in mind, is to simply take most of the header files used by
27852 a project, include them from another header file, precompile that header
27853 file, and @option{-include} the precompiled header. If the header files
27854 have guards against multiple inclusion, they are skipped because
27855 they've already been included (in the precompiled header).
27857 If you need to precompile the same header file for different
27858 languages, targets, or compiler options, you can instead make a
27859 @emph{directory} named like @file{all.h.gch}, and put each precompiled
27860 header in the directory, perhaps using @option{-o}. It doesn't matter
27861 what you call the files in the directory; every precompiled header in
27862 the directory is considered. The first precompiled header
27863 encountered in the directory that is valid for this compilation is
27864 used; they're searched in no particular order.
27866 There are many other possibilities, limited only by your imagination,
27867 good sense, and the constraints of your build system.
27869 A precompiled header file can be used only when these conditions apply:
27873 Only one precompiled header can be used in a particular compilation.
27876 A precompiled header cannot be used once the first C token is seen. You
27877 can have preprocessor directives before a precompiled header; you cannot
27878 include a precompiled header from inside another header.
27881 The precompiled header file must be produced for the same language as
27882 the current compilation. You cannot use a C precompiled header for a C++
27886 The precompiled header file must have been produced by the same compiler
27887 binary as the current compilation is using.
27890 Any macros defined before the precompiled header is included must
27891 either be defined in the same way as when the precompiled header was
27892 generated, or must not affect the precompiled header, which usually
27893 means that they don't appear in the precompiled header at all.
27895 The @option{-D} option is one way to define a macro before a
27896 precompiled header is included; using a @code{#define} can also do it.
27897 There are also some options that define macros implicitly, like
27898 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
27901 @item If debugging information is output when using the precompiled
27902 header, using @option{-g} or similar, the same kind of debugging information
27903 must have been output when building the precompiled header. However,
27904 a precompiled header built using @option{-g} can be used in a compilation
27905 when no debugging information is being output.
27907 @item The same @option{-m} options must generally be used when building
27908 and using the precompiled header. @xref{Submodel Options},
27909 for any cases where this rule is relaxed.
27911 @item Each of the following options must be the same when building and using
27912 the precompiled header:
27914 @gccoptlist{-fexceptions}
27917 Some other command-line options starting with @option{-f},
27918 @option{-p}, or @option{-O} must be defined in the same way as when
27919 the precompiled header was generated. At present, it's not clear
27920 which options are safe to change and which are not; the safest choice
27921 is to use exactly the same options when generating and using the
27922 precompiled header. The following are known to be safe:
27924 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
27925 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
27926 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
27931 For all of these except the last, the compiler automatically
27932 ignores the precompiled header if the conditions aren't met. If you
27933 find an option combination that doesn't work and doesn't cause the
27934 precompiled header to be ignored, please consider filing a bug report,
27937 If you do use differing options when generating and using the
27938 precompiled header, the actual behavior is a mixture of the
27939 behavior for the options. For instance, if you use @option{-g} to
27940 generate the precompiled header but not when using it, you may or may
27941 not get debugging information for routines in the precompiled header.