1 @c Copyright (C) 1988-2016 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2016 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), adb(1), dbx(1), sdb(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
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 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
182 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
183 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
184 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness}
185 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
186 -fsigned-bitfields -fsigned-char @gol
187 -funsigned-bitfields -funsigned-char @gol
188 -trigraphs -traditional -traditional-cpp}
190 @item C++ Language Options
191 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
192 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
193 -fargs-in-order=@var{n} -fcheck-new @gol
194 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
195 -ffriend-injection @gol
196 -fno-elide-constructors @gol
197 -fno-enforce-eh-specs @gol
198 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
199 -fno-implicit-templates @gol
200 -fno-implicit-inline-templates @gol
201 -fno-implement-inlines -fms-extensions @gol
202 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
203 -fno-optional-diags -fpermissive @gol
204 -fno-pretty-templates @gol
205 -frepo -fno-rtti -fsized-deallocation @gol
206 -ftemplate-backtrace-limit=@var{n} @gol
207 -ftemplate-depth=@var{n} @gol
208 -fno-threadsafe-statics -fuse-cxa-atexit @gol
209 -fno-weak -nostdinc++ @gol
210 -fvisibility-inlines-hidden @gol
211 -fvisibility-ms-compat @gol
212 -fext-numeric-literals @gol
213 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
214 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
215 -Wnamespaces -Wnarrowing @gol
216 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
217 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
218 -Wno-non-template-friend -Wold-style-cast @gol
219 -Woverloaded-virtual -Wno-pmf-conversions @gol
220 -Wsign-promo -Wvirtual-inheritance}
222 @item Objective-C and Objective-C++ Language Options
223 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
224 Objective-C and Objective-C++ Dialects}.
225 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
226 -fgnu-runtime -fnext-runtime @gol
227 -fno-nil-receivers @gol
228 -fobjc-abi-version=@var{n} @gol
229 -fobjc-call-cxx-cdtors @gol
230 -fobjc-direct-dispatch @gol
231 -fobjc-exceptions @gol
234 -fobjc-std=objc1 @gol
235 -fno-local-ivars @gol
236 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
237 -freplace-objc-classes @gol
240 -Wassign-intercept @gol
241 -Wno-protocol -Wselector @gol
242 -Wstrict-selector-match @gol
243 -Wundeclared-selector}
245 @item Diagnostic Message Formatting Options
246 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
247 @gccoptlist{-fmessage-length=@var{n} @gol
248 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
249 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
250 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
251 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch}
253 @item Warning Options
254 @xref{Warning Options,,Options to Request or Suppress Warnings}.
255 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
256 -pedantic-errors @gol
257 -w -Wextra -Wall -Waddress -Waggregate-return @gol
258 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
259 -Wno-attributes -Wbool-compare -Wno-builtin-macro-redefined @gol
260 -Wc90-c99-compat -Wc99-c11-compat @gol
261 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
262 -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
263 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
264 -Wdelete-incomplete @gol
265 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
266 -Wdisabled-optimization @gol
267 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
268 -Wno-div-by-zero -Wdouble-promotion -Wduplicated-cond @gol
269 -Wempty-body -Wenum-compare -Wno-endif-labels @gol
270 -Werror -Werror=* -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
271 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
272 -Wformat-security -Wformat-signedness -Wformat-y2k -Wframe-address @gol
273 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
274 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
275 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
276 -Winit-self -Winline -Wno-int-conversion @gol
277 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
278 -Winvalid-pch -Wlarger-than=@var{len} @gol
279 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
280 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
281 -Wmisleading-indentation -Wmissing-braces @gol
282 -Wmissing-field-initializers -Wmissing-include-dirs @gol
283 -Wno-multichar -Wnonnull -Wnonnull-compare @gol
284 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
285 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
286 -Woverride-init-side-effects -Woverlength-strings @gol
287 -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
288 -Wparentheses -Wno-pedantic-ms-format @gol
289 -Wplacement-new -Wplacement-new=@var{n} @gol
290 -Wpointer-arith -Wno-pointer-to-int-cast @gol
291 -Wno-pragmas -Wredundant-decls -Wno-return-local-addr @gol
292 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
293 -Wshift-overflow -Wshift-overflow=@var{n} @gol
294 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
295 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
296 -Wno-scalar-storage-order @gol
297 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
298 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
299 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
300 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
301 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
302 -Wmissing-format-attribute -Wsubobject-linkage @gol
303 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
304 -Wswitch-unreachable -Wsync-nand @gol
305 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
306 -Wtype-limits -Wundef @gol
307 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
308 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
309 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
310 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
311 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
312 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
313 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
314 -Wvla -Wvolatile-register-var -Wwrite-strings @gol
315 -Wzero-as-null-pointer-constant -Whsa}
317 @item C and Objective-C-only Warning Options
318 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
319 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
320 -Wold-style-declaration -Wold-style-definition @gol
321 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
322 -Wdeclaration-after-statement -Wpointer-sign}
324 @item Debugging Options
325 @xref{Debugging Options,,Options for Debugging Your Program}.
326 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
327 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
328 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
329 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
330 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
331 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
332 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
333 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
334 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
335 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
336 -fvar-tracking -fvar-tracking-assignments}
338 @item Optimization Options
339 @xref{Optimize Options,,Options that Control Optimization}.
340 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
341 -falign-jumps[=@var{n}] @gol
342 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
343 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
344 -fauto-inc-dec -fbranch-probabilities @gol
345 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
346 -fbtr-bb-exclusive -fcaller-saves @gol
347 -fcombine-stack-adjustments -fconserve-stack @gol
348 -fcompare-elim -fcprop-registers -fcrossjumping @gol
349 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
350 -fcx-limited-range @gol
351 -fdata-sections -fdce -fdelayed-branch @gol
352 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
353 -fdevirtualize-at-ltrans -fdse @gol
354 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
355 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
356 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
357 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
358 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
359 -fif-conversion2 -findirect-inlining @gol
360 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
361 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment -fipa-bit-cp @gol
362 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
363 -fira-algorithm=@var{algorithm} @gol
364 -fira-region=@var{region} -fira-hoist-pressure @gol
365 -fira-loop-pressure -fno-ira-share-save-slots @gol
366 -fno-ira-share-spill-slots @gol
367 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
368 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
369 -fkeep-static-consts -flive-range-shrinkage @gol
370 -floop-block -floop-interchange -floop-strip-mine @gol
371 -floop-unroll-and-jam -floop-nest-optimize @gol
372 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
373 -flto-partition=@var{alg} -fmerge-all-constants @gol
374 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
375 -fmove-loop-invariants -fno-branch-count-reg @gol
376 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
377 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
378 -fno-peephole2 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
379 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
380 -fomit-frame-pointer -foptimize-sibling-calls @gol
381 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
382 -fprefetch-loop-arrays @gol
383 -fprofile-correction @gol
384 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
385 -fprofile-reorder-functions @gol
386 -freciprocal-math -free -frename-registers -freorder-blocks @gol
387 -freorder-blocks-algorithm=@var{algorithm} @gol
388 -freorder-blocks-and-partition -freorder-functions @gol
389 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
390 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
391 -fsched-spec-load -fsched-spec-load-dangerous @gol
392 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
393 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
394 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
395 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
396 -fschedule-fusion @gol
397 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
398 -fselective-scheduling -fselective-scheduling2 @gol
399 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
400 -fsemantic-interposition -fshrink-wrap -fsignaling-nans @gol
401 -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
403 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
404 -fstdarg-opt -fstrict-aliasing @gol
405 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
406 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
407 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
408 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting -ftree-loop-if-convert @gol
409 -ftree-loop-if-convert-stores -ftree-loop-im @gol
410 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
411 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
412 -ftree-loop-vectorize @gol
413 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
414 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
415 -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
416 -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
417 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
418 -funsafe-math-optimizations -funswitch-loops @gol
419 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
420 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
421 --param @var{name}=@var{value}
422 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
424 @item Program Instrumentation Options
425 @xref{Instrumentation Options,,Program Instrumentation Options}.
426 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
427 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
428 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
429 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
430 -fsanitize-undefined-trap-on-error -fbounds-check @gol
431 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
432 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
433 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
434 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
435 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
436 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
437 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
438 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
439 -fchkp-use-wrappers @gol
440 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
441 -fstack-protector-explicit -fstack-check @gol
442 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
443 -fno-stack-limit -fsplit-stack @gol
444 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
445 -fvtv-counts -fvtv-debug @gol
446 -finstrument-functions @gol
447 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
448 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
450 @item Preprocessor Options
451 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
452 @gccoptlist{-A@var{question}=@var{answer} @gol
453 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
454 -C -dD -dI -dM -dN @gol
455 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
456 -idirafter @var{dir} @gol
457 -include @var{file} -imacros @var{file} @gol
458 -iprefix @var{file} -iwithprefix @var{dir} @gol
459 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
460 -imultilib @var{dir} -isysroot @var{dir} @gol
461 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
462 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
463 -remap -trigraphs -undef -U@var{macro} @gol
464 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
466 @item Assembler Option
467 @xref{Assembler Options,,Passing Options to the Assembler}.
468 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
471 @xref{Link Options,,Options for Linking}.
472 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
473 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
474 -s -static -static-libgcc -static-libstdc++ @gol
475 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
476 -static-libmpx -static-libmpxwrappers @gol
477 -shared -shared-libgcc -symbolic @gol
478 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
479 -u @var{symbol} -z @var{keyword}}
481 @item Directory Options
482 @xref{Directory Options,,Options for Directory Search}.
483 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
484 -iquote@var{dir} -L@var{dir} -no-canonical-prefixes -I- @gol
485 --sysroot=@var{dir} --no-sysroot-suffix}
487 @item Code Generation Options
488 @xref{Code Gen Options,,Options for Code Generation Conventions}.
489 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
490 -ffixed-@var{reg} -fexceptions @gol
491 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
492 -fasynchronous-unwind-tables @gol
494 -finhibit-size-directive -fno-common -fno-ident @gol
495 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
496 -fno-jump-tables @gol
497 -frecord-gcc-switches @gol
498 -freg-struct-return -fshort-enums -fshort-wchar @gol
499 -fverbose-asm -fpack-struct[=@var{n}] @gol
500 -fleading-underscore -ftls-model=@var{model} @gol
501 -fstack-reuse=@var{reuse_level} @gol
503 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
504 -fstrict-volatile-bitfields -fsync-libcalls}
506 @item Developer Options
507 @xref{Developer Options,,GCC Developer Options}.
508 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
509 -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
510 -fdbg-cnt=@var{counter-value-list} @gol
511 -fdisable-ipa-@var{pass_name} @gol
512 -fdisable-rtl-@var{pass_name} @gol
513 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
514 -fdisable-tree-@var{pass_name} @gol
515 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
516 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
517 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
518 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
519 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
521 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
522 -fdump-statistics @gol
524 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
525 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
526 -fdump-tree-cfg -fdump-tree-alias @gol
528 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
529 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
530 -fdump-tree-gimple@r{[}-raw@r{]} @gol
531 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
532 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
533 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
534 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
535 -fdump-tree-backprop@r{[}-@var{n}@r{]} @gol
536 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
537 -fdump-tree-nrv -fdump-tree-vect @gol
538 -fdump-tree-sink @gol
539 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
540 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
541 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
542 -fdump-tree-vtable-verify @gol
543 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
544 -fdump-tree-split-paths@r{[}-@var{n}@r{]} @gol
545 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
546 -fdump-final-insns=@var{file} @gol
547 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
548 -fenable-@var{kind}-@var{pass} @gol
549 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
550 -fira-verbose=@var{n} @gol
551 -flto-report -flto-report-wpa -fmem-report-wpa @gol
552 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
553 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
554 -fprofile-report @gol
555 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
556 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
557 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
558 -fvar-tracking-assignments-toggle -gtoggle @gol
559 -print-file-name=@var{library} -print-libgcc-file-name @gol
560 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
561 -print-prog-name=@var{program} -print-search-dirs -Q @gol
562 -print-sysroot -print-sysroot-headers-suffix @gol
563 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
565 @item Machine-Dependent Options
566 @xref{Submodel Options,,Machine-Dependent Options}.
567 @c This list is ordered alphanumerically by subsection name.
568 @c Try and put the significant identifier (CPU or system) first,
569 @c so users have a clue at guessing where the ones they want will be.
571 @emph{AArch64 Options}
572 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
573 -mgeneral-regs-only @gol
574 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
576 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
577 -mtls-dialect=desc -mtls-dialect=traditional @gol
578 -mtls-size=@var{size} @gol
579 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
580 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol
581 -mlow-precision-recip-sqrt -mno-low-precision-recip-sqrt@gol
582 -mlow-precision-sqrt -mno-low-precision-sqrt@gol
583 -mlow-precision-div -mno-low-precision-div @gol
584 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
586 @emph{Adapteva Epiphany Options}
587 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
588 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
589 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
590 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
591 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
592 -msplit-vecmove-early -m1reg-@var{reg}}
595 @gccoptlist{-mbarrel-shifter @gol
596 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
597 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
598 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
599 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
600 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
601 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
602 -mlong-calls -mmedium-calls -msdata @gol
603 -mucb-mcount -mvolatile-cache -mtp-regno=@var{regno} @gol
604 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
605 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
606 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
607 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
608 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
609 -mtune=@var{cpu} -mmultcost=@var{num} @gol
610 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
611 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
614 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
615 -mabi=@var{name} @gol
616 -mapcs-stack-check -mno-apcs-stack-check @gol
617 -mapcs-float -mno-apcs-float @gol
618 -mapcs-reentrant -mno-apcs-reentrant @gol
619 -msched-prolog -mno-sched-prolog @gol
620 -mlittle-endian -mbig-endian @gol
621 -mfloat-abi=@var{name} @gol
622 -mfp16-format=@var{name}
623 -mthumb-interwork -mno-thumb-interwork @gol
624 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
625 -mtune=@var{name} -mprint-tune-info @gol
626 -mstructure-size-boundary=@var{n} @gol
627 -mabort-on-noreturn @gol
628 -mlong-calls -mno-long-calls @gol
629 -msingle-pic-base -mno-single-pic-base @gol
630 -mpic-register=@var{reg} @gol
631 -mnop-fun-dllimport @gol
632 -mpoke-function-name @gol
634 -mtpcs-frame -mtpcs-leaf-frame @gol
635 -mcaller-super-interworking -mcallee-super-interworking @gol
636 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
637 -mword-relocations @gol
638 -mfix-cortex-m3-ldrd @gol
639 -munaligned-access @gol
640 -mneon-for-64bits @gol
641 -mslow-flash-data @gol
642 -masm-syntax-unified @gol
646 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
647 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
648 -mrelax -mrmw -mstrict-X -mtiny-stack -mfract-convert-truncate -nodevicelib @gol
649 -Waddr-space-convert -Wmisspelled-isr}
651 @emph{Blackfin Options}
652 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
653 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
654 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
655 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
656 -mno-id-shared-library -mshared-library-id=@var{n} @gol
657 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
658 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
659 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
663 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
664 -msim -msdata=@var{sdata-type}}
667 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
668 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
669 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
670 -mstack-align -mdata-align -mconst-align @gol
671 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
672 -melf -maout -melinux -mlinux -sim -sim2 @gol
673 -mmul-bug-workaround -mno-mul-bug-workaround}
676 @gccoptlist{-mmac @gol
677 -mcr16cplus -mcr16c @gol
678 -msim -mint32 -mbit-ops
679 -mdata-model=@var{model}}
681 @emph{Darwin Options}
682 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
683 -arch_only -bind_at_load -bundle -bundle_loader @gol
684 -client_name -compatibility_version -current_version @gol
686 -dependency-file -dylib_file -dylinker_install_name @gol
687 -dynamic -dynamiclib -exported_symbols_list @gol
688 -filelist -flat_namespace -force_cpusubtype_ALL @gol
689 -force_flat_namespace -headerpad_max_install_names @gol
691 -image_base -init -install_name -keep_private_externs @gol
692 -multi_module -multiply_defined -multiply_defined_unused @gol
693 -noall_load -no_dead_strip_inits_and_terms @gol
694 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
695 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
696 -private_bundle -read_only_relocs -sectalign @gol
697 -sectobjectsymbols -whyload -seg1addr @gol
698 -sectcreate -sectobjectsymbols -sectorder @gol
699 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
700 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
701 -segprot -segs_read_only_addr -segs_read_write_addr @gol
702 -single_module -static -sub_library -sub_umbrella @gol
703 -twolevel_namespace -umbrella -undefined @gol
704 -unexported_symbols_list -weak_reference_mismatches @gol
705 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
706 -mkernel -mone-byte-bool}
708 @emph{DEC Alpha Options}
709 @gccoptlist{-mno-fp-regs -msoft-float @gol
710 -mieee -mieee-with-inexact -mieee-conformant @gol
711 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
712 -mtrap-precision=@var{mode} -mbuild-constants @gol
713 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
714 -mbwx -mmax -mfix -mcix @gol
715 -mfloat-vax -mfloat-ieee @gol
716 -mexplicit-relocs -msmall-data -mlarge-data @gol
717 -msmall-text -mlarge-text @gol
718 -mmemory-latency=@var{time}}
721 @gccoptlist{-msmall-model -mno-lsim}
724 @gccoptlist{-msim -mlra -mnodiv}
727 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
728 -mhard-float -msoft-float @gol
729 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
730 -mdouble -mno-double @gol
731 -mmedia -mno-media -mmuladd -mno-muladd @gol
732 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
733 -mlinked-fp -mlong-calls -malign-labels @gol
734 -mlibrary-pic -macc-4 -macc-8 @gol
735 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
736 -moptimize-membar -mno-optimize-membar @gol
737 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
738 -mvliw-branch -mno-vliw-branch @gol
739 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
740 -mno-nested-cond-exec -mtomcat-stats @gol
744 @emph{GNU/Linux Options}
745 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
746 -tno-android-cc -tno-android-ld}
748 @emph{H8/300 Options}
749 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
752 @gccoptlist{-march=@var{architecture-type} @gol
753 -mdisable-fpregs -mdisable-indexing @gol
754 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
755 -mfixed-range=@var{register-range} @gol
756 -mjump-in-delay -mlinker-opt -mlong-calls @gol
757 -mlong-load-store -mno-disable-fpregs @gol
758 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
759 -mno-jump-in-delay -mno-long-load-store @gol
760 -mno-portable-runtime -mno-soft-float @gol
761 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
762 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
763 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
764 -munix=@var{unix-std} -nolibdld -static -threads}
767 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
768 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
769 -mconstant-gp -mauto-pic -mfused-madd @gol
770 -minline-float-divide-min-latency @gol
771 -minline-float-divide-max-throughput @gol
772 -mno-inline-float-divide @gol
773 -minline-int-divide-min-latency @gol
774 -minline-int-divide-max-throughput @gol
775 -mno-inline-int-divide @gol
776 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
777 -mno-inline-sqrt @gol
778 -mdwarf2-asm -mearly-stop-bits @gol
779 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
780 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
781 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
782 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
783 -msched-spec-ldc -msched-spec-control-ldc @gol
784 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
785 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
786 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
787 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
790 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
791 -msign-extend-enabled -muser-enabled}
793 @emph{M32R/D Options}
794 @gccoptlist{-m32r2 -m32rx -m32r @gol
796 -malign-loops -mno-align-loops @gol
797 -missue-rate=@var{number} @gol
798 -mbranch-cost=@var{number} @gol
799 -mmodel=@var{code-size-model-type} @gol
800 -msdata=@var{sdata-type} @gol
801 -mno-flush-func -mflush-func=@var{name} @gol
802 -mno-flush-trap -mflush-trap=@var{number} @gol
806 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
808 @emph{M680x0 Options}
809 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
810 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
811 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
812 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
813 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
814 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
815 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
816 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
820 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
821 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
822 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
823 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
824 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
827 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
828 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
829 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
830 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
833 @emph{MicroBlaze Options}
834 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
835 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
836 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
837 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
838 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
841 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
842 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
843 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
844 -mips16 -mno-mips16 -mflip-mips16 @gol
845 -minterlink-compressed -mno-interlink-compressed @gol
846 -minterlink-mips16 -mno-interlink-mips16 @gol
847 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
848 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
849 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
850 -mno-float -msingle-float -mdouble-float @gol
851 -modd-spreg -mno-odd-spreg @gol
852 -mabs=@var{mode} -mnan=@var{encoding} @gol
853 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
856 -mvirt -mno-virt @gol
858 -mmicromips -mno-micromips @gol
860 -mfpu=@var{fpu-type} @gol
861 -msmartmips -mno-smartmips @gol
862 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
863 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
864 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
865 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
866 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
867 -membedded-data -mno-embedded-data @gol
868 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
869 -mcode-readable=@var{setting} @gol
870 -msplit-addresses -mno-split-addresses @gol
871 -mexplicit-relocs -mno-explicit-relocs @gol
872 -mcheck-zero-division -mno-check-zero-division @gol
873 -mdivide-traps -mdivide-breaks @gol
874 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
875 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
876 -mfix-24k -mno-fix-24k @gol
877 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
878 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
879 -mfix-vr4120 -mno-fix-vr4120 @gol
880 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
881 -mflush-func=@var{func} -mno-flush-func @gol
882 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
883 -mcompact-branches=@var{policy} @gol
884 -mfp-exceptions -mno-fp-exceptions @gol
885 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
886 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
887 -mframe-header-opt -mno-frame-header-opt}
890 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
891 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
892 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
893 -mno-base-addresses -msingle-exit -mno-single-exit}
895 @emph{MN10300 Options}
896 @gccoptlist{-mmult-bug -mno-mult-bug @gol
897 -mno-am33 -mam33 -mam33-2 -mam34 @gol
898 -mtune=@var{cpu-type} @gol
899 -mreturn-pointer-on-d0 @gol
900 -mno-crt0 -mrelax -mliw -msetlb}
903 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
905 @emph{MSP430 Options}
906 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
908 -mcode-region= -mdata-region= @gol
909 -msilicon-errata= -msilicon-errata-warn= @gol
913 @gccoptlist{-mbig-endian -mlittle-endian @gol
914 -mreduced-regs -mfull-regs @gol
915 -mcmov -mno-cmov @gol
916 -mperf-ext -mno-perf-ext @gol
917 -mv3push -mno-v3push @gol
918 -m16bit -mno-16bit @gol
919 -misr-vector-size=@var{num} @gol
920 -mcache-block-size=@var{num} @gol
921 -march=@var{arch} @gol
922 -mcmodel=@var{code-model} @gol
925 @emph{Nios II Options}
926 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
928 -mno-bypass-cache -mbypass-cache @gol
929 -mno-cache-volatile -mcache-volatile @gol
930 -mno-fast-sw-div -mfast-sw-div @gol
931 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
932 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
933 -mcustom-fpu-cfg=@var{name} @gol
934 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
935 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
937 @emph{Nvidia PTX Options}
938 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
940 @emph{PDP-11 Options}
941 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
942 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
943 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
944 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
945 -mbranch-expensive -mbranch-cheap @gol
946 -munix-asm -mdec-asm}
948 @emph{picoChip Options}
949 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
950 -msymbol-as-address -mno-inefficient-warnings}
952 @emph{PowerPC Options}
953 See RS/6000 and PowerPC Options.
956 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
957 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
958 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
960 @emph{RS/6000 and PowerPC Options}
961 @gccoptlist{-mcpu=@var{cpu-type} @gol
962 -mtune=@var{cpu-type} @gol
963 -mcmodel=@var{code-model} @gol
965 -maltivec -mno-altivec @gol
966 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
967 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
968 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
969 -mfprnd -mno-fprnd @gol
970 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
971 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
972 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
973 -malign-power -malign-natural @gol
974 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
975 -msingle-float -mdouble-float -msimple-fpu @gol
976 -mstring -mno-string -mupdate -mno-update @gol
977 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
978 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
979 -mstrict-align -mno-strict-align -mrelocatable @gol
980 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
981 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
982 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
983 -mprioritize-restricted-insns=@var{priority} @gol
984 -msched-costly-dep=@var{dependence_type} @gol
985 -minsert-sched-nops=@var{scheme} @gol
986 -mcall-sysv -mcall-netbsd @gol
987 -maix-struct-return -msvr4-struct-return @gol
988 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
989 -mblock-move-inline-limit=@var{num} @gol
990 -misel -mno-isel @gol
991 -misel=yes -misel=no @gol
993 -mspe=yes -mspe=no @gol
995 -mgen-cell-microcode -mwarn-cell-microcode @gol
996 -mvrsave -mno-vrsave @gol
997 -mmulhw -mno-mulhw @gol
998 -mdlmzb -mno-dlmzb @gol
999 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1000 -mprototype -mno-prototype @gol
1001 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1002 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
1003 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1004 -mno-recip-precision @gol
1005 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1006 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1007 -msave-toc-indirect -mno-save-toc-indirect @gol
1008 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1009 -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol
1010 -mquad-memory -mno-quad-memory @gol
1011 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1012 -mcompat-align-parm -mno-compat-align-parm @gol
1013 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
1014 -mupper-regs-di -mno-upper-regs-di @gol
1015 -mupper-regs -mno-upper-regs @gol
1016 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1020 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1022 -mbig-endian-data -mlittle-endian-data @gol
1025 -mas100-syntax -mno-as100-syntax@gol
1027 -mmax-constant-size=@gol
1030 -mallow-string-insns -mno-allow-string-insns@gol
1032 -mno-warn-multiple-fast-interrupts@gol
1033 -msave-acc-in-interrupts}
1035 @emph{S/390 and zSeries Options}
1036 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1037 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1038 -mlong-double-64 -mlong-double-128 @gol
1039 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1040 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1041 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1042 -mhtm -mvx -mzvector @gol
1043 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1044 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1045 -mhotpatch=@var{halfwords},@var{halfwords}}
1047 @emph{Score Options}
1048 @gccoptlist{-meb -mel @gol
1052 -mscore5 -mscore5u -mscore7 -mscore7d}
1055 @gccoptlist{-m1 -m2 -m2e @gol
1056 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1058 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1059 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1060 -mb -ml -mdalign -mrelax @gol
1061 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1062 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1063 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1064 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1065 -maccumulate-outgoing-args @gol
1066 -matomic-model=@var{atomic-model} @gol
1067 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1068 -mcbranch-force-delay-slot @gol
1069 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1070 -mpretend-cmove -mtas}
1072 @emph{Solaris 2 Options}
1073 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1076 @emph{SPARC Options}
1077 @gccoptlist{-mcpu=@var{cpu-type} @gol
1078 -mtune=@var{cpu-type} @gol
1079 -mcmodel=@var{code-model} @gol
1080 -mmemory-model=@var{mem-model} @gol
1081 -m32 -m64 -mapp-regs -mno-app-regs @gol
1082 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1083 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1084 -mhard-quad-float -msoft-quad-float @gol
1085 -mstack-bias -mno-stack-bias @gol
1086 -mstd-struct-return -mno-std-struct-return @gol
1087 -munaligned-doubles -mno-unaligned-doubles @gol
1088 -muser-mode -mno-user-mode @gol
1089 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1090 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1091 -mcbcond -mno-cbcond @gol
1092 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
1093 -mfix-at697f -mfix-ut699}
1096 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1097 -msafe-dma -munsafe-dma @gol
1099 -msmall-mem -mlarge-mem -mstdmain @gol
1100 -mfixed-range=@var{register-range} @gol
1102 -maddress-space-conversion -mno-address-space-conversion @gol
1103 -mcache-size=@var{cache-size} @gol
1104 -matomic-updates -mno-atomic-updates}
1106 @emph{System V Options}
1107 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1109 @emph{TILE-Gx Options}
1110 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1111 -mcmodel=@var{code-model}}
1113 @emph{TILEPro Options}
1114 @gccoptlist{-mcpu=@var{cpu} -m32}
1117 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1118 -mprolog-function -mno-prolog-function -mspace @gol
1119 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1120 -mapp-regs -mno-app-regs @gol
1121 -mdisable-callt -mno-disable-callt @gol
1122 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1123 -mv850e -mv850 -mv850e3v5 @gol
1134 @gccoptlist{-mg -mgnu -munix}
1136 @emph{Visium Options}
1137 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1138 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1141 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1142 -mpointer-size=@var{size}}
1144 @emph{VxWorks Options}
1145 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1146 -Xbind-lazy -Xbind-now}
1149 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1150 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1151 -mfpmath=@var{unit} @gol
1152 -masm=@var{dialect} -mno-fancy-math-387 @gol
1153 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1154 -mno-wide-multiply -mrtd -malign-double @gol
1155 -mpreferred-stack-boundary=@var{num} @gol
1156 -mincoming-stack-boundary=@var{num} @gol
1157 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1158 -mrecip -mrecip=@var{opt} @gol
1159 -mvzeroupper -mprefer-avx128 @gol
1160 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1161 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1162 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1163 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1164 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1165 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
1166 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mclzero
1167 -mpku -mthreads @gol
1168 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1169 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1170 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1171 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1172 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1173 -mregparm=@var{num} -msseregparm @gol
1174 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1175 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1176 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1177 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1178 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1179 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1180 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1181 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1182 -mmitigate-rop -mgeneral-regs-only}
1184 @emph{x86 Windows Options}
1185 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1186 -mnop-fun-dllimport -mthread @gol
1187 -municode -mwin32 -mwindows -fno-set-stack-executable}
1189 @emph{Xstormy16 Options}
1192 @emph{Xtensa Options}
1193 @gccoptlist{-mconst16 -mno-const16 @gol
1194 -mfused-madd -mno-fused-madd @gol
1196 -mserialize-volatile -mno-serialize-volatile @gol
1197 -mtext-section-literals -mno-text-section-literals @gol
1198 -mauto-litpools -mno-auto-litpools @gol
1199 -mtarget-align -mno-target-align @gol
1200 -mlongcalls -mno-longcalls}
1202 @emph{zSeries Options}
1203 See S/390 and zSeries Options.
1207 @node Overall Options
1208 @section Options Controlling the Kind of Output
1210 Compilation can involve up to four stages: preprocessing, compilation
1211 proper, assembly and linking, always in that order. GCC is capable of
1212 preprocessing and compiling several files either into several
1213 assembler input files, or into one assembler input file; then each
1214 assembler input file produces an object file, and linking combines all
1215 the object files (those newly compiled, and those specified as input)
1216 into an executable file.
1218 @cindex file name suffix
1219 For any given input file, the file name suffix determines what kind of
1220 compilation is done:
1224 C source code that must be preprocessed.
1227 C source code that should not be preprocessed.
1230 C++ source code that should not be preprocessed.
1233 Objective-C source code. Note that you must link with the @file{libobjc}
1234 library to make an Objective-C program work.
1237 Objective-C source code that should not be preprocessed.
1241 Objective-C++ source code. Note that you must link with the @file{libobjc}
1242 library to make an Objective-C++ program work. Note that @samp{.M} refers
1243 to a literal capital M@.
1245 @item @var{file}.mii
1246 Objective-C++ source code that should not be preprocessed.
1249 C, C++, Objective-C or Objective-C++ header file to be turned into a
1250 precompiled header (default), or C, C++ header file to be turned into an
1251 Ada spec (via the @option{-fdump-ada-spec} switch).
1254 @itemx @var{file}.cp
1255 @itemx @var{file}.cxx
1256 @itemx @var{file}.cpp
1257 @itemx @var{file}.CPP
1258 @itemx @var{file}.c++
1260 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1261 the last two letters must both be literally @samp{x}. Likewise,
1262 @samp{.C} refers to a literal capital C@.
1266 Objective-C++ source code that must be preprocessed.
1268 @item @var{file}.mii
1269 Objective-C++ source code that should not be preprocessed.
1273 @itemx @var{file}.hp
1274 @itemx @var{file}.hxx
1275 @itemx @var{file}.hpp
1276 @itemx @var{file}.HPP
1277 @itemx @var{file}.h++
1278 @itemx @var{file}.tcc
1279 C++ header file to be turned into a precompiled header or Ada spec.
1282 @itemx @var{file}.for
1283 @itemx @var{file}.ftn
1284 Fixed form Fortran source code that should not be preprocessed.
1287 @itemx @var{file}.FOR
1288 @itemx @var{file}.fpp
1289 @itemx @var{file}.FPP
1290 @itemx @var{file}.FTN
1291 Fixed form Fortran source code that must be preprocessed (with the traditional
1294 @item @var{file}.f90
1295 @itemx @var{file}.f95
1296 @itemx @var{file}.f03
1297 @itemx @var{file}.f08
1298 Free form Fortran source code that should not be preprocessed.
1300 @item @var{file}.F90
1301 @itemx @var{file}.F95
1302 @itemx @var{file}.F03
1303 @itemx @var{file}.F08
1304 Free form Fortran source code that must be preprocessed (with the
1305 traditional preprocessor).
1310 @c FIXME: Descriptions of Java file types.
1316 @item @var{file}.ads
1317 Ada source code file that contains a library unit declaration (a
1318 declaration of a package, subprogram, or generic, or a generic
1319 instantiation), or a library unit renaming declaration (a package,
1320 generic, or subprogram renaming declaration). Such files are also
1323 @item @var{file}.adb
1324 Ada source code file containing a library unit body (a subprogram or
1325 package body). Such files are also called @dfn{bodies}.
1327 @c GCC also knows about some suffixes for languages not yet included:
1338 @itemx @var{file}.sx
1339 Assembler code that must be preprocessed.
1342 An object file to be fed straight into linking.
1343 Any file name with no recognized suffix is treated this way.
1347 You can specify the input language explicitly with the @option{-x} option:
1350 @item -x @var{language}
1351 Specify explicitly the @var{language} for the following input files
1352 (rather than letting the compiler choose a default based on the file
1353 name suffix). This option applies to all following input files until
1354 the next @option{-x} option. Possible values for @var{language} are:
1356 c c-header cpp-output
1357 c++ c++-header c++-cpp-output
1358 objective-c objective-c-header objective-c-cpp-output
1359 objective-c++ objective-c++-header objective-c++-cpp-output
1360 assembler assembler-with-cpp
1362 f77 f77-cpp-input f95 f95-cpp-input
1368 Turn off any specification of a language, so that subsequent files are
1369 handled according to their file name suffixes (as they are if @option{-x}
1370 has not been used at all).
1373 If you only want some of the stages of compilation, you can use
1374 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1375 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1376 @command{gcc} is to stop. Note that some combinations (for example,
1377 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1382 Compile or assemble the source files, but do not link. The linking
1383 stage simply is not done. The ultimate output is in the form of an
1384 object file for each source file.
1386 By default, the object file name for a source file is made by replacing
1387 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1389 Unrecognized input files, not requiring compilation or assembly, are
1394 Stop after the stage of compilation proper; do not assemble. The output
1395 is in the form of an assembler code file for each non-assembler input
1398 By default, the assembler file name for a source file is made by
1399 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1401 Input files that don't require compilation are ignored.
1405 Stop after the preprocessing stage; do not run the compiler proper. The
1406 output is in the form of preprocessed source code, which is sent to the
1409 Input files that don't require preprocessing are ignored.
1411 @cindex output file option
1414 Place output in file @var{file}. This applies to whatever
1415 sort of output is being produced, whether it be an executable file,
1416 an object file, an assembler file or preprocessed C code.
1418 If @option{-o} is not specified, the default is to put an executable
1419 file in @file{a.out}, the object file for
1420 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1421 assembler file in @file{@var{source}.s}, a precompiled header file in
1422 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1427 Print (on standard error output) the commands executed to run the stages
1428 of compilation. Also print the version number of the compiler driver
1429 program and of the preprocessor and the compiler proper.
1433 Like @option{-v} except the commands are not executed and arguments
1434 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1435 This is useful for shell scripts to capture the driver-generated command lines.
1439 Print (on the standard output) a description of the command-line options
1440 understood by @command{gcc}. If the @option{-v} option is also specified
1441 then @option{--help} is also passed on to the various processes
1442 invoked by @command{gcc}, so that they can display the command-line options
1443 they accept. If the @option{-Wextra} option has also been specified
1444 (prior to the @option{--help} option), then command-line options that
1445 have no documentation associated with them are also displayed.
1448 @opindex target-help
1449 Print (on the standard output) a description of target-specific command-line
1450 options for each tool. For some targets extra target-specific
1451 information may also be printed.
1453 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1454 Print (on the standard output) a description of the command-line
1455 options understood by the compiler that fit into all specified classes
1456 and qualifiers. These are the supported classes:
1459 @item @samp{optimizers}
1460 Display all of the optimization options supported by the
1463 @item @samp{warnings}
1464 Display all of the options controlling warning messages
1465 produced by the compiler.
1468 Display target-specific options. Unlike the
1469 @option{--target-help} option however, target-specific options of the
1470 linker and assembler are not displayed. This is because those
1471 tools do not currently support the extended @option{--help=} syntax.
1474 Display the values recognized by the @option{--param}
1477 @item @var{language}
1478 Display the options supported for @var{language}, where
1479 @var{language} is the name of one of the languages supported in this
1483 Display the options that are common to all languages.
1486 These are the supported qualifiers:
1489 @item @samp{undocumented}
1490 Display only those options that are undocumented.
1493 Display options taking an argument that appears after an equal
1494 sign in the same continuous piece of text, such as:
1495 @samp{--help=target}.
1497 @item @samp{separate}
1498 Display options taking an argument that appears as a separate word
1499 following the original option, such as: @samp{-o output-file}.
1502 Thus for example to display all the undocumented target-specific
1503 switches supported by the compiler, use:
1506 --help=target,undocumented
1509 The sense of a qualifier can be inverted by prefixing it with the
1510 @samp{^} character, so for example to display all binary warning
1511 options (i.e., ones that are either on or off and that do not take an
1512 argument) that have a description, use:
1515 --help=warnings,^joined,^undocumented
1518 The argument to @option{--help=} should not consist solely of inverted
1521 Combining several classes is possible, although this usually
1522 restricts the output so much that there is nothing to display. One
1523 case where it does work, however, is when one of the classes is
1524 @var{target}. For example, to display all the target-specific
1525 optimization options, use:
1528 --help=target,optimizers
1531 The @option{--help=} option can be repeated on the command line. Each
1532 successive use displays its requested class of options, skipping
1533 those that have already been displayed.
1535 If the @option{-Q} option appears on the command line before the
1536 @option{--help=} option, then the descriptive text displayed by
1537 @option{--help=} is changed. Instead of describing the displayed
1538 options, an indication is given as to whether the option is enabled,
1539 disabled or set to a specific value (assuming that the compiler
1540 knows this at the point where the @option{--help=} option is used).
1542 Here is a truncated example from the ARM port of @command{gcc}:
1545 % gcc -Q -mabi=2 --help=target -c
1546 The following options are target specific:
1548 -mabort-on-noreturn [disabled]
1552 The output is sensitive to the effects of previous command-line
1553 options, so for example it is possible to find out which optimizations
1554 are enabled at @option{-O2} by using:
1557 -Q -O2 --help=optimizers
1560 Alternatively you can discover which binary optimizations are enabled
1561 by @option{-O3} by using:
1564 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1565 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1566 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1571 Display the version number and copyrights of the invoked GCC@.
1573 @item -pass-exit-codes
1574 @opindex pass-exit-codes
1575 Normally the @command{gcc} program exits with the code of 1 if any
1576 phase of the compiler returns a non-success return code. If you specify
1577 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1578 the numerically highest error produced by any phase returning an error
1579 indication. The C, C++, and Fortran front ends return 4 if an internal
1580 compiler error is encountered.
1584 Use pipes rather than temporary files for communication between the
1585 various stages of compilation. This fails to work on some systems where
1586 the assembler is unable to read from a pipe; but the GNU assembler has
1589 @item -specs=@var{file}
1591 Process @var{file} after the compiler reads in the standard @file{specs}
1592 file, in order to override the defaults which the @command{gcc} driver
1593 program uses when determining what switches to pass to @command{cc1},
1594 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1595 @option{-specs=@var{file}} can be specified on the command line, and they
1596 are processed in order, from left to right. @xref{Spec Files}, for
1597 information about the format of the @var{file}.
1601 Invoke all subcommands under a wrapper program. The name of the
1602 wrapper program and its parameters are passed as a comma separated
1606 gcc -c t.c -wrapper gdb,--args
1610 This invokes all subprograms of @command{gcc} under
1611 @samp{gdb --args}, thus the invocation of @command{cc1} is
1612 @samp{gdb --args cc1 @dots{}}.
1614 @item -fplugin=@var{name}.so
1616 Load the plugin code in file @var{name}.so, assumed to be a
1617 shared object to be dlopen'd by the compiler. The base name of
1618 the shared object file is used to identify the plugin for the
1619 purposes of argument parsing (See
1620 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1621 Each plugin should define the callback functions specified in the
1624 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1625 @opindex fplugin-arg
1626 Define an argument called @var{key} with a value of @var{value}
1627 for the plugin called @var{name}.
1629 @item -fdump-ada-spec@r{[}-slim@r{]}
1630 @opindex fdump-ada-spec
1631 For C and C++ source and include files, generate corresponding Ada specs.
1632 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1633 GNAT User's Guide}, which provides detailed documentation on this feature.
1635 @item -fada-spec-parent=@var{unit}
1636 @opindex fada-spec-parent
1637 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1638 Ada specs as child units of parent @var{unit}.
1640 @item -fdump-go-spec=@var{file}
1641 @opindex fdump-go-spec
1642 For input files in any language, generate corresponding Go
1643 declarations in @var{file}. This generates Go @code{const},
1644 @code{type}, @code{var}, and @code{func} declarations which may be a
1645 useful way to start writing a Go interface to code written in some
1648 @include @value{srcdir}/../libiberty/at-file.texi
1652 @section Compiling C++ Programs
1654 @cindex suffixes for C++ source
1655 @cindex C++ source file suffixes
1656 C++ source files conventionally use one of the suffixes @samp{.C},
1657 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1658 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1659 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1660 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1661 files with these names and compiles them as C++ programs even if you
1662 call the compiler the same way as for compiling C programs (usually
1663 with the name @command{gcc}).
1667 However, the use of @command{gcc} does not add the C++ library.
1668 @command{g++} is a program that calls GCC and automatically specifies linking
1669 against the C++ library. It treats @samp{.c},
1670 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1671 files unless @option{-x} is used. This program is also useful when
1672 precompiling a C header file with a @samp{.h} extension for use in C++
1673 compilations. On many systems, @command{g++} is also installed with
1674 the name @command{c++}.
1676 @cindex invoking @command{g++}
1677 When you compile C++ programs, you may specify many of the same
1678 command-line options that you use for compiling programs in any
1679 language; or command-line options meaningful for C and related
1680 languages; or options that are meaningful only for C++ programs.
1681 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1682 explanations of options for languages related to C@.
1683 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1684 explanations of options that are meaningful only for C++ programs.
1686 @node C Dialect Options
1687 @section Options Controlling C Dialect
1688 @cindex dialect options
1689 @cindex language dialect options
1690 @cindex options, dialect
1692 The following options control the dialect of C (or languages derived
1693 from C, such as C++, Objective-C and Objective-C++) that the compiler
1697 @cindex ANSI support
1701 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1702 equivalent to @option{-std=c++98}.
1704 This turns off certain features of GCC that are incompatible with ISO
1705 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1706 such as the @code{asm} and @code{typeof} keywords, and
1707 predefined macros such as @code{unix} and @code{vax} that identify the
1708 type of system you are using. It also enables the undesirable and
1709 rarely used ISO trigraph feature. For the C compiler,
1710 it disables recognition of C++ style @samp{//} comments as well as
1711 the @code{inline} keyword.
1713 The alternate keywords @code{__asm__}, @code{__extension__},
1714 @code{__inline__} and @code{__typeof__} continue to work despite
1715 @option{-ansi}. You would not want to use them in an ISO C program, of
1716 course, but it is useful to put them in header files that might be included
1717 in compilations done with @option{-ansi}. Alternate predefined macros
1718 such as @code{__unix__} and @code{__vax__} are also available, with or
1719 without @option{-ansi}.
1721 The @option{-ansi} option does not cause non-ISO programs to be
1722 rejected gratuitously. For that, @option{-Wpedantic} is required in
1723 addition to @option{-ansi}. @xref{Warning Options}.
1725 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1726 option is used. Some header files may notice this macro and refrain
1727 from declaring certain functions or defining certain macros that the
1728 ISO standard doesn't call for; this is to avoid interfering with any
1729 programs that might use these names for other things.
1731 Functions that are normally built in but do not have semantics
1732 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1733 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1734 built-in functions provided by GCC}, for details of the functions
1739 Determine the language standard. @xref{Standards,,Language Standards
1740 Supported by GCC}, for details of these standard versions. This option
1741 is currently only supported when compiling C or C++.
1743 The compiler can accept several base standards, such as @samp{c90} or
1744 @samp{c++98}, and GNU dialects of those standards, such as
1745 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1746 compiler accepts all programs following that standard plus those
1747 using GNU extensions that do not contradict it. For example,
1748 @option{-std=c90} turns off certain features of GCC that are
1749 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1750 keywords, but not other GNU extensions that do not have a meaning in
1751 ISO C90, such as omitting the middle term of a @code{?:}
1752 expression. On the other hand, when a GNU dialect of a standard is
1753 specified, all features supported by the compiler are enabled, even when
1754 those features change the meaning of the base standard. As a result, some
1755 strict-conforming programs may be rejected. The particular standard
1756 is used by @option{-Wpedantic} to identify which features are GNU
1757 extensions given that version of the standard. For example
1758 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1759 comments, while @option{-std=gnu99 -Wpedantic} does not.
1761 A value for this option must be provided; possible values are
1767 Support all ISO C90 programs (certain GNU extensions that conflict
1768 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1770 @item iso9899:199409
1771 ISO C90 as modified in amendment 1.
1777 ISO C99. This standard is substantially completely supported, modulo
1778 bugs and floating-point issues
1779 (mainly but not entirely relating to optional C99 features from
1780 Annexes F and G). See
1781 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1782 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1787 ISO C11, the 2011 revision of the ISO C standard. This standard is
1788 substantially completely supported, modulo bugs, floating-point issues
1789 (mainly but not entirely relating to optional C11 features from
1790 Annexes F and G) and the optional Annexes K (Bounds-checking
1791 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1795 GNU dialect of ISO C90 (including some C99 features).
1799 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1803 GNU dialect of ISO C11. This is the default for C code.
1804 The name @samp{gnu1x} is deprecated.
1808 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1809 additional defect reports. Same as @option{-ansi} for C++ code.
1813 GNU dialect of @option{-std=c++98}.
1817 The 2011 ISO C++ standard plus amendments.
1818 The name @samp{c++0x} is deprecated.
1822 GNU dialect of @option{-std=c++11}.
1823 The name @samp{gnu++0x} is deprecated.
1827 The 2014 ISO C++ standard plus amendments.
1828 The name @samp{c++1y} is deprecated.
1832 GNU dialect of @option{-std=c++14}.
1833 This is the default for C++ code.
1834 The name @samp{gnu++1y} is deprecated.
1837 The next revision of the ISO C++ standard, tentatively planned for
1838 2017. Support is highly experimental, and will almost certainly
1839 change in incompatible ways in future releases.
1842 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1843 and will almost certainly change in incompatible ways in future
1847 @item -fgnu89-inline
1848 @opindex fgnu89-inline
1849 The option @option{-fgnu89-inline} tells GCC to use the traditional
1850 GNU semantics for @code{inline} functions when in C99 mode.
1851 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1852 Using this option is roughly equivalent to adding the
1853 @code{gnu_inline} function attribute to all inline functions
1854 (@pxref{Function Attributes}).
1856 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1857 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1858 specifies the default behavior).
1859 This option is not supported in @option{-std=c90} or
1860 @option{-std=gnu90} mode.
1862 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1863 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1864 in effect for @code{inline} functions. @xref{Common Predefined
1865 Macros,,,cpp,The C Preprocessor}.
1867 @item -aux-info @var{filename}
1869 Output to the given filename prototyped declarations for all functions
1870 declared and/or defined in a translation unit, including those in header
1871 files. This option is silently ignored in any language other than C@.
1873 Besides declarations, the file indicates, in comments, the origin of
1874 each declaration (source file and line), whether the declaration was
1875 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1876 @samp{O} for old, respectively, in the first character after the line
1877 number and the colon), and whether it came from a declaration or a
1878 definition (@samp{C} or @samp{F}, respectively, in the following
1879 character). In the case of function definitions, a K&R-style list of
1880 arguments followed by their declarations is also provided, inside
1881 comments, after the declaration.
1883 @item -fallow-parameterless-variadic-functions
1884 @opindex fallow-parameterless-variadic-functions
1885 Accept variadic functions without named parameters.
1887 Although it is possible to define such a function, this is not very
1888 useful as it is not possible to read the arguments. This is only
1889 supported for C as this construct is allowed by C++.
1893 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1894 keyword, so that code can use these words as identifiers. You can use
1895 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1896 instead. @option{-ansi} implies @option{-fno-asm}.
1898 In C++, this switch only affects the @code{typeof} keyword, since
1899 @code{asm} and @code{inline} are standard keywords. You may want to
1900 use the @option{-fno-gnu-keywords} flag instead, which has the same
1901 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1902 switch only affects the @code{asm} and @code{typeof} keywords, since
1903 @code{inline} is a standard keyword in ISO C99.
1906 @itemx -fno-builtin-@var{function}
1907 @opindex fno-builtin
1908 @cindex built-in functions
1909 Don't recognize built-in functions that do not begin with
1910 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1911 functions provided by GCC}, for details of the functions affected,
1912 including those which are not built-in functions when @option{-ansi} or
1913 @option{-std} options for strict ISO C conformance are used because they
1914 do not have an ISO standard meaning.
1916 GCC normally generates special code to handle certain built-in functions
1917 more efficiently; for instance, calls to @code{alloca} may become single
1918 instructions which adjust the stack directly, and calls to @code{memcpy}
1919 may become inline copy loops. The resulting code is often both smaller
1920 and faster, but since the function calls no longer appear as such, you
1921 cannot set a breakpoint on those calls, nor can you change the behavior
1922 of the functions by linking with a different library. In addition,
1923 when a function is recognized as a built-in function, GCC may use
1924 information about that function to warn about problems with calls to
1925 that function, or to generate more efficient code, even if the
1926 resulting code still contains calls to that function. For example,
1927 warnings are given with @option{-Wformat} for bad calls to
1928 @code{printf} when @code{printf} is built in and @code{strlen} is
1929 known not to modify global memory.
1931 With the @option{-fno-builtin-@var{function}} option
1932 only the built-in function @var{function} is
1933 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1934 function is named that is not built-in in this version of GCC, this
1935 option is ignored. There is no corresponding
1936 @option{-fbuiltin-@var{function}} option; if you wish to enable
1937 built-in functions selectively when using @option{-fno-builtin} or
1938 @option{-ffreestanding}, you may define macros such as:
1941 #define abs(n) __builtin_abs ((n))
1942 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1947 @cindex hosted environment
1949 Assert that compilation targets a hosted environment. This implies
1950 @option{-fbuiltin}. A hosted environment is one in which the
1951 entire standard library is available, and in which @code{main} has a return
1952 type of @code{int}. Examples are nearly everything except a kernel.
1953 This is equivalent to @option{-fno-freestanding}.
1955 @item -ffreestanding
1956 @opindex ffreestanding
1957 @cindex hosted environment
1959 Assert that compilation targets a freestanding environment. This
1960 implies @option{-fno-builtin}. A freestanding environment
1961 is one in which the standard library may not exist, and program startup may
1962 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1963 This is equivalent to @option{-fno-hosted}.
1965 @xref{Standards,,Language Standards Supported by GCC}, for details of
1966 freestanding and hosted environments.
1970 @cindex OpenACC accelerator programming
1971 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
1972 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
1973 compiler generates accelerated code according to the OpenACC Application
1974 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
1975 implies @option{-pthread}, and thus is only supported on targets that
1976 have support for @option{-pthread}.
1978 @item -fopenacc-dim=@var{geom}
1979 @opindex fopenacc-dim
1980 @cindex OpenACC accelerator programming
1981 Specify default compute dimensions for parallel offload regions that do
1982 not explicitly specify. The @var{geom} value is a triple of
1983 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
1984 can be omitted, to use a target-specific default value.
1988 @cindex OpenMP parallel
1989 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1990 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1991 compiler generates parallel code according to the OpenMP Application
1992 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
1993 implies @option{-pthread}, and thus is only supported on targets that
1994 have support for @option{-pthread}. @option{-fopenmp} implies
1995 @option{-fopenmp-simd}.
1998 @opindex fopenmp-simd
2001 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2002 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2007 @cindex Enable Cilk Plus
2008 Enable the usage of Cilk Plus language extension features for C/C++.
2009 When the option @option{-fcilkplus} is specified, enable the usage of
2010 the Cilk Plus Language extension features for C/C++. The present
2011 implementation follows ABI version 1.2. This is an experimental
2012 feature that is only partially complete, and whose interface may
2013 change in future versions of GCC as the official specification
2014 changes. Currently, all features but @code{_Cilk_for} have been
2019 When the option @option{-fgnu-tm} is specified, the compiler
2020 generates code for the Linux variant of Intel's current Transactional
2021 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2022 an experimental feature whose interface may change in future versions
2023 of GCC, as the official specification changes. Please note that not
2024 all architectures are supported for this feature.
2026 For more information on GCC's support for transactional memory,
2027 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2028 Transactional Memory Library}.
2030 Note that the transactional memory feature is not supported with
2031 non-call exceptions (@option{-fnon-call-exceptions}).
2033 @item -fms-extensions
2034 @opindex fms-extensions
2035 Accept some non-standard constructs used in Microsoft header files.
2037 In C++ code, this allows member names in structures to be similar
2038 to previous types declarations.
2047 Some cases of unnamed fields in structures and unions are only
2048 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2049 fields within structs/unions}, for details.
2051 Note that this option is off for all targets but x86
2052 targets using ms-abi.
2054 @item -fplan9-extensions
2055 @opindex fplan9-extensions
2056 Accept some non-standard constructs used in Plan 9 code.
2058 This enables @option{-fms-extensions}, permits passing pointers to
2059 structures with anonymous fields to functions that expect pointers to
2060 elements of the type of the field, and permits referring to anonymous
2061 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2062 struct/union fields within structs/unions}, for details. This is only
2063 supported for C, not C++.
2067 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
2068 options for strict ISO C conformance) implies @option{-trigraphs}.
2070 @cindex traditional C language
2071 @cindex C language, traditional
2073 @itemx -traditional-cpp
2074 @opindex traditional-cpp
2075 @opindex traditional
2076 Formerly, these options caused GCC to attempt to emulate a pre-standard
2077 C compiler. They are now only supported with the @option{-E} switch.
2078 The preprocessor continues to support a pre-standard mode. See the GNU
2079 CPP manual for details.
2081 @item -fcond-mismatch
2082 @opindex fcond-mismatch
2083 Allow conditional expressions with mismatched types in the second and
2084 third arguments. The value of such an expression is void. This option
2085 is not supported for C++.
2087 @item -flax-vector-conversions
2088 @opindex flax-vector-conversions
2089 Allow implicit conversions between vectors with differing numbers of
2090 elements and/or incompatible element types. This option should not be
2093 @item -funsigned-char
2094 @opindex funsigned-char
2095 Let the type @code{char} be unsigned, like @code{unsigned char}.
2097 Each kind of machine has a default for what @code{char} should
2098 be. It is either like @code{unsigned char} by default or like
2099 @code{signed char} by default.
2101 Ideally, a portable program should always use @code{signed char} or
2102 @code{unsigned char} when it depends on the signedness of an object.
2103 But many programs have been written to use plain @code{char} and
2104 expect it to be signed, or expect it to be unsigned, depending on the
2105 machines they were written for. This option, and its inverse, let you
2106 make such a program work with the opposite default.
2108 The type @code{char} is always a distinct type from each of
2109 @code{signed char} or @code{unsigned char}, even though its behavior
2110 is always just like one of those two.
2113 @opindex fsigned-char
2114 Let the type @code{char} be signed, like @code{signed char}.
2116 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2117 the negative form of @option{-funsigned-char}. Likewise, the option
2118 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2120 @item -fsigned-bitfields
2121 @itemx -funsigned-bitfields
2122 @itemx -fno-signed-bitfields
2123 @itemx -fno-unsigned-bitfields
2124 @opindex fsigned-bitfields
2125 @opindex funsigned-bitfields
2126 @opindex fno-signed-bitfields
2127 @opindex fno-unsigned-bitfields
2128 These options control whether a bit-field is signed or unsigned, when the
2129 declaration does not use either @code{signed} or @code{unsigned}. By
2130 default, such a bit-field is signed, because this is consistent: the
2131 basic integer types such as @code{int} are signed types.
2133 @item -fsso-struct=@var{endianness}
2134 @opindex fsso-struct
2135 Set the default scalar storage order of structures and unions to the
2136 specified endianness. The accepted values are @samp{big-endian} and
2137 @samp{little-endian}. If the option is not passed, the compiler uses
2138 the native endianness of the target. This option is not supported for C++.
2140 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2141 code that is not binary compatible with code generated without it if the
2142 specified endianness is not the native endianness of the target.
2145 @node C++ Dialect Options
2146 @section Options Controlling C++ Dialect
2148 @cindex compiler options, C++
2149 @cindex C++ options, command-line
2150 @cindex options, C++
2151 This section describes the command-line options that are only meaningful
2152 for C++ programs. You can also use most of the GNU compiler options
2153 regardless of what language your program is in. For example, you
2154 might compile a file @file{firstClass.C} like this:
2157 g++ -g -fstrict-enums -O -c firstClass.C
2161 In this example, only @option{-fstrict-enums} is an option meant
2162 only for C++ programs; you can use the other options with any
2163 language supported by GCC@.
2165 Some options for compiling C programs, such as @option{-std}, are also
2166 relevant for C++ programs.
2167 @xref{C Dialect Options,,Options Controlling C Dialect}.
2169 Here is a list of options that are @emph{only} for compiling C++ programs:
2173 @item -fabi-version=@var{n}
2174 @opindex fabi-version
2175 Use version @var{n} of the C++ ABI@. The default is version 0.
2177 Version 0 refers to the version conforming most closely to
2178 the C++ ABI specification. Therefore, the ABI obtained using version 0
2179 will change in different versions of G++ as ABI bugs are fixed.
2181 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2183 Version 2 is the version of the C++ ABI that first appeared in G++
2184 3.4, and was the default through G++ 4.9.
2186 Version 3 corrects an error in mangling a constant address as a
2189 Version 4, which first appeared in G++ 4.5, implements a standard
2190 mangling for vector types.
2192 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2193 attribute const/volatile on function pointer types, decltype of a
2194 plain decl, and use of a function parameter in the declaration of
2197 Version 6, which first appeared in G++ 4.7, corrects the promotion
2198 behavior of C++11 scoped enums and the mangling of template argument
2199 packs, const/static_cast, prefix ++ and --, and a class scope function
2200 used as a template argument.
2202 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2203 builtin type and corrects the mangling of lambdas in default argument
2206 Version 8, which first appeared in G++ 4.9, corrects the substitution
2207 behavior of function types with function-cv-qualifiers.
2209 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2212 Version 10, which first appeared in G++ 6.1, adds mangling of
2213 attributes that affect type identity, such as ia32 calling convention
2214 attributes (e.g. @samp{stdcall}).
2216 See also @option{-Wabi}.
2218 @item -fabi-compat-version=@var{n}
2219 @opindex fabi-compat-version
2220 On targets that support strong aliases, G++
2221 works around mangling changes by creating an alias with the correct
2222 mangled name when defining a symbol with an incorrect mangled name.
2223 This switch specifies which ABI version to use for the alias.
2225 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2226 compatibility). If another ABI version is explicitly selected, this
2227 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2228 use @option{-fabi-compat-version=2}.
2230 If this option is not provided but @option{-Wabi=@var{n}} is, that
2231 version is used for compatibility aliases. If this option is provided
2232 along with @option{-Wabi} (without the version), the version from this
2233 option is used for the warning.
2235 @item -fno-access-control
2236 @opindex fno-access-control
2237 Turn off all access checking. This switch is mainly useful for working
2238 around bugs in the access control code.
2242 Check that the pointer returned by @code{operator new} is non-null
2243 before attempting to modify the storage allocated. This check is
2244 normally unnecessary because the C++ standard specifies that
2245 @code{operator new} only returns @code{0} if it is declared
2246 @code{throw()}, in which case the compiler always checks the
2247 return value even without this option. In all other cases, when
2248 @code{operator new} has a non-empty exception specification, memory
2249 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2250 @samp{new (nothrow)}.
2254 Enable support for the C++ Extensions for Concepts Technical
2255 Specification, ISO 19217 (2015), which allows code like
2258 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2259 template <Addable T> T add (T a, T b) @{ return a + b; @}
2262 @item -fconstexpr-depth=@var{n}
2263 @opindex fconstexpr-depth
2264 Set the maximum nested evaluation depth for C++11 constexpr functions
2265 to @var{n}. A limit is needed to detect endless recursion during
2266 constant expression evaluation. The minimum specified by the standard
2269 @item -fconstexpr-loop-limit=@var{n}
2270 @opindex fconstexpr-loop-limit
2271 Set the maximum number of iterations for a loop in C++14 constexpr functions
2272 to @var{n}. A limit is needed to detect infinite loops during
2273 constant expression evaluation. The default is 262144 (1<<18).
2275 @item -fdeduce-init-list
2276 @opindex fdeduce-init-list
2277 Enable deduction of a template type parameter as
2278 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2281 template <class T> auto forward(T t) -> decltype (realfn (t))
2288 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2292 This deduction was implemented as a possible extension to the
2293 originally proposed semantics for the C++11 standard, but was not part
2294 of the final standard, so it is disabled by default. This option is
2295 deprecated, and may be removed in a future version of G++.
2297 @item -ffriend-injection
2298 @opindex ffriend-injection
2299 Inject friend functions into the enclosing namespace, so that they are
2300 visible outside the scope of the class in which they are declared.
2301 Friend functions were documented to work this way in the old Annotated
2302 C++ Reference Manual.
2303 However, in ISO C++ a friend function that is not declared
2304 in an enclosing scope can only be found using argument dependent
2305 lookup. GCC defaults to the standard behavior.
2307 This option is for compatibility, and may be removed in a future
2310 @item -fno-elide-constructors
2311 @opindex fno-elide-constructors
2312 The C++ standard allows an implementation to omit creating a temporary
2313 that is only used to initialize another object of the same type.
2314 Specifying this option disables that optimization, and forces G++ to
2315 call the copy constructor in all cases.
2317 @item -fno-enforce-eh-specs
2318 @opindex fno-enforce-eh-specs
2319 Don't generate code to check for violation of exception specifications
2320 at run time. This option violates the C++ standard, but may be useful
2321 for reducing code size in production builds, much like defining
2322 @code{NDEBUG}. This does not give user code permission to throw
2323 exceptions in violation of the exception specifications; the compiler
2324 still optimizes based on the specifications, so throwing an
2325 unexpected exception results in undefined behavior at run time.
2327 @item -fextern-tls-init
2328 @itemx -fno-extern-tls-init
2329 @opindex fextern-tls-init
2330 @opindex fno-extern-tls-init
2331 The C++11 and OpenMP standards allow @code{thread_local} and
2332 @code{threadprivate} variables to have dynamic (runtime)
2333 initialization. To support this, any use of such a variable goes
2334 through a wrapper function that performs any necessary initialization.
2335 When the use and definition of the variable are in the same
2336 translation unit, this overhead can be optimized away, but when the
2337 use is in a different translation unit there is significant overhead
2338 even if the variable doesn't actually need dynamic initialization. If
2339 the programmer can be sure that no use of the variable in a
2340 non-defining TU needs to trigger dynamic initialization (either
2341 because the variable is statically initialized, or a use of the
2342 variable in the defining TU will be executed before any uses in
2343 another TU), they can avoid this overhead with the
2344 @option{-fno-extern-tls-init} option.
2346 On targets that support symbol aliases, the default is
2347 @option{-fextern-tls-init}. On targets that do not support symbol
2348 aliases, the default is @option{-fno-extern-tls-init}.
2351 @itemx -fno-for-scope
2353 @opindex fno-for-scope
2354 If @option{-ffor-scope} is specified, the scope of variables declared in
2355 a @i{for-init-statement} is limited to the @code{for} loop itself,
2356 as specified by the C++ standard.
2357 If @option{-fno-for-scope} is specified, the scope of variables declared in
2358 a @i{for-init-statement} extends to the end of the enclosing scope,
2359 as was the case in old versions of G++, and other (traditional)
2360 implementations of C++.
2362 If neither flag is given, the default is to follow the standard,
2363 but to allow and give a warning for old-style code that would
2364 otherwise be invalid, or have different behavior.
2366 @item -fno-gnu-keywords
2367 @opindex fno-gnu-keywords
2368 Do not recognize @code{typeof} as a keyword, so that code can use this
2369 word as an identifier. You can use the keyword @code{__typeof__} instead.
2370 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2371 @option{-std=c++98}, @option{-std=c++11}, etc.
2373 @item -fno-implicit-templates
2374 @opindex fno-implicit-templates
2375 Never emit code for non-inline templates that are instantiated
2376 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2377 @xref{Template Instantiation}, for more information.
2379 @item -fno-implicit-inline-templates
2380 @opindex fno-implicit-inline-templates
2381 Don't emit code for implicit instantiations of inline templates, either.
2382 The default is to handle inlines differently so that compiles with and
2383 without optimization need the same set of explicit instantiations.
2385 @item -fno-implement-inlines
2386 @opindex fno-implement-inlines
2387 To save space, do not emit out-of-line copies of inline functions
2388 controlled by @code{#pragma implementation}. This causes linker
2389 errors if these functions are not inlined everywhere they are called.
2391 @item -fms-extensions
2392 @opindex fms-extensions
2393 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2394 int and getting a pointer to member function via non-standard syntax.
2396 @item -fno-nonansi-builtins
2397 @opindex fno-nonansi-builtins
2398 Disable built-in declarations of functions that are not mandated by
2399 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2400 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2403 @opindex fnothrow-opt
2404 Treat a @code{throw()} exception specification as if it were a
2405 @code{noexcept} specification to reduce or eliminate the text size
2406 overhead relative to a function with no exception specification. If
2407 the function has local variables of types with non-trivial
2408 destructors, the exception specification actually makes the
2409 function smaller because the EH cleanups for those variables can be
2410 optimized away. The semantic effect is that an exception thrown out of
2411 a function with such an exception specification results in a call
2412 to @code{terminate} rather than @code{unexpected}.
2414 @item -fno-operator-names
2415 @opindex fno-operator-names
2416 Do not treat the operator name keywords @code{and}, @code{bitand},
2417 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2418 synonyms as keywords.
2420 @item -fno-optional-diags
2421 @opindex fno-optional-diags
2422 Disable diagnostics that the standard says a compiler does not need to
2423 issue. Currently, the only such diagnostic issued by G++ is the one for
2424 a name having multiple meanings within a class.
2427 @opindex fpermissive
2428 Downgrade some diagnostics about nonconformant code from errors to
2429 warnings. Thus, using @option{-fpermissive} allows some
2430 nonconforming code to compile.
2432 @item -fno-pretty-templates
2433 @opindex fno-pretty-templates
2434 When an error message refers to a specialization of a function
2435 template, the compiler normally prints the signature of the
2436 template followed by the template arguments and any typedefs or
2437 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2438 rather than @code{void f(int)}) so that it's clear which template is
2439 involved. When an error message refers to a specialization of a class
2440 template, the compiler omits any template arguments that match
2441 the default template arguments for that template. If either of these
2442 behaviors make it harder to understand the error message rather than
2443 easier, you can use @option{-fno-pretty-templates} to disable them.
2447 Enable automatic template instantiation at link time. This option also
2448 implies @option{-fno-implicit-templates}. @xref{Template
2449 Instantiation}, for more information.
2453 Disable generation of information about every class with virtual
2454 functions for use by the C++ run-time type identification features
2455 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2456 of the language, you can save some space by using this flag. Note that
2457 exception handling uses the same information, but G++ generates it as
2458 needed. The @code{dynamic_cast} operator can still be used for casts that
2459 do not require run-time type information, i.e.@: casts to @code{void *} or to
2460 unambiguous base classes.
2462 @item -fsized-deallocation
2463 @opindex fsized-deallocation
2464 Enable the built-in global declarations
2466 void operator delete (void *, std::size_t) noexcept;
2467 void operator delete[] (void *, std::size_t) noexcept;
2469 as introduced in C++14. This is useful for user-defined replacement
2470 deallocation functions that, for example, use the size of the object
2471 to make deallocation faster. Enabled by default under
2472 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2473 warns about places that might want to add a definition.
2475 @item -fstrict-enums
2476 @opindex fstrict-enums
2477 Allow the compiler to optimize using the assumption that a value of
2478 enumerated type can only be one of the values of the enumeration (as
2479 defined in the C++ standard; basically, a value that can be
2480 represented in the minimum number of bits needed to represent all the
2481 enumerators). This assumption may not be valid if the program uses a
2482 cast to convert an arbitrary integer value to the enumerated type.
2484 @item -fstrong-eval-order
2485 @opindex fstrong-eval-order
2486 Evaluate member access, array subscripting, and shift expressions in
2487 left-to-right order, and evaluate assignment in right-to-left order,
2488 as adopted for C++17. Enabled by default with @option{-std=c++1z}.
2489 @option{-fstrong-eval-order=some} enables just the ordering of member
2490 access and shift expressions, and is the default without
2491 @option{-std=c++1z}.
2493 @item -ftemplate-backtrace-limit=@var{n}
2494 @opindex ftemplate-backtrace-limit
2495 Set the maximum number of template instantiation notes for a single
2496 warning or error to @var{n}. The default value is 10.
2498 @item -ftemplate-depth=@var{n}
2499 @opindex ftemplate-depth
2500 Set the maximum instantiation depth for template classes to @var{n}.
2501 A limit on the template instantiation depth is needed to detect
2502 endless recursions during template class instantiation. ANSI/ISO C++
2503 conforming programs must not rely on a maximum depth greater than 17
2504 (changed to 1024 in C++11). The default value is 900, as the compiler
2505 can run out of stack space before hitting 1024 in some situations.
2507 @item -fno-threadsafe-statics
2508 @opindex fno-threadsafe-statics
2509 Do not emit the extra code to use the routines specified in the C++
2510 ABI for thread-safe initialization of local statics. You can use this
2511 option to reduce code size slightly in code that doesn't need to be
2514 @item -fuse-cxa-atexit
2515 @opindex fuse-cxa-atexit
2516 Register destructors for objects with static storage duration with the
2517 @code{__cxa_atexit} function rather than the @code{atexit} function.
2518 This option is required for fully standards-compliant handling of static
2519 destructors, but only works if your C library supports
2520 @code{__cxa_atexit}.
2522 @item -fno-use-cxa-get-exception-ptr
2523 @opindex fno-use-cxa-get-exception-ptr
2524 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2525 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2526 if the runtime routine is not available.
2528 @item -fvisibility-inlines-hidden
2529 @opindex fvisibility-inlines-hidden
2530 This switch declares that the user does not attempt to compare
2531 pointers to inline functions or methods where the addresses of the two functions
2532 are taken in different shared objects.
2534 The effect of this is that GCC may, effectively, mark inline methods with
2535 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2536 appear in the export table of a DSO and do not require a PLT indirection
2537 when used within the DSO@. Enabling this option can have a dramatic effect
2538 on load and link times of a DSO as it massively reduces the size of the
2539 dynamic export table when the library makes heavy use of templates.
2541 The behavior of this switch is not quite the same as marking the
2542 methods as hidden directly, because it does not affect static variables
2543 local to the function or cause the compiler to deduce that
2544 the function is defined in only one shared object.
2546 You may mark a method as having a visibility explicitly to negate the
2547 effect of the switch for that method. For example, if you do want to
2548 compare pointers to a particular inline method, you might mark it as
2549 having default visibility. Marking the enclosing class with explicit
2550 visibility has no effect.
2552 Explicitly instantiated inline methods are unaffected by this option
2553 as their linkage might otherwise cross a shared library boundary.
2554 @xref{Template Instantiation}.
2556 @item -fvisibility-ms-compat
2557 @opindex fvisibility-ms-compat
2558 This flag attempts to use visibility settings to make GCC's C++
2559 linkage model compatible with that of Microsoft Visual Studio.
2561 The flag makes these changes to GCC's linkage model:
2565 It sets the default visibility to @code{hidden}, like
2566 @option{-fvisibility=hidden}.
2569 Types, but not their members, are not hidden by default.
2572 The One Definition Rule is relaxed for types without explicit
2573 visibility specifications that are defined in more than one
2574 shared object: those declarations are permitted if they are
2575 permitted when this option is not used.
2578 In new code it is better to use @option{-fvisibility=hidden} and
2579 export those classes that are intended to be externally visible.
2580 Unfortunately it is possible for code to rely, perhaps accidentally,
2581 on the Visual Studio behavior.
2583 Among the consequences of these changes are that static data members
2584 of the same type with the same name but defined in different shared
2585 objects are different, so changing one does not change the other;
2586 and that pointers to function members defined in different shared
2587 objects may not compare equal. When this flag is given, it is a
2588 violation of the ODR to define types with the same name differently.
2592 Do not use weak symbol support, even if it is provided by the linker.
2593 By default, G++ uses weak symbols if they are available. This
2594 option exists only for testing, and should not be used by end-users;
2595 it results in inferior code and has no benefits. This option may
2596 be removed in a future release of G++.
2600 Do not search for header files in the standard directories specific to
2601 C++, but do still search the other standard directories. (This option
2602 is used when building the C++ library.)
2605 In addition, these optimization, warning, and code generation options
2606 have meanings only for C++ programs:
2609 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2612 Warn when G++ it generates code that is probably not compatible with
2613 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2614 ABI with each major release, normally @option{-Wabi} will warn only if
2615 there is a check added later in a release series for an ABI issue
2616 discovered since the initial release. @option{-Wabi} will warn about
2617 more things if an older ABI version is selected (with
2618 @option{-fabi-version=@var{n}}).
2620 @option{-Wabi} can also be used with an explicit version number to
2621 warn about compatibility with a particular @option{-fabi-version}
2622 level, e.g. @option{-Wabi=2} to warn about changes relative to
2623 @option{-fabi-version=2}.
2625 If an explicit version number is provided and
2626 @option{-fabi-compat-version} is not specified, the version number
2627 from this option is used for compatibility aliases. If no explicit
2628 version number is provided with this option, but
2629 @option{-fabi-compat-version} is specified, that version number is
2630 used for ABI warnings.
2632 Although an effort has been made to warn about
2633 all such cases, there are probably some cases that are not warned about,
2634 even though G++ is generating incompatible code. There may also be
2635 cases where warnings are emitted even though the code that is generated
2638 You should rewrite your code to avoid these warnings if you are
2639 concerned about the fact that code generated by G++ may not be binary
2640 compatible with code generated by other compilers.
2642 Known incompatibilities in @option{-fabi-version=2} (which was the
2643 default from GCC 3.4 to 4.9) include:
2648 A template with a non-type template parameter of reference type was
2649 mangled incorrectly:
2652 template <int &> struct S @{@};
2656 This was fixed in @option{-fabi-version=3}.
2659 SIMD vector types declared using @code{__attribute ((vector_size))} were
2660 mangled in a non-standard way that does not allow for overloading of
2661 functions taking vectors of different sizes.
2663 The mangling was changed in @option{-fabi-version=4}.
2666 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2667 qualifiers, and @code{decltype} of a plain declaration was folded away.
2669 These mangling issues were fixed in @option{-fabi-version=5}.
2672 Scoped enumerators passed as arguments to a variadic function are
2673 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2674 On most targets this does not actually affect the parameter passing
2675 ABI, as there is no way to pass an argument smaller than @code{int}.
2677 Also, the ABI changed the mangling of template argument packs,
2678 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2679 a class scope function used as a template argument.
2681 These issues were corrected in @option{-fabi-version=6}.
2684 Lambdas in default argument scope were mangled incorrectly, and the
2685 ABI changed the mangling of @code{nullptr_t}.
2687 These issues were corrected in @option{-fabi-version=7}.
2690 When mangling a function type with function-cv-qualifiers, the
2691 un-qualified function type was incorrectly treated as a substitution
2694 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2697 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2698 unaligned accesses. Note that this did not affect the ABI of a
2699 function with a @code{nullptr_t} parameter, as parameters have a
2702 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2705 Target-specific attributes that affect the identity of a type, such as
2706 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2707 did not affect the mangled name, leading to name collisions when
2708 function pointers were used as template arguments.
2710 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2714 It also warns about psABI-related changes. The known psABI changes at this
2720 For SysV/x86-64, unions with @code{long double} members are
2721 passed in memory as specified in psABI. For example:
2731 @code{union U} is always passed in memory.
2735 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2738 Warn when a type with an ABI tag is used in a context that does not
2739 have that ABI tag. See @ref{C++ Attributes} for more information
2742 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2743 @opindex Wctor-dtor-privacy
2744 @opindex Wno-ctor-dtor-privacy
2745 Warn when a class seems unusable because all the constructors or
2746 destructors in that class are private, and it has neither friends nor
2747 public static member functions. Also warn if there are no non-private
2748 methods, and there's at least one private member function that isn't
2749 a constructor or destructor.
2751 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2752 @opindex Wdelete-non-virtual-dtor
2753 @opindex Wno-delete-non-virtual-dtor
2754 Warn when @code{delete} is used to destroy an instance of a class that
2755 has virtual functions and non-virtual destructor. It is unsafe to delete
2756 an instance of a derived class through a pointer to a base class if the
2757 base class does not have a virtual destructor. This warning is enabled
2760 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2761 @opindex Wliteral-suffix
2762 @opindex Wno-literal-suffix
2763 Warn when a string or character literal is followed by a ud-suffix which does
2764 not begin with an underscore. As a conforming extension, GCC treats such
2765 suffixes as separate preprocessing tokens in order to maintain backwards
2766 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2770 #define __STDC_FORMAT_MACROS
2771 #include <inttypes.h>
2776 printf("My int64: %" PRId64"\n", i64);
2780 In this case, @code{PRId64} is treated as a separate preprocessing token.
2782 This warning is enabled by default.
2784 @item -Wlto-type-mismatch
2785 @opindex Wlto-type-mismatch
2786 @opindex Wno-lto-type-mismatch
2788 During the link-time optimization warn about type mismatches in
2789 global declarations from different compilation units.
2790 Requires @option{-flto} to be enabled. Enabled by default.
2792 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2794 @opindex Wno-narrowing
2795 With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing
2796 conversion prohibited by C++11 occurs within
2800 int i = @{ 2.2 @}; // error: narrowing from double to int
2803 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2805 When a later standard is in effect, e.g. when using @option{-std=c++11},
2806 narrowing conversions are diagnosed by default, as required by the standard.
2807 A narrowing conversion from a constant produces an error,
2808 and a narrowing conversion from a non-constant produces a warning,
2809 but @option{-Wno-narrowing} suppresses the diagnostic.
2810 Note that this does not affect the meaning of well-formed code;
2811 narrowing conversions are still considered ill-formed in SFINAE contexts.
2813 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2815 @opindex Wno-noexcept
2816 Warn when a noexcept-expression evaluates to false because of a call
2817 to a function that does not have a non-throwing exception
2818 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2819 the compiler to never throw an exception.
2821 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2822 @opindex Wnon-virtual-dtor
2823 @opindex Wno-non-virtual-dtor
2824 Warn when a class has virtual functions and an accessible non-virtual
2825 destructor itself or in an accessible polymorphic base class, in which
2826 case it is possible but unsafe to delete an instance of a derived
2827 class through a pointer to the class itself or base class. This
2828 warning is automatically enabled if @option{-Weffc++} is specified.
2830 @item -Wreorder @r{(C++ and Objective-C++ only)}
2832 @opindex Wno-reorder
2833 @cindex reordering, warning
2834 @cindex warning for reordering of member initializers
2835 Warn when the order of member initializers given in the code does not
2836 match the order in which they must be executed. For instance:
2842 A(): j (0), i (1) @{ @}
2847 The compiler rearranges the member initializers for @code{i}
2848 and @code{j} to match the declaration order of the members, emitting
2849 a warning to that effect. This warning is enabled by @option{-Wall}.
2851 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2852 @opindex fext-numeric-literals
2853 @opindex fno-ext-numeric-literals
2854 Accept imaginary, fixed-point, or machine-defined
2855 literal number suffixes as GNU extensions.
2856 When this option is turned off these suffixes are treated
2857 as C++11 user-defined literal numeric suffixes.
2858 This is on by default for all pre-C++11 dialects and all GNU dialects:
2859 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2860 @option{-std=gnu++14}.
2861 This option is off by default
2862 for ISO C++11 onwards (@option{-std=c++11}, ...).
2865 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2868 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2871 Warn about violations of the following style guidelines from Scott Meyers'
2872 @cite{Effective C++} series of books:
2876 Define a copy constructor and an assignment operator for classes
2877 with dynamically-allocated memory.
2880 Prefer initialization to assignment in constructors.
2883 Have @code{operator=} return a reference to @code{*this}.
2886 Don't try to return a reference when you must return an object.
2889 Distinguish between prefix and postfix forms of increment and
2890 decrement operators.
2893 Never overload @code{&&}, @code{||}, or @code{,}.
2897 This option also enables @option{-Wnon-virtual-dtor}, which is also
2898 one of the effective C++ recommendations. However, the check is
2899 extended to warn about the lack of virtual destructor in accessible
2900 non-polymorphic bases classes too.
2902 When selecting this option, be aware that the standard library
2903 headers do not obey all of these guidelines; use @samp{grep -v}
2904 to filter out those warnings.
2906 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2907 @opindex Wstrict-null-sentinel
2908 @opindex Wno-strict-null-sentinel
2909 Warn about the use of an uncasted @code{NULL} as sentinel. When
2910 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2911 to @code{__null}. Although it is a null pointer constant rather than a
2912 null pointer, it is guaranteed to be of the same size as a pointer.
2913 But this use is not portable across different compilers.
2915 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2916 @opindex Wno-non-template-friend
2917 @opindex Wnon-template-friend
2918 Disable warnings when non-templatized friend functions are declared
2919 within a template. Since the advent of explicit template specification
2920 support in G++, if the name of the friend is an unqualified-id (i.e.,
2921 @samp{friend foo(int)}), the C++ language specification demands that the
2922 friend declare or define an ordinary, nontemplate function. (Section
2923 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2924 could be interpreted as a particular specialization of a templatized
2925 function. Because this non-conforming behavior is no longer the default
2926 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2927 check existing code for potential trouble spots and is on by default.
2928 This new compiler behavior can be turned off with
2929 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2930 but disables the helpful warning.
2932 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2933 @opindex Wold-style-cast
2934 @opindex Wno-old-style-cast
2935 Warn if an old-style (C-style) cast to a non-void type is used within
2936 a C++ program. The new-style casts (@code{dynamic_cast},
2937 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
2938 less vulnerable to unintended effects and much easier to search for.
2940 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2941 @opindex Woverloaded-virtual
2942 @opindex Wno-overloaded-virtual
2943 @cindex overloaded virtual function, warning
2944 @cindex warning for overloaded virtual function
2945 Warn when a function declaration hides virtual functions from a
2946 base class. For example, in:
2953 struct B: public A @{
2958 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2969 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2970 @opindex Wno-pmf-conversions
2971 @opindex Wpmf-conversions
2972 Disable the diagnostic for converting a bound pointer to member function
2975 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2976 @opindex Wsign-promo
2977 @opindex Wno-sign-promo
2978 Warn when overload resolution chooses a promotion from unsigned or
2979 enumerated type to a signed type, over a conversion to an unsigned type of
2980 the same size. Previous versions of G++ tried to preserve
2981 unsignedness, but the standard mandates the current behavior.
2983 @item -Wtemplates @r{(C++ and Objective-C++ only)}
2985 Warn when a primary template declaration is encountered. Some coding
2986 rules disallow templates, and this may be used to enforce that rule.
2987 The warning is inactive inside a system header file, such as the STL, so
2988 one can still use the STL. One may also instantiate or specialize
2991 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
2992 @opindex Wmultiple-inheritance
2993 Warn when a class is defined with multiple direct base classes. Some
2994 coding rules disallow multiple inheritance, and this may be used to
2995 enforce that rule. The warning is inactive inside a system header file,
2996 such as the STL, so one can still use the STL. One may also define
2997 classes that indirectly use multiple inheritance.
2999 @item -Wvirtual-inheritance
3000 @opindex Wvirtual-inheritance
3001 Warn when a class is defined with a virtual direct base classe. Some
3002 coding rules disallow multiple inheritance, and this may be used to
3003 enforce that rule. The warning is inactive inside a system header file,
3004 such as the STL, so one can still use the STL. One may also define
3005 classes that indirectly use virtual inheritance.
3008 @opindex Wnamespaces
3009 Warn when a namespace definition is opened. Some coding rules disallow
3010 namespaces, and this may be used to enforce that rule. The warning is
3011 inactive inside a system header file, such as the STL, so one can still
3012 use the STL. One may also use using directives and qualified names.
3014 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3016 @opindex Wno-terminate
3017 Disable the warning about a throw-expression that will immediately
3018 result in a call to @code{terminate}.
3021 @node Objective-C and Objective-C++ Dialect Options
3022 @section Options Controlling Objective-C and Objective-C++ Dialects
3024 @cindex compiler options, Objective-C and Objective-C++
3025 @cindex Objective-C and Objective-C++ options, command-line
3026 @cindex options, Objective-C and Objective-C++
3027 (NOTE: This manual does not describe the Objective-C and Objective-C++
3028 languages themselves. @xref{Standards,,Language Standards
3029 Supported by GCC}, for references.)
3031 This section describes the command-line options that are only meaningful
3032 for Objective-C and Objective-C++ programs. You can also use most of
3033 the language-independent GNU compiler options.
3034 For example, you might compile a file @file{some_class.m} like this:
3037 gcc -g -fgnu-runtime -O -c some_class.m
3041 In this example, @option{-fgnu-runtime} is an option meant only for
3042 Objective-C and Objective-C++ programs; you can use the other options with
3043 any language supported by GCC@.
3045 Note that since Objective-C is an extension of the C language, Objective-C
3046 compilations may also use options specific to the C front-end (e.g.,
3047 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3048 C++-specific options (e.g., @option{-Wabi}).
3050 Here is a list of options that are @emph{only} for compiling Objective-C
3051 and Objective-C++ programs:
3054 @item -fconstant-string-class=@var{class-name}
3055 @opindex fconstant-string-class
3056 Use @var{class-name} as the name of the class to instantiate for each
3057 literal string specified with the syntax @code{@@"@dots{}"}. The default
3058 class name is @code{NXConstantString} if the GNU runtime is being used, and
3059 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3060 @option{-fconstant-cfstrings} option, if also present, overrides the
3061 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3062 to be laid out as constant CoreFoundation strings.
3065 @opindex fgnu-runtime
3066 Generate object code compatible with the standard GNU Objective-C
3067 runtime. This is the default for most types of systems.
3069 @item -fnext-runtime
3070 @opindex fnext-runtime
3071 Generate output compatible with the NeXT runtime. This is the default
3072 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3073 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3076 @item -fno-nil-receivers
3077 @opindex fno-nil-receivers
3078 Assume that all Objective-C message dispatches (@code{[receiver
3079 message:arg]}) in this translation unit ensure that the receiver is
3080 not @code{nil}. This allows for more efficient entry points in the
3081 runtime to be used. This option is only available in conjunction with
3082 the NeXT runtime and ABI version 0 or 1.
3084 @item -fobjc-abi-version=@var{n}
3085 @opindex fobjc-abi-version
3086 Use version @var{n} of the Objective-C ABI for the selected runtime.
3087 This option is currently supported only for the NeXT runtime. In that
3088 case, Version 0 is the traditional (32-bit) ABI without support for
3089 properties and other Objective-C 2.0 additions. Version 1 is the
3090 traditional (32-bit) ABI with support for properties and other
3091 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3092 nothing is specified, the default is Version 0 on 32-bit target
3093 machines, and Version 2 on 64-bit target machines.
3095 @item -fobjc-call-cxx-cdtors
3096 @opindex fobjc-call-cxx-cdtors
3097 For each Objective-C class, check if any of its instance variables is a
3098 C++ object with a non-trivial default constructor. If so, synthesize a
3099 special @code{- (id) .cxx_construct} instance method which runs
3100 non-trivial default constructors on any such instance variables, in order,
3101 and then return @code{self}. Similarly, check if any instance variable
3102 is a C++ object with a non-trivial destructor, and if so, synthesize a
3103 special @code{- (void) .cxx_destruct} method which runs
3104 all such default destructors, in reverse order.
3106 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3107 methods thusly generated only operate on instance variables
3108 declared in the current Objective-C class, and not those inherited
3109 from superclasses. It is the responsibility of the Objective-C
3110 runtime to invoke all such methods in an object's inheritance
3111 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3112 by the runtime immediately after a new object instance is allocated;
3113 the @code{- (void) .cxx_destruct} methods are invoked immediately
3114 before the runtime deallocates an object instance.
3116 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3117 support for invoking the @code{- (id) .cxx_construct} and
3118 @code{- (void) .cxx_destruct} methods.
3120 @item -fobjc-direct-dispatch
3121 @opindex fobjc-direct-dispatch
3122 Allow fast jumps to the message dispatcher. On Darwin this is
3123 accomplished via the comm page.
3125 @item -fobjc-exceptions
3126 @opindex fobjc-exceptions
3127 Enable syntactic support for structured exception handling in
3128 Objective-C, similar to what is offered by C++ and Java. This option
3129 is required to use the Objective-C keywords @code{@@try},
3130 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3131 @code{@@synchronized}. This option is available with both the GNU
3132 runtime and the NeXT runtime (but not available in conjunction with
3133 the NeXT runtime on Mac OS X 10.2 and earlier).
3137 Enable garbage collection (GC) in Objective-C and Objective-C++
3138 programs. This option is only available with the NeXT runtime; the
3139 GNU runtime has a different garbage collection implementation that
3140 does not require special compiler flags.
3142 @item -fobjc-nilcheck
3143 @opindex fobjc-nilcheck
3144 For the NeXT runtime with version 2 of the ABI, check for a nil
3145 receiver in method invocations before doing the actual method call.
3146 This is the default and can be disabled using
3147 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3148 checked for nil in this way no matter what this flag is set to.
3149 Currently this flag does nothing when the GNU runtime, or an older
3150 version of the NeXT runtime ABI, is used.
3152 @item -fobjc-std=objc1
3154 Conform to the language syntax of Objective-C 1.0, the language
3155 recognized by GCC 4.0. This only affects the Objective-C additions to
3156 the C/C++ language; it does not affect conformance to C/C++ standards,
3157 which is controlled by the separate C/C++ dialect option flags. When
3158 this option is used with the Objective-C or Objective-C++ compiler,
3159 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3160 This is useful if you need to make sure that your Objective-C code can
3161 be compiled with older versions of GCC@.
3163 @item -freplace-objc-classes
3164 @opindex freplace-objc-classes
3165 Emit a special marker instructing @command{ld(1)} not to statically link in
3166 the resulting object file, and allow @command{dyld(1)} to load it in at
3167 run time instead. This is used in conjunction with the Fix-and-Continue
3168 debugging mode, where the object file in question may be recompiled and
3169 dynamically reloaded in the course of program execution, without the need
3170 to restart the program itself. Currently, Fix-and-Continue functionality
3171 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3176 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3177 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3178 compile time) with static class references that get initialized at load time,
3179 which improves run-time performance. Specifying the @option{-fzero-link} flag
3180 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3181 to be retained. This is useful in Zero-Link debugging mode, since it allows
3182 for individual class implementations to be modified during program execution.
3183 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3184 regardless of command-line options.
3186 @item -fno-local-ivars
3187 @opindex fno-local-ivars
3188 @opindex flocal-ivars
3189 By default instance variables in Objective-C can be accessed as if
3190 they were local variables from within the methods of the class they're
3191 declared in. This can lead to shadowing between instance variables
3192 and other variables declared either locally inside a class method or
3193 globally with the same name. Specifying the @option{-fno-local-ivars}
3194 flag disables this behavior thus avoiding variable shadowing issues.
3196 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3197 @opindex fivar-visibility
3198 Set the default instance variable visibility to the specified option
3199 so that instance variables declared outside the scope of any access
3200 modifier directives default to the specified visibility.
3204 Dump interface declarations for all classes seen in the source file to a
3205 file named @file{@var{sourcename}.decl}.
3207 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3208 @opindex Wassign-intercept
3209 @opindex Wno-assign-intercept
3210 Warn whenever an Objective-C assignment is being intercepted by the
3213 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3214 @opindex Wno-protocol
3216 If a class is declared to implement a protocol, a warning is issued for
3217 every method in the protocol that is not implemented by the class. The
3218 default behavior is to issue a warning for every method not explicitly
3219 implemented in the class, even if a method implementation is inherited
3220 from the superclass. If you use the @option{-Wno-protocol} option, then
3221 methods inherited from the superclass are considered to be implemented,
3222 and no warning is issued for them.
3224 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3226 @opindex Wno-selector
3227 Warn if multiple methods of different types for the same selector are
3228 found during compilation. The check is performed on the list of methods
3229 in the final stage of compilation. Additionally, a check is performed
3230 for each selector appearing in a @code{@@selector(@dots{})}
3231 expression, and a corresponding method for that selector has been found
3232 during compilation. Because these checks scan the method table only at
3233 the end of compilation, these warnings are not produced if the final
3234 stage of compilation is not reached, for example because an error is
3235 found during compilation, or because the @option{-fsyntax-only} option is
3238 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3239 @opindex Wstrict-selector-match
3240 @opindex Wno-strict-selector-match
3241 Warn if multiple methods with differing argument and/or return types are
3242 found for a given selector when attempting to send a message using this
3243 selector to a receiver of type @code{id} or @code{Class}. When this flag
3244 is off (which is the default behavior), the compiler omits such warnings
3245 if any differences found are confined to types that share the same size
3248 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3249 @opindex Wundeclared-selector
3250 @opindex Wno-undeclared-selector
3251 Warn if a @code{@@selector(@dots{})} expression referring to an
3252 undeclared selector is found. A selector is considered undeclared if no
3253 method with that name has been declared before the
3254 @code{@@selector(@dots{})} expression, either explicitly in an
3255 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3256 an @code{@@implementation} section. This option always performs its
3257 checks as soon as a @code{@@selector(@dots{})} expression is found,
3258 while @option{-Wselector} only performs its checks in the final stage of
3259 compilation. This also enforces the coding style convention
3260 that methods and selectors must be declared before being used.
3262 @item -print-objc-runtime-info
3263 @opindex print-objc-runtime-info
3264 Generate C header describing the largest structure that is passed by
3269 @node Diagnostic Message Formatting Options
3270 @section Options to Control Diagnostic Messages Formatting
3271 @cindex options to control diagnostics formatting
3272 @cindex diagnostic messages
3273 @cindex message formatting
3275 Traditionally, diagnostic messages have been formatted irrespective of
3276 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3277 options described below
3278 to control the formatting algorithm for diagnostic messages,
3279 e.g.@: how many characters per line, how often source location
3280 information should be reported. Note that some language front ends may not
3281 honor these options.
3284 @item -fmessage-length=@var{n}
3285 @opindex fmessage-length
3286 Try to format error messages so that they fit on lines of about
3287 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3288 done; each error message appears on a single line. This is the
3289 default for all front ends.
3291 @item -fdiagnostics-show-location=once
3292 @opindex fdiagnostics-show-location
3293 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3294 reporter to emit source location information @emph{once}; that is, in
3295 case the message is too long to fit on a single physical line and has to
3296 be wrapped, the source location won't be emitted (as prefix) again,
3297 over and over, in subsequent continuation lines. This is the default
3300 @item -fdiagnostics-show-location=every-line
3301 Only meaningful in line-wrapping mode. Instructs the diagnostic
3302 messages reporter to emit the same source location information (as
3303 prefix) for physical lines that result from the process of breaking
3304 a message which is too long to fit on a single line.
3306 @item -fdiagnostics-color[=@var{WHEN}]
3307 @itemx -fno-diagnostics-color
3308 @opindex fdiagnostics-color
3309 @cindex highlight, color
3310 @vindex GCC_COLORS @r{environment variable}
3311 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3312 or @samp{auto}. The default depends on how the compiler has been configured,
3313 it can be any of the above @var{WHEN} options or also @samp{never}
3314 if @env{GCC_COLORS} environment variable isn't present in the environment,
3315 and @samp{auto} otherwise.
3316 @samp{auto} means to use color only when the standard error is a terminal.
3317 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3318 aliases for @option{-fdiagnostics-color=always} and
3319 @option{-fdiagnostics-color=never}, respectively.
3321 The colors are defined by the environment variable @env{GCC_COLORS}.
3322 Its value is a colon-separated list of capabilities and Select Graphic
3323 Rendition (SGR) substrings. SGR commands are interpreted by the
3324 terminal or terminal emulator. (See the section in the documentation
3325 of your text terminal for permitted values and their meanings as
3326 character attributes.) These substring values are integers in decimal
3327 representation and can be concatenated with semicolons.
3328 Common values to concatenate include
3330 @samp{4} for underline,
3332 @samp{7} for inverse,
3333 @samp{39} for default foreground color,
3334 @samp{30} to @samp{37} for foreground colors,
3335 @samp{90} to @samp{97} for 16-color mode foreground colors,
3336 @samp{38;5;0} to @samp{38;5;255}
3337 for 88-color and 256-color modes foreground colors,
3338 @samp{49} for default background color,
3339 @samp{40} to @samp{47} for background colors,
3340 @samp{100} to @samp{107} for 16-color mode background colors,
3341 and @samp{48;5;0} to @samp{48;5;255}
3342 for 88-color and 256-color modes background colors.
3344 The default @env{GCC_COLORS} is
3346 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:quote=01:\
3347 fixit-insert=32:fixit-delete=31:\
3348 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32
3351 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3352 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3353 @samp{01} is bold, and @samp{31} is red.
3354 Setting @env{GCC_COLORS} to the empty string disables colors.
3355 Supported capabilities are as follows.
3359 @vindex error GCC_COLORS @r{capability}
3360 SGR substring for error: markers.
3363 @vindex warning GCC_COLORS @r{capability}
3364 SGR substring for warning: markers.
3367 @vindex note GCC_COLORS @r{capability}
3368 SGR substring for note: markers.
3371 @vindex range1 GCC_COLORS @r{capability}
3372 SGR substring for first additional range.
3375 @vindex range2 GCC_COLORS @r{capability}
3376 SGR substring for second additional range.
3379 @vindex locus GCC_COLORS @r{capability}
3380 SGR substring for location information, @samp{file:line} or
3381 @samp{file:line:column} etc.
3384 @vindex quote GCC_COLORS @r{capability}
3385 SGR substring for information printed within quotes.
3388 @vindex fixit-insert GCC_COLORS @r{capability}
3389 SGR substring for fix-it hints suggesting text to
3390 be inserted or replaced.
3393 @vindex fixit-delete GCC_COLORS @r{capability}
3394 SGR substring for fix-it hints suggesting text to
3397 @item diff-filename=
3398 @vindex diff-filename GCC_COLORS @r{capability}
3399 SGR substring for filename headers within generated patches.
3402 @vindex diff-hunk GCC_COLORS @r{capability}
3403 SGR substring for the starts of hunks within generated patches.
3406 @vindex diff-delete GCC_COLORS @r{capability}
3407 SGR substring for deleted lines within generated patches.
3410 @vindex diff-insert GCC_COLORS @r{capability}
3411 SGR substring for inserted lines within generated patches.
3414 @item -fno-diagnostics-show-option
3415 @opindex fno-diagnostics-show-option
3416 @opindex fdiagnostics-show-option
3417 By default, each diagnostic emitted includes text indicating the
3418 command-line option that directly controls the diagnostic (if such an
3419 option is known to the diagnostic machinery). Specifying the
3420 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3422 @item -fno-diagnostics-show-caret
3423 @opindex fno-diagnostics-show-caret
3424 @opindex fdiagnostics-show-caret
3425 By default, each diagnostic emitted includes the original source line
3426 and a caret @samp{^} indicating the column. This option suppresses this
3427 information. The source line is truncated to @var{n} characters, if
3428 the @option{-fmessage-length=n} option is given. When the output is done
3429 to the terminal, the width is limited to the width given by the
3430 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3432 @item -fdiagnostics-parseable-fixits
3433 @opindex fdiagnostics-parseable-fixits
3434 Emit fix-it hints in a machine-parseable format, suitable for consumption
3435 by IDEs. For each fix-it, a line will be printed after the relevant
3436 diagnostic, starting with the string ``fix-it:''. For example:
3439 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3442 The location is expressed as a half-open range, expressed as a count of
3443 bytes, starting at byte 1 for the initial column. In the above example,
3444 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3448 00000000011111111112222222222
3449 12345678901234567890123456789
3450 gtk_widget_showall (dlg);
3455 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3456 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3457 (e.g. vertical tab as ``\013'').
3459 An empty replacement string indicates that the given range is to be removed.
3460 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3461 be inserted at the given position.
3463 @item -fdiagnostics-generate-patch
3464 @opindex fdiagnostics-generate-patch
3465 Print fix-it hints to stderr in unified diff format, after any diagnostics
3466 are printed. For example:
3473 void show_cb(GtkDialog *dlg)
3475 - gtk_widget_showall(dlg);
3476 + gtk_widget_show_all(dlg);
3481 The diff may or may not be colorized, following the same rules
3482 as for diagnostics (see @option{-fdiagnostics-color}).
3486 @node Warning Options
3487 @section Options to Request or Suppress Warnings
3488 @cindex options to control warnings
3489 @cindex warning messages
3490 @cindex messages, warning
3491 @cindex suppressing warnings
3493 Warnings are diagnostic messages that report constructions that
3494 are not inherently erroneous but that are risky or suggest there
3495 may have been an error.
3497 The following language-independent options do not enable specific
3498 warnings but control the kinds of diagnostics produced by GCC@.
3501 @cindex syntax checking
3503 @opindex fsyntax-only
3504 Check the code for syntax errors, but don't do anything beyond that.
3506 @item -fmax-errors=@var{n}
3507 @opindex fmax-errors
3508 Limits the maximum number of error messages to @var{n}, at which point
3509 GCC bails out rather than attempting to continue processing the source
3510 code. If @var{n} is 0 (the default), there is no limit on the number
3511 of error messages produced. If @option{-Wfatal-errors} is also
3512 specified, then @option{-Wfatal-errors} takes precedence over this
3517 Inhibit all warning messages.
3522 Make all warnings into errors.
3527 Make the specified warning into an error. The specifier for a warning
3528 is appended; for example @option{-Werror=switch} turns the warnings
3529 controlled by @option{-Wswitch} into errors. This switch takes a
3530 negative form, to be used to negate @option{-Werror} for specific
3531 warnings; for example @option{-Wno-error=switch} makes
3532 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3535 The warning message for each controllable warning includes the
3536 option that controls the warning. That option can then be used with
3537 @option{-Werror=} and @option{-Wno-error=} as described above.
3538 (Printing of the option in the warning message can be disabled using the
3539 @option{-fno-diagnostics-show-option} flag.)
3541 Note that specifying @option{-Werror=}@var{foo} automatically implies
3542 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3545 @item -Wfatal-errors
3546 @opindex Wfatal-errors
3547 @opindex Wno-fatal-errors
3548 This option causes the compiler to abort compilation on the first error
3549 occurred rather than trying to keep going and printing further error
3554 You can request many specific warnings with options beginning with
3555 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3556 implicit declarations. Each of these specific warning options also
3557 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3558 example, @option{-Wno-implicit}. This manual lists only one of the
3559 two forms, whichever is not the default. For further
3560 language-specific options also refer to @ref{C++ Dialect Options} and
3561 @ref{Objective-C and Objective-C++ Dialect Options}.
3563 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3564 options, such as @option{-Wunused}, which may turn on further options,
3565 such as @option{-Wunused-value}. The combined effect of positive and
3566 negative forms is that more specific options have priority over less
3567 specific ones, independently of their position in the command-line. For
3568 options of the same specificity, the last one takes effect. Options
3569 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3570 as if they appeared at the end of the command-line.
3572 When an unrecognized warning option is requested (e.g.,
3573 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3574 that the option is not recognized. However, if the @option{-Wno-} form
3575 is used, the behavior is slightly different: no diagnostic is
3576 produced for @option{-Wno-unknown-warning} unless other diagnostics
3577 are being produced. This allows the use of new @option{-Wno-} options
3578 with old compilers, but if something goes wrong, the compiler
3579 warns that an unrecognized option is present.
3586 Issue all the warnings demanded by strict ISO C and ISO C++;
3587 reject all programs that use forbidden extensions, and some other
3588 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3589 version of the ISO C standard specified by any @option{-std} option used.
3591 Valid ISO C and ISO C++ programs should compile properly with or without
3592 this option (though a rare few require @option{-ansi} or a
3593 @option{-std} option specifying the required version of ISO C)@. However,
3594 without this option, certain GNU extensions and traditional C and C++
3595 features are supported as well. With this option, they are rejected.
3597 @option{-Wpedantic} does not cause warning messages for use of the
3598 alternate keywords whose names begin and end with @samp{__}. Pedantic
3599 warnings are also disabled in the expression that follows
3600 @code{__extension__}. However, only system header files should use
3601 these escape routes; application programs should avoid them.
3602 @xref{Alternate Keywords}.
3604 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3605 C conformance. They soon find that it does not do quite what they want:
3606 it finds some non-ISO practices, but not all---only those for which
3607 ISO C @emph{requires} a diagnostic, and some others for which
3608 diagnostics have been added.
3610 A feature to report any failure to conform to ISO C might be useful in
3611 some instances, but would require considerable additional work and would
3612 be quite different from @option{-Wpedantic}. We don't have plans to
3613 support such a feature in the near future.
3615 Where the standard specified with @option{-std} represents a GNU
3616 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3617 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3618 extended dialect is based. Warnings from @option{-Wpedantic} are given
3619 where they are required by the base standard. (It does not make sense
3620 for such warnings to be given only for features not in the specified GNU
3621 C dialect, since by definition the GNU dialects of C include all
3622 features the compiler supports with the given option, and there would be
3623 nothing to warn about.)
3625 @item -pedantic-errors
3626 @opindex pedantic-errors
3627 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3628 requires a diagnostic, in some cases where there is undefined behavior
3629 at compile-time and in some other cases that do not prevent compilation
3630 of programs that are valid according to the standard. This is not
3631 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3632 by this option and not enabled by the latter and vice versa.
3637 This enables all the warnings about constructions that some users
3638 consider questionable, and that are easy to avoid (or modify to
3639 prevent the warning), even in conjunction with macros. This also
3640 enables some language-specific warnings described in @ref{C++ Dialect
3641 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3643 @option{-Wall} turns on the following warning flags:
3645 @gccoptlist{-Waddress @gol
3646 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3648 -Wc++11-compat -Wc++14-compat@gol
3649 -Wchar-subscripts @gol
3651 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3652 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3654 -Wimplicit @r{(C and Objective-C only)} @gol
3655 -Wimplicit-int @r{(C and Objective-C only)} @gol
3656 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3657 -Winit-self @r{(only for C++)} @gol
3658 -Wlogical-not-parentheses
3659 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3660 -Wmaybe-uninitialized @gol
3661 -Wmemset-elt-size @gol
3662 -Wmemset-transposed-args @gol
3663 -Wmisleading-indentation @r{(only for C/C++)} @gol
3664 -Wmissing-braces @r{(only for C/ObjC)} @gol
3665 -Wnarrowing @r{(only for C++)} @gol
3667 -Wnonnull-compare @gol
3673 -Wsequence-point @gol
3674 -Wsign-compare @r{(only in C++)} @gol
3675 -Wsizeof-pointer-memaccess @gol
3676 -Wstrict-aliasing @gol
3677 -Wstrict-overflow=1 @gol
3679 -Wtautological-compare @gol
3681 -Wuninitialized @gol
3682 -Wunknown-pragmas @gol
3683 -Wunused-function @gol
3686 -Wunused-variable @gol
3687 -Wvolatile-register-var @gol
3690 Note that some warning flags are not implied by @option{-Wall}. Some of
3691 them warn about constructions that users generally do not consider
3692 questionable, but which occasionally you might wish to check for;
3693 others warn about constructions that are necessary or hard to avoid in
3694 some cases, and there is no simple way to modify the code to suppress
3695 the warning. Some of them are enabled by @option{-Wextra} but many of
3696 them must be enabled individually.
3702 This enables some extra warning flags that are not enabled by
3703 @option{-Wall}. (This option used to be called @option{-W}. The older
3704 name is still supported, but the newer name is more descriptive.)
3706 @gccoptlist{-Wclobbered @gol
3708 -Wignored-qualifiers @gol
3709 -Wmissing-field-initializers @gol
3710 -Wmissing-parameter-type @r{(C only)} @gol
3711 -Wold-style-declaration @r{(C only)} @gol
3712 -Woverride-init @gol
3713 -Wsign-compare @r{(C only)} @gol
3715 -Wuninitialized @gol
3716 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3717 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3718 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3721 The option @option{-Wextra} also prints warning messages for the
3727 A pointer is compared against integer zero with @code{<}, @code{<=},
3728 @code{>}, or @code{>=}.
3731 (C++ only) An enumerator and a non-enumerator both appear in a
3732 conditional expression.
3735 (C++ only) Ambiguous virtual bases.
3738 (C++ only) Subscripting an array that has been declared @code{register}.
3741 (C++ only) Taking the address of a variable that has been declared
3745 (C++ only) A base class is not initialized in a derived class's copy
3750 @item -Wchar-subscripts
3751 @opindex Wchar-subscripts
3752 @opindex Wno-char-subscripts
3753 Warn if an array subscript has type @code{char}. This is a common cause
3754 of error, as programmers often forget that this type is signed on some
3756 This warning is enabled by @option{-Wall}.
3760 @opindex Wno-comment
3761 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3762 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3763 This warning is enabled by @option{-Wall}.
3765 @item -Wno-coverage-mismatch
3766 @opindex Wno-coverage-mismatch
3767 Warn if feedback profiles do not match when using the
3768 @option{-fprofile-use} option.
3769 If a source file is changed between compiling with @option{-fprofile-gen} and
3770 with @option{-fprofile-use}, the files with the profile feedback can fail
3771 to match the source file and GCC cannot use the profile feedback
3772 information. By default, this warning is enabled and is treated as an
3773 error. @option{-Wno-coverage-mismatch} can be used to disable the
3774 warning or @option{-Wno-error=coverage-mismatch} can be used to
3775 disable the error. Disabling the error for this warning can result in
3776 poorly optimized code and is useful only in the
3777 case of very minor changes such as bug fixes to an existing code-base.
3778 Completely disabling the warning is not recommended.
3781 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3783 Suppress warning messages emitted by @code{#warning} directives.
3785 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3786 @opindex Wdouble-promotion
3787 @opindex Wno-double-promotion
3788 Give a warning when a value of type @code{float} is implicitly
3789 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3790 floating-point unit implement @code{float} in hardware, but emulate
3791 @code{double} in software. On such a machine, doing computations
3792 using @code{double} values is much more expensive because of the
3793 overhead required for software emulation.
3795 It is easy to accidentally do computations with @code{double} because
3796 floating-point literals are implicitly of type @code{double}. For
3800 float area(float radius)
3802 return 3.14159 * radius * radius;
3806 the compiler performs the entire computation with @code{double}
3807 because the floating-point literal is a @code{double}.
3809 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
3810 @opindex Wduplicate-decl-specifier
3811 @opindex Wno-duplicate-decl-specifier
3812 Warn if a declaration has duplicate @code{const}, @code{volatile},
3813 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
3817 @itemx -Wformat=@var{n}
3820 @opindex ffreestanding
3821 @opindex fno-builtin
3823 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3824 the arguments supplied have types appropriate to the format string
3825 specified, and that the conversions specified in the format string make
3826 sense. This includes standard functions, and others specified by format
3827 attributes (@pxref{Function Attributes}), in the @code{printf},
3828 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3829 not in the C standard) families (or other target-specific families).
3830 Which functions are checked without format attributes having been
3831 specified depends on the standard version selected, and such checks of
3832 functions without the attribute specified are disabled by
3833 @option{-ffreestanding} or @option{-fno-builtin}.
3835 The formats are checked against the format features supported by GNU
3836 libc version 2.2. These include all ISO C90 and C99 features, as well
3837 as features from the Single Unix Specification and some BSD and GNU
3838 extensions. Other library implementations may not support all these
3839 features; GCC does not support warning about features that go beyond a
3840 particular library's limitations. However, if @option{-Wpedantic} is used
3841 with @option{-Wformat}, warnings are given about format features not
3842 in the selected standard version (but not for @code{strfmon} formats,
3843 since those are not in any version of the C standard). @xref{C Dialect
3844 Options,,Options Controlling C Dialect}.
3851 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3852 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3853 @option{-Wformat} also checks for null format arguments for several
3854 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3855 aspects of this level of format checking can be disabled by the
3856 options: @option{-Wno-format-contains-nul},
3857 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3858 @option{-Wformat} is enabled by @option{-Wall}.
3860 @item -Wno-format-contains-nul
3861 @opindex Wno-format-contains-nul
3862 @opindex Wformat-contains-nul
3863 If @option{-Wformat} is specified, do not warn about format strings that
3866 @item -Wno-format-extra-args
3867 @opindex Wno-format-extra-args
3868 @opindex Wformat-extra-args
3869 If @option{-Wformat} is specified, do not warn about excess arguments to a
3870 @code{printf} or @code{scanf} format function. The C standard specifies
3871 that such arguments are ignored.
3873 Where the unused arguments lie between used arguments that are
3874 specified with @samp{$} operand number specifications, normally
3875 warnings are still given, since the implementation could not know what
3876 type to pass to @code{va_arg} to skip the unused arguments. However,
3877 in the case of @code{scanf} formats, this option suppresses the
3878 warning if the unused arguments are all pointers, since the Single
3879 Unix Specification says that such unused arguments are allowed.
3881 @item -Wno-format-zero-length
3882 @opindex Wno-format-zero-length
3883 @opindex Wformat-zero-length
3884 If @option{-Wformat} is specified, do not warn about zero-length formats.
3885 The C standard specifies that zero-length formats are allowed.
3890 Enable @option{-Wformat} plus additional format checks. Currently
3891 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3894 @item -Wformat-nonliteral
3895 @opindex Wformat-nonliteral
3896 @opindex Wno-format-nonliteral
3897 If @option{-Wformat} is specified, also warn if the format string is not a
3898 string literal and so cannot be checked, unless the format function
3899 takes its format arguments as a @code{va_list}.
3901 @item -Wformat-security
3902 @opindex Wformat-security
3903 @opindex Wno-format-security
3904 If @option{-Wformat} is specified, also warn about uses of format
3905 functions that represent possible security problems. At present, this
3906 warns about calls to @code{printf} and @code{scanf} functions where the
3907 format string is not a string literal and there are no format arguments,
3908 as in @code{printf (foo);}. This may be a security hole if the format
3909 string came from untrusted input and contains @samp{%n}. (This is
3910 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3911 in future warnings may be added to @option{-Wformat-security} that are not
3912 included in @option{-Wformat-nonliteral}.)
3914 @item -Wformat-signedness
3915 @opindex Wformat-signedness
3916 @opindex Wno-format-signedness
3917 If @option{-Wformat} is specified, also warn if the format string
3918 requires an unsigned argument and the argument is signed and vice versa.
3921 @opindex Wformat-y2k
3922 @opindex Wno-format-y2k
3923 If @option{-Wformat} is specified, also warn about @code{strftime}
3924 formats that may yield only a two-digit year.
3929 @opindex Wno-nonnull
3930 Warn about passing a null pointer for arguments marked as
3931 requiring a non-null value by the @code{nonnull} function attribute.
3933 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3934 can be disabled with the @option{-Wno-nonnull} option.
3936 @item -Wnonnull-compare
3937 @opindex Wnonnull-compare
3938 @opindex Wno-nonnull-compare
3939 Warn when comparing an argument marked with the @code{nonnull}
3940 function attribute against null inside the function.
3942 @option{-Wnonnull-compare} is included in @option{-Wall}. It
3943 can be disabled with the @option{-Wno-nonnull-compare} option.
3945 @item -Wnull-dereference
3946 @opindex Wnull-dereference
3947 @opindex Wno-null-dereference
3948 Warn if the compiler detects paths that trigger erroneous or
3949 undefined behavior due to dereferencing a null pointer. This option
3950 is only active when @option{-fdelete-null-pointer-checks} is active,
3951 which is enabled by optimizations in most targets. The precision of
3952 the warnings depends on the optimization options used.
3954 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3956 @opindex Wno-init-self
3957 Warn about uninitialized variables that are initialized with themselves.
3958 Note this option can only be used with the @option{-Wuninitialized} option.
3960 For example, GCC warns about @code{i} being uninitialized in the
3961 following snippet only when @option{-Winit-self} has been specified:
3972 This warning is enabled by @option{-Wall} in C++.
3974 @item -Wimplicit-int @r{(C and Objective-C only)}
3975 @opindex Wimplicit-int
3976 @opindex Wno-implicit-int
3977 Warn when a declaration does not specify a type.
3978 This warning is enabled by @option{-Wall}.
3980 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3981 @opindex Wimplicit-function-declaration
3982 @opindex Wno-implicit-function-declaration
3983 Give a warning whenever a function is used before being declared. In
3984 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3985 enabled by default and it is made into an error by
3986 @option{-pedantic-errors}. This warning is also enabled by
3989 @item -Wimplicit @r{(C and Objective-C only)}
3991 @opindex Wno-implicit
3992 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3993 This warning is enabled by @option{-Wall}.
3995 @item -Wignored-qualifiers @r{(C and C++ only)}
3996 @opindex Wignored-qualifiers
3997 @opindex Wno-ignored-qualifiers
3998 Warn if the return type of a function has a type qualifier
3999 such as @code{const}. For ISO C such a type qualifier has no effect,
4000 since the value returned by a function is not an lvalue.
4001 For C++, the warning is only emitted for scalar types or @code{void}.
4002 ISO C prohibits qualified @code{void} return types on function
4003 definitions, so such return types always receive a warning
4004 even without this option.
4006 This warning is also enabled by @option{-Wextra}.
4008 @item -Wignored-attributes @r{(C and C++ only)}
4009 @opindex Wignored-attributes
4010 @opindex Wno-ignored-attributes
4011 Warn when an attribute is ignored. This is different from the
4012 @option{-Wattributes} option in that it warns whenever the compiler decides
4013 to drop an attribute, not that the attribute is either unknown, used in a
4014 wrong place, etc. This warning is enabled by default.
4019 Warn if the type of @code{main} is suspicious. @code{main} should be
4020 a function with external linkage, returning int, taking either zero
4021 arguments, two, or three arguments of appropriate types. This warning
4022 is enabled by default in C++ and is enabled by either @option{-Wall}
4023 or @option{-Wpedantic}.
4025 @item -Wmisleading-indentation @r{(C and C++ only)}
4026 @opindex Wmisleading-indentation
4027 @opindex Wno-misleading-indentation
4028 Warn when the indentation of the code does not reflect the block structure.
4029 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4030 @code{for} clauses with a guarded statement that does not use braces,
4031 followed by an unguarded statement with the same indentation.
4033 In the following example, the call to ``bar'' is misleadingly indented as
4034 if it were guarded by the ``if'' conditional.
4037 if (some_condition ())
4039 bar (); /* Gotcha: this is not guarded by the "if". */
4042 In the case of mixed tabs and spaces, the warning uses the
4043 @option{-ftabstop=} option to determine if the statements line up
4046 The warning is not issued for code involving multiline preprocessor logic
4047 such as the following example.
4052 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4058 The warning is not issued after a @code{#line} directive, since this
4059 typically indicates autogenerated code, and no assumptions can be made
4060 about the layout of the file that the directive references.
4062 This warning is enabled by @option{-Wall} in C and C++.
4064 @item -Wmissing-braces
4065 @opindex Wmissing-braces
4066 @opindex Wno-missing-braces
4067 Warn if an aggregate or union initializer is not fully bracketed. In
4068 the following example, the initializer for @code{a} is not fully
4069 bracketed, but that for @code{b} is fully bracketed. This warning is
4070 enabled by @option{-Wall} in C.
4073 int a[2][2] = @{ 0, 1, 2, 3 @};
4074 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4077 This warning is enabled by @option{-Wall}.
4079 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4080 @opindex Wmissing-include-dirs
4081 @opindex Wno-missing-include-dirs
4082 Warn if a user-supplied include directory does not exist.
4085 @opindex Wparentheses
4086 @opindex Wno-parentheses
4087 Warn if parentheses are omitted in certain contexts, such
4088 as when there is an assignment in a context where a truth value
4089 is expected, or when operators are nested whose precedence people
4090 often get confused about.
4092 Also warn if a comparison like @code{x<=y<=z} appears; this is
4093 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4094 interpretation from that of ordinary mathematical notation.
4096 Also warn for dangerous uses of the GNU extension to
4097 @code{?:} with omitted middle operand. When the condition
4098 in the @code{?}: operator is a boolean expression, the omitted value is
4099 always 1. Often programmers expect it to be a value computed
4100 inside the conditional expression instead.
4102 This warning is enabled by @option{-Wall}.
4104 @item -Wsequence-point
4105 @opindex Wsequence-point
4106 @opindex Wno-sequence-point
4107 Warn about code that may have undefined semantics because of violations
4108 of sequence point rules in the C and C++ standards.
4110 The C and C++ standards define the order in which expressions in a C/C++
4111 program are evaluated in terms of @dfn{sequence points}, which represent
4112 a partial ordering between the execution of parts of the program: those
4113 executed before the sequence point, and those executed after it. These
4114 occur after the evaluation of a full expression (one which is not part
4115 of a larger expression), after the evaluation of the first operand of a
4116 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4117 function is called (but after the evaluation of its arguments and the
4118 expression denoting the called function), and in certain other places.
4119 Other than as expressed by the sequence point rules, the order of
4120 evaluation of subexpressions of an expression is not specified. All
4121 these rules describe only a partial order rather than a total order,
4122 since, for example, if two functions are called within one expression
4123 with no sequence point between them, the order in which the functions
4124 are called is not specified. However, the standards committee have
4125 ruled that function calls do not overlap.
4127 It is not specified when between sequence points modifications to the
4128 values of objects take effect. Programs whose behavior depends on this
4129 have undefined behavior; the C and C++ standards specify that ``Between
4130 the previous and next sequence point an object shall have its stored
4131 value modified at most once by the evaluation of an expression.
4132 Furthermore, the prior value shall be read only to determine the value
4133 to be stored.''. If a program breaks these rules, the results on any
4134 particular implementation are entirely unpredictable.
4136 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4137 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4138 diagnosed by this option, and it may give an occasional false positive
4139 result, but in general it has been found fairly effective at detecting
4140 this sort of problem in programs.
4142 The C++17 standard will define the order of evaluation of operands in
4143 more cases: in particular it requires that the right-hand side of an
4144 assignment be evaluated before the left-hand side, so the above
4145 examples are no longer undefined. But this warning will still warn
4146 about them, to help people avoid writing code that is undefined in C
4147 and earlier revisions of C++.
4149 The standard is worded confusingly, therefore there is some debate
4150 over the precise meaning of the sequence point rules in subtle cases.
4151 Links to discussions of the problem, including proposed formal
4152 definitions, may be found on the GCC readings page, at
4153 @uref{http://gcc.gnu.org/@/readings.html}.
4155 This warning is enabled by @option{-Wall} for C and C++.
4157 @item -Wno-return-local-addr
4158 @opindex Wno-return-local-addr
4159 @opindex Wreturn-local-addr
4160 Do not warn about returning a pointer (or in C++, a reference) to a
4161 variable that goes out of scope after the function returns.
4164 @opindex Wreturn-type
4165 @opindex Wno-return-type
4166 Warn whenever a function is defined with a return type that defaults
4167 to @code{int}. Also warn about any @code{return} statement with no
4168 return value in a function whose return type is not @code{void}
4169 (falling off the end of the function body is considered returning
4172 For C only, warn about a @code{return} statement with an expression in a
4173 function whose return type is @code{void}, unless the expression type is
4174 also @code{void}. As a GNU extension, the latter case is accepted
4175 without a warning unless @option{-Wpedantic} is used.
4177 For C++, a function without return type always produces a diagnostic
4178 message, even when @option{-Wno-return-type} is specified. The only
4179 exceptions are @code{main} and functions defined in system headers.
4181 This warning is enabled by @option{-Wall}.
4183 @item -Wshift-count-negative
4184 @opindex Wshift-count-negative
4185 @opindex Wno-shift-count-negative
4186 Warn if shift count is negative. This warning is enabled by default.
4188 @item -Wshift-count-overflow
4189 @opindex Wshift-count-overflow
4190 @opindex Wno-shift-count-overflow
4191 Warn if shift count >= width of type. This warning is enabled by default.
4193 @item -Wshift-negative-value
4194 @opindex Wshift-negative-value
4195 @opindex Wno-shift-negative-value
4196 Warn if left shifting a negative value. This warning is enabled by
4197 @option{-Wextra} in C99 and C++11 modes (and newer).
4199 @item -Wshift-overflow
4200 @itemx -Wshift-overflow=@var{n}
4201 @opindex Wshift-overflow
4202 @opindex Wno-shift-overflow
4203 Warn about left shift overflows. This warning is enabled by
4204 default in C99 and C++11 modes (and newer).
4207 @item -Wshift-overflow=1
4208 This is the warning level of @option{-Wshift-overflow} and is enabled
4209 by default in C99 and C++11 modes (and newer). This warning level does
4210 not warn about left-shifting 1 into the sign bit. (However, in C, such
4211 an overflow is still rejected in contexts where an integer constant expression
4214 @item -Wshift-overflow=2
4215 This warning level also warns about left-shifting 1 into the sign bit,
4216 unless C++14 mode is active.
4222 Warn whenever a @code{switch} statement has an index of enumerated type
4223 and lacks a @code{case} for one or more of the named codes of that
4224 enumeration. (The presence of a @code{default} label prevents this
4225 warning.) @code{case} labels outside the enumeration range also
4226 provoke warnings when this option is used (even if there is a
4227 @code{default} label).
4228 This warning is enabled by @option{-Wall}.
4230 @item -Wswitch-default
4231 @opindex Wswitch-default
4232 @opindex Wno-switch-default
4233 Warn whenever a @code{switch} statement does not have a @code{default}
4237 @opindex Wswitch-enum
4238 @opindex Wno-switch-enum
4239 Warn whenever a @code{switch} statement has an index of enumerated type
4240 and lacks a @code{case} for one or more of the named codes of that
4241 enumeration. @code{case} labels outside the enumeration range also
4242 provoke warnings when this option is used. The only difference
4243 between @option{-Wswitch} and this option is that this option gives a
4244 warning about an omitted enumeration code even if there is a
4245 @code{default} label.
4248 @opindex Wswitch-bool
4249 @opindex Wno-switch-bool
4250 Warn whenever a @code{switch} statement has an index of boolean type
4251 and the case values are outside the range of a boolean type.
4252 It is possible to suppress this warning by casting the controlling
4253 expression to a type other than @code{bool}. For example:
4256 switch ((int) (a == 4))
4262 This warning is enabled by default for C and C++ programs.
4264 @item -Wswitch-unreachable
4265 @opindex Wswitch-unreachable
4266 @opindex Wno-switch-unreachable
4267 Warn whenever a @code{switch} statement contains statements between the
4268 controlling expression and the first case label, which will never be
4269 executed. For example:
4281 @option{-Wswitch-unreachable} does not warn if the statement between the
4282 controlling expression and the first case label is just a declaration:
4295 This warning is enabled by default for C and C++ programs.
4297 @item -Wsync-nand @r{(C and C++ only)}
4299 @opindex Wno-sync-nand
4300 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4301 built-in functions are used. These functions changed semantics in GCC 4.4.
4305 @opindex Wno-trigraphs
4306 Warn if any trigraphs are encountered that might change the meaning of
4307 the program (trigraphs within comments are not warned about).
4308 This warning is enabled by @option{-Wall}.
4310 @item -Wunused-but-set-parameter
4311 @opindex Wunused-but-set-parameter
4312 @opindex Wno-unused-but-set-parameter
4313 Warn whenever a function parameter is assigned to, but otherwise unused
4314 (aside from its declaration).
4316 To suppress this warning use the @code{unused} attribute
4317 (@pxref{Variable Attributes}).
4319 This warning is also enabled by @option{-Wunused} together with
4322 @item -Wunused-but-set-variable
4323 @opindex Wunused-but-set-variable
4324 @opindex Wno-unused-but-set-variable
4325 Warn whenever a local variable is assigned to, but otherwise unused
4326 (aside from its declaration).
4327 This warning is enabled by @option{-Wall}.
4329 To suppress this warning use the @code{unused} attribute
4330 (@pxref{Variable Attributes}).
4332 This warning is also enabled by @option{-Wunused}, which is enabled
4335 @item -Wunused-function
4336 @opindex Wunused-function
4337 @opindex Wno-unused-function
4338 Warn whenever a static function is declared but not defined or a
4339 non-inline static function is unused.
4340 This warning is enabled by @option{-Wall}.
4342 @item -Wunused-label
4343 @opindex Wunused-label
4344 @opindex Wno-unused-label
4345 Warn whenever a label is declared but not used.
4346 This warning is enabled by @option{-Wall}.
4348 To suppress this warning use the @code{unused} attribute
4349 (@pxref{Variable Attributes}).
4351 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4352 @opindex Wunused-local-typedefs
4353 Warn when a typedef locally defined in a function is not used.
4354 This warning is enabled by @option{-Wall}.
4356 @item -Wunused-parameter
4357 @opindex Wunused-parameter
4358 @opindex Wno-unused-parameter
4359 Warn whenever a function parameter is unused aside from its declaration.
4361 To suppress this warning use the @code{unused} attribute
4362 (@pxref{Variable Attributes}).
4364 @item -Wno-unused-result
4365 @opindex Wunused-result
4366 @opindex Wno-unused-result
4367 Do not warn if a caller of a function marked with attribute
4368 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4369 its return value. The default is @option{-Wunused-result}.
4371 @item -Wunused-variable
4372 @opindex Wunused-variable
4373 @opindex Wno-unused-variable
4374 Warn whenever a local or static variable is unused aside from its
4375 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4376 but not for C++. This warning is enabled by @option{-Wall}.
4378 To suppress this warning use the @code{unused} attribute
4379 (@pxref{Variable Attributes}).
4381 @item -Wunused-const-variable
4382 @itemx -Wunused-const-variable=@var{n}
4383 @opindex Wunused-const-variable
4384 @opindex Wno-unused-const-variable
4385 Warn whenever a constant static variable is unused aside from its declaration.
4386 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4387 for C, but not for C++. In C this declares variable storage, but in C++ this
4388 is not an error since const variables take the place of @code{#define}s.
4390 To suppress this warning use the @code{unused} attribute
4391 (@pxref{Variable Attributes}).
4394 @item -Wunused-const-variable=1
4395 This is the warning level that is enabled by @option{-Wunused-variable} for
4396 C. It warns only about unused static const variables defined in the main
4397 compilation unit, but not about static const variables declared in any
4400 @item -Wunused-const-variable=2
4401 This warning level also warns for unused constant static variables in
4402 headers (excluding system headers). This is the warning level of
4403 @option{-Wunused-const-variable} and must be explicitly requested since
4404 in C++ this isn't an error and in C it might be harder to clean up all
4408 @item -Wunused-value
4409 @opindex Wunused-value
4410 @opindex Wno-unused-value
4411 Warn whenever a statement computes a result that is explicitly not
4412 used. To suppress this warning cast the unused expression to
4413 @code{void}. This includes an expression-statement or the left-hand
4414 side of a comma expression that contains no side effects. For example,
4415 an expression such as @code{x[i,j]} causes a warning, while
4416 @code{x[(void)i,j]} does not.
4418 This warning is enabled by @option{-Wall}.
4423 All the above @option{-Wunused} options combined.
4425 In order to get a warning about an unused function parameter, you must
4426 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4427 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4429 @item -Wuninitialized
4430 @opindex Wuninitialized
4431 @opindex Wno-uninitialized
4432 Warn if an automatic variable is used without first being initialized
4433 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4434 warn if a non-static reference or non-static @code{const} member
4435 appears in a class without constructors.
4437 If you want to warn about code that uses the uninitialized value of the
4438 variable in its own initializer, use the @option{-Winit-self} option.
4440 These warnings occur for individual uninitialized or clobbered
4441 elements of structure, union or array variables as well as for
4442 variables that are uninitialized or clobbered as a whole. They do
4443 not occur for variables or elements declared @code{volatile}. Because
4444 these warnings depend on optimization, the exact variables or elements
4445 for which there are warnings depends on the precise optimization
4446 options and version of GCC used.
4448 Note that there may be no warning about a variable that is used only
4449 to compute a value that itself is never used, because such
4450 computations may be deleted by data flow analysis before the warnings
4453 @item -Winvalid-memory-model
4454 @opindex Winvalid-memory-model
4455 @opindex Wno-invalid-memory-model
4456 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4457 and the C11 atomic generic functions with a memory consistency argument
4458 that is either invalid for the operation or outside the range of values
4459 of the @code{memory_order} enumeration. For example, since the
4460 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4461 defined for the relaxed, release, and sequentially consistent memory
4462 orders the following code is diagnosed:
4467 __atomic_store_n (i, 0, memory_order_consume);
4471 @option{-Winvalid-memory-model} is enabled by default.
4473 @item -Wmaybe-uninitialized
4474 @opindex Wmaybe-uninitialized
4475 @opindex Wno-maybe-uninitialized
4476 For an automatic variable, if there exists a path from the function
4477 entry to a use of the variable that is initialized, but there exist
4478 some other paths for which the variable is not initialized, the compiler
4479 emits a warning if it cannot prove the uninitialized paths are not
4480 executed at run time. These warnings are made optional because GCC is
4481 not smart enough to see all the reasons why the code might be correct
4482 in spite of appearing to have an error. Here is one example of how
4503 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4504 always initialized, but GCC doesn't know this. To suppress the
4505 warning, you need to provide a default case with assert(0) or
4508 @cindex @code{longjmp} warnings
4509 This option also warns when a non-volatile automatic variable might be
4510 changed by a call to @code{longjmp}. These warnings as well are possible
4511 only in optimizing compilation.
4513 The compiler sees only the calls to @code{setjmp}. It cannot know
4514 where @code{longjmp} will be called; in fact, a signal handler could
4515 call it at any point in the code. As a result, you may get a warning
4516 even when there is in fact no problem because @code{longjmp} cannot
4517 in fact be called at the place that would cause a problem.
4519 Some spurious warnings can be avoided if you declare all the functions
4520 you use that never return as @code{noreturn}. @xref{Function
4523 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4525 @item -Wunknown-pragmas
4526 @opindex Wunknown-pragmas
4527 @opindex Wno-unknown-pragmas
4528 @cindex warning for unknown pragmas
4529 @cindex unknown pragmas, warning
4530 @cindex pragmas, warning of unknown
4531 Warn when a @code{#pragma} directive is encountered that is not understood by
4532 GCC@. If this command-line option is used, warnings are even issued
4533 for unknown pragmas in system header files. This is not the case if
4534 the warnings are only enabled by the @option{-Wall} command-line option.
4537 @opindex Wno-pragmas
4539 Do not warn about misuses of pragmas, such as incorrect parameters,
4540 invalid syntax, or conflicts between pragmas. See also
4541 @option{-Wunknown-pragmas}.
4543 @item -Wstrict-aliasing
4544 @opindex Wstrict-aliasing
4545 @opindex Wno-strict-aliasing
4546 This option is only active when @option{-fstrict-aliasing} is active.
4547 It warns about code that might break the strict aliasing rules that the
4548 compiler is using for optimization. The warning does not catch all
4549 cases, but does attempt to catch the more common pitfalls. It is
4550 included in @option{-Wall}.
4551 It is equivalent to @option{-Wstrict-aliasing=3}
4553 @item -Wstrict-aliasing=n
4554 @opindex Wstrict-aliasing=n
4555 This option is only active when @option{-fstrict-aliasing} is active.
4556 It warns about code that might break the strict aliasing rules that the
4557 compiler is using for optimization.
4558 Higher levels correspond to higher accuracy (fewer false positives).
4559 Higher levels also correspond to more effort, similar to the way @option{-O}
4561 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4563 Level 1: Most aggressive, quick, least accurate.
4564 Possibly useful when higher levels
4565 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4566 false negatives. However, it has many false positives.
4567 Warns for all pointer conversions between possibly incompatible types,
4568 even if never dereferenced. Runs in the front end only.
4570 Level 2: Aggressive, quick, not too precise.
4571 May still have many false positives (not as many as level 1 though),
4572 and few false negatives (but possibly more than level 1).
4573 Unlike level 1, it only warns when an address is taken. Warns about
4574 incomplete types. Runs in the front end only.
4576 Level 3 (default for @option{-Wstrict-aliasing}):
4577 Should have very few false positives and few false
4578 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4579 Takes care of the common pun+dereference pattern in the front end:
4580 @code{*(int*)&some_float}.
4581 If optimization is enabled, it also runs in the back end, where it deals
4582 with multiple statement cases using flow-sensitive points-to information.
4583 Only warns when the converted pointer is dereferenced.
4584 Does not warn about incomplete types.
4586 @item -Wstrict-overflow
4587 @itemx -Wstrict-overflow=@var{n}
4588 @opindex Wstrict-overflow
4589 @opindex Wno-strict-overflow
4590 This option is only active when @option{-fstrict-overflow} is active.
4591 It warns about cases where the compiler optimizes based on the
4592 assumption that signed overflow does not occur. Note that it does not
4593 warn about all cases where the code might overflow: it only warns
4594 about cases where the compiler implements some optimization. Thus
4595 this warning depends on the optimization level.
4597 An optimization that assumes that signed overflow does not occur is
4598 perfectly safe if the values of the variables involved are such that
4599 overflow never does, in fact, occur. Therefore this warning can
4600 easily give a false positive: a warning about code that is not
4601 actually a problem. To help focus on important issues, several
4602 warning levels are defined. No warnings are issued for the use of
4603 undefined signed overflow when estimating how many iterations a loop
4604 requires, in particular when determining whether a loop will be
4608 @item -Wstrict-overflow=1
4609 Warn about cases that are both questionable and easy to avoid. For
4610 example, with @option{-fstrict-overflow}, the compiler simplifies
4611 @code{x + 1 > x} to @code{1}. This level of
4612 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4613 are not, and must be explicitly requested.
4615 @item -Wstrict-overflow=2
4616 Also warn about other cases where a comparison is simplified to a
4617 constant. For example: @code{abs (x) >= 0}. This can only be
4618 simplified when @option{-fstrict-overflow} is in effect, because
4619 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4620 zero. @option{-Wstrict-overflow} (with no level) is the same as
4621 @option{-Wstrict-overflow=2}.
4623 @item -Wstrict-overflow=3
4624 Also warn about other cases where a comparison is simplified. For
4625 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4627 @item -Wstrict-overflow=4
4628 Also warn about other simplifications not covered by the above cases.
4629 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4631 @item -Wstrict-overflow=5
4632 Also warn about cases where the compiler reduces the magnitude of a
4633 constant involved in a comparison. For example: @code{x + 2 > y} is
4634 simplified to @code{x + 1 >= y}. This is reported only at the
4635 highest warning level because this simplification applies to many
4636 comparisons, so this warning level gives a very large number of
4640 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4641 @opindex Wsuggest-attribute=
4642 @opindex Wno-suggest-attribute=
4643 Warn for cases where adding an attribute may be beneficial. The
4644 attributes currently supported are listed below.
4647 @item -Wsuggest-attribute=pure
4648 @itemx -Wsuggest-attribute=const
4649 @itemx -Wsuggest-attribute=noreturn
4650 @opindex Wsuggest-attribute=pure
4651 @opindex Wno-suggest-attribute=pure
4652 @opindex Wsuggest-attribute=const
4653 @opindex Wno-suggest-attribute=const
4654 @opindex Wsuggest-attribute=noreturn
4655 @opindex Wno-suggest-attribute=noreturn
4657 Warn about functions that might be candidates for attributes
4658 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4659 functions visible in other compilation units or (in the case of @code{pure} and
4660 @code{const}) if it cannot prove that the function returns normally. A function
4661 returns normally if it doesn't contain an infinite loop or return abnormally
4662 by throwing, calling @code{abort} or trapping. This analysis requires option
4663 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4664 higher. Higher optimization levels improve the accuracy of the analysis.
4666 @item -Wsuggest-attribute=format
4667 @itemx -Wmissing-format-attribute
4668 @opindex Wsuggest-attribute=format
4669 @opindex Wmissing-format-attribute
4670 @opindex Wno-suggest-attribute=format
4671 @opindex Wno-missing-format-attribute
4675 Warn about function pointers that might be candidates for @code{format}
4676 attributes. Note these are only possible candidates, not absolute ones.
4677 GCC guesses that function pointers with @code{format} attributes that
4678 are used in assignment, initialization, parameter passing or return
4679 statements should have a corresponding @code{format} attribute in the
4680 resulting type. I.e.@: the left-hand side of the assignment or
4681 initialization, the type of the parameter variable, or the return type
4682 of the containing function respectively should also have a @code{format}
4683 attribute to avoid the warning.
4685 GCC also warns about function definitions that might be
4686 candidates for @code{format} attributes. Again, these are only
4687 possible candidates. GCC guesses that @code{format} attributes
4688 might be appropriate for any function that calls a function like
4689 @code{vprintf} or @code{vscanf}, but this might not always be the
4690 case, and some functions for which @code{format} attributes are
4691 appropriate may not be detected.
4694 @item -Wsuggest-final-types
4695 @opindex Wno-suggest-final-types
4696 @opindex Wsuggest-final-types
4697 Warn about types with virtual methods where code quality would be improved
4698 if the type were declared with the C++11 @code{final} specifier,
4700 declared in an anonymous namespace. This allows GCC to more aggressively
4701 devirtualize the polymorphic calls. This warning is more effective with link
4702 time optimization, where the information about the class hierarchy graph is
4705 @item -Wsuggest-final-methods
4706 @opindex Wno-suggest-final-methods
4707 @opindex Wsuggest-final-methods
4708 Warn about virtual methods where code quality would be improved if the method
4709 were declared with the C++11 @code{final} specifier,
4710 or, if possible, its type were
4711 declared in an anonymous namespace or with the @code{final} specifier.
4713 more effective with link time optimization, where the information about the
4714 class hierarchy graph is more complete. It is recommended to first consider
4715 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4718 @item -Wsuggest-override
4719 Warn about overriding virtual functions that are not marked with the override
4722 @item -Warray-bounds
4723 @itemx -Warray-bounds=@var{n}
4724 @opindex Wno-array-bounds
4725 @opindex Warray-bounds
4726 This option is only active when @option{-ftree-vrp} is active
4727 (default for @option{-O2} and above). It warns about subscripts to arrays
4728 that are always out of bounds. This warning is enabled by @option{-Wall}.
4731 @item -Warray-bounds=1
4732 This is the warning level of @option{-Warray-bounds} and is enabled
4733 by @option{-Wall}; higher levels are not, and must be explicitly requested.
4735 @item -Warray-bounds=2
4736 This warning level also warns about out of bounds access for
4737 arrays at the end of a struct and for arrays accessed through
4738 pointers. This warning level may give a larger number of
4739 false positives and is deactivated by default.
4742 @item -Wbool-compare
4743 @opindex Wno-bool-compare
4744 @opindex Wbool-compare
4745 Warn about boolean expression compared with an integer value different from
4746 @code{true}/@code{false}. For instance, the following comparison is
4751 if ((n > 1) == 2) @{ @dots{} @}
4753 This warning is enabled by @option{-Wall}.
4755 @item -Wduplicated-cond
4756 @opindex Wno-duplicated-cond
4757 @opindex Wduplicated-cond
4758 Warn about duplicated conditions in an if-else-if chain. For instance,
4759 warn for the following code:
4761 if (p->q != NULL) @{ @dots{} @}
4762 else if (p->q != NULL) @{ @dots{} @}
4765 @item -Wframe-address
4766 @opindex Wno-frame-address
4767 @opindex Wframe-address
4768 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
4769 is called with an argument greater than 0. Such calls may return indeterminate
4770 values or crash the program. The warning is included in @option{-Wall}.
4772 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
4773 @opindex Wno-discarded-qualifiers
4774 @opindex Wdiscarded-qualifiers
4775 Do not warn if type qualifiers on pointers are being discarded.
4776 Typically, the compiler warns if a @code{const char *} variable is
4777 passed to a function that takes a @code{char *} parameter. This option
4778 can be used to suppress such a warning.
4780 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
4781 @opindex Wno-discarded-array-qualifiers
4782 @opindex Wdiscarded-array-qualifiers
4783 Do not warn if type qualifiers on arrays which are pointer targets
4784 are being discarded. Typically, the compiler warns if a
4785 @code{const int (*)[]} variable is passed to a function that
4786 takes a @code{int (*)[]} parameter. This option can be used to
4787 suppress such a warning.
4789 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
4790 @opindex Wno-incompatible-pointer-types
4791 @opindex Wincompatible-pointer-types
4792 Do not warn when there is a conversion between pointers that have incompatible
4793 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
4794 which warns for pointer argument passing or assignment with different
4797 @item -Wno-int-conversion @r{(C and Objective-C only)}
4798 @opindex Wno-int-conversion
4799 @opindex Wint-conversion
4800 Do not warn about incompatible integer to pointer and pointer to integer
4801 conversions. This warning is about implicit conversions; for explicit
4802 conversions the warnings @option{-Wno-int-to-pointer-cast} and
4803 @option{-Wno-pointer-to-int-cast} may be used.
4805 @item -Wno-div-by-zero
4806 @opindex Wno-div-by-zero
4807 @opindex Wdiv-by-zero
4808 Do not warn about compile-time integer division by zero. Floating-point
4809 division by zero is not warned about, as it can be a legitimate way of
4810 obtaining infinities and NaNs.
4812 @item -Wsystem-headers
4813 @opindex Wsystem-headers
4814 @opindex Wno-system-headers
4815 @cindex warnings from system headers
4816 @cindex system headers, warnings from
4817 Print warning messages for constructs found in system header files.
4818 Warnings from system headers are normally suppressed, on the assumption
4819 that they usually do not indicate real problems and would only make the
4820 compiler output harder to read. Using this command-line option tells
4821 GCC to emit warnings from system headers as if they occurred in user
4822 code. However, note that using @option{-Wall} in conjunction with this
4823 option does @emph{not} warn about unknown pragmas in system
4824 headers---for that, @option{-Wunknown-pragmas} must also be used.
4826 @item -Wtautological-compare
4827 @opindex Wtautological-compare
4828 @opindex Wno-tautological-compare
4829 Warn if a self-comparison always evaluates to true or false. This
4830 warning detects various mistakes such as:
4834 if (i > i) @{ @dots{} @}
4836 This warning is enabled by @option{-Wall}.
4839 @opindex Wtrampolines
4840 @opindex Wno-trampolines
4841 Warn about trampolines generated for pointers to nested functions.
4842 A trampoline is a small piece of data or code that is created at run
4843 time on the stack when the address of a nested function is taken, and is
4844 used to call the nested function indirectly. For some targets, it is
4845 made up of data only and thus requires no special treatment. But, for
4846 most targets, it is made up of code and thus requires the stack to be
4847 made executable in order for the program to work properly.
4850 @opindex Wfloat-equal
4851 @opindex Wno-float-equal
4852 Warn if floating-point values are used in equality comparisons.
4854 The idea behind this is that sometimes it is convenient (for the
4855 programmer) to consider floating-point values as approximations to
4856 infinitely precise real numbers. If you are doing this, then you need
4857 to compute (by analyzing the code, or in some other way) the maximum or
4858 likely maximum error that the computation introduces, and allow for it
4859 when performing comparisons (and when producing output, but that's a
4860 different problem). In particular, instead of testing for equality, you
4861 should check to see whether the two values have ranges that overlap; and
4862 this is done with the relational operators, so equality comparisons are
4865 @item -Wtraditional @r{(C and Objective-C only)}
4866 @opindex Wtraditional
4867 @opindex Wno-traditional
4868 Warn about certain constructs that behave differently in traditional and
4869 ISO C@. Also warn about ISO C constructs that have no traditional C
4870 equivalent, and/or problematic constructs that should be avoided.
4874 Macro parameters that appear within string literals in the macro body.
4875 In traditional C macro replacement takes place within string literals,
4876 but in ISO C it does not.
4879 In traditional C, some preprocessor directives did not exist.
4880 Traditional preprocessors only considered a line to be a directive
4881 if the @samp{#} appeared in column 1 on the line. Therefore
4882 @option{-Wtraditional} warns about directives that traditional C
4883 understands but ignores because the @samp{#} does not appear as the
4884 first character on the line. It also suggests you hide directives like
4885 @code{#pragma} not understood by traditional C by indenting them. Some
4886 traditional implementations do not recognize @code{#elif}, so this option
4887 suggests avoiding it altogether.
4890 A function-like macro that appears without arguments.
4893 The unary plus operator.
4896 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4897 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
4898 constants.) Note, these suffixes appear in macros defined in the system
4899 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4900 Use of these macros in user code might normally lead to spurious
4901 warnings, however GCC's integrated preprocessor has enough context to
4902 avoid warning in these cases.
4905 A function declared external in one block and then used after the end of
4909 A @code{switch} statement has an operand of type @code{long}.
4912 A non-@code{static} function declaration follows a @code{static} one.
4913 This construct is not accepted by some traditional C compilers.
4916 The ISO type of an integer constant has a different width or
4917 signedness from its traditional type. This warning is only issued if
4918 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
4919 typically represent bit patterns, are not warned about.
4922 Usage of ISO string concatenation is detected.
4925 Initialization of automatic aggregates.
4928 Identifier conflicts with labels. Traditional C lacks a separate
4929 namespace for labels.
4932 Initialization of unions. If the initializer is zero, the warning is
4933 omitted. This is done under the assumption that the zero initializer in
4934 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4935 initializer warnings and relies on default initialization to zero in the
4939 Conversions by prototypes between fixed/floating-point values and vice
4940 versa. The absence of these prototypes when compiling with traditional
4941 C causes serious problems. This is a subset of the possible
4942 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4945 Use of ISO C style function definitions. This warning intentionally is
4946 @emph{not} issued for prototype declarations or variadic functions
4947 because these ISO C features appear in your code when using
4948 libiberty's traditional C compatibility macros, @code{PARAMS} and
4949 @code{VPARAMS}. This warning is also bypassed for nested functions
4950 because that feature is already a GCC extension and thus not relevant to
4951 traditional C compatibility.
4954 @item -Wtraditional-conversion @r{(C and Objective-C only)}
4955 @opindex Wtraditional-conversion
4956 @opindex Wno-traditional-conversion
4957 Warn if a prototype causes a type conversion that is different from what
4958 would happen to the same argument in the absence of a prototype. This
4959 includes conversions of fixed point to floating and vice versa, and
4960 conversions changing the width or signedness of a fixed-point argument
4961 except when the same as the default promotion.
4963 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4964 @opindex Wdeclaration-after-statement
4965 @opindex Wno-declaration-after-statement
4966 Warn when a declaration is found after a statement in a block. This
4967 construct, known from C++, was introduced with ISO C99 and is by default
4968 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
4973 Warn if an undefined identifier is evaluated in an @code{#if} directive.
4975 @item -Wno-endif-labels
4976 @opindex Wno-endif-labels
4977 @opindex Wendif-labels
4978 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
4983 Warn whenever a local variable or type declaration shadows another
4984 variable, parameter, type, class member (in C++), or instance variable
4985 (in Objective-C) or whenever a built-in function is shadowed. Note
4986 that in C++, the compiler warns if a local variable shadows an
4987 explicit typedef, but not if it shadows a struct/class/enum.
4989 @item -Wno-shadow-ivar @r{(Objective-C only)}
4990 @opindex Wno-shadow-ivar
4991 @opindex Wshadow-ivar
4992 Do not warn whenever a local variable shadows an instance variable in an
4995 @item -Wlarger-than=@var{len}
4996 @opindex Wlarger-than=@var{len}
4997 @opindex Wlarger-than-@var{len}
4998 Warn whenever an object of larger than @var{len} bytes is defined.
5000 @item -Wframe-larger-than=@var{len}
5001 @opindex Wframe-larger-than
5002 Warn if the size of a function frame is larger than @var{len} bytes.
5003 The computation done to determine the stack frame size is approximate
5004 and not conservative.
5005 The actual requirements may be somewhat greater than @var{len}
5006 even if you do not get a warning. In addition, any space allocated
5007 via @code{alloca}, variable-length arrays, or related constructs
5008 is not included by the compiler when determining
5009 whether or not to issue a warning.
5011 @item -Wno-free-nonheap-object
5012 @opindex Wno-free-nonheap-object
5013 @opindex Wfree-nonheap-object
5014 Do not warn when attempting to free an object that was not allocated
5017 @item -Wstack-usage=@var{len}
5018 @opindex Wstack-usage
5019 Warn if the stack usage of a function might be larger than @var{len} bytes.
5020 The computation done to determine the stack usage is conservative.
5021 Any space allocated via @code{alloca}, variable-length arrays, or related
5022 constructs is included by the compiler when determining whether or not to
5025 The message is in keeping with the output of @option{-fstack-usage}.
5029 If the stack usage is fully static but exceeds the specified amount, it's:
5032 warning: stack usage is 1120 bytes
5035 If the stack usage is (partly) dynamic but bounded, it's:
5038 warning: stack usage might be 1648 bytes
5041 If the stack usage is (partly) dynamic and not bounded, it's:
5044 warning: stack usage might be unbounded
5048 @item -Wunsafe-loop-optimizations
5049 @opindex Wunsafe-loop-optimizations
5050 @opindex Wno-unsafe-loop-optimizations
5051 Warn if the loop cannot be optimized because the compiler cannot
5052 assume anything on the bounds of the loop indices. With
5053 @option{-funsafe-loop-optimizations} warn if the compiler makes
5056 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
5057 @opindex Wno-pedantic-ms-format
5058 @opindex Wpedantic-ms-format
5059 When used in combination with @option{-Wformat}
5060 and @option{-pedantic} without GNU extensions, this option
5061 disables the warnings about non-ISO @code{printf} / @code{scanf} format
5062 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
5063 which depend on the MS runtime.
5065 @item -Wplacement-new
5066 @itemx -Wplacement-new=@var{n}
5067 @opindex Wplacement-new
5068 @opindex Wno-placement-new
5069 Warn about placement new expressions with undefined behavior, such as
5070 constructing an object in a buffer that is smaller than the type of
5071 the object. For example, the placement new expression below is diagnosed
5072 because it attempts to construct an array of 64 integers in a buffer only
5078 This warning is enabled by default.
5081 @item -Wplacement-new=1
5082 This is the default warning level of @option{-Wplacement-new}. At this
5083 level the warning is not issued for some strictly undefined constructs that
5084 GCC allows as extensions for compatibility with legacy code. For example,
5085 the following @code{new} expression is not diagnosed at this level even
5086 though it has undefined behavior according to the C++ standard because
5087 it writes past the end of the one-element array.
5089 struct S @{ int n, a[1]; @};
5090 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5091 new (s->a)int [32]();
5094 @item -Wplacement-new=2
5095 At this level, in addition to diagnosing all the same constructs as at level
5096 1, a diagnostic is also issued for placement new expressions that construct
5097 an object in the last member of structure whose type is an array of a single
5098 element and whose size is less than the size of the object being constructed.
5099 While the previous example would be diagnosed, the following construct makes
5100 use of the flexible member array extension to avoid the warning at level 2.
5102 struct S @{ int n, a[]; @};
5103 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5104 new (s->a)int [32]();
5109 @item -Wpointer-arith
5110 @opindex Wpointer-arith
5111 @opindex Wno-pointer-arith
5112 Warn about anything that depends on the ``size of'' a function type or
5113 of @code{void}. GNU C assigns these types a size of 1, for
5114 convenience in calculations with @code{void *} pointers and pointers
5115 to functions. In C++, warn also when an arithmetic operation involves
5116 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
5119 @opindex Wtype-limits
5120 @opindex Wno-type-limits
5121 Warn if a comparison is always true or always false due to the limited
5122 range of the data type, but do not warn for constant expressions. For
5123 example, warn if an unsigned variable is compared against zero with
5124 @code{<} or @code{>=}. This warning is also enabled by
5127 @item -Wbad-function-cast @r{(C and Objective-C only)}
5128 @opindex Wbad-function-cast
5129 @opindex Wno-bad-function-cast
5130 Warn when a function call is cast to a non-matching type.
5131 For example, warn if a call to a function returning an integer type
5132 is cast to a pointer type.
5134 @item -Wc90-c99-compat @r{(C and Objective-C only)}
5135 @opindex Wc90-c99-compat
5136 @opindex Wno-c90-c99-compat
5137 Warn about features not present in ISO C90, but present in ISO C99.
5138 For instance, warn about use of variable length arrays, @code{long long}
5139 type, @code{bool} type, compound literals, designated initializers, and so
5140 on. This option is independent of the standards mode. Warnings are disabled
5141 in the expression that follows @code{__extension__}.
5143 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5144 @opindex Wc99-c11-compat
5145 @opindex Wno-c99-c11-compat
5146 Warn about features not present in ISO C99, but present in ISO C11.
5147 For instance, warn about use of anonymous structures and unions,
5148 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5149 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5150 and so on. This option is independent of the standards mode. Warnings are
5151 disabled in the expression that follows @code{__extension__}.
5153 @item -Wc++-compat @r{(C and Objective-C only)}
5154 @opindex Wc++-compat
5155 Warn about ISO C constructs that are outside of the common subset of
5156 ISO C and ISO C++, e.g.@: request for implicit conversion from
5157 @code{void *} to a pointer to non-@code{void} type.
5159 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5160 @opindex Wc++11-compat
5161 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5162 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5163 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5164 enabled by @option{-Wall}.
5166 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5167 @opindex Wc++14-compat
5168 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5169 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5173 @opindex Wno-cast-qual
5174 Warn whenever a pointer is cast so as to remove a type qualifier from
5175 the target type. For example, warn if a @code{const char *} is cast
5176 to an ordinary @code{char *}.
5178 Also warn when making a cast that introduces a type qualifier in an
5179 unsafe way. For example, casting @code{char **} to @code{const char **}
5180 is unsafe, as in this example:
5183 /* p is char ** value. */
5184 const char **q = (const char **) p;
5185 /* Assignment of readonly string to const char * is OK. */
5187 /* Now char** pointer points to read-only memory. */
5192 @opindex Wcast-align
5193 @opindex Wno-cast-align
5194 Warn whenever a pointer is cast such that the required alignment of the
5195 target is increased. For example, warn if a @code{char *} is cast to
5196 an @code{int *} on machines where integers can only be accessed at
5197 two- or four-byte boundaries.
5199 @item -Wwrite-strings
5200 @opindex Wwrite-strings
5201 @opindex Wno-write-strings
5202 When compiling C, give string constants the type @code{const
5203 char[@var{length}]} so that copying the address of one into a
5204 non-@code{const} @code{char *} pointer produces a warning. These
5205 warnings help you find at compile time code that can try to write
5206 into a string constant, but only if you have been very careful about
5207 using @code{const} in declarations and prototypes. Otherwise, it is
5208 just a nuisance. This is why we did not make @option{-Wall} request
5211 When compiling C++, warn about the deprecated conversion from string
5212 literals to @code{char *}. This warning is enabled by default for C++
5217 @opindex Wno-clobbered
5218 Warn for variables that might be changed by @code{longjmp} or
5219 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5221 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5222 @opindex Wconditionally-supported
5223 @opindex Wno-conditionally-supported
5224 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5227 @opindex Wconversion
5228 @opindex Wno-conversion
5229 Warn for implicit conversions that may alter a value. This includes
5230 conversions between real and integer, like @code{abs (x)} when
5231 @code{x} is @code{double}; conversions between signed and unsigned,
5232 like @code{unsigned ui = -1}; and conversions to smaller types, like
5233 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5234 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5235 changed by the conversion like in @code{abs (2.0)}. Warnings about
5236 conversions between signed and unsigned integers can be disabled by
5237 using @option{-Wno-sign-conversion}.
5239 For C++, also warn for confusing overload resolution for user-defined
5240 conversions; and conversions that never use a type conversion
5241 operator: conversions to @code{void}, the same type, a base class or a
5242 reference to them. Warnings about conversions between signed and
5243 unsigned integers are disabled by default in C++ unless
5244 @option{-Wsign-conversion} is explicitly enabled.
5246 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5247 @opindex Wconversion-null
5248 @opindex Wno-conversion-null
5249 Do not warn for conversions between @code{NULL} and non-pointer
5250 types. @option{-Wconversion-null} is enabled by default.
5252 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5253 @opindex Wzero-as-null-pointer-constant
5254 @opindex Wno-zero-as-null-pointer-constant
5255 Warn when a literal @samp{0} is used as null pointer constant. This can
5256 be useful to facilitate the conversion to @code{nullptr} in C++11.
5258 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5259 @opindex Wsubobject-linkage
5260 @opindex Wno-subobject-linkage
5261 Warn if a class type has a base or a field whose type uses the anonymous
5262 namespace or depends on a type with no linkage. If a type A depends on
5263 a type B with no or internal linkage, defining it in multiple
5264 translation units would be an ODR violation because the meaning of B
5265 is different in each translation unit. If A only appears in a single
5266 translation unit, the best way to silence the warning is to give it
5267 internal linkage by putting it in an anonymous namespace as well. The
5268 compiler doesn't give this warning for types defined in the main .C
5269 file, as those are unlikely to have multiple definitions.
5270 @option{-Wsubobject-linkage} is enabled by default.
5272 @item -Wdangling-else
5273 @opindex Wdangling-else
5274 @opindex Wno-dangling-else
5275 Warn about constructions where there may be confusion to which
5276 @code{if} statement an @code{else} branch belongs. Here is an example of
5291 In C/C++, every @code{else} branch belongs to the innermost possible
5292 @code{if} statement, which in this example is @code{if (b)}. This is
5293 often not what the programmer expected, as illustrated in the above
5294 example by indentation the programmer chose. When there is the
5295 potential for this confusion, GCC issues a warning when this flag
5296 is specified. To eliminate the warning, add explicit braces around
5297 the innermost @code{if} statement so there is no way the @code{else}
5298 can belong to the enclosing @code{if}. The resulting code
5315 This warning is enabled by @option{-Wparentheses}.
5319 @opindex Wno-date-time
5320 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5321 are encountered as they might prevent bit-wise-identical reproducible
5324 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5325 @opindex Wdelete-incomplete
5326 @opindex Wno-delete-incomplete
5327 Warn when deleting a pointer to incomplete type, which may cause
5328 undefined behavior at runtime. This warning is enabled by default.
5330 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5331 @opindex Wuseless-cast
5332 @opindex Wno-useless-cast
5333 Warn when an expression is casted to its own type.
5336 @opindex Wempty-body
5337 @opindex Wno-empty-body
5338 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5339 while} statement. This warning is also enabled by @option{-Wextra}.
5341 @item -Wenum-compare
5342 @opindex Wenum-compare
5343 @opindex Wno-enum-compare
5344 Warn about a comparison between values of different enumerated types.
5345 In C++ enumeral mismatches in conditional expressions are also
5346 diagnosed and the warning is enabled by default. In C this warning is
5347 enabled by @option{-Wall}.
5349 @item -Wjump-misses-init @r{(C, Objective-C only)}
5350 @opindex Wjump-misses-init
5351 @opindex Wno-jump-misses-init
5352 Warn if a @code{goto} statement or a @code{switch} statement jumps
5353 forward across the initialization of a variable, or jumps backward to a
5354 label after the variable has been initialized. This only warns about
5355 variables that are initialized when they are declared. This warning is
5356 only supported for C and Objective-C; in C++ this sort of branch is an
5359 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5360 can be disabled with the @option{-Wno-jump-misses-init} option.
5362 @item -Wsign-compare
5363 @opindex Wsign-compare
5364 @opindex Wno-sign-compare
5365 @cindex warning for comparison of signed and unsigned values
5366 @cindex comparison of signed and unsigned values, warning
5367 @cindex signed and unsigned values, comparison warning
5368 Warn when a comparison between signed and unsigned values could produce
5369 an incorrect result when the signed value is converted to unsigned.
5370 In C++, this warning is also enabled by @option{-Wall}. In C, it is
5371 also enabled by @option{-Wextra}.
5373 @item -Wsign-conversion
5374 @opindex Wsign-conversion
5375 @opindex Wno-sign-conversion
5376 Warn for implicit conversions that may change the sign of an integer
5377 value, like assigning a signed integer expression to an unsigned
5378 integer variable. An explicit cast silences the warning. In C, this
5379 option is enabled also by @option{-Wconversion}.
5381 @item -Wfloat-conversion
5382 @opindex Wfloat-conversion
5383 @opindex Wno-float-conversion
5384 Warn for implicit conversions that reduce the precision of a real value.
5385 This includes conversions from real to integer, and from higher precision
5386 real to lower precision real values. This option is also enabled by
5387 @option{-Wconversion}.
5389 @item -Wno-scalar-storage-order
5390 @opindex -Wno-scalar-storage-order
5391 @opindex -Wscalar-storage-order
5392 Do not warn on suspicious constructs involving reverse scalar storage order.
5394 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
5395 @opindex Wsized-deallocation
5396 @opindex Wno-sized-deallocation
5397 Warn about a definition of an unsized deallocation function
5399 void operator delete (void *) noexcept;
5400 void operator delete[] (void *) noexcept;
5402 without a definition of the corresponding sized deallocation function
5404 void operator delete (void *, std::size_t) noexcept;
5405 void operator delete[] (void *, std::size_t) noexcept;
5407 or vice versa. Enabled by @option{-Wextra} along with
5408 @option{-fsized-deallocation}.
5410 @item -Wsizeof-pointer-memaccess
5411 @opindex Wsizeof-pointer-memaccess
5412 @opindex Wno-sizeof-pointer-memaccess
5413 Warn for suspicious length parameters to certain string and memory built-in
5414 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
5415 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
5416 but a pointer, and suggests a possible fix, or about
5417 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
5420 @item -Wsizeof-array-argument
5421 @opindex Wsizeof-array-argument
5422 @opindex Wno-sizeof-array-argument
5423 Warn when the @code{sizeof} operator is applied to a parameter that is
5424 declared as an array in a function definition. This warning is enabled by
5425 default for C and C++ programs.
5427 @item -Wmemset-elt-size
5428 @opindex Wmemset-elt-size
5429 @opindex Wno-memset-elt-size
5430 Warn for suspicious calls to the @code{memset} built-in function, if the
5431 first argument references an array, and the third argument is a number
5432 equal to the number of elements, but not equal to the size of the array
5433 in memory. This indicates that the user has omitted a multiplication by
5434 the element size. This warning is enabled by @option{-Wall}.
5436 @item -Wmemset-transposed-args
5437 @opindex Wmemset-transposed-args
5438 @opindex Wno-memset-transposed-args
5439 Warn for suspicious calls to the @code{memset} built-in function, if the
5440 second argument is not zero and the third argument is zero. This warns e.g.@
5441 about @code{memset (buf, sizeof buf, 0)} where most probably
5442 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
5443 is only emitted if the third argument is literal zero. If it is some
5444 expression that is folded to zero, a cast of zero to some type, etc.,
5445 it is far less likely that the user has mistakenly exchanged the arguments
5446 and no warning is emitted. This warning is enabled by @option{-Wall}.
5450 @opindex Wno-address
5451 Warn about suspicious uses of memory addresses. These include using
5452 the address of a function in a conditional expression, such as
5453 @code{void func(void); if (func)}, and comparisons against the memory
5454 address of a string literal, such as @code{if (x == "abc")}. Such
5455 uses typically indicate a programmer error: the address of a function
5456 always evaluates to true, so their use in a conditional usually
5457 indicate that the programmer forgot the parentheses in a function
5458 call; and comparisons against string literals result in unspecified
5459 behavior and are not portable in C, so they usually indicate that the
5460 programmer intended to use @code{strcmp}. This warning is enabled by
5464 @opindex Wlogical-op
5465 @opindex Wno-logical-op
5466 Warn about suspicious uses of logical operators in expressions.
5467 This includes using logical operators in contexts where a
5468 bit-wise operator is likely to be expected. Also warns when
5469 the operands of a logical operator are the same:
5472 if (a < 0 && a < 0) @{ @dots{} @}
5475 @item -Wlogical-not-parentheses
5476 @opindex Wlogical-not-parentheses
5477 @opindex Wno-logical-not-parentheses
5478 Warn about logical not used on the left hand side operand of a comparison.
5479 This option does not warn if the right operand is considered to be a Boolean
5480 expression. Its purpose is to detect suspicious code like the following:
5484 if (!a > 1) @{ @dots{} @}
5487 It is possible to suppress the warning by wrapping the LHS into
5490 if ((!a) > 1) @{ @dots{} @}
5493 This warning is enabled by @option{-Wall}.
5495 @item -Waggregate-return
5496 @opindex Waggregate-return
5497 @opindex Wno-aggregate-return
5498 Warn if any functions that return structures or unions are defined or
5499 called. (In languages where you can return an array, this also elicits
5502 @item -Wno-aggressive-loop-optimizations
5503 @opindex Wno-aggressive-loop-optimizations
5504 @opindex Waggressive-loop-optimizations
5505 Warn if in a loop with constant number of iterations the compiler detects
5506 undefined behavior in some statement during one or more of the iterations.
5508 @item -Wno-attributes
5509 @opindex Wno-attributes
5510 @opindex Wattributes
5511 Do not warn if an unexpected @code{__attribute__} is used, such as
5512 unrecognized attributes, function attributes applied to variables,
5513 etc. This does not stop errors for incorrect use of supported
5516 @item -Wno-builtin-macro-redefined
5517 @opindex Wno-builtin-macro-redefined
5518 @opindex Wbuiltin-macro-redefined
5519 Do not warn if certain built-in macros are redefined. This suppresses
5520 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
5521 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
5523 @item -Wstrict-prototypes @r{(C and Objective-C only)}
5524 @opindex Wstrict-prototypes
5525 @opindex Wno-strict-prototypes
5526 Warn if a function is declared or defined without specifying the
5527 argument types. (An old-style function definition is permitted without
5528 a warning if preceded by a declaration that specifies the argument
5531 @item -Wold-style-declaration @r{(C and Objective-C only)}
5532 @opindex Wold-style-declaration
5533 @opindex Wno-old-style-declaration
5534 Warn for obsolescent usages, according to the C Standard, in a
5535 declaration. For example, warn if storage-class specifiers like
5536 @code{static} are not the first things in a declaration. This warning
5537 is also enabled by @option{-Wextra}.
5539 @item -Wold-style-definition @r{(C and Objective-C only)}
5540 @opindex Wold-style-definition
5541 @opindex Wno-old-style-definition
5542 Warn if an old-style function definition is used. A warning is given
5543 even if there is a previous prototype.
5545 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5546 @opindex Wmissing-parameter-type
5547 @opindex Wno-missing-parameter-type
5548 A function parameter is declared without a type specifier in K&R-style
5555 This warning is also enabled by @option{-Wextra}.
5557 @item -Wmissing-prototypes @r{(C and Objective-C only)}
5558 @opindex Wmissing-prototypes
5559 @opindex Wno-missing-prototypes
5560 Warn if a global function is defined without a previous prototype
5561 declaration. This warning is issued even if the definition itself
5562 provides a prototype. Use this option to detect global functions
5563 that do not have a matching prototype declaration in a header file.
5564 This option is not valid for C++ because all function declarations
5565 provide prototypes and a non-matching declaration declares an
5566 overload rather than conflict with an earlier declaration.
5567 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
5569 @item -Wmissing-declarations
5570 @opindex Wmissing-declarations
5571 @opindex Wno-missing-declarations
5572 Warn if a global function is defined without a previous declaration.
5573 Do so even if the definition itself provides a prototype.
5574 Use this option to detect global functions that are not declared in
5575 header files. In C, no warnings are issued for functions with previous
5576 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
5577 missing prototypes. In C++, no warnings are issued for function templates,
5578 or for inline functions, or for functions in anonymous namespaces.
5580 @item -Wmissing-field-initializers
5581 @opindex Wmissing-field-initializers
5582 @opindex Wno-missing-field-initializers
5586 Warn if a structure's initializer has some fields missing. For
5587 example, the following code causes such a warning, because
5588 @code{x.h} is implicitly zero:
5591 struct s @{ int f, g, h; @};
5592 struct s x = @{ 3, 4 @};
5595 This option does not warn about designated initializers, so the following
5596 modification does not trigger a warning:
5599 struct s @{ int f, g, h; @};
5600 struct s x = @{ .f = 3, .g = 4 @};
5603 In C++ this option does not warn either about the empty @{ @}
5604 initializer, for example:
5607 struct s @{ int f, g, h; @};
5611 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
5612 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
5614 @item -Wno-multichar
5615 @opindex Wno-multichar
5617 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
5618 Usually they indicate a typo in the user's code, as they have
5619 implementation-defined values, and should not be used in portable code.
5621 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
5622 @opindex Wnormalized=
5623 @opindex Wnormalized
5624 @opindex Wno-normalized
5627 @cindex character set, input normalization
5628 In ISO C and ISO C++, two identifiers are different if they are
5629 different sequences of characters. However, sometimes when characters
5630 outside the basic ASCII character set are used, you can have two
5631 different character sequences that look the same. To avoid confusion,
5632 the ISO 10646 standard sets out some @dfn{normalization rules} which
5633 when applied ensure that two sequences that look the same are turned into
5634 the same sequence. GCC can warn you if you are using identifiers that
5635 have not been normalized; this option controls that warning.
5637 There are four levels of warning supported by GCC@. The default is
5638 @option{-Wnormalized=nfc}, which warns about any identifier that is
5639 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
5640 recommended form for most uses. It is equivalent to
5641 @option{-Wnormalized}.
5643 Unfortunately, there are some characters allowed in identifiers by
5644 ISO C and ISO C++ that, when turned into NFC, are not allowed in
5645 identifiers. That is, there's no way to use these symbols in portable
5646 ISO C or C++ and have all your identifiers in NFC@.
5647 @option{-Wnormalized=id} suppresses the warning for these characters.
5648 It is hoped that future versions of the standards involved will correct
5649 this, which is why this option is not the default.
5651 You can switch the warning off for all characters by writing
5652 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
5653 only do this if you are using some other normalization scheme (like
5654 ``D''), because otherwise you can easily create bugs that are
5655 literally impossible to see.
5657 Some characters in ISO 10646 have distinct meanings but look identical
5658 in some fonts or display methodologies, especially once formatting has
5659 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
5660 LETTER N'', displays just like a regular @code{n} that has been
5661 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
5662 normalization scheme to convert all these into a standard form as
5663 well, and GCC warns if your code is not in NFKC if you use
5664 @option{-Wnormalized=nfkc}. This warning is comparable to warning
5665 about every identifier that contains the letter O because it might be
5666 confused with the digit 0, and so is not the default, but may be
5667 useful as a local coding convention if the programming environment
5668 cannot be fixed to display these characters distinctly.
5670 @item -Wno-deprecated
5671 @opindex Wno-deprecated
5672 @opindex Wdeprecated
5673 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
5675 @item -Wno-deprecated-declarations
5676 @opindex Wno-deprecated-declarations
5677 @opindex Wdeprecated-declarations
5678 Do not warn about uses of functions (@pxref{Function Attributes}),
5679 variables (@pxref{Variable Attributes}), and types (@pxref{Type
5680 Attributes}) marked as deprecated by using the @code{deprecated}
5684 @opindex Wno-overflow
5686 Do not warn about compile-time overflow in constant expressions.
5691 Warn about One Definition Rule violations during link-time optimization.
5692 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
5695 @opindex Wopenm-simd
5696 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
5697 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
5698 option can be used to relax the cost model.
5700 @item -Woverride-init @r{(C and Objective-C only)}
5701 @opindex Woverride-init
5702 @opindex Wno-override-init
5706 Warn if an initialized field without side effects is overridden when
5707 using designated initializers (@pxref{Designated Inits, , Designated
5710 This warning is included in @option{-Wextra}. To get other
5711 @option{-Wextra} warnings without this one, use @option{-Wextra
5712 -Wno-override-init}.
5714 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
5715 @opindex Woverride-init-side-effects
5716 @opindex Wno-override-init-side-effects
5717 Warn if an initialized field with side effects is overridden when
5718 using designated initializers (@pxref{Designated Inits, , Designated
5719 Initializers}). This warning is enabled by default.
5724 Warn if a structure is given the packed attribute, but the packed
5725 attribute has no effect on the layout or size of the structure.
5726 Such structures may be mis-aligned for little benefit. For
5727 instance, in this code, the variable @code{f.x} in @code{struct bar}
5728 is misaligned even though @code{struct bar} does not itself
5729 have the packed attribute:
5736 @} __attribute__((packed));
5744 @item -Wpacked-bitfield-compat
5745 @opindex Wpacked-bitfield-compat
5746 @opindex Wno-packed-bitfield-compat
5747 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
5748 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
5749 the change can lead to differences in the structure layout. GCC
5750 informs you when the offset of such a field has changed in GCC 4.4.
5751 For example there is no longer a 4-bit padding between field @code{a}
5752 and @code{b} in this structure:
5759 @} __attribute__ ((packed));
5762 This warning is enabled by default. Use
5763 @option{-Wno-packed-bitfield-compat} to disable this warning.
5768 Warn if padding is included in a structure, either to align an element
5769 of the structure or to align the whole structure. Sometimes when this
5770 happens it is possible to rearrange the fields of the structure to
5771 reduce the padding and so make the structure smaller.
5773 @item -Wredundant-decls
5774 @opindex Wredundant-decls
5775 @opindex Wno-redundant-decls
5776 Warn if anything is declared more than once in the same scope, even in
5777 cases where multiple declaration is valid and changes nothing.
5779 @item -Wnested-externs @r{(C and Objective-C only)}
5780 @opindex Wnested-externs
5781 @opindex Wno-nested-externs
5782 Warn if an @code{extern} declaration is encountered within a function.
5784 @item -Wno-inherited-variadic-ctor
5785 @opindex Winherited-variadic-ctor
5786 @opindex Wno-inherited-variadic-ctor
5787 Suppress warnings about use of C++11 inheriting constructors when the
5788 base class inherited from has a C variadic constructor; the warning is
5789 on by default because the ellipsis is not inherited.
5794 Warn if a function that is declared as inline cannot be inlined.
5795 Even with this option, the compiler does not warn about failures to
5796 inline functions declared in system headers.
5798 The compiler uses a variety of heuristics to determine whether or not
5799 to inline a function. For example, the compiler takes into account
5800 the size of the function being inlined and the amount of inlining
5801 that has already been done in the current function. Therefore,
5802 seemingly insignificant changes in the source program can cause the
5803 warnings produced by @option{-Winline} to appear or disappear.
5805 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
5806 @opindex Wno-invalid-offsetof
5807 @opindex Winvalid-offsetof
5808 Suppress warnings from applying the @code{offsetof} macro to a non-POD
5809 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
5810 to a non-standard-layout type is undefined. In existing C++ implementations,
5811 however, @code{offsetof} typically gives meaningful results.
5812 This flag is for users who are aware that they are
5813 writing nonportable code and who have deliberately chosen to ignore the
5816 The restrictions on @code{offsetof} may be relaxed in a future version
5817 of the C++ standard.
5819 @item -Wno-int-to-pointer-cast
5820 @opindex Wno-int-to-pointer-cast
5821 @opindex Wint-to-pointer-cast
5822 Suppress warnings from casts to pointer type of an integer of a
5823 different size. In C++, casting to a pointer type of smaller size is
5824 an error. @option{Wint-to-pointer-cast} is enabled by default.
5827 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
5828 @opindex Wno-pointer-to-int-cast
5829 @opindex Wpointer-to-int-cast
5830 Suppress warnings from casts from a pointer to an integer type of a
5834 @opindex Winvalid-pch
5835 @opindex Wno-invalid-pch
5836 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
5837 the search path but can't be used.
5841 @opindex Wno-long-long
5842 Warn if @code{long long} type is used. This is enabled by either
5843 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
5844 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
5846 @item -Wvariadic-macros
5847 @opindex Wvariadic-macros
5848 @opindex Wno-variadic-macros
5849 Warn if variadic macros are used in ISO C90 mode, or if the GNU
5850 alternate syntax is used in ISO C99 mode. This is enabled by either
5851 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
5852 messages, use @option{-Wno-variadic-macros}.
5856 @opindex Wno-varargs
5857 Warn upon questionable usage of the macros used to handle variable
5858 arguments like @code{va_start}. This is default. To inhibit the
5859 warning messages, use @option{-Wno-varargs}.
5861 @item -Wvector-operation-performance
5862 @opindex Wvector-operation-performance
5863 @opindex Wno-vector-operation-performance
5864 Warn if vector operation is not implemented via SIMD capabilities of the
5865 architecture. Mainly useful for the performance tuning.
5866 Vector operation can be implemented @code{piecewise}, which means that the
5867 scalar operation is performed on every vector element;
5868 @code{in parallel}, which means that the vector operation is implemented
5869 using scalars of wider type, which normally is more performance efficient;
5870 and @code{as a single scalar}, which means that vector fits into a
5873 @item -Wno-virtual-move-assign
5874 @opindex Wvirtual-move-assign
5875 @opindex Wno-virtual-move-assign
5876 Suppress warnings about inheriting from a virtual base with a
5877 non-trivial C++11 move assignment operator. This is dangerous because
5878 if the virtual base is reachable along more than one path, it is
5879 moved multiple times, which can mean both objects end up in the
5880 moved-from state. If the move assignment operator is written to avoid
5881 moving from a moved-from object, this warning can be disabled.
5886 Warn if variable length array is used in the code.
5887 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
5888 the variable length array.
5890 @item -Wvolatile-register-var
5891 @opindex Wvolatile-register-var
5892 @opindex Wno-volatile-register-var
5893 Warn if a register variable is declared volatile. The volatile
5894 modifier does not inhibit all optimizations that may eliminate reads
5895 and/or writes to register variables. This warning is enabled by
5898 @item -Wdisabled-optimization
5899 @opindex Wdisabled-optimization
5900 @opindex Wno-disabled-optimization
5901 Warn if a requested optimization pass is disabled. This warning does
5902 not generally indicate that there is anything wrong with your code; it
5903 merely indicates that GCC's optimizers are unable to handle the code
5904 effectively. Often, the problem is that your code is too big or too
5905 complex; GCC refuses to optimize programs when the optimization
5906 itself is likely to take inordinate amounts of time.
5908 @item -Wpointer-sign @r{(C and Objective-C only)}
5909 @opindex Wpointer-sign
5910 @opindex Wno-pointer-sign
5911 Warn for pointer argument passing or assignment with different signedness.
5912 This option is only supported for C and Objective-C@. It is implied by
5913 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
5914 @option{-Wno-pointer-sign}.
5916 @item -Wstack-protector
5917 @opindex Wstack-protector
5918 @opindex Wno-stack-protector
5919 This option is only active when @option{-fstack-protector} is active. It
5920 warns about functions that are not protected against stack smashing.
5922 @item -Woverlength-strings
5923 @opindex Woverlength-strings
5924 @opindex Wno-overlength-strings
5925 Warn about string constants that are longer than the ``minimum
5926 maximum'' length specified in the C standard. Modern compilers
5927 generally allow string constants that are much longer than the
5928 standard's minimum limit, but very portable programs should avoid
5929 using longer strings.
5931 The limit applies @emph{after} string constant concatenation, and does
5932 not count the trailing NUL@. In C90, the limit was 509 characters; in
5933 C99, it was raised to 4095. C++98 does not specify a normative
5934 minimum maximum, so we do not diagnose overlength strings in C++@.
5936 This option is implied by @option{-Wpedantic}, and can be disabled with
5937 @option{-Wno-overlength-strings}.
5939 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
5940 @opindex Wunsuffixed-float-constants
5942 Issue a warning for any floating constant that does not have
5943 a suffix. When used together with @option{-Wsystem-headers} it
5944 warns about such constants in system header files. This can be useful
5945 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
5946 from the decimal floating-point extension to C99.
5948 @item -Wno-designated-init @r{(C and Objective-C only)}
5949 Suppress warnings when a positional initializer is used to initialize
5950 a structure that has been marked with the @code{designated_init}
5954 Issue a warning when HSAIL cannot be emitted for the compiled function or
5959 @node Debugging Options
5960 @section Options for Debugging Your Program
5961 @cindex options, debugging
5962 @cindex debugging information options
5964 To tell GCC to emit extra information for use by a debugger, in almost
5965 all cases you need only to add @option{-g} to your other options.
5967 GCC allows you to use @option{-g} with
5968 @option{-O}. The shortcuts taken by optimized code may occasionally
5969 be surprising: some variables you declared may not exist
5970 at all; flow of control may briefly move where you did not expect it;
5971 some statements may not be executed because they compute constant
5972 results or their values are already at hand; some statements may
5973 execute in different places because they have been moved out of loops.
5974 Nevertheless it is possible to debug optimized output. This makes
5975 it reasonable to use the optimizer for programs that might have bugs.
5977 If you are not using some other optimization option, consider
5978 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
5979 With no @option{-O} option at all, some compiler passes that collect
5980 information useful for debugging do not run at all, so that
5981 @option{-Og} may result in a better debugging experience.
5986 Produce debugging information in the operating system's native format
5987 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
5990 On most systems that use stabs format, @option{-g} enables use of extra
5991 debugging information that only GDB can use; this extra information
5992 makes debugging work better in GDB but probably makes other debuggers
5994 refuse to read the program. If you want to control for certain whether
5995 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
5996 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
6000 Produce debugging information for use by GDB@. This means to use the
6001 most expressive format available (DWARF, stabs, or the native format
6002 if neither of those are supported), including GDB extensions if at all
6006 @itemx -gdwarf-@var{version}
6008 Produce debugging information in DWARF format (if that is supported).
6009 The value of @var{version} may be either 2, 3, 4 or 5; the default version
6010 for most targets is 4. DWARF Version 5 is only experimental.
6012 Note that with DWARF Version 2, some ports require and always
6013 use some non-conflicting DWARF 3 extensions in the unwind tables.
6015 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
6016 for maximum benefit.
6018 GCC no longer supports DWARF Version 1, which is substantially
6019 different than Version 2 and later. For historical reasons, some
6020 other DWARF-related options (including @option{-feliminate-dwarf2-dups}
6021 and @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
6022 in their names, but apply to all currently-supported versions of DWARF.
6026 Produce debugging information in stabs format (if that is supported),
6027 without GDB extensions. This is the format used by DBX on most BSD
6028 systems. On MIPS, Alpha and System V Release 4 systems this option
6029 produces stabs debugging output that is not understood by DBX or SDB@.
6030 On System V Release 4 systems this option requires the GNU assembler.
6034 Produce debugging information in stabs format (if that is supported),
6035 using GNU extensions understood only by the GNU debugger (GDB)@. The
6036 use of these extensions is likely to make other debuggers crash or
6037 refuse to read the program.
6041 Produce debugging information in COFF format (if that is supported).
6042 This is the format used by SDB on most System V systems prior to
6047 Produce debugging information in XCOFF format (if that is supported).
6048 This is the format used by the DBX debugger on IBM RS/6000 systems.
6052 Produce debugging information in XCOFF format (if that is supported),
6053 using GNU extensions understood only by the GNU debugger (GDB)@. The
6054 use of these extensions is likely to make other debuggers crash or
6055 refuse to read the program, and may cause assemblers other than the GNU
6056 assembler (GAS) to fail with an error.
6060 Produce debugging information in Alpha/VMS debug format (if that is
6061 supported). This is the format used by DEBUG on Alpha/VMS systems.
6064 @itemx -ggdb@var{level}
6065 @itemx -gstabs@var{level}
6066 @itemx -gcoff@var{level}
6067 @itemx -gxcoff@var{level}
6068 @itemx -gvms@var{level}
6069 Request debugging information and also use @var{level} to specify how
6070 much information. The default level is 2.
6072 Level 0 produces no debug information at all. Thus, @option{-g0} negates
6075 Level 1 produces minimal information, enough for making backtraces in
6076 parts of the program that you don't plan to debug. This includes
6077 descriptions of functions and external variables, and line number
6078 tables, but no information about local variables.
6080 Level 3 includes extra information, such as all the macro definitions
6081 present in the program. Some debuggers support macro expansion when
6082 you use @option{-g3}.
6084 @option{-gdwarf} does not accept a concatenated debug level, to avoid
6085 confusion with @option{-gdwarf-@var{level}}.
6086 Instead use an additional @option{-g@var{level}} option to change the
6087 debug level for DWARF.
6089 @item -feliminate-unused-debug-symbols
6090 @opindex feliminate-unused-debug-symbols
6091 Produce debugging information in stabs format (if that is supported),
6092 for only symbols that are actually used.
6094 @item -femit-class-debug-always
6095 @opindex femit-class-debug-always
6096 Instead of emitting debugging information for a C++ class in only one
6097 object file, emit it in all object files using the class. This option
6098 should be used only with debuggers that are unable to handle the way GCC
6099 normally emits debugging information for classes because using this
6100 option increases the size of debugging information by as much as a
6103 @item -fno-merge-debug-strings
6104 @opindex fmerge-debug-strings
6105 @opindex fno-merge-debug-strings
6106 Direct the linker to not merge together strings in the debugging
6107 information that are identical in different object files. Merging is
6108 not supported by all assemblers or linkers. Merging decreases the size
6109 of the debug information in the output file at the cost of increasing
6110 link processing time. Merging is enabled by default.
6112 @item -fdebug-prefix-map=@var{old}=@var{new}
6113 @opindex fdebug-prefix-map
6114 When compiling files in directory @file{@var{old}}, record debugging
6115 information describing them as in @file{@var{new}} instead.
6117 @item -fvar-tracking
6118 @opindex fvar-tracking
6119 Run variable tracking pass. It computes where variables are stored at each
6120 position in code. Better debugging information is then generated
6121 (if the debugging information format supports this information).
6123 It is enabled by default when compiling with optimization (@option{-Os},
6124 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6125 the debug info format supports it.
6127 @item -fvar-tracking-assignments
6128 @opindex fvar-tracking-assignments
6129 @opindex fno-var-tracking-assignments
6130 Annotate assignments to user variables early in the compilation and
6131 attempt to carry the annotations over throughout the compilation all the
6132 way to the end, in an attempt to improve debug information while
6133 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6135 It can be enabled even if var-tracking is disabled, in which case
6136 annotations are created and maintained, but discarded at the end.
6137 By default, this flag is enabled together with @option{-fvar-tracking},
6138 except when selective scheduling is enabled.
6141 @opindex gsplit-dwarf
6142 Separate as much DWARF debugging information as possible into a
6143 separate output file with the extension @file{.dwo}. This option allows
6144 the build system to avoid linking files with debug information. To
6145 be useful, this option requires a debugger capable of reading @file{.dwo}
6150 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
6152 @item -ggnu-pubnames
6153 @opindex ggnu-pubnames
6154 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
6155 suitable for conversion into a GDB@ index. This option is only useful
6156 with a linker that can produce GDB@ index version 7.
6158 @item -fdebug-types-section
6159 @opindex fdebug-types-section
6160 @opindex fno-debug-types-section
6161 When using DWARF Version 4 or higher, type DIEs can be put into
6162 their own @code{.debug_types} section instead of making them part of the
6163 @code{.debug_info} section. It is more efficient to put them in a separate
6164 comdat sections since the linker can then remove duplicates.
6165 But not all DWARF consumers support @code{.debug_types} sections yet
6166 and on some objects @code{.debug_types} produces larger instead of smaller
6167 debugging information.
6169 @item -grecord-gcc-switches
6170 @item -gno-record-gcc-switches
6171 @opindex grecord-gcc-switches
6172 @opindex gno-record-gcc-switches
6173 This switch causes the command-line options used to invoke the
6174 compiler that may affect code generation to be appended to the
6175 DW_AT_producer attribute in DWARF debugging information. The options
6176 are concatenated with spaces separating them from each other and from
6177 the compiler version.
6178 It is enabled by default.
6179 See also @option{-frecord-gcc-switches} for another
6180 way of storing compiler options into the object file.
6182 @item -gstrict-dwarf
6183 @opindex gstrict-dwarf
6184 Disallow using extensions of later DWARF standard version than selected
6185 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
6186 DWARF extensions from later standard versions is allowed.
6188 @item -gno-strict-dwarf
6189 @opindex gno-strict-dwarf
6190 Allow using extensions of later DWARF standard version than selected with
6191 @option{-gdwarf-@var{version}}.
6193 @item -gz@r{[}=@var{type}@r{]}
6195 Produce compressed debug sections in DWARF format, if that is supported.
6196 If @var{type} is not given, the default type depends on the capabilities
6197 of the assembler and linker used. @var{type} may be one of
6198 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
6199 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
6200 compression in traditional GNU format). If the linker doesn't support
6201 writing compressed debug sections, the option is rejected. Otherwise,
6202 if the assembler does not support them, @option{-gz} is silently ignored
6203 when producing object files.
6205 @item -feliminate-dwarf2-dups
6206 @opindex feliminate-dwarf2-dups
6207 Compress DWARF debugging information by eliminating duplicated
6208 information about each symbol. This option only makes sense when
6209 generating DWARF debugging information.
6211 @item -femit-struct-debug-baseonly
6212 @opindex femit-struct-debug-baseonly
6213 Emit debug information for struct-like types
6214 only when the base name of the compilation source file
6215 matches the base name of file in which the struct is defined.
6217 This option substantially reduces the size of debugging information,
6218 but at significant potential loss in type information to the debugger.
6219 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6220 See @option{-femit-struct-debug-detailed} for more detailed control.
6222 This option works only with DWARF debug output.
6224 @item -femit-struct-debug-reduced
6225 @opindex femit-struct-debug-reduced
6226 Emit debug information for struct-like types
6227 only when the base name of the compilation source file
6228 matches the base name of file in which the type is defined,
6229 unless the struct is a template or defined in a system header.
6231 This option significantly reduces the size of debugging information,
6232 with some potential loss in type information to the debugger.
6233 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6234 See @option{-femit-struct-debug-detailed} for more detailed control.
6236 This option works only with DWARF debug output.
6238 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6239 @opindex femit-struct-debug-detailed
6240 Specify the struct-like types
6241 for which the compiler generates debug information.
6242 The intent is to reduce duplicate struct debug information
6243 between different object files within the same program.
6245 This option is a detailed version of
6246 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6247 which serves for most needs.
6249 A specification has the syntax@*
6250 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6252 The optional first word limits the specification to
6253 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6254 A struct type is used directly when it is the type of a variable, member.
6255 Indirect uses arise through pointers to structs.
6256 That is, when use of an incomplete struct is valid, the use is indirect.
6258 @samp{struct one direct; struct two * indirect;}.
6260 The optional second word limits the specification to
6261 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6262 Generic structs are a bit complicated to explain.
6263 For C++, these are non-explicit specializations of template classes,
6264 or non-template classes within the above.
6265 Other programming languages have generics,
6266 but @option{-femit-struct-debug-detailed} does not yet implement them.
6268 The third word specifies the source files for those
6269 structs for which the compiler should emit debug information.
6270 The values @samp{none} and @samp{any} have the normal meaning.
6271 The value @samp{base} means that
6272 the base of name of the file in which the type declaration appears
6273 must match the base of the name of the main compilation file.
6274 In practice, this means that when compiling @file{foo.c}, debug information
6275 is generated for types declared in that file and @file{foo.h},
6276 but not other header files.
6277 The value @samp{sys} means those types satisfying @samp{base}
6278 or declared in system or compiler headers.
6280 You may need to experiment to determine the best settings for your application.
6282 The default is @option{-femit-struct-debug-detailed=all}.
6284 This option works only with DWARF debug output.
6286 @item -fno-dwarf2-cfi-asm
6287 @opindex fdwarf2-cfi-asm
6288 @opindex fno-dwarf2-cfi-asm
6289 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
6290 instead of using GAS @code{.cfi_*} directives.
6292 @item -fno-eliminate-unused-debug-types
6293 @opindex feliminate-unused-debug-types
6294 @opindex fno-eliminate-unused-debug-types
6295 Normally, when producing DWARF output, GCC avoids producing debug symbol
6296 output for types that are nowhere used in the source file being compiled.
6297 Sometimes it is useful to have GCC emit debugging
6298 information for all types declared in a compilation
6299 unit, regardless of whether or not they are actually used
6300 in that compilation unit, for example
6301 if, in the debugger, you want to cast a value to a type that is
6302 not actually used in your program (but is declared). More often,
6303 however, this results in a significant amount of wasted space.
6306 @node Optimize Options
6307 @section Options That Control Optimization
6308 @cindex optimize options
6309 @cindex options, optimization
6311 These options control various sorts of optimizations.
6313 Without any optimization option, the compiler's goal is to reduce the
6314 cost of compilation and to make debugging produce the expected
6315 results. Statements are independent: if you stop the program with a
6316 breakpoint between statements, you can then assign a new value to any
6317 variable or change the program counter to any other statement in the
6318 function and get exactly the results you expect from the source
6321 Turning on optimization flags makes the compiler attempt to improve
6322 the performance and/or code size at the expense of compilation time
6323 and possibly the ability to debug the program.
6325 The compiler performs optimization based on the knowledge it has of the
6326 program. Compiling multiple files at once to a single output file mode allows
6327 the compiler to use information gained from all of the files when compiling
6330 Not all optimizations are controlled directly by a flag. Only
6331 optimizations that have a flag are listed in this section.
6333 Most optimizations are only enabled if an @option{-O} level is set on
6334 the command line. Otherwise they are disabled, even if individual
6335 optimization flags are specified.
6337 Depending on the target and how GCC was configured, a slightly different
6338 set of optimizations may be enabled at each @option{-O} level than
6339 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6340 to find out the exact set of optimizations that are enabled at each level.
6341 @xref{Overall Options}, for examples.
6348 Optimize. Optimizing compilation takes somewhat more time, and a lot
6349 more memory for a large function.
6351 With @option{-O}, the compiler tries to reduce code size and execution
6352 time, without performing any optimizations that take a great deal of
6355 @option{-O} turns on the following optimization flags:
6358 -fbranch-count-reg @gol
6359 -fcombine-stack-adjustments @gol
6361 -fcprop-registers @gol
6364 -fdelayed-branch @gol
6366 -fforward-propagate @gol
6367 -fguess-branch-probability @gol
6368 -fif-conversion2 @gol
6369 -fif-conversion @gol
6370 -finline-functions-called-once @gol
6371 -fipa-pure-const @gol
6373 -fipa-reference @gol
6374 -fmerge-constants @gol
6375 -fmove-loop-invariants @gol
6376 -freorder-blocks @gol
6378 -fsplit-wide-types @gol
6384 -ftree-coalesce-vars @gol
6385 -ftree-copy-prop @gol
6387 -ftree-dominator-opts @gol
6389 -ftree-forwprop @gol
6399 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6400 where doing so does not interfere with debugging.
6404 Optimize even more. GCC performs nearly all supported optimizations
6405 that do not involve a space-speed tradeoff.
6406 As compared to @option{-O}, this option increases both compilation time
6407 and the performance of the generated code.
6409 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6410 also turns on the following optimization flags:
6411 @gccoptlist{-fthread-jumps @gol
6412 -falign-functions -falign-jumps @gol
6413 -falign-loops -falign-labels @gol
6416 -fcse-follow-jumps -fcse-skip-blocks @gol
6417 -fdelete-null-pointer-checks @gol
6418 -fdevirtualize -fdevirtualize-speculatively @gol
6419 -fexpensive-optimizations @gol
6420 -fgcse -fgcse-lm @gol
6421 -fhoist-adjacent-loads @gol
6422 -finline-small-functions @gol
6423 -findirect-inlining @gol
6425 -fipa-cp-alignment @gol
6429 -fisolate-erroneous-paths-dereference @gol
6431 -foptimize-sibling-calls @gol
6432 -foptimize-strlen @gol
6433 -fpartial-inlining @gol
6435 -freorder-blocks-algorithm=stc @gol
6436 -freorder-blocks-and-partition -freorder-functions @gol
6437 -frerun-cse-after-loop @gol
6438 -fsched-interblock -fsched-spec @gol
6439 -fschedule-insns -fschedule-insns2 @gol
6440 -fstrict-aliasing -fstrict-overflow @gol
6441 -ftree-builtin-call-dce @gol
6442 -ftree-switch-conversion -ftree-tail-merge @gol
6443 -fcode-hoisting @gol
6448 Please note the warning under @option{-fgcse} about
6449 invoking @option{-O2} on programs that use computed gotos.
6453 Optimize yet more. @option{-O3} turns on all optimizations specified
6454 by @option{-O2} and also turns on the @option{-finline-functions},
6455 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6456 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
6457 @option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
6458 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
6459 @option{-ftree-partial-pre}, @option{-fpeel-loops}
6460 and @option{-fipa-cp-clone} options.
6464 Reduce compilation time and make debugging produce the expected
6465 results. This is the default.
6469 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6470 do not typically increase code size. It also performs further
6471 optimizations designed to reduce code size.
6473 @option{-Os} disables the following optimization flags:
6474 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6475 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
6476 -freorder-blocks-and-partition -fprefetch-loop-arrays}
6480 Disregard strict standards compliance. @option{-Ofast} enables all
6481 @option{-O3} optimizations. It also enables optimizations that are not
6482 valid for all standard-compliant programs.
6483 It turns on @option{-ffast-math} and the Fortran-specific
6484 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6488 Optimize debugging experience. @option{-Og} enables optimizations
6489 that do not interfere with debugging. It should be the optimization
6490 level of choice for the standard edit-compile-debug cycle, offering
6491 a reasonable level of optimization while maintaining fast compilation
6492 and a good debugging experience.
6495 If you use multiple @option{-O} options, with or without level numbers,
6496 the last such option is the one that is effective.
6498 Options of the form @option{-f@var{flag}} specify machine-independent
6499 flags. Most flags have both positive and negative forms; the negative
6500 form of @option{-ffoo} is @option{-fno-foo}. In the table
6501 below, only one of the forms is listed---the one you typically
6502 use. You can figure out the other form by either removing @samp{no-}
6505 The following options control specific optimizations. They are either
6506 activated by @option{-O} options or are related to ones that are. You
6507 can use the following flags in the rare cases when ``fine-tuning'' of
6508 optimizations to be performed is desired.
6511 @item -fno-defer-pop
6512 @opindex fno-defer-pop
6513 Always pop the arguments to each function call as soon as that function
6514 returns. For machines that must pop arguments after a function call,
6515 the compiler normally lets arguments accumulate on the stack for several
6516 function calls and pops them all at once.
6518 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6520 @item -fforward-propagate
6521 @opindex fforward-propagate
6522 Perform a forward propagation pass on RTL@. The pass tries to combine two
6523 instructions and checks if the result can be simplified. If loop unrolling
6524 is active, two passes are performed and the second is scheduled after
6527 This option is enabled by default at optimization levels @option{-O},
6528 @option{-O2}, @option{-O3}, @option{-Os}.
6530 @item -ffp-contract=@var{style}
6531 @opindex ffp-contract
6532 @option{-ffp-contract=off} disables floating-point expression contraction.
6533 @option{-ffp-contract=fast} enables floating-point expression contraction
6534 such as forming of fused multiply-add operations if the target has
6535 native support for them.
6536 @option{-ffp-contract=on} enables floating-point expression contraction
6537 if allowed by the language standard. This is currently not implemented
6538 and treated equal to @option{-ffp-contract=off}.
6540 The default is @option{-ffp-contract=fast}.
6542 @item -fomit-frame-pointer
6543 @opindex fomit-frame-pointer
6544 Don't keep the frame pointer in a register for functions that
6545 don't need one. This avoids the instructions to save, set up and
6546 restore frame pointers; it also makes an extra register available
6547 in many functions. @strong{It also makes debugging impossible on
6550 On some machines, such as the VAX, this flag has no effect, because
6551 the standard calling sequence automatically handles the frame pointer
6552 and nothing is saved by pretending it doesn't exist. The
6553 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6554 whether a target machine supports this flag. @xref{Registers,,Register
6555 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6557 The default setting (when not optimizing for
6558 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
6559 @option{-fomit-frame-pointer}. You can configure GCC with the
6560 @option{--enable-frame-pointer} configure option to change the default.
6562 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6564 @item -foptimize-sibling-calls
6565 @opindex foptimize-sibling-calls
6566 Optimize sibling and tail recursive calls.
6568 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6570 @item -foptimize-strlen
6571 @opindex foptimize-strlen
6572 Optimize various standard C string functions (e.g. @code{strlen},
6573 @code{strchr} or @code{strcpy}) and
6574 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
6576 Enabled at levels @option{-O2}, @option{-O3}.
6580 Do not expand any functions inline apart from those marked with
6581 the @code{always_inline} attribute. This is the default when not
6584 Single functions can be exempted from inlining by marking them
6585 with the @code{noinline} attribute.
6587 @item -finline-small-functions
6588 @opindex finline-small-functions
6589 Integrate functions into their callers when their body is smaller than expected
6590 function call code (so overall size of program gets smaller). The compiler
6591 heuristically decides which functions are simple enough to be worth integrating
6592 in this way. This inlining applies to all functions, even those not declared
6595 Enabled at level @option{-O2}.
6597 @item -findirect-inlining
6598 @opindex findirect-inlining
6599 Inline also indirect calls that are discovered to be known at compile
6600 time thanks to previous inlining. This option has any effect only
6601 when inlining itself is turned on by the @option{-finline-functions}
6602 or @option{-finline-small-functions} options.
6604 Enabled at level @option{-O2}.
6606 @item -finline-functions
6607 @opindex finline-functions
6608 Consider all functions for inlining, even if they are not declared inline.
6609 The compiler heuristically decides which functions are worth integrating
6612 If all calls to a given function are integrated, and the function is
6613 declared @code{static}, then the function is normally not output as
6614 assembler code in its own right.
6616 Enabled at level @option{-O3}.
6618 @item -finline-functions-called-once
6619 @opindex finline-functions-called-once
6620 Consider all @code{static} functions called once for inlining into their
6621 caller even if they are not marked @code{inline}. If a call to a given
6622 function is integrated, then the function is not output as assembler code
6625 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6627 @item -fearly-inlining
6628 @opindex fearly-inlining
6629 Inline functions marked by @code{always_inline} and functions whose body seems
6630 smaller than the function call overhead early before doing
6631 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
6632 makes profiling significantly cheaper and usually inlining faster on programs
6633 having large chains of nested wrapper functions.
6639 Perform interprocedural scalar replacement of aggregates, removal of
6640 unused parameters and replacement of parameters passed by reference
6641 by parameters passed by value.
6643 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6645 @item -finline-limit=@var{n}
6646 @opindex finline-limit
6647 By default, GCC limits the size of functions that can be inlined. This flag
6648 allows coarse control of this limit. @var{n} is the size of functions that
6649 can be inlined in number of pseudo instructions.
6651 Inlining is actually controlled by a number of parameters, which may be
6652 specified individually by using @option{--param @var{name}=@var{value}}.
6653 The @option{-finline-limit=@var{n}} option sets some of these parameters
6657 @item max-inline-insns-single
6658 is set to @var{n}/2.
6659 @item max-inline-insns-auto
6660 is set to @var{n}/2.
6663 See below for a documentation of the individual
6664 parameters controlling inlining and for the defaults of these parameters.
6666 @emph{Note:} there may be no value to @option{-finline-limit} that results
6667 in default behavior.
6669 @emph{Note:} pseudo instruction represents, in this particular context, an
6670 abstract measurement of function's size. In no way does it represent a count
6671 of assembly instructions and as such its exact meaning might change from one
6672 release to an another.
6674 @item -fno-keep-inline-dllexport
6675 @opindex fno-keep-inline-dllexport
6676 This is a more fine-grained version of @option{-fkeep-inline-functions},
6677 which applies only to functions that are declared using the @code{dllexport}
6678 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6681 @item -fkeep-inline-functions
6682 @opindex fkeep-inline-functions
6683 In C, emit @code{static} functions that are declared @code{inline}
6684 into the object file, even if the function has been inlined into all
6685 of its callers. This switch does not affect functions using the
6686 @code{extern inline} extension in GNU C90@. In C++, emit any and all
6687 inline functions into the object file.
6689 @item -fkeep-static-functions
6690 @opindex fkeep-static-functions
6691 Emit @code{static} functions into the object file, even if the function
6694 @item -fkeep-static-consts
6695 @opindex fkeep-static-consts
6696 Emit variables declared @code{static const} when optimization isn't turned
6697 on, even if the variables aren't referenced.
6699 GCC enables this option by default. If you want to force the compiler to
6700 check if a variable is referenced, regardless of whether or not
6701 optimization is turned on, use the @option{-fno-keep-static-consts} option.
6703 @item -fmerge-constants
6704 @opindex fmerge-constants
6705 Attempt to merge identical constants (string constants and floating-point
6706 constants) across compilation units.
6708 This option is the default for optimized compilation if the assembler and
6709 linker support it. Use @option{-fno-merge-constants} to inhibit this
6712 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6714 @item -fmerge-all-constants
6715 @opindex fmerge-all-constants
6716 Attempt to merge identical constants and identical variables.
6718 This option implies @option{-fmerge-constants}. In addition to
6719 @option{-fmerge-constants} this considers e.g.@: even constant initialized
6720 arrays or initialized constant variables with integral or floating-point
6721 types. Languages like C or C++ require each variable, including multiple
6722 instances of the same variable in recursive calls, to have distinct locations,
6723 so using this option results in non-conforming
6726 @item -fmodulo-sched
6727 @opindex fmodulo-sched
6728 Perform swing modulo scheduling immediately before the first scheduling
6729 pass. This pass looks at innermost loops and reorders their
6730 instructions by overlapping different iterations.
6732 @item -fmodulo-sched-allow-regmoves
6733 @opindex fmodulo-sched-allow-regmoves
6734 Perform more aggressive SMS-based modulo scheduling with register moves
6735 allowed. By setting this flag certain anti-dependences edges are
6736 deleted, which triggers the generation of reg-moves based on the
6737 life-range analysis. This option is effective only with
6738 @option{-fmodulo-sched} enabled.
6740 @item -fno-branch-count-reg
6741 @opindex fno-branch-count-reg
6742 Avoid running a pass scanning for opportunities to use ``decrement and
6743 branch'' instructions on a count register instead of generating sequences
6744 of instructions that decrement a register, compare it against zero, and
6745 then branch based upon the result. This option is only meaningful on
6746 architectures that support such instructions, which include x86, PowerPC,
6747 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
6748 doesn't remove the decrement and branch instructions from the generated
6749 instruction stream introduced by other optimization passes.
6751 Enabled by default at @option{-O1} and higher.
6753 The default is @option{-fbranch-count-reg}.
6755 @item -fno-function-cse
6756 @opindex fno-function-cse
6757 Do not put function addresses in registers; make each instruction that
6758 calls a constant function contain the function's address explicitly.
6760 This option results in less efficient code, but some strange hacks
6761 that alter the assembler output may be confused by the optimizations
6762 performed when this option is not used.
6764 The default is @option{-ffunction-cse}
6766 @item -fno-zero-initialized-in-bss
6767 @opindex fno-zero-initialized-in-bss
6768 If the target supports a BSS section, GCC by default puts variables that
6769 are initialized to zero into BSS@. This can save space in the resulting
6772 This option turns off this behavior because some programs explicitly
6773 rely on variables going to the data section---e.g., so that the
6774 resulting executable can find the beginning of that section and/or make
6775 assumptions based on that.
6777 The default is @option{-fzero-initialized-in-bss}.
6779 @item -fthread-jumps
6780 @opindex fthread-jumps
6781 Perform optimizations that check to see if a jump branches to a
6782 location where another comparison subsumed by the first is found. If
6783 so, the first branch is redirected to either the destination of the
6784 second branch or a point immediately following it, depending on whether
6785 the condition is known to be true or false.
6787 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6789 @item -fsplit-wide-types
6790 @opindex fsplit-wide-types
6791 When using a type that occupies multiple registers, such as @code{long
6792 long} on a 32-bit system, split the registers apart and allocate them
6793 independently. This normally generates better code for those types,
6794 but may make debugging more difficult.
6796 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6799 @item -fcse-follow-jumps
6800 @opindex fcse-follow-jumps
6801 In common subexpression elimination (CSE), scan through jump instructions
6802 when the target of the jump is not reached by any other path. For
6803 example, when CSE encounters an @code{if} statement with an
6804 @code{else} clause, CSE follows the jump when the condition
6807 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6809 @item -fcse-skip-blocks
6810 @opindex fcse-skip-blocks
6811 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6812 follow jumps that conditionally skip over blocks. When CSE
6813 encounters a simple @code{if} statement with no else clause,
6814 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
6815 body of the @code{if}.
6817 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6819 @item -frerun-cse-after-loop
6820 @opindex frerun-cse-after-loop
6821 Re-run common subexpression elimination after loop optimizations are
6824 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6828 Perform a global common subexpression elimination pass.
6829 This pass also performs global constant and copy propagation.
6831 @emph{Note:} When compiling a program using computed gotos, a GCC
6832 extension, you may get better run-time performance if you disable
6833 the global common subexpression elimination pass by adding
6834 @option{-fno-gcse} to the command line.
6836 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6840 When @option{-fgcse-lm} is enabled, global common subexpression elimination
6841 attempts to move loads that are only killed by stores into themselves. This
6842 allows a loop containing a load/store sequence to be changed to a load outside
6843 the loop, and a copy/store within the loop.
6845 Enabled by default when @option{-fgcse} is enabled.
6849 When @option{-fgcse-sm} is enabled, a store motion pass is run after
6850 global common subexpression elimination. This pass attempts to move
6851 stores out of loops. When used in conjunction with @option{-fgcse-lm},
6852 loops containing a load/store sequence can be changed to a load before
6853 the loop and a store after the loop.
6855 Not enabled at any optimization level.
6859 When @option{-fgcse-las} is enabled, the global common subexpression
6860 elimination pass eliminates redundant loads that come after stores to the
6861 same memory location (both partial and full redundancies).
6863 Not enabled at any optimization level.
6865 @item -fgcse-after-reload
6866 @opindex fgcse-after-reload
6867 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6868 pass is performed after reload. The purpose of this pass is to clean up
6871 @item -faggressive-loop-optimizations
6872 @opindex faggressive-loop-optimizations
6873 This option tells the loop optimizer to use language constraints to
6874 derive bounds for the number of iterations of a loop. This assumes that
6875 loop code does not invoke undefined behavior by for example causing signed
6876 integer overflows or out-of-bound array accesses. The bounds for the
6877 number of iterations of a loop are used to guide loop unrolling and peeling
6878 and loop exit test optimizations.
6879 This option is enabled by default.
6881 @item -funconstrained-commons
6882 @opindex funconstrained-commons
6883 This option tells the compiler that variables declared in common blocks
6884 (e.g. Fortran) may later be overridden with longer trailing arrays. This
6885 prevents certain optimizations that depend on knowing the array bounds.
6887 @item -fcrossjumping
6888 @opindex fcrossjumping
6889 Perform cross-jumping transformation.
6890 This transformation unifies equivalent code and saves code size. The
6891 resulting code may or may not perform better than without cross-jumping.
6893 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6895 @item -fauto-inc-dec
6896 @opindex fauto-inc-dec
6897 Combine increments or decrements of addresses with memory accesses.
6898 This pass is always skipped on architectures that do not have
6899 instructions to support this. Enabled by default at @option{-O} and
6900 higher on architectures that support this.
6904 Perform dead code elimination (DCE) on RTL@.
6905 Enabled by default at @option{-O} and higher.
6909 Perform dead store elimination (DSE) on RTL@.
6910 Enabled by default at @option{-O} and higher.
6912 @item -fif-conversion
6913 @opindex fif-conversion
6914 Attempt to transform conditional jumps into branch-less equivalents. This
6915 includes use of conditional moves, min, max, set flags and abs instructions, and
6916 some tricks doable by standard arithmetics. The use of conditional execution
6917 on chips where it is available is controlled by @option{-fif-conversion2}.
6919 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6921 @item -fif-conversion2
6922 @opindex fif-conversion2
6923 Use conditional execution (where available) to transform conditional jumps into
6924 branch-less equivalents.
6926 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6928 @item -fdeclone-ctor-dtor
6929 @opindex fdeclone-ctor-dtor
6930 The C++ ABI requires multiple entry points for constructors and
6931 destructors: one for a base subobject, one for a complete object, and
6932 one for a virtual destructor that calls operator delete afterwards.
6933 For a hierarchy with virtual bases, the base and complete variants are
6934 clones, which means two copies of the function. With this option, the
6935 base and complete variants are changed to be thunks that call a common
6938 Enabled by @option{-Os}.
6940 @item -fdelete-null-pointer-checks
6941 @opindex fdelete-null-pointer-checks
6942 Assume that programs cannot safely dereference null pointers, and that
6943 no code or data element resides at address zero.
6944 This option enables simple constant
6945 folding optimizations at all optimization levels. In addition, other
6946 optimization passes in GCC use this flag to control global dataflow
6947 analyses that eliminate useless checks for null pointers; these assume
6948 that a memory access to address zero always results in a trap, so
6949 that if a pointer is checked after it has already been dereferenced,
6952 Note however that in some environments this assumption is not true.
6953 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
6954 for programs that depend on that behavior.
6956 This option is enabled by default on most targets. On Nios II ELF, it
6957 defaults to off. On AVR and CR16, this option is completely disabled.
6959 Passes that use the dataflow information
6960 are enabled independently at different optimization levels.
6962 @item -fdevirtualize
6963 @opindex fdevirtualize
6964 Attempt to convert calls to virtual functions to direct calls. This
6965 is done both within a procedure and interprocedurally as part of
6966 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
6967 propagation (@option{-fipa-cp}).
6968 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6970 @item -fdevirtualize-speculatively
6971 @opindex fdevirtualize-speculatively
6972 Attempt to convert calls to virtual functions to speculative direct calls.
6973 Based on the analysis of the type inheritance graph, determine for a given call
6974 the set of likely targets. If the set is small, preferably of size 1, change
6975 the call into a conditional deciding between direct and indirect calls. The
6976 speculative calls enable more optimizations, such as inlining. When they seem
6977 useless after further optimization, they are converted back into original form.
6979 @item -fdevirtualize-at-ltrans
6980 @opindex fdevirtualize-at-ltrans
6981 Stream extra information needed for aggressive devirtualization when running
6982 the link-time optimizer in local transformation mode.
6983 This option enables more devirtualization but
6984 significantly increases the size of streamed data. For this reason it is
6985 disabled by default.
6987 @item -fexpensive-optimizations
6988 @opindex fexpensive-optimizations
6989 Perform a number of minor optimizations that are relatively expensive.
6991 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6995 Attempt to remove redundant extension instructions. This is especially
6996 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
6997 registers after writing to their lower 32-bit half.
6999 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
7000 @option{-O3}, @option{-Os}.
7002 @item -fno-lifetime-dse
7003 @opindex fno-lifetime-dse
7004 In C++ the value of an object is only affected by changes within its
7005 lifetime: when the constructor begins, the object has an indeterminate
7006 value, and any changes during the lifetime of the object are dead when
7007 the object is destroyed. Normally dead store elimination will take
7008 advantage of this; if your code relies on the value of the object
7009 storage persisting beyond the lifetime of the object, you can use this
7010 flag to disable this optimization. To preserve stores before the
7011 constructor starts (e.g. because your operator new clears the object
7012 storage) but still treat the object as dead after the destructor you,
7013 can use @option{-flifetime-dse=1}. The default behavior can be
7014 explicitly selected with @option{-flifetime-dse=2}.
7015 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
7017 @item -flive-range-shrinkage
7018 @opindex flive-range-shrinkage
7019 Attempt to decrease register pressure through register live range
7020 shrinkage. This is helpful for fast processors with small or moderate
7023 @item -fira-algorithm=@var{algorithm}
7024 @opindex fira-algorithm
7025 Use the specified coloring algorithm for the integrated register
7026 allocator. The @var{algorithm} argument can be @samp{priority}, which
7027 specifies Chow's priority coloring, or @samp{CB}, which specifies
7028 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
7029 for all architectures, but for those targets that do support it, it is
7030 the default because it generates better code.
7032 @item -fira-region=@var{region}
7033 @opindex fira-region
7034 Use specified regions for the integrated register allocator. The
7035 @var{region} argument should be one of the following:
7040 Use all loops as register allocation regions.
7041 This can give the best results for machines with a small and/or
7042 irregular register set.
7045 Use all loops except for loops with small register pressure
7046 as the regions. This value usually gives
7047 the best results in most cases and for most architectures,
7048 and is enabled by default when compiling with optimization for speed
7049 (@option{-O}, @option{-O2}, @dots{}).
7052 Use all functions as a single region.
7053 This typically results in the smallest code size, and is enabled by default for
7054 @option{-Os} or @option{-O0}.
7058 @item -fira-hoist-pressure
7059 @opindex fira-hoist-pressure
7060 Use IRA to evaluate register pressure in the code hoisting pass for
7061 decisions to hoist expressions. This option usually results in smaller
7062 code, but it can slow the compiler down.
7064 This option is enabled at level @option{-Os} for all targets.
7066 @item -fira-loop-pressure
7067 @opindex fira-loop-pressure
7068 Use IRA to evaluate register pressure in loops for decisions to move
7069 loop invariants. This option usually results in generation
7070 of faster and smaller code on machines with large register files (>= 32
7071 registers), but it can slow the compiler down.
7073 This option is enabled at level @option{-O3} for some targets.
7075 @item -fno-ira-share-save-slots
7076 @opindex fno-ira-share-save-slots
7077 Disable sharing of stack slots used for saving call-used hard
7078 registers living through a call. Each hard register gets a
7079 separate stack slot, and as a result function stack frames are
7082 @item -fno-ira-share-spill-slots
7083 @opindex fno-ira-share-spill-slots
7084 Disable sharing of stack slots allocated for pseudo-registers. Each
7085 pseudo-register that does not get a hard register gets a separate
7086 stack slot, and as a result function stack frames are larger.
7090 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7091 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7092 values if it is profitable.
7094 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7096 @item -fdelayed-branch
7097 @opindex fdelayed-branch
7098 If supported for the target machine, attempt to reorder instructions
7099 to exploit instruction slots available after delayed branch
7102 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7104 @item -fschedule-insns
7105 @opindex fschedule-insns
7106 If supported for the target machine, attempt to reorder instructions to
7107 eliminate execution stalls due to required data being unavailable. This
7108 helps machines that have slow floating point or memory load instructions
7109 by allowing other instructions to be issued until the result of the load
7110 or floating-point instruction is required.
7112 Enabled at levels @option{-O2}, @option{-O3}.
7114 @item -fschedule-insns2
7115 @opindex fschedule-insns2
7116 Similar to @option{-fschedule-insns}, but requests an additional pass of
7117 instruction scheduling after register allocation has been done. This is
7118 especially useful on machines with a relatively small number of
7119 registers and where memory load instructions take more than one cycle.
7121 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7123 @item -fno-sched-interblock
7124 @opindex fno-sched-interblock
7125 Don't schedule instructions across basic blocks. This is normally
7126 enabled by default when scheduling before register allocation, i.e.@:
7127 with @option{-fschedule-insns} or at @option{-O2} or higher.
7129 @item -fno-sched-spec
7130 @opindex fno-sched-spec
7131 Don't allow speculative motion of non-load instructions. This is normally
7132 enabled by default when scheduling before register allocation, i.e.@:
7133 with @option{-fschedule-insns} or at @option{-O2} or higher.
7135 @item -fsched-pressure
7136 @opindex fsched-pressure
7137 Enable register pressure sensitive insn scheduling before register
7138 allocation. This only makes sense when scheduling before register
7139 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7140 @option{-O2} or higher. Usage of this option can improve the
7141 generated code and decrease its size by preventing register pressure
7142 increase above the number of available hard registers and subsequent
7143 spills in register allocation.
7145 @item -fsched-spec-load
7146 @opindex fsched-spec-load
7147 Allow speculative motion of some load instructions. This only makes
7148 sense when scheduling before register allocation, i.e.@: with
7149 @option{-fschedule-insns} or at @option{-O2} or higher.
7151 @item -fsched-spec-load-dangerous
7152 @opindex fsched-spec-load-dangerous
7153 Allow speculative motion of more load instructions. This only makes
7154 sense when scheduling before register allocation, i.e.@: with
7155 @option{-fschedule-insns} or at @option{-O2} or higher.
7157 @item -fsched-stalled-insns
7158 @itemx -fsched-stalled-insns=@var{n}
7159 @opindex fsched-stalled-insns
7160 Define how many insns (if any) can be moved prematurely from the queue
7161 of stalled insns into the ready list during the second scheduling pass.
7162 @option{-fno-sched-stalled-insns} means that no insns are moved
7163 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7164 on how many queued insns can be moved prematurely.
7165 @option{-fsched-stalled-insns} without a value is equivalent to
7166 @option{-fsched-stalled-insns=1}.
7168 @item -fsched-stalled-insns-dep
7169 @itemx -fsched-stalled-insns-dep=@var{n}
7170 @opindex fsched-stalled-insns-dep
7171 Define how many insn groups (cycles) are examined for a dependency
7172 on a stalled insn that is a candidate for premature removal from the queue
7173 of stalled insns. This has an effect only during the second scheduling pass,
7174 and only if @option{-fsched-stalled-insns} is used.
7175 @option{-fno-sched-stalled-insns-dep} is equivalent to
7176 @option{-fsched-stalled-insns-dep=0}.
7177 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7178 @option{-fsched-stalled-insns-dep=1}.
7180 @item -fsched2-use-superblocks
7181 @opindex fsched2-use-superblocks
7182 When scheduling after register allocation, use superblock scheduling.
7183 This allows motion across basic block boundaries,
7184 resulting in faster schedules. This option is experimental, as not all machine
7185 descriptions used by GCC model the CPU closely enough to avoid unreliable
7186 results from the algorithm.
7188 This only makes sense when scheduling after register allocation, i.e.@: with
7189 @option{-fschedule-insns2} or at @option{-O2} or higher.
7191 @item -fsched-group-heuristic
7192 @opindex fsched-group-heuristic
7193 Enable the group heuristic in the scheduler. This heuristic favors
7194 the instruction that belongs to a schedule group. This is enabled
7195 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7196 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7198 @item -fsched-critical-path-heuristic
7199 @opindex fsched-critical-path-heuristic
7200 Enable the critical-path heuristic in the scheduler. This heuristic favors
7201 instructions on the critical path. This is enabled by default when
7202 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7203 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7205 @item -fsched-spec-insn-heuristic
7206 @opindex fsched-spec-insn-heuristic
7207 Enable the speculative instruction heuristic in the scheduler. This
7208 heuristic favors speculative instructions with greater dependency weakness.
7209 This is enabled by default when scheduling is enabled, i.e.@:
7210 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7211 or at @option{-O2} or higher.
7213 @item -fsched-rank-heuristic
7214 @opindex fsched-rank-heuristic
7215 Enable the rank heuristic in the scheduler. This heuristic favors
7216 the instruction belonging to a basic block with greater size or frequency.
7217 This is enabled by default when scheduling is enabled, i.e.@:
7218 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7219 at @option{-O2} or higher.
7221 @item -fsched-last-insn-heuristic
7222 @opindex fsched-last-insn-heuristic
7223 Enable the last-instruction heuristic in the scheduler. This heuristic
7224 favors the instruction that is less dependent on the last instruction
7225 scheduled. This is enabled by default when scheduling is enabled,
7226 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7227 at @option{-O2} or higher.
7229 @item -fsched-dep-count-heuristic
7230 @opindex fsched-dep-count-heuristic
7231 Enable the dependent-count heuristic in the scheduler. This heuristic
7232 favors the instruction that has more instructions depending on it.
7233 This is enabled by default when scheduling is enabled, i.e.@:
7234 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7235 at @option{-O2} or higher.
7237 @item -freschedule-modulo-scheduled-loops
7238 @opindex freschedule-modulo-scheduled-loops
7239 Modulo scheduling is performed before traditional scheduling. If a loop
7240 is modulo scheduled, later scheduling passes may change its schedule.
7241 Use this option to control that behavior.
7243 @item -fselective-scheduling
7244 @opindex fselective-scheduling
7245 Schedule instructions using selective scheduling algorithm. Selective
7246 scheduling runs instead of the first scheduler pass.
7248 @item -fselective-scheduling2
7249 @opindex fselective-scheduling2
7250 Schedule instructions using selective scheduling algorithm. Selective
7251 scheduling runs instead of the second scheduler pass.
7253 @item -fsel-sched-pipelining
7254 @opindex fsel-sched-pipelining
7255 Enable software pipelining of innermost loops during selective scheduling.
7256 This option has no effect unless one of @option{-fselective-scheduling} or
7257 @option{-fselective-scheduling2} is turned on.
7259 @item -fsel-sched-pipelining-outer-loops
7260 @opindex fsel-sched-pipelining-outer-loops
7261 When pipelining loops during selective scheduling, also pipeline outer loops.
7262 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7264 @item -fsemantic-interposition
7265 @opindex fsemantic-interposition
7266 Some object formats, like ELF, allow interposing of symbols by the
7268 This means that for symbols exported from the DSO, the compiler cannot perform
7269 interprocedural propagation, inlining and other optimizations in anticipation
7270 that the function or variable in question may change. While this feature is
7271 useful, for example, to rewrite memory allocation functions by a debugging
7272 implementation, it is expensive in the terms of code quality.
7273 With @option{-fno-semantic-interposition} the compiler assumes that
7274 if interposition happens for functions the overwriting function will have
7275 precisely the same semantics (and side effects).
7276 Similarly if interposition happens
7277 for variables, the constructor of the variable will be the same. The flag
7278 has no effect for functions explicitly declared inline
7279 (where it is never allowed for interposition to change semantics)
7280 and for symbols explicitly declared weak.
7283 @opindex fshrink-wrap
7284 Emit function prologues only before parts of the function that need it,
7285 rather than at the top of the function. This flag is enabled by default at
7286 @option{-O} and higher.
7288 @item -fcaller-saves
7289 @opindex fcaller-saves
7290 Enable allocation of values to registers that are clobbered by
7291 function calls, by emitting extra instructions to save and restore the
7292 registers around such calls. Such allocation is done only when it
7293 seems to result in better code.
7295 This option is always enabled by default on certain machines, usually
7296 those which have no call-preserved registers to use instead.
7298 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7300 @item -fcombine-stack-adjustments
7301 @opindex fcombine-stack-adjustments
7302 Tracks stack adjustments (pushes and pops) and stack memory references
7303 and then tries to find ways to combine them.
7305 Enabled by default at @option{-O1} and higher.
7309 Use caller save registers for allocation if those registers are not used by
7310 any called function. In that case it is not necessary to save and restore
7311 them around calls. This is only possible if called functions are part of
7312 same compilation unit as current function and they are compiled before it.
7314 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
7315 is disabled if generated code will be instrumented for profiling
7316 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
7317 exactly (this happens on targets that do not expose prologues
7318 and epilogues in RTL).
7320 @item -fconserve-stack
7321 @opindex fconserve-stack
7322 Attempt to minimize stack usage. The compiler attempts to use less
7323 stack space, even if that makes the program slower. This option
7324 implies setting the @option{large-stack-frame} parameter to 100
7325 and the @option{large-stack-frame-growth} parameter to 400.
7327 @item -ftree-reassoc
7328 @opindex ftree-reassoc
7329 Perform reassociation on trees. This flag is enabled by default
7330 at @option{-O} and higher.
7332 @item -fcode-hoisting
7333 @opindex fcode-hoisting
7334 Perform code hoisting. Code hoisting tries to move the
7335 evaluation of expressions executed on all paths to the function exit
7336 as early as possible. This is especially useful as a code size
7337 optimization, but it often helps for code speed as well.
7338 This flag is enabled by default at @option{-O2} and higher.
7342 Perform partial redundancy elimination (PRE) on trees. This flag is
7343 enabled by default at @option{-O2} and @option{-O3}.
7345 @item -ftree-partial-pre
7346 @opindex ftree-partial-pre
7347 Make partial redundancy elimination (PRE) more aggressive. This flag is
7348 enabled by default at @option{-O3}.
7350 @item -ftree-forwprop
7351 @opindex ftree-forwprop
7352 Perform forward propagation on trees. This flag is enabled by default
7353 at @option{-O} and higher.
7357 Perform full redundancy elimination (FRE) on trees. The difference
7358 between FRE and PRE is that FRE only considers expressions
7359 that are computed on all paths leading to the redundant computation.
7360 This analysis is faster than PRE, though it exposes fewer redundancies.
7361 This flag is enabled by default at @option{-O} and higher.
7363 @item -ftree-phiprop
7364 @opindex ftree-phiprop
7365 Perform hoisting of loads from conditional pointers on trees. This
7366 pass is enabled by default at @option{-O} and higher.
7368 @item -fhoist-adjacent-loads
7369 @opindex fhoist-adjacent-loads
7370 Speculatively hoist loads from both branches of an if-then-else if the
7371 loads are from adjacent locations in the same structure and the target
7372 architecture has a conditional move instruction. This flag is enabled
7373 by default at @option{-O2} and higher.
7375 @item -ftree-copy-prop
7376 @opindex ftree-copy-prop
7377 Perform copy propagation on trees. This pass eliminates unnecessary
7378 copy operations. This flag is enabled by default at @option{-O} and
7381 @item -fipa-pure-const
7382 @opindex fipa-pure-const
7383 Discover which functions are pure or constant.
7384 Enabled by default at @option{-O} and higher.
7386 @item -fipa-reference
7387 @opindex fipa-reference
7388 Discover which static variables do not escape the
7390 Enabled by default at @option{-O} and higher.
7394 Perform interprocedural pointer analysis and interprocedural modification
7395 and reference analysis. This option can cause excessive memory and
7396 compile-time usage on large compilation units. It is not enabled by
7397 default at any optimization level.
7400 @opindex fipa-profile
7401 Perform interprocedural profile propagation. The functions called only from
7402 cold functions are marked as cold. Also functions executed once (such as
7403 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7404 functions and loop less parts of functions executed once are then optimized for
7406 Enabled by default at @option{-O} and higher.
7410 Perform interprocedural constant propagation.
7411 This optimization analyzes the program to determine when values passed
7412 to functions are constants and then optimizes accordingly.
7413 This optimization can substantially increase performance
7414 if the application has constants passed to functions.
7415 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7417 @item -fipa-cp-clone
7418 @opindex fipa-cp-clone
7419 Perform function cloning to make interprocedural constant propagation stronger.
7420 When enabled, interprocedural constant propagation performs function cloning
7421 when externally visible function can be called with constant arguments.
7422 Because this optimization can create multiple copies of functions,
7423 it may significantly increase code size
7424 (see @option{--param ipcp-unit-growth=@var{value}}).
7425 This flag is enabled by default at @option{-O3}.
7427 @item -fipa-cp-alignment
7428 @opindex -fipa-cp-alignment
7429 When enabled, this optimization propagates alignment of function
7430 parameters to support better vectorization and string operations.
7432 This flag is enabled by default at @option{-O2} and @option{-Os}. It
7433 requires that @option{-fipa-cp} is enabled.
7436 @opindex -fipa-bit-cp
7437 When enabled, perform ipa bitwise constant propagation. This flag is
7438 enabled by default at @option{-O2}. It requires that @option{-fipa-cp}
7443 Perform Identical Code Folding for functions and read-only variables.
7444 The optimization reduces code size and may disturb unwind stacks by replacing
7445 a function by equivalent one with a different name. The optimization works
7446 more effectively with link time optimization enabled.
7448 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
7449 works on different levels and thus the optimizations are not same - there are
7450 equivalences that are found only by GCC and equivalences found only by Gold.
7452 This flag is enabled by default at @option{-O2} and @option{-Os}.
7454 @item -fisolate-erroneous-paths-dereference
7455 @opindex fisolate-erroneous-paths-dereference
7456 Detect paths that trigger erroneous or undefined behavior due to
7457 dereferencing a null pointer. Isolate those paths from the main control
7458 flow and turn the statement with erroneous or undefined behavior into a trap.
7459 This flag is enabled by default at @option{-O2} and higher and depends on
7460 @option{-fdelete-null-pointer-checks} also being enabled.
7462 @item -fisolate-erroneous-paths-attribute
7463 @opindex fisolate-erroneous-paths-attribute
7464 Detect paths that trigger erroneous or undefined behavior due a null value
7465 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
7466 attribute. Isolate those paths from the main control flow and turn the
7467 statement with erroneous or undefined behavior into a trap. This is not
7468 currently enabled, but may be enabled by @option{-O2} in the future.
7472 Perform forward store motion on trees. This flag is
7473 enabled by default at @option{-O} and higher.
7475 @item -ftree-bit-ccp
7476 @opindex ftree-bit-ccp
7477 Perform sparse conditional bit constant propagation on trees and propagate
7478 pointer alignment information.
7479 This pass only operates on local scalar variables and is enabled by default
7480 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7484 Perform sparse conditional constant propagation (CCP) on trees. This
7485 pass only operates on local scalar variables and is enabled by default
7486 at @option{-O} and higher.
7488 @item -fssa-backprop
7489 @opindex fssa-backprop
7490 Propagate information about uses of a value up the definition chain
7491 in order to simplify the definitions. For example, this pass strips
7492 sign operations if the sign of a value never matters. The flag is
7493 enabled by default at @option{-O} and higher.
7496 @opindex fssa-phiopt
7497 Perform pattern matching on SSA PHI nodes to optimize conditional
7498 code. This pass is enabled by default at @option{-O} and higher.
7500 @item -ftree-switch-conversion
7501 @opindex ftree-switch-conversion
7502 Perform conversion of simple initializations in a switch to
7503 initializations from a scalar array. This flag is enabled by default
7504 at @option{-O2} and higher.
7506 @item -ftree-tail-merge
7507 @opindex ftree-tail-merge
7508 Look for identical code sequences. When found, replace one with a jump to the
7509 other. This optimization is known as tail merging or cross jumping. This flag
7510 is enabled by default at @option{-O2} and higher. The compilation time
7512 be limited using @option{max-tail-merge-comparisons} parameter and
7513 @option{max-tail-merge-iterations} parameter.
7517 Perform dead code elimination (DCE) on trees. This flag is enabled by
7518 default at @option{-O} and higher.
7520 @item -ftree-builtin-call-dce
7521 @opindex ftree-builtin-call-dce
7522 Perform conditional dead code elimination (DCE) for calls to built-in functions
7523 that may set @code{errno} but are otherwise side-effect free. This flag is
7524 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7527 @item -ftree-dominator-opts
7528 @opindex ftree-dominator-opts
7529 Perform a variety of simple scalar cleanups (constant/copy
7530 propagation, redundancy elimination, range propagation and expression
7531 simplification) based on a dominator tree traversal. This also
7532 performs jump threading (to reduce jumps to jumps). This flag is
7533 enabled by default at @option{-O} and higher.
7537 Perform dead store elimination (DSE) on trees. A dead store is a store into
7538 a memory location that is later overwritten by another store without
7539 any intervening loads. In this case the earlier store can be deleted. This
7540 flag is enabled by default at @option{-O} and higher.
7544 Perform loop header copying on trees. This is beneficial since it increases
7545 effectiveness of code motion optimizations. It also saves one jump. This flag
7546 is enabled by default at @option{-O} and higher. It is not enabled
7547 for @option{-Os}, since it usually increases code size.
7549 @item -ftree-loop-optimize
7550 @opindex ftree-loop-optimize
7551 Perform loop optimizations on trees. This flag is enabled by default
7552 at @option{-O} and higher.
7554 @item -ftree-loop-linear
7555 @itemx -floop-interchange
7556 @itemx -floop-strip-mine
7558 @itemx -floop-unroll-and-jam
7559 @opindex ftree-loop-linear
7560 @opindex floop-interchange
7561 @opindex floop-strip-mine
7562 @opindex floop-block
7563 @opindex floop-unroll-and-jam
7564 Perform loop nest optimizations. Same as
7565 @option{-floop-nest-optimize}. To use this code transformation, GCC has
7566 to be configured with @option{--with-isl} to enable the Graphite loop
7567 transformation infrastructure.
7569 @item -fgraphite-identity
7570 @opindex fgraphite-identity
7571 Enable the identity transformation for graphite. For every SCoP we generate
7572 the polyhedral representation and transform it back to gimple. Using
7573 @option{-fgraphite-identity} we can check the costs or benefits of the
7574 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
7575 are also performed by the code generator isl, like index splitting and
7576 dead code elimination in loops.
7578 @item -floop-nest-optimize
7579 @opindex floop-nest-optimize
7580 Enable the isl based loop nest optimizer. This is a generic loop nest
7581 optimizer based on the Pluto optimization algorithms. It calculates a loop
7582 structure optimized for data-locality and parallelism. This option
7585 @item -floop-parallelize-all
7586 @opindex floop-parallelize-all
7587 Use the Graphite data dependence analysis to identify loops that can
7588 be parallelized. Parallelize all the loops that can be analyzed to
7589 not contain loop carried dependences without checking that it is
7590 profitable to parallelize the loops.
7592 @item -ftree-coalesce-vars
7593 @opindex ftree-coalesce-vars
7594 While transforming the program out of the SSA representation, attempt to
7595 reduce copying by coalescing versions of different user-defined
7596 variables, instead of just compiler temporaries. This may severely
7597 limit the ability to debug an optimized program compiled with
7598 @option{-fno-var-tracking-assignments}. In the negated form, this flag
7599 prevents SSA coalescing of user variables. This option is enabled by
7600 default if optimization is enabled, and it does very little otherwise.
7602 @item -ftree-loop-if-convert
7603 @opindex ftree-loop-if-convert
7604 Attempt to transform conditional jumps in the innermost loops to
7605 branch-less equivalents. The intent is to remove control-flow from
7606 the innermost loops in order to improve the ability of the
7607 vectorization pass to handle these loops. This is enabled by default
7608 if vectorization is enabled.
7610 @item -ftree-loop-if-convert-stores
7611 @opindex ftree-loop-if-convert-stores
7612 Attempt to also if-convert conditional jumps containing memory writes.
7613 This transformation can be unsafe for multi-threaded programs as it
7614 transforms conditional memory writes into unconditional memory writes.
7617 for (i = 0; i < N; i++)
7623 for (i = 0; i < N; i++)
7624 A[i] = cond ? expr : A[i];
7626 potentially producing data races.
7628 @item -ftree-loop-distribution
7629 @opindex ftree-loop-distribution
7630 Perform loop distribution. This flag can improve cache performance on
7631 big loop bodies and allow further loop optimizations, like
7632 parallelization or vectorization, to take place. For example, the loop
7649 @item -ftree-loop-distribute-patterns
7650 @opindex ftree-loop-distribute-patterns
7651 Perform loop distribution of patterns that can be code generated with
7652 calls to a library. This flag is enabled by default at @option{-O3}.
7654 This pass distributes the initialization loops and generates a call to
7655 memset zero. For example, the loop
7671 and the initialization loop is transformed into a call to memset zero.
7673 @item -ftree-loop-im
7674 @opindex ftree-loop-im
7675 Perform loop invariant motion on trees. This pass moves only invariants that
7676 are hard to handle at RTL level (function calls, operations that expand to
7677 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
7678 operands of conditions that are invariant out of the loop, so that we can use
7679 just trivial invariantness analysis in loop unswitching. The pass also includes
7682 @item -ftree-loop-ivcanon
7683 @opindex ftree-loop-ivcanon
7684 Create a canonical counter for number of iterations in loops for which
7685 determining number of iterations requires complicated analysis. Later
7686 optimizations then may determine the number easily. Useful especially
7687 in connection with unrolling.
7691 Perform induction variable optimizations (strength reduction, induction
7692 variable merging and induction variable elimination) on trees.
7694 @item -ftree-parallelize-loops=n
7695 @opindex ftree-parallelize-loops
7696 Parallelize loops, i.e., split their iteration space to run in n threads.
7697 This is only possible for loops whose iterations are independent
7698 and can be arbitrarily reordered. The optimization is only
7699 profitable on multiprocessor machines, for loops that are CPU-intensive,
7700 rather than constrained e.g.@: by memory bandwidth. This option
7701 implies @option{-pthread}, and thus is only supported on targets
7702 that have support for @option{-pthread}.
7706 Perform function-local points-to analysis on trees. This flag is
7707 enabled by default at @option{-O} and higher.
7711 Perform scalar replacement of aggregates. This pass replaces structure
7712 references with scalars to prevent committing structures to memory too
7713 early. This flag is enabled by default at @option{-O} and higher.
7717 Perform temporary expression replacement during the SSA->normal phase. Single
7718 use/single def temporaries are replaced at their use location with their
7719 defining expression. This results in non-GIMPLE code, but gives the expanders
7720 much more complex trees to work on resulting in better RTL generation. This is
7721 enabled by default at @option{-O} and higher.
7725 Perform straight-line strength reduction on trees. This recognizes related
7726 expressions involving multiplications and replaces them by less expensive
7727 calculations when possible. This is enabled by default at @option{-O} and
7730 @item -ftree-vectorize
7731 @opindex ftree-vectorize
7732 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
7733 and @option{-ftree-slp-vectorize} if not explicitly specified.
7735 @item -ftree-loop-vectorize
7736 @opindex ftree-loop-vectorize
7737 Perform loop vectorization on trees. This flag is enabled by default at
7738 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7740 @item -ftree-slp-vectorize
7741 @opindex ftree-slp-vectorize
7742 Perform basic block vectorization on trees. This flag is enabled by default at
7743 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7745 @item -fvect-cost-model=@var{model}
7746 @opindex fvect-cost-model
7747 Alter the cost model used for vectorization. The @var{model} argument
7748 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
7749 With the @samp{unlimited} model the vectorized code-path is assumed
7750 to be profitable while with the @samp{dynamic} model a runtime check
7751 guards the vectorized code-path to enable it only for iteration
7752 counts that will likely execute faster than when executing the original
7753 scalar loop. The @samp{cheap} model disables vectorization of
7754 loops where doing so would be cost prohibitive for example due to
7755 required runtime checks for data dependence or alignment but otherwise
7756 is equal to the @samp{dynamic} model.
7757 The default cost model depends on other optimization flags and is
7758 either @samp{dynamic} or @samp{cheap}.
7760 @item -fsimd-cost-model=@var{model}
7761 @opindex fsimd-cost-model
7762 Alter the cost model used for vectorization of loops marked with the OpenMP
7763 or Cilk Plus simd directive. The @var{model} argument should be one of
7764 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
7765 have the same meaning as described in @option{-fvect-cost-model} and by
7766 default a cost model defined with @option{-fvect-cost-model} is used.
7770 Perform Value Range Propagation on trees. This is similar to the
7771 constant propagation pass, but instead of values, ranges of values are
7772 propagated. This allows the optimizers to remove unnecessary range
7773 checks like array bound checks and null pointer checks. This is
7774 enabled by default at @option{-O2} and higher. Null pointer check
7775 elimination is only done if @option{-fdelete-null-pointer-checks} is
7779 @opindex fsplit-paths
7780 Split paths leading to loop backedges. This can improve dead code
7781 elimination and common subexpression elimination. This is enabled by
7782 default at @option{-O2} and above.
7784 @item -fsplit-ivs-in-unroller
7785 @opindex fsplit-ivs-in-unroller
7786 Enables expression of values of induction variables in later iterations
7787 of the unrolled loop using the value in the first iteration. This breaks
7788 long dependency chains, thus improving efficiency of the scheduling passes.
7790 A combination of @option{-fweb} and CSE is often sufficient to obtain the
7791 same effect. However, that is not reliable in cases where the loop body
7792 is more complicated than a single basic block. It also does not work at all
7793 on some architectures due to restrictions in the CSE pass.
7795 This optimization is enabled by default.
7797 @item -fvariable-expansion-in-unroller
7798 @opindex fvariable-expansion-in-unroller
7799 With this option, the compiler creates multiple copies of some
7800 local variables when unrolling a loop, which can result in superior code.
7802 @item -fpartial-inlining
7803 @opindex fpartial-inlining
7804 Inline parts of functions. This option has any effect only
7805 when inlining itself is turned on by the @option{-finline-functions}
7806 or @option{-finline-small-functions} options.
7808 Enabled at level @option{-O2}.
7810 @item -fpredictive-commoning
7811 @opindex fpredictive-commoning
7812 Perform predictive commoning optimization, i.e., reusing computations
7813 (especially memory loads and stores) performed in previous
7814 iterations of loops.
7816 This option is enabled at level @option{-O3}.
7818 @item -fprefetch-loop-arrays
7819 @opindex fprefetch-loop-arrays
7820 If supported by the target machine, generate instructions to prefetch
7821 memory to improve the performance of loops that access large arrays.
7823 This option may generate better or worse code; results are highly
7824 dependent on the structure of loops within the source code.
7826 Disabled at level @option{-Os}.
7829 @itemx -fno-peephole2
7830 @opindex fno-peephole
7831 @opindex fno-peephole2
7832 Disable any machine-specific peephole optimizations. The difference
7833 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
7834 are implemented in the compiler; some targets use one, some use the
7835 other, a few use both.
7837 @option{-fpeephole} is enabled by default.
7838 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7840 @item -fno-guess-branch-probability
7841 @opindex fno-guess-branch-probability
7842 Do not guess branch probabilities using heuristics.
7844 GCC uses heuristics to guess branch probabilities if they are
7845 not provided by profiling feedback (@option{-fprofile-arcs}). These
7846 heuristics are based on the control flow graph. If some branch probabilities
7847 are specified by @code{__builtin_expect}, then the heuristics are
7848 used to guess branch probabilities for the rest of the control flow graph,
7849 taking the @code{__builtin_expect} info into account. The interactions
7850 between the heuristics and @code{__builtin_expect} can be complex, and in
7851 some cases, it may be useful to disable the heuristics so that the effects
7852 of @code{__builtin_expect} are easier to understand.
7854 The default is @option{-fguess-branch-probability} at levels
7855 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7857 @item -freorder-blocks
7858 @opindex freorder-blocks
7859 Reorder basic blocks in the compiled function in order to reduce number of
7860 taken branches and improve code locality.
7862 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7864 @item -freorder-blocks-algorithm=@var{algorithm}
7865 @opindex freorder-blocks-algorithm
7866 Use the specified algorithm for basic block reordering. The
7867 @var{algorithm} argument can be @samp{simple}, which does not increase
7868 code size (except sometimes due to secondary effects like alignment),
7869 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
7870 put all often executed code together, minimizing the number of branches
7871 executed by making extra copies of code.
7873 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
7874 @samp{stc} at levels @option{-O2}, @option{-O3}.
7876 @item -freorder-blocks-and-partition
7877 @opindex freorder-blocks-and-partition
7878 In addition to reordering basic blocks in the compiled function, in order
7879 to reduce number of taken branches, partitions hot and cold basic blocks
7880 into separate sections of the assembly and @file{.o} files, to improve
7881 paging and cache locality performance.
7883 This optimization is automatically turned off in the presence of
7884 exception handling, for linkonce sections, for functions with a user-defined
7885 section attribute and on any architecture that does not support named
7888 Enabled for x86 at levels @option{-O2}, @option{-O3}.
7890 @item -freorder-functions
7891 @opindex freorder-functions
7892 Reorder functions in the object file in order to
7893 improve code locality. This is implemented by using special
7894 subsections @code{.text.hot} for most frequently executed functions and
7895 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
7896 the linker so object file format must support named sections and linker must
7897 place them in a reasonable way.
7899 Also profile feedback must be available to make this option effective. See
7900 @option{-fprofile-arcs} for details.
7902 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7904 @item -fstrict-aliasing
7905 @opindex fstrict-aliasing
7906 Allow the compiler to assume the strictest aliasing rules applicable to
7907 the language being compiled. For C (and C++), this activates
7908 optimizations based on the type of expressions. In particular, an
7909 object of one type is assumed never to reside at the same address as an
7910 object of a different type, unless the types are almost the same. For
7911 example, an @code{unsigned int} can alias an @code{int}, but not a
7912 @code{void*} or a @code{double}. A character type may alias any other
7915 @anchor{Type-punning}Pay special attention to code like this:
7928 The practice of reading from a different union member than the one most
7929 recently written to (called ``type-punning'') is common. Even with
7930 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
7931 is accessed through the union type. So, the code above works as
7932 expected. @xref{Structures unions enumerations and bit-fields
7933 implementation}. However, this code might not:
7944 Similarly, access by taking the address, casting the resulting pointer
7945 and dereferencing the result has undefined behavior, even if the cast
7946 uses a union type, e.g.:
7950 return ((union a_union *) &d)->i;
7954 The @option{-fstrict-aliasing} option is enabled at levels
7955 @option{-O2}, @option{-O3}, @option{-Os}.
7957 @item -fstrict-overflow
7958 @opindex fstrict-overflow
7959 Allow the compiler to assume strict signed overflow rules, depending
7960 on the language being compiled. For C (and C++) this means that
7961 overflow when doing arithmetic with signed numbers is undefined, which
7962 means that the compiler may assume that it does not happen. This
7963 permits various optimizations. For example, the compiler assumes
7964 that an expression like @code{i + 10 > i} is always true for
7965 signed @code{i}. This assumption is only valid if signed overflow is
7966 undefined, as the expression is false if @code{i + 10} overflows when
7967 using twos complement arithmetic. When this option is in effect any
7968 attempt to determine whether an operation on signed numbers
7969 overflows must be written carefully to not actually involve overflow.
7971 This option also allows the compiler to assume strict pointer
7972 semantics: given a pointer to an object, if adding an offset to that
7973 pointer does not produce a pointer to the same object, the addition is
7974 undefined. This permits the compiler to conclude that @code{p + u >
7975 p} is always true for a pointer @code{p} and unsigned integer
7976 @code{u}. This assumption is only valid because pointer wraparound is
7977 undefined, as the expression is false if @code{p + u} overflows using
7978 twos complement arithmetic.
7980 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
7981 that integer signed overflow is fully defined: it wraps. When
7982 @option{-fwrapv} is used, there is no difference between
7983 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
7984 integers. With @option{-fwrapv} certain types of overflow are
7985 permitted. For example, if the compiler gets an overflow when doing
7986 arithmetic on constants, the overflowed value can still be used with
7987 @option{-fwrapv}, but not otherwise.
7989 The @option{-fstrict-overflow} option is enabled at levels
7990 @option{-O2}, @option{-O3}, @option{-Os}.
7992 @item -falign-functions
7993 @itemx -falign-functions=@var{n}
7994 @opindex falign-functions
7995 Align the start of functions to the next power-of-two greater than
7996 @var{n}, skipping up to @var{n} bytes. For instance,
7997 @option{-falign-functions=32} aligns functions to the next 32-byte
7998 boundary, but @option{-falign-functions=24} aligns to the next
7999 32-byte boundary only if this can be done by skipping 23 bytes or less.
8001 @option{-fno-align-functions} and @option{-falign-functions=1} are
8002 equivalent and mean that functions are not aligned.
8004 Some assemblers only support this flag when @var{n} is a power of two;
8005 in that case, it is rounded up.
8007 If @var{n} is not specified or is zero, use a machine-dependent default.
8009 Enabled at levels @option{-O2}, @option{-O3}.
8011 @item -falign-labels
8012 @itemx -falign-labels=@var{n}
8013 @opindex falign-labels
8014 Align all branch targets to a power-of-two boundary, skipping up to
8015 @var{n} bytes like @option{-falign-functions}. This option can easily
8016 make code slower, because it must insert dummy operations for when the
8017 branch target is reached in the usual flow of the code.
8019 @option{-fno-align-labels} and @option{-falign-labels=1} are
8020 equivalent and mean that labels are not aligned.
8022 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8023 are greater than this value, then their values are used instead.
8025 If @var{n} is not specified or is zero, use a machine-dependent default
8026 which is very likely to be @samp{1}, meaning no alignment.
8028 Enabled at levels @option{-O2}, @option{-O3}.
8031 @itemx -falign-loops=@var{n}
8032 @opindex falign-loops
8033 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8034 like @option{-falign-functions}. If the loops are
8035 executed many times, this makes up for any execution of the dummy
8038 @option{-fno-align-loops} and @option{-falign-loops=1} are
8039 equivalent and mean that loops are not aligned.
8041 If @var{n} is not specified or is zero, use a machine-dependent default.
8043 Enabled at levels @option{-O2}, @option{-O3}.
8046 @itemx -falign-jumps=@var{n}
8047 @opindex falign-jumps
8048 Align branch targets to a power-of-two boundary, for branch targets
8049 where the targets can only be reached by jumping, skipping up to @var{n}
8050 bytes like @option{-falign-functions}. In this case, no dummy operations
8053 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
8054 equivalent and mean that loops are not aligned.
8056 If @var{n} is not specified or is zero, use a machine-dependent default.
8058 Enabled at levels @option{-O2}, @option{-O3}.
8060 @item -funit-at-a-time
8061 @opindex funit-at-a-time
8062 This option is left for compatibility reasons. @option{-funit-at-a-time}
8063 has no effect, while @option{-fno-unit-at-a-time} implies
8064 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8068 @item -fno-toplevel-reorder
8069 @opindex fno-toplevel-reorder
8070 Do not reorder top-level functions, variables, and @code{asm}
8071 statements. Output them in the same order that they appear in the
8072 input file. When this option is used, unreferenced static variables
8073 are not removed. This option is intended to support existing code
8074 that relies on a particular ordering. For new code, it is better to
8075 use attributes when possible.
8077 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8078 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8083 Constructs webs as commonly used for register allocation purposes and assign
8084 each web individual pseudo register. This allows the register allocation pass
8085 to operate on pseudos directly, but also strengthens several other optimization
8086 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8087 however, make debugging impossible, since variables no longer stay in a
8090 Enabled by default with @option{-funroll-loops}.
8092 @item -fwhole-program
8093 @opindex fwhole-program
8094 Assume that the current compilation unit represents the whole program being
8095 compiled. All public functions and variables with the exception of @code{main}
8096 and those merged by attribute @code{externally_visible} become static functions
8097 and in effect are optimized more aggressively by interprocedural optimizers.
8099 This option should not be used in combination with @option{-flto}.
8100 Instead relying on a linker plugin should provide safer and more precise
8103 @item -flto[=@var{n}]
8105 This option runs the standard link-time optimizer. When invoked
8106 with source code, it generates GIMPLE (one of GCC's internal
8107 representations) and writes it to special ELF sections in the object
8108 file. When the object files are linked together, all the function
8109 bodies are read from these ELF sections and instantiated as if they
8110 had been part of the same translation unit.
8112 To use the link-time optimizer, @option{-flto} and optimization
8113 options should be specified at compile time and during the final link.
8114 It is recommended that you compile all the files participating in the
8115 same link with the same options and also specify those options at
8120 gcc -c -O2 -flto foo.c
8121 gcc -c -O2 -flto bar.c
8122 gcc -o myprog -flto -O2 foo.o bar.o
8125 The first two invocations to GCC save a bytecode representation
8126 of GIMPLE into special ELF sections inside @file{foo.o} and
8127 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8128 @file{foo.o} and @file{bar.o}, merges the two files into a single
8129 internal image, and compiles the result as usual. Since both
8130 @file{foo.o} and @file{bar.o} are merged into a single image, this
8131 causes all the interprocedural analyses and optimizations in GCC to
8132 work across the two files as if they were a single one. This means,
8133 for example, that the inliner is able to inline functions in
8134 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8136 Another (simpler) way to enable link-time optimization is:
8139 gcc -o myprog -flto -O2 foo.c bar.c
8142 The above generates bytecode for @file{foo.c} and @file{bar.c},
8143 merges them together into a single GIMPLE representation and optimizes
8144 them as usual to produce @file{myprog}.
8146 The only important thing to keep in mind is that to enable link-time
8147 optimizations you need to use the GCC driver to perform the link step.
8148 GCC then automatically performs link-time optimization if any of the
8149 objects involved were compiled with the @option{-flto} command-line option.
8151 should specify the optimization options to be used for link-time
8152 optimization though GCC tries to be clever at guessing an
8153 optimization level to use from the options used at compile time
8154 if you fail to specify one at link time. You can always override
8155 the automatic decision to do link-time optimization at link time
8156 by passing @option{-fno-lto} to the link command.
8158 To make whole program optimization effective, it is necessary to make
8159 certain whole program assumptions. The compiler needs to know
8160 what functions and variables can be accessed by libraries and runtime
8161 outside of the link-time optimized unit. When supported by the linker,
8162 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8163 to the compiler about used and externally visible symbols. When
8164 the linker plugin is not available, @option{-fwhole-program} should be
8165 used to allow the compiler to make these assumptions, which leads
8166 to more aggressive optimization decisions.
8168 When @option{-fuse-linker-plugin} is not enabled, when a file is
8169 compiled with @option{-flto}, the generated object file is larger than
8170 a regular object file because it contains GIMPLE bytecodes and the usual
8171 final code (see @option{-ffat-lto-objects}. This means that
8172 object files with LTO information can be linked as normal object
8173 files; if @option{-fno-lto} is passed to the linker, no
8174 interprocedural optimizations are applied. Note that when
8175 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
8176 but you cannot perform a regular, non-LTO link on them.
8178 Additionally, the optimization flags used to compile individual files
8179 are not necessarily related to those used at link time. For instance,
8182 gcc -c -O0 -ffat-lto-objects -flto foo.c
8183 gcc -c -O0 -ffat-lto-objects -flto bar.c
8184 gcc -o myprog -O3 foo.o bar.o
8187 This produces individual object files with unoptimized assembler
8188 code, but the resulting binary @file{myprog} is optimized at
8189 @option{-O3}. If, instead, the final binary is generated with
8190 @option{-fno-lto}, then @file{myprog} is not optimized.
8192 When producing the final binary, GCC only
8193 applies link-time optimizations to those files that contain bytecode.
8194 Therefore, you can mix and match object files and libraries with
8195 GIMPLE bytecodes and final object code. GCC automatically selects
8196 which files to optimize in LTO mode and which files to link without
8199 There are some code generation flags preserved by GCC when
8200 generating bytecodes, as they need to be used during the final link
8201 stage. Generally options specified at link time override those
8202 specified at compile time.
8204 If you do not specify an optimization level option @option{-O} at
8205 link time, then GCC uses the highest optimization level
8206 used when compiling the object files.
8208 Currently, the following options and their settings are taken from
8209 the first object file that explicitly specifies them:
8210 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8211 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8212 and all the @option{-m} target flags.
8214 Certain ABI-changing flags are required to match in all compilation units,
8215 and trying to override this at link time with a conflicting value
8216 is ignored. This includes options such as @option{-freg-struct-return}
8217 and @option{-fpcc-struct-return}.
8219 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8220 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8221 are passed through to the link stage and merged conservatively for
8222 conflicting translation units. Specifically
8223 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8224 precedence; and for example @option{-ffp-contract=off} takes precedence
8225 over @option{-ffp-contract=fast}. You can override them at link time.
8227 If LTO encounters objects with C linkage declared with incompatible
8228 types in separate translation units to be linked together (undefined
8229 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8230 issued. The behavior is still undefined at run time. Similar
8231 diagnostics may be raised for other languages.
8233 Another feature of LTO is that it is possible to apply interprocedural
8234 optimizations on files written in different languages:
8239 gfortran -c -flto baz.f90
8240 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8243 Notice that the final link is done with @command{g++} to get the C++
8244 runtime libraries and @option{-lgfortran} is added to get the Fortran
8245 runtime libraries. In general, when mixing languages in LTO mode, you
8246 should use the same link command options as when mixing languages in a
8247 regular (non-LTO) compilation.
8249 If object files containing GIMPLE bytecode are stored in a library archive, say
8250 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8251 are using a linker with plugin support. To create static libraries suitable
8252 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8253 and @command{ranlib};
8254 to show the symbols of object files with GIMPLE bytecode, use
8255 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8256 and @command{nm} have been compiled with plugin support. At link time, use the the
8257 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8258 the LTO optimization process:
8261 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8264 With the linker plugin enabled, the linker extracts the needed
8265 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8266 to make them part of the aggregated GIMPLE image to be optimized.
8268 If you are not using a linker with plugin support and/or do not
8269 enable the linker plugin, then the objects inside @file{libfoo.a}
8270 are extracted and linked as usual, but they do not participate
8271 in the LTO optimization process. In order to make a static library suitable
8272 for both LTO optimization and usual linkage, compile its object files with
8273 @option{-flto} @option{-ffat-lto-objects}.
8275 Link-time optimizations do not require the presence of the whole program to
8276 operate. If the program does not require any symbols to be exported, it is
8277 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8278 the interprocedural optimizers to use more aggressive assumptions which may
8279 lead to improved optimization opportunities.
8280 Use of @option{-fwhole-program} is not needed when linker plugin is
8281 active (see @option{-fuse-linker-plugin}).
8283 The current implementation of LTO makes no
8284 attempt to generate bytecode that is portable between different
8285 types of hosts. The bytecode files are versioned and there is a
8286 strict version check, so bytecode files generated in one version of
8287 GCC do not work with an older or newer version of GCC.
8289 Link-time optimization does not work well with generation of debugging
8290 information. Combining @option{-flto} with
8291 @option{-g} is currently experimental and expected to produce unexpected
8294 If you specify the optional @var{n}, the optimization and code
8295 generation done at link time is executed in parallel using @var{n}
8296 parallel jobs by utilizing an installed @command{make} program. The
8297 environment variable @env{MAKE} may be used to override the program
8298 used. The default value for @var{n} is 1.
8300 You can also specify @option{-flto=jobserver} to use GNU make's
8301 job server mode to determine the number of parallel jobs. This
8302 is useful when the Makefile calling GCC is already executing in parallel.
8303 You must prepend a @samp{+} to the command recipe in the parent Makefile
8304 for this to work. This option likely only works if @env{MAKE} is
8307 @item -flto-partition=@var{alg}
8308 @opindex flto-partition
8309 Specify the partitioning algorithm used by the link-time optimizer.
8310 The value is either @samp{1to1} to specify a partitioning mirroring
8311 the original source files or @samp{balanced} to specify partitioning
8312 into equally sized chunks (whenever possible) or @samp{max} to create
8313 new partition for every symbol where possible. Specifying @samp{none}
8314 as an algorithm disables partitioning and streaming completely.
8315 The default value is @samp{balanced}. While @samp{1to1} can be used
8316 as an workaround for various code ordering issues, the @samp{max}
8317 partitioning is intended for internal testing only.
8318 The value @samp{one} specifies that exactly one partition should be
8319 used while the value @samp{none} bypasses partitioning and executes
8320 the link-time optimization step directly from the WPA phase.
8322 @item -flto-odr-type-merging
8323 @opindex flto-odr-type-merging
8324 Enable streaming of mangled types names of C++ types and their unification
8325 at link time. This increases size of LTO object files, but enables
8326 diagnostics about One Definition Rule violations.
8328 @item -flto-compression-level=@var{n}
8329 @opindex flto-compression-level
8330 This option specifies the level of compression used for intermediate
8331 language written to LTO object files, and is only meaningful in
8332 conjunction with LTO mode (@option{-flto}). Valid
8333 values are 0 (no compression) to 9 (maximum compression). Values
8334 outside this range are clamped to either 0 or 9. If the option is not
8335 given, a default balanced compression setting is used.
8337 @item -fuse-linker-plugin
8338 @opindex fuse-linker-plugin
8339 Enables the use of a linker plugin during link-time optimization. This
8340 option relies on plugin support in the linker, which is available in gold
8341 or in GNU ld 2.21 or newer.
8343 This option enables the extraction of object files with GIMPLE bytecode out
8344 of library archives. This improves the quality of optimization by exposing
8345 more code to the link-time optimizer. This information specifies what
8346 symbols can be accessed externally (by non-LTO object or during dynamic
8347 linking). Resulting code quality improvements on binaries (and shared
8348 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
8349 See @option{-flto} for a description of the effect of this flag and how to
8352 This option is enabled by default when LTO support in GCC is enabled
8353 and GCC was configured for use with
8354 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8356 @item -ffat-lto-objects
8357 @opindex ffat-lto-objects
8358 Fat LTO objects are object files that contain both the intermediate language
8359 and the object code. This makes them usable for both LTO linking and normal
8360 linking. This option is effective only when compiling with @option{-flto}
8361 and is ignored at link time.
8363 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8364 requires the complete toolchain to be aware of LTO. It requires a linker with
8365 linker plugin support for basic functionality. Additionally,
8366 @command{nm}, @command{ar} and @command{ranlib}
8367 need to support linker plugins to allow a full-featured build environment
8368 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
8369 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8370 to these tools. With non fat LTO makefiles need to be modified to use them.
8372 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
8375 @item -fcompare-elim
8376 @opindex fcompare-elim
8377 After register allocation and post-register allocation instruction splitting,
8378 identify arithmetic instructions that compute processor flags similar to a
8379 comparison operation based on that arithmetic. If possible, eliminate the
8380 explicit comparison operation.
8382 This pass only applies to certain targets that cannot explicitly represent
8383 the comparison operation before register allocation is complete.
8385 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8387 @item -fcprop-registers
8388 @opindex fcprop-registers
8389 After register allocation and post-register allocation instruction splitting,
8390 perform a copy-propagation pass to try to reduce scheduling dependencies
8391 and occasionally eliminate the copy.
8393 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8395 @item -fprofile-correction
8396 @opindex fprofile-correction
8397 Profiles collected using an instrumented binary for multi-threaded programs may
8398 be inconsistent due to missed counter updates. When this option is specified,
8399 GCC uses heuristics to correct or smooth out such inconsistencies. By
8400 default, GCC emits an error message when an inconsistent profile is detected.
8403 @itemx -fprofile-use=@var{path}
8404 @opindex fprofile-use
8405 Enable profile feedback-directed optimizations,
8406 and the following optimizations
8407 which are generally profitable only with profile feedback available:
8408 @option{-fbranch-probabilities}, @option{-fvpt},
8409 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8410 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
8412 Before you can use this option, you must first generate profiling information.
8413 @xref{Optimize Options}, for information about the @option{-fprofile-generate}
8416 By default, GCC emits an error message if the feedback profiles do not
8417 match the source code. This error can be turned into a warning by using
8418 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8421 If @var{path} is specified, GCC looks at the @var{path} to find
8422 the profile feedback data files. See @option{-fprofile-dir}.
8424 @item -fauto-profile
8425 @itemx -fauto-profile=@var{path}
8426 @opindex fauto-profile
8427 Enable sampling-based feedback-directed optimizations,
8428 and the following optimizations
8429 which are generally profitable only with profile feedback available:
8430 @option{-fbranch-probabilities}, @option{-fvpt},
8431 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8432 @option{-ftree-vectorize},
8433 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
8434 @option{-fpredictive-commoning}, @option{-funswitch-loops},
8435 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
8437 @var{path} is the name of a file containing AutoFDO profile information.
8438 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
8440 Producing an AutoFDO profile data file requires running your program
8441 with the @command{perf} utility on a supported GNU/Linux target system.
8442 For more information, see @uref{https://perf.wiki.kernel.org/}.
8446 perf record -e br_inst_retired:near_taken -b -o perf.data \
8450 Then use the @command{create_gcov} tool to convert the raw profile data
8451 to a format that can be used by GCC.@ You must also supply the
8452 unstripped binary for your program to this tool.
8453 See @uref{https://github.com/google/autofdo}.
8457 create_gcov --binary=your_program.unstripped --profile=perf.data \
8462 The following options control compiler behavior regarding floating-point
8463 arithmetic. These options trade off between speed and
8464 correctness. All must be specifically enabled.
8468 @opindex ffloat-store
8469 Do not store floating-point variables in registers, and inhibit other
8470 options that might change whether a floating-point value is taken from a
8473 @cindex floating-point precision
8474 This option prevents undesirable excess precision on machines such as
8475 the 68000 where the floating registers (of the 68881) keep more
8476 precision than a @code{double} is supposed to have. Similarly for the
8477 x86 architecture. For most programs, the excess precision does only
8478 good, but a few programs rely on the precise definition of IEEE floating
8479 point. Use @option{-ffloat-store} for such programs, after modifying
8480 them to store all pertinent intermediate computations into variables.
8482 @item -fexcess-precision=@var{style}
8483 @opindex fexcess-precision
8484 This option allows further control over excess precision on machines
8485 where floating-point registers have more precision than the IEEE
8486 @code{float} and @code{double} types and the processor does not
8487 support operations rounding to those types. By default,
8488 @option{-fexcess-precision=fast} is in effect; this means that
8489 operations are carried out in the precision of the registers and that
8490 it is unpredictable when rounding to the types specified in the source
8491 code takes place. When compiling C, if
8492 @option{-fexcess-precision=standard} is specified then excess
8493 precision follows the rules specified in ISO C99; in particular,
8494 both casts and assignments cause values to be rounded to their
8495 semantic types (whereas @option{-ffloat-store} only affects
8496 assignments). This option is enabled by default for C if a strict
8497 conformance option such as @option{-std=c99} is used.
8500 @option{-fexcess-precision=standard} is not implemented for languages
8501 other than C, and has no effect if
8502 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8503 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8504 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8505 semantics apply without excess precision, and in the latter, rounding
8510 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8511 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8512 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8514 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8516 This option is not turned on by any @option{-O} option besides
8517 @option{-Ofast} since it can result in incorrect output for programs
8518 that depend on an exact implementation of IEEE or ISO rules/specifications
8519 for math functions. It may, however, yield faster code for programs
8520 that do not require the guarantees of these specifications.
8522 @item -fno-math-errno
8523 @opindex fno-math-errno
8524 Do not set @code{errno} after calling math functions that are executed
8525 with a single instruction, e.g., @code{sqrt}. A program that relies on
8526 IEEE exceptions for math error handling may want to use this flag
8527 for speed while maintaining IEEE arithmetic compatibility.
8529 This option is not turned on by any @option{-O} option since
8530 it can result in incorrect output for programs that depend on
8531 an exact implementation of IEEE or ISO rules/specifications for
8532 math functions. It may, however, yield faster code for programs
8533 that do not require the guarantees of these specifications.
8535 The default is @option{-fmath-errno}.
8537 On Darwin systems, the math library never sets @code{errno}. There is
8538 therefore no reason for the compiler to consider the possibility that
8539 it might, and @option{-fno-math-errno} is the default.
8541 @item -funsafe-math-optimizations
8542 @opindex funsafe-math-optimizations
8544 Allow optimizations for floating-point arithmetic that (a) assume
8545 that arguments and results are valid and (b) may violate IEEE or
8546 ANSI standards. When used at link time, it may include libraries
8547 or startup files that change the default FPU control word or other
8548 similar optimizations.
8550 This option is not turned on by any @option{-O} option since
8551 it can result in incorrect output for programs that depend on
8552 an exact implementation of IEEE or ISO rules/specifications for
8553 math functions. It may, however, yield faster code for programs
8554 that do not require the guarantees of these specifications.
8555 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
8556 @option{-fassociative-math} and @option{-freciprocal-math}.
8558 The default is @option{-fno-unsafe-math-optimizations}.
8560 @item -fassociative-math
8561 @opindex fassociative-math
8563 Allow re-association of operands in series of floating-point operations.
8564 This violates the ISO C and C++ language standard by possibly changing
8565 computation result. NOTE: re-ordering may change the sign of zero as
8566 well as ignore NaNs and inhibit or create underflow or overflow (and
8567 thus cannot be used on code that relies on rounding behavior like
8568 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
8569 and thus may not be used when ordered comparisons are required.
8570 This option requires that both @option{-fno-signed-zeros} and
8571 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
8572 much sense with @option{-frounding-math}. For Fortran the option
8573 is automatically enabled when both @option{-fno-signed-zeros} and
8574 @option{-fno-trapping-math} are in effect.
8576 The default is @option{-fno-associative-math}.
8578 @item -freciprocal-math
8579 @opindex freciprocal-math
8581 Allow the reciprocal of a value to be used instead of dividing by
8582 the value if this enables optimizations. For example @code{x / y}
8583 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
8584 is subject to common subexpression elimination. Note that this loses
8585 precision and increases the number of flops operating on the value.
8587 The default is @option{-fno-reciprocal-math}.
8589 @item -ffinite-math-only
8590 @opindex ffinite-math-only
8591 Allow optimizations for floating-point arithmetic that assume
8592 that arguments and results are not NaNs or +-Infs.
8594 This option is not turned on by any @option{-O} option since
8595 it can result in incorrect output for programs that depend on
8596 an exact implementation of IEEE or ISO rules/specifications for
8597 math functions. It may, however, yield faster code for programs
8598 that do not require the guarantees of these specifications.
8600 The default is @option{-fno-finite-math-only}.
8602 @item -fno-signed-zeros
8603 @opindex fno-signed-zeros
8604 Allow optimizations for floating-point arithmetic that ignore the
8605 signedness of zero. IEEE arithmetic specifies the behavior of
8606 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
8607 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
8608 This option implies that the sign of a zero result isn't significant.
8610 The default is @option{-fsigned-zeros}.
8612 @item -fno-trapping-math
8613 @opindex fno-trapping-math
8614 Compile code assuming that floating-point operations cannot generate
8615 user-visible traps. These traps include division by zero, overflow,
8616 underflow, inexact result and invalid operation. This option requires
8617 that @option{-fno-signaling-nans} be in effect. Setting this option may
8618 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
8620 This option should never be turned on by any @option{-O} option since
8621 it can result in incorrect output for programs that depend on
8622 an exact implementation of IEEE or ISO rules/specifications for
8625 The default is @option{-ftrapping-math}.
8627 @item -frounding-math
8628 @opindex frounding-math
8629 Disable transformations and optimizations that assume default floating-point
8630 rounding behavior. This is round-to-zero for all floating point
8631 to integer conversions, and round-to-nearest for all other arithmetic
8632 truncations. This option should be specified for programs that change
8633 the FP rounding mode dynamically, or that may be executed with a
8634 non-default rounding mode. This option disables constant folding of
8635 floating-point expressions at compile time (which may be affected by
8636 rounding mode) and arithmetic transformations that are unsafe in the
8637 presence of sign-dependent rounding modes.
8639 The default is @option{-fno-rounding-math}.
8641 This option is experimental and does not currently guarantee to
8642 disable all GCC optimizations that are affected by rounding mode.
8643 Future versions of GCC may provide finer control of this setting
8644 using C99's @code{FENV_ACCESS} pragma. This command-line option
8645 will be used to specify the default state for @code{FENV_ACCESS}.
8647 @item -fsignaling-nans
8648 @opindex fsignaling-nans
8649 Compile code assuming that IEEE signaling NaNs may generate user-visible
8650 traps during floating-point operations. Setting this option disables
8651 optimizations that may change the number of exceptions visible with
8652 signaling NaNs. This option implies @option{-ftrapping-math}.
8654 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
8657 The default is @option{-fno-signaling-nans}.
8659 This option is experimental and does not currently guarantee to
8660 disable all GCC optimizations that affect signaling NaN behavior.
8662 @item -fno-fp-int-builtin-inexact
8663 @opindex fno-fp-int-builtin-inexact
8664 Do not allow the built-in functions @code{ceil}, @code{floor},
8665 @code{round} and @code{trunc}, and their @code{float} and @code{long
8666 double} variants, to generate code that raises the ``inexact''
8667 floating-point exception for noninteger arguments. ISO C99 and C11
8668 allow these functions to raise the ``inexact'' exception, but ISO/IEC
8669 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
8672 The default is @option{-ffp-int-builtin-inexact}, allowing the
8673 exception to be raised. This option does nothing unless
8674 @option{-ftrapping-math} is in effect.
8676 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
8677 generate a call to a library function then the ``inexact'' exception
8678 may be raised if the library implementation does not follow TS 18661.
8680 @item -fsingle-precision-constant
8681 @opindex fsingle-precision-constant
8682 Treat floating-point constants as single precision instead of
8683 implicitly converting them to double-precision constants.
8685 @item -fcx-limited-range
8686 @opindex fcx-limited-range
8687 When enabled, this option states that a range reduction step is not
8688 needed when performing complex division. Also, there is no checking
8689 whether the result of a complex multiplication or division is @code{NaN
8690 + I*NaN}, with an attempt to rescue the situation in that case. The
8691 default is @option{-fno-cx-limited-range}, but is enabled by
8692 @option{-ffast-math}.
8694 This option controls the default setting of the ISO C99
8695 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
8698 @item -fcx-fortran-rules
8699 @opindex fcx-fortran-rules
8700 Complex multiplication and division follow Fortran rules. Range
8701 reduction is done as part of complex division, but there is no checking
8702 whether the result of a complex multiplication or division is @code{NaN
8703 + I*NaN}, with an attempt to rescue the situation in that case.
8705 The default is @option{-fno-cx-fortran-rules}.
8709 The following options control optimizations that may improve
8710 performance, but are not enabled by any @option{-O} options. This
8711 section includes experimental options that may produce broken code.
8714 @item -fbranch-probabilities
8715 @opindex fbranch-probabilities
8716 After running a program compiled with @option{-fprofile-arcs}
8717 (@pxref{Instrumentation Options}),
8718 you can compile it a second time using
8719 @option{-fbranch-probabilities}, to improve optimizations based on
8720 the number of times each branch was taken. When a program
8721 compiled with @option{-fprofile-arcs} exits, it saves arc execution
8722 counts to a file called @file{@var{sourcename}.gcda} for each source
8723 file. The information in this data file is very dependent on the
8724 structure of the generated code, so you must use the same source code
8725 and the same optimization options for both compilations.
8727 With @option{-fbranch-probabilities}, GCC puts a
8728 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8729 These can be used to improve optimization. Currently, they are only
8730 used in one place: in @file{reorg.c}, instead of guessing which path a
8731 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8732 exactly determine which path is taken more often.
8734 @item -fprofile-values
8735 @opindex fprofile-values
8736 If combined with @option{-fprofile-arcs}, it adds code so that some
8737 data about values of expressions in the program is gathered.
8739 With @option{-fbranch-probabilities}, it reads back the data gathered
8740 from profiling values of expressions for usage in optimizations.
8742 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8744 @item -fprofile-reorder-functions
8745 @opindex fprofile-reorder-functions
8746 Function reordering based on profile instrumentation collects
8747 first time of execution of a function and orders these functions
8750 Enabled with @option{-fprofile-use}.
8754 If combined with @option{-fprofile-arcs}, this option instructs the compiler
8755 to add code to gather information about values of expressions.
8757 With @option{-fbranch-probabilities}, it reads back the data gathered
8758 and actually performs the optimizations based on them.
8759 Currently the optimizations include specialization of division operations
8760 using the knowledge about the value of the denominator.
8762 @item -frename-registers
8763 @opindex frename-registers
8764 Attempt to avoid false dependencies in scheduled code by making use
8765 of registers left over after register allocation. This optimization
8766 most benefits processors with lots of registers. Depending on the
8767 debug information format adopted by the target, however, it can
8768 make debugging impossible, since variables no longer stay in
8769 a ``home register''.
8771 Enabled by default with @option{-funroll-loops}.
8773 @item -fschedule-fusion
8774 @opindex fschedule-fusion
8775 Performs a target dependent pass over the instruction stream to schedule
8776 instructions of same type together because target machine can execute them
8777 more efficiently if they are adjacent to each other in the instruction flow.
8779 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8783 Perform tail duplication to enlarge superblock size. This transformation
8784 simplifies the control flow of the function allowing other optimizations to do
8787 Enabled with @option{-fprofile-use}.
8789 @item -funroll-loops
8790 @opindex funroll-loops
8791 Unroll loops whose number of iterations can be determined at compile time or
8792 upon entry to the loop. @option{-funroll-loops} implies
8793 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
8794 It also turns on complete loop peeling (i.e.@: complete removal of loops with
8795 a small constant number of iterations). This option makes code larger, and may
8796 or may not make it run faster.
8798 Enabled with @option{-fprofile-use}.
8800 @item -funroll-all-loops
8801 @opindex funroll-all-loops
8802 Unroll all loops, even if their number of iterations is uncertain when
8803 the loop is entered. This usually makes programs run more slowly.
8804 @option{-funroll-all-loops} implies the same options as
8805 @option{-funroll-loops}.
8808 @opindex fpeel-loops
8809 Peels loops for which there is enough information that they do not
8810 roll much (from profile feedback or static analysis). It also turns on
8811 complete loop peeling (i.e.@: complete removal of loops with small constant
8812 number of iterations).
8814 Enabled with @option{-O3} and/or @option{-fprofile-use}.
8816 @item -fmove-loop-invariants
8817 @opindex fmove-loop-invariants
8818 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
8819 at level @option{-O1}
8821 @item -funswitch-loops
8822 @opindex funswitch-loops
8823 Move branches with loop invariant conditions out of the loop, with duplicates
8824 of the loop on both branches (modified according to result of the condition).
8826 @item -ffunction-sections
8827 @itemx -fdata-sections
8828 @opindex ffunction-sections
8829 @opindex fdata-sections
8830 Place each function or data item into its own section in the output
8831 file if the target supports arbitrary sections. The name of the
8832 function or the name of the data item determines the section's name
8835 Use these options on systems where the linker can perform optimizations
8836 to improve locality of reference in the instruction space. Most systems
8837 using the ELF object format and SPARC processors running Solaris 2 have
8838 linkers with such optimizations. AIX may have these optimizations in
8841 Only use these options when there are significant benefits from doing
8842 so. When you specify these options, the assembler and linker
8843 create larger object and executable files and are also slower.
8844 You cannot use @command{gprof} on all systems if you
8845 specify this option, and you may have problems with debugging if
8846 you specify both this option and @option{-g}.
8848 @item -fbranch-target-load-optimize
8849 @opindex fbranch-target-load-optimize
8850 Perform branch target register load optimization before prologue / epilogue
8852 The use of target registers can typically be exposed only during reload,
8853 thus hoisting loads out of loops and doing inter-block scheduling needs
8854 a separate optimization pass.
8856 @item -fbranch-target-load-optimize2
8857 @opindex fbranch-target-load-optimize2
8858 Perform branch target register load optimization after prologue / epilogue
8861 @item -fbtr-bb-exclusive
8862 @opindex fbtr-bb-exclusive
8863 When performing branch target register load optimization, don't reuse
8864 branch target registers within any basic block.
8867 @opindex fstdarg-opt
8868 Optimize the prologue of variadic argument functions with respect to usage of
8871 @item -fsection-anchors
8872 @opindex fsection-anchors
8873 Try to reduce the number of symbolic address calculations by using
8874 shared ``anchor'' symbols to address nearby objects. This transformation
8875 can help to reduce the number of GOT entries and GOT accesses on some
8878 For example, the implementation of the following function @code{foo}:
8882 int foo (void) @{ return a + b + c; @}
8886 usually calculates the addresses of all three variables, but if you
8887 compile it with @option{-fsection-anchors}, it accesses the variables
8888 from a common anchor point instead. The effect is similar to the
8889 following pseudocode (which isn't valid C):
8894 register int *xr = &x;
8895 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8899 Not all targets support this option.
8901 @item --param @var{name}=@var{value}
8903 In some places, GCC uses various constants to control the amount of
8904 optimization that is done. For example, GCC does not inline functions
8905 that contain more than a certain number of instructions. You can
8906 control some of these constants on the command line using the
8907 @option{--param} option.
8909 The names of specific parameters, and the meaning of the values, are
8910 tied to the internals of the compiler, and are subject to change
8911 without notice in future releases.
8913 In each case, the @var{value} is an integer. The allowable choices for
8917 @item predictable-branch-outcome
8918 When branch is predicted to be taken with probability lower than this threshold
8919 (in percent), then it is considered well predictable. The default is 10.
8921 @item max-rtl-if-conversion-insns
8922 RTL if-conversion tries to remove conditional branches around a block and
8923 replace them with conditionally executed instructions. This parameter
8924 gives the maximum number of instructions in a block which should be
8925 considered for if-conversion. The default is 10, though the compiler will
8926 also use other heuristics to decide whether if-conversion is likely to be
8929 @item max-rtl-if-conversion-predictable-cost
8930 @item max-rtl-if-conversion-unpredictable-cost
8931 RTL if-conversion will try to remove conditional branches around a block
8932 and replace them with conditionally executed instructions. These parameters
8933 give the maximum permissible cost for the sequence that would be generated
8934 by if-conversion depending on whether the branch is statically determined
8935 to be predictable or not. The units for this parameter are the same as
8936 those for the GCC internal seq_cost metric. The compiler will try to
8937 provide a reasonable default for this parameter using the BRANCH_COST
8940 @item max-crossjump-edges
8941 The maximum number of incoming edges to consider for cross-jumping.
8942 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
8943 the number of edges incoming to each block. Increasing values mean
8944 more aggressive optimization, making the compilation time increase with
8945 probably small improvement in executable size.
8947 @item min-crossjump-insns
8948 The minimum number of instructions that must be matched at the end
8949 of two blocks before cross-jumping is performed on them. This
8950 value is ignored in the case where all instructions in the block being
8951 cross-jumped from are matched. The default value is 5.
8953 @item max-grow-copy-bb-insns
8954 The maximum code size expansion factor when copying basic blocks
8955 instead of jumping. The expansion is relative to a jump instruction.
8956 The default value is 8.
8958 @item max-goto-duplication-insns
8959 The maximum number of instructions to duplicate to a block that jumps
8960 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
8961 passes, GCC factors computed gotos early in the compilation process,
8962 and unfactors them as late as possible. Only computed jumps at the
8963 end of a basic blocks with no more than max-goto-duplication-insns are
8964 unfactored. The default value is 8.
8966 @item max-delay-slot-insn-search
8967 The maximum number of instructions to consider when looking for an
8968 instruction to fill a delay slot. If more than this arbitrary number of
8969 instructions are searched, the time savings from filling the delay slot
8970 are minimal, so stop searching. Increasing values mean more
8971 aggressive optimization, making the compilation time increase with probably
8972 small improvement in execution time.
8974 @item max-delay-slot-live-search
8975 When trying to fill delay slots, the maximum number of instructions to
8976 consider when searching for a block with valid live register
8977 information. Increasing this arbitrarily chosen value means more
8978 aggressive optimization, increasing the compilation time. This parameter
8979 should be removed when the delay slot code is rewritten to maintain the
8982 @item max-gcse-memory
8983 The approximate maximum amount of memory that can be allocated in
8984 order to perform the global common subexpression elimination
8985 optimization. If more memory than specified is required, the
8986 optimization is not done.
8988 @item max-gcse-insertion-ratio
8989 If the ratio of expression insertions to deletions is larger than this value
8990 for any expression, then RTL PRE inserts or removes the expression and thus
8991 leaves partially redundant computations in the instruction stream. The default value is 20.
8993 @item max-pending-list-length
8994 The maximum number of pending dependencies scheduling allows
8995 before flushing the current state and starting over. Large functions
8996 with few branches or calls can create excessively large lists which
8997 needlessly consume memory and resources.
8999 @item max-modulo-backtrack-attempts
9000 The maximum number of backtrack attempts the scheduler should make
9001 when modulo scheduling a loop. Larger values can exponentially increase
9004 @item max-inline-insns-single
9005 Several parameters control the tree inliner used in GCC@.
9006 This number sets the maximum number of instructions (counted in GCC's
9007 internal representation) in a single function that the tree inliner
9008 considers for inlining. This only affects functions declared
9009 inline and methods implemented in a class declaration (C++).
9010 The default value is 400.
9012 @item max-inline-insns-auto
9013 When you use @option{-finline-functions} (included in @option{-O3}),
9014 a lot of functions that would otherwise not be considered for inlining
9015 by the compiler are investigated. To those functions, a different
9016 (more restrictive) limit compared to functions declared inline can
9018 The default value is 40.
9020 @item inline-min-speedup
9021 When estimated performance improvement of caller + callee runtime exceeds this
9022 threshold (in precent), the function can be inlined regardless the limit on
9023 @option{--param max-inline-insns-single} and @option{--param
9024 max-inline-insns-auto}.
9026 @item large-function-insns
9027 The limit specifying really large functions. For functions larger than this
9028 limit after inlining, inlining is constrained by
9029 @option{--param large-function-growth}. This parameter is useful primarily
9030 to avoid extreme compilation time caused by non-linear algorithms used by the
9032 The default value is 2700.
9034 @item large-function-growth
9035 Specifies maximal growth of large function caused by inlining in percents.
9036 The default value is 100 which limits large function growth to 2.0 times
9039 @item large-unit-insns
9040 The limit specifying large translation unit. Growth caused by inlining of
9041 units larger than this limit is limited by @option{--param inline-unit-growth}.
9042 For small units this might be too tight.
9043 For example, consider a unit consisting of function A
9044 that is inline and B that just calls A three times. If B is small relative to
9045 A, the growth of unit is 300\% and yet such inlining is very sane. For very
9046 large units consisting of small inlineable functions, however, the overall unit
9047 growth limit is needed to avoid exponential explosion of code size. Thus for
9048 smaller units, the size is increased to @option{--param large-unit-insns}
9049 before applying @option{--param inline-unit-growth}. The default is 10000.
9051 @item inline-unit-growth
9052 Specifies maximal overall growth of the compilation unit caused by inlining.
9053 The default value is 20 which limits unit growth to 1.2 times the original
9054 size. Cold functions (either marked cold via an attribute or by profile
9055 feedback) are not accounted into the unit size.
9057 @item ipcp-unit-growth
9058 Specifies maximal overall growth of the compilation unit caused by
9059 interprocedural constant propagation. The default value is 10 which limits
9060 unit growth to 1.1 times the original size.
9062 @item large-stack-frame
9063 The limit specifying large stack frames. While inlining the algorithm is trying
9064 to not grow past this limit too much. The default value is 256 bytes.
9066 @item large-stack-frame-growth
9067 Specifies maximal growth of large stack frames caused by inlining in percents.
9068 The default value is 1000 which limits large stack frame growth to 11 times
9071 @item max-inline-insns-recursive
9072 @itemx max-inline-insns-recursive-auto
9073 Specifies the maximum number of instructions an out-of-line copy of a
9074 self-recursive inline
9075 function can grow into by performing recursive inlining.
9077 @option{--param max-inline-insns-recursive} applies to functions
9079 For functions not declared inline, recursive inlining
9080 happens only when @option{-finline-functions} (included in @option{-O3}) is
9081 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
9082 default value is 450.
9084 @item max-inline-recursive-depth
9085 @itemx max-inline-recursive-depth-auto
9086 Specifies the maximum recursion depth used for recursive inlining.
9088 @option{--param max-inline-recursive-depth} applies to functions
9089 declared inline. For functions not declared inline, recursive inlining
9090 happens only when @option{-finline-functions} (included in @option{-O3}) is
9091 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
9094 @item min-inline-recursive-probability
9095 Recursive inlining is profitable only for function having deep recursion
9096 in average and can hurt for function having little recursion depth by
9097 increasing the prologue size or complexity of function body to other
9100 When profile feedback is available (see @option{-fprofile-generate}) the actual
9101 recursion depth can be guessed from probability that function recurses via a
9102 given call expression. This parameter limits inlining only to call expressions
9103 whose probability exceeds the given threshold (in percents).
9104 The default value is 10.
9106 @item early-inlining-insns
9107 Specify growth that the early inliner can make. In effect it increases
9108 the amount of inlining for code having a large abstraction penalty.
9109 The default value is 14.
9111 @item max-early-inliner-iterations
9112 Limit of iterations of the early inliner. This basically bounds
9113 the number of nested indirect calls the early inliner can resolve.
9114 Deeper chains are still handled by late inlining.
9116 @item comdat-sharing-probability
9117 Probability (in percent) that C++ inline function with comdat visibility
9118 are shared across multiple compilation units. The default value is 20.
9120 @item profile-func-internal-id
9121 A parameter to control whether to use function internal id in profile
9122 database lookup. If the value is 0, the compiler uses an id that
9123 is based on function assembler name and filename, which makes old profile
9124 data more tolerant to source changes such as function reordering etc.
9125 The default value is 0.
9127 @item min-vect-loop-bound
9128 The minimum number of iterations under which loops are not vectorized
9129 when @option{-ftree-vectorize} is used. The number of iterations after
9130 vectorization needs to be greater than the value specified by this option
9131 to allow vectorization. The default value is 0.
9133 @item gcse-cost-distance-ratio
9134 Scaling factor in calculation of maximum distance an expression
9135 can be moved by GCSE optimizations. This is currently supported only in the
9136 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9137 is with simple expressions, i.e., the expressions that have cost
9138 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9139 hoisting of simple expressions. The default value is 10.
9141 @item gcse-unrestricted-cost
9142 Cost, roughly measured as the cost of a single typical machine
9143 instruction, at which GCSE optimizations do not constrain
9144 the distance an expression can travel. This is currently
9145 supported only in the code hoisting pass. The lesser the cost,
9146 the more aggressive code hoisting is. Specifying 0
9147 allows all expressions to travel unrestricted distances.
9148 The default value is 3.
9150 @item max-hoist-depth
9151 The depth of search in the dominator tree for expressions to hoist.
9152 This is used to avoid quadratic behavior in hoisting algorithm.
9153 The value of 0 does not limit on the search, but may slow down compilation
9154 of huge functions. The default value is 30.
9156 @item max-tail-merge-comparisons
9157 The maximum amount of similar bbs to compare a bb with. This is used to
9158 avoid quadratic behavior in tree tail merging. The default value is 10.
9160 @item max-tail-merge-iterations
9161 The maximum amount of iterations of the pass over the function. This is used to
9162 limit compilation time in tree tail merging. The default value is 2.
9164 @item max-unrolled-insns
9165 The maximum number of instructions that a loop may have to be unrolled.
9166 If a loop is unrolled, this parameter also determines how many times
9167 the loop code is unrolled.
9169 @item max-average-unrolled-insns
9170 The maximum number of instructions biased by probabilities of their execution
9171 that a loop may have to be unrolled. If a loop is unrolled,
9172 this parameter also determines how many times the loop code is unrolled.
9174 @item max-unroll-times
9175 The maximum number of unrollings of a single loop.
9177 @item max-peeled-insns
9178 The maximum number of instructions that a loop may have to be peeled.
9179 If a loop is peeled, this parameter also determines how many times
9180 the loop code is peeled.
9182 @item max-peel-times
9183 The maximum number of peelings of a single loop.
9185 @item max-peel-branches
9186 The maximum number of branches on the hot path through the peeled sequence.
9188 @item max-completely-peeled-insns
9189 The maximum number of insns of a completely peeled loop.
9191 @item max-completely-peel-times
9192 The maximum number of iterations of a loop to be suitable for complete peeling.
9194 @item max-completely-peel-loop-nest-depth
9195 The maximum depth of a loop nest suitable for complete peeling.
9197 @item max-unswitch-insns
9198 The maximum number of insns of an unswitched loop.
9200 @item max-unswitch-level
9201 The maximum number of branches unswitched in a single loop.
9203 @item max-loop-headers-insns
9204 The maximum number of insns in loop header duplicated by he copy loop headers
9208 The minimum cost of an expensive expression in the loop invariant motion.
9210 @item iv-consider-all-candidates-bound
9211 Bound on number of candidates for induction variables, below which
9212 all candidates are considered for each use in induction variable
9213 optimizations. If there are more candidates than this,
9214 only the most relevant ones are considered to avoid quadratic time complexity.
9216 @item iv-max-considered-uses
9217 The induction variable optimizations give up on loops that contain more
9218 induction variable uses.
9220 @item iv-always-prune-cand-set-bound
9221 If the number of candidates in the set is smaller than this value,
9222 always try to remove unnecessary ivs from the set
9223 when adding a new one.
9225 @item avg-loop-niter
9226 Average number of iterations of a loop.
9228 @item scev-max-expr-size
9229 Bound on size of expressions used in the scalar evolutions analyzer.
9230 Large expressions slow the analyzer.
9232 @item scev-max-expr-complexity
9233 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9234 Complex expressions slow the analyzer.
9236 @item max-tree-if-conversion-phi-args
9237 Maximum number of arguments in a PHI supported by TREE if conversion
9238 unless the loop is marked with simd pragma.
9240 @item vect-max-version-for-alignment-checks
9241 The maximum number of run-time checks that can be performed when
9242 doing loop versioning for alignment in the vectorizer.
9244 @item vect-max-version-for-alias-checks
9245 The maximum number of run-time checks that can be performed when
9246 doing loop versioning for alias in the vectorizer.
9248 @item vect-max-peeling-for-alignment
9249 The maximum number of loop peels to enhance access alignment
9250 for vectorizer. Value -1 means no limit.
9252 @item max-iterations-to-track
9253 The maximum number of iterations of a loop the brute-force algorithm
9254 for analysis of the number of iterations of the loop tries to evaluate.
9256 @item hot-bb-count-ws-permille
9257 A basic block profile count is considered hot if it contributes to
9258 the given permillage (i.e. 0...1000) of the entire profiled execution.
9260 @item hot-bb-frequency-fraction
9261 Select fraction of the entry block frequency of executions of basic block in
9262 function given basic block needs to have to be considered hot.
9264 @item max-predicted-iterations
9265 The maximum number of loop iterations we predict statically. This is useful
9266 in cases where a function contains a single loop with known bound and
9267 another loop with unknown bound.
9268 The known number of iterations is predicted correctly, while
9269 the unknown number of iterations average to roughly 10. This means that the
9270 loop without bounds appears artificially cold relative to the other one.
9272 @item builtin-expect-probability
9273 Control the probability of the expression having the specified value. This
9274 parameter takes a percentage (i.e. 0 ... 100) as input.
9275 The default probability of 90 is obtained empirically.
9277 @item align-threshold
9279 Select fraction of the maximal frequency of executions of a basic block in
9280 a function to align the basic block.
9282 @item align-loop-iterations
9284 A loop expected to iterate at least the selected number of iterations is
9287 @item tracer-dynamic-coverage
9288 @itemx tracer-dynamic-coverage-feedback
9290 This value is used to limit superblock formation once the given percentage of
9291 executed instructions is covered. This limits unnecessary code size
9294 The @option{tracer-dynamic-coverage-feedback} parameter
9295 is used only when profile
9296 feedback is available. The real profiles (as opposed to statically estimated
9297 ones) are much less balanced allowing the threshold to be larger value.
9299 @item tracer-max-code-growth
9300 Stop tail duplication once code growth has reached given percentage. This is
9301 a rather artificial limit, as most of the duplicates are eliminated later in
9302 cross jumping, so it may be set to much higher values than is the desired code
9305 @item tracer-min-branch-ratio
9307 Stop reverse growth when the reverse probability of best edge is less than this
9308 threshold (in percent).
9310 @item tracer-min-branch-probability
9311 @itemx tracer-min-branch-probability-feedback
9313 Stop forward growth if the best edge has probability lower than this
9316 Similarly to @option{tracer-dynamic-coverage} two parameters are
9317 provided. @option{tracer-min-branch-probability-feedback} is used for
9318 compilation with profile feedback and @option{tracer-min-branch-probability}
9319 compilation without. The value for compilation with profile feedback
9320 needs to be more conservative (higher) in order to make tracer
9323 @item max-cse-path-length
9325 The maximum number of basic blocks on path that CSE considers.
9329 The maximum number of instructions CSE processes before flushing.
9330 The default is 1000.
9332 @item ggc-min-expand
9334 GCC uses a garbage collector to manage its own memory allocation. This
9335 parameter specifies the minimum percentage by which the garbage
9336 collector's heap should be allowed to expand between collections.
9337 Tuning this may improve compilation speed; it has no effect on code
9340 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9341 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9342 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9343 GCC is not able to calculate RAM on a particular platform, the lower
9344 bound of 30% is used. Setting this parameter and
9345 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9346 every opportunity. This is extremely slow, but can be useful for
9349 @item ggc-min-heapsize
9351 Minimum size of the garbage collector's heap before it begins bothering
9352 to collect garbage. The first collection occurs after the heap expands
9353 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9354 tuning this may improve compilation speed, and has no effect on code
9357 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9358 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9359 with a lower bound of 4096 (four megabytes) and an upper bound of
9360 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9361 particular platform, the lower bound is used. Setting this parameter
9362 very large effectively disables garbage collection. Setting this
9363 parameter and @option{ggc-min-expand} to zero causes a full collection
9364 to occur at every opportunity.
9366 @item max-reload-search-insns
9367 The maximum number of instruction reload should look backward for equivalent
9368 register. Increasing values mean more aggressive optimization, making the
9369 compilation time increase with probably slightly better performance.
9370 The default value is 100.
9372 @item max-cselib-memory-locations
9373 The maximum number of memory locations cselib should take into account.
9374 Increasing values mean more aggressive optimization, making the compilation time
9375 increase with probably slightly better performance. The default value is 500.
9377 @item max-sched-ready-insns
9378 The maximum number of instructions ready to be issued the scheduler should
9379 consider at any given time during the first scheduling pass. Increasing
9380 values mean more thorough searches, making the compilation time increase
9381 with probably little benefit. The default value is 100.
9383 @item max-sched-region-blocks
9384 The maximum number of blocks in a region to be considered for
9385 interblock scheduling. The default value is 10.
9387 @item max-pipeline-region-blocks
9388 The maximum number of blocks in a region to be considered for
9389 pipelining in the selective scheduler. The default value is 15.
9391 @item max-sched-region-insns
9392 The maximum number of insns in a region to be considered for
9393 interblock scheduling. The default value is 100.
9395 @item max-pipeline-region-insns
9396 The maximum number of insns in a region to be considered for
9397 pipelining in the selective scheduler. The default value is 200.
9400 The minimum probability (in percents) of reaching a source block
9401 for interblock speculative scheduling. The default value is 40.
9403 @item max-sched-extend-regions-iters
9404 The maximum number of iterations through CFG to extend regions.
9405 A value of 0 (the default) disables region extensions.
9407 @item max-sched-insn-conflict-delay
9408 The maximum conflict delay for an insn to be considered for speculative motion.
9409 The default value is 3.
9411 @item sched-spec-prob-cutoff
9412 The minimal probability of speculation success (in percents), so that
9413 speculative insns are scheduled.
9414 The default value is 40.
9416 @item sched-state-edge-prob-cutoff
9417 The minimum probability an edge must have for the scheduler to save its
9419 The default value is 10.
9421 @item sched-mem-true-dep-cost
9422 Minimal distance (in CPU cycles) between store and load targeting same
9423 memory locations. The default value is 1.
9425 @item selsched-max-lookahead
9426 The maximum size of the lookahead window of selective scheduling. It is a
9427 depth of search for available instructions.
9428 The default value is 50.
9430 @item selsched-max-sched-times
9431 The maximum number of times that an instruction is scheduled during
9432 selective scheduling. This is the limit on the number of iterations
9433 through which the instruction may be pipelined. The default value is 2.
9435 @item selsched-insns-to-rename
9436 The maximum number of best instructions in the ready list that are considered
9437 for renaming in the selective scheduler. The default value is 2.
9440 The minimum value of stage count that swing modulo scheduler
9441 generates. The default value is 2.
9443 @item max-last-value-rtl
9444 The maximum size measured as number of RTLs that can be recorded in an expression
9445 in combiner for a pseudo register as last known value of that register. The default
9448 @item max-combine-insns
9449 The maximum number of instructions the RTL combiner tries to combine.
9450 The default value is 2 at @option{-Og} and 4 otherwise.
9452 @item integer-share-limit
9453 Small integer constants can use a shared data structure, reducing the
9454 compiler's memory usage and increasing its speed. This sets the maximum
9455 value of a shared integer constant. The default value is 256.
9457 @item ssp-buffer-size
9458 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9459 protection when @option{-fstack-protection} is used.
9461 @item min-size-for-stack-sharing
9462 The minimum size of variables taking part in stack slot sharing when not
9463 optimizing. The default value is 32.
9465 @item max-jump-thread-duplication-stmts
9466 Maximum number of statements allowed in a block that needs to be
9467 duplicated when threading jumps.
9469 @item max-fields-for-field-sensitive
9470 Maximum number of fields in a structure treated in
9471 a field sensitive manner during pointer analysis. The default is zero
9472 for @option{-O0} and @option{-O1},
9473 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9475 @item prefetch-latency
9476 Estimate on average number of instructions that are executed before
9477 prefetch finishes. The distance prefetched ahead is proportional
9478 to this constant. Increasing this number may also lead to less
9479 streams being prefetched (see @option{simultaneous-prefetches}).
9481 @item simultaneous-prefetches
9482 Maximum number of prefetches that can run at the same time.
9484 @item l1-cache-line-size
9485 The size of cache line in L1 cache, in bytes.
9488 The size of L1 cache, in kilobytes.
9491 The size of L2 cache, in kilobytes.
9493 @item min-insn-to-prefetch-ratio
9494 The minimum ratio between the number of instructions and the
9495 number of prefetches to enable prefetching in a loop.
9497 @item prefetch-min-insn-to-mem-ratio
9498 The minimum ratio between the number of instructions and the
9499 number of memory references to enable prefetching in a loop.
9501 @item use-canonical-types
9502 Whether the compiler should use the ``canonical'' type system. By
9503 default, this should always be 1, which uses a more efficient internal
9504 mechanism for comparing types in C++ and Objective-C++. However, if
9505 bugs in the canonical type system are causing compilation failures,
9506 set this value to 0 to disable canonical types.
9508 @item switch-conversion-max-branch-ratio
9509 Switch initialization conversion refuses to create arrays that are
9510 bigger than @option{switch-conversion-max-branch-ratio} times the number of
9511 branches in the switch.
9513 @item max-partial-antic-length
9514 Maximum length of the partial antic set computed during the tree
9515 partial redundancy elimination optimization (@option{-ftree-pre}) when
9516 optimizing at @option{-O3} and above. For some sorts of source code
9517 the enhanced partial redundancy elimination optimization can run away,
9518 consuming all of the memory available on the host machine. This
9519 parameter sets a limit on the length of the sets that are computed,
9520 which prevents the runaway behavior. Setting a value of 0 for
9521 this parameter allows an unlimited set length.
9523 @item sccvn-max-scc-size
9524 Maximum size of a strongly connected component (SCC) during SCCVN
9525 processing. If this limit is hit, SCCVN processing for the whole
9526 function is not done and optimizations depending on it are
9527 disabled. The default maximum SCC size is 10000.
9529 @item sccvn-max-alias-queries-per-access
9530 Maximum number of alias-oracle queries we perform when looking for
9531 redundancies for loads and stores. If this limit is hit the search
9532 is aborted and the load or store is not considered redundant. The
9533 number of queries is algorithmically limited to the number of
9534 stores on all paths from the load to the function entry.
9535 The default maximum number of queries is 1000.
9537 @item ira-max-loops-num
9538 IRA uses regional register allocation by default. If a function
9539 contains more loops than the number given by this parameter, only at most
9540 the given number of the most frequently-executed loops form regions
9541 for regional register allocation. The default value of the
9544 @item ira-max-conflict-table-size
9545 Although IRA uses a sophisticated algorithm to compress the conflict
9546 table, the table can still require excessive amounts of memory for
9547 huge functions. If the conflict table for a function could be more
9548 than the size in MB given by this parameter, the register allocator
9549 instead uses a faster, simpler, and lower-quality
9550 algorithm that does not require building a pseudo-register conflict table.
9551 The default value of the parameter is 2000.
9553 @item ira-loop-reserved-regs
9554 IRA can be used to evaluate more accurate register pressure in loops
9555 for decisions to move loop invariants (see @option{-O3}). The number
9556 of available registers reserved for some other purposes is given
9557 by this parameter. The default value of the parameter is 2, which is
9558 the minimal number of registers needed by typical instructions.
9559 This value is the best found from numerous experiments.
9561 @item lra-inheritance-ebb-probability-cutoff
9562 LRA tries to reuse values reloaded in registers in subsequent insns.
9563 This optimization is called inheritance. EBB is used as a region to
9564 do this optimization. The parameter defines a minimal fall-through
9565 edge probability in percentage used to add BB to inheritance EBB in
9566 LRA. The default value of the parameter is 40. The value was chosen
9567 from numerous runs of SPEC2000 on x86-64.
9569 @item loop-invariant-max-bbs-in-loop
9570 Loop invariant motion can be very expensive, both in compilation time and
9571 in amount of needed compile-time memory, with very large loops. Loops
9572 with more basic blocks than this parameter won't have loop invariant
9573 motion optimization performed on them. The default value of the
9574 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
9576 @item loop-max-datarefs-for-datadeps
9577 Building data dependencies is expensive for very large loops. This
9578 parameter limits the number of data references in loops that are
9579 considered for data dependence analysis. These large loops are no
9580 handled by the optimizations using loop data dependencies.
9581 The default value is 1000.
9583 @item max-vartrack-size
9584 Sets a maximum number of hash table slots to use during variable
9585 tracking dataflow analysis of any function. If this limit is exceeded
9586 with variable tracking at assignments enabled, analysis for that
9587 function is retried without it, after removing all debug insns from
9588 the function. If the limit is exceeded even without debug insns, var
9589 tracking analysis is completely disabled for the function. Setting
9590 the parameter to zero makes it unlimited.
9592 @item max-vartrack-expr-depth
9593 Sets a maximum number of recursion levels when attempting to map
9594 variable names or debug temporaries to value expressions. This trades
9595 compilation time for more complete debug information. If this is set too
9596 low, value expressions that are available and could be represented in
9597 debug information may end up not being used; setting this higher may
9598 enable the compiler to find more complex debug expressions, but compile
9599 time and memory use may grow. The default is 12.
9601 @item min-nondebug-insn-uid
9602 Use uids starting at this parameter for nondebug insns. The range below
9603 the parameter is reserved exclusively for debug insns created by
9604 @option{-fvar-tracking-assignments}, but debug insns may get
9605 (non-overlapping) uids above it if the reserved range is exhausted.
9607 @item ipa-sra-ptr-growth-factor
9608 IPA-SRA replaces a pointer to an aggregate with one or more new
9609 parameters only when their cumulative size is less or equal to
9610 @option{ipa-sra-ptr-growth-factor} times the size of the original
9613 @item sra-max-scalarization-size-Ospeed
9614 @item sra-max-scalarization-size-Osize
9615 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
9616 replace scalar parts of aggregates with uses of independent scalar
9617 variables. These parameters control the maximum size, in storage units,
9618 of aggregate which is considered for replacement when compiling for
9620 (@option{sra-max-scalarization-size-Ospeed}) or size
9621 (@option{sra-max-scalarization-size-Osize}) respectively.
9623 @item tm-max-aggregate-size
9624 When making copies of thread-local variables in a transaction, this
9625 parameter specifies the size in bytes after which variables are
9626 saved with the logging functions as opposed to save/restore code
9627 sequence pairs. This option only applies when using
9630 @item graphite-max-nb-scop-params
9631 To avoid exponential effects in the Graphite loop transforms, the
9632 number of parameters in a Static Control Part (SCoP) is bounded. The
9633 default value is 10 parameters. A variable whose value is unknown at
9634 compilation time and defined outside a SCoP is a parameter of the SCoP.
9636 @item graphite-max-bbs-per-function
9637 To avoid exponential effects in the detection of SCoPs, the size of
9638 the functions analyzed by Graphite is bounded. The default value is
9641 @item loop-block-tile-size
9642 Loop blocking or strip mining transforms, enabled with
9643 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
9644 loop in the loop nest by a given number of iterations. The strip
9645 length can be changed using the @option{loop-block-tile-size}
9646 parameter. The default value is 51 iterations.
9648 @item loop-unroll-jam-size
9649 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
9652 @item loop-unroll-jam-depth
9653 Specify the dimension to be unrolled (counting from the most inner loop)
9654 for the @option{-floop-unroll-and-jam}. The default value is 2.
9656 @item ipa-cp-value-list-size
9657 IPA-CP attempts to track all possible values and types passed to a function's
9658 parameter in order to propagate them and perform devirtualization.
9659 @option{ipa-cp-value-list-size} is the maximum number of values and types it
9660 stores per one formal parameter of a function.
9662 @item ipa-cp-eval-threshold
9663 IPA-CP calculates its own score of cloning profitability heuristics
9664 and performs those cloning opportunities with scores that exceed
9665 @option{ipa-cp-eval-threshold}.
9667 @item ipa-cp-recursion-penalty
9668 Percentage penalty the recursive functions will receive when they
9669 are evaluated for cloning.
9671 @item ipa-cp-single-call-penalty
9672 Percentage penalty functions containg a single call to another
9673 function will receive when they are evaluated for cloning.
9676 @item ipa-max-agg-items
9677 IPA-CP is also capable to propagate a number of scalar values passed
9678 in an aggregate. @option{ipa-max-agg-items} controls the maximum
9679 number of such values per one parameter.
9681 @item ipa-cp-loop-hint-bonus
9682 When IPA-CP determines that a cloning candidate would make the number
9683 of iterations of a loop known, it adds a bonus of
9684 @option{ipa-cp-loop-hint-bonus} to the profitability score of
9687 @item ipa-cp-array-index-hint-bonus
9688 When IPA-CP determines that a cloning candidate would make the index of
9689 an array access known, it adds a bonus of
9690 @option{ipa-cp-array-index-hint-bonus} to the profitability
9691 score of the candidate.
9693 @item ipa-max-aa-steps
9694 During its analysis of function bodies, IPA-CP employs alias analysis
9695 in order to track values pointed to by function parameters. In order
9696 not spend too much time analyzing huge functions, it gives up and
9697 consider all memory clobbered after examining
9698 @option{ipa-max-aa-steps} statements modifying memory.
9700 @item lto-partitions
9701 Specify desired number of partitions produced during WHOPR compilation.
9702 The number of partitions should exceed the number of CPUs used for compilation.
9703 The default value is 32.
9705 @item lto-min-partition
9706 Size of minimal partition for WHOPR (in estimated instructions).
9707 This prevents expenses of splitting very small programs into too many
9710 @item lto-max-partition
9711 Size of max partition for WHOPR (in estimated instructions).
9712 to provide an upper bound for individual size of partition.
9713 Meant to be used only with balanced partitioning.
9715 @item cxx-max-namespaces-for-diagnostic-help
9716 The maximum number of namespaces to consult for suggestions when C++
9717 name lookup fails for an identifier. The default is 1000.
9719 @item sink-frequency-threshold
9720 The maximum relative execution frequency (in percents) of the target block
9721 relative to a statement's original block to allow statement sinking of a
9722 statement. Larger numbers result in more aggressive statement sinking.
9723 The default value is 75. A small positive adjustment is applied for
9724 statements with memory operands as those are even more profitable so sink.
9726 @item max-stores-to-sink
9727 The maximum number of conditional store pairs that can be sunk. Set to 0
9728 if either vectorization (@option{-ftree-vectorize}) or if-conversion
9729 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
9731 @item allow-store-data-races
9732 Allow optimizers to introduce new data races on stores.
9733 Set to 1 to allow, otherwise to 0. This option is enabled by default
9734 at optimization level @option{-Ofast}.
9736 @item case-values-threshold
9737 The smallest number of different values for which it is best to use a
9738 jump-table instead of a tree of conditional branches. If the value is
9739 0, use the default for the machine. The default is 0.
9741 @item tree-reassoc-width
9742 Set the maximum number of instructions executed in parallel in
9743 reassociated tree. This parameter overrides target dependent
9744 heuristics used by default if has non zero value.
9746 @item sched-pressure-algorithm
9747 Choose between the two available implementations of
9748 @option{-fsched-pressure}. Algorithm 1 is the original implementation
9749 and is the more likely to prevent instructions from being reordered.
9750 Algorithm 2 was designed to be a compromise between the relatively
9751 conservative approach taken by algorithm 1 and the rather aggressive
9752 approach taken by the default scheduler. It relies more heavily on
9753 having a regular register file and accurate register pressure classes.
9754 See @file{haifa-sched.c} in the GCC sources for more details.
9756 The default choice depends on the target.
9758 @item max-slsr-cand-scan
9759 Set the maximum number of existing candidates that are considered when
9760 seeking a basis for a new straight-line strength reduction candidate.
9763 Enable buffer overflow detection for global objects. This kind
9764 of protection is enabled by default if you are using
9765 @option{-fsanitize=address} option.
9766 To disable global objects protection use @option{--param asan-globals=0}.
9769 Enable buffer overflow detection for stack objects. This kind of
9770 protection is enabled by default when using @option{-fsanitize=address}.
9771 To disable stack protection use @option{--param asan-stack=0} option.
9773 @item asan-instrument-reads
9774 Enable buffer overflow detection for memory reads. This kind of
9775 protection is enabled by default when using @option{-fsanitize=address}.
9776 To disable memory reads protection use
9777 @option{--param asan-instrument-reads=0}.
9779 @item asan-instrument-writes
9780 Enable buffer overflow detection for memory writes. This kind of
9781 protection is enabled by default when using @option{-fsanitize=address}.
9782 To disable memory writes protection use
9783 @option{--param asan-instrument-writes=0} option.
9785 @item asan-memintrin
9786 Enable detection for built-in functions. This kind of protection
9787 is enabled by default when using @option{-fsanitize=address}.
9788 To disable built-in functions protection use
9789 @option{--param asan-memintrin=0}.
9791 @item asan-use-after-return
9792 Enable detection of use-after-return. This kind of protection
9793 is enabled by default when using @option{-fsanitize=address} option.
9794 To disable use-after-return detection use
9795 @option{--param asan-use-after-return=0}.
9797 @item asan-instrumentation-with-call-threshold
9798 If number of memory accesses in function being instrumented
9799 is greater or equal to this number, use callbacks instead of inline checks.
9800 E.g. to disable inline code use
9801 @option{--param asan-instrumentation-with-call-threshold=0}.
9803 @item chkp-max-ctor-size
9804 Static constructors generated by Pointer Bounds Checker may become very
9805 large and significantly increase compile time at optimization level
9806 @option{-O1} and higher. This parameter is a maximum nubmer of statements
9807 in a single generated constructor. Default value is 5000.
9809 @item max-fsm-thread-path-insns
9810 Maximum number of instructions to copy when duplicating blocks on a
9811 finite state automaton jump thread path. The default is 100.
9813 @item max-fsm-thread-length
9814 Maximum number of basic blocks on a finite state automaton jump thread
9815 path. The default is 10.
9817 @item max-fsm-thread-paths
9818 Maximum number of new jump thread paths to create for a finite state
9819 automaton. The default is 50.
9821 @item parloops-chunk-size
9822 Chunk size of omp schedule for loops parallelized by parloops. The default
9825 @item parloops-schedule
9826 Schedule type of omp schedule for loops parallelized by parloops (static,
9827 dynamic, guided, auto, runtime). The default is static.
9829 @item max-ssa-name-query-depth
9830 Maximum depth of recursion when querying properties of SSA names in things
9831 like fold routines. One level of recursion corresponds to following a
9834 @item hsa-gen-debug-stores
9835 Enable emission of special debug stores within HSA kernels which are
9836 then read and reported by libgomp plugin. Generation of these stores
9837 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
9840 @item max-speculative-devirt-maydefs
9841 The maximum number of may-defs we analyze when looking for a must-def
9842 specifying the dynamic type of an object that invokes a virtual call
9843 we may be able to devirtualize speculatively.
9845 @item max-vrp-switch-assertions
9846 The maximum number of assertions to add along the default edge of a switch
9847 statement during VRP. The default is 10.
9851 @node Instrumentation Options
9852 @section Program Instrumentation Options
9853 @cindex instrumentation options
9854 @cindex program instrumentation options
9855 @cindex run-time error checking options
9856 @cindex profiling options
9857 @cindex options, program instrumentation
9858 @cindex options, run-time error checking
9859 @cindex options, profiling
9861 GCC supports a number of command-line options that control adding
9862 run-time instrumentation to the code it normally generates.
9863 For example, one purpose of instrumentation is collect profiling
9864 statistics for use in finding program hot spots, code coverage
9865 analysis, or profile-guided optimizations.
9866 Another class of program instrumentation is adding run-time checking
9867 to detect programming errors like invalid pointer
9868 dereferences or out-of-bounds array accesses, as well as deliberately
9869 hostile attacks such as stack smashing or C++ vtable hijacking.
9870 There is also a general hook which can be used to implement other
9871 forms of tracing or function-level instrumentation for debug or
9872 program analysis purposes.
9875 @cindex @command{prof}
9878 Generate extra code to write profile information suitable for the
9879 analysis program @command{prof}. You must use this option when compiling
9880 the source files you want data about, and you must also use it when
9883 @cindex @command{gprof}
9886 Generate extra code to write profile information suitable for the
9887 analysis program @command{gprof}. You must use this option when compiling
9888 the source files you want data about, and you must also use it when
9891 @item -fprofile-arcs
9892 @opindex fprofile-arcs
9893 Add code so that program flow @dfn{arcs} are instrumented. During
9894 execution the program records how many times each branch and call is
9895 executed and how many times it is taken or returns. When the compiled
9896 program exits it saves this data to a file called
9897 @file{@var{auxname}.gcda} for each source file. The data may be used for
9898 profile-directed optimizations (@option{-fbranch-probabilities}), or for
9899 test coverage analysis (@option{-ftest-coverage}). Each object file's
9900 @var{auxname} is generated from the name of the output file, if
9901 explicitly specified and it is not the final executable, otherwise it is
9902 the basename of the source file. In both cases any suffix is removed
9903 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
9904 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
9905 @xref{Cross-profiling}.
9907 @cindex @command{gcov}
9911 This option is used to compile and link code instrumented for coverage
9912 analysis. The option is a synonym for @option{-fprofile-arcs}
9913 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
9914 linking). See the documentation for those options for more details.
9919 Compile the source files with @option{-fprofile-arcs} plus optimization
9920 and code generation options. For test coverage analysis, use the
9921 additional @option{-ftest-coverage} option. You do not need to profile
9922 every source file in a program.
9925 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
9926 (the latter implies the former).
9929 Run the program on a representative workload to generate the arc profile
9930 information. This may be repeated any number of times. You can run
9931 concurrent instances of your program, and provided that the file system
9932 supports locking, the data files will be correctly updated. Also
9933 @code{fork} calls are detected and correctly handled (double counting
9937 For profile-directed optimizations, compile the source files again with
9938 the same optimization and code generation options plus
9939 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
9940 Control Optimization}).
9943 For test coverage analysis, use @command{gcov} to produce human readable
9944 information from the @file{.gcno} and @file{.gcda} files. Refer to the
9945 @command{gcov} documentation for further information.
9949 With @option{-fprofile-arcs}, for each function of your program GCC
9950 creates a program flow graph, then finds a spanning tree for the graph.
9951 Only arcs that are not on the spanning tree have to be instrumented: the
9952 compiler adds code to count the number of times that these arcs are
9953 executed. When an arc is the only exit or only entrance to a block, the
9954 instrumentation code can be added to the block; otherwise, a new basic
9955 block must be created to hold the instrumentation code.
9958 @item -ftest-coverage
9959 @opindex ftest-coverage
9960 Produce a notes file that the @command{gcov} code-coverage utility
9961 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
9962 show program coverage. Each source file's note file is called
9963 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
9964 above for a description of @var{auxname} and instructions on how to
9965 generate test coverage data. Coverage data matches the source files
9966 more closely if you do not optimize.
9968 @item -fprofile-dir=@var{path}
9969 @opindex fprofile-dir
9971 Set the directory to search for the profile data files in to @var{path}.
9972 This option affects only the profile data generated by
9973 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
9974 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
9975 and its related options. Both absolute and relative paths can be used.
9976 By default, GCC uses the current directory as @var{path}, thus the
9977 profile data file appears in the same directory as the object file.
9979 @item -fprofile-generate
9980 @itemx -fprofile-generate=@var{path}
9981 @opindex fprofile-generate
9983 Enable options usually used for instrumenting application to produce
9984 profile useful for later recompilation with profile feedback based
9985 optimization. You must use @option{-fprofile-generate} both when
9986 compiling and when linking your program.
9988 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
9990 If @var{path} is specified, GCC looks at the @var{path} to find
9991 the profile feedback data files. See @option{-fprofile-dir}.
9993 To optimize the program based on the collected profile information, use
9994 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
9996 @item -fprofile-update=@var{method}
9997 @opindex fprofile-update
9999 Alter the update method for an application instrumented for profile
10000 feedback based optimization. The @var{method} argument should be one of
10001 @samp{single} or @samp{atomic}. The first one is useful for single-threaded
10002 applications, while the second one prevents profile corruption by emitting
10005 @strong{Warning:} When an application does not properly join all threads
10006 (or creates an detached thread), a profile file can be still corrupted.
10008 @item -fsanitize=address
10009 @opindex fsanitize=address
10010 Enable AddressSanitizer, a fast memory error detector.
10011 Memory access instructions are instrumented to detect
10012 out-of-bounds and use-after-free bugs.
10013 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
10014 more details. The run-time behavior can be influenced using the
10015 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
10016 the available options are shown at startup of the instrumented program. See
10017 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
10018 for a list of supported options.
10020 @item -fsanitize=kernel-address
10021 @opindex fsanitize=kernel-address
10022 Enable AddressSanitizer for Linux kernel.
10023 See @uref{https://github.com/google/kasan/wiki} for more details.
10025 @item -fsanitize=thread
10026 @opindex fsanitize=thread
10027 Enable ThreadSanitizer, a fast data race detector.
10028 Memory access instructions are instrumented to detect
10029 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
10030 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
10031 environment variable; see
10032 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
10035 @item -fsanitize=leak
10036 @opindex fsanitize=leak
10037 Enable LeakSanitizer, a memory leak detector.
10038 This option only matters for linking of executables and if neither
10039 @option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that
10040 case the executable is linked against a library that overrides @code{malloc}
10041 and other allocator functions. See
10042 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
10043 details. The run-time behavior can be influenced using the
10044 @env{LSAN_OPTIONS} environment variable.
10046 @item -fsanitize=undefined
10047 @opindex fsanitize=undefined
10048 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
10049 Various computations are instrumented to detect undefined behavior
10050 at runtime. Current suboptions are:
10054 @item -fsanitize=shift
10055 @opindex fsanitize=shift
10056 This option enables checking that the result of a shift operation is
10057 not undefined. Note that what exactly is considered undefined differs
10058 slightly between C and C++, as well as between ISO C90 and C99, etc.
10060 @item -fsanitize=integer-divide-by-zero
10061 @opindex fsanitize=integer-divide-by-zero
10062 Detect integer division by zero as well as @code{INT_MIN / -1} division.
10064 @item -fsanitize=unreachable
10065 @opindex fsanitize=unreachable
10066 With this option, the compiler turns the @code{__builtin_unreachable}
10067 call into a diagnostics message call instead. When reaching the
10068 @code{__builtin_unreachable} call, the behavior is undefined.
10070 @item -fsanitize=vla-bound
10071 @opindex fsanitize=vla-bound
10072 This option instructs the compiler to check that the size of a variable
10073 length array is positive.
10075 @item -fsanitize=null
10076 @opindex fsanitize=null
10077 This option enables pointer checking. Particularly, the application
10078 built with this option turned on will issue an error message when it
10079 tries to dereference a NULL pointer, or if a reference (possibly an
10080 rvalue reference) is bound to a NULL pointer, or if a method is invoked
10081 on an object pointed by a NULL pointer.
10083 @item -fsanitize=return
10084 @opindex fsanitize=return
10085 This option enables return statement checking. Programs
10086 built with this option turned on will issue an error message
10087 when the end of a non-void function is reached without actually
10088 returning a value. This option works in C++ only.
10090 @item -fsanitize=signed-integer-overflow
10091 @opindex fsanitize=signed-integer-overflow
10092 This option enables signed integer overflow checking. We check that
10093 the result of @code{+}, @code{*}, and both unary and binary @code{-}
10094 does not overflow in the signed arithmetics. Note, integer promotion
10095 rules must be taken into account. That is, the following is not an
10098 signed char a = SCHAR_MAX;
10102 @item -fsanitize=bounds
10103 @opindex fsanitize=bounds
10104 This option enables instrumentation of array bounds. Various out of bounds
10105 accesses are detected. Flexible array members, flexible array member-like
10106 arrays, and initializers of variables with static storage are not instrumented.
10108 @item -fsanitize=bounds-strict
10109 @opindex fsanitize=bounds-strict
10110 This option enables strict instrumentation of array bounds. Most out of bounds
10111 accesses are detected, including flexible array members and flexible array
10112 member-like arrays. Initializers of variables with static storage are not
10115 @item -fsanitize=alignment
10116 @opindex fsanitize=alignment
10118 This option enables checking of alignment of pointers when they are
10119 dereferenced, or when a reference is bound to insufficiently aligned target,
10120 or when a method or constructor is invoked on insufficiently aligned object.
10122 @item -fsanitize=object-size
10123 @opindex fsanitize=object-size
10124 This option enables instrumentation of memory references using the
10125 @code{__builtin_object_size} function. Various out of bounds pointer
10126 accesses are detected.
10128 @item -fsanitize=float-divide-by-zero
10129 @opindex fsanitize=float-divide-by-zero
10130 Detect floating-point division by zero. Unlike other similar options,
10131 @option{-fsanitize=float-divide-by-zero} is not enabled by
10132 @option{-fsanitize=undefined}, since floating-point division by zero can
10133 be a legitimate way of obtaining infinities and NaNs.
10135 @item -fsanitize=float-cast-overflow
10136 @opindex fsanitize=float-cast-overflow
10137 This option enables floating-point type to integer conversion checking.
10138 We check that the result of the conversion does not overflow.
10139 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
10140 not enabled by @option{-fsanitize=undefined}.
10141 This option does not work well with @code{FE_INVALID} exceptions enabled.
10143 @item -fsanitize=nonnull-attribute
10144 @opindex fsanitize=nonnull-attribute
10146 This option enables instrumentation of calls, checking whether null values
10147 are not passed to arguments marked as requiring a non-null value by the
10148 @code{nonnull} function attribute.
10150 @item -fsanitize=returns-nonnull-attribute
10151 @opindex fsanitize=returns-nonnull-attribute
10153 This option enables instrumentation of return statements in functions
10154 marked with @code{returns_nonnull} function attribute, to detect returning
10155 of null values from such functions.
10157 @item -fsanitize=bool
10158 @opindex fsanitize=bool
10160 This option enables instrumentation of loads from bool. If a value other
10161 than 0/1 is loaded, a run-time error is issued.
10163 @item -fsanitize=enum
10164 @opindex fsanitize=enum
10166 This option enables instrumentation of loads from an enum type. If
10167 a value outside the range of values for the enum type is loaded,
10168 a run-time error is issued.
10170 @item -fsanitize=vptr
10171 @opindex fsanitize=vptr
10173 This option enables instrumentation of C++ member function calls, member
10174 accesses and some conversions between pointers to base and derived classes,
10175 to verify the referenced object has the correct dynamic type.
10179 While @option{-ftrapv} causes traps for signed overflows to be emitted,
10180 @option{-fsanitize=undefined} gives a diagnostic message.
10181 This currently works only for the C family of languages.
10183 @item -fno-sanitize=all
10184 @opindex fno-sanitize=all
10186 This option disables all previously enabled sanitizers.
10187 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
10190 @item -fasan-shadow-offset=@var{number}
10191 @opindex fasan-shadow-offset
10192 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
10193 It is useful for experimenting with different shadow memory layouts in
10194 Kernel AddressSanitizer.
10196 @item -fsanitize-sections=@var{s1},@var{s2},...
10197 @opindex fsanitize-sections
10198 Sanitize global variables in selected user-defined sections. @var{si} may
10201 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
10202 @opindex fsanitize-recover
10203 @opindex fno-sanitize-recover
10204 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
10205 mentioned in comma-separated list of @var{opts}. Enabling this option
10206 for a sanitizer component causes it to attempt to continue
10207 running the program as if no error happened. This means multiple
10208 runtime errors can be reported in a single program run, and the exit
10209 code of the program may indicate success even when errors
10210 have been reported. The @option{-fno-sanitize-recover=} option
10211 can be used to alter
10212 this behavior: only the first detected error is reported
10213 and program then exits with a non-zero exit code.
10215 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
10216 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
10217 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
10218 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
10219 For these sanitizers error recovery is turned on by default, except @option{-fsanitize=address},
10220 for which this feature is experimental.
10221 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
10222 accepted, the former enables recovery for all sanitizers that support it,
10223 the latter disables recovery for all sanitizers that support it.
10225 Even if a recovery mode is turned on the compiler side, it needs to be also
10226 enabled on the runtime library side, otherwise the failures are still fatal.
10227 The runtime library defaults to @code{halt_on_error=0} for
10228 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
10229 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
10230 setting the @code{halt_on_error} flag in the corresponding environment variable.
10232 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
10234 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10237 Similarly @option{-fno-sanitize-recover} is equivalent to
10239 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10242 @item -fsanitize-undefined-trap-on-error
10243 @opindex fsanitize-undefined-trap-on-error
10244 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
10245 report undefined behavior using @code{__builtin_trap} rather than
10246 a @code{libubsan} library routine. The advantage of this is that the
10247 @code{libubsan} library is not needed and is not linked in, so this
10248 is usable even in freestanding environments.
10250 @item -fsanitize-coverage=trace-pc
10251 @opindex fsanitize-coverage=trace-pc
10252 Enable coverage-guided fuzzing code instrumentation.
10253 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
10255 @item -fbounds-check
10256 @opindex fbounds-check
10257 For front ends that support it, generate additional code to check that
10258 indices used to access arrays are within the declared range. This is
10259 currently only supported by the Java and Fortran front ends, where
10260 this option defaults to true and false respectively.
10262 @item -fcheck-pointer-bounds
10263 @opindex fcheck-pointer-bounds
10264 @opindex fno-check-pointer-bounds
10265 @cindex Pointer Bounds Checker options
10266 Enable Pointer Bounds Checker instrumentation. Each memory reference
10267 is instrumented with checks of the pointer used for memory access against
10268 bounds associated with that pointer.
10271 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
10272 and @option{-mmpx} are required to enable this feature.
10273 MPX-based instrumentation requires
10274 a runtime library to enable MPX in hardware and handle bounds
10275 violation signals. By default when @option{-fcheck-pointer-bounds}
10276 and @option{-mmpx} options are used to link a program, the GCC driver
10277 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
10278 Bounds checking on calls to dynamic libraries requires a linker
10279 with @option{-z bndplt} support; if GCC was configured with a linker
10280 without support for this option (including the Gold linker and older
10281 versions of ld), a warning is given if you link with @option{-mmpx}
10282 without also specifying @option{-static}, since the overall effectiveness
10283 of the bounds checking protection is reduced.
10284 See also @option{-static-libmpxwrappers}.
10286 MPX-based instrumentation
10287 may be used for debugging and also may be included in production code
10288 to increase program security. Depending on usage, you may
10289 have different requirements for the runtime library. The current version
10290 of the MPX runtime library is more oriented for use as a debugging
10291 tool. MPX runtime library usage implies @option{-lpthread}. See
10292 also @option{-static-libmpx}. The runtime library behavior can be
10293 influenced using various @env{CHKP_RT_*} environment variables. See
10294 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
10297 Generated instrumentation may be controlled by various
10298 @option{-fchkp-*} options and by the @code{bnd_variable_size}
10299 structure field attribute (@pxref{Type Attributes}) and
10300 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
10301 (@pxref{Function Attributes}). GCC also provides a number of built-in
10302 functions for controlling the Pointer Bounds Checker. @xref{Pointer
10303 Bounds Checker builtins}, for more information.
10305 @item -fchkp-check-incomplete-type
10306 @opindex fchkp-check-incomplete-type
10307 @opindex fno-chkp-check-incomplete-type
10308 Generate pointer bounds checks for variables with incomplete type.
10309 Enabled by default.
10311 @item -fchkp-narrow-bounds
10312 @opindex fchkp-narrow-bounds
10313 @opindex fno-chkp-narrow-bounds
10314 Controls bounds used by Pointer Bounds Checker for pointers to object
10315 fields. If narrowing is enabled then field bounds are used. Otherwise
10316 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
10317 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
10319 @item -fchkp-first-field-has-own-bounds
10320 @opindex fchkp-first-field-has-own-bounds
10321 @opindex fno-chkp-first-field-has-own-bounds
10322 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
10323 first field in the structure. By default a pointer to the first field has
10324 the same bounds as a pointer to the whole structure.
10326 @item -fchkp-narrow-to-innermost-array
10327 @opindex fchkp-narrow-to-innermost-array
10328 @opindex fno-chkp-narrow-to-innermost-array
10329 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
10330 case of nested static array access. By default this option is disabled and
10331 bounds of the outermost array are used.
10333 @item -fchkp-optimize
10334 @opindex fchkp-optimize
10335 @opindex fno-chkp-optimize
10336 Enables Pointer Bounds Checker optimizations. Enabled by default at
10337 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
10339 @item -fchkp-use-fast-string-functions
10340 @opindex fchkp-use-fast-string-functions
10341 @opindex fno-chkp-use-fast-string-functions
10342 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
10343 by Pointer Bounds Checker. Disabled by default.
10345 @item -fchkp-use-nochk-string-functions
10346 @opindex fchkp-use-nochk-string-functions
10347 @opindex fno-chkp-use-nochk-string-functions
10348 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
10349 by Pointer Bounds Checker. Disabled by default.
10351 @item -fchkp-use-static-bounds
10352 @opindex fchkp-use-static-bounds
10353 @opindex fno-chkp-use-static-bounds
10354 Allow Pointer Bounds Checker to generate static bounds holding
10355 bounds of static variables. Enabled by default.
10357 @item -fchkp-use-static-const-bounds
10358 @opindex fchkp-use-static-const-bounds
10359 @opindex fno-chkp-use-static-const-bounds
10360 Use statically-initialized bounds for constant bounds instead of
10361 generating them each time they are required. By default enabled when
10362 @option{-fchkp-use-static-bounds} is enabled.
10364 @item -fchkp-treat-zero-dynamic-size-as-infinite
10365 @opindex fchkp-treat-zero-dynamic-size-as-infinite
10366 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
10367 With this option, objects with incomplete type whose
10368 dynamically-obtained size is zero are treated as having infinite size
10369 instead by Pointer Bounds
10370 Checker. This option may be helpful if a program is linked with a library
10371 missing size information for some symbols. Disabled by default.
10373 @item -fchkp-check-read
10374 @opindex fchkp-check-read
10375 @opindex fno-chkp-check-read
10376 Instructs Pointer Bounds Checker to generate checks for all read
10377 accesses to memory. Enabled by default.
10379 @item -fchkp-check-write
10380 @opindex fchkp-check-write
10381 @opindex fno-chkp-check-write
10382 Instructs Pointer Bounds Checker to generate checks for all write
10383 accesses to memory. Enabled by default.
10385 @item -fchkp-store-bounds
10386 @opindex fchkp-store-bounds
10387 @opindex fno-chkp-store-bounds
10388 Instructs Pointer Bounds Checker to generate bounds stores for
10389 pointer writes. Enabled by default.
10391 @item -fchkp-instrument-calls
10392 @opindex fchkp-instrument-calls
10393 @opindex fno-chkp-instrument-calls
10394 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
10395 Enabled by default.
10397 @item -fchkp-instrument-marked-only
10398 @opindex fchkp-instrument-marked-only
10399 @opindex fno-chkp-instrument-marked-only
10400 Instructs Pointer Bounds Checker to instrument only functions
10401 marked with the @code{bnd_instrument} attribute
10402 (@pxref{Function Attributes}). Disabled by default.
10404 @item -fchkp-use-wrappers
10405 @opindex fchkp-use-wrappers
10406 @opindex fno-chkp-use-wrappers
10407 Allows Pointer Bounds Checker to replace calls to built-in functions
10408 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
10409 is used to link a program, the GCC driver automatically links
10410 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
10411 Enabled by default.
10413 @item -fstack-protector
10414 @opindex fstack-protector
10415 Emit extra code to check for buffer overflows, such as stack smashing
10416 attacks. This is done by adding a guard variable to functions with
10417 vulnerable objects. This includes functions that call @code{alloca}, and
10418 functions with buffers larger than 8 bytes. The guards are initialized
10419 when a function is entered and then checked when the function exits.
10420 If a guard check fails, an error message is printed and the program exits.
10422 @item -fstack-protector-all
10423 @opindex fstack-protector-all
10424 Like @option{-fstack-protector} except that all functions are protected.
10426 @item -fstack-protector-strong
10427 @opindex fstack-protector-strong
10428 Like @option{-fstack-protector} but includes additional functions to
10429 be protected --- those that have local array definitions, or have
10430 references to local frame addresses.
10432 @item -fstack-protector-explicit
10433 @opindex fstack-protector-explicit
10434 Like @option{-fstack-protector} but only protects those functions which
10435 have the @code{stack_protect} attribute.
10437 @item -fstack-check
10438 @opindex fstack-check
10439 Generate code to verify that you do not go beyond the boundary of the
10440 stack. You should specify this flag if you are running in an
10441 environment with multiple threads, but you only rarely need to specify it in
10442 a single-threaded environment since stack overflow is automatically
10443 detected on nearly all systems if there is only one stack.
10445 Note that this switch does not actually cause checking to be done; the
10446 operating system or the language runtime must do that. The switch causes
10447 generation of code to ensure that they see the stack being extended.
10449 You can additionally specify a string parameter: @samp{no} means no
10450 checking, @samp{generic} means force the use of old-style checking,
10451 @samp{specific} means use the best checking method and is equivalent
10452 to bare @option{-fstack-check}.
10454 Old-style checking is a generic mechanism that requires no specific
10455 target support in the compiler but comes with the following drawbacks:
10459 Modified allocation strategy for large objects: they are always
10460 allocated dynamically if their size exceeds a fixed threshold.
10463 Fixed limit on the size of the static frame of functions: when it is
10464 topped by a particular function, stack checking is not reliable and
10465 a warning is issued by the compiler.
10468 Inefficiency: because of both the modified allocation strategy and the
10469 generic implementation, code performance is hampered.
10472 Note that old-style stack checking is also the fallback method for
10473 @samp{specific} if no target support has been added in the compiler.
10475 @item -fstack-limit-register=@var{reg}
10476 @itemx -fstack-limit-symbol=@var{sym}
10477 @itemx -fno-stack-limit
10478 @opindex fstack-limit-register
10479 @opindex fstack-limit-symbol
10480 @opindex fno-stack-limit
10481 Generate code to ensure that the stack does not grow beyond a certain value,
10482 either the value of a register or the address of a symbol. If a larger
10483 stack is required, a signal is raised at run time. For most targets,
10484 the signal is raised before the stack overruns the boundary, so
10485 it is possible to catch the signal without taking special precautions.
10487 For instance, if the stack starts at absolute address @samp{0x80000000}
10488 and grows downwards, you can use the flags
10489 @option{-fstack-limit-symbol=__stack_limit} and
10490 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10491 of 128KB@. Note that this may only work with the GNU linker.
10493 You can locally override stack limit checking by using the
10494 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
10496 @item -fsplit-stack
10497 @opindex fsplit-stack
10498 Generate code to automatically split the stack before it overflows.
10499 The resulting program has a discontiguous stack which can only
10500 overflow if the program is unable to allocate any more memory. This
10501 is most useful when running threaded programs, as it is no longer
10502 necessary to calculate a good stack size to use for each thread. This
10503 is currently only implemented for the x86 targets running
10506 When code compiled with @option{-fsplit-stack} calls code compiled
10507 without @option{-fsplit-stack}, there may not be much stack space
10508 available for the latter code to run. If compiling all code,
10509 including library code, with @option{-fsplit-stack} is not an option,
10510 then the linker can fix up these calls so that the code compiled
10511 without @option{-fsplit-stack} always has a large stack. Support for
10512 this is implemented in the gold linker in GNU binutils release 2.21
10515 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
10516 @opindex fvtable-verify
10517 This option is only available when compiling C++ code.
10518 It turns on (or off, if using @option{-fvtable-verify=none}) the security
10519 feature that verifies at run time, for every virtual call, that
10520 the vtable pointer through which the call is made is valid for the type of
10521 the object, and has not been corrupted or overwritten. If an invalid vtable
10522 pointer is detected at run time, an error is reported and execution of the
10523 program is immediately halted.
10525 This option causes run-time data structures to be built at program startup,
10526 which are used for verifying the vtable pointers.
10527 The options @samp{std} and @samp{preinit}
10528 control the timing of when these data structures are built. In both cases the
10529 data structures are built before execution reaches @code{main}. Using
10530 @option{-fvtable-verify=std} causes the data structures to be built after
10531 shared libraries have been loaded and initialized.
10532 @option{-fvtable-verify=preinit} causes them to be built before shared
10533 libraries have been loaded and initialized.
10535 If this option appears multiple times in the command line with different
10536 values specified, @samp{none} takes highest priority over both @samp{std} and
10537 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
10540 @opindex fvtv-debug
10541 When used in conjunction with @option{-fvtable-verify=std} or
10542 @option{-fvtable-verify=preinit}, causes debug versions of the
10543 runtime functions for the vtable verification feature to be called.
10544 This flag also causes the compiler to log information about which
10545 vtable pointers it finds for each class.
10546 This information is written to a file named @file{vtv_set_ptr_data.log}
10547 in the directory named by the environment variable @env{VTV_LOGS_DIR}
10548 if that is defined or the current working directory otherwise.
10550 Note: This feature @emph{appends} data to the log file. If you want a fresh log
10551 file, be sure to delete any existing one.
10554 @opindex fvtv-counts
10555 This is a debugging flag. When used in conjunction with
10556 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
10557 causes the compiler to keep track of the total number of virtual calls
10558 it encounters and the number of verifications it inserts. It also
10559 counts the number of calls to certain run-time library functions
10560 that it inserts and logs this information for each compilation unit.
10561 The compiler writes this information to a file named
10562 @file{vtv_count_data.log} in the directory named by the environment
10563 variable @env{VTV_LOGS_DIR} if that is defined or the current working
10564 directory otherwise. It also counts the size of the vtable pointer sets
10565 for each class, and writes this information to @file{vtv_class_set_sizes.log}
10566 in the same directory.
10568 Note: This feature @emph{appends} data to the log files. To get fresh log
10569 files, be sure to delete any existing ones.
10571 @item -finstrument-functions
10572 @opindex finstrument-functions
10573 Generate instrumentation calls for entry and exit to functions. Just
10574 after function entry and just before function exit, the following
10575 profiling functions are called with the address of the current
10576 function and its call site. (On some platforms,
10577 @code{__builtin_return_address} does not work beyond the current
10578 function, so the call site information may not be available to the
10579 profiling functions otherwise.)
10582 void __cyg_profile_func_enter (void *this_fn,
10584 void __cyg_profile_func_exit (void *this_fn,
10588 The first argument is the address of the start of the current function,
10589 which may be looked up exactly in the symbol table.
10591 This instrumentation is also done for functions expanded inline in other
10592 functions. The profiling calls indicate where, conceptually, the
10593 inline function is entered and exited. This means that addressable
10594 versions of such functions must be available. If all your uses of a
10595 function are expanded inline, this may mean an additional expansion of
10596 code size. If you use @code{extern inline} in your C code, an
10597 addressable version of such functions must be provided. (This is
10598 normally the case anyway, but if you get lucky and the optimizer always
10599 expands the functions inline, you might have gotten away without
10600 providing static copies.)
10602 A function may be given the attribute @code{no_instrument_function}, in
10603 which case this instrumentation is not done. This can be used, for
10604 example, for the profiling functions listed above, high-priority
10605 interrupt routines, and any functions from which the profiling functions
10606 cannot safely be called (perhaps signal handlers, if the profiling
10607 routines generate output or allocate memory).
10609 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
10610 @opindex finstrument-functions-exclude-file-list
10612 Set the list of functions that are excluded from instrumentation (see
10613 the description of @option{-finstrument-functions}). If the file that
10614 contains a function definition matches with one of @var{file}, then
10615 that function is not instrumented. The match is done on substrings:
10616 if the @var{file} parameter is a substring of the file name, it is
10617 considered to be a match.
10622 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
10626 excludes any inline function defined in files whose pathnames
10627 contain @file{/bits/stl} or @file{include/sys}.
10629 If, for some reason, you want to include letter @samp{,} in one of
10630 @var{sym}, write @samp{\,}. For example,
10631 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
10632 (note the single quote surrounding the option).
10634 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
10635 @opindex finstrument-functions-exclude-function-list
10637 This is similar to @option{-finstrument-functions-exclude-file-list},
10638 but this option sets the list of function names to be excluded from
10639 instrumentation. The function name to be matched is its user-visible
10640 name, such as @code{vector<int> blah(const vector<int> &)}, not the
10641 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
10642 match is done on substrings: if the @var{sym} parameter is a substring
10643 of the function name, it is considered to be a match. For C99 and C++
10644 extended identifiers, the function name must be given in UTF-8, not
10645 using universal character names.
10650 @node Preprocessor Options
10651 @section Options Controlling the Preprocessor
10652 @cindex preprocessor options
10653 @cindex options, preprocessor
10655 These options control the C preprocessor, which is run on each C source
10656 file before actual compilation.
10658 If you use the @option{-E} option, nothing is done except preprocessing.
10659 Some of these options make sense only together with @option{-E} because
10660 they cause the preprocessor output to be unsuitable for actual
10664 @item -Wp,@var{option}
10666 You can use @option{-Wp,@var{option}} to bypass the compiler driver
10667 and pass @var{option} directly through to the preprocessor. If
10668 @var{option} contains commas, it is split into multiple options at the
10669 commas. However, many options are modified, translated or interpreted
10670 by the compiler driver before being passed to the preprocessor, and
10671 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
10672 interface is undocumented and subject to change, so whenever possible
10673 you should avoid using @option{-Wp} and let the driver handle the
10676 @item -Xpreprocessor @var{option}
10677 @opindex Xpreprocessor
10678 Pass @var{option} as an option to the preprocessor. You can use this to
10679 supply system-specific preprocessor options that GCC does not
10682 If you want to pass an option that takes an argument, you must use
10683 @option{-Xpreprocessor} twice, once for the option and once for the argument.
10685 @item -no-integrated-cpp
10686 @opindex no-integrated-cpp
10687 Perform preprocessing as a separate pass before compilation.
10688 By default, GCC performs preprocessing as an integrated part of
10689 input tokenization and parsing.
10690 If this option is provided, the appropriate language front end
10691 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
10692 and Objective-C, respectively) is instead invoked twice,
10693 once for preprocessing only and once for actual compilation
10694 of the preprocessed input.
10695 This option may be useful in conjunction with the @option{-B} or
10696 @option{-wrapper} options to specify an alternate preprocessor or
10697 perform additional processing of the program source between
10698 normal preprocessing and compilation.
10701 @include cppopts.texi
10703 @node Assembler Options
10704 @section Passing Options to the Assembler
10706 @c prevent bad page break with this line
10707 You can pass options to the assembler.
10710 @item -Wa,@var{option}
10712 Pass @var{option} as an option to the assembler. If @var{option}
10713 contains commas, it is split into multiple options at the commas.
10715 @item -Xassembler @var{option}
10716 @opindex Xassembler
10717 Pass @var{option} as an option to the assembler. You can use this to
10718 supply system-specific assembler options that GCC does not
10721 If you want to pass an option that takes an argument, you must use
10722 @option{-Xassembler} twice, once for the option and once for the argument.
10727 @section Options for Linking
10728 @cindex link options
10729 @cindex options, linking
10731 These options come into play when the compiler links object files into
10732 an executable output file. They are meaningless if the compiler is
10733 not doing a link step.
10737 @item @var{object-file-name}
10738 A file name that does not end in a special recognized suffix is
10739 considered to name an object file or library. (Object files are
10740 distinguished from libraries by the linker according to the file
10741 contents.) If linking is done, these object files are used as input
10750 If any of these options is used, then the linker is not run, and
10751 object file names should not be used as arguments. @xref{Overall
10755 @opindex fuse-ld=bfd
10756 Use the @command{bfd} linker instead of the default linker.
10758 @item -fuse-ld=gold
10759 @opindex fuse-ld=gold
10760 Use the @command{gold} linker instead of the default linker.
10763 @item -l@var{library}
10764 @itemx -l @var{library}
10766 Search the library named @var{library} when linking. (The second
10767 alternative with the library as a separate argument is only for
10768 POSIX compliance and is not recommended.)
10770 It makes a difference where in the command you write this option; the
10771 linker searches and processes libraries and object files in the order they
10772 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
10773 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
10774 to functions in @samp{z}, those functions may not be loaded.
10776 The linker searches a standard list of directories for the library,
10777 which is actually a file named @file{lib@var{library}.a}. The linker
10778 then uses this file as if it had been specified precisely by name.
10780 The directories searched include several standard system directories
10781 plus any that you specify with @option{-L}.
10783 Normally the files found this way are library files---archive files
10784 whose members are object files. The linker handles an archive file by
10785 scanning through it for members which define symbols that have so far
10786 been referenced but not defined. But if the file that is found is an
10787 ordinary object file, it is linked in the usual fashion. The only
10788 difference between using an @option{-l} option and specifying a file name
10789 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
10790 and searches several directories.
10794 You need this special case of the @option{-l} option in order to
10795 link an Objective-C or Objective-C++ program.
10797 @item -nostartfiles
10798 @opindex nostartfiles
10799 Do not use the standard system startup files when linking.
10800 The standard system libraries are used normally, unless @option{-nostdlib}
10801 or @option{-nodefaultlibs} is used.
10803 @item -nodefaultlibs
10804 @opindex nodefaultlibs
10805 Do not use the standard system libraries when linking.
10806 Only the libraries you specify are passed to the linker, and options
10807 specifying linkage of the system libraries, such as @option{-static-libgcc}
10808 or @option{-shared-libgcc}, are ignored.
10809 The standard startup files are used normally, unless @option{-nostartfiles}
10812 The compiler may generate calls to @code{memcmp},
10813 @code{memset}, @code{memcpy} and @code{memmove}.
10814 These entries are usually resolved by entries in
10815 libc. These entry points should be supplied through some other
10816 mechanism when this option is specified.
10820 Do not use the standard system startup files or libraries when linking.
10821 No startup files and only the libraries you specify are passed to
10822 the linker, and options specifying linkage of the system libraries, such as
10823 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
10825 The compiler may generate calls to @code{memcmp}, @code{memset},
10826 @code{memcpy} and @code{memmove}.
10827 These entries are usually resolved by entries in
10828 libc. These entry points should be supplied through some other
10829 mechanism when this option is specified.
10831 @cindex @option{-lgcc}, use with @option{-nostdlib}
10832 @cindex @option{-nostdlib} and unresolved references
10833 @cindex unresolved references and @option{-nostdlib}
10834 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
10835 @cindex @option{-nodefaultlibs} and unresolved references
10836 @cindex unresolved references and @option{-nodefaultlibs}
10837 One of the standard libraries bypassed by @option{-nostdlib} and
10838 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
10839 which GCC uses to overcome shortcomings of particular machines, or special
10840 needs for some languages.
10841 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
10842 Collection (GCC) Internals},
10843 for more discussion of @file{libgcc.a}.)
10844 In most cases, you need @file{libgcc.a} even when you want to avoid
10845 other standard libraries. In other words, when you specify @option{-nostdlib}
10846 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
10847 This ensures that you have no unresolved references to internal GCC
10848 library subroutines.
10849 (An example of such an internal subroutine is @code{__main}, used to ensure C++
10850 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
10851 GNU Compiler Collection (GCC) Internals}.)
10855 Produce a position independent executable on targets that support it.
10856 For predictable results, you must also specify the same set of options
10857 used for compilation (@option{-fpie}, @option{-fPIE},
10858 or model suboptions) when you specify this linker option.
10862 Don't produce a position independent executable.
10866 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
10867 that support it. This instructs the linker to add all symbols, not
10868 only used ones, to the dynamic symbol table. This option is needed
10869 for some uses of @code{dlopen} or to allow obtaining backtraces
10870 from within a program.
10874 Remove all symbol table and relocation information from the executable.
10878 On systems that support dynamic linking, this prevents linking with the shared
10879 libraries. On other systems, this option has no effect.
10883 Produce a shared object which can then be linked with other objects to
10884 form an executable. Not all systems support this option. For predictable
10885 results, you must also specify the same set of options used for compilation
10886 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
10887 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
10888 needs to build supplementary stub code for constructors to work. On
10889 multi-libbed systems, @samp{gcc -shared} must select the correct support
10890 libraries to link against. Failing to supply the correct flags may lead
10891 to subtle defects. Supplying them in cases where they are not necessary
10894 @item -shared-libgcc
10895 @itemx -static-libgcc
10896 @opindex shared-libgcc
10897 @opindex static-libgcc
10898 On systems that provide @file{libgcc} as a shared library, these options
10899 force the use of either the shared or static version, respectively.
10900 If no shared version of @file{libgcc} was built when the compiler was
10901 configured, these options have no effect.
10903 There are several situations in which an application should use the
10904 shared @file{libgcc} instead of the static version. The most common
10905 of these is when the application wishes to throw and catch exceptions
10906 across different shared libraries. In that case, each of the libraries
10907 as well as the application itself should use the shared @file{libgcc}.
10909 Therefore, the G++ and GCJ drivers automatically add
10910 @option{-shared-libgcc} whenever you build a shared library or a main
10911 executable, because C++ and Java programs typically use exceptions, so
10912 this is the right thing to do.
10914 If, instead, you use the GCC driver to create shared libraries, you may
10915 find that they are not always linked with the shared @file{libgcc}.
10916 If GCC finds, at its configuration time, that you have a non-GNU linker
10917 or a GNU linker that does not support option @option{--eh-frame-hdr},
10918 it links the shared version of @file{libgcc} into shared libraries
10919 by default. Otherwise, it takes advantage of the linker and optimizes
10920 away the linking with the shared version of @file{libgcc}, linking with
10921 the static version of libgcc by default. This allows exceptions to
10922 propagate through such shared libraries, without incurring relocation
10923 costs at library load time.
10925 However, if a library or main executable is supposed to throw or catch
10926 exceptions, you must link it using the G++ or GCJ driver, as appropriate
10927 for the languages used in the program, or using the option
10928 @option{-shared-libgcc}, such that it is linked with the shared
10931 @item -static-libasan
10932 @opindex static-libasan
10933 When the @option{-fsanitize=address} option is used to link a program,
10934 the GCC driver automatically links against @option{libasan}. If
10935 @file{libasan} is available as a shared library, and the @option{-static}
10936 option is not used, then this links against the shared version of
10937 @file{libasan}. The @option{-static-libasan} option directs the GCC
10938 driver to link @file{libasan} statically, without necessarily linking
10939 other libraries statically.
10941 @item -static-libtsan
10942 @opindex static-libtsan
10943 When the @option{-fsanitize=thread} option is used to link a program,
10944 the GCC driver automatically links against @option{libtsan}. If
10945 @file{libtsan} is available as a shared library, and the @option{-static}
10946 option is not used, then this links against the shared version of
10947 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
10948 driver to link @file{libtsan} statically, without necessarily linking
10949 other libraries statically.
10951 @item -static-liblsan
10952 @opindex static-liblsan
10953 When the @option{-fsanitize=leak} option is used to link a program,
10954 the GCC driver automatically links against @option{liblsan}. If
10955 @file{liblsan} is available as a shared library, and the @option{-static}
10956 option is not used, then this links against the shared version of
10957 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
10958 driver to link @file{liblsan} statically, without necessarily linking
10959 other libraries statically.
10961 @item -static-libubsan
10962 @opindex static-libubsan
10963 When the @option{-fsanitize=undefined} option is used to link a program,
10964 the GCC driver automatically links against @option{libubsan}. If
10965 @file{libubsan} is available as a shared library, and the @option{-static}
10966 option is not used, then this links against the shared version of
10967 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
10968 driver to link @file{libubsan} statically, without necessarily linking
10969 other libraries statically.
10971 @item -static-libmpx
10972 @opindex static-libmpx
10973 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
10974 used to link a program, the GCC driver automatically links against
10975 @file{libmpx}. If @file{libmpx} is available as a shared library,
10976 and the @option{-static} option is not used, then this links against
10977 the shared version of @file{libmpx}. The @option{-static-libmpx}
10978 option directs the GCC driver to link @file{libmpx} statically,
10979 without necessarily linking other libraries statically.
10981 @item -static-libmpxwrappers
10982 @opindex static-libmpxwrappers
10983 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
10984 to link a program without also using @option{-fno-chkp-use-wrappers}, the
10985 GCC driver automatically links against @file{libmpxwrappers}. If
10986 @file{libmpxwrappers} is available as a shared library, and the
10987 @option{-static} option is not used, then this links against the shared
10988 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
10989 option directs the GCC driver to link @file{libmpxwrappers} statically,
10990 without necessarily linking other libraries statically.
10992 @item -static-libstdc++
10993 @opindex static-libstdc++
10994 When the @command{g++} program is used to link a C++ program, it
10995 normally automatically links against @option{libstdc++}. If
10996 @file{libstdc++} is available as a shared library, and the
10997 @option{-static} option is not used, then this links against the
10998 shared version of @file{libstdc++}. That is normally fine. However, it
10999 is sometimes useful to freeze the version of @file{libstdc++} used by
11000 the program without going all the way to a fully static link. The
11001 @option{-static-libstdc++} option directs the @command{g++} driver to
11002 link @file{libstdc++} statically, without necessarily linking other
11003 libraries statically.
11007 Bind references to global symbols when building a shared object. Warn
11008 about any unresolved references (unless overridden by the link editor
11009 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
11012 @item -T @var{script}
11014 @cindex linker script
11015 Use @var{script} as the linker script. This option is supported by most
11016 systems using the GNU linker. On some targets, such as bare-board
11017 targets without an operating system, the @option{-T} option may be required
11018 when linking to avoid references to undefined symbols.
11020 @item -Xlinker @var{option}
11022 Pass @var{option} as an option to the linker. You can use this to
11023 supply system-specific linker options that GCC does not recognize.
11025 If you want to pass an option that takes a separate argument, you must use
11026 @option{-Xlinker} twice, once for the option and once for the argument.
11027 For example, to pass @option{-assert definitions}, you must write
11028 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
11029 @option{-Xlinker "-assert definitions"}, because this passes the entire
11030 string as a single argument, which is not what the linker expects.
11032 When using the GNU linker, it is usually more convenient to pass
11033 arguments to linker options using the @option{@var{option}=@var{value}}
11034 syntax than as separate arguments. For example, you can specify
11035 @option{-Xlinker -Map=output.map} rather than
11036 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
11037 this syntax for command-line options.
11039 @item -Wl,@var{option}
11041 Pass @var{option} as an option to the linker. If @var{option} contains
11042 commas, it is split into multiple options at the commas. You can use this
11043 syntax to pass an argument to the option.
11044 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
11045 linker. When using the GNU linker, you can also get the same effect with
11046 @option{-Wl,-Map=output.map}.
11048 @item -u @var{symbol}
11050 Pretend the symbol @var{symbol} is undefined, to force linking of
11051 library modules to define it. You can use @option{-u} multiple times with
11052 different symbols to force loading of additional library modules.
11054 @item -z @var{keyword}
11056 @option{-z} is passed directly on to the linker along with the keyword
11057 @var{keyword}. See the section in the documentation of your linker for
11058 permitted values and their meanings.
11061 @node Directory Options
11062 @section Options for Directory Search
11063 @cindex directory options
11064 @cindex options, directory search
11065 @cindex search path
11067 These options specify directories to search for header files, for
11068 libraries and for parts of the compiler:
11073 Add the directory @var{dir} to the head of the list of directories to be
11074 searched for header files. This can be used to override a system header
11075 file, substituting your own version, since these directories are
11076 searched before the system header file directories. However, you should
11077 not use this option to add directories that contain vendor-supplied
11078 system header files (use @option{-isystem} for that). If you use more than
11079 one @option{-I} option, the directories are scanned in left-to-right
11080 order; the standard system directories come after.
11082 If a standard system include directory, or a directory specified with
11083 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
11084 option is ignored. The directory is still searched but as a
11085 system directory at its normal position in the system include chain.
11086 This is to ensure that GCC's procedure to fix buggy system headers and
11087 the ordering for the @code{include_next} directive are not inadvertently changed.
11088 If you really need to change the search order for system directories,
11089 use the @option{-nostdinc} and/or @option{-isystem} options.
11091 @item -iplugindir=@var{dir}
11092 @opindex iplugindir=
11093 Set the directory to search for plugins that are passed
11094 by @option{-fplugin=@var{name}} instead of
11095 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
11096 to be used by the user, but only passed by the driver.
11098 @item -iquote@var{dir}
11100 Add the directory @var{dir} to the head of the list of directories to
11101 be searched for header files only for the case of @code{#include
11102 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
11103 otherwise just like @option{-I}.
11107 Add directory @var{dir} to the list of directories to be searched
11110 @item -B@var{prefix}
11112 This option specifies where to find the executables, libraries,
11113 include files, and data files of the compiler itself.
11115 The compiler driver program runs one or more of the subprograms
11116 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
11117 @var{prefix} as a prefix for each program it tries to run, both with and
11118 without @samp{@var{machine}/@var{version}/} for the corresponding target
11119 machine and compiler version.
11121 For each subprogram to be run, the compiler driver first tries the
11122 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
11123 is not specified, the driver tries two standard prefixes,
11124 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
11125 those results in a file name that is found, the unmodified program
11126 name is searched for using the directories specified in your
11127 @env{PATH} environment variable.
11129 The compiler checks to see if the path provided by @option{-B}
11130 refers to a directory, and if necessary it adds a directory
11131 separator character at the end of the path.
11133 @option{-B} prefixes that effectively specify directory names also apply
11134 to libraries in the linker, because the compiler translates these
11135 options into @option{-L} options for the linker. They also apply to
11136 include files in the preprocessor, because the compiler translates these
11137 options into @option{-isystem} options for the preprocessor. In this case,
11138 the compiler appends @samp{include} to the prefix.
11140 The runtime support file @file{libgcc.a} can also be searched for using
11141 the @option{-B} prefix, if needed. If it is not found there, the two
11142 standard prefixes above are tried, and that is all. The file is left
11143 out of the link if it is not found by those means.
11145 Another way to specify a prefix much like the @option{-B} prefix is to use
11146 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
11149 As a special kludge, if the path provided by @option{-B} is
11150 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
11151 9, then it is replaced by @file{[dir/]include}. This is to help
11152 with boot-strapping the compiler.
11154 @item -no-canonical-prefixes
11155 @opindex no-canonical-prefixes
11156 Do not expand any symbolic links, resolve references to @samp{/../}
11157 or @samp{/./}, or make the path absolute when generating a relative
11160 @item --sysroot=@var{dir}
11162 Use @var{dir} as the logical root directory for headers and libraries.
11163 For example, if the compiler normally searches for headers in
11164 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
11165 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
11167 If you use both this option and the @option{-isysroot} option, then
11168 the @option{--sysroot} option applies to libraries, but the
11169 @option{-isysroot} option applies to header files.
11171 The GNU linker (beginning with version 2.16) has the necessary support
11172 for this option. If your linker does not support this option, the
11173 header file aspect of @option{--sysroot} still works, but the
11174 library aspect does not.
11176 @item --no-sysroot-suffix
11177 @opindex no-sysroot-suffix
11178 For some targets, a suffix is added to the root directory specified
11179 with @option{--sysroot}, depending on the other options used, so that
11180 headers may for example be found in
11181 @file{@var{dir}/@var{suffix}/usr/include} instead of
11182 @file{@var{dir}/usr/include}. This option disables the addition of
11187 This option has been deprecated. Please use @option{-iquote} instead for
11188 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
11190 Any directories you specify with @option{-I} options before the @option{-I-}
11191 option are searched only for the case of @code{#include "@var{file}"};
11192 they are not searched for @code{#include <@var{file}>}.
11194 If additional directories are specified with @option{-I} options after
11195 the @option{-I-} option, these directories are searched for all @code{#include}
11196 directives. (Ordinarily @emph{all} @option{-I} directories are used
11199 In addition, the @option{-I-} option inhibits the use of the current
11200 directory (where the current input file came from) as the first search
11201 directory for @code{#include "@var{file}"}. There is no way to
11202 override this effect of @option{-I-}. With @option{-I.} you can specify
11203 searching the directory that is current when the compiler is
11204 invoked. That is not exactly the same as what the preprocessor does
11205 by default, but it is often satisfactory.
11207 @option{-I-} does not inhibit the use of the standard system directories
11208 for header files. Thus, @option{-I-} and @option{-nostdinc} are
11212 @node Code Gen Options
11213 @section Options for Code Generation Conventions
11214 @cindex code generation conventions
11215 @cindex options, code generation
11216 @cindex run-time options
11218 These machine-independent options control the interface conventions
11219 used in code generation.
11221 Most of them have both positive and negative forms; the negative form
11222 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
11223 one of the forms is listed---the one that is not the default. You
11224 can figure out the other form by either removing @samp{no-} or adding
11228 @item -fstack-reuse=@var{reuse-level}
11229 @opindex fstack_reuse
11230 This option controls stack space reuse for user declared local/auto variables
11231 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
11232 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
11233 local variables and temporaries, @samp{named_vars} enables the reuse only for
11234 user defined local variables with names, and @samp{none} disables stack reuse
11235 completely. The default value is @samp{all}. The option is needed when the
11236 program extends the lifetime of a scoped local variable or a compiler generated
11237 temporary beyond the end point defined by the language. When a lifetime of
11238 a variable ends, and if the variable lives in memory, the optimizing compiler
11239 has the freedom to reuse its stack space with other temporaries or scoped
11240 local variables whose live range does not overlap with it. Legacy code extending
11241 local lifetime is likely to break with the stack reuse optimization.
11260 if (*p == 10) // out of scope use of local1
11271 A(int k) : i(k), j(k) @{ @}
11278 void foo(const A& ar)
11285 foo(A(10)); // temp object's lifetime ends when foo returns
11291 ap->i+= 10; // ap references out of scope temp whose space
11292 // is reused with a. What is the value of ap->i?
11297 The lifetime of a compiler generated temporary is well defined by the C++
11298 standard. When a lifetime of a temporary ends, and if the temporary lives
11299 in memory, the optimizing compiler has the freedom to reuse its stack
11300 space with other temporaries or scoped local variables whose live range
11301 does not overlap with it. However some of the legacy code relies on
11302 the behavior of older compilers in which temporaries' stack space is
11303 not reused, the aggressive stack reuse can lead to runtime errors. This
11304 option is used to control the temporary stack reuse optimization.
11308 This option generates traps for signed overflow on addition, subtraction,
11309 multiplication operations.
11310 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11311 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11312 @option{-fwrapv} being effective. Note that only active options override, so
11313 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11314 results in @option{-ftrapv} being effective.
11318 This option instructs the compiler to assume that signed arithmetic
11319 overflow of addition, subtraction and multiplication wraps around
11320 using twos-complement representation. This flag enables some optimizations
11321 and disables others. This option is enabled by default for the Java
11322 front end, as required by the Java language specification.
11323 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11324 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11325 @option{-fwrapv} being effective. Note that only active options override, so
11326 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11327 results in @option{-ftrapv} being effective.
11330 @opindex fexceptions
11331 Enable exception handling. Generates extra code needed to propagate
11332 exceptions. For some targets, this implies GCC generates frame
11333 unwind information for all functions, which can produce significant data
11334 size overhead, although it does not affect execution. If you do not
11335 specify this option, GCC enables it by default for languages like
11336 C++ that normally require exception handling, and disables it for
11337 languages like C that do not normally require it. However, you may need
11338 to enable this option when compiling C code that needs to interoperate
11339 properly with exception handlers written in C++. You may also wish to
11340 disable this option if you are compiling older C++ programs that don't
11341 use exception handling.
11343 @item -fnon-call-exceptions
11344 @opindex fnon-call-exceptions
11345 Generate code that allows trapping instructions to throw exceptions.
11346 Note that this requires platform-specific runtime support that does
11347 not exist everywhere. Moreover, it only allows @emph{trapping}
11348 instructions to throw exceptions, i.e.@: memory references or floating-point
11349 instructions. It does not allow exceptions to be thrown from
11350 arbitrary signal handlers such as @code{SIGALRM}.
11352 @item -fdelete-dead-exceptions
11353 @opindex fdelete-dead-exceptions
11354 Consider that instructions that may throw exceptions but don't otherwise
11355 contribute to the execution of the program can be optimized away.
11356 This option is enabled by default for the Ada front end, as permitted by
11357 the Ada language specification.
11358 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
11360 @item -funwind-tables
11361 @opindex funwind-tables
11362 Similar to @option{-fexceptions}, except that it just generates any needed
11363 static data, but does not affect the generated code in any other way.
11364 You normally do not need to enable this option; instead, a language processor
11365 that needs this handling enables it on your behalf.
11367 @item -fasynchronous-unwind-tables
11368 @opindex fasynchronous-unwind-tables
11369 Generate unwind table in DWARF format, if supported by target machine. The
11370 table is exact at each instruction boundary, so it can be used for stack
11371 unwinding from asynchronous events (such as debugger or garbage collector).
11373 @item -fno-gnu-unique
11374 @opindex fno-gnu-unique
11375 On systems with recent GNU assembler and C library, the C++ compiler
11376 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
11377 of template static data members and static local variables in inline
11378 functions are unique even in the presence of @code{RTLD_LOCAL}; this
11379 is necessary to avoid problems with a library used by two different
11380 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
11381 therefore disagreeing with the other one about the binding of the
11382 symbol. But this causes @code{dlclose} to be ignored for affected
11383 DSOs; if your program relies on reinitialization of a DSO via
11384 @code{dlclose} and @code{dlopen}, you can use
11385 @option{-fno-gnu-unique}.
11387 @item -fpcc-struct-return
11388 @opindex fpcc-struct-return
11389 Return ``short'' @code{struct} and @code{union} values in memory like
11390 longer ones, rather than in registers. This convention is less
11391 efficient, but it has the advantage of allowing intercallability between
11392 GCC-compiled files and files compiled with other compilers, particularly
11393 the Portable C Compiler (pcc).
11395 The precise convention for returning structures in memory depends
11396 on the target configuration macros.
11398 Short structures and unions are those whose size and alignment match
11399 that of some integer type.
11401 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11402 switch is not binary compatible with code compiled with the
11403 @option{-freg-struct-return} switch.
11404 Use it to conform to a non-default application binary interface.
11406 @item -freg-struct-return
11407 @opindex freg-struct-return
11408 Return @code{struct} and @code{union} values in registers when possible.
11409 This is more efficient for small structures than
11410 @option{-fpcc-struct-return}.
11412 If you specify neither @option{-fpcc-struct-return} nor
11413 @option{-freg-struct-return}, GCC defaults to whichever convention is
11414 standard for the target. If there is no standard convention, GCC
11415 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11416 the principal compiler. In those cases, we can choose the standard, and
11417 we chose the more efficient register return alternative.
11419 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11420 switch is not binary compatible with code compiled with the
11421 @option{-fpcc-struct-return} switch.
11422 Use it to conform to a non-default application binary interface.
11424 @item -fshort-enums
11425 @opindex fshort-enums
11426 Allocate to an @code{enum} type only as many bytes as it needs for the
11427 declared range of possible values. Specifically, the @code{enum} type
11428 is equivalent to the smallest integer type that has enough room.
11430 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11431 code that is not binary compatible with code generated without that switch.
11432 Use it to conform to a non-default application binary interface.
11434 @item -fshort-wchar
11435 @opindex fshort-wchar
11436 Override the underlying type for @code{wchar_t} to be @code{short
11437 unsigned int} instead of the default for the target. This option is
11438 useful for building programs to run under WINE@.
11440 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11441 code that is not binary compatible with code generated without that switch.
11442 Use it to conform to a non-default application binary interface.
11445 @opindex fno-common
11446 In C code, controls the placement of uninitialized global variables.
11447 Unix C compilers have traditionally permitted multiple definitions of
11448 such variables in different compilation units by placing the variables
11450 This is the behavior specified by @option{-fcommon}, and is the default
11451 for GCC on most targets.
11452 On the other hand, this behavior is not required by ISO C, and on some
11453 targets may carry a speed or code size penalty on variable references.
11454 The @option{-fno-common} option specifies that the compiler should place
11455 uninitialized global variables in the data section of the object file,
11456 rather than generating them as common blocks.
11457 This has the effect that if the same variable is declared
11458 (without @code{extern}) in two different compilations,
11459 you get a multiple-definition error when you link them.
11460 In this case, you must compile with @option{-fcommon} instead.
11461 Compiling with @option{-fno-common} is useful on targets for which
11462 it provides better performance, or if you wish to verify that the
11463 program will work on other systems that always treat uninitialized
11464 variable declarations this way.
11468 Ignore the @code{#ident} directive.
11470 @item -finhibit-size-directive
11471 @opindex finhibit-size-directive
11472 Don't output a @code{.size} assembler directive, or anything else that
11473 would cause trouble if the function is split in the middle, and the
11474 two halves are placed at locations far apart in memory. This option is
11475 used when compiling @file{crtstuff.c}; you should not need to use it
11478 @item -fverbose-asm
11479 @opindex fverbose-asm
11480 Put extra commentary information in the generated assembly code to
11481 make it more readable. This option is generally only of use to those
11482 who actually need to read the generated assembly code (perhaps while
11483 debugging the compiler itself).
11485 @option{-fno-verbose-asm}, the default, causes the
11486 extra information to be omitted and is useful when comparing two assembler
11489 The added comments include:
11494 information on the compiler version and command-line options,
11497 the source code lines associated with the assembly instructions,
11498 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
11501 hints on which high-level expressions correspond to
11502 the various assembly instruction operands.
11506 For example, given this C source file:
11514 for (i = 0; i < n; i++)
11521 compiling to (x86_64) assembly via @option{-S} and emitting the result
11522 direct to stdout via @option{-o} @option{-}
11525 gcc -S test.c -fverbose-asm -Os -o -
11528 gives output similar to this:
11532 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
11539 .type test, @@function
11543 # test.c:4: int total = 0;
11544 xorl %eax, %eax # <retval>
11545 # test.c:6: for (i = 0; i < n; i++)
11546 xorl %edx, %edx # i
11548 # test.c:6: for (i = 0; i < n; i++)
11549 cmpl %edi, %edx # n, i
11551 # test.c:7: total += i * i;
11552 movl %edx, %ecx # i, tmp92
11553 imull %edx, %ecx # i, tmp92
11554 # test.c:6: for (i = 0; i < n; i++)
11556 # test.c:7: total += i * i;
11557 addl %ecx, %eax # tmp92, <retval>
11565 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
11566 .section .note.GNU-stack,"",@@progbits
11569 The comments are intended for humans rather than machines and hence the
11570 precise format of the comments is subject to change.
11572 @item -frecord-gcc-switches
11573 @opindex frecord-gcc-switches
11574 This switch causes the command line used to invoke the
11575 compiler to be recorded into the object file that is being created.
11576 This switch is only implemented on some targets and the exact format
11577 of the recording is target and binary file format dependent, but it
11578 usually takes the form of a section containing ASCII text. This
11579 switch is related to the @option{-fverbose-asm} switch, but that
11580 switch only records information in the assembler output file as
11581 comments, so it never reaches the object file.
11582 See also @option{-grecord-gcc-switches} for another
11583 way of storing compiler options into the object file.
11587 @cindex global offset table
11589 Generate position-independent code (PIC) suitable for use in a shared
11590 library, if supported for the target machine. Such code accesses all
11591 constant addresses through a global offset table (GOT)@. The dynamic
11592 loader resolves the GOT entries when the program starts (the dynamic
11593 loader is not part of GCC; it is part of the operating system). If
11594 the GOT size for the linked executable exceeds a machine-specific
11595 maximum size, you get an error message from the linker indicating that
11596 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
11597 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
11598 on the m68k and RS/6000. The x86 has no such limit.)
11600 Position-independent code requires special support, and therefore works
11601 only on certain machines. For the x86, GCC supports PIC for System V
11602 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
11603 position-independent.
11605 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11610 If supported for the target machine, emit position-independent code,
11611 suitable for dynamic linking and avoiding any limit on the size of the
11612 global offset table. This option makes a difference on AArch64, m68k,
11613 PowerPC and SPARC@.
11615 Position-independent code requires special support, and therefore works
11616 only on certain machines.
11618 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11625 These options are similar to @option{-fpic} and @option{-fPIC}, but
11626 generated position independent code can be only linked into executables.
11627 Usually these options are used when @option{-pie} GCC option is
11628 used during linking.
11630 @option{-fpie} and @option{-fPIE} both define the macros
11631 @code{__pie__} and @code{__PIE__}. The macros have the value 1
11632 for @option{-fpie} and 2 for @option{-fPIE}.
11636 Do not use the PLT for external function calls in position-independent code.
11637 Instead, load the callee address at call sites from the GOT and branch to it.
11638 This leads to more efficient code by eliminating PLT stubs and exposing
11639 GOT loads to optimizations. On architectures such as 32-bit x86 where
11640 PLT stubs expect the GOT pointer in a specific register, this gives more
11641 register allocation freedom to the compiler.
11642 Lazy binding requires use of the PLT;
11643 with @option{-fno-plt} all external symbols are resolved at load time.
11645 Alternatively, the function attribute @code{noplt} can be used to avoid calls
11646 through the PLT for specific external functions.
11648 In position-dependent code, a few targets also convert calls to
11649 functions that are marked to not use the PLT to use the GOT instead.
11651 @item -fno-jump-tables
11652 @opindex fno-jump-tables
11653 Do not use jump tables for switch statements even where it would be
11654 more efficient than other code generation strategies. This option is
11655 of use in conjunction with @option{-fpic} or @option{-fPIC} for
11656 building code that forms part of a dynamic linker and cannot
11657 reference the address of a jump table. On some targets, jump tables
11658 do not require a GOT and this option is not needed.
11660 @item -ffixed-@var{reg}
11662 Treat the register named @var{reg} as a fixed register; generated code
11663 should never refer to it (except perhaps as a stack pointer, frame
11664 pointer or in some other fixed role).
11666 @var{reg} must be the name of a register. The register names accepted
11667 are machine-specific and are defined in the @code{REGISTER_NAMES}
11668 macro in the machine description macro file.
11670 This flag does not have a negative form, because it specifies a
11673 @item -fcall-used-@var{reg}
11674 @opindex fcall-used
11675 Treat the register named @var{reg} as an allocable register that is
11676 clobbered by function calls. It may be allocated for temporaries or
11677 variables that do not live across a call. Functions compiled this way
11678 do not save and restore the register @var{reg}.
11680 It is an error to use this flag with the frame pointer or stack pointer.
11681 Use of this flag for other registers that have fixed pervasive roles in
11682 the machine's execution model produces disastrous results.
11684 This flag does not have a negative form, because it specifies a
11687 @item -fcall-saved-@var{reg}
11688 @opindex fcall-saved
11689 Treat the register named @var{reg} as an allocable register saved by
11690 functions. It may be allocated even for temporaries or variables that
11691 live across a call. Functions compiled this way save and restore
11692 the register @var{reg} if they use it.
11694 It is an error to use this flag with the frame pointer or stack pointer.
11695 Use of this flag for other registers that have fixed pervasive roles in
11696 the machine's execution model produces disastrous results.
11698 A different sort of disaster results from the use of this flag for
11699 a register in which function values may be returned.
11701 This flag does not have a negative form, because it specifies a
11704 @item -fpack-struct[=@var{n}]
11705 @opindex fpack-struct
11706 Without a value specified, pack all structure members together without
11707 holes. When a value is specified (which must be a small power of two), pack
11708 structure members according to this value, representing the maximum
11709 alignment (that is, objects with default alignment requirements larger than
11710 this are output potentially unaligned at the next fitting location.
11712 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11713 code that is not binary compatible with code generated without that switch.
11714 Additionally, it makes the code suboptimal.
11715 Use it to conform to a non-default application binary interface.
11717 @item -fleading-underscore
11718 @opindex fleading-underscore
11719 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11720 change the way C symbols are represented in the object file. One use
11721 is to help link with legacy assembly code.
11723 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11724 generate code that is not binary compatible with code generated without that
11725 switch. Use it to conform to a non-default application binary interface.
11726 Not all targets provide complete support for this switch.
11728 @item -ftls-model=@var{model}
11729 @opindex ftls-model
11730 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11731 The @var{model} argument should be one of @samp{global-dynamic},
11732 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
11733 Note that the choice is subject to optimization: the compiler may use
11734 a more efficient model for symbols not visible outside of the translation
11735 unit, or if @option{-fpic} is not given on the command line.
11737 The default without @option{-fpic} is @samp{initial-exec}; with
11738 @option{-fpic} the default is @samp{global-dynamic}.
11740 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
11741 @opindex fvisibility
11742 Set the default ELF image symbol visibility to the specified option---all
11743 symbols are marked with this unless overridden within the code.
11744 Using this feature can very substantially improve linking and
11745 load times of shared object libraries, produce more optimized
11746 code, provide near-perfect API export and prevent symbol clashes.
11747 It is @strong{strongly} recommended that you use this in any shared objects
11750 Despite the nomenclature, @samp{default} always means public; i.e.,
11751 available to be linked against from outside the shared object.
11752 @samp{protected} and @samp{internal} are pretty useless in real-world
11753 usage so the only other commonly used option is @samp{hidden}.
11754 The default if @option{-fvisibility} isn't specified is
11755 @samp{default}, i.e., make every symbol public.
11757 A good explanation of the benefits offered by ensuring ELF
11758 symbols have the correct visibility is given by ``How To Write
11759 Shared Libraries'' by Ulrich Drepper (which can be found at
11760 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
11761 solution made possible by this option to marking things hidden when
11762 the default is public is to make the default hidden and mark things
11763 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
11764 and @code{__attribute__ ((visibility("default")))} instead of
11765 @code{__declspec(dllexport)} you get almost identical semantics with
11766 identical syntax. This is a great boon to those working with
11767 cross-platform projects.
11769 For those adding visibility support to existing code, you may find
11770 @code{#pragma GCC visibility} of use. This works by you enclosing
11771 the declarations you wish to set visibility for with (for example)
11772 @code{#pragma GCC visibility push(hidden)} and
11773 @code{#pragma GCC visibility pop}.
11774 Bear in mind that symbol visibility should be viewed @strong{as
11775 part of the API interface contract} and thus all new code should
11776 always specify visibility when it is not the default; i.e., declarations
11777 only for use within the local DSO should @strong{always} be marked explicitly
11778 as hidden as so to avoid PLT indirection overheads---making this
11779 abundantly clear also aids readability and self-documentation of the code.
11780 Note that due to ISO C++ specification requirements, @code{operator new} and
11781 @code{operator delete} must always be of default visibility.
11783 Be aware that headers from outside your project, in particular system
11784 headers and headers from any other library you use, may not be
11785 expecting to be compiled with visibility other than the default. You
11786 may need to explicitly say @code{#pragma GCC visibility push(default)}
11787 before including any such headers.
11789 @code{extern} declarations are not affected by @option{-fvisibility}, so
11790 a lot of code can be recompiled with @option{-fvisibility=hidden} with
11791 no modifications. However, this means that calls to @code{extern}
11792 functions with no explicit visibility use the PLT, so it is more
11793 effective to use @code{__attribute ((visibility))} and/or
11794 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
11795 declarations should be treated as hidden.
11797 Note that @option{-fvisibility} does affect C++ vague linkage
11798 entities. This means that, for instance, an exception class that is
11799 be thrown between DSOs must be explicitly marked with default
11800 visibility so that the @samp{type_info} nodes are unified between
11803 An overview of these techniques, their benefits and how to use them
11804 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
11806 @item -fstrict-volatile-bitfields
11807 @opindex fstrict-volatile-bitfields
11808 This option should be used if accesses to volatile bit-fields (or other
11809 structure fields, although the compiler usually honors those types
11810 anyway) should use a single access of the width of the
11811 field's type, aligned to a natural alignment if possible. For
11812 example, targets with memory-mapped peripheral registers might require
11813 all such accesses to be 16 bits wide; with this flag you can
11814 declare all peripheral bit-fields as @code{unsigned short} (assuming short
11815 is 16 bits on these targets) to force GCC to use 16-bit accesses
11816 instead of, perhaps, a more efficient 32-bit access.
11818 If this option is disabled, the compiler uses the most efficient
11819 instruction. In the previous example, that might be a 32-bit load
11820 instruction, even though that accesses bytes that do not contain
11821 any portion of the bit-field, or memory-mapped registers unrelated to
11822 the one being updated.
11824 In some cases, such as when the @code{packed} attribute is applied to a
11825 structure field, it may not be possible to access the field with a single
11826 read or write that is correctly aligned for the target machine. In this
11827 case GCC falls back to generating multiple accesses rather than code that
11828 will fault or truncate the result at run time.
11830 Note: Due to restrictions of the C/C++11 memory model, write accesses are
11831 not allowed to touch non bit-field members. It is therefore recommended
11832 to define all bits of the field's type as bit-field members.
11834 The default value of this option is determined by the application binary
11835 interface for the target processor.
11837 @item -fsync-libcalls
11838 @opindex fsync-libcalls
11839 This option controls whether any out-of-line instance of the @code{__sync}
11840 family of functions may be used to implement the C++11 @code{__atomic}
11841 family of functions.
11843 The default value of this option is enabled, thus the only useful form
11844 of the option is @option{-fno-sync-libcalls}. This option is used in
11845 the implementation of the @file{libatomic} runtime library.
11849 @node Developer Options
11850 @section GCC Developer Options
11851 @cindex developer options
11852 @cindex debugging GCC
11853 @cindex debug dump options
11854 @cindex dump options
11855 @cindex compilation statistics
11857 This section describes command-line options that are primarily of
11858 interest to GCC developers, including options to support compiler
11859 testing and investigation of compiler bugs and compile-time
11860 performance problems. This includes options that produce debug dumps
11861 at various points in the compilation; that print statistics such as
11862 memory use and execution time; and that print information about GCC's
11863 configuration, such as where it searches for libraries. You should
11864 rarely need to use any of these options for ordinary compilation and
11869 @item -d@var{letters}
11870 @itemx -fdump-rtl-@var{pass}
11871 @itemx -fdump-rtl-@var{pass}=@var{filename}
11873 @opindex fdump-rtl-@var{pass}
11874 Says to make debugging dumps during compilation at times specified by
11875 @var{letters}. This is used for debugging the RTL-based passes of the
11876 compiler. The file names for most of the dumps are made by appending
11877 a pass number and a word to the @var{dumpname}, and the files are
11878 created in the directory of the output file. In case of
11879 @option{=@var{filename}} option, the dump is output on the given file
11880 instead of the pass numbered dump files. Note that the pass number is
11881 assigned as passes are registered into the pass manager. Most passes
11882 are registered in the order that they will execute and for these passes
11883 the number corresponds to the pass execution order. However, passes
11884 registered by plugins, passes specific to compilation targets, or
11885 passes that are otherwise registered after all the other passes are
11886 numbered higher than a pass named "final", even if they are executed
11887 earlier. @var{dumpname} is generated from the name of the output
11888 file if explicitly specified and not an executable, otherwise it is
11889 the basename of the source file. These switches may have different
11890 effects when @option{-E} is used for preprocessing.
11892 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
11893 @option{-d} option @var{letters}. Here are the possible
11894 letters for use in @var{pass} and @var{letters}, and their meanings:
11898 @item -fdump-rtl-alignments
11899 @opindex fdump-rtl-alignments
11900 Dump after branch alignments have been computed.
11902 @item -fdump-rtl-asmcons
11903 @opindex fdump-rtl-asmcons
11904 Dump after fixing rtl statements that have unsatisfied in/out constraints.
11906 @item -fdump-rtl-auto_inc_dec
11907 @opindex fdump-rtl-auto_inc_dec
11908 Dump after auto-inc-dec discovery. This pass is only run on
11909 architectures that have auto inc or auto dec instructions.
11911 @item -fdump-rtl-barriers
11912 @opindex fdump-rtl-barriers
11913 Dump after cleaning up the barrier instructions.
11915 @item -fdump-rtl-bbpart
11916 @opindex fdump-rtl-bbpart
11917 Dump after partitioning hot and cold basic blocks.
11919 @item -fdump-rtl-bbro
11920 @opindex fdump-rtl-bbro
11921 Dump after block reordering.
11923 @item -fdump-rtl-btl1
11924 @itemx -fdump-rtl-btl2
11925 @opindex fdump-rtl-btl2
11926 @opindex fdump-rtl-btl2
11927 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
11928 after the two branch
11929 target load optimization passes.
11931 @item -fdump-rtl-bypass
11932 @opindex fdump-rtl-bypass
11933 Dump after jump bypassing and control flow optimizations.
11935 @item -fdump-rtl-combine
11936 @opindex fdump-rtl-combine
11937 Dump after the RTL instruction combination pass.
11939 @item -fdump-rtl-compgotos
11940 @opindex fdump-rtl-compgotos
11941 Dump after duplicating the computed gotos.
11943 @item -fdump-rtl-ce1
11944 @itemx -fdump-rtl-ce2
11945 @itemx -fdump-rtl-ce3
11946 @opindex fdump-rtl-ce1
11947 @opindex fdump-rtl-ce2
11948 @opindex fdump-rtl-ce3
11949 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
11950 @option{-fdump-rtl-ce3} enable dumping after the three
11951 if conversion passes.
11953 @item -fdump-rtl-cprop_hardreg
11954 @opindex fdump-rtl-cprop_hardreg
11955 Dump after hard register copy propagation.
11957 @item -fdump-rtl-csa
11958 @opindex fdump-rtl-csa
11959 Dump after combining stack adjustments.
11961 @item -fdump-rtl-cse1
11962 @itemx -fdump-rtl-cse2
11963 @opindex fdump-rtl-cse1
11964 @opindex fdump-rtl-cse2
11965 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
11966 the two common subexpression elimination passes.
11968 @item -fdump-rtl-dce
11969 @opindex fdump-rtl-dce
11970 Dump after the standalone dead code elimination passes.
11972 @item -fdump-rtl-dbr
11973 @opindex fdump-rtl-dbr
11974 Dump after delayed branch scheduling.
11976 @item -fdump-rtl-dce1
11977 @itemx -fdump-rtl-dce2
11978 @opindex fdump-rtl-dce1
11979 @opindex fdump-rtl-dce2
11980 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
11981 the two dead store elimination passes.
11983 @item -fdump-rtl-eh
11984 @opindex fdump-rtl-eh
11985 Dump after finalization of EH handling code.
11987 @item -fdump-rtl-eh_ranges
11988 @opindex fdump-rtl-eh_ranges
11989 Dump after conversion of EH handling range regions.
11991 @item -fdump-rtl-expand
11992 @opindex fdump-rtl-expand
11993 Dump after RTL generation.
11995 @item -fdump-rtl-fwprop1
11996 @itemx -fdump-rtl-fwprop2
11997 @opindex fdump-rtl-fwprop1
11998 @opindex fdump-rtl-fwprop2
11999 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
12000 dumping after the two forward propagation passes.
12002 @item -fdump-rtl-gcse1
12003 @itemx -fdump-rtl-gcse2
12004 @opindex fdump-rtl-gcse1
12005 @opindex fdump-rtl-gcse2
12006 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
12007 after global common subexpression elimination.
12009 @item -fdump-rtl-init-regs
12010 @opindex fdump-rtl-init-regs
12011 Dump after the initialization of the registers.
12013 @item -fdump-rtl-initvals
12014 @opindex fdump-rtl-initvals
12015 Dump after the computation of the initial value sets.
12017 @item -fdump-rtl-into_cfglayout
12018 @opindex fdump-rtl-into_cfglayout
12019 Dump after converting to cfglayout mode.
12021 @item -fdump-rtl-ira
12022 @opindex fdump-rtl-ira
12023 Dump after iterated register allocation.
12025 @item -fdump-rtl-jump
12026 @opindex fdump-rtl-jump
12027 Dump after the second jump optimization.
12029 @item -fdump-rtl-loop2
12030 @opindex fdump-rtl-loop2
12031 @option{-fdump-rtl-loop2} enables dumping after the rtl
12032 loop optimization passes.
12034 @item -fdump-rtl-mach
12035 @opindex fdump-rtl-mach
12036 Dump after performing the machine dependent reorganization pass, if that
12039 @item -fdump-rtl-mode_sw
12040 @opindex fdump-rtl-mode_sw
12041 Dump after removing redundant mode switches.
12043 @item -fdump-rtl-rnreg
12044 @opindex fdump-rtl-rnreg
12045 Dump after register renumbering.
12047 @item -fdump-rtl-outof_cfglayout
12048 @opindex fdump-rtl-outof_cfglayout
12049 Dump after converting from cfglayout mode.
12051 @item -fdump-rtl-peephole2
12052 @opindex fdump-rtl-peephole2
12053 Dump after the peephole pass.
12055 @item -fdump-rtl-postreload
12056 @opindex fdump-rtl-postreload
12057 Dump after post-reload optimizations.
12059 @item -fdump-rtl-pro_and_epilogue
12060 @opindex fdump-rtl-pro_and_epilogue
12061 Dump after generating the function prologues and epilogues.
12063 @item -fdump-rtl-sched1
12064 @itemx -fdump-rtl-sched2
12065 @opindex fdump-rtl-sched1
12066 @opindex fdump-rtl-sched2
12067 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
12068 after the basic block scheduling passes.
12070 @item -fdump-rtl-ree
12071 @opindex fdump-rtl-ree
12072 Dump after sign/zero extension elimination.
12074 @item -fdump-rtl-seqabstr
12075 @opindex fdump-rtl-seqabstr
12076 Dump after common sequence discovery.
12078 @item -fdump-rtl-shorten
12079 @opindex fdump-rtl-shorten
12080 Dump after shortening branches.
12082 @item -fdump-rtl-sibling
12083 @opindex fdump-rtl-sibling
12084 Dump after sibling call optimizations.
12086 @item -fdump-rtl-split1
12087 @itemx -fdump-rtl-split2
12088 @itemx -fdump-rtl-split3
12089 @itemx -fdump-rtl-split4
12090 @itemx -fdump-rtl-split5
12091 @opindex fdump-rtl-split1
12092 @opindex fdump-rtl-split2
12093 @opindex fdump-rtl-split3
12094 @opindex fdump-rtl-split4
12095 @opindex fdump-rtl-split5
12096 These options enable dumping after five rounds of
12097 instruction splitting.
12099 @item -fdump-rtl-sms
12100 @opindex fdump-rtl-sms
12101 Dump after modulo scheduling. This pass is only run on some
12104 @item -fdump-rtl-stack
12105 @opindex fdump-rtl-stack
12106 Dump after conversion from GCC's ``flat register file'' registers to the
12107 x87's stack-like registers. This pass is only run on x86 variants.
12109 @item -fdump-rtl-subreg1
12110 @itemx -fdump-rtl-subreg2
12111 @opindex fdump-rtl-subreg1
12112 @opindex fdump-rtl-subreg2
12113 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
12114 the two subreg expansion passes.
12116 @item -fdump-rtl-unshare
12117 @opindex fdump-rtl-unshare
12118 Dump after all rtl has been unshared.
12120 @item -fdump-rtl-vartrack
12121 @opindex fdump-rtl-vartrack
12122 Dump after variable tracking.
12124 @item -fdump-rtl-vregs
12125 @opindex fdump-rtl-vregs
12126 Dump after converting virtual registers to hard registers.
12128 @item -fdump-rtl-web
12129 @opindex fdump-rtl-web
12130 Dump after live range splitting.
12132 @item -fdump-rtl-regclass
12133 @itemx -fdump-rtl-subregs_of_mode_init
12134 @itemx -fdump-rtl-subregs_of_mode_finish
12135 @itemx -fdump-rtl-dfinit
12136 @itemx -fdump-rtl-dfinish
12137 @opindex fdump-rtl-regclass
12138 @opindex fdump-rtl-subregs_of_mode_init
12139 @opindex fdump-rtl-subregs_of_mode_finish
12140 @opindex fdump-rtl-dfinit
12141 @opindex fdump-rtl-dfinish
12142 These dumps are defined but always produce empty files.
12145 @itemx -fdump-rtl-all
12147 @opindex fdump-rtl-all
12148 Produce all the dumps listed above.
12152 Annotate the assembler output with miscellaneous debugging information.
12156 Dump all macro definitions, at the end of preprocessing, in addition to
12161 Produce a core dump whenever an error occurs.
12165 Annotate the assembler output with a comment indicating which
12166 pattern and alternative is used. The length of each instruction is
12171 Dump the RTL in the assembler output as a comment before each instruction.
12172 Also turns on @option{-dp} annotation.
12176 Just generate RTL for a function instead of compiling it. Usually used
12177 with @option{-fdump-rtl-expand}.
12180 @item -fdump-noaddr
12181 @opindex fdump-noaddr
12182 When doing debugging dumps, suppress address output. This makes it more
12183 feasible to use diff on debugging dumps for compiler invocations with
12184 different compiler binaries and/or different
12185 text / bss / data / heap / stack / dso start locations.
12188 @opindex freport-bug
12189 Collect and dump debug information into a temporary file if an
12190 internal compiler error (ICE) occurs.
12192 @item -fdump-unnumbered
12193 @opindex fdump-unnumbered
12194 When doing debugging dumps, suppress instruction numbers and address output.
12195 This makes it more feasible to use diff on debugging dumps for compiler
12196 invocations with different options, in particular with and without
12199 @item -fdump-unnumbered-links
12200 @opindex fdump-unnumbered-links
12201 When doing debugging dumps (see @option{-d} option above), suppress
12202 instruction numbers for the links to the previous and next instructions
12205 @item -fdump-translation-unit @r{(C++ only)}
12206 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
12207 @opindex fdump-translation-unit
12208 Dump a representation of the tree structure for the entire translation
12209 unit to a file. The file name is made by appending @file{.tu} to the
12210 source file name, and the file is created in the same directory as the
12211 output file. If the @samp{-@var{options}} form is used, @var{options}
12212 controls the details of the dump as described for the
12213 @option{-fdump-tree} options.
12215 @item -fdump-class-hierarchy @r{(C++ only)}
12216 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
12217 @opindex fdump-class-hierarchy
12218 Dump a representation of each class's hierarchy and virtual function
12219 table layout to a file. The file name is made by appending
12220 @file{.class} to the source file name, and the file is created in the
12221 same directory as the output file. If the @samp{-@var{options}} form
12222 is used, @var{options} controls the details of the dump as described
12223 for the @option{-fdump-tree} options.
12225 @item -fdump-ipa-@var{switch}
12227 Control the dumping at various stages of inter-procedural analysis
12228 language tree to a file. The file name is generated by appending a
12229 switch specific suffix to the source file name, and the file is created
12230 in the same directory as the output file. The following dumps are
12235 Enables all inter-procedural analysis dumps.
12238 Dumps information about call-graph optimization, unused function removal,
12239 and inlining decisions.
12242 Dump after function inlining.
12246 @item -fdump-passes
12247 @opindex fdump-passes
12248 Dump the list of optimization passes that are turned on and off by
12249 the current command-line options.
12251 @item -fdump-statistics-@var{option}
12252 @opindex fdump-statistics
12253 Enable and control dumping of pass statistics in a separate file. The
12254 file name is generated by appending a suffix ending in
12255 @samp{.statistics} to the source file name, and the file is created in
12256 the same directory as the output file. If the @samp{-@var{option}}
12257 form is used, @samp{-stats} causes counters to be summed over the
12258 whole compilation unit while @samp{-details} dumps every event as
12259 the passes generate them. The default with no option is to sum
12260 counters for each function compiled.
12262 @item -fdump-tree-@var{switch}
12263 @itemx -fdump-tree-@var{switch}-@var{options}
12264 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
12265 @opindex fdump-tree
12266 Control the dumping at various stages of processing the intermediate
12267 language tree to a file. The file name is generated by appending a
12268 switch-specific suffix to the source file name, and the file is
12269 created in the same directory as the output file. In case of
12270 @option{=@var{filename}} option, the dump is output on the given file
12271 instead of the auto named dump files. If the @samp{-@var{options}}
12272 form is used, @var{options} is a list of @samp{-} separated options
12273 which control the details of the dump. Not all options are applicable
12274 to all dumps; those that are not meaningful are ignored. The
12275 following options are available
12279 Print the address of each node. Usually this is not meaningful as it
12280 changes according to the environment and source file. Its primary use
12281 is for tying up a dump file with a debug environment.
12283 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
12284 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
12285 use working backward from mangled names in the assembly file.
12287 When dumping front-end intermediate representations, inhibit dumping
12288 of members of a scope or body of a function merely because that scope
12289 has been reached. Only dump such items when they are directly reachable
12290 by some other path.
12292 When dumping pretty-printed trees, this option inhibits dumping the
12293 bodies of control structures.
12295 When dumping RTL, print the RTL in slim (condensed) form instead of
12296 the default LISP-like representation.
12298 Print a raw representation of the tree. By default, trees are
12299 pretty-printed into a C-like representation.
12301 Enable more detailed dumps (not honored by every dump option). Also
12302 include information from the optimization passes.
12304 Enable dumping various statistics about the pass (not honored by every dump
12307 Enable showing basic block boundaries (disabled in raw dumps).
12309 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
12310 dump a representation of the control flow graph suitable for viewing with
12311 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
12312 the file is pretty-printed as a subgraph, so that GraphViz can render them
12313 all in a single plot.
12315 This option currently only works for RTL dumps, and the RTL is always
12316 dumped in slim form.
12318 Enable showing virtual operands for every statement.
12320 Enable showing line numbers for statements.
12322 Enable showing the unique ID (@code{DECL_UID}) for each variable.
12324 Enable showing the tree dump for each statement.
12326 Enable showing the EH region number holding each statement.
12328 Enable showing scalar evolution analysis details.
12330 Enable showing optimization information (only available in certain
12333 Enable showing missed optimization information (only available in certain
12336 Enable other detailed optimization information (only available in
12338 @item =@var{filename}
12339 Instead of an auto named dump file, output into the given file
12340 name. The file names @file{stdout} and @file{stderr} are treated
12341 specially and are considered already open standard streams. For
12345 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
12346 -fdump-tree-pre=stderr file.c
12349 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
12350 output on to @file{stderr}. If two conflicting dump filenames are
12351 given for the same pass, then the latter option overrides the earlier
12355 @opindex fdump-tree-split-paths
12356 Dump each function after splitting paths to loop backedges. The file
12357 name is made by appending @file{.split-paths} to the source file name.
12360 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
12361 and @option{lineno}.
12364 Turn on all optimization options, i.e., @option{optimized},
12365 @option{missed}, and @option{note}.
12368 The following tree dumps are possible:
12372 @opindex fdump-tree-original
12373 Dump before any tree based optimization, to @file{@var{file}.original}.
12376 @opindex fdump-tree-optimized
12377 Dump after all tree based optimization, to @file{@var{file}.optimized}.
12380 @opindex fdump-tree-gimple
12381 Dump each function before and after the gimplification pass to a file. The
12382 file name is made by appending @file{.gimple} to the source file name.
12385 @opindex fdump-tree-cfg
12386 Dump the control flow graph of each function to a file. The file name is
12387 made by appending @file{.cfg} to the source file name.
12390 @opindex fdump-tree-ch
12391 Dump each function after copying loop headers. The file name is made by
12392 appending @file{.ch} to the source file name.
12395 @opindex fdump-tree-ssa
12396 Dump SSA related information to a file. The file name is made by appending
12397 @file{.ssa} to the source file name.
12400 @opindex fdump-tree-alias
12401 Dump aliasing information for each function. The file name is made by
12402 appending @file{.alias} to the source file name.
12405 @opindex fdump-tree-ccp
12406 Dump each function after CCP@. The file name is made by appending
12407 @file{.ccp} to the source file name.
12410 @opindex fdump-tree-storeccp
12411 Dump each function after STORE-CCP@. The file name is made by appending
12412 @file{.storeccp} to the source file name.
12415 @opindex fdump-tree-pre
12416 Dump trees after partial redundancy elimination and/or code hoisting.
12417 The file name is made by appending @file{.pre} to the source file name.
12420 @opindex fdump-tree-fre
12421 Dump trees after full redundancy elimination. The file name is made
12422 by appending @file{.fre} to the source file name.
12425 @opindex fdump-tree-copyprop
12426 Dump trees after copy propagation. The file name is made
12427 by appending @file{.copyprop} to the source file name.
12429 @item store_copyprop
12430 @opindex fdump-tree-store_copyprop
12431 Dump trees after store copy-propagation. The file name is made
12432 by appending @file{.store_copyprop} to the source file name.
12435 @opindex fdump-tree-dce
12436 Dump each function after dead code elimination. The file name is made by
12437 appending @file{.dce} to the source file name.
12440 @opindex fdump-tree-sra
12441 Dump each function after performing scalar replacement of aggregates. The
12442 file name is made by appending @file{.sra} to the source file name.
12445 @opindex fdump-tree-sink
12446 Dump each function after performing code sinking. The file name is made
12447 by appending @file{.sink} to the source file name.
12450 @opindex fdump-tree-dom
12451 Dump each function after applying dominator tree optimizations. The file
12452 name is made by appending @file{.dom} to the source file name.
12455 @opindex fdump-tree-dse
12456 Dump each function after applying dead store elimination. The file
12457 name is made by appending @file{.dse} to the source file name.
12460 @opindex fdump-tree-phiopt
12461 Dump each function after optimizing PHI nodes into straightline code. The file
12462 name is made by appending @file{.phiopt} to the source file name.
12465 @opindex fdump-tree-backprop
12466 Dump each function after back-propagating use information up the definition
12467 chain. The file name is made by appending @file{.backprop} to the
12471 @opindex fdump-tree-forwprop
12472 Dump each function after forward propagating single use variables. The file
12473 name is made by appending @file{.forwprop} to the source file name.
12476 @opindex fdump-tree-nrv
12477 Dump each function after applying the named return value optimization on
12478 generic trees. The file name is made by appending @file{.nrv} to the source
12482 @opindex fdump-tree-vect
12483 Dump each function after applying vectorization of loops. The file name is
12484 made by appending @file{.vect} to the source file name.
12487 @opindex fdump-tree-slp
12488 Dump each function after applying vectorization of basic blocks. The file name
12489 is made by appending @file{.slp} to the source file name.
12492 @opindex fdump-tree-vrp
12493 Dump each function after Value Range Propagation (VRP). The file name
12494 is made by appending @file{.vrp} to the source file name.
12497 @opindex fdump-tree-oaccdevlow
12498 Dump each function after applying device-specific OpenACC transformations.
12499 The file name is made by appending @file{.oaccdevlow} to the source file name.
12502 @opindex fdump-tree-all
12503 Enable all the available tree dumps with the flags provided in this option.
12507 @itemx -fopt-info-@var{options}
12508 @itemx -fopt-info-@var{options}=@var{filename}
12510 Controls optimization dumps from various optimization passes. If the
12511 @samp{-@var{options}} form is used, @var{options} is a list of
12512 @samp{-} separated option keywords to select the dump details and
12515 The @var{options} can be divided into two groups: options describing the
12516 verbosity of the dump, and options describing which optimizations
12517 should be included. The options from both the groups can be freely
12518 mixed as they are non-overlapping. However, in case of any conflicts,
12519 the later options override the earlier options on the command
12522 The following options control the dump verbosity:
12526 Print information when an optimization is successfully applied. It is
12527 up to a pass to decide which information is relevant. For example, the
12528 vectorizer passes print the source location of loops which are
12529 successfully vectorized.
12531 Print information about missed optimizations. Individual passes
12532 control which information to include in the output.
12534 Print verbose information about optimizations, such as certain
12535 transformations, more detailed messages about decisions etc.
12537 Print detailed optimization information. This includes
12538 @samp{optimized}, @samp{missed}, and @samp{note}.
12541 One or more of the following option keywords can be used to describe a
12542 group of optimizations:
12546 Enable dumps from all interprocedural optimizations.
12548 Enable dumps from all loop optimizations.
12550 Enable dumps from all inlining optimizations.
12552 Enable dumps from all vectorization optimizations.
12554 Enable dumps from all optimizations. This is a superset of
12555 the optimization groups listed above.
12558 If @var{options} is
12559 omitted, it defaults to @samp{optimized-optall}, which means to dump all
12560 info about successful optimizations from all the passes.
12562 If the @var{filename} is provided, then the dumps from all the
12563 applicable optimizations are concatenated into the @var{filename}.
12564 Otherwise the dump is output onto @file{stderr}. Though multiple
12565 @option{-fopt-info} options are accepted, only one of them can include
12566 a @var{filename}. If other filenames are provided then all but the
12567 first such option are ignored.
12569 Note that the output @var{filename} is overwritten
12570 in case of multiple translation units. If a combined output from
12571 multiple translation units is desired, @file{stderr} should be used
12574 In the following example, the optimization info is output to
12583 gcc -O3 -fopt-info-missed=missed.all
12587 outputs missed optimization report from all the passes into
12588 @file{missed.all}, and this one:
12591 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
12595 prints information about missed optimization opportunities from
12596 vectorization passes on @file{stderr}.
12597 Note that @option{-fopt-info-vec-missed} is equivalent to
12598 @option{-fopt-info-missed-vec}.
12600 As another example,
12602 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
12606 outputs information about missed optimizations as well as
12607 optimized locations from all the inlining passes into
12613 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
12617 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
12618 in conflict since only one output file is allowed. In this case, only
12619 the first option takes effect and the subsequent options are
12620 ignored. Thus only @file{vec.miss} is produced which contains
12621 dumps from the vectorizer about missed opportunities.
12623 @item -fsched-verbose=@var{n}
12624 @opindex fsched-verbose
12625 On targets that use instruction scheduling, this option controls the
12626 amount of debugging output the scheduler prints to the dump files.
12628 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
12629 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
12630 For @var{n} greater than one, it also output basic block probabilities,
12631 detailed ready list information and unit/insn info. For @var{n} greater
12632 than two, it includes RTL at abort point, control-flow and regions info.
12633 And for @var{n} over four, @option{-fsched-verbose} also includes
12638 @item -fenable-@var{kind}-@var{pass}
12639 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
12643 This is a set of options that are used to explicitly disable/enable
12644 optimization passes. These options are intended for use for debugging GCC.
12645 Compiler users should use regular options for enabling/disabling
12650 @item -fdisable-ipa-@var{pass}
12651 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12652 statically invoked in the compiler multiple times, the pass name should be
12653 appended with a sequential number starting from 1.
12655 @item -fdisable-rtl-@var{pass}
12656 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
12657 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
12658 statically invoked in the compiler multiple times, the pass name should be
12659 appended with a sequential number starting from 1. @var{range-list} is a
12660 comma-separated list of function ranges or assembler names. Each range is a number
12661 pair separated by a colon. The range is inclusive in both ends. If the range
12662 is trivial, the number pair can be simplified as a single number. If the
12663 function's call graph node's @var{uid} falls within one of the specified ranges,
12664 the @var{pass} is disabled for that function. The @var{uid} is shown in the
12665 function header of a dump file, and the pass names can be dumped by using
12666 option @option{-fdump-passes}.
12668 @item -fdisable-tree-@var{pass}
12669 @itemx -fdisable-tree-@var{pass}=@var{range-list}
12670 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
12673 @item -fenable-ipa-@var{pass}
12674 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12675 statically invoked in the compiler multiple times, the pass name should be
12676 appended with a sequential number starting from 1.
12678 @item -fenable-rtl-@var{pass}
12679 @itemx -fenable-rtl-@var{pass}=@var{range-list}
12680 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
12681 description and examples.
12683 @item -fenable-tree-@var{pass}
12684 @itemx -fenable-tree-@var{pass}=@var{range-list}
12685 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
12686 of option arguments.
12690 Here are some examples showing uses of these options.
12694 # disable ccp1 for all functions
12695 -fdisable-tree-ccp1
12696 # disable complete unroll for function whose cgraph node uid is 1
12697 -fenable-tree-cunroll=1
12698 # disable gcse2 for functions at the following ranges [1,1],
12699 # [300,400], and [400,1000]
12700 # disable gcse2 for functions foo and foo2
12701 -fdisable-rtl-gcse2=foo,foo2
12702 # disable early inlining
12703 -fdisable-tree-einline
12704 # disable ipa inlining
12705 -fdisable-ipa-inline
12706 # enable tree full unroll
12707 -fenable-tree-unroll
12712 @itemx -fchecking=@var{n}
12714 @opindex fno-checking
12715 Enable internal consistency checking. The default depends on
12716 the compiler configuration. @option{-fchecking=2} enables further
12717 internal consistency checking that might affect code generation.
12719 @item -frandom-seed=@var{string}
12720 @opindex frandom-seed
12721 This option provides a seed that GCC uses in place of
12722 random numbers in generating certain symbol names
12723 that have to be different in every compiled file. It is also used to
12724 place unique stamps in coverage data files and the object files that
12725 produce them. You can use the @option{-frandom-seed} option to produce
12726 reproducibly identical object files.
12728 The @var{string} can either be a number (decimal, octal or hex) or an
12729 arbitrary string (in which case it's converted to a number by
12732 The @var{string} should be different for every file you compile.
12735 @itemx -save-temps=cwd
12736 @opindex save-temps
12737 Store the usual ``temporary'' intermediate files permanently; place them
12738 in the current directory and name them based on the source file. Thus,
12739 compiling @file{foo.c} with @option{-c -save-temps} produces files
12740 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
12741 preprocessed @file{foo.i} output file even though the compiler now
12742 normally uses an integrated preprocessor.
12744 When used in combination with the @option{-x} command-line option,
12745 @option{-save-temps} is sensible enough to avoid over writing an
12746 input source file with the same extension as an intermediate file.
12747 The corresponding intermediate file may be obtained by renaming the
12748 source file before using @option{-save-temps}.
12750 If you invoke GCC in parallel, compiling several different source
12751 files that share a common base name in different subdirectories or the
12752 same source file compiled for multiple output destinations, it is
12753 likely that the different parallel compilers will interfere with each
12754 other, and overwrite the temporary files. For instance:
12757 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
12758 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
12761 may result in @file{foo.i} and @file{foo.o} being written to
12762 simultaneously by both compilers.
12764 @item -save-temps=obj
12765 @opindex save-temps=obj
12766 Store the usual ``temporary'' intermediate files permanently. If the
12767 @option{-o} option is used, the temporary files are based on the
12768 object file. If the @option{-o} option is not used, the
12769 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
12774 gcc -save-temps=obj -c foo.c
12775 gcc -save-temps=obj -c bar.c -o dir/xbar.o
12776 gcc -save-temps=obj foobar.c -o dir2/yfoobar
12780 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
12781 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
12782 @file{dir2/yfoobar.o}.
12784 @item -time@r{[}=@var{file}@r{]}
12786 Report the CPU time taken by each subprocess in the compilation
12787 sequence. For C source files, this is the compiler proper and assembler
12788 (plus the linker if linking is done).
12790 Without the specification of an output file, the output looks like this:
12797 The first number on each line is the ``user time'', that is time spent
12798 executing the program itself. The second number is ``system time'',
12799 time spent executing operating system routines on behalf of the program.
12800 Both numbers are in seconds.
12802 With the specification of an output file, the output is appended to the
12803 named file, and it looks like this:
12806 0.12 0.01 cc1 @var{options}
12807 0.00 0.01 as @var{options}
12810 The ``user time'' and the ``system time'' are moved before the program
12811 name, and the options passed to the program are displayed, so that one
12812 can later tell what file was being compiled, and with which options.
12814 @item -fdump-final-insns@r{[}=@var{file}@r{]}
12815 @opindex fdump-final-insns
12816 Dump the final internal representation (RTL) to @var{file}. If the
12817 optional argument is omitted (or if @var{file} is @code{.}), the name
12818 of the dump file is determined by appending @code{.gkd} to the
12819 compilation output file name.
12821 @item -fcompare-debug@r{[}=@var{opts}@r{]}
12822 @opindex fcompare-debug
12823 @opindex fno-compare-debug
12824 If no error occurs during compilation, run the compiler a second time,
12825 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
12826 passed to the second compilation. Dump the final internal
12827 representation in both compilations, and print an error if they differ.
12829 If the equal sign is omitted, the default @option{-gtoggle} is used.
12831 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
12832 and nonzero, implicitly enables @option{-fcompare-debug}. If
12833 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
12834 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
12837 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
12838 is equivalent to @option{-fno-compare-debug}, which disables the dumping
12839 of the final representation and the second compilation, preventing even
12840 @env{GCC_COMPARE_DEBUG} from taking effect.
12842 To verify full coverage during @option{-fcompare-debug} testing, set
12843 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
12844 which GCC rejects as an invalid option in any actual compilation
12845 (rather than preprocessing, assembly or linking). To get just a
12846 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
12847 not overridden} will do.
12849 @item -fcompare-debug-second
12850 @opindex fcompare-debug-second
12851 This option is implicitly passed to the compiler for the second
12852 compilation requested by @option{-fcompare-debug}, along with options to
12853 silence warnings, and omitting other options that would cause
12854 side-effect compiler outputs to files or to the standard output. Dump
12855 files and preserved temporary files are renamed so as to contain the
12856 @code{.gk} additional extension during the second compilation, to avoid
12857 overwriting those generated by the first.
12859 When this option is passed to the compiler driver, it causes the
12860 @emph{first} compilation to be skipped, which makes it useful for little
12861 other than debugging the compiler proper.
12865 Turn off generation of debug info, if leaving out this option
12866 generates it, or turn it on at level 2 otherwise. The position of this
12867 argument in the command line does not matter; it takes effect after all
12868 other options are processed, and it does so only once, no matter how
12869 many times it is given. This is mainly intended to be used with
12870 @option{-fcompare-debug}.
12872 @item -fvar-tracking-assignments-toggle
12873 @opindex fvar-tracking-assignments-toggle
12874 @opindex fno-var-tracking-assignments-toggle
12875 Toggle @option{-fvar-tracking-assignments}, in the same way that
12876 @option{-gtoggle} toggles @option{-g}.
12880 Makes the compiler print out each function name as it is compiled, and
12881 print some statistics about each pass when it finishes.
12883 @item -ftime-report
12884 @opindex ftime-report
12885 Makes the compiler print some statistics about the time consumed by each
12886 pass when it finishes.
12888 @item -ftime-report-details
12889 @opindex ftime-report-details
12890 Record the time consumed by infrastructure parts separately for each pass.
12892 @item -fira-verbose=@var{n}
12893 @opindex fira-verbose
12894 Control the verbosity of the dump file for the integrated register allocator.
12895 The default value is 5. If the value @var{n} is greater or equal to 10,
12896 the dump output is sent to stderr using the same format as @var{n} minus 10.
12899 @opindex flto-report
12900 Prints a report with internal details on the workings of the link-time
12901 optimizer. The contents of this report vary from version to version.
12902 It is meant to be useful to GCC developers when processing object
12903 files in LTO mode (via @option{-flto}).
12905 Disabled by default.
12907 @item -flto-report-wpa
12908 @opindex flto-report-wpa
12909 Like @option{-flto-report}, but only print for the WPA phase of Link
12913 @opindex fmem-report
12914 Makes the compiler print some statistics about permanent memory
12915 allocation when it finishes.
12917 @item -fmem-report-wpa
12918 @opindex fmem-report-wpa
12919 Makes the compiler print some statistics about permanent memory
12920 allocation for the WPA phase only.
12922 @item -fpre-ipa-mem-report
12923 @opindex fpre-ipa-mem-report
12924 @item -fpost-ipa-mem-report
12925 @opindex fpost-ipa-mem-report
12926 Makes the compiler print some statistics about permanent memory
12927 allocation before or after interprocedural optimization.
12929 @item -fprofile-report
12930 @opindex fprofile-report
12931 Makes the compiler print some statistics about consistency of the
12932 (estimated) profile and effect of individual passes.
12934 @item -fstack-usage
12935 @opindex fstack-usage
12936 Makes the compiler output stack usage information for the program, on a
12937 per-function basis. The filename for the dump is made by appending
12938 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
12939 the output file, if explicitly specified and it is not an executable,
12940 otherwise it is the basename of the source file. An entry is made up
12945 The name of the function.
12949 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
12952 The qualifier @code{static} means that the function manipulates the stack
12953 statically: a fixed number of bytes are allocated for the frame on function
12954 entry and released on function exit; no stack adjustments are otherwise made
12955 in the function. The second field is this fixed number of bytes.
12957 The qualifier @code{dynamic} means that the function manipulates the stack
12958 dynamically: in addition to the static allocation described above, stack
12959 adjustments are made in the body of the function, for example to push/pop
12960 arguments around function calls. If the qualifier @code{bounded} is also
12961 present, the amount of these adjustments is bounded at compile time and
12962 the second field is an upper bound of the total amount of stack used by
12963 the function. If it is not present, the amount of these adjustments is
12964 not bounded at compile time and the second field only represents the
12969 Emit statistics about front-end processing at the end of the compilation.
12970 This option is supported only by the C++ front end, and
12971 the information is generally only useful to the G++ development team.
12973 @item -fdbg-cnt-list
12974 @opindex fdbg-cnt-list
12975 Print the name and the counter upper bound for all debug counters.
12978 @item -fdbg-cnt=@var{counter-value-list}
12980 Set the internal debug counter upper bound. @var{counter-value-list}
12981 is a comma-separated list of @var{name}:@var{value} pairs
12982 which sets the upper bound of each debug counter @var{name} to @var{value}.
12983 All debug counters have the initial upper bound of @code{UINT_MAX};
12984 thus @code{dbg_cnt} returns true always unless the upper bound
12985 is set by this option.
12986 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
12987 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
12989 @item -print-file-name=@var{library}
12990 @opindex print-file-name
12991 Print the full absolute name of the library file @var{library} that
12992 would be used when linking---and don't do anything else. With this
12993 option, GCC does not compile or link anything; it just prints the
12996 @item -print-multi-directory
12997 @opindex print-multi-directory
12998 Print the directory name corresponding to the multilib selected by any
12999 other switches present in the command line. This directory is supposed
13000 to exist in @env{GCC_EXEC_PREFIX}.
13002 @item -print-multi-lib
13003 @opindex print-multi-lib
13004 Print the mapping from multilib directory names to compiler switches
13005 that enable them. The directory name is separated from the switches by
13006 @samp{;}, and each switch starts with an @samp{@@} instead of the
13007 @samp{-}, without spaces between multiple switches. This is supposed to
13008 ease shell processing.
13010 @item -print-multi-os-directory
13011 @opindex print-multi-os-directory
13012 Print the path to OS libraries for the selected
13013 multilib, relative to some @file{lib} subdirectory. If OS libraries are
13014 present in the @file{lib} subdirectory and no multilibs are used, this is
13015 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
13016 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
13017 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
13018 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
13020 @item -print-multiarch
13021 @opindex print-multiarch
13022 Print the path to OS libraries for the selected multiarch,
13023 relative to some @file{lib} subdirectory.
13025 @item -print-prog-name=@var{program}
13026 @opindex print-prog-name
13027 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
13029 @item -print-libgcc-file-name
13030 @opindex print-libgcc-file-name
13031 Same as @option{-print-file-name=libgcc.a}.
13033 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
13034 but you do want to link with @file{libgcc.a}. You can do:
13037 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
13040 @item -print-search-dirs
13041 @opindex print-search-dirs
13042 Print the name of the configured installation directory and a list of
13043 program and library directories @command{gcc} searches---and don't do anything else.
13045 This is useful when @command{gcc} prints the error message
13046 @samp{installation problem, cannot exec cpp0: No such file or directory}.
13047 To resolve this you either need to put @file{cpp0} and the other compiler
13048 components where @command{gcc} expects to find them, or you can set the environment
13049 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
13050 Don't forget the trailing @samp{/}.
13051 @xref{Environment Variables}.
13053 @item -print-sysroot
13054 @opindex print-sysroot
13055 Print the target sysroot directory that is used during
13056 compilation. This is the target sysroot specified either at configure
13057 time or using the @option{--sysroot} option, possibly with an extra
13058 suffix that depends on compilation options. If no target sysroot is
13059 specified, the option prints nothing.
13061 @item -print-sysroot-headers-suffix
13062 @opindex print-sysroot-headers-suffix
13063 Print the suffix added to the target sysroot when searching for
13064 headers, or give an error if the compiler is not configured with such
13065 a suffix---and don't do anything else.
13068 @opindex dumpmachine
13069 Print the compiler's target machine (for example,
13070 @samp{i686-pc-linux-gnu})---and don't do anything else.
13073 @opindex dumpversion
13074 Print the compiler version (for example, @code{3.0})---and don't do
13079 Print the compiler's built-in specs---and don't do anything else. (This
13080 is used when GCC itself is being built.) @xref{Spec Files}.
13083 @node Submodel Options
13084 @section Machine-Dependent Options
13085 @cindex submodel options
13086 @cindex specifying hardware config
13087 @cindex hardware models and configurations, specifying
13088 @cindex target-dependent options
13089 @cindex machine-dependent options
13091 Each target machine supported by GCC can have its own options---for
13092 example, to allow you to compile for a particular processor variant or
13093 ABI, or to control optimizations specific to that machine. By
13094 convention, the names of machine-specific options start with
13097 Some configurations of the compiler also support additional target-specific
13098 options, usually for compatibility with other compilers on the same
13101 @c This list is ordered alphanumerically by subsection name.
13102 @c It should be the same order and spelling as these options are listed
13103 @c in Machine Dependent Options
13106 * AArch64 Options::
13107 * Adapteva Epiphany Options::
13111 * Blackfin Options::
13116 * DEC Alpha Options::
13120 * GNU/Linux Options::
13130 * MicroBlaze Options::
13133 * MN10300 Options::
13137 * Nios II Options::
13138 * Nvidia PTX Options::
13140 * picoChip Options::
13141 * PowerPC Options::
13143 * RS/6000 and PowerPC Options::
13145 * S/390 and zSeries Options::
13148 * Solaris 2 Options::
13151 * System V Options::
13152 * TILE-Gx Options::
13153 * TILEPro Options::
13158 * VxWorks Options::
13160 * x86 Windows Options::
13161 * Xstormy16 Options::
13163 * zSeries Options::
13166 @node AArch64 Options
13167 @subsection AArch64 Options
13168 @cindex AArch64 Options
13170 These options are defined for AArch64 implementations:
13174 @item -mabi=@var{name}
13176 Generate code for the specified data model. Permissible values
13177 are @samp{ilp32} for SysV-like data model where int, long int and pointers
13178 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
13179 but long int and pointers are 64 bits.
13181 The default depends on the specific target configuration. Note that
13182 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
13183 entire program with the same ABI, and link with a compatible set of libraries.
13186 @opindex mbig-endian
13187 Generate big-endian code. This is the default when GCC is configured for an
13188 @samp{aarch64_be-*-*} target.
13190 @item -mgeneral-regs-only
13191 @opindex mgeneral-regs-only
13192 Generate code which uses only the general-purpose registers. This will prevent
13193 the compiler from using floating-point and Advanced SIMD registers but will not
13194 impose any restrictions on the assembler.
13196 @item -mlittle-endian
13197 @opindex mlittle-endian
13198 Generate little-endian code. This is the default when GCC is configured for an
13199 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
13201 @item -mcmodel=tiny
13202 @opindex mcmodel=tiny
13203 Generate code for the tiny code model. The program and its statically defined
13204 symbols must be within 1MB of each other. Programs can be statically or
13205 dynamically linked.
13207 @item -mcmodel=small
13208 @opindex mcmodel=small
13209 Generate code for the small code model. The program and its statically defined
13210 symbols must be within 4GB of each other. Programs can be statically or
13211 dynamically linked. This is the default code model.
13213 @item -mcmodel=large
13214 @opindex mcmodel=large
13215 Generate code for the large code model. This makes no assumptions about
13216 addresses and sizes of sections. Programs can be statically linked only.
13218 @item -mstrict-align
13219 @opindex mstrict-align
13220 Avoid generating memory accesses that may not be aligned on a natural object
13221 boundary as described in the architecture specification.
13223 @item -momit-leaf-frame-pointer
13224 @itemx -mno-omit-leaf-frame-pointer
13225 @opindex momit-leaf-frame-pointer
13226 @opindex mno-omit-leaf-frame-pointer
13227 Omit or keep the frame pointer in leaf functions. The former behavior is the
13230 @item -mtls-dialect=desc
13231 @opindex mtls-dialect=desc
13232 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
13233 of TLS variables. This is the default.
13235 @item -mtls-dialect=traditional
13236 @opindex mtls-dialect=traditional
13237 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
13240 @item -mtls-size=@var{size}
13242 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
13243 This option requires binutils 2.26 or newer.
13245 @item -mfix-cortex-a53-835769
13246 @itemx -mno-fix-cortex-a53-835769
13247 @opindex mfix-cortex-a53-835769
13248 @opindex mno-fix-cortex-a53-835769
13249 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
13250 This involves inserting a NOP instruction between memory instructions and
13251 64-bit integer multiply-accumulate instructions.
13253 @item -mfix-cortex-a53-843419
13254 @itemx -mno-fix-cortex-a53-843419
13255 @opindex mfix-cortex-a53-843419
13256 @opindex mno-fix-cortex-a53-843419
13257 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
13258 This erratum workaround is made at link time and this will only pass the
13259 corresponding flag to the linker.
13261 @item -mlow-precision-recip-sqrt
13262 @item -mno-low-precision-recip-sqrt
13263 @opindex mlow-precision-recip-sqrt
13264 @opindex mno-low-precision-recip-sqrt
13265 Enable or disable the reciprocal square root approximation.
13266 This option only has an effect if @option{-ffast-math} or
13267 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13268 precision of reciprocal square root results to about 16 bits for
13269 single precision and to 32 bits for double precision.
13271 @item -mlow-precision-sqrt
13272 @item -mno-low-precision-sqrt
13273 @opindex -mlow-precision-sqrt
13274 @opindex -mno-low-precision-sqrt
13275 Enable or disable the square root approximation.
13276 This option only has an effect if @option{-ffast-math} or
13277 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13278 precision of square root results to about 16 bits for
13279 single precision and to 32 bits for double precision.
13280 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
13282 @item -mlow-precision-div
13283 @item -mno-low-precision-div
13284 @opindex -mlow-precision-div
13285 @opindex -mno-low-precision-div
13286 Enable or disable the division approximation.
13287 This option only has an effect if @option{-ffast-math} or
13288 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13289 precision of division results to about 16 bits for
13290 single precision and to 32 bits for double precision.
13292 @item -march=@var{name}
13294 Specify the name of the target architecture and, optionally, one or
13295 more feature modifiers. This option has the form
13296 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
13298 The permissible values for @var{arch} are @samp{armv8-a},
13299 @samp{armv8.1-a}, @samp{armv8.2-a} or @var{native}.
13301 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
13302 support for the ARMv8.2-A architecture extensions.
13304 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
13305 support for the ARMv8.1-A architecture extension. In particular, it
13306 enables the @samp{+crc} and @samp{+lse} features.
13308 The value @samp{native} is available on native AArch64 GNU/Linux and
13309 causes the compiler to pick the architecture of the host system. This
13310 option has no effect if the compiler is unable to recognize the
13311 architecture of the host system,
13313 The permissible values for @var{feature} are listed in the sub-section
13314 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13315 Feature Modifiers}. Where conflicting feature modifiers are
13316 specified, the right-most feature is used.
13318 GCC uses @var{name} to determine what kind of instructions it can emit
13319 when generating assembly code. If @option{-march} is specified
13320 without either of @option{-mtune} or @option{-mcpu} also being
13321 specified, the code is tuned to perform well across a range of target
13322 processors implementing the target architecture.
13324 @item -mtune=@var{name}
13326 Specify the name of the target processor for which GCC should tune the
13327 performance of the code. Permissible values for this option are:
13328 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
13329 @samp{cortex-a72}, @samp{cortex-a73}, @samp{exynos-m1}, @samp{qdf24xx},
13330 @samp{thunderx}, @samp{xgene1}, @samp{vulcan}, @samp{cortex-a57.cortex-a53},
13331 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
13332 @samp{cortex-a73.cortex-a53}, @samp{native}.
13334 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
13335 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}
13336 specify that GCC should tune for a big.LITTLE system.
13338 Additionally on native AArch64 GNU/Linux systems the value
13339 @samp{native} tunes performance to the host system. This option has no effect
13340 if the compiler is unable to recognize the processor of the host system.
13342 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
13343 are specified, the code is tuned to perform well across a range
13344 of target processors.
13346 This option cannot be suffixed by feature modifiers.
13348 @item -mcpu=@var{name}
13350 Specify the name of the target processor, optionally suffixed by one
13351 or more feature modifiers. This option has the form
13352 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
13353 the permissible values for @var{cpu} are the same as those available
13354 for @option{-mtune}. The permissible values for @var{feature} are
13355 documented in the sub-section on
13356 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13357 Feature Modifiers}. Where conflicting feature modifiers are
13358 specified, the right-most feature is used.
13360 GCC uses @var{name} to determine what kind of instructions it can emit when
13361 generating assembly code (as if by @option{-march}) and to determine
13362 the target processor for which to tune for performance (as if
13363 by @option{-mtune}). Where this option is used in conjunction
13364 with @option{-march} or @option{-mtune}, those options take precedence
13365 over the appropriate part of this option.
13367 @item -moverride=@var{string}
13369 Override tuning decisions made by the back-end in response to a
13370 @option{-mtune=} switch. The syntax, semantics, and accepted values
13371 for @var{string} in this option are not guaranteed to be consistent
13374 This option is only intended to be useful when developing GCC.
13376 @item -mpc-relative-literal-loads
13377 @opindex mpc-relative-literal-loads
13378 Enable PC-relative literal loads. With this option literal pools are
13379 accessed using a single instruction and emitted after each function. This
13380 limits the maximum size of functions to 1MB. This is enabled by default for
13381 @option{-mcmodel=tiny}.
13385 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
13386 @anchor{aarch64-feature-modifiers}
13387 @cindex @option{-march} feature modifiers
13388 @cindex @option{-mcpu} feature modifiers
13389 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
13390 the following and their inverses @option{no@var{feature}}:
13394 Enable CRC extension. This is on by default for
13395 @option{-march=armv8.1-a}.
13397 Enable Crypto extension. This also enables Advanced SIMD and floating-point
13400 Enable floating-point instructions. This is on by default for all possible
13401 values for options @option{-march} and @option{-mcpu}.
13403 Enable Advanced SIMD instructions. This also enables floating-point
13404 instructions. This is on by default for all possible values for options
13405 @option{-march} and @option{-mcpu}.
13407 Enable Large System Extension instructions. This is on by default for
13408 @option{-march=armv8.1-a}.
13410 Enable FP16 extension. This also enables floating-point instructions.
13414 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
13415 Conversely, @option{nofp} implies @option{nosimd}, which implies
13418 @node Adapteva Epiphany Options
13419 @subsection Adapteva Epiphany Options
13421 These @samp{-m} options are defined for Adapteva Epiphany:
13424 @item -mhalf-reg-file
13425 @opindex mhalf-reg-file
13426 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
13427 That allows code to run on hardware variants that lack these registers.
13429 @item -mprefer-short-insn-regs
13430 @opindex mprefer-short-insn-regs
13431 Preferentially allocate registers that allow short instruction generation.
13432 This can result in increased instruction count, so this may either reduce or
13433 increase overall code size.
13435 @item -mbranch-cost=@var{num}
13436 @opindex mbranch-cost
13437 Set the cost of branches to roughly @var{num} ``simple'' instructions.
13438 This cost is only a heuristic and is not guaranteed to produce
13439 consistent results across releases.
13443 Enable the generation of conditional moves.
13445 @item -mnops=@var{num}
13447 Emit @var{num} NOPs before every other generated instruction.
13449 @item -mno-soft-cmpsf
13450 @opindex mno-soft-cmpsf
13451 For single-precision floating-point comparisons, emit an @code{fsub} instruction
13452 and test the flags. This is faster than a software comparison, but can
13453 get incorrect results in the presence of NaNs, or when two different small
13454 numbers are compared such that their difference is calculated as zero.
13455 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
13456 software comparisons.
13458 @item -mstack-offset=@var{num}
13459 @opindex mstack-offset
13460 Set the offset between the top of the stack and the stack pointer.
13461 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
13462 can be used by leaf functions without stack allocation.
13463 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
13464 Note also that this option changes the ABI; compiling a program with a
13465 different stack offset than the libraries have been compiled with
13466 generally does not work.
13467 This option can be useful if you want to evaluate if a different stack
13468 offset would give you better code, but to actually use a different stack
13469 offset to build working programs, it is recommended to configure the
13470 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
13472 @item -mno-round-nearest
13473 @opindex mno-round-nearest
13474 Make the scheduler assume that the rounding mode has been set to
13475 truncating. The default is @option{-mround-nearest}.
13478 @opindex mlong-calls
13479 If not otherwise specified by an attribute, assume all calls might be beyond
13480 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
13481 function address into a register before performing a (otherwise direct) call.
13482 This is the default.
13484 @item -mshort-calls
13485 @opindex short-calls
13486 If not otherwise specified by an attribute, assume all direct calls are
13487 in the range of the @code{b} / @code{bl} instructions, so use these instructions
13488 for direct calls. The default is @option{-mlong-calls}.
13492 Assume addresses can be loaded as 16-bit unsigned values. This does not
13493 apply to function addresses for which @option{-mlong-calls} semantics
13496 @item -mfp-mode=@var{mode}
13498 Set the prevailing mode of the floating-point unit.
13499 This determines the floating-point mode that is provided and expected
13500 at function call and return time. Making this mode match the mode you
13501 predominantly need at function start can make your programs smaller and
13502 faster by avoiding unnecessary mode switches.
13504 @var{mode} can be set to one the following values:
13508 Any mode at function entry is valid, and retained or restored when
13509 the function returns, and when it calls other functions.
13510 This mode is useful for compiling libraries or other compilation units
13511 you might want to incorporate into different programs with different
13512 prevailing FPU modes, and the convenience of being able to use a single
13513 object file outweighs the size and speed overhead for any extra
13514 mode switching that might be needed, compared with what would be needed
13515 with a more specific choice of prevailing FPU mode.
13518 This is the mode used for floating-point calculations with
13519 truncating (i.e.@: round towards zero) rounding mode. That includes
13520 conversion from floating point to integer.
13522 @item round-nearest
13523 This is the mode used for floating-point calculations with
13524 round-to-nearest-or-even rounding mode.
13527 This is the mode used to perform integer calculations in the FPU, e.g.@:
13528 integer multiply, or integer multiply-and-accumulate.
13531 The default is @option{-mfp-mode=caller}
13533 @item -mnosplit-lohi
13534 @itemx -mno-postinc
13535 @itemx -mno-postmodify
13536 @opindex mnosplit-lohi
13537 @opindex mno-postinc
13538 @opindex mno-postmodify
13539 Code generation tweaks that disable, respectively, splitting of 32-bit
13540 loads, generation of post-increment addresses, and generation of
13541 post-modify addresses. The defaults are @option{msplit-lohi},
13542 @option{-mpost-inc}, and @option{-mpost-modify}.
13544 @item -mnovect-double
13545 @opindex mno-vect-double
13546 Change the preferred SIMD mode to SImode. The default is
13547 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
13549 @item -max-vect-align=@var{num}
13550 @opindex max-vect-align
13551 The maximum alignment for SIMD vector mode types.
13552 @var{num} may be 4 or 8. The default is 8.
13553 Note that this is an ABI change, even though many library function
13554 interfaces are unaffected if they don't use SIMD vector modes
13555 in places that affect size and/or alignment of relevant types.
13557 @item -msplit-vecmove-early
13558 @opindex msplit-vecmove-early
13559 Split vector moves into single word moves before reload. In theory this
13560 can give better register allocation, but so far the reverse seems to be
13561 generally the case.
13563 @item -m1reg-@var{reg}
13565 Specify a register to hold the constant @minus{}1, which makes loading small negative
13566 constants and certain bitmasks faster.
13567 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
13568 which specify use of that register as a fixed register,
13569 and @samp{none}, which means that no register is used for this
13570 purpose. The default is @option{-m1reg-none}.
13575 @subsection ARC Options
13576 @cindex ARC options
13578 The following options control the architecture variant for which code
13581 @c architecture variants
13584 @item -mbarrel-shifter
13585 @opindex mbarrel-shifter
13586 Generate instructions supported by barrel shifter. This is the default
13587 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
13589 @item -mcpu=@var{cpu}
13591 Set architecture type, register usage, and instruction scheduling
13592 parameters for @var{cpu}. There are also shortcut alias options
13593 available for backward compatibility and convenience. Supported
13594 values for @var{cpu} are
13601 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
13606 Compile for ARC601. Alias: @option{-mARC601}.
13612 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
13613 This is the default when configured with @option{--with-cpu=arc700}@.
13617 Compile for ARC EM.
13621 Compile for ARC HS.
13626 @itemx -mdpfp-compact
13627 @opindex mdpfp-compact
13628 FPX: Generate Double Precision FPX instructions, tuned for the compact
13632 @opindex mdpfp-fast
13633 FPX: Generate Double Precision FPX instructions, tuned for the fast
13636 @item -mno-dpfp-lrsr
13637 @opindex mno-dpfp-lrsr
13638 Disable LR and SR instructions from using FPX extension aux registers.
13642 Generate Extended arithmetic instructions. Currently only
13643 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
13644 supported. This is always enabled for @option{-mcpu=ARC700}.
13648 Do not generate mpy instructions for ARC700.
13652 Generate 32x16 bit multiply and mac instructions.
13656 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
13660 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
13665 @itemx -mspfp-compact
13666 @opindex mspfp-compact
13667 FPX: Generate Single Precision FPX instructions, tuned for the compact
13671 @opindex mspfp-fast
13672 FPX: Generate Single Precision FPX instructions, tuned for the fast
13677 Enable generation of ARC SIMD instructions via target-specific
13678 builtins. Only valid for @option{-mcpu=ARC700}.
13681 @opindex msoft-float
13682 This option ignored; it is provided for compatibility purposes only.
13683 Software floating point code is emitted by default, and this default
13684 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
13685 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
13686 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
13690 Generate swap instructions.
13694 This enables Locked Load/Store Conditional extension to implement
13695 atomic memopry built-in functions. Not available for ARC 6xx or ARC
13700 Enable DIV/REM instructions for ARCv2 cores.
13702 @item -mcode-density
13703 @opindex mcode-density
13704 Enable code density instructions for ARC EM, default on for ARC HS.
13708 Enable double load/store operations for ARC HS cores.
13710 @item -mtp-regno=@var{regno}
13712 Specify thread pointer register number.
13714 @item -mmpy-option=@var{multo}
13715 @opindex mmpy-option
13716 Compile ARCv2 code with a multiplier design option. @samp{wlh1} is
13717 the default value. The recognized values for @var{multo} are:
13721 No multiplier available.
13725 The multiply option is set to w: 16x16 multiplier, fully pipelined.
13726 The following instructions are enabled: MPYW, and MPYUW.
13730 The multiply option is set to wlh1: 32x32 multiplier, fully
13731 pipelined (1 stage). The following instructions are additionally
13732 enabled: MPY, MPYU, MPYM, MPYMU, and MPY_S.
13736 The multiply option is set to wlh2: 32x32 multiplier, fully pipelined
13737 (2 stages). The following instructions are additionally enabled: MPY,
13738 MPYU, MPYM, MPYMU, and MPY_S.
13742 The multiply option is set to wlh3: Two 16x16 multiplier, blocking,
13743 sequential. The following instructions are additionally enabled: MPY,
13744 MPYU, MPYM, MPYMU, and MPY_S.
13748 The multiply option is set to wlh4: One 16x16 multiplier, blocking,
13749 sequential. The following instructions are additionally enabled: MPY,
13750 MPYU, MPYM, MPYMU, and MPY_S.
13754 The multiply option is set to wlh5: One 32x4 multiplier, blocking,
13755 sequential. The following instructions are additionally enabled: MPY,
13756 MPYU, MPYM, MPYMU, and MPY_S.
13760 This option is only available for ARCv2 cores@.
13762 @item -mfpu=@var{fpu}
13764 Enables specific floating-point hardware extension for ARCv2
13765 core. Supported values for @var{fpu} are:
13771 Enables support for single precision floating point hardware
13776 Enables support for double precision floating point hardware
13777 extensions. The single precision floating point extension is also
13778 enabled. Not available for ARC EM@.
13782 Enables support for double precision floating point hardware
13783 extensions using double precision assist instructions. The single
13784 precision floating point extension is also enabled. This option is
13785 only available for ARC EM@.
13789 Enables support for double precision floating point hardware
13790 extensions using double precision assist instructions, and simple
13791 precision square-root and divide hardware extensions. The single
13792 precision floating point extension is also enabled. This option is
13793 only available for ARC EM@.
13797 Enables support for double precision floating point hardware
13798 extensions using double precision assist instructions, and simple
13799 precision fused multiple and add hardware extension. The single
13800 precision floating point extension is also enabled. This option is
13801 only available for ARC EM@.
13805 Enables support for double precision floating point hardware
13806 extensions using double precision assist instructions, and all simple
13807 precision hardware extensions. The single precision floating point
13808 extension is also enabled. This option is only available for ARC EM@.
13812 Enables support for single precision floating point, and single
13813 precision square-root and divide hardware extensions@.
13817 Enables support for double precision floating point, and double
13818 precision square-root and divide hardware extensions. This option
13819 includes option @samp{fpus_div}. Not available for ARC EM@.
13823 Enables support for single precision floating point, and single
13824 precision fused multiple and add hardware extensions@.
13828 Enables support for double precision floating point, and double
13829 precision fused multiple and add hardware extensions. This option
13830 includes option @samp{fpus_fma}. Not available for ARC EM@.
13834 Enables support for all single precision floating point hardware
13839 Enables support for all single and double precision floating point
13840 hardware extensions. Not available for ARC EM@.
13846 The following options are passed through to the assembler, and also
13847 define preprocessor macro symbols.
13849 @c Flags used by the assembler, but for which we define preprocessor
13850 @c macro symbols as well.
13853 @opindex mdsp-packa
13854 Passed down to the assembler to enable the DSP Pack A extensions.
13855 Also sets the preprocessor symbol @code{__Xdsp_packa}.
13859 Passed down to the assembler to enable the dual viterbi butterfly
13860 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
13862 @c ARC700 4.10 extension instruction
13865 Passed down to the assembler to enable the Locked Load/Store
13866 Conditional extension. Also sets the preprocessor symbol
13871 Passed down to the assembler. Also sets the preprocessor symbol
13872 @code{__Xxmac_d16}.
13876 Passed down to the assembler. Also sets the preprocessor symbol
13879 @c ARC700 4.10 extension instruction
13882 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
13883 extension instruction. Also sets the preprocessor symbol
13886 @c ARC700 4.10 extension instruction
13889 Passed down to the assembler to enable the swap byte ordering
13890 extension instruction. Also sets the preprocessor symbol
13894 @opindex mtelephony
13895 Passed down to the assembler to enable dual and single operand
13896 instructions for telephony. Also sets the preprocessor symbol
13897 @code{__Xtelephony}.
13901 Passed down to the assembler to enable the XY Memory extension. Also
13902 sets the preprocessor symbol @code{__Xxy}.
13906 The following options control how the assembly code is annotated:
13908 @c Assembly annotation options
13912 Annotate assembler instructions with estimated addresses.
13914 @item -mannotate-align
13915 @opindex mannotate-align
13916 Explain what alignment considerations lead to the decision to make an
13917 instruction short or long.
13921 The following options are passed through to the linker:
13923 @c options passed through to the linker
13927 Passed through to the linker, to specify use of the @code{arclinux} emulation.
13928 This option is enabled by default in tool chains built for
13929 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
13930 when profiling is not requested.
13932 @item -marclinux_prof
13933 @opindex marclinux_prof
13934 Passed through to the linker, to specify use of the
13935 @code{arclinux_prof} emulation. This option is enabled by default in
13936 tool chains built for @w{@code{arc-linux-uclibc}} and
13937 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
13941 The following options control the semantics of generated code:
13943 @c semantically relevant code generation options
13946 @opindex mlong-calls
13947 Generate call insns as register indirect calls, thus providing access
13948 to the full 32-bit address range.
13950 @item -mmedium-calls
13951 @opindex mmedium-calls
13952 Don't use less than 25 bit addressing range for calls, which is the
13953 offset available for an unconditional branch-and-link
13954 instruction. Conditional execution of function calls is suppressed, to
13955 allow use of the 25-bit range, rather than the 21-bit range with
13956 conditional branch-and-link. This is the default for tool chains built
13957 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
13961 Do not generate sdata references. This is the default for tool chains
13962 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
13966 @opindex mucb-mcount
13967 Instrument with mcount calls as used in UCB code. I.e. do the
13968 counting in the callee, not the caller. By default ARC instrumentation
13969 counts in the caller.
13971 @item -mvolatile-cache
13972 @opindex mvolatile-cache
13973 Use ordinarily cached memory accesses for volatile references. This is the
13976 @item -mno-volatile-cache
13977 @opindex mno-volatile-cache
13978 Enable cache bypass for volatile references.
13982 The following options fine tune code generation:
13983 @c code generation tuning options
13986 @opindex malign-call
13987 Do alignment optimizations for call instructions.
13989 @item -mauto-modify-reg
13990 @opindex mauto-modify-reg
13991 Enable the use of pre/post modify with register displacement.
13993 @item -mbbit-peephole
13994 @opindex mbbit-peephole
13995 Enable bbit peephole2.
13999 This option disables a target-specific pass in @file{arc_reorg} to
14000 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
14001 generation driven by the combiner pass.
14003 @item -mcase-vector-pcrel
14004 @opindex mcase-vector-pcrel
14005 Use pc-relative switch case tables - this enables case table shortening.
14006 This is the default for @option{-Os}.
14008 @item -mcompact-casesi
14009 @opindex mcompact-casesi
14010 Enable compact casesi pattern.
14011 This is the default for @option{-Os}.
14013 @item -mno-cond-exec
14014 @opindex mno-cond-exec
14015 Disable ARCompact specific pass to generate conditional execution instructions.
14016 Due to delay slot scheduling and interactions between operand numbers,
14017 literal sizes, instruction lengths, and the support for conditional execution,
14018 the target-independent pass to generate conditional execution is often lacking,
14019 so the ARC port has kept a special pass around that tries to find more
14020 conditional execution generating opportunities after register allocation,
14021 branch shortening, and delay slot scheduling have been done. This pass
14022 generally, but not always, improves performance and code size, at the cost of
14023 extra compilation time, which is why there is an option to switch it off.
14024 If you have a problem with call instructions exceeding their allowable
14025 offset range because they are conditionalized, you should consider using
14026 @option{-mmedium-calls} instead.
14028 @item -mearly-cbranchsi
14029 @opindex mearly-cbranchsi
14030 Enable pre-reload use of the cbranchsi pattern.
14032 @item -mexpand-adddi
14033 @opindex mexpand-adddi
14034 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
14035 @code{add.f}, @code{adc} etc.
14037 @item -mindexed-loads
14038 @opindex mindexed-loads
14039 Enable the use of indexed loads. This can be problematic because some
14040 optimizers then assume that indexed stores exist, which is not
14044 Enable Local Register Allocation. This is still experimental for ARC,
14045 so by default the compiler uses standard reload
14046 (i.e. @option{-mno-lra}).
14048 @item -mlra-priority-none
14049 @opindex mlra-priority-none
14050 Don't indicate any priority for target registers.
14052 @item -mlra-priority-compact
14053 @opindex mlra-priority-compact
14054 Indicate target register priority for r0..r3 / r12..r15.
14056 @item -mlra-priority-noncompact
14057 @opindex mlra-priority-noncompact
14058 Reduce target register priority for r0..r3 / r12..r15.
14060 @item -mno-millicode
14061 @opindex mno-millicode
14062 When optimizing for size (using @option{-Os}), prologues and epilogues
14063 that have to save or restore a large number of registers are often
14064 shortened by using call to a special function in libgcc; this is
14065 referred to as a @emph{millicode} call. As these calls can pose
14066 performance issues, and/or cause linking issues when linking in a
14067 nonstandard way, this option is provided to turn off millicode call
14071 @opindex mmixed-code
14072 Tweak register allocation to help 16-bit instruction generation.
14073 This generally has the effect of decreasing the average instruction size
14074 while increasing the instruction count.
14078 Enable 'q' instruction alternatives.
14079 This is the default for @option{-Os}.
14083 Enable Rcq constraint handling - most short code generation depends on this.
14084 This is the default.
14088 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
14089 This is the default.
14091 @item -msize-level=@var{level}
14092 @opindex msize-level
14093 Fine-tune size optimization with regards to instruction lengths and alignment.
14094 The recognized values for @var{level} are:
14097 No size optimization. This level is deprecated and treated like @samp{1}.
14100 Short instructions are used opportunistically.
14103 In addition, alignment of loops and of code after barriers are dropped.
14106 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
14110 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
14111 the behavior when this is not set is equivalent to level @samp{1}.
14113 @item -mtune=@var{cpu}
14115 Set instruction scheduling parameters for @var{cpu}, overriding any implied
14116 by @option{-mcpu=}.
14118 Supported values for @var{cpu} are
14122 Tune for ARC600 cpu.
14125 Tune for ARC601 cpu.
14128 Tune for ARC700 cpu with standard multiplier block.
14131 Tune for ARC700 cpu with XMAC block.
14134 Tune for ARC725D cpu.
14137 Tune for ARC750D cpu.
14141 @item -mmultcost=@var{num}
14143 Cost to assume for a multiply instruction, with @samp{4} being equal to a
14144 normal instruction.
14146 @item -munalign-prob-threshold=@var{probability}
14147 @opindex munalign-prob-threshold
14148 Set probability threshold for unaligning branches.
14149 When tuning for @samp{ARC700} and optimizing for speed, branches without
14150 filled delay slot are preferably emitted unaligned and long, unless
14151 profiling indicates that the probability for the branch to be taken
14152 is below @var{probability}. @xref{Cross-profiling}.
14153 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
14157 The following options are maintained for backward compatibility, but
14158 are now deprecated and will be removed in a future release:
14160 @c Deprecated options
14168 @opindex mbig-endian
14171 Compile code for big endian targets. Use of these options is now
14172 deprecated. Users wanting big-endian code, should use the
14173 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
14174 building the tool chain, for which big-endian is the default.
14176 @item -mlittle-endian
14177 @opindex mlittle-endian
14180 Compile code for little endian targets. Use of these options is now
14181 deprecated. Users wanting little-endian code should use the
14182 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
14183 building the tool chain, for which little-endian is the default.
14185 @item -mbarrel_shifter
14186 @opindex mbarrel_shifter
14187 Replaced by @option{-mbarrel-shifter}.
14189 @item -mdpfp_compact
14190 @opindex mdpfp_compact
14191 Replaced by @option{-mdpfp-compact}.
14194 @opindex mdpfp_fast
14195 Replaced by @option{-mdpfp-fast}.
14198 @opindex mdsp_packa
14199 Replaced by @option{-mdsp-packa}.
14203 Replaced by @option{-mea}.
14207 Replaced by @option{-mmac-24}.
14211 Replaced by @option{-mmac-d16}.
14213 @item -mspfp_compact
14214 @opindex mspfp_compact
14215 Replaced by @option{-mspfp-compact}.
14218 @opindex mspfp_fast
14219 Replaced by @option{-mspfp-fast}.
14221 @item -mtune=@var{cpu}
14223 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
14224 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
14225 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
14227 @item -multcost=@var{num}
14229 Replaced by @option{-mmultcost}.
14234 @subsection ARM Options
14235 @cindex ARM options
14237 These @samp{-m} options are defined for the ARM port:
14240 @item -mabi=@var{name}
14242 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
14243 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
14246 @opindex mapcs-frame
14247 Generate a stack frame that is compliant with the ARM Procedure Call
14248 Standard for all functions, even if this is not strictly necessary for
14249 correct execution of the code. Specifying @option{-fomit-frame-pointer}
14250 with this option causes the stack frames not to be generated for
14251 leaf functions. The default is @option{-mno-apcs-frame}.
14252 This option is deprecated.
14256 This is a synonym for @option{-mapcs-frame} and is deprecated.
14259 @c not currently implemented
14260 @item -mapcs-stack-check
14261 @opindex mapcs-stack-check
14262 Generate code to check the amount of stack space available upon entry to
14263 every function (that actually uses some stack space). If there is
14264 insufficient space available then either the function
14265 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
14266 called, depending upon the amount of stack space required. The runtime
14267 system is required to provide these functions. The default is
14268 @option{-mno-apcs-stack-check}, since this produces smaller code.
14270 @c not currently implemented
14272 @opindex mapcs-float
14273 Pass floating-point arguments using the floating-point registers. This is
14274 one of the variants of the APCS@. This option is recommended if the
14275 target hardware has a floating-point unit or if a lot of floating-point
14276 arithmetic is going to be performed by the code. The default is
14277 @option{-mno-apcs-float}, since the size of integer-only code is
14278 slightly increased if @option{-mapcs-float} is used.
14280 @c not currently implemented
14281 @item -mapcs-reentrant
14282 @opindex mapcs-reentrant
14283 Generate reentrant, position-independent code. The default is
14284 @option{-mno-apcs-reentrant}.
14287 @item -mthumb-interwork
14288 @opindex mthumb-interwork
14289 Generate code that supports calling between the ARM and Thumb
14290 instruction sets. Without this option, on pre-v5 architectures, the
14291 two instruction sets cannot be reliably used inside one program. The
14292 default is @option{-mno-thumb-interwork}, since slightly larger code
14293 is generated when @option{-mthumb-interwork} is specified. In AAPCS
14294 configurations this option is meaningless.
14296 @item -mno-sched-prolog
14297 @opindex mno-sched-prolog
14298 Prevent the reordering of instructions in the function prologue, or the
14299 merging of those instruction with the instructions in the function's
14300 body. This means that all functions start with a recognizable set
14301 of instructions (or in fact one of a choice from a small set of
14302 different function prologues), and this information can be used to
14303 locate the start of functions inside an executable piece of code. The
14304 default is @option{-msched-prolog}.
14306 @item -mfloat-abi=@var{name}
14307 @opindex mfloat-abi
14308 Specifies which floating-point ABI to use. Permissible values
14309 are: @samp{soft}, @samp{softfp} and @samp{hard}.
14311 Specifying @samp{soft} causes GCC to generate output containing
14312 library calls for floating-point operations.
14313 @samp{softfp} allows the generation of code using hardware floating-point
14314 instructions, but still uses the soft-float calling conventions.
14315 @samp{hard} allows generation of floating-point instructions
14316 and uses FPU-specific calling conventions.
14318 The default depends on the specific target configuration. Note that
14319 the hard-float and soft-float ABIs are not link-compatible; you must
14320 compile your entire program with the same ABI, and link with a
14321 compatible set of libraries.
14323 @item -mlittle-endian
14324 @opindex mlittle-endian
14325 Generate code for a processor running in little-endian mode. This is
14326 the default for all standard configurations.
14329 @opindex mbig-endian
14330 Generate code for a processor running in big-endian mode; the default is
14331 to compile code for a little-endian processor.
14333 @item -march=@var{name}
14335 This specifies the name of the target ARM architecture. GCC uses this
14336 name to determine what kind of instructions it can emit when generating
14337 assembly code. This option can be used in conjunction with or instead
14338 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
14339 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
14340 @samp{armv5}, @samp{armv5e}, @samp{armv5t}, @samp{armv5te},
14341 @samp{armv6}, @samp{armv6-m}, @samp{armv6j}, @samp{armv6k},
14342 @samp{armv6kz}, @samp{armv6s-m},
14343 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk},
14344 @samp{armv7}, @samp{armv7-a}, @samp{armv7-m}, @samp{armv7-r}, @samp{armv7e-m},
14345 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
14346 @samp{armv8.1-a+crc}, @samp{armv8-m.base}, @samp{armv8-m.main},
14347 @samp{armv8-m.main+dsp}, @samp{iwmmxt}, @samp{iwmmxt2}.
14349 Architecture revisions older than @samp{armv4t} are deprecated.
14351 @option{-march=armv6s-m} is the @samp{armv6-m} architecture with support for
14352 the (now mandatory) SVC instruction.
14354 @option{-march=armv6zk} is an alias for @samp{armv6kz}, existing for backwards
14357 @option{-march=armv7ve} is the @samp{armv7-a} architecture with virtualization
14360 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
14361 architecture together with the optional CRC32 extensions.
14363 @option{-march=native} causes the compiler to auto-detect the architecture
14364 of the build computer. At present, this feature is only supported on
14365 GNU/Linux, and not all architectures are recognized. If the auto-detect
14366 is unsuccessful the option has no effect.
14368 @item -mtune=@var{name}
14370 This option specifies the name of the target ARM processor for
14371 which GCC should tune the performance of the code.
14372 For some ARM implementations better performance can be obtained by using
14374 Permissible names are: @samp{arm2}, @samp{arm250},
14375 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
14376 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
14377 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
14378 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
14380 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
14381 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
14382 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
14383 @samp{strongarm1110},
14384 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
14385 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
14386 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
14387 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
14388 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
14389 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
14390 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
14391 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
14392 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
14393 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
14394 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-r4},
14395 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
14401 @samp{cortex-m0plus},
14402 @samp{cortex-m1.small-multiply},
14403 @samp{cortex-m0.small-multiply},
14404 @samp{cortex-m0plus.small-multiply},
14407 @samp{marvell-pj4},
14408 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
14409 @samp{fa526}, @samp{fa626},
14410 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
14413 Additionally, this option can specify that GCC should tune the performance
14414 of the code for a big.LITTLE system. Permissible names are:
14415 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
14416 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14417 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}.
14419 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
14420 performance for a blend of processors within architecture @var{arch}.
14421 The aim is to generate code that run well on the current most popular
14422 processors, balancing between optimizations that benefit some CPUs in the
14423 range, and avoiding performance pitfalls of other CPUs. The effects of
14424 this option may change in future GCC versions as CPU models come and go.
14426 @option{-mtune=native} causes the compiler to auto-detect the CPU
14427 of the build computer. At present, this feature is only supported on
14428 GNU/Linux, and not all architectures are recognized. If the auto-detect is
14429 unsuccessful the option has no effect.
14431 @item -mcpu=@var{name}
14433 This specifies the name of the target ARM processor. GCC uses this name
14434 to derive the name of the target ARM architecture (as if specified
14435 by @option{-march}) and the ARM processor type for which to tune for
14436 performance (as if specified by @option{-mtune}). Where this option
14437 is used in conjunction with @option{-march} or @option{-mtune},
14438 those options take precedence over the appropriate part of this option.
14440 Permissible names for this option are the same as those for
14443 @option{-mcpu=generic-@var{arch}} is also permissible, and is
14444 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
14445 See @option{-mtune} for more information.
14447 @option{-mcpu=native} causes the compiler to auto-detect the CPU
14448 of the build computer. At present, this feature is only supported on
14449 GNU/Linux, and not all architectures are recognized. If the auto-detect
14450 is unsuccessful the option has no effect.
14452 @item -mfpu=@var{name}
14454 This specifies what floating-point hardware (or hardware emulation) is
14455 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
14456 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
14457 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
14458 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
14459 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
14460 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
14462 If @option{-msoft-float} is specified this specifies the format of
14463 floating-point values.
14465 If the selected floating-point hardware includes the NEON extension
14466 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
14467 operations are not generated by GCC's auto-vectorization pass unless
14468 @option{-funsafe-math-optimizations} is also specified. This is
14469 because NEON hardware does not fully implement the IEEE 754 standard for
14470 floating-point arithmetic (in particular denormal values are treated as
14471 zero), so the use of NEON instructions may lead to a loss of precision.
14473 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}).
14475 @item -mfp16-format=@var{name}
14476 @opindex mfp16-format
14477 Specify the format of the @code{__fp16} half-precision floating-point type.
14478 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
14479 the default is @samp{none}, in which case the @code{__fp16} type is not
14480 defined. @xref{Half-Precision}, for more information.
14482 @item -mstructure-size-boundary=@var{n}
14483 @opindex mstructure-size-boundary
14484 The sizes of all structures and unions are rounded up to a multiple
14485 of the number of bits set by this option. Permissible values are 8, 32
14486 and 64. The default value varies for different toolchains. For the COFF
14487 targeted toolchain the default value is 8. A value of 64 is only allowed
14488 if the underlying ABI supports it.
14490 Specifying a larger number can produce faster, more efficient code, but
14491 can also increase the size of the program. Different values are potentially
14492 incompatible. Code compiled with one value cannot necessarily expect to
14493 work with code or libraries compiled with another value, if they exchange
14494 information using structures or unions.
14496 @item -mabort-on-noreturn
14497 @opindex mabort-on-noreturn
14498 Generate a call to the function @code{abort} at the end of a
14499 @code{noreturn} function. It is executed if the function tries to
14503 @itemx -mno-long-calls
14504 @opindex mlong-calls
14505 @opindex mno-long-calls
14506 Tells the compiler to perform function calls by first loading the
14507 address of the function into a register and then performing a subroutine
14508 call on this register. This switch is needed if the target function
14509 lies outside of the 64-megabyte addressing range of the offset-based
14510 version of subroutine call instruction.
14512 Even if this switch is enabled, not all function calls are turned
14513 into long calls. The heuristic is that static functions, functions
14514 that have the @code{short_call} attribute, functions that are inside
14515 the scope of a @code{#pragma no_long_calls} directive, and functions whose
14516 definitions have already been compiled within the current compilation
14517 unit are not turned into long calls. The exceptions to this rule are
14518 that weak function definitions, functions with the @code{long_call}
14519 attribute or the @code{section} attribute, and functions that are within
14520 the scope of a @code{#pragma long_calls} directive are always
14521 turned into long calls.
14523 This feature is not enabled by default. Specifying
14524 @option{-mno-long-calls} restores the default behavior, as does
14525 placing the function calls within the scope of a @code{#pragma
14526 long_calls_off} directive. Note these switches have no effect on how
14527 the compiler generates code to handle function calls via function
14530 @item -msingle-pic-base
14531 @opindex msingle-pic-base
14532 Treat the register used for PIC addressing as read-only, rather than
14533 loading it in the prologue for each function. The runtime system is
14534 responsible for initializing this register with an appropriate value
14535 before execution begins.
14537 @item -mpic-register=@var{reg}
14538 @opindex mpic-register
14539 Specify the register to be used for PIC addressing.
14540 For standard PIC base case, the default is any suitable register
14541 determined by compiler. For single PIC base case, the default is
14542 @samp{R9} if target is EABI based or stack-checking is enabled,
14543 otherwise the default is @samp{R10}.
14545 @item -mpic-data-is-text-relative
14546 @opindex mpic-data-is-text-relative
14547 Assume that the displacement between the text and data segments is fixed
14548 at static link time. This permits using PC-relative addressing
14549 operations to access data known to be in the data segment. For
14550 non-VxWorks RTP targets, this option is enabled by default. When
14551 disabled on such targets, it will enable @option{-msingle-pic-base} by
14554 @item -mpoke-function-name
14555 @opindex mpoke-function-name
14556 Write the name of each function into the text section, directly
14557 preceding the function prologue. The generated code is similar to this:
14561 .ascii "arm_poke_function_name", 0
14564 .word 0xff000000 + (t1 - t0)
14565 arm_poke_function_name
14567 stmfd sp!, @{fp, ip, lr, pc@}
14571 When performing a stack backtrace, code can inspect the value of
14572 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
14573 location @code{pc - 12} and the top 8 bits are set, then we know that
14574 there is a function name embedded immediately preceding this location
14575 and has length @code{((pc[-3]) & 0xff000000)}.
14582 Select between generating code that executes in ARM and Thumb
14583 states. The default for most configurations is to generate code
14584 that executes in ARM state, but the default can be changed by
14585 configuring GCC with the @option{--with-mode=}@var{state}
14588 You can also override the ARM and Thumb mode for each function
14589 by using the @code{target("thumb")} and @code{target("arm")} function attributes
14590 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
14593 @opindex mtpcs-frame
14594 Generate a stack frame that is compliant with the Thumb Procedure Call
14595 Standard for all non-leaf functions. (A leaf function is one that does
14596 not call any other functions.) The default is @option{-mno-tpcs-frame}.
14598 @item -mtpcs-leaf-frame
14599 @opindex mtpcs-leaf-frame
14600 Generate a stack frame that is compliant with the Thumb Procedure Call
14601 Standard for all leaf functions. (A leaf function is one that does
14602 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
14604 @item -mcallee-super-interworking
14605 @opindex mcallee-super-interworking
14606 Gives all externally visible functions in the file being compiled an ARM
14607 instruction set header which switches to Thumb mode before executing the
14608 rest of the function. This allows these functions to be called from
14609 non-interworking code. This option is not valid in AAPCS configurations
14610 because interworking is enabled by default.
14612 @item -mcaller-super-interworking
14613 @opindex mcaller-super-interworking
14614 Allows calls via function pointers (including virtual functions) to
14615 execute correctly regardless of whether the target code has been
14616 compiled for interworking or not. There is a small overhead in the cost
14617 of executing a function pointer if this option is enabled. This option
14618 is not valid in AAPCS configurations because interworking is enabled
14621 @item -mtp=@var{name}
14623 Specify the access model for the thread local storage pointer. The valid
14624 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
14625 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
14626 (supported in the arm6k architecture), and @samp{auto}, which uses the
14627 best available method for the selected processor. The default setting is
14630 @item -mtls-dialect=@var{dialect}
14631 @opindex mtls-dialect
14632 Specify the dialect to use for accessing thread local storage. Two
14633 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
14634 @samp{gnu} dialect selects the original GNU scheme for supporting
14635 local and global dynamic TLS models. The @samp{gnu2} dialect
14636 selects the GNU descriptor scheme, which provides better performance
14637 for shared libraries. The GNU descriptor scheme is compatible with
14638 the original scheme, but does require new assembler, linker and
14639 library support. Initial and local exec TLS models are unaffected by
14640 this option and always use the original scheme.
14642 @item -mword-relocations
14643 @opindex mword-relocations
14644 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
14645 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
14646 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
14649 @item -mfix-cortex-m3-ldrd
14650 @opindex mfix-cortex-m3-ldrd
14651 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
14652 with overlapping destination and base registers are used. This option avoids
14653 generating these instructions. This option is enabled by default when
14654 @option{-mcpu=cortex-m3} is specified.
14656 @item -munaligned-access
14657 @itemx -mno-unaligned-access
14658 @opindex munaligned-access
14659 @opindex mno-unaligned-access
14660 Enables (or disables) reading and writing of 16- and 32- bit values
14661 from addresses that are not 16- or 32- bit aligned. By default
14662 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
14663 ARMv8-M Baseline architectures, and enabled for all other
14664 architectures. If unaligned access is not enabled then words in packed
14665 data structures are accessed a byte at a time.
14667 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
14668 generated object file to either true or false, depending upon the
14669 setting of this option. If unaligned access is enabled then the
14670 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
14673 @item -mneon-for-64bits
14674 @opindex mneon-for-64bits
14675 Enables using Neon to handle scalar 64-bits operations. This is
14676 disabled by default since the cost of moving data from core registers
14679 @item -mslow-flash-data
14680 @opindex mslow-flash-data
14681 Assume loading data from flash is slower than fetching instruction.
14682 Therefore literal load is minimized for better performance.
14683 This option is only supported when compiling for ARMv7 M-profile and
14686 @item -masm-syntax-unified
14687 @opindex masm-syntax-unified
14688 Assume inline assembler is using unified asm syntax. The default is
14689 currently off which implies divided syntax. This option has no impact
14690 on Thumb2. However, this may change in future releases of GCC.
14691 Divided syntax should be considered deprecated.
14693 @item -mrestrict-it
14694 @opindex mrestrict-it
14695 Restricts generation of IT blocks to conform to the rules of ARMv8.
14696 IT blocks can only contain a single 16-bit instruction from a select
14697 set of instructions. This option is on by default for ARMv8 Thumb mode.
14699 @item -mprint-tune-info
14700 @opindex mprint-tune-info
14701 Print CPU tuning information as comment in assembler file. This is
14702 an option used only for regression testing of the compiler and not
14703 intended for ordinary use in compiling code. This option is disabled
14708 @subsection AVR Options
14709 @cindex AVR Options
14711 These options are defined for AVR implementations:
14714 @item -mmcu=@var{mcu}
14716 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
14718 The default for this option is@tie{}@samp{avr2}.
14720 GCC supports the following AVR devices and ISAs:
14722 @include avr-mmcu.texi
14724 @item -maccumulate-args
14725 @opindex maccumulate-args
14726 Accumulate outgoing function arguments and acquire/release the needed
14727 stack space for outgoing function arguments once in function
14728 prologue/epilogue. Without this option, outgoing arguments are pushed
14729 before calling a function and popped afterwards.
14731 Popping the arguments after the function call can be expensive on
14732 AVR so that accumulating the stack space might lead to smaller
14733 executables because arguments need not to be removed from the
14734 stack after such a function call.
14736 This option can lead to reduced code size for functions that perform
14737 several calls to functions that get their arguments on the stack like
14738 calls to printf-like functions.
14740 @item -mbranch-cost=@var{cost}
14741 @opindex mbranch-cost
14742 Set the branch costs for conditional branch instructions to
14743 @var{cost}. Reasonable values for @var{cost} are small, non-negative
14744 integers. The default branch cost is 0.
14746 @item -mcall-prologues
14747 @opindex mcall-prologues
14748 Functions prologues/epilogues are expanded as calls to appropriate
14749 subroutines. Code size is smaller.
14753 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
14754 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
14755 and @code{long long} is 4 bytes. Please note that this option does not
14756 conform to the C standards, but it results in smaller code
14759 @item -mn-flash=@var{num}
14761 Assume that the flash memory has a size of
14762 @var{num} times 64@tie{}KiB.
14764 @item -mno-interrupts
14765 @opindex mno-interrupts
14766 Generated code is not compatible with hardware interrupts.
14767 Code size is smaller.
14771 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
14772 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
14773 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
14774 the assembler's command line and the @option{--relax} option to the
14775 linker's command line.
14777 Jump relaxing is performed by the linker because jump offsets are not
14778 known before code is located. Therefore, the assembler code generated by the
14779 compiler is the same, but the instructions in the executable may
14780 differ from instructions in the assembler code.
14782 Relaxing must be turned on if linker stubs are needed, see the
14783 section on @code{EIND} and linker stubs below.
14787 Assume that the device supports the Read-Modify-Write
14788 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
14792 Treat the stack pointer register as an 8-bit register,
14793 i.e.@: assume the high byte of the stack pointer is zero.
14794 In general, you don't need to set this option by hand.
14796 This option is used internally by the compiler to select and
14797 build multilibs for architectures @code{avr2} and @code{avr25}.
14798 These architectures mix devices with and without @code{SPH}.
14799 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
14800 the compiler driver adds or removes this option from the compiler
14801 proper's command line, because the compiler then knows if the device
14802 or architecture has an 8-bit stack pointer and thus no @code{SPH}
14807 Use address register @code{X} in a way proposed by the hardware. This means
14808 that @code{X} is only used in indirect, post-increment or
14809 pre-decrement addressing.
14811 Without this option, the @code{X} register may be used in the same way
14812 as @code{Y} or @code{Z} which then is emulated by additional
14814 For example, loading a value with @code{X+const} addressing with a
14815 small non-negative @code{const < 64} to a register @var{Rn} is
14819 adiw r26, const ; X += const
14820 ld @var{Rn}, X ; @var{Rn} = *X
14821 sbiw r26, const ; X -= const
14825 @opindex mtiny-stack
14826 Only change the lower 8@tie{}bits of the stack pointer.
14828 @item -mfract-convert-truncate
14829 @opindex mfract-convert-truncate
14830 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
14833 @opindex nodevicelib
14834 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
14836 @item -Waddr-space-convert
14837 @opindex Waddr-space-convert
14838 Warn about conversions between address spaces in the case where the
14839 resulting address space is not contained in the incoming address space.
14841 @item -Wmisspelled-isr
14842 @opindex Wmisspelled-isr
14843 Warn if the ISR is misspelled, i.e. without __vector prefix.
14844 Enabled by default.
14847 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
14848 @cindex @code{EIND}
14849 Pointers in the implementation are 16@tie{}bits wide.
14850 The address of a function or label is represented as word address so
14851 that indirect jumps and calls can target any code address in the
14852 range of 64@tie{}Ki words.
14854 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
14855 bytes of program memory space, there is a special function register called
14856 @code{EIND} that serves as most significant part of the target address
14857 when @code{EICALL} or @code{EIJMP} instructions are used.
14859 Indirect jumps and calls on these devices are handled as follows by
14860 the compiler and are subject to some limitations:
14865 The compiler never sets @code{EIND}.
14868 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
14869 instructions or might read @code{EIND} directly in order to emulate an
14870 indirect call/jump by means of a @code{RET} instruction.
14873 The compiler assumes that @code{EIND} never changes during the startup
14874 code or during the application. In particular, @code{EIND} is not
14875 saved/restored in function or interrupt service routine
14879 For indirect calls to functions and computed goto, the linker
14880 generates @emph{stubs}. Stubs are jump pads sometimes also called
14881 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
14882 The stub contains a direct jump to the desired address.
14885 Linker relaxation must be turned on so that the linker generates
14886 the stubs correctly in all situations. See the compiler option
14887 @option{-mrelax} and the linker option @option{--relax}.
14888 There are corner cases where the linker is supposed to generate stubs
14889 but aborts without relaxation and without a helpful error message.
14892 The default linker script is arranged for code with @code{EIND = 0}.
14893 If code is supposed to work for a setup with @code{EIND != 0}, a custom
14894 linker script has to be used in order to place the sections whose
14895 name start with @code{.trampolines} into the segment where @code{EIND}
14899 The startup code from libgcc never sets @code{EIND}.
14900 Notice that startup code is a blend of code from libgcc and AVR-LibC.
14901 For the impact of AVR-LibC on @code{EIND}, see the
14902 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
14905 It is legitimate for user-specific startup code to set up @code{EIND}
14906 early, for example by means of initialization code located in
14907 section @code{.init3}. Such code runs prior to general startup code
14908 that initializes RAM and calls constructors, but after the bit
14909 of startup code from AVR-LibC that sets @code{EIND} to the segment
14910 where the vector table is located.
14912 #include <avr/io.h>
14915 __attribute__((section(".init3"),naked,used,no_instrument_function))
14916 init3_set_eind (void)
14918 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
14919 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
14924 The @code{__trampolines_start} symbol is defined in the linker script.
14927 Stubs are generated automatically by the linker if
14928 the following two conditions are met:
14931 @item The address of a label is taken by means of the @code{gs} modifier
14932 (short for @emph{generate stubs}) like so:
14934 LDI r24, lo8(gs(@var{func}))
14935 LDI r25, hi8(gs(@var{func}))
14937 @item The final location of that label is in a code segment
14938 @emph{outside} the segment where the stubs are located.
14942 The compiler emits such @code{gs} modifiers for code labels in the
14943 following situations:
14945 @item Taking address of a function or code label.
14946 @item Computed goto.
14947 @item If prologue-save function is used, see @option{-mcall-prologues}
14948 command-line option.
14949 @item Switch/case dispatch tables. If you do not want such dispatch
14950 tables you can specify the @option{-fno-jump-tables} command-line option.
14951 @item C and C++ constructors/destructors called during startup/shutdown.
14952 @item If the tools hit a @code{gs()} modifier explained above.
14956 Jumping to non-symbolic addresses like so is @emph{not} supported:
14961 /* Call function at word address 0x2 */
14962 return ((int(*)(void)) 0x2)();
14966 Instead, a stub has to be set up, i.e.@: the function has to be called
14967 through a symbol (@code{func_4} in the example):
14972 extern int func_4 (void);
14974 /* Call function at byte address 0x4 */
14979 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
14980 Alternatively, @code{func_4} can be defined in the linker script.
14983 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
14984 @cindex @code{RAMPD}
14985 @cindex @code{RAMPX}
14986 @cindex @code{RAMPY}
14987 @cindex @code{RAMPZ}
14988 Some AVR devices support memories larger than the 64@tie{}KiB range
14989 that can be accessed with 16-bit pointers. To access memory locations
14990 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
14991 register is used as high part of the address:
14992 The @code{X}, @code{Y}, @code{Z} address register is concatenated
14993 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
14994 register, respectively, to get a wide address. Similarly,
14995 @code{RAMPD} is used together with direct addressing.
14999 The startup code initializes the @code{RAMP} special function
15000 registers with zero.
15003 If a @ref{AVR Named Address Spaces,named address space} other than
15004 generic or @code{__flash} is used, then @code{RAMPZ} is set
15005 as needed before the operation.
15008 If the device supports RAM larger than 64@tie{}KiB and the compiler
15009 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
15010 is reset to zero after the operation.
15013 If the device comes with a specific @code{RAMP} register, the ISR
15014 prologue/epilogue saves/restores that SFR and initializes it with
15015 zero in case the ISR code might (implicitly) use it.
15018 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
15019 If you use inline assembler to read from locations outside the
15020 16-bit address range and change one of the @code{RAMP} registers,
15021 you must reset it to zero after the access.
15025 @subsubsection AVR Built-in Macros
15027 GCC defines several built-in macros so that the user code can test
15028 for the presence or absence of features. Almost any of the following
15029 built-in macros are deduced from device capabilities and thus
15030 triggered by the @option{-mmcu=} command-line option.
15032 For even more AVR-specific built-in macros see
15033 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
15038 Build-in macro that resolves to a decimal number that identifies the
15039 architecture and depends on the @option{-mmcu=@var{mcu}} option.
15040 Possible values are:
15042 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
15043 @code{4}, @code{5}, @code{51}, @code{6}
15045 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
15046 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
15050 @code{100}, @code{102}, @code{104},
15051 @code{105}, @code{106}, @code{107}
15053 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
15054 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
15055 If @var{mcu} specifies a device, this built-in macro is set
15056 accordingly. For example, with @option{-mmcu=atmega8} the macro is
15057 defined to @code{4}.
15059 @item __AVR_@var{Device}__
15060 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
15061 the device's name. For example, @option{-mmcu=atmega8} defines the
15062 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
15063 @code{__AVR_ATtiny261A__}, etc.
15065 The built-in macros' names follow
15066 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
15067 the device name as from the AVR user manual. The difference between
15068 @var{Device} in the built-in macro and @var{device} in
15069 @option{-mmcu=@var{device}} is that the latter is always lowercase.
15071 If @var{device} is not a device but only a core architecture like
15072 @samp{avr51}, this macro is not defined.
15074 @item __AVR_DEVICE_NAME__
15075 Setting @option{-mmcu=@var{device}} defines this built-in macro to
15076 the device's name. For example, with @option{-mmcu=atmega8} the macro
15077 is defined to @code{atmega8}.
15079 If @var{device} is not a device but only a core architecture like
15080 @samp{avr51}, this macro is not defined.
15082 @item __AVR_XMEGA__
15083 The device / architecture belongs to the XMEGA family of devices.
15085 @item __AVR_HAVE_ELPM__
15086 The device has the @code{ELPM} instruction.
15088 @item __AVR_HAVE_ELPMX__
15089 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
15090 R@var{n},Z+} instructions.
15092 @item __AVR_HAVE_MOVW__
15093 The device has the @code{MOVW} instruction to perform 16-bit
15094 register-register moves.
15096 @item __AVR_HAVE_LPMX__
15097 The device has the @code{LPM R@var{n},Z} and
15098 @code{LPM R@var{n},Z+} instructions.
15100 @item __AVR_HAVE_MUL__
15101 The device has a hardware multiplier.
15103 @item __AVR_HAVE_JMP_CALL__
15104 The device has the @code{JMP} and @code{CALL} instructions.
15105 This is the case for devices with at least 16@tie{}KiB of program
15108 @item __AVR_HAVE_EIJMP_EICALL__
15109 @itemx __AVR_3_BYTE_PC__
15110 The device has the @code{EIJMP} and @code{EICALL} instructions.
15111 This is the case for devices with more than 128@tie{}KiB of program memory.
15112 This also means that the program counter
15113 (PC) is 3@tie{}bytes wide.
15115 @item __AVR_2_BYTE_PC__
15116 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
15117 with up to 128@tie{}KiB of program memory.
15119 @item __AVR_HAVE_8BIT_SP__
15120 @itemx __AVR_HAVE_16BIT_SP__
15121 The stack pointer (SP) register is treated as 8-bit respectively
15122 16-bit register by the compiler.
15123 The definition of these macros is affected by @option{-mtiny-stack}.
15125 @item __AVR_HAVE_SPH__
15127 The device has the SPH (high part of stack pointer) special function
15128 register or has an 8-bit stack pointer, respectively.
15129 The definition of these macros is affected by @option{-mmcu=} and
15130 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
15133 @item __AVR_HAVE_RAMPD__
15134 @itemx __AVR_HAVE_RAMPX__
15135 @itemx __AVR_HAVE_RAMPY__
15136 @itemx __AVR_HAVE_RAMPZ__
15137 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
15138 @code{RAMPZ} special function register, respectively.
15140 @item __NO_INTERRUPTS__
15141 This macro reflects the @option{-mno-interrupts} command-line option.
15143 @item __AVR_ERRATA_SKIP__
15144 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
15145 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
15146 instructions because of a hardware erratum. Skip instructions are
15147 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
15148 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
15151 @item __AVR_ISA_RMW__
15152 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
15154 @item __AVR_SFR_OFFSET__=@var{offset}
15155 Instructions that can address I/O special function registers directly
15156 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
15157 address as if addressed by an instruction to access RAM like @code{LD}
15158 or @code{STS}. This offset depends on the device architecture and has
15159 to be subtracted from the RAM address in order to get the
15160 respective I/O@tie{}address.
15162 @item __WITH_AVRLIBC__
15163 The compiler is configured to be used together with AVR-Libc.
15164 See the @option{--with-avrlibc} configure option.
15168 @node Blackfin Options
15169 @subsection Blackfin Options
15170 @cindex Blackfin Options
15173 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
15175 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
15176 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
15177 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
15178 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
15179 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
15180 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
15181 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
15182 @samp{bf561}, @samp{bf592}.
15184 The optional @var{sirevision} specifies the silicon revision of the target
15185 Blackfin processor. Any workarounds available for the targeted silicon revision
15186 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
15187 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
15188 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
15189 hexadecimal digits representing the major and minor numbers in the silicon
15190 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
15191 is not defined. If @var{sirevision} is @samp{any}, the
15192 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
15193 If this optional @var{sirevision} is not used, GCC assumes the latest known
15194 silicon revision of the targeted Blackfin processor.
15196 GCC defines a preprocessor macro for the specified @var{cpu}.
15197 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
15198 provided by libgloss to be linked in if @option{-msim} is not given.
15200 Without this option, @samp{bf532} is used as the processor by default.
15202 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
15203 only the preprocessor macro is defined.
15207 Specifies that the program will be run on the simulator. This causes
15208 the simulator BSP provided by libgloss to be linked in. This option
15209 has effect only for @samp{bfin-elf} toolchain.
15210 Certain other options, such as @option{-mid-shared-library} and
15211 @option{-mfdpic}, imply @option{-msim}.
15213 @item -momit-leaf-frame-pointer
15214 @opindex momit-leaf-frame-pointer
15215 Don't keep the frame pointer in a register for leaf functions. This
15216 avoids the instructions to save, set up and restore frame pointers and
15217 makes an extra register available in leaf functions. The option
15218 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
15219 which might make debugging harder.
15221 @item -mspecld-anomaly
15222 @opindex mspecld-anomaly
15223 When enabled, the compiler ensures that the generated code does not
15224 contain speculative loads after jump instructions. If this option is used,
15225 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
15227 @item -mno-specld-anomaly
15228 @opindex mno-specld-anomaly
15229 Don't generate extra code to prevent speculative loads from occurring.
15231 @item -mcsync-anomaly
15232 @opindex mcsync-anomaly
15233 When enabled, the compiler ensures that the generated code does not
15234 contain CSYNC or SSYNC instructions too soon after conditional branches.
15235 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
15237 @item -mno-csync-anomaly
15238 @opindex mno-csync-anomaly
15239 Don't generate extra code to prevent CSYNC or SSYNC instructions from
15240 occurring too soon after a conditional branch.
15244 When enabled, the compiler is free to take advantage of the knowledge that
15245 the entire program fits into the low 64k of memory.
15248 @opindex mno-low-64k
15249 Assume that the program is arbitrarily large. This is the default.
15251 @item -mstack-check-l1
15252 @opindex mstack-check-l1
15253 Do stack checking using information placed into L1 scratchpad memory by the
15256 @item -mid-shared-library
15257 @opindex mid-shared-library
15258 Generate code that supports shared libraries via the library ID method.
15259 This allows for execute in place and shared libraries in an environment
15260 without virtual memory management. This option implies @option{-fPIC}.
15261 With a @samp{bfin-elf} target, this option implies @option{-msim}.
15263 @item -mno-id-shared-library
15264 @opindex mno-id-shared-library
15265 Generate code that doesn't assume ID-based shared libraries are being used.
15266 This is the default.
15268 @item -mleaf-id-shared-library
15269 @opindex mleaf-id-shared-library
15270 Generate code that supports shared libraries via the library ID method,
15271 but assumes that this library or executable won't link against any other
15272 ID shared libraries. That allows the compiler to use faster code for jumps
15275 @item -mno-leaf-id-shared-library
15276 @opindex mno-leaf-id-shared-library
15277 Do not assume that the code being compiled won't link against any ID shared
15278 libraries. Slower code is generated for jump and call insns.
15280 @item -mshared-library-id=n
15281 @opindex mshared-library-id
15282 Specifies the identification number of the ID-based shared library being
15283 compiled. Specifying a value of 0 generates more compact code; specifying
15284 other values forces the allocation of that number to the current
15285 library but is no more space- or time-efficient than omitting this option.
15289 Generate code that allows the data segment to be located in a different
15290 area of memory from the text segment. This allows for execute in place in
15291 an environment without virtual memory management by eliminating relocations
15292 against the text section.
15294 @item -mno-sep-data
15295 @opindex mno-sep-data
15296 Generate code that assumes that the data segment follows the text segment.
15297 This is the default.
15300 @itemx -mno-long-calls
15301 @opindex mlong-calls
15302 @opindex mno-long-calls
15303 Tells the compiler to perform function calls by first loading the
15304 address of the function into a register and then performing a subroutine
15305 call on this register. This switch is needed if the target function
15306 lies outside of the 24-bit addressing range of the offset-based
15307 version of subroutine call instruction.
15309 This feature is not enabled by default. Specifying
15310 @option{-mno-long-calls} restores the default behavior. Note these
15311 switches have no effect on how the compiler generates code to handle
15312 function calls via function pointers.
15316 Link with the fast floating-point library. This library relaxes some of
15317 the IEEE floating-point standard's rules for checking inputs against
15318 Not-a-Number (NAN), in the interest of performance.
15321 @opindex minline-plt
15322 Enable inlining of PLT entries in function calls to functions that are
15323 not known to bind locally. It has no effect without @option{-mfdpic}.
15326 @opindex mmulticore
15327 Build a standalone application for multicore Blackfin processors.
15328 This option causes proper start files and link scripts supporting
15329 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
15330 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
15332 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
15333 selects the one-application-per-core programming model. Without
15334 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
15335 programming model is used. In this model, the main function of Core B
15336 should be named as @code{coreb_main}.
15338 If this option is not used, the single-core application programming
15343 Build a standalone application for Core A of BF561 when using
15344 the one-application-per-core programming model. Proper start files
15345 and link scripts are used to support Core A, and the macro
15346 @code{__BFIN_COREA} is defined.
15347 This option can only be used in conjunction with @option{-mmulticore}.
15351 Build a standalone application for Core B of BF561 when using
15352 the one-application-per-core programming model. Proper start files
15353 and link scripts are used to support Core B, and the macro
15354 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
15355 should be used instead of @code{main}.
15356 This option can only be used in conjunction with @option{-mmulticore}.
15360 Build a standalone application for SDRAM. Proper start files and
15361 link scripts are used to put the application into SDRAM, and the macro
15362 @code{__BFIN_SDRAM} is defined.
15363 The loader should initialize SDRAM before loading the application.
15367 Assume that ICPLBs are enabled at run time. This has an effect on certain
15368 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
15369 are enabled; for standalone applications the default is off.
15373 @subsection C6X Options
15374 @cindex C6X Options
15377 @item -march=@var{name}
15379 This specifies the name of the target architecture. GCC uses this
15380 name to determine what kind of instructions it can emit when generating
15381 assembly code. Permissible names are: @samp{c62x},
15382 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
15385 @opindex mbig-endian
15386 Generate code for a big-endian target.
15388 @item -mlittle-endian
15389 @opindex mlittle-endian
15390 Generate code for a little-endian target. This is the default.
15394 Choose startup files and linker script suitable for the simulator.
15396 @item -msdata=default
15397 @opindex msdata=default
15398 Put small global and static data in the @code{.neardata} section,
15399 which is pointed to by register @code{B14}. Put small uninitialized
15400 global and static data in the @code{.bss} section, which is adjacent
15401 to the @code{.neardata} section. Put small read-only data into the
15402 @code{.rodata} section. The corresponding sections used for large
15403 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
15406 @opindex msdata=all
15407 Put all data, not just small objects, into the sections reserved for
15408 small data, and use addressing relative to the @code{B14} register to
15412 @opindex msdata=none
15413 Make no use of the sections reserved for small data, and use absolute
15414 addresses to access all data. Put all initialized global and static
15415 data in the @code{.fardata} section, and all uninitialized data in the
15416 @code{.far} section. Put all constant data into the @code{.const}
15421 @subsection CRIS Options
15422 @cindex CRIS Options
15424 These options are defined specifically for the CRIS ports.
15427 @item -march=@var{architecture-type}
15428 @itemx -mcpu=@var{architecture-type}
15431 Generate code for the specified architecture. The choices for
15432 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
15433 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
15434 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
15437 @item -mtune=@var{architecture-type}
15439 Tune to @var{architecture-type} everything applicable about the generated
15440 code, except for the ABI and the set of available instructions. The
15441 choices for @var{architecture-type} are the same as for
15442 @option{-march=@var{architecture-type}}.
15444 @item -mmax-stack-frame=@var{n}
15445 @opindex mmax-stack-frame
15446 Warn when the stack frame of a function exceeds @var{n} bytes.
15452 The options @option{-metrax4} and @option{-metrax100} are synonyms for
15453 @option{-march=v3} and @option{-march=v8} respectively.
15455 @item -mmul-bug-workaround
15456 @itemx -mno-mul-bug-workaround
15457 @opindex mmul-bug-workaround
15458 @opindex mno-mul-bug-workaround
15459 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
15460 models where it applies. This option is active by default.
15464 Enable CRIS-specific verbose debug-related information in the assembly
15465 code. This option also has the effect of turning off the @samp{#NO_APP}
15466 formatted-code indicator to the assembler at the beginning of the
15471 Do not use condition-code results from previous instruction; always emit
15472 compare and test instructions before use of condition codes.
15474 @item -mno-side-effects
15475 @opindex mno-side-effects
15476 Do not emit instructions with side effects in addressing modes other than
15479 @item -mstack-align
15480 @itemx -mno-stack-align
15481 @itemx -mdata-align
15482 @itemx -mno-data-align
15483 @itemx -mconst-align
15484 @itemx -mno-const-align
15485 @opindex mstack-align
15486 @opindex mno-stack-align
15487 @opindex mdata-align
15488 @opindex mno-data-align
15489 @opindex mconst-align
15490 @opindex mno-const-align
15491 These options (@samp{no-} options) arrange (eliminate arrangements) for the
15492 stack frame, individual data and constants to be aligned for the maximum
15493 single data access size for the chosen CPU model. The default is to
15494 arrange for 32-bit alignment. ABI details such as structure layout are
15495 not affected by these options.
15503 Similar to the stack- data- and const-align options above, these options
15504 arrange for stack frame, writable data and constants to all be 32-bit,
15505 16-bit or 8-bit aligned. The default is 32-bit alignment.
15507 @item -mno-prologue-epilogue
15508 @itemx -mprologue-epilogue
15509 @opindex mno-prologue-epilogue
15510 @opindex mprologue-epilogue
15511 With @option{-mno-prologue-epilogue}, the normal function prologue and
15512 epilogue which set up the stack frame are omitted and no return
15513 instructions or return sequences are generated in the code. Use this
15514 option only together with visual inspection of the compiled code: no
15515 warnings or errors are generated when call-saved registers must be saved,
15516 or storage for local variables needs to be allocated.
15520 @opindex mno-gotplt
15522 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
15523 instruction sequences that load addresses for functions from the PLT part
15524 of the GOT rather than (traditional on other architectures) calls to the
15525 PLT@. The default is @option{-mgotplt}.
15529 Legacy no-op option only recognized with the cris-axis-elf and
15530 cris-axis-linux-gnu targets.
15534 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
15538 This option, recognized for the cris-axis-elf, arranges
15539 to link with input-output functions from a simulator library. Code,
15540 initialized data and zero-initialized data are allocated consecutively.
15544 Like @option{-sim}, but pass linker options to locate initialized data at
15545 0x40000000 and zero-initialized data at 0x80000000.
15549 @subsection CR16 Options
15550 @cindex CR16 Options
15552 These options are defined specifically for the CR16 ports.
15558 Enable the use of multiply-accumulate instructions. Disabled by default.
15562 @opindex mcr16cplus
15564 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
15569 Links the library libsim.a which is in compatible with simulator. Applicable
15570 to ELF compiler only.
15574 Choose integer type as 32-bit wide.
15578 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
15580 @item -mdata-model=@var{model}
15581 @opindex mdata-model
15582 Choose a data model. The choices for @var{model} are @samp{near},
15583 @samp{far} or @samp{medium}. @samp{medium} is default.
15584 However, @samp{far} is not valid with @option{-mcr16c}, as the
15585 CR16C architecture does not support the far data model.
15588 @node Darwin Options
15589 @subsection Darwin Options
15590 @cindex Darwin options
15592 These options are defined for all architectures running the Darwin operating
15595 FSF GCC on Darwin does not create ``fat'' object files; it creates
15596 an object file for the single architecture that GCC was built to
15597 target. Apple's GCC on Darwin does create ``fat'' files if multiple
15598 @option{-arch} options are used; it does so by running the compiler or
15599 linker multiple times and joining the results together with
15602 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
15603 @samp{i686}) is determined by the flags that specify the ISA
15604 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
15605 @option{-force_cpusubtype_ALL} option can be used to override this.
15607 The Darwin tools vary in their behavior when presented with an ISA
15608 mismatch. The assembler, @file{as}, only permits instructions to
15609 be used that are valid for the subtype of the file it is generating,
15610 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
15611 The linker for shared libraries, @file{/usr/bin/libtool}, fails
15612 and prints an error if asked to create a shared library with a less
15613 restrictive subtype than its input files (for instance, trying to put
15614 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
15615 for executables, @command{ld}, quietly gives the executable the most
15616 restrictive subtype of any of its input files.
15621 Add the framework directory @var{dir} to the head of the list of
15622 directories to be searched for header files. These directories are
15623 interleaved with those specified by @option{-I} options and are
15624 scanned in a left-to-right order.
15626 A framework directory is a directory with frameworks in it. A
15627 framework is a directory with a @file{Headers} and/or
15628 @file{PrivateHeaders} directory contained directly in it that ends
15629 in @file{.framework}. The name of a framework is the name of this
15630 directory excluding the @file{.framework}. Headers associated with
15631 the framework are found in one of those two directories, with
15632 @file{Headers} being searched first. A subframework is a framework
15633 directory that is in a framework's @file{Frameworks} directory.
15634 Includes of subframework headers can only appear in a header of a
15635 framework that contains the subframework, or in a sibling subframework
15636 header. Two subframeworks are siblings if they occur in the same
15637 framework. A subframework should not have the same name as a
15638 framework; a warning is issued if this is violated. Currently a
15639 subframework cannot have subframeworks; in the future, the mechanism
15640 may be extended to support this. The standard frameworks can be found
15641 in @file{/System/Library/Frameworks} and
15642 @file{/Library/Frameworks}. An example include looks like
15643 @code{#include <Framework/header.h>}, where @file{Framework} denotes
15644 the name of the framework and @file{header.h} is found in the
15645 @file{PrivateHeaders} or @file{Headers} directory.
15647 @item -iframework@var{dir}
15648 @opindex iframework
15649 Like @option{-F} except the directory is a treated as a system
15650 directory. The main difference between this @option{-iframework} and
15651 @option{-F} is that with @option{-iframework} the compiler does not
15652 warn about constructs contained within header files found via
15653 @var{dir}. This option is valid only for the C family of languages.
15657 Emit debugging information for symbols that are used. For stabs
15658 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
15659 This is by default ON@.
15663 Emit debugging information for all symbols and types.
15665 @item -mmacosx-version-min=@var{version}
15666 The earliest version of MacOS X that this executable will run on
15667 is @var{version}. Typical values of @var{version} include @code{10.1},
15668 @code{10.2}, and @code{10.3.9}.
15670 If the compiler was built to use the system's headers by default,
15671 then the default for this option is the system version on which the
15672 compiler is running, otherwise the default is to make choices that
15673 are compatible with as many systems and code bases as possible.
15677 Enable kernel development mode. The @option{-mkernel} option sets
15678 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
15679 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
15680 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
15681 applicable. This mode also sets @option{-mno-altivec},
15682 @option{-msoft-float}, @option{-fno-builtin} and
15683 @option{-mlong-branch} for PowerPC targets.
15685 @item -mone-byte-bool
15686 @opindex mone-byte-bool
15687 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
15688 By default @code{sizeof(bool)} is @code{4} when compiling for
15689 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
15690 option has no effect on x86.
15692 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
15693 to generate code that is not binary compatible with code generated
15694 without that switch. Using this switch may require recompiling all
15695 other modules in a program, including system libraries. Use this
15696 switch to conform to a non-default data model.
15698 @item -mfix-and-continue
15699 @itemx -ffix-and-continue
15700 @itemx -findirect-data
15701 @opindex mfix-and-continue
15702 @opindex ffix-and-continue
15703 @opindex findirect-data
15704 Generate code suitable for fast turnaround development, such as to
15705 allow GDB to dynamically load @file{.o} files into already-running
15706 programs. @option{-findirect-data} and @option{-ffix-and-continue}
15707 are provided for backwards compatibility.
15711 Loads all members of static archive libraries.
15712 See man ld(1) for more information.
15714 @item -arch_errors_fatal
15715 @opindex arch_errors_fatal
15716 Cause the errors having to do with files that have the wrong architecture
15719 @item -bind_at_load
15720 @opindex bind_at_load
15721 Causes the output file to be marked such that the dynamic linker will
15722 bind all undefined references when the file is loaded or launched.
15726 Produce a Mach-o bundle format file.
15727 See man ld(1) for more information.
15729 @item -bundle_loader @var{executable}
15730 @opindex bundle_loader
15731 This option specifies the @var{executable} that will load the build
15732 output file being linked. See man ld(1) for more information.
15735 @opindex dynamiclib
15736 When passed this option, GCC produces a dynamic library instead of
15737 an executable when linking, using the Darwin @file{libtool} command.
15739 @item -force_cpusubtype_ALL
15740 @opindex force_cpusubtype_ALL
15741 This causes GCC's output file to have the @samp{ALL} subtype, instead of
15742 one controlled by the @option{-mcpu} or @option{-march} option.
15744 @item -allowable_client @var{client_name}
15745 @itemx -client_name
15746 @itemx -compatibility_version
15747 @itemx -current_version
15749 @itemx -dependency-file
15751 @itemx -dylinker_install_name
15753 @itemx -exported_symbols_list
15756 @itemx -flat_namespace
15757 @itemx -force_flat_namespace
15758 @itemx -headerpad_max_install_names
15761 @itemx -install_name
15762 @itemx -keep_private_externs
15763 @itemx -multi_module
15764 @itemx -multiply_defined
15765 @itemx -multiply_defined_unused
15768 @itemx -no_dead_strip_inits_and_terms
15769 @itemx -nofixprebinding
15770 @itemx -nomultidefs
15772 @itemx -noseglinkedit
15773 @itemx -pagezero_size
15775 @itemx -prebind_all_twolevel_modules
15776 @itemx -private_bundle
15778 @itemx -read_only_relocs
15780 @itemx -sectobjectsymbols
15784 @itemx -sectobjectsymbols
15787 @itemx -segs_read_only_addr
15789 @itemx -segs_read_write_addr
15790 @itemx -seg_addr_table
15791 @itemx -seg_addr_table_filename
15792 @itemx -seglinkedit
15794 @itemx -segs_read_only_addr
15795 @itemx -segs_read_write_addr
15796 @itemx -single_module
15798 @itemx -sub_library
15800 @itemx -sub_umbrella
15801 @itemx -twolevel_namespace
15804 @itemx -unexported_symbols_list
15805 @itemx -weak_reference_mismatches
15806 @itemx -whatsloaded
15807 @opindex allowable_client
15808 @opindex client_name
15809 @opindex compatibility_version
15810 @opindex current_version
15811 @opindex dead_strip
15812 @opindex dependency-file
15813 @opindex dylib_file
15814 @opindex dylinker_install_name
15816 @opindex exported_symbols_list
15818 @opindex flat_namespace
15819 @opindex force_flat_namespace
15820 @opindex headerpad_max_install_names
15821 @opindex image_base
15823 @opindex install_name
15824 @opindex keep_private_externs
15825 @opindex multi_module
15826 @opindex multiply_defined
15827 @opindex multiply_defined_unused
15828 @opindex noall_load
15829 @opindex no_dead_strip_inits_and_terms
15830 @opindex nofixprebinding
15831 @opindex nomultidefs
15833 @opindex noseglinkedit
15834 @opindex pagezero_size
15836 @opindex prebind_all_twolevel_modules
15837 @opindex private_bundle
15838 @opindex read_only_relocs
15840 @opindex sectobjectsymbols
15843 @opindex sectcreate
15844 @opindex sectobjectsymbols
15847 @opindex segs_read_only_addr
15848 @opindex segs_read_write_addr
15849 @opindex seg_addr_table
15850 @opindex seg_addr_table_filename
15851 @opindex seglinkedit
15853 @opindex segs_read_only_addr
15854 @opindex segs_read_write_addr
15855 @opindex single_module
15857 @opindex sub_library
15858 @opindex sub_umbrella
15859 @opindex twolevel_namespace
15862 @opindex unexported_symbols_list
15863 @opindex weak_reference_mismatches
15864 @opindex whatsloaded
15865 These options are passed to the Darwin linker. The Darwin linker man page
15866 describes them in detail.
15869 @node DEC Alpha Options
15870 @subsection DEC Alpha Options
15872 These @samp{-m} options are defined for the DEC Alpha implementations:
15875 @item -mno-soft-float
15876 @itemx -msoft-float
15877 @opindex mno-soft-float
15878 @opindex msoft-float
15879 Use (do not use) the hardware floating-point instructions for
15880 floating-point operations. When @option{-msoft-float} is specified,
15881 functions in @file{libgcc.a} are used to perform floating-point
15882 operations. Unless they are replaced by routines that emulate the
15883 floating-point operations, or compiled in such a way as to call such
15884 emulations routines, these routines issue floating-point
15885 operations. If you are compiling for an Alpha without floating-point
15886 operations, you must ensure that the library is built so as not to call
15889 Note that Alpha implementations without floating-point operations are
15890 required to have floating-point registers.
15893 @itemx -mno-fp-regs
15895 @opindex mno-fp-regs
15896 Generate code that uses (does not use) the floating-point register set.
15897 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
15898 register set is not used, floating-point operands are passed in integer
15899 registers as if they were integers and floating-point results are passed
15900 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
15901 so any function with a floating-point argument or return value called by code
15902 compiled with @option{-mno-fp-regs} must also be compiled with that
15905 A typical use of this option is building a kernel that does not use,
15906 and hence need not save and restore, any floating-point registers.
15910 The Alpha architecture implements floating-point hardware optimized for
15911 maximum performance. It is mostly compliant with the IEEE floating-point
15912 standard. However, for full compliance, software assistance is
15913 required. This option generates code fully IEEE-compliant code
15914 @emph{except} that the @var{inexact-flag} is not maintained (see below).
15915 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
15916 defined during compilation. The resulting code is less efficient but is
15917 able to correctly support denormalized numbers and exceptional IEEE
15918 values such as not-a-number and plus/minus infinity. Other Alpha
15919 compilers call this option @option{-ieee_with_no_inexact}.
15921 @item -mieee-with-inexact
15922 @opindex mieee-with-inexact
15923 This is like @option{-mieee} except the generated code also maintains
15924 the IEEE @var{inexact-flag}. Turning on this option causes the
15925 generated code to implement fully-compliant IEEE math. In addition to
15926 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
15927 macro. On some Alpha implementations the resulting code may execute
15928 significantly slower than the code generated by default. Since there is
15929 very little code that depends on the @var{inexact-flag}, you should
15930 normally not specify this option. Other Alpha compilers call this
15931 option @option{-ieee_with_inexact}.
15933 @item -mfp-trap-mode=@var{trap-mode}
15934 @opindex mfp-trap-mode
15935 This option controls what floating-point related traps are enabled.
15936 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
15937 The trap mode can be set to one of four values:
15941 This is the default (normal) setting. The only traps that are enabled
15942 are the ones that cannot be disabled in software (e.g., division by zero
15946 In addition to the traps enabled by @samp{n}, underflow traps are enabled
15950 Like @samp{u}, but the instructions are marked to be safe for software
15951 completion (see Alpha architecture manual for details).
15954 Like @samp{su}, but inexact traps are enabled as well.
15957 @item -mfp-rounding-mode=@var{rounding-mode}
15958 @opindex mfp-rounding-mode
15959 Selects the IEEE rounding mode. Other Alpha compilers call this option
15960 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
15965 Normal IEEE rounding mode. Floating-point numbers are rounded towards
15966 the nearest machine number or towards the even machine number in case
15970 Round towards minus infinity.
15973 Chopped rounding mode. Floating-point numbers are rounded towards zero.
15976 Dynamic rounding mode. A field in the floating-point control register
15977 (@var{fpcr}, see Alpha architecture reference manual) controls the
15978 rounding mode in effect. The C library initializes this register for
15979 rounding towards plus infinity. Thus, unless your program modifies the
15980 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
15983 @item -mtrap-precision=@var{trap-precision}
15984 @opindex mtrap-precision
15985 In the Alpha architecture, floating-point traps are imprecise. This
15986 means without software assistance it is impossible to recover from a
15987 floating trap and program execution normally needs to be terminated.
15988 GCC can generate code that can assist operating system trap handlers
15989 in determining the exact location that caused a floating-point trap.
15990 Depending on the requirements of an application, different levels of
15991 precisions can be selected:
15995 Program precision. This option is the default and means a trap handler
15996 can only identify which program caused a floating-point exception.
15999 Function precision. The trap handler can determine the function that
16000 caused a floating-point exception.
16003 Instruction precision. The trap handler can determine the exact
16004 instruction that caused a floating-point exception.
16007 Other Alpha compilers provide the equivalent options called
16008 @option{-scope_safe} and @option{-resumption_safe}.
16010 @item -mieee-conformant
16011 @opindex mieee-conformant
16012 This option marks the generated code as IEEE conformant. You must not
16013 use this option unless you also specify @option{-mtrap-precision=i} and either
16014 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
16015 is to emit the line @samp{.eflag 48} in the function prologue of the
16016 generated assembly file.
16018 @item -mbuild-constants
16019 @opindex mbuild-constants
16020 Normally GCC examines a 32- or 64-bit integer constant to
16021 see if it can construct it from smaller constants in two or three
16022 instructions. If it cannot, it outputs the constant as a literal and
16023 generates code to load it from the data segment at run time.
16025 Use this option to require GCC to construct @emph{all} integer constants
16026 using code, even if it takes more instructions (the maximum is six).
16028 You typically use this option to build a shared library dynamic
16029 loader. Itself a shared library, it must relocate itself in memory
16030 before it can find the variables and constants in its own data segment.
16048 Indicate whether GCC should generate code to use the optional BWX,
16049 CIX, FIX and MAX instruction sets. The default is to use the instruction
16050 sets supported by the CPU type specified via @option{-mcpu=} option or that
16051 of the CPU on which GCC was built if none is specified.
16054 @itemx -mfloat-ieee
16055 @opindex mfloat-vax
16056 @opindex mfloat-ieee
16057 Generate code that uses (does not use) VAX F and G floating-point
16058 arithmetic instead of IEEE single and double precision.
16060 @item -mexplicit-relocs
16061 @itemx -mno-explicit-relocs
16062 @opindex mexplicit-relocs
16063 @opindex mno-explicit-relocs
16064 Older Alpha assemblers provided no way to generate symbol relocations
16065 except via assembler macros. Use of these macros does not allow
16066 optimal instruction scheduling. GNU binutils as of version 2.12
16067 supports a new syntax that allows the compiler to explicitly mark
16068 which relocations should apply to which instructions. This option
16069 is mostly useful for debugging, as GCC detects the capabilities of
16070 the assembler when it is built and sets the default accordingly.
16073 @itemx -mlarge-data
16074 @opindex msmall-data
16075 @opindex mlarge-data
16076 When @option{-mexplicit-relocs} is in effect, static data is
16077 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
16078 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
16079 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
16080 16-bit relocations off of the @code{$gp} register. This limits the
16081 size of the small data area to 64KB, but allows the variables to be
16082 directly accessed via a single instruction.
16084 The default is @option{-mlarge-data}. With this option the data area
16085 is limited to just below 2GB@. Programs that require more than 2GB of
16086 data must use @code{malloc} or @code{mmap} to allocate the data in the
16087 heap instead of in the program's data segment.
16089 When generating code for shared libraries, @option{-fpic} implies
16090 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
16093 @itemx -mlarge-text
16094 @opindex msmall-text
16095 @opindex mlarge-text
16096 When @option{-msmall-text} is used, the compiler assumes that the
16097 code of the entire program (or shared library) fits in 4MB, and is
16098 thus reachable with a branch instruction. When @option{-msmall-data}
16099 is used, the compiler can assume that all local symbols share the
16100 same @code{$gp} value, and thus reduce the number of instructions
16101 required for a function call from 4 to 1.
16103 The default is @option{-mlarge-text}.
16105 @item -mcpu=@var{cpu_type}
16107 Set the instruction set and instruction scheduling parameters for
16108 machine type @var{cpu_type}. You can specify either the @samp{EV}
16109 style name or the corresponding chip number. GCC supports scheduling
16110 parameters for the EV4, EV5 and EV6 family of processors and
16111 chooses the default values for the instruction set from the processor
16112 you specify. If you do not specify a processor type, GCC defaults
16113 to the processor on which the compiler was built.
16115 Supported values for @var{cpu_type} are
16121 Schedules as an EV4 and has no instruction set extensions.
16125 Schedules as an EV5 and has no instruction set extensions.
16129 Schedules as an EV5 and supports the BWX extension.
16134 Schedules as an EV5 and supports the BWX and MAX extensions.
16138 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
16142 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
16145 Native toolchains also support the value @samp{native},
16146 which selects the best architecture option for the host processor.
16147 @option{-mcpu=native} has no effect if GCC does not recognize
16150 @item -mtune=@var{cpu_type}
16152 Set only the instruction scheduling parameters for machine type
16153 @var{cpu_type}. The instruction set is not changed.
16155 Native toolchains also support the value @samp{native},
16156 which selects the best architecture option for the host processor.
16157 @option{-mtune=native} has no effect if GCC does not recognize
16160 @item -mmemory-latency=@var{time}
16161 @opindex mmemory-latency
16162 Sets the latency the scheduler should assume for typical memory
16163 references as seen by the application. This number is highly
16164 dependent on the memory access patterns used by the application
16165 and the size of the external cache on the machine.
16167 Valid options for @var{time} are
16171 A decimal number representing clock cycles.
16177 The compiler contains estimates of the number of clock cycles for
16178 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
16179 (also called Dcache, Scache, and Bcache), as well as to main memory.
16180 Note that L3 is only valid for EV5.
16186 @subsection FR30 Options
16187 @cindex FR30 Options
16189 These options are defined specifically for the FR30 port.
16193 @item -msmall-model
16194 @opindex msmall-model
16195 Use the small address space model. This can produce smaller code, but
16196 it does assume that all symbolic values and addresses fit into a
16201 Assume that runtime support has been provided and so there is no need
16202 to include the simulator library (@file{libsim.a}) on the linker
16208 @subsection FT32 Options
16209 @cindex FT32 Options
16211 These options are defined specifically for the FT32 port.
16217 Specifies that the program will be run on the simulator. This causes
16218 an alternate runtime startup and library to be linked.
16219 You must not use this option when generating programs that will run on
16220 real hardware; you must provide your own runtime library for whatever
16221 I/O functions are needed.
16225 Enable Local Register Allocation. This is still experimental for FT32,
16226 so by default the compiler uses standard reload.
16230 Do not use div and mod instructions.
16235 @subsection FRV Options
16236 @cindex FRV Options
16242 Only use the first 32 general-purpose registers.
16247 Use all 64 general-purpose registers.
16252 Use only the first 32 floating-point registers.
16257 Use all 64 floating-point registers.
16260 @opindex mhard-float
16262 Use hardware instructions for floating-point operations.
16265 @opindex msoft-float
16267 Use library routines for floating-point operations.
16272 Dynamically allocate condition code registers.
16277 Do not try to dynamically allocate condition code registers, only
16278 use @code{icc0} and @code{fcc0}.
16283 Change ABI to use double word insns.
16288 Do not use double word instructions.
16293 Use floating-point double instructions.
16296 @opindex mno-double
16298 Do not use floating-point double instructions.
16303 Use media instructions.
16308 Do not use media instructions.
16313 Use multiply and add/subtract instructions.
16316 @opindex mno-muladd
16318 Do not use multiply and add/subtract instructions.
16323 Select the FDPIC ABI, which uses function descriptors to represent
16324 pointers to functions. Without any PIC/PIE-related options, it
16325 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
16326 assumes GOT entries and small data are within a 12-bit range from the
16327 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
16328 are computed with 32 bits.
16329 With a @samp{bfin-elf} target, this option implies @option{-msim}.
16332 @opindex minline-plt
16334 Enable inlining of PLT entries in function calls to functions that are
16335 not known to bind locally. It has no effect without @option{-mfdpic}.
16336 It's enabled by default if optimizing for speed and compiling for
16337 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
16338 optimization option such as @option{-O3} or above is present in the
16344 Assume a large TLS segment when generating thread-local code.
16349 Do not assume a large TLS segment when generating thread-local code.
16354 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
16355 that is known to be in read-only sections. It's enabled by default,
16356 except for @option{-fpic} or @option{-fpie}: even though it may help
16357 make the global offset table smaller, it trades 1 instruction for 4.
16358 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
16359 one of which may be shared by multiple symbols, and it avoids the need
16360 for a GOT entry for the referenced symbol, so it's more likely to be a
16361 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
16363 @item -multilib-library-pic
16364 @opindex multilib-library-pic
16366 Link with the (library, not FD) pic libraries. It's implied by
16367 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
16368 @option{-fpic} without @option{-mfdpic}. You should never have to use
16372 @opindex mlinked-fp
16374 Follow the EABI requirement of always creating a frame pointer whenever
16375 a stack frame is allocated. This option is enabled by default and can
16376 be disabled with @option{-mno-linked-fp}.
16379 @opindex mlong-calls
16381 Use indirect addressing to call functions outside the current
16382 compilation unit. This allows the functions to be placed anywhere
16383 within the 32-bit address space.
16385 @item -malign-labels
16386 @opindex malign-labels
16388 Try to align labels to an 8-byte boundary by inserting NOPs into the
16389 previous packet. This option only has an effect when VLIW packing
16390 is enabled. It doesn't create new packets; it merely adds NOPs to
16393 @item -mlibrary-pic
16394 @opindex mlibrary-pic
16396 Generate position-independent EABI code.
16401 Use only the first four media accumulator registers.
16406 Use all eight media accumulator registers.
16411 Pack VLIW instructions.
16416 Do not pack VLIW instructions.
16419 @opindex mno-eflags
16421 Do not mark ABI switches in e_flags.
16424 @opindex mcond-move
16426 Enable the use of conditional-move instructions (default).
16428 This switch is mainly for debugging the compiler and will likely be removed
16429 in a future version.
16431 @item -mno-cond-move
16432 @opindex mno-cond-move
16434 Disable the use of conditional-move instructions.
16436 This switch is mainly for debugging the compiler and will likely be removed
16437 in a future version.
16442 Enable the use of conditional set instructions (default).
16444 This switch is mainly for debugging the compiler and will likely be removed
16445 in a future version.
16450 Disable the use of conditional set instructions.
16452 This switch is mainly for debugging the compiler and will likely be removed
16453 in a future version.
16456 @opindex mcond-exec
16458 Enable the use of conditional execution (default).
16460 This switch is mainly for debugging the compiler and will likely be removed
16461 in a future version.
16463 @item -mno-cond-exec
16464 @opindex mno-cond-exec
16466 Disable the use of conditional execution.
16468 This switch is mainly for debugging the compiler and will likely be removed
16469 in a future version.
16471 @item -mvliw-branch
16472 @opindex mvliw-branch
16474 Run a pass to pack branches into VLIW instructions (default).
16476 This switch is mainly for debugging the compiler and will likely be removed
16477 in a future version.
16479 @item -mno-vliw-branch
16480 @opindex mno-vliw-branch
16482 Do not run a pass to pack branches into VLIW instructions.
16484 This switch is mainly for debugging the compiler and will likely be removed
16485 in a future version.
16487 @item -mmulti-cond-exec
16488 @opindex mmulti-cond-exec
16490 Enable optimization of @code{&&} and @code{||} in conditional execution
16493 This switch is mainly for debugging the compiler and will likely be removed
16494 in a future version.
16496 @item -mno-multi-cond-exec
16497 @opindex mno-multi-cond-exec
16499 Disable optimization of @code{&&} and @code{||} in conditional execution.
16501 This switch is mainly for debugging the compiler and will likely be removed
16502 in a future version.
16504 @item -mnested-cond-exec
16505 @opindex mnested-cond-exec
16507 Enable nested conditional execution optimizations (default).
16509 This switch is mainly for debugging the compiler and will likely be removed
16510 in a future version.
16512 @item -mno-nested-cond-exec
16513 @opindex mno-nested-cond-exec
16515 Disable nested conditional execution optimizations.
16517 This switch is mainly for debugging the compiler and will likely be removed
16518 in a future version.
16520 @item -moptimize-membar
16521 @opindex moptimize-membar
16523 This switch removes redundant @code{membar} instructions from the
16524 compiler-generated code. It is enabled by default.
16526 @item -mno-optimize-membar
16527 @opindex mno-optimize-membar
16529 This switch disables the automatic removal of redundant @code{membar}
16530 instructions from the generated code.
16532 @item -mtomcat-stats
16533 @opindex mtomcat-stats
16535 Cause gas to print out tomcat statistics.
16537 @item -mcpu=@var{cpu}
16540 Select the processor type for which to generate code. Possible values are
16541 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
16542 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
16546 @node GNU/Linux Options
16547 @subsection GNU/Linux Options
16549 These @samp{-m} options are defined for GNU/Linux targets:
16554 Use the GNU C library. This is the default except
16555 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
16556 @samp{*-*-linux-*android*} targets.
16560 Use uClibc C library. This is the default on
16561 @samp{*-*-linux-*uclibc*} targets.
16565 Use the musl C library. This is the default on
16566 @samp{*-*-linux-*musl*} targets.
16570 Use Bionic C library. This is the default on
16571 @samp{*-*-linux-*android*} targets.
16575 Compile code compatible with Android platform. This is the default on
16576 @samp{*-*-linux-*android*} targets.
16578 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
16579 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
16580 this option makes the GCC driver pass Android-specific options to the linker.
16581 Finally, this option causes the preprocessor macro @code{__ANDROID__}
16584 @item -tno-android-cc
16585 @opindex tno-android-cc
16586 Disable compilation effects of @option{-mandroid}, i.e., do not enable
16587 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
16588 @option{-fno-rtti} by default.
16590 @item -tno-android-ld
16591 @opindex tno-android-ld
16592 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
16593 linking options to the linker.
16597 @node H8/300 Options
16598 @subsection H8/300 Options
16600 These @samp{-m} options are defined for the H8/300 implementations:
16605 Shorten some address references at link time, when possible; uses the
16606 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
16607 ld, Using ld}, for a fuller description.
16611 Generate code for the H8/300H@.
16615 Generate code for the H8S@.
16619 Generate code for the H8S and H8/300H in the normal mode. This switch
16620 must be used either with @option{-mh} or @option{-ms}.
16624 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
16628 Extended registers are stored on stack before execution of function
16629 with monitor attribute. Default option is @option{-mexr}.
16630 This option is valid only for H8S targets.
16634 Extended registers are not stored on stack before execution of function
16635 with monitor attribute. Default option is @option{-mno-exr}.
16636 This option is valid only for H8S targets.
16640 Make @code{int} data 32 bits by default.
16643 @opindex malign-300
16644 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
16645 The default for the H8/300H and H8S is to align longs and floats on
16647 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
16648 This option has no effect on the H8/300.
16652 @subsection HPPA Options
16653 @cindex HPPA Options
16655 These @samp{-m} options are defined for the HPPA family of computers:
16658 @item -march=@var{architecture-type}
16660 Generate code for the specified architecture. The choices for
16661 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
16662 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
16663 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
16664 architecture option for your machine. Code compiled for lower numbered
16665 architectures runs on higher numbered architectures, but not the
16668 @item -mpa-risc-1-0
16669 @itemx -mpa-risc-1-1
16670 @itemx -mpa-risc-2-0
16671 @opindex mpa-risc-1-0
16672 @opindex mpa-risc-1-1
16673 @opindex mpa-risc-2-0
16674 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
16676 @item -mjump-in-delay
16677 @opindex mjump-in-delay
16678 This option is ignored and provided for compatibility purposes only.
16680 @item -mdisable-fpregs
16681 @opindex mdisable-fpregs
16682 Prevent floating-point registers from being used in any manner. This is
16683 necessary for compiling kernels that perform lazy context switching of
16684 floating-point registers. If you use this option and attempt to perform
16685 floating-point operations, the compiler aborts.
16687 @item -mdisable-indexing
16688 @opindex mdisable-indexing
16689 Prevent the compiler from using indexing address modes. This avoids some
16690 rather obscure problems when compiling MIG generated code under MACH@.
16692 @item -mno-space-regs
16693 @opindex mno-space-regs
16694 Generate code that assumes the target has no space registers. This allows
16695 GCC to generate faster indirect calls and use unscaled index address modes.
16697 Such code is suitable for level 0 PA systems and kernels.
16699 @item -mfast-indirect-calls
16700 @opindex mfast-indirect-calls
16701 Generate code that assumes calls never cross space boundaries. This
16702 allows GCC to emit code that performs faster indirect calls.
16704 This option does not work in the presence of shared libraries or nested
16707 @item -mfixed-range=@var{register-range}
16708 @opindex mfixed-range
16709 Generate code treating the given register range as fixed registers.
16710 A fixed register is one that the register allocator cannot use. This is
16711 useful when compiling kernel code. A register range is specified as
16712 two registers separated by a dash. Multiple register ranges can be
16713 specified separated by a comma.
16715 @item -mlong-load-store
16716 @opindex mlong-load-store
16717 Generate 3-instruction load and store sequences as sometimes required by
16718 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
16721 @item -mportable-runtime
16722 @opindex mportable-runtime
16723 Use the portable calling conventions proposed by HP for ELF systems.
16727 Enable the use of assembler directives only GAS understands.
16729 @item -mschedule=@var{cpu-type}
16731 Schedule code according to the constraints for the machine type
16732 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
16733 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
16734 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
16735 proper scheduling option for your machine. The default scheduling is
16739 @opindex mlinker-opt
16740 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
16741 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
16742 linkers in which they give bogus error messages when linking some programs.
16745 @opindex msoft-float
16746 Generate output containing library calls for floating point.
16747 @strong{Warning:} the requisite libraries are not available for all HPPA
16748 targets. Normally the facilities of the machine's usual C compiler are
16749 used, but this cannot be done directly in cross-compilation. You must make
16750 your own arrangements to provide suitable library functions for
16753 @option{-msoft-float} changes the calling convention in the output file;
16754 therefore, it is only useful if you compile @emph{all} of a program with
16755 this option. In particular, you need to compile @file{libgcc.a}, the
16756 library that comes with GCC, with @option{-msoft-float} in order for
16761 Generate the predefine, @code{_SIO}, for server IO@. The default is
16762 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
16763 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
16764 options are available under HP-UX and HI-UX@.
16768 Use options specific to GNU @command{ld}.
16769 This passes @option{-shared} to @command{ld} when
16770 building a shared library. It is the default when GCC is configured,
16771 explicitly or implicitly, with the GNU linker. This option does not
16772 affect which @command{ld} is called; it only changes what parameters
16773 are passed to that @command{ld}.
16774 The @command{ld} that is called is determined by the
16775 @option{--with-ld} configure option, GCC's program search path, and
16776 finally by the user's @env{PATH}. The linker used by GCC can be printed
16777 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
16778 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16782 Use options specific to HP @command{ld}.
16783 This passes @option{-b} to @command{ld} when building
16784 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
16785 links. It is the default when GCC is configured, explicitly or
16786 implicitly, with the HP linker. This option does not affect
16787 which @command{ld} is called; it only changes what parameters are passed to that
16789 The @command{ld} that is called is determined by the @option{--with-ld}
16790 configure option, GCC's program search path, and finally by the user's
16791 @env{PATH}. The linker used by GCC can be printed using @samp{which
16792 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
16793 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16796 @opindex mno-long-calls
16797 Generate code that uses long call sequences. This ensures that a call
16798 is always able to reach linker generated stubs. The default is to generate
16799 long calls only when the distance from the call site to the beginning
16800 of the function or translation unit, as the case may be, exceeds a
16801 predefined limit set by the branch type being used. The limits for
16802 normal calls are 7,600,000 and 240,000 bytes, respectively for the
16803 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
16806 Distances are measured from the beginning of functions when using the
16807 @option{-ffunction-sections} option, or when using the @option{-mgas}
16808 and @option{-mno-portable-runtime} options together under HP-UX with
16811 It is normally not desirable to use this option as it degrades
16812 performance. However, it may be useful in large applications,
16813 particularly when partial linking is used to build the application.
16815 The types of long calls used depends on the capabilities of the
16816 assembler and linker, and the type of code being generated. The
16817 impact on systems that support long absolute calls, and long pic
16818 symbol-difference or pc-relative calls should be relatively small.
16819 However, an indirect call is used on 32-bit ELF systems in pic code
16820 and it is quite long.
16822 @item -munix=@var{unix-std}
16824 Generate compiler predefines and select a startfile for the specified
16825 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
16826 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
16827 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
16828 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
16829 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
16832 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
16833 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
16834 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
16835 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
16836 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
16837 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
16839 It is @emph{important} to note that this option changes the interfaces
16840 for various library routines. It also affects the operational behavior
16841 of the C library. Thus, @emph{extreme} care is needed in using this
16844 Library code that is intended to operate with more than one UNIX
16845 standard must test, set and restore the variable @code{__xpg4_extended_mask}
16846 as appropriate. Most GNU software doesn't provide this capability.
16850 Suppress the generation of link options to search libdld.sl when the
16851 @option{-static} option is specified on HP-UX 10 and later.
16855 The HP-UX implementation of setlocale in libc has a dependency on
16856 libdld.sl. There isn't an archive version of libdld.sl. Thus,
16857 when the @option{-static} option is specified, special link options
16858 are needed to resolve this dependency.
16860 On HP-UX 10 and later, the GCC driver adds the necessary options to
16861 link with libdld.sl when the @option{-static} option is specified.
16862 This causes the resulting binary to be dynamic. On the 64-bit port,
16863 the linkers generate dynamic binaries by default in any case. The
16864 @option{-nolibdld} option can be used to prevent the GCC driver from
16865 adding these link options.
16869 Add support for multithreading with the @dfn{dce thread} library
16870 under HP-UX@. This option sets flags for both the preprocessor and
16874 @node IA-64 Options
16875 @subsection IA-64 Options
16876 @cindex IA-64 Options
16878 These are the @samp{-m} options defined for the Intel IA-64 architecture.
16882 @opindex mbig-endian
16883 Generate code for a big-endian target. This is the default for HP-UX@.
16885 @item -mlittle-endian
16886 @opindex mlittle-endian
16887 Generate code for a little-endian target. This is the default for AIX5
16893 @opindex mno-gnu-as
16894 Generate (or don't) code for the GNU assembler. This is the default.
16895 @c Also, this is the default if the configure option @option{--with-gnu-as}
16901 @opindex mno-gnu-ld
16902 Generate (or don't) code for the GNU linker. This is the default.
16903 @c Also, this is the default if the configure option @option{--with-gnu-ld}
16908 Generate code that does not use a global pointer register. The result
16909 is not position independent code, and violates the IA-64 ABI@.
16911 @item -mvolatile-asm-stop
16912 @itemx -mno-volatile-asm-stop
16913 @opindex mvolatile-asm-stop
16914 @opindex mno-volatile-asm-stop
16915 Generate (or don't) a stop bit immediately before and after volatile asm
16918 @item -mregister-names
16919 @itemx -mno-register-names
16920 @opindex mregister-names
16921 @opindex mno-register-names
16922 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
16923 the stacked registers. This may make assembler output more readable.
16929 Disable (or enable) optimizations that use the small data section. This may
16930 be useful for working around optimizer bugs.
16932 @item -mconstant-gp
16933 @opindex mconstant-gp
16934 Generate code that uses a single constant global pointer value. This is
16935 useful when compiling kernel code.
16939 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
16940 This is useful when compiling firmware code.
16942 @item -minline-float-divide-min-latency
16943 @opindex minline-float-divide-min-latency
16944 Generate code for inline divides of floating-point values
16945 using the minimum latency algorithm.
16947 @item -minline-float-divide-max-throughput
16948 @opindex minline-float-divide-max-throughput
16949 Generate code for inline divides of floating-point values
16950 using the maximum throughput algorithm.
16952 @item -mno-inline-float-divide
16953 @opindex mno-inline-float-divide
16954 Do not generate inline code for divides of floating-point values.
16956 @item -minline-int-divide-min-latency
16957 @opindex minline-int-divide-min-latency
16958 Generate code for inline divides of integer values
16959 using the minimum latency algorithm.
16961 @item -minline-int-divide-max-throughput
16962 @opindex minline-int-divide-max-throughput
16963 Generate code for inline divides of integer values
16964 using the maximum throughput algorithm.
16966 @item -mno-inline-int-divide
16967 @opindex mno-inline-int-divide
16968 Do not generate inline code for divides of integer values.
16970 @item -minline-sqrt-min-latency
16971 @opindex minline-sqrt-min-latency
16972 Generate code for inline square roots
16973 using the minimum latency algorithm.
16975 @item -minline-sqrt-max-throughput
16976 @opindex minline-sqrt-max-throughput
16977 Generate code for inline square roots
16978 using the maximum throughput algorithm.
16980 @item -mno-inline-sqrt
16981 @opindex mno-inline-sqrt
16982 Do not generate inline code for @code{sqrt}.
16985 @itemx -mno-fused-madd
16986 @opindex mfused-madd
16987 @opindex mno-fused-madd
16988 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
16989 instructions. The default is to use these instructions.
16991 @item -mno-dwarf2-asm
16992 @itemx -mdwarf2-asm
16993 @opindex mno-dwarf2-asm
16994 @opindex mdwarf2-asm
16995 Don't (or do) generate assembler code for the DWARF line number debugging
16996 info. This may be useful when not using the GNU assembler.
16998 @item -mearly-stop-bits
16999 @itemx -mno-early-stop-bits
17000 @opindex mearly-stop-bits
17001 @opindex mno-early-stop-bits
17002 Allow stop bits to be placed earlier than immediately preceding the
17003 instruction that triggered the stop bit. This can improve instruction
17004 scheduling, but does not always do so.
17006 @item -mfixed-range=@var{register-range}
17007 @opindex mfixed-range
17008 Generate code treating the given register range as fixed registers.
17009 A fixed register is one that the register allocator cannot use. This is
17010 useful when compiling kernel code. A register range is specified as
17011 two registers separated by a dash. Multiple register ranges can be
17012 specified separated by a comma.
17014 @item -mtls-size=@var{tls-size}
17016 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
17019 @item -mtune=@var{cpu-type}
17021 Tune the instruction scheduling for a particular CPU, Valid values are
17022 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
17023 and @samp{mckinley}.
17029 Generate code for a 32-bit or 64-bit environment.
17030 The 32-bit environment sets int, long and pointer to 32 bits.
17031 The 64-bit environment sets int to 32 bits and long and pointer
17032 to 64 bits. These are HP-UX specific flags.
17034 @item -mno-sched-br-data-spec
17035 @itemx -msched-br-data-spec
17036 @opindex mno-sched-br-data-spec
17037 @opindex msched-br-data-spec
17038 (Dis/En)able data speculative scheduling before reload.
17039 This results in generation of @code{ld.a} instructions and
17040 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17041 The default setting is disabled.
17043 @item -msched-ar-data-spec
17044 @itemx -mno-sched-ar-data-spec
17045 @opindex msched-ar-data-spec
17046 @opindex mno-sched-ar-data-spec
17047 (En/Dis)able data speculative scheduling after reload.
17048 This results in generation of @code{ld.a} instructions and
17049 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17050 The default setting is enabled.
17052 @item -mno-sched-control-spec
17053 @itemx -msched-control-spec
17054 @opindex mno-sched-control-spec
17055 @opindex msched-control-spec
17056 (Dis/En)able control speculative scheduling. This feature is
17057 available only during region scheduling (i.e.@: before reload).
17058 This results in generation of the @code{ld.s} instructions and
17059 the corresponding check instructions @code{chk.s}.
17060 The default setting is disabled.
17062 @item -msched-br-in-data-spec
17063 @itemx -mno-sched-br-in-data-spec
17064 @opindex msched-br-in-data-spec
17065 @opindex mno-sched-br-in-data-spec
17066 (En/Dis)able speculative scheduling of the instructions that
17067 are dependent on the data speculative loads before reload.
17068 This is effective only with @option{-msched-br-data-spec} enabled.
17069 The default setting is enabled.
17071 @item -msched-ar-in-data-spec
17072 @itemx -mno-sched-ar-in-data-spec
17073 @opindex msched-ar-in-data-spec
17074 @opindex mno-sched-ar-in-data-spec
17075 (En/Dis)able speculative scheduling of the instructions that
17076 are dependent on the data speculative loads after reload.
17077 This is effective only with @option{-msched-ar-data-spec} enabled.
17078 The default setting is enabled.
17080 @item -msched-in-control-spec
17081 @itemx -mno-sched-in-control-spec
17082 @opindex msched-in-control-spec
17083 @opindex mno-sched-in-control-spec
17084 (En/Dis)able speculative scheduling of the instructions that
17085 are dependent on the control speculative loads.
17086 This is effective only with @option{-msched-control-spec} enabled.
17087 The default setting is enabled.
17089 @item -mno-sched-prefer-non-data-spec-insns
17090 @itemx -msched-prefer-non-data-spec-insns
17091 @opindex mno-sched-prefer-non-data-spec-insns
17092 @opindex msched-prefer-non-data-spec-insns
17093 If enabled, data-speculative instructions are chosen for schedule
17094 only if there are no other choices at the moment. This makes
17095 the use of the data speculation much more conservative.
17096 The default setting is disabled.
17098 @item -mno-sched-prefer-non-control-spec-insns
17099 @itemx -msched-prefer-non-control-spec-insns
17100 @opindex mno-sched-prefer-non-control-spec-insns
17101 @opindex msched-prefer-non-control-spec-insns
17102 If enabled, control-speculative instructions are chosen for schedule
17103 only if there are no other choices at the moment. This makes
17104 the use of the control speculation much more conservative.
17105 The default setting is disabled.
17107 @item -mno-sched-count-spec-in-critical-path
17108 @itemx -msched-count-spec-in-critical-path
17109 @opindex mno-sched-count-spec-in-critical-path
17110 @opindex msched-count-spec-in-critical-path
17111 If enabled, speculative dependencies are considered during
17112 computation of the instructions priorities. This makes the use of the
17113 speculation a bit more conservative.
17114 The default setting is disabled.
17116 @item -msched-spec-ldc
17117 @opindex msched-spec-ldc
17118 Use a simple data speculation check. This option is on by default.
17120 @item -msched-control-spec-ldc
17121 @opindex msched-spec-ldc
17122 Use a simple check for control speculation. This option is on by default.
17124 @item -msched-stop-bits-after-every-cycle
17125 @opindex msched-stop-bits-after-every-cycle
17126 Place a stop bit after every cycle when scheduling. This option is on
17129 @item -msched-fp-mem-deps-zero-cost
17130 @opindex msched-fp-mem-deps-zero-cost
17131 Assume that floating-point stores and loads are not likely to cause a conflict
17132 when placed into the same instruction group. This option is disabled by
17135 @item -msel-sched-dont-check-control-spec
17136 @opindex msel-sched-dont-check-control-spec
17137 Generate checks for control speculation in selective scheduling.
17138 This flag is disabled by default.
17140 @item -msched-max-memory-insns=@var{max-insns}
17141 @opindex msched-max-memory-insns
17142 Limit on the number of memory insns per instruction group, giving lower
17143 priority to subsequent memory insns attempting to schedule in the same
17144 instruction group. Frequently useful to prevent cache bank conflicts.
17145 The default value is 1.
17147 @item -msched-max-memory-insns-hard-limit
17148 @opindex msched-max-memory-insns-hard-limit
17149 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
17150 disallowing more than that number in an instruction group.
17151 Otherwise, the limit is ``soft'', meaning that non-memory operations
17152 are preferred when the limit is reached, but memory operations may still
17158 @subsection LM32 Options
17159 @cindex LM32 options
17161 These @option{-m} options are defined for the LatticeMico32 architecture:
17164 @item -mbarrel-shift-enabled
17165 @opindex mbarrel-shift-enabled
17166 Enable barrel-shift instructions.
17168 @item -mdivide-enabled
17169 @opindex mdivide-enabled
17170 Enable divide and modulus instructions.
17172 @item -mmultiply-enabled
17173 @opindex multiply-enabled
17174 Enable multiply instructions.
17176 @item -msign-extend-enabled
17177 @opindex msign-extend-enabled
17178 Enable sign extend instructions.
17180 @item -muser-enabled
17181 @opindex muser-enabled
17182 Enable user-defined instructions.
17187 @subsection M32C Options
17188 @cindex M32C options
17191 @item -mcpu=@var{name}
17193 Select the CPU for which code is generated. @var{name} may be one of
17194 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
17195 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
17196 the M32C/80 series.
17200 Specifies that the program will be run on the simulator. This causes
17201 an alternate runtime library to be linked in which supports, for
17202 example, file I/O@. You must not use this option when generating
17203 programs that will run on real hardware; you must provide your own
17204 runtime library for whatever I/O functions are needed.
17206 @item -memregs=@var{number}
17208 Specifies the number of memory-based pseudo-registers GCC uses
17209 during code generation. These pseudo-registers are used like real
17210 registers, so there is a tradeoff between GCC's ability to fit the
17211 code into available registers, and the performance penalty of using
17212 memory instead of registers. Note that all modules in a program must
17213 be compiled with the same value for this option. Because of that, you
17214 must not use this option with GCC's default runtime libraries.
17218 @node M32R/D Options
17219 @subsection M32R/D Options
17220 @cindex M32R/D options
17222 These @option{-m} options are defined for Renesas M32R/D architectures:
17227 Generate code for the M32R/2@.
17231 Generate code for the M32R/X@.
17235 Generate code for the M32R@. This is the default.
17237 @item -mmodel=small
17238 @opindex mmodel=small
17239 Assume all objects live in the lower 16MB of memory (so that their addresses
17240 can be loaded with the @code{ld24} instruction), and assume all subroutines
17241 are reachable with the @code{bl} instruction.
17242 This is the default.
17244 The addressability of a particular object can be set with the
17245 @code{model} attribute.
17247 @item -mmodel=medium
17248 @opindex mmodel=medium
17249 Assume objects may be anywhere in the 32-bit address space (the compiler
17250 generates @code{seth/add3} instructions to load their addresses), and
17251 assume all subroutines are reachable with the @code{bl} instruction.
17253 @item -mmodel=large
17254 @opindex mmodel=large
17255 Assume objects may be anywhere in the 32-bit address space (the compiler
17256 generates @code{seth/add3} instructions to load their addresses), and
17257 assume subroutines may not be reachable with the @code{bl} instruction
17258 (the compiler generates the much slower @code{seth/add3/jl}
17259 instruction sequence).
17262 @opindex msdata=none
17263 Disable use of the small data area. Variables are put into
17264 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
17265 @code{section} attribute has been specified).
17266 This is the default.
17268 The small data area consists of sections @code{.sdata} and @code{.sbss}.
17269 Objects may be explicitly put in the small data area with the
17270 @code{section} attribute using one of these sections.
17272 @item -msdata=sdata
17273 @opindex msdata=sdata
17274 Put small global and static data in the small data area, but do not
17275 generate special code to reference them.
17278 @opindex msdata=use
17279 Put small global and static data in the small data area, and generate
17280 special instructions to reference them.
17284 @cindex smaller data references
17285 Put global and static objects less than or equal to @var{num} bytes
17286 into the small data or BSS sections instead of the normal data or BSS
17287 sections. The default value of @var{num} is 8.
17288 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
17289 for this option to have any effect.
17291 All modules should be compiled with the same @option{-G @var{num}} value.
17292 Compiling with different values of @var{num} may or may not work; if it
17293 doesn't the linker gives an error message---incorrect code is not
17298 Makes the M32R-specific code in the compiler display some statistics
17299 that might help in debugging programs.
17301 @item -malign-loops
17302 @opindex malign-loops
17303 Align all loops to a 32-byte boundary.
17305 @item -mno-align-loops
17306 @opindex mno-align-loops
17307 Do not enforce a 32-byte alignment for loops. This is the default.
17309 @item -missue-rate=@var{number}
17310 @opindex missue-rate=@var{number}
17311 Issue @var{number} instructions per cycle. @var{number} can only be 1
17314 @item -mbranch-cost=@var{number}
17315 @opindex mbranch-cost=@var{number}
17316 @var{number} can only be 1 or 2. If it is 1 then branches are
17317 preferred over conditional code, if it is 2, then the opposite applies.
17319 @item -mflush-trap=@var{number}
17320 @opindex mflush-trap=@var{number}
17321 Specifies the trap number to use to flush the cache. The default is
17322 12. Valid numbers are between 0 and 15 inclusive.
17324 @item -mno-flush-trap
17325 @opindex mno-flush-trap
17326 Specifies that the cache cannot be flushed by using a trap.
17328 @item -mflush-func=@var{name}
17329 @opindex mflush-func=@var{name}
17330 Specifies the name of the operating system function to call to flush
17331 the cache. The default is @samp{_flush_cache}, but a function call
17332 is only used if a trap is not available.
17334 @item -mno-flush-func
17335 @opindex mno-flush-func
17336 Indicates that there is no OS function for flushing the cache.
17340 @node M680x0 Options
17341 @subsection M680x0 Options
17342 @cindex M680x0 options
17344 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
17345 The default settings depend on which architecture was selected when
17346 the compiler was configured; the defaults for the most common choices
17350 @item -march=@var{arch}
17352 Generate code for a specific M680x0 or ColdFire instruction set
17353 architecture. Permissible values of @var{arch} for M680x0
17354 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
17355 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
17356 architectures are selected according to Freescale's ISA classification
17357 and the permissible values are: @samp{isaa}, @samp{isaaplus},
17358 @samp{isab} and @samp{isac}.
17360 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
17361 code for a ColdFire target. The @var{arch} in this macro is one of the
17362 @option{-march} arguments given above.
17364 When used together, @option{-march} and @option{-mtune} select code
17365 that runs on a family of similar processors but that is optimized
17366 for a particular microarchitecture.
17368 @item -mcpu=@var{cpu}
17370 Generate code for a specific M680x0 or ColdFire processor.
17371 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
17372 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
17373 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
17374 below, which also classifies the CPUs into families:
17376 @multitable @columnfractions 0.20 0.80
17377 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
17378 @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}
17379 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
17380 @item @samp{5206e} @tab @samp{5206e}
17381 @item @samp{5208} @tab @samp{5207} @samp{5208}
17382 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
17383 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
17384 @item @samp{5216} @tab @samp{5214} @samp{5216}
17385 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
17386 @item @samp{5225} @tab @samp{5224} @samp{5225}
17387 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
17388 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
17389 @item @samp{5249} @tab @samp{5249}
17390 @item @samp{5250} @tab @samp{5250}
17391 @item @samp{5271} @tab @samp{5270} @samp{5271}
17392 @item @samp{5272} @tab @samp{5272}
17393 @item @samp{5275} @tab @samp{5274} @samp{5275}
17394 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
17395 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
17396 @item @samp{5307} @tab @samp{5307}
17397 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
17398 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
17399 @item @samp{5407} @tab @samp{5407}
17400 @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}
17403 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
17404 @var{arch} is compatible with @var{cpu}. Other combinations of
17405 @option{-mcpu} and @option{-march} are rejected.
17407 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
17408 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
17409 where the value of @var{family} is given by the table above.
17411 @item -mtune=@var{tune}
17413 Tune the code for a particular microarchitecture within the
17414 constraints set by @option{-march} and @option{-mcpu}.
17415 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
17416 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
17417 and @samp{cpu32}. The ColdFire microarchitectures
17418 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
17420 You can also use @option{-mtune=68020-40} for code that needs
17421 to run relatively well on 68020, 68030 and 68040 targets.
17422 @option{-mtune=68020-60} is similar but includes 68060 targets
17423 as well. These two options select the same tuning decisions as
17424 @option{-m68020-40} and @option{-m68020-60} respectively.
17426 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
17427 when tuning for 680x0 architecture @var{arch}. It also defines
17428 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
17429 option is used. If GCC is tuning for a range of architectures,
17430 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
17431 it defines the macros for every architecture in the range.
17433 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
17434 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
17435 of the arguments given above.
17441 Generate output for a 68000. This is the default
17442 when the compiler is configured for 68000-based systems.
17443 It is equivalent to @option{-march=68000}.
17445 Use this option for microcontrollers with a 68000 or EC000 core,
17446 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
17450 Generate output for a 68010. This is the default
17451 when the compiler is configured for 68010-based systems.
17452 It is equivalent to @option{-march=68010}.
17458 Generate output for a 68020. This is the default
17459 when the compiler is configured for 68020-based systems.
17460 It is equivalent to @option{-march=68020}.
17464 Generate output for a 68030. This is the default when the compiler is
17465 configured for 68030-based systems. It is equivalent to
17466 @option{-march=68030}.
17470 Generate output for a 68040. This is the default when the compiler is
17471 configured for 68040-based systems. It is equivalent to
17472 @option{-march=68040}.
17474 This option inhibits the use of 68881/68882 instructions that have to be
17475 emulated by software on the 68040. Use this option if your 68040 does not
17476 have code to emulate those instructions.
17480 Generate output for a 68060. This is the default when the compiler is
17481 configured for 68060-based systems. It is equivalent to
17482 @option{-march=68060}.
17484 This option inhibits the use of 68020 and 68881/68882 instructions that
17485 have to be emulated by software on the 68060. Use this option if your 68060
17486 does not have code to emulate those instructions.
17490 Generate output for a CPU32. This is the default
17491 when the compiler is configured for CPU32-based systems.
17492 It is equivalent to @option{-march=cpu32}.
17494 Use this option for microcontrollers with a
17495 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
17496 68336, 68340, 68341, 68349 and 68360.
17500 Generate output for a 520X ColdFire CPU@. This is the default
17501 when the compiler is configured for 520X-based systems.
17502 It is equivalent to @option{-mcpu=5206}, and is now deprecated
17503 in favor of that option.
17505 Use this option for microcontroller with a 5200 core, including
17506 the MCF5202, MCF5203, MCF5204 and MCF5206.
17510 Generate output for a 5206e ColdFire CPU@. The option is now
17511 deprecated in favor of the equivalent @option{-mcpu=5206e}.
17515 Generate output for a member of the ColdFire 528X family.
17516 The option is now deprecated in favor of the equivalent
17517 @option{-mcpu=528x}.
17521 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
17522 in favor of the equivalent @option{-mcpu=5307}.
17526 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
17527 in favor of the equivalent @option{-mcpu=5407}.
17531 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
17532 This includes use of hardware floating-point instructions.
17533 The option is equivalent to @option{-mcpu=547x}, and is now
17534 deprecated in favor of that option.
17538 Generate output for a 68040, without using any of the new instructions.
17539 This results in code that can run relatively efficiently on either a
17540 68020/68881 or a 68030 or a 68040. The generated code does use the
17541 68881 instructions that are emulated on the 68040.
17543 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
17547 Generate output for a 68060, without using any of the new instructions.
17548 This results in code that can run relatively efficiently on either a
17549 68020/68881 or a 68030 or a 68040. The generated code does use the
17550 68881 instructions that are emulated on the 68060.
17552 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
17556 @opindex mhard-float
17558 Generate floating-point instructions. This is the default for 68020
17559 and above, and for ColdFire devices that have an FPU@. It defines the
17560 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
17561 on ColdFire targets.
17564 @opindex msoft-float
17565 Do not generate floating-point instructions; use library calls instead.
17566 This is the default for 68000, 68010, and 68832 targets. It is also
17567 the default for ColdFire devices that have no FPU.
17573 Generate (do not generate) ColdFire hardware divide and remainder
17574 instructions. If @option{-march} is used without @option{-mcpu},
17575 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
17576 architectures. Otherwise, the default is taken from the target CPU
17577 (either the default CPU, or the one specified by @option{-mcpu}). For
17578 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
17579 @option{-mcpu=5206e}.
17581 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
17585 Consider type @code{int} to be 16 bits wide, like @code{short int}.
17586 Additionally, parameters passed on the stack are also aligned to a
17587 16-bit boundary even on targets whose API mandates promotion to 32-bit.
17591 Do not consider type @code{int} to be 16 bits wide. This is the default.
17594 @itemx -mno-bitfield
17595 @opindex mnobitfield
17596 @opindex mno-bitfield
17597 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
17598 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
17602 Do use the bit-field instructions. The @option{-m68020} option implies
17603 @option{-mbitfield}. This is the default if you use a configuration
17604 designed for a 68020.
17608 Use a different function-calling convention, in which functions
17609 that take a fixed number of arguments return with the @code{rtd}
17610 instruction, which pops their arguments while returning. This
17611 saves one instruction in the caller since there is no need to pop
17612 the arguments there.
17614 This calling convention is incompatible with the one normally
17615 used on Unix, so you cannot use it if you need to call libraries
17616 compiled with the Unix compiler.
17618 Also, you must provide function prototypes for all functions that
17619 take variable numbers of arguments (including @code{printf});
17620 otherwise incorrect code is generated for calls to those
17623 In addition, seriously incorrect code results if you call a
17624 function with too many arguments. (Normally, extra arguments are
17625 harmlessly ignored.)
17627 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
17628 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
17632 Do not use the calling conventions selected by @option{-mrtd}.
17633 This is the default.
17636 @itemx -mno-align-int
17637 @opindex malign-int
17638 @opindex mno-align-int
17639 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
17640 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
17641 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
17642 Aligning variables on 32-bit boundaries produces code that runs somewhat
17643 faster on processors with 32-bit busses at the expense of more memory.
17645 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
17646 aligns structures containing the above types differently than
17647 most published application binary interface specifications for the m68k.
17651 Use the pc-relative addressing mode of the 68000 directly, instead of
17652 using a global offset table. At present, this option implies @option{-fpic},
17653 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
17654 not presently supported with @option{-mpcrel}, though this could be supported for
17655 68020 and higher processors.
17657 @item -mno-strict-align
17658 @itemx -mstrict-align
17659 @opindex mno-strict-align
17660 @opindex mstrict-align
17661 Do not (do) assume that unaligned memory references are handled by
17665 Generate code that allows the data segment to be located in a different
17666 area of memory from the text segment. This allows for execute-in-place in
17667 an environment without virtual memory management. This option implies
17670 @item -mno-sep-data
17671 Generate code that assumes that the data segment follows the text segment.
17672 This is the default.
17674 @item -mid-shared-library
17675 Generate code that supports shared libraries via the library ID method.
17676 This allows for execute-in-place and shared libraries in an environment
17677 without virtual memory management. This option implies @option{-fPIC}.
17679 @item -mno-id-shared-library
17680 Generate code that doesn't assume ID-based shared libraries are being used.
17681 This is the default.
17683 @item -mshared-library-id=n
17684 Specifies the identification number of the ID-based shared library being
17685 compiled. Specifying a value of 0 generates more compact code; specifying
17686 other values forces the allocation of that number to the current
17687 library, but is no more space- or time-efficient than omitting this option.
17693 When generating position-independent code for ColdFire, generate code
17694 that works if the GOT has more than 8192 entries. This code is
17695 larger and slower than code generated without this option. On M680x0
17696 processors, this option is not needed; @option{-fPIC} suffices.
17698 GCC normally uses a single instruction to load values from the GOT@.
17699 While this is relatively efficient, it only works if the GOT
17700 is smaller than about 64k. Anything larger causes the linker
17701 to report an error such as:
17703 @cindex relocation truncated to fit (ColdFire)
17705 relocation truncated to fit: R_68K_GOT16O foobar
17708 If this happens, you should recompile your code with @option{-mxgot}.
17709 It should then work with very large GOTs. However, code generated with
17710 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
17711 the value of a global symbol.
17713 Note that some linkers, including newer versions of the GNU linker,
17714 can create multiple GOTs and sort GOT entries. If you have such a linker,
17715 you should only need to use @option{-mxgot} when compiling a single
17716 object file that accesses more than 8192 GOT entries. Very few do.
17718 These options have no effect unless GCC is generating
17719 position-independent code.
17723 @node MCore Options
17724 @subsection MCore Options
17725 @cindex MCore options
17727 These are the @samp{-m} options defined for the Motorola M*Core
17733 @itemx -mno-hardlit
17735 @opindex mno-hardlit
17736 Inline constants into the code stream if it can be done in two
17737 instructions or less.
17743 Use the divide instruction. (Enabled by default).
17745 @item -mrelax-immediate
17746 @itemx -mno-relax-immediate
17747 @opindex mrelax-immediate
17748 @opindex mno-relax-immediate
17749 Allow arbitrary-sized immediates in bit operations.
17751 @item -mwide-bitfields
17752 @itemx -mno-wide-bitfields
17753 @opindex mwide-bitfields
17754 @opindex mno-wide-bitfields
17755 Always treat bit-fields as @code{int}-sized.
17757 @item -m4byte-functions
17758 @itemx -mno-4byte-functions
17759 @opindex m4byte-functions
17760 @opindex mno-4byte-functions
17761 Force all functions to be aligned to a 4-byte boundary.
17763 @item -mcallgraph-data
17764 @itemx -mno-callgraph-data
17765 @opindex mcallgraph-data
17766 @opindex mno-callgraph-data
17767 Emit callgraph information.
17770 @itemx -mno-slow-bytes
17771 @opindex mslow-bytes
17772 @opindex mno-slow-bytes
17773 Prefer word access when reading byte quantities.
17775 @item -mlittle-endian
17776 @itemx -mbig-endian
17777 @opindex mlittle-endian
17778 @opindex mbig-endian
17779 Generate code for a little-endian target.
17785 Generate code for the 210 processor.
17789 Assume that runtime support has been provided and so omit the
17790 simulator library (@file{libsim.a)} from the linker command line.
17792 @item -mstack-increment=@var{size}
17793 @opindex mstack-increment
17794 Set the maximum amount for a single stack increment operation. Large
17795 values can increase the speed of programs that contain functions
17796 that need a large amount of stack space, but they can also trigger a
17797 segmentation fault if the stack is extended too much. The default
17803 @subsection MeP Options
17804 @cindex MeP options
17810 Enables the @code{abs} instruction, which is the absolute difference
17811 between two registers.
17815 Enables all the optional instructions---average, multiply, divide, bit
17816 operations, leading zero, absolute difference, min/max, clip, and
17822 Enables the @code{ave} instruction, which computes the average of two
17825 @item -mbased=@var{n}
17827 Variables of size @var{n} bytes or smaller are placed in the
17828 @code{.based} section by default. Based variables use the @code{$tp}
17829 register as a base register, and there is a 128-byte limit to the
17830 @code{.based} section.
17834 Enables the bit operation instructions---bit test (@code{btstm}), set
17835 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
17836 test-and-set (@code{tas}).
17838 @item -mc=@var{name}
17840 Selects which section constant data is placed in. @var{name} may
17841 be @samp{tiny}, @samp{near}, or @samp{far}.
17845 Enables the @code{clip} instruction. Note that @option{-mclip} is not
17846 useful unless you also provide @option{-mminmax}.
17848 @item -mconfig=@var{name}
17850 Selects one of the built-in core configurations. Each MeP chip has
17851 one or more modules in it; each module has a core CPU and a variety of
17852 coprocessors, optional instructions, and peripherals. The
17853 @code{MeP-Integrator} tool, not part of GCC, provides these
17854 configurations through this option; using this option is the same as
17855 using all the corresponding command-line options. The default
17856 configuration is @samp{default}.
17860 Enables the coprocessor instructions. By default, this is a 32-bit
17861 coprocessor. Note that the coprocessor is normally enabled via the
17862 @option{-mconfig=} option.
17866 Enables the 32-bit coprocessor's instructions.
17870 Enables the 64-bit coprocessor's instructions.
17874 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
17878 Causes constant variables to be placed in the @code{.near} section.
17882 Enables the @code{div} and @code{divu} instructions.
17886 Generate big-endian code.
17890 Generate little-endian code.
17892 @item -mio-volatile
17893 @opindex mio-volatile
17894 Tells the compiler that any variable marked with the @code{io}
17895 attribute is to be considered volatile.
17899 Causes variables to be assigned to the @code{.far} section by default.
17903 Enables the @code{leadz} (leading zero) instruction.
17907 Causes variables to be assigned to the @code{.near} section by default.
17911 Enables the @code{min} and @code{max} instructions.
17915 Enables the multiplication and multiply-accumulate instructions.
17919 Disables all the optional instructions enabled by @option{-mall-opts}.
17923 Enables the @code{repeat} and @code{erepeat} instructions, used for
17924 low-overhead looping.
17928 Causes all variables to default to the @code{.tiny} section. Note
17929 that there is a 65536-byte limit to this section. Accesses to these
17930 variables use the @code{%gp} base register.
17934 Enables the saturation instructions. Note that the compiler does not
17935 currently generate these itself, but this option is included for
17936 compatibility with other tools, like @code{as}.
17940 Link the SDRAM-based runtime instead of the default ROM-based runtime.
17944 Link the simulator run-time libraries.
17948 Link the simulator runtime libraries, excluding built-in support
17949 for reset and exception vectors and tables.
17953 Causes all functions to default to the @code{.far} section. Without
17954 this option, functions default to the @code{.near} section.
17956 @item -mtiny=@var{n}
17958 Variables that are @var{n} bytes or smaller are allocated to the
17959 @code{.tiny} section. These variables use the @code{$gp} base
17960 register. The default for this option is 4, but note that there's a
17961 65536-byte limit to the @code{.tiny} section.
17965 @node MicroBlaze Options
17966 @subsection MicroBlaze Options
17967 @cindex MicroBlaze Options
17972 @opindex msoft-float
17973 Use software emulation for floating point (default).
17976 @opindex mhard-float
17977 Use hardware floating-point instructions.
17981 Do not optimize block moves, use @code{memcpy}.
17983 @item -mno-clearbss
17984 @opindex mno-clearbss
17985 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
17987 @item -mcpu=@var{cpu-type}
17989 Use features of, and schedule code for, the given CPU.
17990 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
17991 where @var{X} is a major version, @var{YY} is the minor version, and
17992 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
17993 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
17995 @item -mxl-soft-mul
17996 @opindex mxl-soft-mul
17997 Use software multiply emulation (default).
17999 @item -mxl-soft-div
18000 @opindex mxl-soft-div
18001 Use software emulation for divides (default).
18003 @item -mxl-barrel-shift
18004 @opindex mxl-barrel-shift
18005 Use the hardware barrel shifter.
18007 @item -mxl-pattern-compare
18008 @opindex mxl-pattern-compare
18009 Use pattern compare instructions.
18011 @item -msmall-divides
18012 @opindex msmall-divides
18013 Use table lookup optimization for small signed integer divisions.
18015 @item -mxl-stack-check
18016 @opindex mxl-stack-check
18017 This option is deprecated. Use @option{-fstack-check} instead.
18020 @opindex mxl-gp-opt
18021 Use GP-relative @code{.sdata}/@code{.sbss} sections.
18023 @item -mxl-multiply-high
18024 @opindex mxl-multiply-high
18025 Use multiply high instructions for high part of 32x32 multiply.
18027 @item -mxl-float-convert
18028 @opindex mxl-float-convert
18029 Use hardware floating-point conversion instructions.
18031 @item -mxl-float-sqrt
18032 @opindex mxl-float-sqrt
18033 Use hardware floating-point square root instruction.
18036 @opindex mbig-endian
18037 Generate code for a big-endian target.
18039 @item -mlittle-endian
18040 @opindex mlittle-endian
18041 Generate code for a little-endian target.
18044 @opindex mxl-reorder
18045 Use reorder instructions (swap and byte reversed load/store).
18047 @item -mxl-mode-@var{app-model}
18048 Select application model @var{app-model}. Valid models are
18051 normal executable (default), uses startup code @file{crt0.o}.
18054 for use with Xilinx Microprocessor Debugger (XMD) based
18055 software intrusive debug agent called xmdstub. This uses startup file
18056 @file{crt1.o} and sets the start address of the program to 0x800.
18059 for applications that are loaded using a bootloader.
18060 This model uses startup file @file{crt2.o} which does not contain a processor
18061 reset vector handler. This is suitable for transferring control on a
18062 processor reset to the bootloader rather than the application.
18065 for applications that do not require any of the
18066 MicroBlaze vectors. This option may be useful for applications running
18067 within a monitoring application. This model uses @file{crt3.o} as a startup file.
18070 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
18071 @option{-mxl-mode-@var{app-model}}.
18076 @subsection MIPS Options
18077 @cindex MIPS options
18083 Generate big-endian code.
18087 Generate little-endian code. This is the default for @samp{mips*el-*-*}
18090 @item -march=@var{arch}
18092 Generate code that runs on @var{arch}, which can be the name of a
18093 generic MIPS ISA, or the name of a particular processor.
18095 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
18096 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
18097 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
18098 @samp{mips64r5} and @samp{mips64r6}.
18099 The processor names are:
18100 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
18101 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
18102 @samp{5kc}, @samp{5kf},
18104 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
18105 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
18106 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
18107 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
18108 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
18111 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
18113 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
18114 @samp{m5100}, @samp{m5101},
18115 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
18118 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
18119 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
18120 @samp{rm7000}, @samp{rm9000},
18121 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
18124 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
18125 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
18126 @samp{xlr} and @samp{xlp}.
18127 The special value @samp{from-abi} selects the
18128 most compatible architecture for the selected ABI (that is,
18129 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
18131 The native Linux/GNU toolchain also supports the value @samp{native},
18132 which selects the best architecture option for the host processor.
18133 @option{-march=native} has no effect if GCC does not recognize
18136 In processor names, a final @samp{000} can be abbreviated as @samp{k}
18137 (for example, @option{-march=r2k}). Prefixes are optional, and
18138 @samp{vr} may be written @samp{r}.
18140 Names of the form @samp{@var{n}f2_1} refer to processors with
18141 FPUs clocked at half the rate of the core, names of the form
18142 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
18143 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
18144 processors with FPUs clocked a ratio of 3:2 with respect to the core.
18145 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
18146 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
18147 accepted as synonyms for @samp{@var{n}f1_1}.
18149 GCC defines two macros based on the value of this option. The first
18150 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
18151 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
18152 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
18153 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
18154 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
18156 Note that the @code{_MIPS_ARCH} macro uses the processor names given
18157 above. In other words, it has the full prefix and does not
18158 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
18159 the macro names the resolved architecture (either @code{"mips1"} or
18160 @code{"mips3"}). It names the default architecture when no
18161 @option{-march} option is given.
18163 @item -mtune=@var{arch}
18165 Optimize for @var{arch}. Among other things, this option controls
18166 the way instructions are scheduled, and the perceived cost of arithmetic
18167 operations. The list of @var{arch} values is the same as for
18170 When this option is not used, GCC optimizes for the processor
18171 specified by @option{-march}. By using @option{-march} and
18172 @option{-mtune} together, it is possible to generate code that
18173 runs on a family of processors, but optimize the code for one
18174 particular member of that family.
18176 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
18177 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
18178 @option{-march} ones described above.
18182 Equivalent to @option{-march=mips1}.
18186 Equivalent to @option{-march=mips2}.
18190 Equivalent to @option{-march=mips3}.
18194 Equivalent to @option{-march=mips4}.
18198 Equivalent to @option{-march=mips32}.
18202 Equivalent to @option{-march=mips32r3}.
18206 Equivalent to @option{-march=mips32r5}.
18210 Equivalent to @option{-march=mips32r6}.
18214 Equivalent to @option{-march=mips64}.
18218 Equivalent to @option{-march=mips64r2}.
18222 Equivalent to @option{-march=mips64r3}.
18226 Equivalent to @option{-march=mips64r5}.
18230 Equivalent to @option{-march=mips64r6}.
18235 @opindex mno-mips16
18236 Generate (do not generate) MIPS16 code. If GCC is targeting a
18237 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
18239 MIPS16 code generation can also be controlled on a per-function basis
18240 by means of @code{mips16} and @code{nomips16} attributes.
18241 @xref{Function Attributes}, for more information.
18243 @item -mflip-mips16
18244 @opindex mflip-mips16
18245 Generate MIPS16 code on alternating functions. This option is provided
18246 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
18247 not intended for ordinary use in compiling user code.
18249 @item -minterlink-compressed
18250 @item -mno-interlink-compressed
18251 @opindex minterlink-compressed
18252 @opindex mno-interlink-compressed
18253 Require (do not require) that code using the standard (uncompressed) MIPS ISA
18254 be link-compatible with MIPS16 and microMIPS code, and vice versa.
18256 For example, code using the standard ISA encoding cannot jump directly
18257 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
18258 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
18259 knows that the target of the jump is not compressed.
18261 @item -minterlink-mips16
18262 @itemx -mno-interlink-mips16
18263 @opindex minterlink-mips16
18264 @opindex mno-interlink-mips16
18265 Aliases of @option{-minterlink-compressed} and
18266 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
18267 and are retained for backwards compatibility.
18279 Generate code for the given ABI@.
18281 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
18282 generates 64-bit code when you select a 64-bit architecture, but you
18283 can use @option{-mgp32} to get 32-bit code instead.
18285 For information about the O64 ABI, see
18286 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
18288 GCC supports a variant of the o32 ABI in which floating-point registers
18289 are 64 rather than 32 bits wide. You can select this combination with
18290 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
18291 and @code{mfhc1} instructions and is therefore only supported for
18292 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
18294 The register assignments for arguments and return values remain the
18295 same, but each scalar value is passed in a single 64-bit register
18296 rather than a pair of 32-bit registers. For example, scalar
18297 floating-point values are returned in @samp{$f0} only, not a
18298 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
18299 remains the same in that the even-numbered double-precision registers
18302 Two additional variants of the o32 ABI are supported to enable
18303 a transition from 32-bit to 64-bit registers. These are FPXX
18304 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
18305 The FPXX extension mandates that all code must execute correctly
18306 when run using 32-bit or 64-bit registers. The code can be interlinked
18307 with either FP32 or FP64, but not both.
18308 The FP64A extension is similar to the FP64 extension but forbids the
18309 use of odd-numbered single-precision registers. This can be used
18310 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
18311 processors and allows both FP32 and FP64A code to interlink and
18312 run in the same process without changing FPU modes.
18315 @itemx -mno-abicalls
18317 @opindex mno-abicalls
18318 Generate (do not generate) code that is suitable for SVR4-style
18319 dynamic objects. @option{-mabicalls} is the default for SVR4-based
18324 Generate (do not generate) code that is fully position-independent,
18325 and that can therefore be linked into shared libraries. This option
18326 only affects @option{-mabicalls}.
18328 All @option{-mabicalls} code has traditionally been position-independent,
18329 regardless of options like @option{-fPIC} and @option{-fpic}. However,
18330 as an extension, the GNU toolchain allows executables to use absolute
18331 accesses for locally-binding symbols. It can also use shorter GP
18332 initialization sequences and generate direct calls to locally-defined
18333 functions. This mode is selected by @option{-mno-shared}.
18335 @option{-mno-shared} depends on binutils 2.16 or higher and generates
18336 objects that can only be linked by the GNU linker. However, the option
18337 does not affect the ABI of the final executable; it only affects the ABI
18338 of relocatable objects. Using @option{-mno-shared} generally makes
18339 executables both smaller and quicker.
18341 @option{-mshared} is the default.
18347 Assume (do not assume) that the static and dynamic linkers
18348 support PLTs and copy relocations. This option only affects
18349 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
18350 has no effect without @option{-msym32}.
18352 You can make @option{-mplt} the default by configuring
18353 GCC with @option{--with-mips-plt}. The default is
18354 @option{-mno-plt} otherwise.
18360 Lift (do not lift) the usual restrictions on the size of the global
18363 GCC normally uses a single instruction to load values from the GOT@.
18364 While this is relatively efficient, it only works if the GOT
18365 is smaller than about 64k. Anything larger causes the linker
18366 to report an error such as:
18368 @cindex relocation truncated to fit (MIPS)
18370 relocation truncated to fit: R_MIPS_GOT16 foobar
18373 If this happens, you should recompile your code with @option{-mxgot}.
18374 This works with very large GOTs, although the code is also
18375 less efficient, since it takes three instructions to fetch the
18376 value of a global symbol.
18378 Note that some linkers can create multiple GOTs. If you have such a
18379 linker, you should only need to use @option{-mxgot} when a single object
18380 file accesses more than 64k's worth of GOT entries. Very few do.
18382 These options have no effect unless GCC is generating position
18387 Assume that general-purpose registers are 32 bits wide.
18391 Assume that general-purpose registers are 64 bits wide.
18395 Assume that floating-point registers are 32 bits wide.
18399 Assume that floating-point registers are 64 bits wide.
18403 Do not assume the width of floating-point registers.
18406 @opindex mhard-float
18407 Use floating-point coprocessor instructions.
18410 @opindex msoft-float
18411 Do not use floating-point coprocessor instructions. Implement
18412 floating-point calculations using library calls instead.
18416 Equivalent to @option{-msoft-float}, but additionally asserts that the
18417 program being compiled does not perform any floating-point operations.
18418 This option is presently supported only by some bare-metal MIPS
18419 configurations, where it may select a special set of libraries
18420 that lack all floating-point support (including, for example, the
18421 floating-point @code{printf} formats).
18422 If code compiled with @option{-mno-float} accidentally contains
18423 floating-point operations, it is likely to suffer a link-time
18424 or run-time failure.
18426 @item -msingle-float
18427 @opindex msingle-float
18428 Assume that the floating-point coprocessor only supports single-precision
18431 @item -mdouble-float
18432 @opindex mdouble-float
18433 Assume that the floating-point coprocessor supports double-precision
18434 operations. This is the default.
18437 @itemx -mno-odd-spreg
18438 @opindex modd-spreg
18439 @opindex mno-odd-spreg
18440 Enable the use of odd-numbered single-precision floating-point registers
18441 for the o32 ABI. This is the default for processors that are known to
18442 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
18446 @itemx -mabs=legacy
18448 @opindex mabs=legacy
18449 These options control the treatment of the special not-a-number (NaN)
18450 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
18451 @code{neg.@i{fmt}} machine instructions.
18453 By default or when @option{-mabs=legacy} is used the legacy
18454 treatment is selected. In this case these instructions are considered
18455 arithmetic and avoided where correct operation is required and the
18456 input operand might be a NaN. A longer sequence of instructions that
18457 manipulate the sign bit of floating-point datum manually is used
18458 instead unless the @option{-ffinite-math-only} option has also been
18461 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
18462 this case these instructions are considered non-arithmetic and therefore
18463 operating correctly in all cases, including in particular where the
18464 input operand is a NaN. These instructions are therefore always used
18465 for the respective operations.
18468 @itemx -mnan=legacy
18470 @opindex mnan=legacy
18471 These options control the encoding of the special not-a-number (NaN)
18472 IEEE 754 floating-point data.
18474 The @option{-mnan=legacy} option selects the legacy encoding. In this
18475 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
18476 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
18477 by the first bit of their trailing significand field being 1.
18479 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
18480 this case qNaNs are denoted by the first bit of their trailing
18481 significand field being 1, whereas sNaNs are denoted by the first bit of
18482 their trailing significand field being 0.
18484 The default is @option{-mnan=legacy} unless GCC has been configured with
18485 @option{--with-nan=2008}.
18491 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
18492 implement atomic memory built-in functions. When neither option is
18493 specified, GCC uses the instructions if the target architecture
18496 @option{-mllsc} is useful if the runtime environment can emulate the
18497 instructions and @option{-mno-llsc} can be useful when compiling for
18498 nonstandard ISAs. You can make either option the default by
18499 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
18500 respectively. @option{--with-llsc} is the default for some
18501 configurations; see the installation documentation for details.
18507 Use (do not use) revision 1 of the MIPS DSP ASE@.
18508 @xref{MIPS DSP Built-in Functions}. This option defines the
18509 preprocessor macro @code{__mips_dsp}. It also defines
18510 @code{__mips_dsp_rev} to 1.
18516 Use (do not use) revision 2 of the MIPS DSP ASE@.
18517 @xref{MIPS DSP Built-in Functions}. This option defines the
18518 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
18519 It also defines @code{__mips_dsp_rev} to 2.
18522 @itemx -mno-smartmips
18523 @opindex msmartmips
18524 @opindex mno-smartmips
18525 Use (do not use) the MIPS SmartMIPS ASE.
18527 @item -mpaired-single
18528 @itemx -mno-paired-single
18529 @opindex mpaired-single
18530 @opindex mno-paired-single
18531 Use (do not use) paired-single floating-point instructions.
18532 @xref{MIPS Paired-Single Support}. This option requires
18533 hardware floating-point support to be enabled.
18539 Use (do not use) MIPS Digital Media Extension instructions.
18540 This option can only be used when generating 64-bit code and requires
18541 hardware floating-point support to be enabled.
18546 @opindex mno-mips3d
18547 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
18548 The option @option{-mips3d} implies @option{-mpaired-single}.
18551 @itemx -mno-micromips
18552 @opindex mmicromips
18553 @opindex mno-mmicromips
18554 Generate (do not generate) microMIPS code.
18556 MicroMIPS code generation can also be controlled on a per-function basis
18557 by means of @code{micromips} and @code{nomicromips} attributes.
18558 @xref{Function Attributes}, for more information.
18564 Use (do not use) MT Multithreading instructions.
18570 Use (do not use) the MIPS MCU ASE instructions.
18576 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
18582 Use (do not use) the MIPS Virtualization Application Specific instructions.
18588 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
18592 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
18593 an explanation of the default and the way that the pointer size is
18598 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
18600 The default size of @code{int}s, @code{long}s and pointers depends on
18601 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
18602 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
18603 32-bit @code{long}s. Pointers are the same size as @code{long}s,
18604 or the same size as integer registers, whichever is smaller.
18610 Assume (do not assume) that all symbols have 32-bit values, regardless
18611 of the selected ABI@. This option is useful in combination with
18612 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
18613 to generate shorter and faster references to symbolic addresses.
18617 Put definitions of externally-visible data in a small data section
18618 if that data is no bigger than @var{num} bytes. GCC can then generate
18619 more efficient accesses to the data; see @option{-mgpopt} for details.
18621 The default @option{-G} option depends on the configuration.
18623 @item -mlocal-sdata
18624 @itemx -mno-local-sdata
18625 @opindex mlocal-sdata
18626 @opindex mno-local-sdata
18627 Extend (do not extend) the @option{-G} behavior to local data too,
18628 such as to static variables in C@. @option{-mlocal-sdata} is the
18629 default for all configurations.
18631 If the linker complains that an application is using too much small data,
18632 you might want to try rebuilding the less performance-critical parts with
18633 @option{-mno-local-sdata}. You might also want to build large
18634 libraries with @option{-mno-local-sdata}, so that the libraries leave
18635 more room for the main program.
18637 @item -mextern-sdata
18638 @itemx -mno-extern-sdata
18639 @opindex mextern-sdata
18640 @opindex mno-extern-sdata
18641 Assume (do not assume) that externally-defined data is in
18642 a small data section if the size of that data is within the @option{-G} limit.
18643 @option{-mextern-sdata} is the default for all configurations.
18645 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
18646 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
18647 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
18648 is placed in a small data section. If @var{Var} is defined by another
18649 module, you must either compile that module with a high-enough
18650 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
18651 definition. If @var{Var} is common, you must link the application
18652 with a high-enough @option{-G} setting.
18654 The easiest way of satisfying these restrictions is to compile
18655 and link every module with the same @option{-G} option. However,
18656 you may wish to build a library that supports several different
18657 small data limits. You can do this by compiling the library with
18658 the highest supported @option{-G} setting and additionally using
18659 @option{-mno-extern-sdata} to stop the library from making assumptions
18660 about externally-defined data.
18666 Use (do not use) GP-relative accesses for symbols that are known to be
18667 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
18668 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
18671 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
18672 might not hold the value of @code{_gp}. For example, if the code is
18673 part of a library that might be used in a boot monitor, programs that
18674 call boot monitor routines pass an unknown value in @code{$gp}.
18675 (In such situations, the boot monitor itself is usually compiled
18676 with @option{-G0}.)
18678 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
18679 @option{-mno-extern-sdata}.
18681 @item -membedded-data
18682 @itemx -mno-embedded-data
18683 @opindex membedded-data
18684 @opindex mno-embedded-data
18685 Allocate variables to the read-only data section first if possible, then
18686 next in the small data section if possible, otherwise in data. This gives
18687 slightly slower code than the default, but reduces the amount of RAM required
18688 when executing, and thus may be preferred for some embedded systems.
18690 @item -muninit-const-in-rodata
18691 @itemx -mno-uninit-const-in-rodata
18692 @opindex muninit-const-in-rodata
18693 @opindex mno-uninit-const-in-rodata
18694 Put uninitialized @code{const} variables in the read-only data section.
18695 This option is only meaningful in conjunction with @option{-membedded-data}.
18697 @item -mcode-readable=@var{setting}
18698 @opindex mcode-readable
18699 Specify whether GCC may generate code that reads from executable sections.
18700 There are three possible settings:
18703 @item -mcode-readable=yes
18704 Instructions may freely access executable sections. This is the
18707 @item -mcode-readable=pcrel
18708 MIPS16 PC-relative load instructions can access executable sections,
18709 but other instructions must not do so. This option is useful on 4KSc
18710 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
18711 It is also useful on processors that can be configured to have a dual
18712 instruction/data SRAM interface and that, like the M4K, automatically
18713 redirect PC-relative loads to the instruction RAM.
18715 @item -mcode-readable=no
18716 Instructions must not access executable sections. This option can be
18717 useful on targets that are configured to have a dual instruction/data
18718 SRAM interface but that (unlike the M4K) do not automatically redirect
18719 PC-relative loads to the instruction RAM.
18722 @item -msplit-addresses
18723 @itemx -mno-split-addresses
18724 @opindex msplit-addresses
18725 @opindex mno-split-addresses
18726 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
18727 relocation operators. This option has been superseded by
18728 @option{-mexplicit-relocs} but is retained for backwards compatibility.
18730 @item -mexplicit-relocs
18731 @itemx -mno-explicit-relocs
18732 @opindex mexplicit-relocs
18733 @opindex mno-explicit-relocs
18734 Use (do not use) assembler relocation operators when dealing with symbolic
18735 addresses. The alternative, selected by @option{-mno-explicit-relocs},
18736 is to use assembler macros instead.
18738 @option{-mexplicit-relocs} is the default if GCC was configured
18739 to use an assembler that supports relocation operators.
18741 @item -mcheck-zero-division
18742 @itemx -mno-check-zero-division
18743 @opindex mcheck-zero-division
18744 @opindex mno-check-zero-division
18745 Trap (do not trap) on integer division by zero.
18747 The default is @option{-mcheck-zero-division}.
18749 @item -mdivide-traps
18750 @itemx -mdivide-breaks
18751 @opindex mdivide-traps
18752 @opindex mdivide-breaks
18753 MIPS systems check for division by zero by generating either a
18754 conditional trap or a break instruction. Using traps results in
18755 smaller code, but is only supported on MIPS II and later. Also, some
18756 versions of the Linux kernel have a bug that prevents trap from
18757 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
18758 allow conditional traps on architectures that support them and
18759 @option{-mdivide-breaks} to force the use of breaks.
18761 The default is usually @option{-mdivide-traps}, but this can be
18762 overridden at configure time using @option{--with-divide=breaks}.
18763 Divide-by-zero checks can be completely disabled using
18764 @option{-mno-check-zero-division}.
18769 @opindex mno-memcpy
18770 Force (do not force) the use of @code{memcpy} for non-trivial block
18771 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
18772 most constant-sized copies.
18775 @itemx -mno-long-calls
18776 @opindex mlong-calls
18777 @opindex mno-long-calls
18778 Disable (do not disable) use of the @code{jal} instruction. Calling
18779 functions using @code{jal} is more efficient but requires the caller
18780 and callee to be in the same 256 megabyte segment.
18782 This option has no effect on abicalls code. The default is
18783 @option{-mno-long-calls}.
18789 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
18790 instructions, as provided by the R4650 ISA@.
18796 Enable (disable) use of the @code{madd} and @code{msub} integer
18797 instructions. The default is @option{-mimadd} on architectures
18798 that support @code{madd} and @code{msub} except for the 74k
18799 architecture where it was found to generate slower code.
18802 @itemx -mno-fused-madd
18803 @opindex mfused-madd
18804 @opindex mno-fused-madd
18805 Enable (disable) use of the floating-point multiply-accumulate
18806 instructions, when they are available. The default is
18807 @option{-mfused-madd}.
18809 On the R8000 CPU when multiply-accumulate instructions are used,
18810 the intermediate product is calculated to infinite precision
18811 and is not subject to the FCSR Flush to Zero bit. This may be
18812 undesirable in some circumstances. On other processors the result
18813 is numerically identical to the equivalent computation using
18814 separate multiply, add, subtract and negate instructions.
18818 Tell the MIPS assembler to not run its preprocessor over user
18819 assembler files (with a @samp{.s} suffix) when assembling them.
18824 @opindex mno-fix-24k
18825 Work around the 24K E48 (lost data on stores during refill) errata.
18826 The workarounds are implemented by the assembler rather than by GCC@.
18829 @itemx -mno-fix-r4000
18830 @opindex mfix-r4000
18831 @opindex mno-fix-r4000
18832 Work around certain R4000 CPU errata:
18835 A double-word or a variable shift may give an incorrect result if executed
18836 immediately after starting an integer division.
18838 A double-word or a variable shift may give an incorrect result if executed
18839 while an integer multiplication is in progress.
18841 An integer division may give an incorrect result if started in a delay slot
18842 of a taken branch or a jump.
18846 @itemx -mno-fix-r4400
18847 @opindex mfix-r4400
18848 @opindex mno-fix-r4400
18849 Work around certain R4400 CPU errata:
18852 A double-word or a variable shift may give an incorrect result if executed
18853 immediately after starting an integer division.
18857 @itemx -mno-fix-r10000
18858 @opindex mfix-r10000
18859 @opindex mno-fix-r10000
18860 Work around certain R10000 errata:
18863 @code{ll}/@code{sc} sequences may not behave atomically on revisions
18864 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
18867 This option can only be used if the target architecture supports
18868 branch-likely instructions. @option{-mfix-r10000} is the default when
18869 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
18873 @itemx -mno-fix-rm7000
18874 @opindex mfix-rm7000
18875 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
18876 workarounds are implemented by the assembler rather than by GCC@.
18879 @itemx -mno-fix-vr4120
18880 @opindex mfix-vr4120
18881 Work around certain VR4120 errata:
18884 @code{dmultu} does not always produce the correct result.
18886 @code{div} and @code{ddiv} do not always produce the correct result if one
18887 of the operands is negative.
18889 The workarounds for the division errata rely on special functions in
18890 @file{libgcc.a}. At present, these functions are only provided by
18891 the @code{mips64vr*-elf} configurations.
18893 Other VR4120 errata require a NOP to be inserted between certain pairs of
18894 instructions. These errata are handled by the assembler, not by GCC itself.
18897 @opindex mfix-vr4130
18898 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
18899 workarounds are implemented by the assembler rather than by GCC,
18900 although GCC avoids using @code{mflo} and @code{mfhi} if the
18901 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
18902 instructions are available instead.
18905 @itemx -mno-fix-sb1
18907 Work around certain SB-1 CPU core errata.
18908 (This flag currently works around the SB-1 revision 2
18909 ``F1'' and ``F2'' floating-point errata.)
18911 @item -mr10k-cache-barrier=@var{setting}
18912 @opindex mr10k-cache-barrier
18913 Specify whether GCC should insert cache barriers to avoid the
18914 side-effects of speculation on R10K processors.
18916 In common with many processors, the R10K tries to predict the outcome
18917 of a conditional branch and speculatively executes instructions from
18918 the ``taken'' branch. It later aborts these instructions if the
18919 predicted outcome is wrong. However, on the R10K, even aborted
18920 instructions can have side effects.
18922 This problem only affects kernel stores and, depending on the system,
18923 kernel loads. As an example, a speculatively-executed store may load
18924 the target memory into cache and mark the cache line as dirty, even if
18925 the store itself is later aborted. If a DMA operation writes to the
18926 same area of memory before the ``dirty'' line is flushed, the cached
18927 data overwrites the DMA-ed data. See the R10K processor manual
18928 for a full description, including other potential problems.
18930 One workaround is to insert cache barrier instructions before every memory
18931 access that might be speculatively executed and that might have side
18932 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
18933 controls GCC's implementation of this workaround. It assumes that
18934 aborted accesses to any byte in the following regions does not have
18939 the memory occupied by the current function's stack frame;
18942 the memory occupied by an incoming stack argument;
18945 the memory occupied by an object with a link-time-constant address.
18948 It is the kernel's responsibility to ensure that speculative
18949 accesses to these regions are indeed safe.
18951 If the input program contains a function declaration such as:
18957 then the implementation of @code{foo} must allow @code{j foo} and
18958 @code{jal foo} to be executed speculatively. GCC honors this
18959 restriction for functions it compiles itself. It expects non-GCC
18960 functions (such as hand-written assembly code) to do the same.
18962 The option has three forms:
18965 @item -mr10k-cache-barrier=load-store
18966 Insert a cache barrier before a load or store that might be
18967 speculatively executed and that might have side effects even
18970 @item -mr10k-cache-barrier=store
18971 Insert a cache barrier before a store that might be speculatively
18972 executed and that might have side effects even if aborted.
18974 @item -mr10k-cache-barrier=none
18975 Disable the insertion of cache barriers. This is the default setting.
18978 @item -mflush-func=@var{func}
18979 @itemx -mno-flush-func
18980 @opindex mflush-func
18981 Specifies the function to call to flush the I and D caches, or to not
18982 call any such function. If called, the function must take the same
18983 arguments as the common @code{_flush_func}, that is, the address of the
18984 memory range for which the cache is being flushed, the size of the
18985 memory range, and the number 3 (to flush both caches). The default
18986 depends on the target GCC was configured for, but commonly is either
18987 @code{_flush_func} or @code{__cpu_flush}.
18989 @item mbranch-cost=@var{num}
18990 @opindex mbranch-cost
18991 Set the cost of branches to roughly @var{num} ``simple'' instructions.
18992 This cost is only a heuristic and is not guaranteed to produce
18993 consistent results across releases. A zero cost redundantly selects
18994 the default, which is based on the @option{-mtune} setting.
18996 @item -mbranch-likely
18997 @itemx -mno-branch-likely
18998 @opindex mbranch-likely
18999 @opindex mno-branch-likely
19000 Enable or disable use of Branch Likely instructions, regardless of the
19001 default for the selected architecture. By default, Branch Likely
19002 instructions may be generated if they are supported by the selected
19003 architecture. An exception is for the MIPS32 and MIPS64 architectures
19004 and processors that implement those architectures; for those, Branch
19005 Likely instructions are not be generated by default because the MIPS32
19006 and MIPS64 architectures specifically deprecate their use.
19008 @item -mcompact-branches=never
19009 @itemx -mcompact-branches=optimal
19010 @itemx -mcompact-branches=always
19011 @opindex mcompact-branches=never
19012 @opindex mcompact-branches=optimal
19013 @opindex mcompact-branches=always
19014 These options control which form of branches will be generated. The
19015 default is @option{-mcompact-branches=optimal}.
19017 The @option{-mcompact-branches=never} option ensures that compact branch
19018 instructions will never be generated.
19020 The @option{-mcompact-branches=always} option ensures that a compact
19021 branch instruction will be generated if available. If a compact branch
19022 instruction is not available, a delay slot form of the branch will be
19025 This option is supported from MIPS Release 6 onwards.
19027 The @option{-mcompact-branches=optimal} option will cause a delay slot
19028 branch to be used if one is available in the current ISA and the delay
19029 slot is successfully filled. If the delay slot is not filled, a compact
19030 branch will be chosen if one is available.
19032 @item -mfp-exceptions
19033 @itemx -mno-fp-exceptions
19034 @opindex mfp-exceptions
19035 Specifies whether FP exceptions are enabled. This affects how
19036 FP instructions are scheduled for some processors.
19037 The default is that FP exceptions are
19040 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
19041 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
19044 @item -mvr4130-align
19045 @itemx -mno-vr4130-align
19046 @opindex mvr4130-align
19047 The VR4130 pipeline is two-way superscalar, but can only issue two
19048 instructions together if the first one is 8-byte aligned. When this
19049 option is enabled, GCC aligns pairs of instructions that it
19050 thinks should execute in parallel.
19052 This option only has an effect when optimizing for the VR4130.
19053 It normally makes code faster, but at the expense of making it bigger.
19054 It is enabled by default at optimization level @option{-O3}.
19059 Enable (disable) generation of @code{synci} instructions on
19060 architectures that support it. The @code{synci} instructions (if
19061 enabled) are generated when @code{__builtin___clear_cache} is
19064 This option defaults to @option{-mno-synci}, but the default can be
19065 overridden by configuring GCC with @option{--with-synci}.
19067 When compiling code for single processor systems, it is generally safe
19068 to use @code{synci}. However, on many multi-core (SMP) systems, it
19069 does not invalidate the instruction caches on all cores and may lead
19070 to undefined behavior.
19072 @item -mrelax-pic-calls
19073 @itemx -mno-relax-pic-calls
19074 @opindex mrelax-pic-calls
19075 Try to turn PIC calls that are normally dispatched via register
19076 @code{$25} into direct calls. This is only possible if the linker can
19077 resolve the destination at link time and if the destination is within
19078 range for a direct call.
19080 @option{-mrelax-pic-calls} is the default if GCC was configured to use
19081 an assembler and a linker that support the @code{.reloc} assembly
19082 directive and @option{-mexplicit-relocs} is in effect. With
19083 @option{-mno-explicit-relocs}, this optimization can be performed by the
19084 assembler and the linker alone without help from the compiler.
19086 @item -mmcount-ra-address
19087 @itemx -mno-mcount-ra-address
19088 @opindex mmcount-ra-address
19089 @opindex mno-mcount-ra-address
19090 Emit (do not emit) code that allows @code{_mcount} to modify the
19091 calling function's return address. When enabled, this option extends
19092 the usual @code{_mcount} interface with a new @var{ra-address}
19093 parameter, which has type @code{intptr_t *} and is passed in register
19094 @code{$12}. @code{_mcount} can then modify the return address by
19095 doing both of the following:
19098 Returning the new address in register @code{$31}.
19100 Storing the new address in @code{*@var{ra-address}},
19101 if @var{ra-address} is nonnull.
19104 The default is @option{-mno-mcount-ra-address}.
19106 @item -mframe-header-opt
19107 @itemx -mno-frame-header-opt
19108 @opindex mframe-header-opt
19109 Enable (disable) frame header optimization in the o32 ABI. When using the
19110 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
19111 function to write out register arguments. When enabled, this optimization
19112 will suppress the allocation of the frame header if it can be determined that
19115 This optimization is off by default at all optimization levels.
19120 @subsection MMIX Options
19121 @cindex MMIX Options
19123 These options are defined for the MMIX:
19127 @itemx -mno-libfuncs
19129 @opindex mno-libfuncs
19130 Specify that intrinsic library functions are being compiled, passing all
19131 values in registers, no matter the size.
19134 @itemx -mno-epsilon
19136 @opindex mno-epsilon
19137 Generate floating-point comparison instructions that compare with respect
19138 to the @code{rE} epsilon register.
19140 @item -mabi=mmixware
19142 @opindex mabi=mmixware
19144 Generate code that passes function parameters and return values that (in
19145 the called function) are seen as registers @code{$0} and up, as opposed to
19146 the GNU ABI which uses global registers @code{$231} and up.
19148 @item -mzero-extend
19149 @itemx -mno-zero-extend
19150 @opindex mzero-extend
19151 @opindex mno-zero-extend
19152 When reading data from memory in sizes shorter than 64 bits, use (do not
19153 use) zero-extending load instructions by default, rather than
19154 sign-extending ones.
19157 @itemx -mno-knuthdiv
19159 @opindex mno-knuthdiv
19160 Make the result of a division yielding a remainder have the same sign as
19161 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
19162 remainder follows the sign of the dividend. Both methods are
19163 arithmetically valid, the latter being almost exclusively used.
19165 @item -mtoplevel-symbols
19166 @itemx -mno-toplevel-symbols
19167 @opindex mtoplevel-symbols
19168 @opindex mno-toplevel-symbols
19169 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
19170 code can be used with the @code{PREFIX} assembly directive.
19174 Generate an executable in the ELF format, rather than the default
19175 @samp{mmo} format used by the @command{mmix} simulator.
19177 @item -mbranch-predict
19178 @itemx -mno-branch-predict
19179 @opindex mbranch-predict
19180 @opindex mno-branch-predict
19181 Use (do not use) the probable-branch instructions, when static branch
19182 prediction indicates a probable branch.
19184 @item -mbase-addresses
19185 @itemx -mno-base-addresses
19186 @opindex mbase-addresses
19187 @opindex mno-base-addresses
19188 Generate (do not generate) code that uses @emph{base addresses}. Using a
19189 base address automatically generates a request (handled by the assembler
19190 and the linker) for a constant to be set up in a global register. The
19191 register is used for one or more base address requests within the range 0
19192 to 255 from the value held in the register. The generally leads to short
19193 and fast code, but the number of different data items that can be
19194 addressed is limited. This means that a program that uses lots of static
19195 data may require @option{-mno-base-addresses}.
19197 @item -msingle-exit
19198 @itemx -mno-single-exit
19199 @opindex msingle-exit
19200 @opindex mno-single-exit
19201 Force (do not force) generated code to have a single exit point in each
19205 @node MN10300 Options
19206 @subsection MN10300 Options
19207 @cindex MN10300 options
19209 These @option{-m} options are defined for Matsushita MN10300 architectures:
19214 Generate code to avoid bugs in the multiply instructions for the MN10300
19215 processors. This is the default.
19217 @item -mno-mult-bug
19218 @opindex mno-mult-bug
19219 Do not generate code to avoid bugs in the multiply instructions for the
19220 MN10300 processors.
19224 Generate code using features specific to the AM33 processor.
19228 Do not generate code using features specific to the AM33 processor. This
19233 Generate code using features specific to the AM33/2.0 processor.
19237 Generate code using features specific to the AM34 processor.
19239 @item -mtune=@var{cpu-type}
19241 Use the timing characteristics of the indicated CPU type when
19242 scheduling instructions. This does not change the targeted processor
19243 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
19244 @samp{am33-2} or @samp{am34}.
19246 @item -mreturn-pointer-on-d0
19247 @opindex mreturn-pointer-on-d0
19248 When generating a function that returns a pointer, return the pointer
19249 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
19250 only in @code{a0}, and attempts to call such functions without a prototype
19251 result in errors. Note that this option is on by default; use
19252 @option{-mno-return-pointer-on-d0} to disable it.
19256 Do not link in the C run-time initialization object file.
19260 Indicate to the linker that it should perform a relaxation optimization pass
19261 to shorten branches, calls and absolute memory addresses. This option only
19262 has an effect when used on the command line for the final link step.
19264 This option makes symbolic debugging impossible.
19268 Allow the compiler to generate @emph{Long Instruction Word}
19269 instructions if the target is the @samp{AM33} or later. This is the
19270 default. This option defines the preprocessor macro @code{__LIW__}.
19274 Do not allow the compiler to generate @emph{Long Instruction Word}
19275 instructions. This option defines the preprocessor macro
19280 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
19281 instructions if the target is the @samp{AM33} or later. This is the
19282 default. This option defines the preprocessor macro @code{__SETLB__}.
19286 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
19287 instructions. This option defines the preprocessor macro
19288 @code{__NO_SETLB__}.
19292 @node Moxie Options
19293 @subsection Moxie Options
19294 @cindex Moxie Options
19300 Generate big-endian code. This is the default for @samp{moxie-*-*}
19305 Generate little-endian code.
19309 Generate mul.x and umul.x instructions. This is the default for
19310 @samp{moxiebox-*-*} configurations.
19314 Do not link in the C run-time initialization object file.
19318 @node MSP430 Options
19319 @subsection MSP430 Options
19320 @cindex MSP430 Options
19322 These options are defined for the MSP430:
19328 Force assembly output to always use hex constants. Normally such
19329 constants are signed decimals, but this option is available for
19330 testsuite and/or aesthetic purposes.
19334 Select the MCU to target. This is used to create a C preprocessor
19335 symbol based upon the MCU name, converted to upper case and pre- and
19336 post-fixed with @samp{__}. This in turn is used by the
19337 @file{msp430.h} header file to select an MCU-specific supplementary
19340 The option also sets the ISA to use. If the MCU name is one that is
19341 known to only support the 430 ISA then that is selected, otherwise the
19342 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
19343 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
19344 name selects the 430X ISA.
19346 In addition an MCU-specific linker script is added to the linker
19347 command line. The script's name is the name of the MCU with
19348 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
19349 command line defines the C preprocessor symbol @code{__XXX__} and
19350 cause the linker to search for a script called @file{xxx.ld}.
19352 This option is also passed on to the assembler.
19355 @itemx -mno-warn-mcu
19357 @opindex mno-warn-mcu
19358 This option enables or disables warnings about conflicts between the
19359 MCU name specified by the @option{-mmcu} option and the ISA set by the
19360 @option{-mcpu} option and/or the hardware multiply support set by the
19361 @option{-mhwmult} option. It also toggles warnings about unrecognized
19362 MCU names. This option is on by default.
19366 Specifies the ISA to use. Accepted values are @samp{msp430},
19367 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
19368 @option{-mmcu=} option should be used to select the ISA.
19372 Link to the simulator runtime libraries and linker script. Overrides
19373 any scripts that would be selected by the @option{-mmcu=} option.
19377 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
19381 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
19385 This option is passed to the assembler and linker, and allows the
19386 linker to perform certain optimizations that cannot be done until
19391 Describes the type of hardware multiply supported by the target.
19392 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
19393 for the original 16-bit-only multiply supported by early MCUs.
19394 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
19395 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
19396 A value of @samp{auto} can also be given. This tells GCC to deduce
19397 the hardware multiply support based upon the MCU name provided by the
19398 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
19399 the MCU name is not recognized then no hardware multiply support is
19400 assumed. @code{auto} is the default setting.
19402 Hardware multiplies are normally performed by calling a library
19403 routine. This saves space in the generated code. When compiling at
19404 @option{-O3} or higher however the hardware multiplier is invoked
19405 inline. This makes for bigger, but faster code.
19407 The hardware multiply routines disable interrupts whilst running and
19408 restore the previous interrupt state when they finish. This makes
19409 them safe to use inside interrupt handlers as well as in normal code.
19413 Enable the use of a minimum runtime environment - no static
19414 initializers or constructors. This is intended for memory-constrained
19415 devices. The compiler includes special symbols in some objects
19416 that tell the linker and runtime which code fragments are required.
19418 @item -mcode-region=
19419 @itemx -mdata-region=
19420 @opindex mcode-region
19421 @opindex mdata-region
19422 These options tell the compiler where to place functions and data that
19423 do not have one of the @code{lower}, @code{upper}, @code{either} or
19424 @code{section} attributes. Possible values are @code{lower},
19425 @code{upper}, @code{either} or @code{any}. The first three behave
19426 like the corresponding attribute. The fourth possible value -
19427 @code{any} - is the default. It leaves placement entirely up to the
19428 linker script and how it assigns the standard sections
19429 (@code{.text}, @code{.data}, etc) to the memory regions.
19431 @item -msilicon-errata=
19432 @opindex msilicon-errata
19433 This option passes on a request to assembler to enable the fixes for
19434 the named silicon errata.
19436 @item -msilicon-errata-warn=
19437 @opindex msilicon-errata-warn
19438 This option passes on a request to the assembler to enable warning
19439 messages when a silicon errata might need to be applied.
19443 @node NDS32 Options
19444 @subsection NDS32 Options
19445 @cindex NDS32 Options
19447 These options are defined for NDS32 implementations:
19452 @opindex mbig-endian
19453 Generate code in big-endian mode.
19455 @item -mlittle-endian
19456 @opindex mlittle-endian
19457 Generate code in little-endian mode.
19459 @item -mreduced-regs
19460 @opindex mreduced-regs
19461 Use reduced-set registers for register allocation.
19464 @opindex mfull-regs
19465 Use full-set registers for register allocation.
19469 Generate conditional move instructions.
19473 Do not generate conditional move instructions.
19477 Generate performance extension instructions.
19479 @item -mno-perf-ext
19480 @opindex mno-perf-ext
19481 Do not generate performance extension instructions.
19485 Generate v3 push25/pop25 instructions.
19488 @opindex mno-v3push
19489 Do not generate v3 push25/pop25 instructions.
19493 Generate 16-bit instructions.
19496 @opindex mno-16-bit
19497 Do not generate 16-bit instructions.
19499 @item -misr-vector-size=@var{num}
19500 @opindex misr-vector-size
19501 Specify the size of each interrupt vector, which must be 4 or 16.
19503 @item -mcache-block-size=@var{num}
19504 @opindex mcache-block-size
19505 Specify the size of each cache block,
19506 which must be a power of 2 between 4 and 512.
19508 @item -march=@var{arch}
19510 Specify the name of the target architecture.
19512 @item -mcmodel=@var{code-model}
19514 Set the code model to one of
19517 All the data and read-only data segments must be within 512KB addressing space.
19518 The text segment must be within 16MB addressing space.
19519 @item @samp{medium}
19520 The data segment must be within 512KB while the read-only data segment can be
19521 within 4GB addressing space. The text segment should be still within 16MB
19524 All the text and data segments can be within 4GB addressing space.
19528 @opindex mctor-dtor
19529 Enable constructor/destructor feature.
19533 Guide linker to relax instructions.
19537 @node Nios II Options
19538 @subsection Nios II Options
19539 @cindex Nios II options
19540 @cindex Altera Nios II options
19542 These are the options defined for the Altera Nios II processor.
19548 @cindex smaller data references
19549 Put global and static objects less than or equal to @var{num} bytes
19550 into the small data or BSS sections instead of the normal data or BSS
19551 sections. The default value of @var{num} is 8.
19553 @item -mgpopt=@var{option}
19558 Generate (do not generate) GP-relative accesses. The following
19559 @var{option} names are recognized:
19564 Do not generate GP-relative accesses.
19567 Generate GP-relative accesses for small data objects that are not
19568 external, weak, or uninitialized common symbols.
19569 Also use GP-relative addressing for objects that
19570 have been explicitly placed in a small data section via a @code{section}
19574 As for @samp{local}, but also generate GP-relative accesses for
19575 small data objects that are external, weak, or common. If you use this option,
19576 you must ensure that all parts of your program (including libraries) are
19577 compiled with the same @option{-G} setting.
19580 Generate GP-relative accesses for all data objects in the program. If you
19581 use this option, the entire data and BSS segments
19582 of your program must fit in 64K of memory and you must use an appropriate
19583 linker script to allocate them within the addressable range of the
19587 Generate GP-relative addresses for function pointers as well as data
19588 pointers. If you use this option, the entire text, data, and BSS segments
19589 of your program must fit in 64K of memory and you must use an appropriate
19590 linker script to allocate them within the addressable range of the
19595 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
19596 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
19598 The default is @option{-mgpopt} except when @option{-fpic} or
19599 @option{-fPIC} is specified to generate position-independent code.
19600 Note that the Nios II ABI does not permit GP-relative accesses from
19603 You may need to specify @option{-mno-gpopt} explicitly when building
19604 programs that include large amounts of small data, including large
19605 GOT data sections. In this case, the 16-bit offset for GP-relative
19606 addressing may not be large enough to allow access to the entire
19607 small data section.
19613 Generate little-endian (default) or big-endian (experimental) code,
19616 @item -march=@var{arch}
19618 This specifies the name of the target Nios II architecture. GCC uses this
19619 name to determine what kind of instructions it can emit when generating
19620 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
19622 The preprocessor macro @code{__nios2_arch__} is available to programs,
19623 with value 1 or 2, indicating the targeted ISA level.
19625 @item -mbypass-cache
19626 @itemx -mno-bypass-cache
19627 @opindex mno-bypass-cache
19628 @opindex mbypass-cache
19629 Force all load and store instructions to always bypass cache by
19630 using I/O variants of the instructions. The default is not to
19633 @item -mno-cache-volatile
19634 @itemx -mcache-volatile
19635 @opindex mcache-volatile
19636 @opindex mno-cache-volatile
19637 Volatile memory access bypass the cache using the I/O variants of
19638 the load and store instructions. The default is not to bypass the cache.
19640 @item -mno-fast-sw-div
19641 @itemx -mfast-sw-div
19642 @opindex mno-fast-sw-div
19643 @opindex mfast-sw-div
19644 Do not use table-based fast divide for small numbers. The default
19645 is to use the fast divide at @option{-O3} and above.
19649 @itemx -mno-hw-mulx
19653 @opindex mno-hw-mul
19655 @opindex mno-hw-mulx
19657 @opindex mno-hw-div
19659 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
19660 instructions by the compiler. The default is to emit @code{mul}
19661 and not emit @code{div} and @code{mulx}.
19667 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
19668 CDX (code density) instructions. Enabling these instructions also
19669 requires @option{-march=r2}. Since these instructions are optional
19670 extensions to the R2 architecture, the default is not to emit them.
19672 @item -mcustom-@var{insn}=@var{N}
19673 @itemx -mno-custom-@var{insn}
19674 @opindex mcustom-@var{insn}
19675 @opindex mno-custom-@var{insn}
19676 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
19677 custom instruction with encoding @var{N} when generating code that uses
19678 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
19679 instruction 253 for single-precision floating-point add operations instead
19680 of the default behavior of using a library call.
19682 The following values of @var{insn} are supported. Except as otherwise
19683 noted, floating-point operations are expected to be implemented with
19684 normal IEEE 754 semantics and correspond directly to the C operators or the
19685 equivalent GCC built-in functions (@pxref{Other Builtins}).
19687 Single-precision floating point:
19690 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
19691 Binary arithmetic operations.
19697 Unary absolute value.
19699 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
19700 Comparison operations.
19702 @item @samp{fmins}, @samp{fmaxs}
19703 Floating-point minimum and maximum. These instructions are only
19704 generated if @option{-ffinite-math-only} is specified.
19706 @item @samp{fsqrts}
19707 Unary square root operation.
19709 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
19710 Floating-point trigonometric and exponential functions. These instructions
19711 are only generated if @option{-funsafe-math-optimizations} is also specified.
19715 Double-precision floating point:
19718 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
19719 Binary arithmetic operations.
19725 Unary absolute value.
19727 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
19728 Comparison operations.
19730 @item @samp{fmind}, @samp{fmaxd}
19731 Double-precision minimum and maximum. These instructions are only
19732 generated if @option{-ffinite-math-only} is specified.
19734 @item @samp{fsqrtd}
19735 Unary square root operation.
19737 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
19738 Double-precision trigonometric and exponential functions. These instructions
19739 are only generated if @option{-funsafe-math-optimizations} is also specified.
19745 @item @samp{fextsd}
19746 Conversion from single precision to double precision.
19748 @item @samp{ftruncds}
19749 Conversion from double precision to single precision.
19751 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
19752 Conversion from floating point to signed or unsigned integer types, with
19753 truncation towards zero.
19756 Conversion from single-precision floating point to signed integer,
19757 rounding to the nearest integer and ties away from zero.
19758 This corresponds to the @code{__builtin_lroundf} function when
19759 @option{-fno-math-errno} is used.
19761 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
19762 Conversion from signed or unsigned integer types to floating-point types.
19766 In addition, all of the following transfer instructions for internal
19767 registers X and Y must be provided to use any of the double-precision
19768 floating-point instructions. Custom instructions taking two
19769 double-precision source operands expect the first operand in the
19770 64-bit register X. The other operand (or only operand of a unary
19771 operation) is given to the custom arithmetic instruction with the
19772 least significant half in source register @var{src1} and the most
19773 significant half in @var{src2}. A custom instruction that returns a
19774 double-precision result returns the most significant 32 bits in the
19775 destination register and the other half in 32-bit register Y.
19776 GCC automatically generates the necessary code sequences to write
19777 register X and/or read register Y when double-precision floating-point
19778 instructions are used.
19783 Write @var{src1} into the least significant half of X and @var{src2} into
19784 the most significant half of X.
19787 Write @var{src1} into Y.
19789 @item @samp{frdxhi}, @samp{frdxlo}
19790 Read the most or least (respectively) significant half of X and store it in
19794 Read the value of Y and store it into @var{dest}.
19797 Note that you can gain more local control over generation of Nios II custom
19798 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
19799 and @code{target("no-custom-@var{insn}")} function attributes
19800 (@pxref{Function Attributes})
19801 or pragmas (@pxref{Function Specific Option Pragmas}).
19803 @item -mcustom-fpu-cfg=@var{name}
19804 @opindex mcustom-fpu-cfg
19806 This option enables a predefined, named set of custom instruction encodings
19807 (see @option{-mcustom-@var{insn}} above).
19808 Currently, the following sets are defined:
19810 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
19811 @gccoptlist{-mcustom-fmuls=252 @gol
19812 -mcustom-fadds=253 @gol
19813 -mcustom-fsubs=254 @gol
19814 -fsingle-precision-constant}
19816 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
19817 @gccoptlist{-mcustom-fmuls=252 @gol
19818 -mcustom-fadds=253 @gol
19819 -mcustom-fsubs=254 @gol
19820 -mcustom-fdivs=255 @gol
19821 -fsingle-precision-constant}
19823 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
19824 @gccoptlist{-mcustom-floatus=243 @gol
19825 -mcustom-fixsi=244 @gol
19826 -mcustom-floatis=245 @gol
19827 -mcustom-fcmpgts=246 @gol
19828 -mcustom-fcmples=249 @gol
19829 -mcustom-fcmpeqs=250 @gol
19830 -mcustom-fcmpnes=251 @gol
19831 -mcustom-fmuls=252 @gol
19832 -mcustom-fadds=253 @gol
19833 -mcustom-fsubs=254 @gol
19834 -mcustom-fdivs=255 @gol
19835 -fsingle-precision-constant}
19837 Custom instruction assignments given by individual
19838 @option{-mcustom-@var{insn}=} options override those given by
19839 @option{-mcustom-fpu-cfg=}, regardless of the
19840 order of the options on the command line.
19842 Note that you can gain more local control over selection of a FPU
19843 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
19844 function attribute (@pxref{Function Attributes})
19845 or pragma (@pxref{Function Specific Option Pragmas}).
19849 These additional @samp{-m} options are available for the Altera Nios II
19850 ELF (bare-metal) target:
19856 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
19857 startup and termination code, and is typically used in conjunction with
19858 @option{-msys-crt0=} to specify the location of the alternate startup code
19859 provided by the HAL BSP.
19863 Link with a limited version of the C library, @option{-lsmallc}, rather than
19866 @item -msys-crt0=@var{startfile}
19868 @var{startfile} is the file name of the startfile (crt0) to use
19869 when linking. This option is only useful in conjunction with @option{-mhal}.
19871 @item -msys-lib=@var{systemlib}
19873 @var{systemlib} is the library name of the library that provides
19874 low-level system calls required by the C library,
19875 e.g. @code{read} and @code{write}.
19876 This option is typically used to link with a library provided by a HAL BSP.
19880 @node Nvidia PTX Options
19881 @subsection Nvidia PTX Options
19882 @cindex Nvidia PTX options
19883 @cindex nvptx options
19885 These options are defined for Nvidia PTX:
19893 Generate code for 32-bit or 64-bit ABI.
19896 @opindex mmainkernel
19897 Link in code for a __main kernel. This is for stand-alone instead of
19898 offloading execution.
19902 Apply partitioned execution optimizations. This is the default when any
19903 level of optimization is selected.
19907 @node PDP-11 Options
19908 @subsection PDP-11 Options
19909 @cindex PDP-11 Options
19911 These options are defined for the PDP-11:
19916 Use hardware FPP floating point. This is the default. (FIS floating
19917 point on the PDP-11/40 is not supported.)
19920 @opindex msoft-float
19921 Do not use hardware floating point.
19925 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
19929 Return floating-point results in memory. This is the default.
19933 Generate code for a PDP-11/40.
19937 Generate code for a PDP-11/45. This is the default.
19941 Generate code for a PDP-11/10.
19943 @item -mbcopy-builtin
19944 @opindex mbcopy-builtin
19945 Use inline @code{movmemhi} patterns for copying memory. This is the
19950 Do not use inline @code{movmemhi} patterns for copying memory.
19956 Use 16-bit @code{int}. This is the default.
19962 Use 32-bit @code{int}.
19965 @itemx -mno-float32
19967 @opindex mno-float32
19968 Use 64-bit @code{float}. This is the default.
19971 @itemx -mno-float64
19973 @opindex mno-float64
19974 Use 32-bit @code{float}.
19978 Use @code{abshi2} pattern. This is the default.
19982 Do not use @code{abshi2} pattern.
19984 @item -mbranch-expensive
19985 @opindex mbranch-expensive
19986 Pretend that branches are expensive. This is for experimenting with
19987 code generation only.
19989 @item -mbranch-cheap
19990 @opindex mbranch-cheap
19991 Do not pretend that branches are expensive. This is the default.
19995 Use Unix assembler syntax. This is the default when configured for
19996 @samp{pdp11-*-bsd}.
20000 Use DEC assembler syntax. This is the default when configured for any
20001 PDP-11 target other than @samp{pdp11-*-bsd}.
20004 @node picoChip Options
20005 @subsection picoChip Options
20006 @cindex picoChip options
20008 These @samp{-m} options are defined for picoChip implementations:
20012 @item -mae=@var{ae_type}
20014 Set the instruction set, register set, and instruction scheduling
20015 parameters for array element type @var{ae_type}. Supported values
20016 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
20018 @option{-mae=ANY} selects a completely generic AE type. Code
20019 generated with this option runs on any of the other AE types. The
20020 code is not as efficient as it would be if compiled for a specific
20021 AE type, and some types of operation (e.g., multiplication) do not
20022 work properly on all types of AE.
20024 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
20025 for compiled code, and is the default.
20027 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
20028 option may suffer from poor performance of byte (char) manipulation,
20029 since the DSP AE does not provide hardware support for byte load/stores.
20031 @item -msymbol-as-address
20032 Enable the compiler to directly use a symbol name as an address in a
20033 load/store instruction, without first loading it into a
20034 register. Typically, the use of this option generates larger
20035 programs, which run faster than when the option isn't used. However, the
20036 results vary from program to program, so it is left as a user option,
20037 rather than being permanently enabled.
20039 @item -mno-inefficient-warnings
20040 Disables warnings about the generation of inefficient code. These
20041 warnings can be generated, for example, when compiling code that
20042 performs byte-level memory operations on the MAC AE type. The MAC AE has
20043 no hardware support for byte-level memory operations, so all byte
20044 load/stores must be synthesized from word load/store operations. This is
20045 inefficient and a warning is generated to indicate
20046 that you should rewrite the code to avoid byte operations, or to target
20047 an AE type that has the necessary hardware support. This option disables
20052 @node PowerPC Options
20053 @subsection PowerPC Options
20054 @cindex PowerPC options
20056 These are listed under @xref{RS/6000 and PowerPC Options}.
20059 @subsection RL78 Options
20060 @cindex RL78 Options
20066 Links in additional target libraries to support operation within a
20075 Specifies the type of hardware multiplication and division support to
20076 be used. The simplest is @code{none}, which uses software for both
20077 multiplication and division. This is the default. The @code{g13}
20078 value is for the hardware multiply/divide peripheral found on the
20079 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
20080 the multiplication and division instructions supported by the RL78/G14
20081 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
20082 the value @code{mg10} is an alias for @code{none}.
20084 In addition a C preprocessor macro is defined, based upon the setting
20085 of this option. Possible values are: @code{__RL78_MUL_NONE__},
20086 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
20093 Specifies the RL78 core to target. The default is the G14 core, also
20094 known as an S3 core or just RL78. The G13 or S2 core does not have
20095 multiply or divide instructions, instead it uses a hardware peripheral
20096 for these operations. The G10 or S1 core does not have register
20097 banks, so it uses a different calling convention.
20099 If this option is set it also selects the type of hardware multiply
20100 support to use, unless this is overridden by an explicit
20101 @option{-mmul=none} option on the command line. Thus specifying
20102 @option{-mcpu=g13} enables the use of the G13 hardware multiply
20103 peripheral and specifying @option{-mcpu=g10} disables the use of
20104 hardware multiplications altogether.
20106 Note, although the RL78/G14 core is the default target, specifying
20107 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
20108 change the behavior of the toolchain since it also enables G14
20109 hardware multiply support. If these options are not specified on the
20110 command line then software multiplication routines will be used even
20111 though the code targets the RL78 core. This is for backwards
20112 compatibility with older toolchains which did not have hardware
20113 multiply and divide support.
20115 In addition a C preprocessor macro is defined, based upon the setting
20116 of this option. Possible values are: @code{__RL78_G10__},
20117 @code{__RL78_G13__} or @code{__RL78_G14__}.
20127 These are aliases for the corresponding @option{-mcpu=} option. They
20128 are provided for backwards compatibility.
20132 Allow the compiler to use all of the available registers. By default
20133 registers @code{r24..r31} are reserved for use in interrupt handlers.
20134 With this option enabled these registers can be used in ordinary
20137 @item -m64bit-doubles
20138 @itemx -m32bit-doubles
20139 @opindex m64bit-doubles
20140 @opindex m32bit-doubles
20141 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
20142 or 32 bits (@option{-m32bit-doubles}) in size. The default is
20143 @option{-m32bit-doubles}.
20145 @item -msave-mduc-in-interrupts
20146 @item -mno-save-mduc-in-interrupts
20147 @opindex msave-mduc-in-interrupts
20148 @opindex mno-save-mduc-in-interrupts
20149 Specifies that interrupt handler functions should preserve the
20150 MDUC registers. This is only necessary if normal code might use
20151 the MDUC registers, for example because it performs multiplication
20152 and division operations. The default is to ignore the MDUC registers
20153 as this makes the interrupt handlers faster. The target option -mg13
20154 needs to be passed for this to work as this feature is only available
20155 on the G13 target (S2 core). The MDUC registers will only be saved
20156 if the interrupt handler performs a multiplication or division
20157 operation or it calls another function.
20161 @node RS/6000 and PowerPC Options
20162 @subsection IBM RS/6000 and PowerPC Options
20163 @cindex RS/6000 and PowerPC Options
20164 @cindex IBM RS/6000 and PowerPC Options
20166 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
20168 @item -mpowerpc-gpopt
20169 @itemx -mno-powerpc-gpopt
20170 @itemx -mpowerpc-gfxopt
20171 @itemx -mno-powerpc-gfxopt
20174 @itemx -mno-powerpc64
20178 @itemx -mno-popcntb
20180 @itemx -mno-popcntd
20189 @itemx -mno-hard-dfp
20190 @opindex mpowerpc-gpopt
20191 @opindex mno-powerpc-gpopt
20192 @opindex mpowerpc-gfxopt
20193 @opindex mno-powerpc-gfxopt
20194 @opindex mpowerpc64
20195 @opindex mno-powerpc64
20199 @opindex mno-popcntb
20201 @opindex mno-popcntd
20207 @opindex mno-mfpgpr
20209 @opindex mno-hard-dfp
20210 You use these options to specify which instructions are available on the
20211 processor you are using. The default value of these options is
20212 determined when configuring GCC@. Specifying the
20213 @option{-mcpu=@var{cpu_type}} overrides the specification of these
20214 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
20215 rather than the options listed above.
20217 Specifying @option{-mpowerpc-gpopt} allows
20218 GCC to use the optional PowerPC architecture instructions in the
20219 General Purpose group, including floating-point square root. Specifying
20220 @option{-mpowerpc-gfxopt} allows GCC to
20221 use the optional PowerPC architecture instructions in the Graphics
20222 group, including floating-point select.
20224 The @option{-mmfcrf} option allows GCC to generate the move from
20225 condition register field instruction implemented on the POWER4
20226 processor and other processors that support the PowerPC V2.01
20228 The @option{-mpopcntb} option allows GCC to generate the popcount and
20229 double-precision FP reciprocal estimate instruction implemented on the
20230 POWER5 processor and other processors that support the PowerPC V2.02
20232 The @option{-mpopcntd} option allows GCC to generate the popcount
20233 instruction implemented on the POWER7 processor and other processors
20234 that support the PowerPC V2.06 architecture.
20235 The @option{-mfprnd} option allows GCC to generate the FP round to
20236 integer instructions implemented on the POWER5+ processor and other
20237 processors that support the PowerPC V2.03 architecture.
20238 The @option{-mcmpb} option allows GCC to generate the compare bytes
20239 instruction implemented on the POWER6 processor and other processors
20240 that support the PowerPC V2.05 architecture.
20241 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
20242 general-purpose register instructions implemented on the POWER6X
20243 processor and other processors that support the extended PowerPC V2.05
20245 The @option{-mhard-dfp} option allows GCC to generate the decimal
20246 floating-point instructions implemented on some POWER processors.
20248 The @option{-mpowerpc64} option allows GCC to generate the additional
20249 64-bit instructions that are found in the full PowerPC64 architecture
20250 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
20251 @option{-mno-powerpc64}.
20253 @item -mcpu=@var{cpu_type}
20255 Set architecture type, register usage, and
20256 instruction scheduling parameters for machine type @var{cpu_type}.
20257 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
20258 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
20259 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
20260 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
20261 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
20262 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
20263 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
20264 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
20265 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
20266 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
20267 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
20270 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
20271 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
20272 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
20273 architecture machine types, with an appropriate, generic processor
20274 model assumed for scheduling purposes.
20276 The other options specify a specific processor. Code generated under
20277 those options runs best on that processor, and may not run at all on
20280 The @option{-mcpu} options automatically enable or disable the
20283 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
20284 -mpopcntb -mpopcntd -mpowerpc64 @gol
20285 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
20286 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
20287 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
20288 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
20290 The particular options set for any particular CPU varies between
20291 compiler versions, depending on what setting seems to produce optimal
20292 code for that CPU; it doesn't necessarily reflect the actual hardware's
20293 capabilities. If you wish to set an individual option to a particular
20294 value, you may specify it after the @option{-mcpu} option, like
20295 @option{-mcpu=970 -mno-altivec}.
20297 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
20298 not enabled or disabled by the @option{-mcpu} option at present because
20299 AIX does not have full support for these options. You may still
20300 enable or disable them individually if you're sure it'll work in your
20303 @item -mtune=@var{cpu_type}
20305 Set the instruction scheduling parameters for machine type
20306 @var{cpu_type}, but do not set the architecture type or register usage,
20307 as @option{-mcpu=@var{cpu_type}} does. The same
20308 values for @var{cpu_type} are used for @option{-mtune} as for
20309 @option{-mcpu}. If both are specified, the code generated uses the
20310 architecture and registers set by @option{-mcpu}, but the
20311 scheduling parameters set by @option{-mtune}.
20313 @item -mcmodel=small
20314 @opindex mcmodel=small
20315 Generate PowerPC64 code for the small model: The TOC is limited to
20318 @item -mcmodel=medium
20319 @opindex mcmodel=medium
20320 Generate PowerPC64 code for the medium model: The TOC and other static
20321 data may be up to a total of 4G in size.
20323 @item -mcmodel=large
20324 @opindex mcmodel=large
20325 Generate PowerPC64 code for the large model: The TOC may be up to 4G
20326 in size. Other data and code is only limited by the 64-bit address
20330 @itemx -mno-altivec
20332 @opindex mno-altivec
20333 Generate code that uses (does not use) AltiVec instructions, and also
20334 enable the use of built-in functions that allow more direct access to
20335 the AltiVec instruction set. You may also need to set
20336 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
20339 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
20340 @option{-maltivec=be}, the element order for AltiVec intrinsics such
20341 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
20342 match array element order corresponding to the endianness of the
20343 target. That is, element zero identifies the leftmost element in a
20344 vector register when targeting a big-endian platform, and identifies
20345 the rightmost element in a vector register when targeting a
20346 little-endian platform.
20349 @opindex maltivec=be
20350 Generate AltiVec instructions using big-endian element order,
20351 regardless of whether the target is big- or little-endian. This is
20352 the default when targeting a big-endian platform.
20354 The element order is used to interpret element numbers in AltiVec
20355 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20356 @code{vec_insert}. By default, these match array element order
20357 corresponding to the endianness for the target.
20360 @opindex maltivec=le
20361 Generate AltiVec instructions using little-endian element order,
20362 regardless of whether the target is big- or little-endian. This is
20363 the default when targeting a little-endian platform. This option is
20364 currently ignored when targeting a big-endian platform.
20366 The element order is used to interpret element numbers in AltiVec
20367 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20368 @code{vec_insert}. By default, these match array element order
20369 corresponding to the endianness for the target.
20374 @opindex mno-vrsave
20375 Generate VRSAVE instructions when generating AltiVec code.
20377 @item -mgen-cell-microcode
20378 @opindex mgen-cell-microcode
20379 Generate Cell microcode instructions.
20381 @item -mwarn-cell-microcode
20382 @opindex mwarn-cell-microcode
20383 Warn when a Cell microcode instruction is emitted. An example
20384 of a Cell microcode instruction is a variable shift.
20387 @opindex msecure-plt
20388 Generate code that allows @command{ld} and @command{ld.so}
20389 to build executables and shared
20390 libraries with non-executable @code{.plt} and @code{.got} sections.
20392 32-bit SYSV ABI option.
20396 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
20398 requires @code{.plt} and @code{.got}
20399 sections that are both writable and executable.
20400 This is a PowerPC 32-bit SYSV ABI option.
20406 This switch enables or disables the generation of ISEL instructions.
20408 @item -misel=@var{yes/no}
20409 This switch has been deprecated. Use @option{-misel} and
20410 @option{-mno-isel} instead.
20414 Enable Local Register Allocation. This is still experimental for PowerPC,
20415 so by default the compiler uses standard reload
20416 (i.e. @option{-mno-lra}).
20422 This switch enables or disables the generation of SPE simd
20428 @opindex mno-paired
20429 This switch enables or disables the generation of PAIRED simd
20432 @item -mspe=@var{yes/no}
20433 This option has been deprecated. Use @option{-mspe} and
20434 @option{-mno-spe} instead.
20440 Generate code that uses (does not use) vector/scalar (VSX)
20441 instructions, and also enable the use of built-in functions that allow
20442 more direct access to the VSX instruction set.
20447 @opindex mno-crypto
20448 Enable the use (disable) of the built-in functions that allow direct
20449 access to the cryptographic instructions that were added in version
20450 2.07 of the PowerPC ISA.
20452 @item -mdirect-move
20453 @itemx -mno-direct-move
20454 @opindex mdirect-move
20455 @opindex mno-direct-move
20456 Generate code that uses (does not use) the instructions to move data
20457 between the general purpose registers and the vector/scalar (VSX)
20458 registers that were added in version 2.07 of the PowerPC ISA.
20464 Enable (disable) the use of the built-in functions that allow direct
20465 access to the Hardware Transactional Memory (HTM) instructions that
20466 were added in version 2.07 of the PowerPC ISA.
20468 @item -mpower8-fusion
20469 @itemx -mno-power8-fusion
20470 @opindex mpower8-fusion
20471 @opindex mno-power8-fusion
20472 Generate code that keeps (does not keeps) some integer operations
20473 adjacent so that the instructions can be fused together on power8 and
20476 @item -mpower8-vector
20477 @itemx -mno-power8-vector
20478 @opindex mpower8-vector
20479 @opindex mno-power8-vector
20480 Generate code that uses (does not use) the vector and scalar
20481 instructions that were added in version 2.07 of the PowerPC ISA. Also
20482 enable the use of built-in functions that allow more direct access to
20483 the vector instructions.
20485 @item -mquad-memory
20486 @itemx -mno-quad-memory
20487 @opindex mquad-memory
20488 @opindex mno-quad-memory
20489 Generate code that uses (does not use) the non-atomic quad word memory
20490 instructions. The @option{-mquad-memory} option requires use of
20493 @item -mquad-memory-atomic
20494 @itemx -mno-quad-memory-atomic
20495 @opindex mquad-memory-atomic
20496 @opindex mno-quad-memory-atomic
20497 Generate code that uses (does not use) the atomic quad word memory
20498 instructions. The @option{-mquad-memory-atomic} option requires use of
20501 @item -mupper-regs-di
20502 @itemx -mno-upper-regs-di
20503 @opindex mupper-regs-di
20504 @opindex mno-upper-regs-di
20505 Generate code that uses (does not use) the scalar instructions that
20506 target all 64 registers in the vector/scalar floating point register
20507 set that were added in version 2.06 of the PowerPC ISA when processing
20508 integers. @option{-mupper-regs-di} is turned on by default if you use
20509 any of the @option{-mcpu=power7}, @option{-mcpu=power8},
20510 @option{-mcpu=power9}, or @option{-mvsx} options.
20512 @item -mupper-regs-df
20513 @itemx -mno-upper-regs-df
20514 @opindex mupper-regs-df
20515 @opindex mno-upper-regs-df
20516 Generate code that uses (does not use) the scalar double precision
20517 instructions that target all 64 registers in the vector/scalar
20518 floating point register set that were added in version 2.06 of the
20519 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
20520 use any of the @option{-mcpu=power7}, @option{-mcpu=power8},
20521 @option{-mcpu=power9}, or @option{-mvsx} options.
20523 @item -mupper-regs-sf
20524 @itemx -mno-upper-regs-sf
20525 @opindex mupper-regs-sf
20526 @opindex mno-upper-regs-sf
20527 Generate code that uses (does not use) the scalar single precision
20528 instructions that target all 64 registers in the vector/scalar
20529 floating point register set that were added in version 2.07 of the
20530 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
20531 use either of the @option{-mcpu=power8}, @option{-mpower8-vector}, or
20532 @option{-mcpu=power9} options.
20535 @itemx -mno-upper-regs
20536 @opindex mupper-regs
20537 @opindex mno-upper-regs
20538 Generate code that uses (does not use) the scalar
20539 instructions that target all 64 registers in the vector/scalar
20540 floating point register set, depending on the model of the machine.
20542 If the @option{-mno-upper-regs} option is used, it turns off both
20543 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
20546 @itemx -mno-float128
20548 @opindex mno-float128
20549 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
20550 and use either software emulation for IEEE 128-bit floating point or
20551 hardware instructions.
20553 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
20554 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
20555 option. The @option{-mfloat128} option only works on PowerPC 64-bit
20558 If you use the ISA 3.0 instruction set (@option{-mcpu=power9}), the
20559 @option{-mfloat128} option will also enable the generation of ISA 3.0
20560 IEEE 128-bit floating point instructions. Otherwise, IEEE 128-bit
20561 floating point will be done with software emulation.
20563 @item -mfloat128-hardware
20564 @itemx -mno-float128-hardware
20565 @opindex mfloat128-hardware
20566 @opindex mno-float128-hardware
20567 Enable/disable using ISA 3.0 hardware instructions to support the
20568 @var{__float128} data type.
20570 If you use @option{-mfloat128-hardware}, it will enable the option
20571 @option{-mfloat128} as well.
20573 If you select ISA 3.0 instructions with @option{-mcpu=power9}, but do
20574 not use either @option{-mfloat128} or @option{-mfloat128-hardware},
20575 the IEEE 128-bit floating point support will not be enabled.
20577 @item -mfloat-gprs=@var{yes/single/double/no}
20578 @itemx -mfloat-gprs
20579 @opindex mfloat-gprs
20580 This switch enables or disables the generation of floating-point
20581 operations on the general-purpose registers for architectures that
20584 The argument @samp{yes} or @samp{single} enables the use of
20585 single-precision floating-point operations.
20587 The argument @samp{double} enables the use of single and
20588 double-precision floating-point operations.
20590 The argument @samp{no} disables floating-point operations on the
20591 general-purpose registers.
20593 This option is currently only available on the MPC854x.
20599 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
20600 targets (including GNU/Linux). The 32-bit environment sets int, long
20601 and pointer to 32 bits and generates code that runs on any PowerPC
20602 variant. The 64-bit environment sets int to 32 bits and long and
20603 pointer to 64 bits, and generates code for PowerPC64, as for
20604 @option{-mpowerpc64}.
20607 @itemx -mno-fp-in-toc
20608 @itemx -mno-sum-in-toc
20609 @itemx -mminimal-toc
20611 @opindex mno-fp-in-toc
20612 @opindex mno-sum-in-toc
20613 @opindex mminimal-toc
20614 Modify generation of the TOC (Table Of Contents), which is created for
20615 every executable file. The @option{-mfull-toc} option is selected by
20616 default. In that case, GCC allocates at least one TOC entry for
20617 each unique non-automatic variable reference in your program. GCC
20618 also places floating-point constants in the TOC@. However, only
20619 16,384 entries are available in the TOC@.
20621 If you receive a linker error message that saying you have overflowed
20622 the available TOC space, you can reduce the amount of TOC space used
20623 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
20624 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
20625 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
20626 generate code to calculate the sum of an address and a constant at
20627 run time instead of putting that sum into the TOC@. You may specify one
20628 or both of these options. Each causes GCC to produce very slightly
20629 slower and larger code at the expense of conserving TOC space.
20631 If you still run out of space in the TOC even when you specify both of
20632 these options, specify @option{-mminimal-toc} instead. This option causes
20633 GCC to make only one TOC entry for every file. When you specify this
20634 option, GCC produces code that is slower and larger but which
20635 uses extremely little TOC space. You may wish to use this option
20636 only on files that contain less frequently-executed code.
20642 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
20643 @code{long} type, and the infrastructure needed to support them.
20644 Specifying @option{-maix64} implies @option{-mpowerpc64},
20645 while @option{-maix32} disables the 64-bit ABI and
20646 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
20649 @itemx -mno-xl-compat
20650 @opindex mxl-compat
20651 @opindex mno-xl-compat
20652 Produce code that conforms more closely to IBM XL compiler semantics
20653 when using AIX-compatible ABI@. Pass floating-point arguments to
20654 prototyped functions beyond the register save area (RSA) on the stack
20655 in addition to argument FPRs. Do not assume that most significant
20656 double in 128-bit long double value is properly rounded when comparing
20657 values and converting to double. Use XL symbol names for long double
20660 The AIX calling convention was extended but not initially documented to
20661 handle an obscure K&R C case of calling a function that takes the
20662 address of its arguments with fewer arguments than declared. IBM XL
20663 compilers access floating-point arguments that do not fit in the
20664 RSA from the stack when a subroutine is compiled without
20665 optimization. Because always storing floating-point arguments on the
20666 stack is inefficient and rarely needed, this option is not enabled by
20667 default and only is necessary when calling subroutines compiled by IBM
20668 XL compilers without optimization.
20672 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
20673 application written to use message passing with special startup code to
20674 enable the application to run. The system must have PE installed in the
20675 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
20676 must be overridden with the @option{-specs=} option to specify the
20677 appropriate directory location. The Parallel Environment does not
20678 support threads, so the @option{-mpe} option and the @option{-pthread}
20679 option are incompatible.
20681 @item -malign-natural
20682 @itemx -malign-power
20683 @opindex malign-natural
20684 @opindex malign-power
20685 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
20686 @option{-malign-natural} overrides the ABI-defined alignment of larger
20687 types, such as floating-point doubles, on their natural size-based boundary.
20688 The option @option{-malign-power} instructs GCC to follow the ABI-specified
20689 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
20691 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
20695 @itemx -mhard-float
20696 @opindex msoft-float
20697 @opindex mhard-float
20698 Generate code that does not use (uses) the floating-point register set.
20699 Software floating-point emulation is provided if you use the
20700 @option{-msoft-float} option, and pass the option to GCC when linking.
20702 @item -msingle-float
20703 @itemx -mdouble-float
20704 @opindex msingle-float
20705 @opindex mdouble-float
20706 Generate code for single- or double-precision floating-point operations.
20707 @option{-mdouble-float} implies @option{-msingle-float}.
20710 @opindex msimple-fpu
20711 Do not generate @code{sqrt} and @code{div} instructions for hardware
20712 floating-point unit.
20714 @item -mfpu=@var{name}
20716 Specify type of floating-point unit. Valid values for @var{name} are
20717 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
20718 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
20719 @samp{sp_full} (equivalent to @option{-msingle-float}),
20720 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
20723 @opindex mxilinx-fpu
20724 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
20727 @itemx -mno-multiple
20729 @opindex mno-multiple
20730 Generate code that uses (does not use) the load multiple word
20731 instructions and the store multiple word instructions. These
20732 instructions are generated by default on POWER systems, and not
20733 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
20734 PowerPC systems, since those instructions do not work when the
20735 processor is in little-endian mode. The exceptions are PPC740 and
20736 PPC750 which permit these instructions in little-endian mode.
20741 @opindex mno-string
20742 Generate code that uses (does not use) the load string instructions
20743 and the store string word instructions to save multiple registers and
20744 do small block moves. These instructions are generated by default on
20745 POWER systems, and not generated on PowerPC systems. Do not use
20746 @option{-mstring} on little-endian PowerPC systems, since those
20747 instructions do not work when the processor is in little-endian mode.
20748 The exceptions are PPC740 and PPC750 which permit these instructions
20749 in little-endian mode.
20754 @opindex mno-update
20755 Generate code that uses (does not use) the load or store instructions
20756 that update the base register to the address of the calculated memory
20757 location. These instructions are generated by default. If you use
20758 @option{-mno-update}, there is a small window between the time that the
20759 stack pointer is updated and the address of the previous frame is
20760 stored, which means code that walks the stack frame across interrupts or
20761 signals may get corrupted data.
20763 @item -mavoid-indexed-addresses
20764 @itemx -mno-avoid-indexed-addresses
20765 @opindex mavoid-indexed-addresses
20766 @opindex mno-avoid-indexed-addresses
20767 Generate code that tries to avoid (not avoid) the use of indexed load
20768 or store instructions. These instructions can incur a performance
20769 penalty on Power6 processors in certain situations, such as when
20770 stepping through large arrays that cross a 16M boundary. This option
20771 is enabled by default when targeting Power6 and disabled otherwise.
20774 @itemx -mno-fused-madd
20775 @opindex mfused-madd
20776 @opindex mno-fused-madd
20777 Generate code that uses (does not use) the floating-point multiply and
20778 accumulate instructions. These instructions are generated by default
20779 if hardware floating point is used. The machine-dependent
20780 @option{-mfused-madd} option is now mapped to the machine-independent
20781 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
20782 mapped to @option{-ffp-contract=off}.
20788 Generate code that uses (does not use) the half-word multiply and
20789 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
20790 These instructions are generated by default when targeting those
20797 Generate code that uses (does not use) the string-search @samp{dlmzb}
20798 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
20799 generated by default when targeting those processors.
20801 @item -mno-bit-align
20803 @opindex mno-bit-align
20804 @opindex mbit-align
20805 On System V.4 and embedded PowerPC systems do not (do) force structures
20806 and unions that contain bit-fields to be aligned to the base type of the
20809 For example, by default a structure containing nothing but 8
20810 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
20811 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
20812 the structure is aligned to a 1-byte boundary and is 1 byte in
20815 @item -mno-strict-align
20816 @itemx -mstrict-align
20817 @opindex mno-strict-align
20818 @opindex mstrict-align
20819 On System V.4 and embedded PowerPC systems do not (do) assume that
20820 unaligned memory references are handled by the system.
20822 @item -mrelocatable
20823 @itemx -mno-relocatable
20824 @opindex mrelocatable
20825 @opindex mno-relocatable
20826 Generate code that allows (does not allow) a static executable to be
20827 relocated to a different address at run time. A simple embedded
20828 PowerPC system loader should relocate the entire contents of
20829 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
20830 a table of 32-bit addresses generated by this option. For this to
20831 work, all objects linked together must be compiled with
20832 @option{-mrelocatable} or @option{-mrelocatable-lib}.
20833 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
20835 @item -mrelocatable-lib
20836 @itemx -mno-relocatable-lib
20837 @opindex mrelocatable-lib
20838 @opindex mno-relocatable-lib
20839 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
20840 @code{.fixup} section to allow static executables to be relocated at
20841 run time, but @option{-mrelocatable-lib} does not use the smaller stack
20842 alignment of @option{-mrelocatable}. Objects compiled with
20843 @option{-mrelocatable-lib} may be linked with objects compiled with
20844 any combination of the @option{-mrelocatable} options.
20850 On System V.4 and embedded PowerPC systems do not (do) assume that
20851 register 2 contains a pointer to a global area pointing to the addresses
20852 used in the program.
20855 @itemx -mlittle-endian
20857 @opindex mlittle-endian
20858 On System V.4 and embedded PowerPC systems compile code for the
20859 processor in little-endian mode. The @option{-mlittle-endian} option is
20860 the same as @option{-mlittle}.
20863 @itemx -mbig-endian
20865 @opindex mbig-endian
20866 On System V.4 and embedded PowerPC systems compile code for the
20867 processor in big-endian mode. The @option{-mbig-endian} option is
20868 the same as @option{-mbig}.
20870 @item -mdynamic-no-pic
20871 @opindex mdynamic-no-pic
20872 On Darwin and Mac OS X systems, compile code so that it is not
20873 relocatable, but that its external references are relocatable. The
20874 resulting code is suitable for applications, but not shared
20877 @item -msingle-pic-base
20878 @opindex msingle-pic-base
20879 Treat the register used for PIC addressing as read-only, rather than
20880 loading it in the prologue for each function. The runtime system is
20881 responsible for initializing this register with an appropriate value
20882 before execution begins.
20884 @item -mprioritize-restricted-insns=@var{priority}
20885 @opindex mprioritize-restricted-insns
20886 This option controls the priority that is assigned to
20887 dispatch-slot restricted instructions during the second scheduling
20888 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
20889 or @samp{2} to assign no, highest, or second-highest (respectively)
20890 priority to dispatch-slot restricted
20893 @item -msched-costly-dep=@var{dependence_type}
20894 @opindex msched-costly-dep
20895 This option controls which dependences are considered costly
20896 by the target during instruction scheduling. The argument
20897 @var{dependence_type} takes one of the following values:
20901 No dependence is costly.
20904 All dependences are costly.
20906 @item @samp{true_store_to_load}
20907 A true dependence from store to load is costly.
20909 @item @samp{store_to_load}
20910 Any dependence from store to load is costly.
20913 Any dependence for which the latency is greater than or equal to
20914 @var{number} is costly.
20917 @item -minsert-sched-nops=@var{scheme}
20918 @opindex minsert-sched-nops
20919 This option controls which NOP insertion scheme is used during
20920 the second scheduling pass. The argument @var{scheme} takes one of the
20928 Pad with NOPs any dispatch group that has vacant issue slots,
20929 according to the scheduler's grouping.
20931 @item @samp{regroup_exact}
20932 Insert NOPs to force costly dependent insns into
20933 separate groups. Insert exactly as many NOPs as needed to force an insn
20934 to a new group, according to the estimated processor grouping.
20937 Insert NOPs to force costly dependent insns into
20938 separate groups. Insert @var{number} NOPs to force an insn to a new group.
20942 @opindex mcall-sysv
20943 On System V.4 and embedded PowerPC systems compile code using calling
20944 conventions that adhere to the March 1995 draft of the System V
20945 Application Binary Interface, PowerPC processor supplement. This is the
20946 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
20948 @item -mcall-sysv-eabi
20950 @opindex mcall-sysv-eabi
20951 @opindex mcall-eabi
20952 Specify both @option{-mcall-sysv} and @option{-meabi} options.
20954 @item -mcall-sysv-noeabi
20955 @opindex mcall-sysv-noeabi
20956 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
20958 @item -mcall-aixdesc
20960 On System V.4 and embedded PowerPC systems compile code for the AIX
20964 @opindex mcall-linux
20965 On System V.4 and embedded PowerPC systems compile code for the
20966 Linux-based GNU system.
20968 @item -mcall-freebsd
20969 @opindex mcall-freebsd
20970 On System V.4 and embedded PowerPC systems compile code for the
20971 FreeBSD operating system.
20973 @item -mcall-netbsd
20974 @opindex mcall-netbsd
20975 On System V.4 and embedded PowerPC systems compile code for the
20976 NetBSD operating system.
20978 @item -mcall-openbsd
20979 @opindex mcall-netbsd
20980 On System V.4 and embedded PowerPC systems compile code for the
20981 OpenBSD operating system.
20983 @item -maix-struct-return
20984 @opindex maix-struct-return
20985 Return all structures in memory (as specified by the AIX ABI)@.
20987 @item -msvr4-struct-return
20988 @opindex msvr4-struct-return
20989 Return structures smaller than 8 bytes in registers (as specified by the
20992 @item -mabi=@var{abi-type}
20994 Extend the current ABI with a particular extension, or remove such extension.
20995 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
20996 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
20997 @samp{elfv1}, @samp{elfv2}@.
21001 Extend the current ABI with SPE ABI extensions. This does not change
21002 the default ABI, instead it adds the SPE ABI extensions to the current
21006 @opindex mabi=no-spe
21007 Disable Book-E SPE ABI extensions for the current ABI@.
21009 @item -mabi=ibmlongdouble
21010 @opindex mabi=ibmlongdouble
21011 Change the current ABI to use IBM extended-precision long double.
21012 This is a PowerPC 32-bit SYSV ABI option.
21014 @item -mabi=ieeelongdouble
21015 @opindex mabi=ieeelongdouble
21016 Change the current ABI to use IEEE extended-precision long double.
21017 This is a PowerPC 32-bit Linux ABI option.
21020 @opindex mabi=elfv1
21021 Change the current ABI to use the ELFv1 ABI.
21022 This is the default ABI for big-endian PowerPC 64-bit Linux.
21023 Overriding the default ABI requires special system support and is
21024 likely to fail in spectacular ways.
21027 @opindex mabi=elfv2
21028 Change the current ABI to use the ELFv2 ABI.
21029 This is the default ABI for little-endian PowerPC 64-bit Linux.
21030 Overriding the default ABI requires special system support and is
21031 likely to fail in spectacular ways.
21034 @itemx -mno-prototype
21035 @opindex mprototype
21036 @opindex mno-prototype
21037 On System V.4 and embedded PowerPC systems assume that all calls to
21038 variable argument functions are properly prototyped. Otherwise, the
21039 compiler must insert an instruction before every non-prototyped call to
21040 set or clear bit 6 of the condition code register (@code{CR}) to
21041 indicate whether floating-point values are passed in the floating-point
21042 registers in case the function takes variable arguments. With
21043 @option{-mprototype}, only calls to prototyped variable argument functions
21044 set or clear the bit.
21048 On embedded PowerPC systems, assume that the startup module is called
21049 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
21050 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
21055 On embedded PowerPC systems, assume that the startup module is called
21056 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
21061 On embedded PowerPC systems, assume that the startup module is called
21062 @file{crt0.o} and the standard C libraries are @file{libads.a} and
21065 @item -myellowknife
21066 @opindex myellowknife
21067 On embedded PowerPC systems, assume that the startup module is called
21068 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
21073 On System V.4 and embedded PowerPC systems, specify that you are
21074 compiling for a VxWorks system.
21078 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
21079 header to indicate that @samp{eabi} extended relocations are used.
21085 On System V.4 and embedded PowerPC systems do (do not) adhere to the
21086 Embedded Applications Binary Interface (EABI), which is a set of
21087 modifications to the System V.4 specifications. Selecting @option{-meabi}
21088 means that the stack is aligned to an 8-byte boundary, a function
21089 @code{__eabi} is called from @code{main} to set up the EABI
21090 environment, and the @option{-msdata} option can use both @code{r2} and
21091 @code{r13} to point to two separate small data areas. Selecting
21092 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
21093 no EABI initialization function is called from @code{main}, and the
21094 @option{-msdata} option only uses @code{r13} to point to a single
21095 small data area. The @option{-meabi} option is on by default if you
21096 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
21099 @opindex msdata=eabi
21100 On System V.4 and embedded PowerPC systems, put small initialized
21101 @code{const} global and static data in the @code{.sdata2} section, which
21102 is pointed to by register @code{r2}. Put small initialized
21103 non-@code{const} global and static data in the @code{.sdata} section,
21104 which is pointed to by register @code{r13}. Put small uninitialized
21105 global and static data in the @code{.sbss} section, which is adjacent to
21106 the @code{.sdata} section. The @option{-msdata=eabi} option is
21107 incompatible with the @option{-mrelocatable} option. The
21108 @option{-msdata=eabi} option also sets the @option{-memb} option.
21111 @opindex msdata=sysv
21112 On System V.4 and embedded PowerPC systems, put small global and static
21113 data in the @code{.sdata} section, which is pointed to by register
21114 @code{r13}. Put small uninitialized global and static data in the
21115 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
21116 The @option{-msdata=sysv} option is incompatible with the
21117 @option{-mrelocatable} option.
21119 @item -msdata=default
21121 @opindex msdata=default
21123 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
21124 compile code the same as @option{-msdata=eabi}, otherwise compile code the
21125 same as @option{-msdata=sysv}.
21128 @opindex msdata=data
21129 On System V.4 and embedded PowerPC systems, put small global
21130 data in the @code{.sdata} section. Put small uninitialized global
21131 data in the @code{.sbss} section. Do not use register @code{r13}
21132 to address small data however. This is the default behavior unless
21133 other @option{-msdata} options are used.
21137 @opindex msdata=none
21139 On embedded PowerPC systems, put all initialized global and static data
21140 in the @code{.data} section, and all uninitialized data in the
21141 @code{.bss} section.
21143 @item -mblock-move-inline-limit=@var{num}
21144 @opindex mblock-move-inline-limit
21145 Inline all block moves (such as calls to @code{memcpy} or structure
21146 copies) less than or equal to @var{num} bytes. The minimum value for
21147 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
21148 targets. The default value is target-specific.
21152 @cindex smaller data references (PowerPC)
21153 @cindex .sdata/.sdata2 references (PowerPC)
21154 On embedded PowerPC systems, put global and static items less than or
21155 equal to @var{num} bytes into the small data or BSS sections instead of
21156 the normal data or BSS section. By default, @var{num} is 8. The
21157 @option{-G @var{num}} switch is also passed to the linker.
21158 All modules should be compiled with the same @option{-G @var{num}} value.
21161 @itemx -mno-regnames
21163 @opindex mno-regnames
21164 On System V.4 and embedded PowerPC systems do (do not) emit register
21165 names in the assembly language output using symbolic forms.
21168 @itemx -mno-longcall
21170 @opindex mno-longcall
21171 By default assume that all calls are far away so that a longer and more
21172 expensive calling sequence is required. This is required for calls
21173 farther than 32 megabytes (33,554,432 bytes) from the current location.
21174 A short call is generated if the compiler knows
21175 the call cannot be that far away. This setting can be overridden by
21176 the @code{shortcall} function attribute, or by @code{#pragma
21179 Some linkers are capable of detecting out-of-range calls and generating
21180 glue code on the fly. On these systems, long calls are unnecessary and
21181 generate slower code. As of this writing, the AIX linker can do this,
21182 as can the GNU linker for PowerPC/64. It is planned to add this feature
21183 to the GNU linker for 32-bit PowerPC systems as well.
21185 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
21186 callee, L42}, plus a @dfn{branch island} (glue code). The two target
21187 addresses represent the callee and the branch island. The
21188 Darwin/PPC linker prefers the first address and generates a @code{bl
21189 callee} if the PPC @code{bl} instruction reaches the callee directly;
21190 otherwise, the linker generates @code{bl L42} to call the branch
21191 island. The branch island is appended to the body of the
21192 calling function; it computes the full 32-bit address of the callee
21195 On Mach-O (Darwin) systems, this option directs the compiler emit to
21196 the glue for every direct call, and the Darwin linker decides whether
21197 to use or discard it.
21199 In the future, GCC may ignore all longcall specifications
21200 when the linker is known to generate glue.
21202 @item -mtls-markers
21203 @itemx -mno-tls-markers
21204 @opindex mtls-markers
21205 @opindex mno-tls-markers
21206 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
21207 specifying the function argument. The relocation allows the linker to
21208 reliably associate function call with argument setup instructions for
21209 TLS optimization, which in turn allows GCC to better schedule the
21214 Adds support for multithreading with the @dfn{pthreads} library.
21215 This option sets flags for both the preprocessor and linker.
21220 This option enables use of the reciprocal estimate and
21221 reciprocal square root estimate instructions with additional
21222 Newton-Raphson steps to increase precision instead of doing a divide or
21223 square root and divide for floating-point arguments. You should use
21224 the @option{-ffast-math} option when using @option{-mrecip} (or at
21225 least @option{-funsafe-math-optimizations},
21226 @option{-ffinite-math-only}, @option{-freciprocal-math} and
21227 @option{-fno-trapping-math}). Note that while the throughput of the
21228 sequence is generally higher than the throughput of the non-reciprocal
21229 instruction, the precision of the sequence can be decreased by up to 2
21230 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
21233 @item -mrecip=@var{opt}
21234 @opindex mrecip=opt
21235 This option controls which reciprocal estimate instructions
21236 may be used. @var{opt} is a comma-separated list of options, which may
21237 be preceded by a @code{!} to invert the option:
21242 Enable all estimate instructions.
21245 Enable the default instructions, equivalent to @option{-mrecip}.
21248 Disable all estimate instructions, equivalent to @option{-mno-recip}.
21251 Enable the reciprocal approximation instructions for both
21252 single and double precision.
21255 Enable the single-precision reciprocal approximation instructions.
21258 Enable the double-precision reciprocal approximation instructions.
21261 Enable the reciprocal square root approximation instructions for both
21262 single and double precision.
21265 Enable the single-precision reciprocal square root approximation instructions.
21268 Enable the double-precision reciprocal square root approximation instructions.
21272 So, for example, @option{-mrecip=all,!rsqrtd} enables
21273 all of the reciprocal estimate instructions, except for the
21274 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
21275 which handle the double-precision reciprocal square root calculations.
21277 @item -mrecip-precision
21278 @itemx -mno-recip-precision
21279 @opindex mrecip-precision
21280 Assume (do not assume) that the reciprocal estimate instructions
21281 provide higher-precision estimates than is mandated by the PowerPC
21282 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
21283 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
21284 The double-precision square root estimate instructions are not generated by
21285 default on low-precision machines, since they do not provide an
21286 estimate that converges after three steps.
21288 @item -mveclibabi=@var{type}
21289 @opindex mveclibabi
21290 Specifies the ABI type to use for vectorizing intrinsics using an
21291 external library. The only type supported at present is @samp{mass},
21292 which specifies to use IBM's Mathematical Acceleration Subsystem
21293 (MASS) libraries for vectorizing intrinsics using external libraries.
21294 GCC currently emits calls to @code{acosd2}, @code{acosf4},
21295 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
21296 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
21297 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
21298 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
21299 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
21300 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
21301 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
21302 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
21303 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
21304 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
21305 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
21306 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
21307 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
21308 for power7. Both @option{-ftree-vectorize} and
21309 @option{-funsafe-math-optimizations} must also be enabled. The MASS
21310 libraries must be specified at link time.
21315 Generate (do not generate) the @code{friz} instruction when the
21316 @option{-funsafe-math-optimizations} option is used to optimize
21317 rounding of floating-point values to 64-bit integer and back to floating
21318 point. The @code{friz} instruction does not return the same value if
21319 the floating-point number is too large to fit in an integer.
21321 @item -mpointers-to-nested-functions
21322 @itemx -mno-pointers-to-nested-functions
21323 @opindex mpointers-to-nested-functions
21324 Generate (do not generate) code to load up the static chain register
21325 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
21326 systems where a function pointer points to a 3-word descriptor giving
21327 the function address, TOC value to be loaded in register @code{r2}, and
21328 static chain value to be loaded in register @code{r11}. The
21329 @option{-mpointers-to-nested-functions} is on by default. You cannot
21330 call through pointers to nested functions or pointers
21331 to functions compiled in other languages that use the static chain if
21332 you use @option{-mno-pointers-to-nested-functions}.
21334 @item -msave-toc-indirect
21335 @itemx -mno-save-toc-indirect
21336 @opindex msave-toc-indirect
21337 Generate (do not generate) code to save the TOC value in the reserved
21338 stack location in the function prologue if the function calls through
21339 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
21340 saved in the prologue, it is saved just before the call through the
21341 pointer. The @option{-mno-save-toc-indirect} option is the default.
21343 @item -mcompat-align-parm
21344 @itemx -mno-compat-align-parm
21345 @opindex mcompat-align-parm
21346 Generate (do not generate) code to pass structure parameters with a
21347 maximum alignment of 64 bits, for compatibility with older versions
21350 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
21351 structure parameter on a 128-bit boundary when that structure contained
21352 a member requiring 128-bit alignment. This is corrected in more
21353 recent versions of GCC. This option may be used to generate code
21354 that is compatible with functions compiled with older versions of
21357 The @option{-mno-compat-align-parm} option is the default.
21361 @subsection RX Options
21364 These command-line options are defined for RX targets:
21367 @item -m64bit-doubles
21368 @itemx -m32bit-doubles
21369 @opindex m64bit-doubles
21370 @opindex m32bit-doubles
21371 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
21372 or 32 bits (@option{-m32bit-doubles}) in size. The default is
21373 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
21374 works on 32-bit values, which is why the default is
21375 @option{-m32bit-doubles}.
21381 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
21382 floating-point hardware. The default is enabled for the RX600
21383 series and disabled for the RX200 series.
21385 Floating-point instructions are only generated for 32-bit floating-point
21386 values, however, so the FPU hardware is not used for doubles if the
21387 @option{-m64bit-doubles} option is used.
21389 @emph{Note} If the @option{-fpu} option is enabled then
21390 @option{-funsafe-math-optimizations} is also enabled automatically.
21391 This is because the RX FPU instructions are themselves unsafe.
21393 @item -mcpu=@var{name}
21395 Selects the type of RX CPU to be targeted. Currently three types are
21396 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
21397 the specific @samp{RX610} CPU. The default is @samp{RX600}.
21399 The only difference between @samp{RX600} and @samp{RX610} is that the
21400 @samp{RX610} does not support the @code{MVTIPL} instruction.
21402 The @samp{RX200} series does not have a hardware floating-point unit
21403 and so @option{-nofpu} is enabled by default when this type is
21406 @item -mbig-endian-data
21407 @itemx -mlittle-endian-data
21408 @opindex mbig-endian-data
21409 @opindex mlittle-endian-data
21410 Store data (but not code) in the big-endian format. The default is
21411 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
21414 @item -msmall-data-limit=@var{N}
21415 @opindex msmall-data-limit
21416 Specifies the maximum size in bytes of global and static variables
21417 which can be placed into the small data area. Using the small data
21418 area can lead to smaller and faster code, but the size of area is
21419 limited and it is up to the programmer to ensure that the area does
21420 not overflow. Also when the small data area is used one of the RX's
21421 registers (usually @code{r13}) is reserved for use pointing to this
21422 area, so it is no longer available for use by the compiler. This
21423 could result in slower and/or larger code if variables are pushed onto
21424 the stack instead of being held in this register.
21426 Note, common variables (variables that have not been initialized) and
21427 constants are not placed into the small data area as they are assigned
21428 to other sections in the output executable.
21430 The default value is zero, which disables this feature. Note, this
21431 feature is not enabled by default with higher optimization levels
21432 (@option{-O2} etc) because of the potentially detrimental effects of
21433 reserving a register. It is up to the programmer to experiment and
21434 discover whether this feature is of benefit to their program. See the
21435 description of the @option{-mpid} option for a description of how the
21436 actual register to hold the small data area pointer is chosen.
21442 Use the simulator runtime. The default is to use the libgloss
21443 board-specific runtime.
21445 @item -mas100-syntax
21446 @itemx -mno-as100-syntax
21447 @opindex mas100-syntax
21448 @opindex mno-as100-syntax
21449 When generating assembler output use a syntax that is compatible with
21450 Renesas's AS100 assembler. This syntax can also be handled by the GAS
21451 assembler, but it has some restrictions so it is not generated by default.
21453 @item -mmax-constant-size=@var{N}
21454 @opindex mmax-constant-size
21455 Specifies the maximum size, in bytes, of a constant that can be used as
21456 an operand in a RX instruction. Although the RX instruction set does
21457 allow constants of up to 4 bytes in length to be used in instructions,
21458 a longer value equates to a longer instruction. Thus in some
21459 circumstances it can be beneficial to restrict the size of constants
21460 that are used in instructions. Constants that are too big are instead
21461 placed into a constant pool and referenced via register indirection.
21463 The value @var{N} can be between 0 and 4. A value of 0 (the default)
21464 or 4 means that constants of any size are allowed.
21468 Enable linker relaxation. Linker relaxation is a process whereby the
21469 linker attempts to reduce the size of a program by finding shorter
21470 versions of various instructions. Disabled by default.
21472 @item -mint-register=@var{N}
21473 @opindex mint-register
21474 Specify the number of registers to reserve for fast interrupt handler
21475 functions. The value @var{N} can be between 0 and 4. A value of 1
21476 means that register @code{r13} is reserved for the exclusive use
21477 of fast interrupt handlers. A value of 2 reserves @code{r13} and
21478 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
21479 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
21480 A value of 0, the default, does not reserve any registers.
21482 @item -msave-acc-in-interrupts
21483 @opindex msave-acc-in-interrupts
21484 Specifies that interrupt handler functions should preserve the
21485 accumulator register. This is only necessary if normal code might use
21486 the accumulator register, for example because it performs 64-bit
21487 multiplications. The default is to ignore the accumulator as this
21488 makes the interrupt handlers faster.
21494 Enables the generation of position independent data. When enabled any
21495 access to constant data is done via an offset from a base address
21496 held in a register. This allows the location of constant data to be
21497 determined at run time without requiring the executable to be
21498 relocated, which is a benefit to embedded applications with tight
21499 memory constraints. Data that can be modified is not affected by this
21502 Note, using this feature reserves a register, usually @code{r13}, for
21503 the constant data base address. This can result in slower and/or
21504 larger code, especially in complicated functions.
21506 The actual register chosen to hold the constant data base address
21507 depends upon whether the @option{-msmall-data-limit} and/or the
21508 @option{-mint-register} command-line options are enabled. Starting
21509 with register @code{r13} and proceeding downwards, registers are
21510 allocated first to satisfy the requirements of @option{-mint-register},
21511 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
21512 is possible for the small data area register to be @code{r8} if both
21513 @option{-mint-register=4} and @option{-mpid} are specified on the
21516 By default this feature is not enabled. The default can be restored
21517 via the @option{-mno-pid} command-line option.
21519 @item -mno-warn-multiple-fast-interrupts
21520 @itemx -mwarn-multiple-fast-interrupts
21521 @opindex mno-warn-multiple-fast-interrupts
21522 @opindex mwarn-multiple-fast-interrupts
21523 Prevents GCC from issuing a warning message if it finds more than one
21524 fast interrupt handler when it is compiling a file. The default is to
21525 issue a warning for each extra fast interrupt handler found, as the RX
21526 only supports one such interrupt.
21528 @item -mallow-string-insns
21529 @itemx -mno-allow-string-insns
21530 @opindex mallow-string-insns
21531 @opindex mno-allow-string-insns
21532 Enables or disables the use of the string manipulation instructions
21533 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
21534 @code{SWHILE} and also the @code{RMPA} instruction. These
21535 instructions may prefetch data, which is not safe to do if accessing
21536 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
21537 for more information).
21539 The default is to allow these instructions, but it is not possible for
21540 GCC to reliably detect all circumstances where a string instruction
21541 might be used to access an I/O register, so their use cannot be
21542 disabled automatically. Instead it is reliant upon the programmer to
21543 use the @option{-mno-allow-string-insns} option if their program
21544 accesses I/O space.
21546 When the instructions are enabled GCC defines the C preprocessor
21547 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
21548 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
21554 Use only (or not only) @code{JSR} instructions to access functions.
21555 This option can be used when code size exceeds the range of @code{BSR}
21556 instructions. Note that @option{-mno-jsr} does not mean to not use
21557 @code{JSR} but instead means that any type of branch may be used.
21560 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
21561 has special significance to the RX port when used with the
21562 @code{interrupt} function attribute. This attribute indicates a
21563 function intended to process fast interrupts. GCC ensures
21564 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
21565 and/or @code{r13} and only provided that the normal use of the
21566 corresponding registers have been restricted via the
21567 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
21570 @node S/390 and zSeries Options
21571 @subsection S/390 and zSeries Options
21572 @cindex S/390 and zSeries Options
21574 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
21578 @itemx -msoft-float
21579 @opindex mhard-float
21580 @opindex msoft-float
21581 Use (do not use) the hardware floating-point instructions and registers
21582 for floating-point operations. When @option{-msoft-float} is specified,
21583 functions in @file{libgcc.a} are used to perform floating-point
21584 operations. When @option{-mhard-float} is specified, the compiler
21585 generates IEEE floating-point instructions. This is the default.
21588 @itemx -mno-hard-dfp
21590 @opindex mno-hard-dfp
21591 Use (do not use) the hardware decimal-floating-point instructions for
21592 decimal-floating-point operations. When @option{-mno-hard-dfp} is
21593 specified, functions in @file{libgcc.a} are used to perform
21594 decimal-floating-point operations. When @option{-mhard-dfp} is
21595 specified, the compiler generates decimal-floating-point hardware
21596 instructions. This is the default for @option{-march=z9-ec} or higher.
21598 @item -mlong-double-64
21599 @itemx -mlong-double-128
21600 @opindex mlong-double-64
21601 @opindex mlong-double-128
21602 These switches control the size of @code{long double} type. A size
21603 of 64 bits makes the @code{long double} type equivalent to the @code{double}
21604 type. This is the default.
21607 @itemx -mno-backchain
21608 @opindex mbackchain
21609 @opindex mno-backchain
21610 Store (do not store) the address of the caller's frame as backchain pointer
21611 into the callee's stack frame.
21612 A backchain may be needed to allow debugging using tools that do not understand
21613 DWARF call frame information.
21614 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
21615 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
21616 the backchain is placed into the topmost word of the 96/160 byte register
21619 In general, code compiled with @option{-mbackchain} is call-compatible with
21620 code compiled with @option{-mmo-backchain}; however, use of the backchain
21621 for debugging purposes usually requires that the whole binary is built with
21622 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
21623 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21624 to build a linux kernel use @option{-msoft-float}.
21626 The default is to not maintain the backchain.
21628 @item -mpacked-stack
21629 @itemx -mno-packed-stack
21630 @opindex mpacked-stack
21631 @opindex mno-packed-stack
21632 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
21633 specified, the compiler uses the all fields of the 96/160 byte register save
21634 area only for their default purpose; unused fields still take up stack space.
21635 When @option{-mpacked-stack} is specified, register save slots are densely
21636 packed at the top of the register save area; unused space is reused for other
21637 purposes, allowing for more efficient use of the available stack space.
21638 However, when @option{-mbackchain} is also in effect, the topmost word of
21639 the save area is always used to store the backchain, and the return address
21640 register is always saved two words below the backchain.
21642 As long as the stack frame backchain is not used, code generated with
21643 @option{-mpacked-stack} is call-compatible with code generated with
21644 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
21645 S/390 or zSeries generated code that uses the stack frame backchain at run
21646 time, not just for debugging purposes. Such code is not call-compatible
21647 with code compiled with @option{-mpacked-stack}. Also, note that the
21648 combination of @option{-mbackchain},
21649 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21650 to build a linux kernel use @option{-msoft-float}.
21652 The default is to not use the packed stack layout.
21655 @itemx -mno-small-exec
21656 @opindex msmall-exec
21657 @opindex mno-small-exec
21658 Generate (or do not generate) code using the @code{bras} instruction
21659 to do subroutine calls.
21660 This only works reliably if the total executable size does not
21661 exceed 64k. The default is to use the @code{basr} instruction instead,
21662 which does not have this limitation.
21668 When @option{-m31} is specified, generate code compliant to the
21669 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
21670 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
21671 particular to generate 64-bit instructions. For the @samp{s390}
21672 targets, the default is @option{-m31}, while the @samp{s390x}
21673 targets default to @option{-m64}.
21679 When @option{-mzarch} is specified, generate code using the
21680 instructions available on z/Architecture.
21681 When @option{-mesa} is specified, generate code using the
21682 instructions available on ESA/390. Note that @option{-mesa} is
21683 not possible with @option{-m64}.
21684 When generating code compliant to the GNU/Linux for S/390 ABI,
21685 the default is @option{-mesa}. When generating code compliant
21686 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
21692 The @option{-mhtm} option enables a set of builtins making use of
21693 instructions available with the transactional execution facility
21694 introduced with the IBM zEnterprise EC12 machine generation
21695 @ref{S/390 System z Built-in Functions}.
21696 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
21702 When @option{-mvx} is specified, generate code using the instructions
21703 available with the vector extension facility introduced with the IBM
21704 z13 machine generation.
21705 This option changes the ABI for some vector type values with regard to
21706 alignment and calling conventions. In case vector type values are
21707 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
21708 command will be added to mark the resulting binary with the ABI used.
21709 @option{-mvx} is enabled by default when using @option{-march=z13}.
21712 @itemx -mno-zvector
21714 @opindex mno-zvector
21715 The @option{-mzvector} option enables vector language extensions and
21716 builtins using instructions available with the vector extension
21717 facility introduced with the IBM z13 machine generation.
21718 This option adds support for @samp{vector} to be used as a keyword to
21719 define vector type variables and arguments. @samp{vector} is only
21720 available when GNU extensions are enabled. It will not be expanded
21721 when requesting strict standard compliance e.g. with @option{-std=c99}.
21722 In addition to the GCC low-level builtins @option{-mzvector} enables
21723 a set of builtins added for compatibility with AltiVec-style
21724 implementations like Power and Cell. In order to make use of these
21725 builtins the header file @file{vecintrin.h} needs to be included.
21726 @option{-mzvector} is disabled by default.
21732 Generate (or do not generate) code using the @code{mvcle} instruction
21733 to perform block moves. When @option{-mno-mvcle} is specified,
21734 use a @code{mvc} loop instead. This is the default unless optimizing for
21741 Print (or do not print) additional debug information when compiling.
21742 The default is to not print debug information.
21744 @item -march=@var{cpu-type}
21746 Generate code that runs on @var{cpu-type}, which is the name of a
21747 system representing a certain processor type. Possible values for
21748 @var{cpu-type} are @samp{z900}, @samp{z990}, @samp{z9-109},
21749 @samp{z9-ec}, @samp{z10}, @samp{z196}, @samp{zEC12}, and @samp{z13}.
21750 The default is @option{-march=z900}. @samp{g5} and @samp{g6} are
21751 deprecated and will be removed with future releases.
21753 @item -mtune=@var{cpu-type}
21755 Tune to @var{cpu-type} everything applicable about the generated code,
21756 except for the ABI and the set of available instructions.
21757 The list of @var{cpu-type} values is the same as for @option{-march}.
21758 The default is the value used for @option{-march}.
21761 @itemx -mno-tpf-trace
21762 @opindex mtpf-trace
21763 @opindex mno-tpf-trace
21764 Generate code that adds (does not add) in TPF OS specific branches to trace
21765 routines in the operating system. This option is off by default, even
21766 when compiling for the TPF OS@.
21769 @itemx -mno-fused-madd
21770 @opindex mfused-madd
21771 @opindex mno-fused-madd
21772 Generate code that uses (does not use) the floating-point multiply and
21773 accumulate instructions. These instructions are generated by default if
21774 hardware floating point is used.
21776 @item -mwarn-framesize=@var{framesize}
21777 @opindex mwarn-framesize
21778 Emit a warning if the current function exceeds the given frame size. Because
21779 this is a compile-time check it doesn't need to be a real problem when the program
21780 runs. It is intended to identify functions that most probably cause
21781 a stack overflow. It is useful to be used in an environment with limited stack
21782 size e.g.@: the linux kernel.
21784 @item -mwarn-dynamicstack
21785 @opindex mwarn-dynamicstack
21786 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
21787 arrays. This is generally a bad idea with a limited stack size.
21789 @item -mstack-guard=@var{stack-guard}
21790 @itemx -mstack-size=@var{stack-size}
21791 @opindex mstack-guard
21792 @opindex mstack-size
21793 If these options are provided the S/390 back end emits additional instructions in
21794 the function prologue that trigger a trap if the stack size is @var{stack-guard}
21795 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
21796 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
21797 the frame size of the compiled function is chosen.
21798 These options are intended to be used to help debugging stack overflow problems.
21799 The additionally emitted code causes only little overhead and hence can also be
21800 used in production-like systems without greater performance degradation. The given
21801 values have to be exact powers of 2 and @var{stack-size} has to be greater than
21802 @var{stack-guard} without exceeding 64k.
21803 In order to be efficient the extra code makes the assumption that the stack starts
21804 at an address aligned to the value given by @var{stack-size}.
21805 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
21807 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
21809 If the hotpatch option is enabled, a ``hot-patching'' function
21810 prologue is generated for all functions in the compilation unit.
21811 The funtion label is prepended with the given number of two-byte
21812 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
21813 the label, 2 * @var{post-halfwords} bytes are appended, using the
21814 largest NOP like instructions the architecture allows (maximum
21817 If both arguments are zero, hotpatching is disabled.
21819 This option can be overridden for individual functions with the
21820 @code{hotpatch} attribute.
21823 @node Score Options
21824 @subsection Score Options
21825 @cindex Score Options
21827 These options are defined for Score implementations:
21832 Compile code for big-endian mode. This is the default.
21836 Compile code for little-endian mode.
21840 Disable generation of @code{bcnz} instructions.
21844 Enable generation of unaligned load and store instructions.
21848 Enable the use of multiply-accumulate instructions. Disabled by default.
21852 Specify the SCORE5 as the target architecture.
21856 Specify the SCORE5U of the target architecture.
21860 Specify the SCORE7 as the target architecture. This is the default.
21864 Specify the SCORE7D as the target architecture.
21868 @subsection SH Options
21870 These @samp{-m} options are defined for the SH implementations:
21875 Generate code for the SH1.
21879 Generate code for the SH2.
21882 Generate code for the SH2e.
21886 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
21887 that the floating-point unit is not used.
21889 @item -m2a-single-only
21890 @opindex m2a-single-only
21891 Generate code for the SH2a-FPU, in such a way that no double-precision
21892 floating-point operations are used.
21895 @opindex m2a-single
21896 Generate code for the SH2a-FPU assuming the floating-point unit is in
21897 single-precision mode by default.
21901 Generate code for the SH2a-FPU assuming the floating-point unit is in
21902 double-precision mode by default.
21906 Generate code for the SH3.
21910 Generate code for the SH3e.
21914 Generate code for the SH4 without a floating-point unit.
21916 @item -m4-single-only
21917 @opindex m4-single-only
21918 Generate code for the SH4 with a floating-point unit that only
21919 supports single-precision arithmetic.
21923 Generate code for the SH4 assuming the floating-point unit is in
21924 single-precision mode by default.
21928 Generate code for the SH4.
21932 Generate code for SH4-100.
21934 @item -m4-100-nofpu
21935 @opindex m4-100-nofpu
21936 Generate code for SH4-100 in such a way that the
21937 floating-point unit is not used.
21939 @item -m4-100-single
21940 @opindex m4-100-single
21941 Generate code for SH4-100 assuming the floating-point unit is in
21942 single-precision mode by default.
21944 @item -m4-100-single-only
21945 @opindex m4-100-single-only
21946 Generate code for SH4-100 in such a way that no double-precision
21947 floating-point operations are used.
21951 Generate code for SH4-200.
21953 @item -m4-200-nofpu
21954 @opindex m4-200-nofpu
21955 Generate code for SH4-200 without in such a way that the
21956 floating-point unit is not used.
21958 @item -m4-200-single
21959 @opindex m4-200-single
21960 Generate code for SH4-200 assuming the floating-point unit is in
21961 single-precision mode by default.
21963 @item -m4-200-single-only
21964 @opindex m4-200-single-only
21965 Generate code for SH4-200 in such a way that no double-precision
21966 floating-point operations are used.
21970 Generate code for SH4-300.
21972 @item -m4-300-nofpu
21973 @opindex m4-300-nofpu
21974 Generate code for SH4-300 without in such a way that the
21975 floating-point unit is not used.
21977 @item -m4-300-single
21978 @opindex m4-300-single
21979 Generate code for SH4-300 in such a way that no double-precision
21980 floating-point operations are used.
21982 @item -m4-300-single-only
21983 @opindex m4-300-single-only
21984 Generate code for SH4-300 in such a way that no double-precision
21985 floating-point operations are used.
21989 Generate code for SH4-340 (no MMU, no FPU).
21993 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
21998 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
21999 floating-point unit is not used.
22001 @item -m4a-single-only
22002 @opindex m4a-single-only
22003 Generate code for the SH4a, in such a way that no double-precision
22004 floating-point operations are used.
22007 @opindex m4a-single
22008 Generate code for the SH4a assuming the floating-point unit is in
22009 single-precision mode by default.
22013 Generate code for the SH4a.
22017 Same as @option{-m4a-nofpu}, except that it implicitly passes
22018 @option{-dsp} to the assembler. GCC doesn't generate any DSP
22019 instructions at the moment.
22023 Compile code for the processor in big-endian mode.
22027 Compile code for the processor in little-endian mode.
22031 Align doubles at 64-bit boundaries. Note that this changes the calling
22032 conventions, and thus some functions from the standard C library do
22033 not work unless you recompile it first with @option{-mdalign}.
22037 Shorten some address references at link time, when possible; uses the
22038 linker option @option{-relax}.
22042 Use 32-bit offsets in @code{switch} tables. The default is to use
22047 Enable the use of bit manipulation instructions on SH2A.
22051 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
22052 alignment constraints.
22056 Comply with the calling conventions defined by Renesas.
22059 @opindex mno-renesas
22060 Comply with the calling conventions defined for GCC before the Renesas
22061 conventions were available. This option is the default for all
22062 targets of the SH toolchain.
22065 @opindex mnomacsave
22066 Mark the @code{MAC} register as call-clobbered, even if
22067 @option{-mrenesas} is given.
22073 Control the IEEE compliance of floating-point comparisons, which affects the
22074 handling of cases where the result of a comparison is unordered. By default
22075 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
22076 enabled @option{-mno-ieee} is implicitly set, which results in faster
22077 floating-point greater-equal and less-equal comparisons. The implicit settings
22078 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
22080 @item -minline-ic_invalidate
22081 @opindex minline-ic_invalidate
22082 Inline code to invalidate instruction cache entries after setting up
22083 nested function trampolines.
22084 This option has no effect if @option{-musermode} is in effect and the selected
22085 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
22087 If the selected code generation option does not allow the use of the @code{icbi}
22088 instruction, and @option{-musermode} is not in effect, the inlined code
22089 manipulates the instruction cache address array directly with an associative
22090 write. This not only requires privileged mode at run time, but it also
22091 fails if the cache line had been mapped via the TLB and has become unmapped.
22095 Dump instruction size and location in the assembly code.
22098 @opindex mpadstruct
22099 This option is deprecated. It pads structures to multiple of 4 bytes,
22100 which is incompatible with the SH ABI@.
22102 @item -matomic-model=@var{model}
22103 @opindex matomic-model=@var{model}
22104 Sets the model of atomic operations and additional parameters as a comma
22105 separated list. For details on the atomic built-in functions see
22106 @ref{__atomic Builtins}. The following models and parameters are supported:
22111 Disable compiler generated atomic sequences and emit library calls for atomic
22112 operations. This is the default if the target is not @code{sh*-*-linux*}.
22115 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
22116 built-in functions. The generated atomic sequences require additional support
22117 from the interrupt/exception handling code of the system and are only suitable
22118 for SH3* and SH4* single-core systems. This option is enabled by default when
22119 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
22120 this option also partially utilizes the hardware atomic instructions
22121 @code{movli.l} and @code{movco.l} to create more efficient code, unless
22122 @samp{strict} is specified.
22125 Generate software atomic sequences that use a variable in the thread control
22126 block. This is a variation of the gUSA sequences which can also be used on
22127 SH1* and SH2* targets. The generated atomic sequences require additional
22128 support from the interrupt/exception handling code of the system and are only
22129 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
22130 parameter has to be specified as well.
22133 Generate software atomic sequences that temporarily disable interrupts by
22134 setting @code{SR.IMASK = 1111}. This model works only when the program runs
22135 in privileged mode and is only suitable for single-core systems. Additional
22136 support from the interrupt/exception handling code of the system is not
22137 required. This model is enabled by default when the target is
22138 @code{sh*-*-linux*} and SH1* or SH2*.
22141 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
22142 instructions only. This is only available on SH4A and is suitable for
22143 multi-core systems. Since the hardware instructions support only 32 bit atomic
22144 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
22145 Code compiled with this option is also compatible with other software
22146 atomic model interrupt/exception handling systems if executed on an SH4A
22147 system. Additional support from the interrupt/exception handling code of the
22148 system is not required for this model.
22151 This parameter specifies the offset in bytes of the variable in the thread
22152 control block structure that should be used by the generated atomic sequences
22153 when the @samp{soft-tcb} model has been selected. For other models this
22154 parameter is ignored. The specified value must be an integer multiple of four
22155 and in the range 0-1020.
22158 This parameter prevents mixed usage of multiple atomic models, even if they
22159 are compatible, and makes the compiler generate atomic sequences of the
22160 specified model only.
22166 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
22167 Notice that depending on the particular hardware and software configuration
22168 this can degrade overall performance due to the operand cache line flushes
22169 that are implied by the @code{tas.b} instruction. On multi-core SH4A
22170 processors the @code{tas.b} instruction must be used with caution since it
22171 can result in data corruption for certain cache configurations.
22174 @opindex mprefergot
22175 When generating position-independent code, emit function calls using
22176 the Global Offset Table instead of the Procedure Linkage Table.
22179 @itemx -mno-usermode
22181 @opindex mno-usermode
22182 Don't allow (allow) the compiler generating privileged mode code. Specifying
22183 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
22184 inlined code would not work in user mode. @option{-musermode} is the default
22185 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
22186 @option{-musermode} has no effect, since there is no user mode.
22188 @item -multcost=@var{number}
22189 @opindex multcost=@var{number}
22190 Set the cost to assume for a multiply insn.
22192 @item -mdiv=@var{strategy}
22193 @opindex mdiv=@var{strategy}
22194 Set the division strategy to be used for integer division operations.
22195 @var{strategy} can be one of:
22200 Calls a library function that uses the single-step division instruction
22201 @code{div1} to perform the operation. Division by zero calculates an
22202 unspecified result and does not trap. This is the default except for SH4,
22203 SH2A and SHcompact.
22206 Calls a library function that performs the operation in double precision
22207 floating point. Division by zero causes a floating-point exception. This is
22208 the default for SHcompact with FPU. Specifying this for targets that do not
22209 have a double precision FPU defaults to @code{call-div1}.
22212 Calls a library function that uses a lookup table for small divisors and
22213 the @code{div1} instruction with case distinction for larger divisors. Division
22214 by zero calculates an unspecified result and does not trap. This is the default
22215 for SH4. Specifying this for targets that do not have dynamic shift
22216 instructions defaults to @code{call-div1}.
22220 When a division strategy has not been specified the default strategy is
22221 selected based on the current target. For SH2A the default strategy is to
22222 use the @code{divs} and @code{divu} instructions instead of library function
22225 @item -maccumulate-outgoing-args
22226 @opindex maccumulate-outgoing-args
22227 Reserve space once for outgoing arguments in the function prologue rather
22228 than around each call. Generally beneficial for performance and size. Also
22229 needed for unwinding to avoid changing the stack frame around conditional code.
22231 @item -mdivsi3_libfunc=@var{name}
22232 @opindex mdivsi3_libfunc=@var{name}
22233 Set the name of the library function used for 32-bit signed division to
22235 This only affects the name used in the @samp{call} division strategies, and
22236 the compiler still expects the same sets of input/output/clobbered registers as
22237 if this option were not present.
22239 @item -mfixed-range=@var{register-range}
22240 @opindex mfixed-range
22241 Generate code treating the given register range as fixed registers.
22242 A fixed register is one that the register allocator can not use. This is
22243 useful when compiling kernel code. A register range is specified as
22244 two registers separated by a dash. Multiple register ranges can be
22245 specified separated by a comma.
22247 @item -mbranch-cost=@var{num}
22248 @opindex mbranch-cost=@var{num}
22249 Assume @var{num} to be the cost for a branch instruction. Higher numbers
22250 make the compiler try to generate more branch-free code if possible.
22251 If not specified the value is selected depending on the processor type that
22252 is being compiled for.
22255 @itemx -mno-zdcbranch
22256 @opindex mzdcbranch
22257 @opindex mno-zdcbranch
22258 Assume (do not assume) that zero displacement conditional branch instructions
22259 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
22260 compiler prefers zero displacement branch code sequences. This is
22261 enabled by default when generating code for SH4 and SH4A. It can be explicitly
22262 disabled by specifying @option{-mno-zdcbranch}.
22264 @item -mcbranch-force-delay-slot
22265 @opindex mcbranch-force-delay-slot
22266 Force the usage of delay slots for conditional branches, which stuffs the delay
22267 slot with a @code{nop} if a suitable instruction can't be found. By default
22268 this option is disabled. It can be enabled to work around hardware bugs as
22269 found in the original SH7055.
22272 @itemx -mno-fused-madd
22273 @opindex mfused-madd
22274 @opindex mno-fused-madd
22275 Generate code that uses (does not use) the floating-point multiply and
22276 accumulate instructions. These instructions are generated by default
22277 if hardware floating point is used. The machine-dependent
22278 @option{-mfused-madd} option is now mapped to the machine-independent
22279 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22280 mapped to @option{-ffp-contract=off}.
22286 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
22287 and cosine approximations. The option @option{-mfsca} must be used in
22288 combination with @option{-funsafe-math-optimizations}. It is enabled by default
22289 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
22290 approximations even if @option{-funsafe-math-optimizations} is in effect.
22296 Allow or disallow the compiler to emit the @code{fsrra} instruction for
22297 reciprocal square root approximations. The option @option{-mfsrra} must be used
22298 in combination with @option{-funsafe-math-optimizations} and
22299 @option{-ffinite-math-only}. It is enabled by default when generating code for
22300 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
22301 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
22304 @item -mpretend-cmove
22305 @opindex mpretend-cmove
22306 Prefer zero-displacement conditional branches for conditional move instruction
22307 patterns. This can result in faster code on the SH4 processor.
22311 Generate code using the FDPIC ABI.
22315 @node Solaris 2 Options
22316 @subsection Solaris 2 Options
22317 @cindex Solaris 2 options
22319 These @samp{-m} options are supported on Solaris 2:
22322 @item -mclear-hwcap
22323 @opindex mclear-hwcap
22324 @option{-mclear-hwcap} tells the compiler to remove the hardware
22325 capabilities generated by the Solaris assembler. This is only necessary
22326 when object files use ISA extensions not supported by the current
22327 machine, but check at runtime whether or not to use them.
22329 @item -mimpure-text
22330 @opindex mimpure-text
22331 @option{-mimpure-text}, used in addition to @option{-shared}, tells
22332 the compiler to not pass @option{-z text} to the linker when linking a
22333 shared object. Using this option, you can link position-dependent
22334 code into a shared object.
22336 @option{-mimpure-text} suppresses the ``relocations remain against
22337 allocatable but non-writable sections'' linker error message.
22338 However, the necessary relocations trigger copy-on-write, and the
22339 shared object is not actually shared across processes. Instead of
22340 using @option{-mimpure-text}, you should compile all source code with
22341 @option{-fpic} or @option{-fPIC}.
22345 These switches are supported in addition to the above on Solaris 2:
22350 Add support for multithreading using the POSIX threads library. This
22351 option sets flags for both the preprocessor and linker. This option does
22352 not affect the thread safety of object code produced by the compiler or
22353 that of libraries supplied with it.
22357 This is a synonym for @option{-pthreads}.
22360 @node SPARC Options
22361 @subsection SPARC Options
22362 @cindex SPARC options
22364 These @samp{-m} options are supported on the SPARC:
22367 @item -mno-app-regs
22369 @opindex mno-app-regs
22371 Specify @option{-mapp-regs} to generate output using the global registers
22372 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
22373 global register 1, each global register 2 through 4 is then treated as an
22374 allocable register that is clobbered by function calls. This is the default.
22376 To be fully SVR4 ABI-compliant at the cost of some performance loss,
22377 specify @option{-mno-app-regs}. You should compile libraries and system
22378 software with this option.
22384 With @option{-mflat}, the compiler does not generate save/restore instructions
22385 and uses a ``flat'' or single register window model. This model is compatible
22386 with the regular register window model. The local registers and the input
22387 registers (0--5) are still treated as ``call-saved'' registers and are
22388 saved on the stack as needed.
22390 With @option{-mno-flat} (the default), the compiler generates save/restore
22391 instructions (except for leaf functions). This is the normal operating mode.
22394 @itemx -mhard-float
22396 @opindex mhard-float
22397 Generate output containing floating-point instructions. This is the
22401 @itemx -msoft-float
22403 @opindex msoft-float
22404 Generate output containing library calls for floating point.
22405 @strong{Warning:} the requisite libraries are not available for all SPARC
22406 targets. Normally the facilities of the machine's usual C compiler are
22407 used, but this cannot be done directly in cross-compilation. You must make
22408 your own arrangements to provide suitable library functions for
22409 cross-compilation. The embedded targets @samp{sparc-*-aout} and
22410 @samp{sparclite-*-*} do provide software floating-point support.
22412 @option{-msoft-float} changes the calling convention in the output file;
22413 therefore, it is only useful if you compile @emph{all} of a program with
22414 this option. In particular, you need to compile @file{libgcc.a}, the
22415 library that comes with GCC, with @option{-msoft-float} in order for
22418 @item -mhard-quad-float
22419 @opindex mhard-quad-float
22420 Generate output containing quad-word (long double) floating-point
22423 @item -msoft-quad-float
22424 @opindex msoft-quad-float
22425 Generate output containing library calls for quad-word (long double)
22426 floating-point instructions. The functions called are those specified
22427 in the SPARC ABI@. This is the default.
22429 As of this writing, there are no SPARC implementations that have hardware
22430 support for the quad-word floating-point instructions. They all invoke
22431 a trap handler for one of these instructions, and then the trap handler
22432 emulates the effect of the instruction. Because of the trap handler overhead,
22433 this is much slower than calling the ABI library routines. Thus the
22434 @option{-msoft-quad-float} option is the default.
22436 @item -mno-unaligned-doubles
22437 @itemx -munaligned-doubles
22438 @opindex mno-unaligned-doubles
22439 @opindex munaligned-doubles
22440 Assume that doubles have 8-byte alignment. This is the default.
22442 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
22443 alignment only if they are contained in another type, or if they have an
22444 absolute address. Otherwise, it assumes they have 4-byte alignment.
22445 Specifying this option avoids some rare compatibility problems with code
22446 generated by other compilers. It is not the default because it results
22447 in a performance loss, especially for floating-point code.
22450 @itemx -mno-user-mode
22451 @opindex muser-mode
22452 @opindex mno-user-mode
22453 Do not generate code that can only run in supervisor mode. This is relevant
22454 only for the @code{casa} instruction emitted for the LEON3 processor. This
22457 @item -mfaster-structs
22458 @itemx -mno-faster-structs
22459 @opindex mfaster-structs
22460 @opindex mno-faster-structs
22461 With @option{-mfaster-structs}, the compiler assumes that structures
22462 should have 8-byte alignment. This enables the use of pairs of
22463 @code{ldd} and @code{std} instructions for copies in structure
22464 assignment, in place of twice as many @code{ld} and @code{st} pairs.
22465 However, the use of this changed alignment directly violates the SPARC
22466 ABI@. Thus, it's intended only for use on targets where the developer
22467 acknowledges that their resulting code is not directly in line with
22468 the rules of the ABI@.
22470 @item -mstd-struct-return
22471 @itemx -mno-std-struct-return
22472 @opindex mstd-struct-return
22473 @opindex mno-std-struct-return
22474 With @option{-mstd-struct-return}, the compiler generates checking code
22475 in functions returning structures or unions to detect size mismatches
22476 between the two sides of function calls, as per the 32-bit ABI@.
22478 The default is @option{-mno-std-struct-return}. This option has no effect
22481 @item -mcpu=@var{cpu_type}
22483 Set the instruction set, register set, and instruction scheduling parameters
22484 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22485 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
22486 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
22487 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
22488 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
22489 @samp{niagara3}, @samp{niagara4} and @samp{niagara7}.
22491 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
22492 which selects the best architecture option for the host processor.
22493 @option{-mcpu=native} has no effect if GCC does not recognize
22496 Default instruction scheduling parameters are used for values that select
22497 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
22498 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
22500 Here is a list of each supported architecture and their supported
22508 supersparc, hypersparc, leon, leon3
22511 f930, f934, sparclite86x
22517 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7
22520 By default (unless configured otherwise), GCC generates code for the V7
22521 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
22522 additionally optimizes it for the Cypress CY7C602 chip, as used in the
22523 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
22524 SPARCStation 1, 2, IPX etc.
22526 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
22527 architecture. The only difference from V7 code is that the compiler emits
22528 the integer multiply and integer divide instructions which exist in SPARC-V8
22529 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
22530 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
22533 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
22534 the SPARC architecture. This adds the integer multiply, integer divide step
22535 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
22536 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
22537 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
22538 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
22539 MB86934 chip, which is the more recent SPARClite with FPU@.
22541 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
22542 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
22543 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
22544 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
22545 optimizes it for the TEMIC SPARClet chip.
22547 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
22548 architecture. This adds 64-bit integer and floating-point move instructions,
22549 3 additional floating-point condition code registers and conditional move
22550 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
22551 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
22552 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
22553 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
22554 @option{-mcpu=niagara}, the compiler additionally optimizes it for
22555 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
22556 additionally optimizes it for Sun UltraSPARC T2 chips. With
22557 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
22558 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
22559 additionally optimizes it for Sun UltraSPARC T4 chips. With
22560 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
22561 Oracle SPARC M7 chips.
22563 @item -mtune=@var{cpu_type}
22565 Set the instruction scheduling parameters for machine type
22566 @var{cpu_type}, but do not set the instruction set or register set that the
22567 option @option{-mcpu=@var{cpu_type}} does.
22569 The same values for @option{-mcpu=@var{cpu_type}} can be used for
22570 @option{-mtune=@var{cpu_type}}, but the only useful values are those
22571 that select a particular CPU implementation. Those are
22572 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
22573 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
22574 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
22575 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
22576 @samp{niagara4} and @samp{niagara7}. With native Solaris and
22577 GNU/Linux toolchains, @samp{native} can also be used.
22582 @opindex mno-v8plus
22583 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
22584 difference from the V8 ABI is that the global and out registers are
22585 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
22586 mode for all SPARC-V9 processors.
22592 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
22593 Visual Instruction Set extensions. The default is @option{-mno-vis}.
22599 With @option{-mvis2}, GCC generates code that takes advantage of
22600 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
22601 default is @option{-mvis2} when targeting a cpu that supports such
22602 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
22603 also sets @option{-mvis}.
22609 With @option{-mvis3}, GCC generates code that takes advantage of
22610 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
22611 default is @option{-mvis3} when targeting a cpu that supports such
22612 instructions, such as niagara-3 and later. Setting @option{-mvis3}
22613 also sets @option{-mvis2} and @option{-mvis}.
22619 With @option{-mvis4}, GCC generates code that takes advantage of
22620 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
22621 default is @option{-mvis4} when targeting a cpu that supports such
22622 instructions, such as niagara-7 and later. Setting @option{-mvis4}
22623 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
22628 @opindex mno-cbcond
22629 With @option{-mcbcond}, GCC generates code that takes advantage of
22630 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
22631 The default is @option{-mcbcond} when targeting a cpu that supports such
22632 instructions, such as niagara-4 and later.
22638 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
22639 population count instruction. The default is @option{-mpopc}
22640 when targeting a cpu that supports such instructions, such as Niagara-2 and
22647 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
22648 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
22649 when targeting a cpu that supports such instructions, such as Niagara-3 and
22653 @opindex mfix-at697f
22654 Enable the documented workaround for the single erratum of the Atmel AT697F
22655 processor (which corresponds to erratum #13 of the AT697E processor).
22658 @opindex mfix-ut699
22659 Enable the documented workarounds for the floating-point errata and the data
22660 cache nullify errata of the UT699 processor.
22663 These @samp{-m} options are supported in addition to the above
22664 on SPARC-V9 processors in 64-bit environments:
22671 Generate code for a 32-bit or 64-bit environment.
22672 The 32-bit environment sets int, long and pointer to 32 bits.
22673 The 64-bit environment sets int to 32 bits and long and pointer
22676 @item -mcmodel=@var{which}
22678 Set the code model to one of
22682 The Medium/Low code model: 64-bit addresses, programs
22683 must be linked in the low 32 bits of memory. Programs can be statically
22684 or dynamically linked.
22687 The Medium/Middle code model: 64-bit addresses, programs
22688 must be linked in the low 44 bits of memory, the text and data segments must
22689 be less than 2GB in size and the data segment must be located within 2GB of
22693 The Medium/Anywhere code model: 64-bit addresses, programs
22694 may be linked anywhere in memory, the text and data segments must be less
22695 than 2GB in size and the data segment must be located within 2GB of the
22699 The Medium/Anywhere code model for embedded systems:
22700 64-bit addresses, the text and data segments must be less than 2GB in
22701 size, both starting anywhere in memory (determined at link time). The
22702 global register %g4 points to the base of the data segment. Programs
22703 are statically linked and PIC is not supported.
22706 @item -mmemory-model=@var{mem-model}
22707 @opindex mmemory-model
22708 Set the memory model in force on the processor to one of
22712 The default memory model for the processor and operating system.
22715 Relaxed Memory Order
22718 Partial Store Order
22724 Sequential Consistency
22727 These memory models are formally defined in Appendix D of the Sparc V9
22728 architecture manual, as set in the processor's @code{PSTATE.MM} field.
22731 @itemx -mno-stack-bias
22732 @opindex mstack-bias
22733 @opindex mno-stack-bias
22734 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
22735 frame pointer if present, are offset by @minus{}2047 which must be added back
22736 when making stack frame references. This is the default in 64-bit mode.
22737 Otherwise, assume no such offset is present.
22741 @subsection SPU Options
22742 @cindex SPU options
22744 These @samp{-m} options are supported on the SPU:
22748 @itemx -merror-reloc
22749 @opindex mwarn-reloc
22750 @opindex merror-reloc
22752 The loader for SPU does not handle dynamic relocations. By default, GCC
22753 gives an error when it generates code that requires a dynamic
22754 relocation. @option{-mno-error-reloc} disables the error,
22755 @option{-mwarn-reloc} generates a warning instead.
22758 @itemx -munsafe-dma
22760 @opindex munsafe-dma
22762 Instructions that initiate or test completion of DMA must not be
22763 reordered with respect to loads and stores of the memory that is being
22765 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
22766 memory accesses, but that can lead to inefficient code in places where the
22767 memory is known to not change. Rather than mark the memory as volatile,
22768 you can use @option{-msafe-dma} to tell the compiler to treat
22769 the DMA instructions as potentially affecting all memory.
22771 @item -mbranch-hints
22772 @opindex mbranch-hints
22774 By default, GCC generates a branch hint instruction to avoid
22775 pipeline stalls for always-taken or probably-taken branches. A hint
22776 is not generated closer than 8 instructions away from its branch.
22777 There is little reason to disable them, except for debugging purposes,
22778 or to make an object a little bit smaller.
22782 @opindex msmall-mem
22783 @opindex mlarge-mem
22785 By default, GCC generates code assuming that addresses are never larger
22786 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
22787 a full 32-bit address.
22792 By default, GCC links against startup code that assumes the SPU-style
22793 main function interface (which has an unconventional parameter list).
22794 With @option{-mstdmain}, GCC links your program against startup
22795 code that assumes a C99-style interface to @code{main}, including a
22796 local copy of @code{argv} strings.
22798 @item -mfixed-range=@var{register-range}
22799 @opindex mfixed-range
22800 Generate code treating the given register range as fixed registers.
22801 A fixed register is one that the register allocator cannot use. This is
22802 useful when compiling kernel code. A register range is specified as
22803 two registers separated by a dash. Multiple register ranges can be
22804 specified separated by a comma.
22810 Compile code assuming that pointers to the PPU address space accessed
22811 via the @code{__ea} named address space qualifier are either 32 or 64
22812 bits wide. The default is 32 bits. As this is an ABI-changing option,
22813 all object code in an executable must be compiled with the same setting.
22815 @item -maddress-space-conversion
22816 @itemx -mno-address-space-conversion
22817 @opindex maddress-space-conversion
22818 @opindex mno-address-space-conversion
22819 Allow/disallow treating the @code{__ea} address space as superset
22820 of the generic address space. This enables explicit type casts
22821 between @code{__ea} and generic pointer as well as implicit
22822 conversions of generic pointers to @code{__ea} pointers. The
22823 default is to allow address space pointer conversions.
22825 @item -mcache-size=@var{cache-size}
22826 @opindex mcache-size
22827 This option controls the version of libgcc that the compiler links to an
22828 executable and selects a software-managed cache for accessing variables
22829 in the @code{__ea} address space with a particular cache size. Possible
22830 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
22831 and @samp{128}. The default cache size is 64KB.
22833 @item -matomic-updates
22834 @itemx -mno-atomic-updates
22835 @opindex matomic-updates
22836 @opindex mno-atomic-updates
22837 This option controls the version of libgcc that the compiler links to an
22838 executable and selects whether atomic updates to the software-managed
22839 cache of PPU-side variables are used. If you use atomic updates, changes
22840 to a PPU variable from SPU code using the @code{__ea} named address space
22841 qualifier do not interfere with changes to other PPU variables residing
22842 in the same cache line from PPU code. If you do not use atomic updates,
22843 such interference may occur; however, writing back cache lines is
22844 more efficient. The default behavior is to use atomic updates.
22847 @itemx -mdual-nops=@var{n}
22848 @opindex mdual-nops
22849 By default, GCC inserts nops to increase dual issue when it expects
22850 it to increase performance. @var{n} can be a value from 0 to 10. A
22851 smaller @var{n} inserts fewer nops. 10 is the default, 0 is the
22852 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
22854 @item -mhint-max-nops=@var{n}
22855 @opindex mhint-max-nops
22856 Maximum number of nops to insert for a branch hint. A branch hint must
22857 be at least 8 instructions away from the branch it is affecting. GCC
22858 inserts up to @var{n} nops to enforce this, otherwise it does not
22859 generate the branch hint.
22861 @item -mhint-max-distance=@var{n}
22862 @opindex mhint-max-distance
22863 The encoding of the branch hint instruction limits the hint to be within
22864 256 instructions of the branch it is affecting. By default, GCC makes
22865 sure it is within 125.
22868 @opindex msafe-hints
22869 Work around a hardware bug that causes the SPU to stall indefinitely.
22870 By default, GCC inserts the @code{hbrp} instruction to make sure
22871 this stall won't happen.
22875 @node System V Options
22876 @subsection Options for System V
22878 These additional options are available on System V Release 4 for
22879 compatibility with other compilers on those systems:
22884 Create a shared object.
22885 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
22889 Identify the versions of each tool used by the compiler, in a
22890 @code{.ident} assembler directive in the output.
22894 Refrain from adding @code{.ident} directives to the output file (this is
22897 @item -YP,@var{dirs}
22899 Search the directories @var{dirs}, and no others, for libraries
22900 specified with @option{-l}.
22902 @item -Ym,@var{dir}
22904 Look in the directory @var{dir} to find the M4 preprocessor.
22905 The assembler uses this option.
22906 @c This is supposed to go with a -Yd for predefined M4 macro files, but
22907 @c the generic assembler that comes with Solaris takes just -Ym.
22910 @node TILE-Gx Options
22911 @subsection TILE-Gx Options
22912 @cindex TILE-Gx options
22914 These @samp{-m} options are supported on the TILE-Gx:
22917 @item -mcmodel=small
22918 @opindex mcmodel=small
22919 Generate code for the small model. The distance for direct calls is
22920 limited to 500M in either direction. PC-relative addresses are 32
22921 bits. Absolute addresses support the full address range.
22923 @item -mcmodel=large
22924 @opindex mcmodel=large
22925 Generate code for the large model. There is no limitation on call
22926 distance, pc-relative addresses, or absolute addresses.
22928 @item -mcpu=@var{name}
22930 Selects the type of CPU to be targeted. Currently the only supported
22931 type is @samp{tilegx}.
22937 Generate code for a 32-bit or 64-bit environment. The 32-bit
22938 environment sets int, long, and pointer to 32 bits. The 64-bit
22939 environment sets int to 32 bits and long and pointer to 64 bits.
22942 @itemx -mlittle-endian
22943 @opindex mbig-endian
22944 @opindex mlittle-endian
22945 Generate code in big/little endian mode, respectively.
22948 @node TILEPro Options
22949 @subsection TILEPro Options
22950 @cindex TILEPro options
22952 These @samp{-m} options are supported on the TILEPro:
22955 @item -mcpu=@var{name}
22957 Selects the type of CPU to be targeted. Currently the only supported
22958 type is @samp{tilepro}.
22962 Generate code for a 32-bit environment, which sets int, long, and
22963 pointer to 32 bits. This is the only supported behavior so the flag
22964 is essentially ignored.
22968 @subsection V850 Options
22969 @cindex V850 Options
22971 These @samp{-m} options are defined for V850 implementations:
22975 @itemx -mno-long-calls
22976 @opindex mlong-calls
22977 @opindex mno-long-calls
22978 Treat all calls as being far away (near). If calls are assumed to be
22979 far away, the compiler always loads the function's address into a
22980 register, and calls indirect through the pointer.
22986 Do not optimize (do optimize) basic blocks that use the same index
22987 pointer 4 or more times to copy pointer into the @code{ep} register, and
22988 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
22989 option is on by default if you optimize.
22991 @item -mno-prolog-function
22992 @itemx -mprolog-function
22993 @opindex mno-prolog-function
22994 @opindex mprolog-function
22995 Do not use (do use) external functions to save and restore registers
22996 at the prologue and epilogue of a function. The external functions
22997 are slower, but use less code space if more than one function saves
22998 the same number of registers. The @option{-mprolog-function} option
22999 is on by default if you optimize.
23003 Try to make the code as small as possible. At present, this just turns
23004 on the @option{-mep} and @option{-mprolog-function} options.
23006 @item -mtda=@var{n}
23008 Put static or global variables whose size is @var{n} bytes or less into
23009 the tiny data area that register @code{ep} points to. The tiny data
23010 area can hold up to 256 bytes in total (128 bytes for byte references).
23012 @item -msda=@var{n}
23014 Put static or global variables whose size is @var{n} bytes or less into
23015 the small data area that register @code{gp} points to. The small data
23016 area can hold up to 64 kilobytes.
23018 @item -mzda=@var{n}
23020 Put static or global variables whose size is @var{n} bytes or less into
23021 the first 32 kilobytes of memory.
23025 Specify that the target processor is the V850.
23029 Specify that the target processor is the V850E3V5. The preprocessor
23030 constant @code{__v850e3v5__} is defined if this option is used.
23034 Specify that the target processor is the V850E3V5. This is an alias for
23035 the @option{-mv850e3v5} option.
23039 Specify that the target processor is the V850E2V3. The preprocessor
23040 constant @code{__v850e2v3__} is defined if this option is used.
23044 Specify that the target processor is the V850E2. The preprocessor
23045 constant @code{__v850e2__} is defined if this option is used.
23049 Specify that the target processor is the V850E1. The preprocessor
23050 constants @code{__v850e1__} and @code{__v850e__} are defined if
23051 this option is used.
23055 Specify that the target processor is the V850ES. This is an alias for
23056 the @option{-mv850e1} option.
23060 Specify that the target processor is the V850E@. The preprocessor
23061 constant @code{__v850e__} is defined if this option is used.
23063 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
23064 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
23065 are defined then a default target processor is chosen and the
23066 relevant @samp{__v850*__} preprocessor constant is defined.
23068 The preprocessor constants @code{__v850} and @code{__v851__} are always
23069 defined, regardless of which processor variant is the target.
23071 @item -mdisable-callt
23072 @itemx -mno-disable-callt
23073 @opindex mdisable-callt
23074 @opindex mno-disable-callt
23075 This option suppresses generation of the @code{CALLT} instruction for the
23076 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
23079 This option is enabled by default when the RH850 ABI is
23080 in use (see @option{-mrh850-abi}), and disabled by default when the
23081 GCC ABI is in use. If @code{CALLT} instructions are being generated
23082 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
23088 Pass on (or do not pass on) the @option{-mrelax} command-line option
23092 @itemx -mno-long-jumps
23093 @opindex mlong-jumps
23094 @opindex mno-long-jumps
23095 Disable (or re-enable) the generation of PC-relative jump instructions.
23098 @itemx -mhard-float
23099 @opindex msoft-float
23100 @opindex mhard-float
23101 Disable (or re-enable) the generation of hardware floating point
23102 instructions. This option is only significant when the target
23103 architecture is @samp{V850E2V3} or higher. If hardware floating point
23104 instructions are being generated then the C preprocessor symbol
23105 @code{__FPU_OK__} is defined, otherwise the symbol
23106 @code{__NO_FPU__} is defined.
23110 Enables the use of the e3v5 LOOP instruction. The use of this
23111 instruction is not enabled by default when the e3v5 architecture is
23112 selected because its use is still experimental.
23116 @opindex mrh850-abi
23118 Enables support for the RH850 version of the V850 ABI. This is the
23119 default. With this version of the ABI the following rules apply:
23123 Integer sized structures and unions are returned via a memory pointer
23124 rather than a register.
23127 Large structures and unions (more than 8 bytes in size) are passed by
23131 Functions are aligned to 16-bit boundaries.
23134 The @option{-m8byte-align} command-line option is supported.
23137 The @option{-mdisable-callt} command-line option is enabled by
23138 default. The @option{-mno-disable-callt} command-line option is not
23142 When this version of the ABI is enabled the C preprocessor symbol
23143 @code{__V850_RH850_ABI__} is defined.
23147 Enables support for the old GCC version of the V850 ABI. With this
23148 version of the ABI the following rules apply:
23152 Integer sized structures and unions are returned in register @code{r10}.
23155 Large structures and unions (more than 8 bytes in size) are passed by
23159 Functions are aligned to 32-bit boundaries, unless optimizing for
23163 The @option{-m8byte-align} command-line option is not supported.
23166 The @option{-mdisable-callt} command-line option is supported but not
23167 enabled by default.
23170 When this version of the ABI is enabled the C preprocessor symbol
23171 @code{__V850_GCC_ABI__} is defined.
23173 @item -m8byte-align
23174 @itemx -mno-8byte-align
23175 @opindex m8byte-align
23176 @opindex mno-8byte-align
23177 Enables support for @code{double} and @code{long long} types to be
23178 aligned on 8-byte boundaries. The default is to restrict the
23179 alignment of all objects to at most 4-bytes. When
23180 @option{-m8byte-align} is in effect the C preprocessor symbol
23181 @code{__V850_8BYTE_ALIGN__} is defined.
23184 @opindex mbig-switch
23185 Generate code suitable for big switch tables. Use this option only if
23186 the assembler/linker complain about out of range branches within a switch
23191 This option causes r2 and r5 to be used in the code generated by
23192 the compiler. This setting is the default.
23194 @item -mno-app-regs
23195 @opindex mno-app-regs
23196 This option causes r2 and r5 to be treated as fixed registers.
23201 @subsection VAX Options
23202 @cindex VAX options
23204 These @samp{-m} options are defined for the VAX:
23209 Do not output certain jump instructions (@code{aobleq} and so on)
23210 that the Unix assembler for the VAX cannot handle across long
23215 Do output those jump instructions, on the assumption that the
23216 GNU assembler is being used.
23220 Output code for G-format floating-point numbers instead of D-format.
23223 @node Visium Options
23224 @subsection Visium Options
23225 @cindex Visium options
23231 A program which performs file I/O and is destined to run on an MCM target
23232 should be linked with this option. It causes the libraries libc.a and
23233 libdebug.a to be linked. The program should be run on the target under
23234 the control of the GDB remote debugging stub.
23238 A program which performs file I/O and is destined to run on the simulator
23239 should be linked with option. This causes libraries libc.a and libsim.a to
23243 @itemx -mhard-float
23245 @opindex mhard-float
23246 Generate code containing floating-point instructions. This is the
23250 @itemx -msoft-float
23252 @opindex msoft-float
23253 Generate code containing library calls for floating-point.
23255 @option{-msoft-float} changes the calling convention in the output file;
23256 therefore, it is only useful if you compile @emph{all} of a program with
23257 this option. In particular, you need to compile @file{libgcc.a}, the
23258 library that comes with GCC, with @option{-msoft-float} in order for
23261 @item -mcpu=@var{cpu_type}
23263 Set the instruction set, register set, and instruction scheduling parameters
23264 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23265 @samp{mcm}, @samp{gr5} and @samp{gr6}.
23267 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
23269 By default (unless configured otherwise), GCC generates code for the GR5
23270 variant of the Visium architecture.
23272 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
23273 architecture. The only difference from GR5 code is that the compiler will
23274 generate block move instructions.
23276 @item -mtune=@var{cpu_type}
23278 Set the instruction scheduling parameters for machine type @var{cpu_type},
23279 but do not set the instruction set or register set that the option
23280 @option{-mcpu=@var{cpu_type}} would.
23284 Generate code for the supervisor mode, where there are no restrictions on
23285 the access to general registers. This is the default.
23288 @opindex muser-mode
23289 Generate code for the user mode, where the access to some general registers
23290 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
23291 mode; on the GR6, only registers r29 to r31 are affected.
23295 @subsection VMS Options
23297 These @samp{-m} options are defined for the VMS implementations:
23300 @item -mvms-return-codes
23301 @opindex mvms-return-codes
23302 Return VMS condition codes from @code{main}. The default is to return POSIX-style
23303 condition (e.g.@ error) codes.
23305 @item -mdebug-main=@var{prefix}
23306 @opindex mdebug-main=@var{prefix}
23307 Flag the first routine whose name starts with @var{prefix} as the main
23308 routine for the debugger.
23312 Default to 64-bit memory allocation routines.
23314 @item -mpointer-size=@var{size}
23315 @opindex mpointer-size=@var{size}
23316 Set the default size of pointers. Possible options for @var{size} are
23317 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
23318 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
23319 The later option disables @code{pragma pointer_size}.
23322 @node VxWorks Options
23323 @subsection VxWorks Options
23324 @cindex VxWorks Options
23326 The options in this section are defined for all VxWorks targets.
23327 Options specific to the target hardware are listed with the other
23328 options for that target.
23333 GCC can generate code for both VxWorks kernels and real time processes
23334 (RTPs). This option switches from the former to the latter. It also
23335 defines the preprocessor macro @code{__RTP__}.
23338 @opindex non-static
23339 Link an RTP executable against shared libraries rather than static
23340 libraries. The options @option{-static} and @option{-shared} can
23341 also be used for RTPs (@pxref{Link Options}); @option{-static}
23348 These options are passed down to the linker. They are defined for
23349 compatibility with Diab.
23352 @opindex Xbind-lazy
23353 Enable lazy binding of function calls. This option is equivalent to
23354 @option{-Wl,-z,now} and is defined for compatibility with Diab.
23358 Disable lazy binding of function calls. This option is the default and
23359 is defined for compatibility with Diab.
23363 @subsection x86 Options
23364 @cindex x86 Options
23366 These @samp{-m} options are defined for the x86 family of computers.
23370 @item -march=@var{cpu-type}
23372 Generate instructions for the machine type @var{cpu-type}. In contrast to
23373 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
23374 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
23375 to generate code that may not run at all on processors other than the one
23376 indicated. Specifying @option{-march=@var{cpu-type}} implies
23377 @option{-mtune=@var{cpu-type}}.
23379 The choices for @var{cpu-type} are:
23383 This selects the CPU to generate code for at compilation time by determining
23384 the processor type of the compiling machine. Using @option{-march=native}
23385 enables all instruction subsets supported by the local machine (hence
23386 the result might not run on different machines). Using @option{-mtune=native}
23387 produces code optimized for the local machine under the constraints
23388 of the selected instruction set.
23391 Original Intel i386 CPU@.
23394 Intel i486 CPU@. (No scheduling is implemented for this chip.)
23398 Intel Pentium CPU with no MMX support.
23401 Intel Lakemont MCU, based on Intel Pentium CPU.
23404 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
23407 Intel Pentium Pro CPU@.
23410 When used with @option{-march}, the Pentium Pro
23411 instruction set is used, so the code runs on all i686 family chips.
23412 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
23415 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
23420 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
23424 Intel Pentium M; low-power version of Intel Pentium III CPU
23425 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
23429 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
23432 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
23436 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
23437 SSE2 and SSE3 instruction set support.
23440 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
23441 instruction set support.
23444 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23445 SSE4.1, SSE4.2 and POPCNT instruction set support.
23448 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23449 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
23452 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23453 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
23456 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23457 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
23458 instruction set support.
23461 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23462 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23463 BMI, BMI2 and F16C instruction set support.
23466 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23467 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23468 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
23471 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23472 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23473 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
23474 XSAVES instruction set support.
23477 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
23478 instruction set support.
23481 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23482 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
23485 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23486 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23487 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
23488 AVX512CD instruction set support.
23490 @item skylake-avx512
23491 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23492 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23493 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
23494 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
23497 AMD K6 CPU with MMX instruction set support.
23501 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
23504 @itemx athlon-tbird
23505 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
23511 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
23512 instruction set support.
23518 Processors based on the AMD K8 core with x86-64 instruction set support,
23519 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
23520 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
23521 instruction set extensions.)
23524 @itemx opteron-sse3
23525 @itemx athlon64-sse3
23526 Improved versions of AMD K8 cores with SSE3 instruction set support.
23530 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
23531 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
23532 instruction set extensions.)
23535 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
23536 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
23537 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
23539 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23540 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
23541 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
23544 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23545 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
23546 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
23547 64-bit instruction set extensions.
23549 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23550 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
23551 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
23552 SSE4.2, ABM and 64-bit instruction set extensions.
23555 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
23556 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
23557 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
23558 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
23559 instruction set extensions.
23562 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
23563 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
23564 instruction set extensions.)
23567 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
23568 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
23569 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
23572 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
23576 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
23577 instruction set support.
23580 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
23581 (No scheduling is implemented for this chip.)
23584 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
23585 (No scheduling is implemented for this chip.)
23588 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
23589 (No scheduling is implemented for this chip.)
23592 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
23593 (No scheduling is implemented for this chip.)
23596 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
23597 (No scheduling is implemented for this chip.)
23600 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
23601 (No scheduling is implemented for this chip.)
23604 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
23605 (No scheduling is implemented for this chip.)
23608 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
23609 AVX and AVX2 instruction set support.
23610 (No scheduling is implemented for this chip.)
23613 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23614 instruction set support.
23615 (No scheduling is implemented for this chip.)
23618 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23619 instruction set support.
23620 (No scheduling is implemented for this chip.)
23623 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23624 instruction set support.
23625 (No scheduling is implemented for this chip.)
23628 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23629 instruction set support.
23630 (No scheduling is implemented for this chip.)
23633 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23634 instruction set support.
23635 (No scheduling is implemented for this chip.)
23638 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23639 instruction set support.
23640 (No scheduling is implemented for this chip.)
23643 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
23646 @item -mtune=@var{cpu-type}
23648 Tune to @var{cpu-type} everything applicable about the generated code, except
23649 for the ABI and the set of available instructions.
23650 While picking a specific @var{cpu-type} schedules things appropriately
23651 for that particular chip, the compiler does not generate any code that
23652 cannot run on the default machine type unless you use a
23653 @option{-march=@var{cpu-type}} option.
23654 For example, if GCC is configured for i686-pc-linux-gnu
23655 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
23656 but still runs on i686 machines.
23658 The choices for @var{cpu-type} are the same as for @option{-march}.
23659 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
23663 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
23664 If you know the CPU on which your code will run, then you should use
23665 the corresponding @option{-mtune} or @option{-march} option instead of
23666 @option{-mtune=generic}. But, if you do not know exactly what CPU users
23667 of your application will have, then you should use this option.
23669 As new processors are deployed in the marketplace, the behavior of this
23670 option will change. Therefore, if you upgrade to a newer version of
23671 GCC, code generation controlled by this option will change to reflect
23673 that are most common at the time that version of GCC is released.
23675 There is no @option{-march=generic} option because @option{-march}
23676 indicates the instruction set the compiler can use, and there is no
23677 generic instruction set applicable to all processors. In contrast,
23678 @option{-mtune} indicates the processor (or, in this case, collection of
23679 processors) for which the code is optimized.
23682 Produce code optimized for the most current Intel processors, which are
23683 Haswell and Silvermont for this version of GCC. If you know the CPU
23684 on which your code will run, then you should use the corresponding
23685 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
23686 But, if you want your application performs better on both Haswell and
23687 Silvermont, then you should use this option.
23689 As new Intel processors are deployed in the marketplace, the behavior of
23690 this option will change. Therefore, if you upgrade to a newer version of
23691 GCC, code generation controlled by this option will change to reflect
23692 the most current Intel processors at the time that version of GCC is
23695 There is no @option{-march=intel} option because @option{-march} indicates
23696 the instruction set the compiler can use, and there is no common
23697 instruction set applicable to all processors. In contrast,
23698 @option{-mtune} indicates the processor (or, in this case, collection of
23699 processors) for which the code is optimized.
23702 @item -mcpu=@var{cpu-type}
23704 A deprecated synonym for @option{-mtune}.
23706 @item -mfpmath=@var{unit}
23708 Generate floating-point arithmetic for selected unit @var{unit}. The choices
23709 for @var{unit} are:
23713 Use the standard 387 floating-point coprocessor present on the majority of chips and
23714 emulated otherwise. Code compiled with this option runs almost everywhere.
23715 The temporary results are computed in 80-bit precision instead of the precision
23716 specified by the type, resulting in slightly different results compared to most
23717 of other chips. See @option{-ffloat-store} for more detailed description.
23719 This is the default choice for x86-32 targets.
23722 Use scalar floating-point instructions present in the SSE instruction set.
23723 This instruction set is supported by Pentium III and newer chips,
23724 and in the AMD line
23725 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
23726 instruction set supports only single-precision arithmetic, thus the double and
23727 extended-precision arithmetic are still done using 387. A later version, present
23728 only in Pentium 4 and AMD x86-64 chips, supports double-precision
23731 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
23732 or @option{-msse2} switches to enable SSE extensions and make this option
23733 effective. For the x86-64 compiler, these extensions are enabled by default.
23735 The resulting code should be considerably faster in the majority of cases and avoid
23736 the numerical instability problems of 387 code, but may break some existing
23737 code that expects temporaries to be 80 bits.
23739 This is the default choice for the x86-64 compiler.
23744 Attempt to utilize both instruction sets at once. This effectively doubles the
23745 amount of available registers, and on chips with separate execution units for
23746 387 and SSE the execution resources too. Use this option with care, as it is
23747 still experimental, because the GCC register allocator does not model separate
23748 functional units well, resulting in unstable performance.
23751 @item -masm=@var{dialect}
23752 @opindex masm=@var{dialect}
23753 Output assembly instructions using selected @var{dialect}. Also affects
23754 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
23755 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
23756 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
23757 not support @samp{intel}.
23760 @itemx -mno-ieee-fp
23762 @opindex mno-ieee-fp
23763 Control whether or not the compiler uses IEEE floating-point
23764 comparisons. These correctly handle the case where the result of a
23765 comparison is unordered.
23770 @opindex mhard-float
23771 Generate output containing 80387 instructions for floating point.
23776 @opindex msoft-float
23777 Generate output containing library calls for floating point.
23779 @strong{Warning:} the requisite libraries are not part of GCC@.
23780 Normally the facilities of the machine's usual C compiler are used, but
23781 this can't be done directly in cross-compilation. You must make your
23782 own arrangements to provide suitable library functions for
23785 On machines where a function returns floating-point results in the 80387
23786 register stack, some floating-point opcodes may be emitted even if
23787 @option{-msoft-float} is used.
23789 @item -mno-fp-ret-in-387
23790 @opindex mno-fp-ret-in-387
23791 Do not use the FPU registers for return values of functions.
23793 The usual calling convention has functions return values of types
23794 @code{float} and @code{double} in an FPU register, even if there
23795 is no FPU@. The idea is that the operating system should emulate
23798 The option @option{-mno-fp-ret-in-387} causes such values to be returned
23799 in ordinary CPU registers instead.
23801 @item -mno-fancy-math-387
23802 @opindex mno-fancy-math-387
23803 Some 387 emulators do not support the @code{sin}, @code{cos} and
23804 @code{sqrt} instructions for the 387. Specify this option to avoid
23805 generating those instructions. This option is the default on
23806 OpenBSD and NetBSD@. This option is overridden when @option{-march}
23807 indicates that the target CPU always has an FPU and so the
23808 instruction does not need emulation. These
23809 instructions are not generated unless you also use the
23810 @option{-funsafe-math-optimizations} switch.
23812 @item -malign-double
23813 @itemx -mno-align-double
23814 @opindex malign-double
23815 @opindex mno-align-double
23816 Control whether GCC aligns @code{double}, @code{long double}, and
23817 @code{long long} variables on a two-word boundary or a one-word
23818 boundary. Aligning @code{double} variables on a two-word boundary
23819 produces code that runs somewhat faster on a Pentium at the
23820 expense of more memory.
23822 On x86-64, @option{-malign-double} is enabled by default.
23824 @strong{Warning:} if you use the @option{-malign-double} switch,
23825 structures containing the above types are aligned differently than
23826 the published application binary interface specifications for the x86-32
23827 and are not binary compatible with structures in code compiled
23828 without that switch.
23830 @item -m96bit-long-double
23831 @itemx -m128bit-long-double
23832 @opindex m96bit-long-double
23833 @opindex m128bit-long-double
23834 These switches control the size of @code{long double} type. The x86-32
23835 application binary interface specifies the size to be 96 bits,
23836 so @option{-m96bit-long-double} is the default in 32-bit mode.
23838 Modern architectures (Pentium and newer) prefer @code{long double}
23839 to be aligned to an 8- or 16-byte boundary. In arrays or structures
23840 conforming to the ABI, this is not possible. So specifying
23841 @option{-m128bit-long-double} aligns @code{long double}
23842 to a 16-byte boundary by padding the @code{long double} with an additional
23845 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
23846 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
23848 Notice that neither of these options enable any extra precision over the x87
23849 standard of 80 bits for a @code{long double}.
23851 @strong{Warning:} if you override the default value for your target ABI, this
23852 changes the size of
23853 structures and arrays containing @code{long double} variables,
23854 as well as modifying the function calling convention for functions taking
23855 @code{long double}. Hence they are not binary-compatible
23856 with code compiled without that switch.
23858 @item -mlong-double-64
23859 @itemx -mlong-double-80
23860 @itemx -mlong-double-128
23861 @opindex mlong-double-64
23862 @opindex mlong-double-80
23863 @opindex mlong-double-128
23864 These switches control the size of @code{long double} type. A size
23865 of 64 bits makes the @code{long double} type equivalent to the @code{double}
23866 type. This is the default for 32-bit Bionic C library. A size
23867 of 128 bits makes the @code{long double} type equivalent to the
23868 @code{__float128} type. This is the default for 64-bit Bionic C library.
23870 @strong{Warning:} if you override the default value for your target ABI, this
23871 changes the size of
23872 structures and arrays containing @code{long double} variables,
23873 as well as modifying the function calling convention for functions taking
23874 @code{long double}. Hence they are not binary-compatible
23875 with code compiled without that switch.
23877 @item -malign-data=@var{type}
23878 @opindex malign-data
23879 Control how GCC aligns variables. Supported values for @var{type} are
23880 @samp{compat} uses increased alignment value compatible uses GCC 4.8
23881 and earlier, @samp{abi} uses alignment value as specified by the
23882 psABI, and @samp{cacheline} uses increased alignment value to match
23883 the cache line size. @samp{compat} is the default.
23885 @item -mlarge-data-threshold=@var{threshold}
23886 @opindex mlarge-data-threshold
23887 When @option{-mcmodel=medium} is specified, data objects larger than
23888 @var{threshold} are placed in the large data section. This value must be the
23889 same across all objects linked into the binary, and defaults to 65535.
23893 Use a different function-calling convention, in which functions that
23894 take a fixed number of arguments return with the @code{ret @var{num}}
23895 instruction, which pops their arguments while returning. This saves one
23896 instruction in the caller since there is no need to pop the arguments
23899 You can specify that an individual function is called with this calling
23900 sequence with the function attribute @code{stdcall}. You can also
23901 override the @option{-mrtd} option by using the function attribute
23902 @code{cdecl}. @xref{Function Attributes}.
23904 @strong{Warning:} this calling convention is incompatible with the one
23905 normally used on Unix, so you cannot use it if you need to call
23906 libraries compiled with the Unix compiler.
23908 Also, you must provide function prototypes for all functions that
23909 take variable numbers of arguments (including @code{printf});
23910 otherwise incorrect code is generated for calls to those
23913 In addition, seriously incorrect code results if you call a
23914 function with too many arguments. (Normally, extra arguments are
23915 harmlessly ignored.)
23917 @item -mregparm=@var{num}
23919 Control how many registers are used to pass integer arguments. By
23920 default, no registers are used to pass arguments, and at most 3
23921 registers can be used. You can control this behavior for a specific
23922 function by using the function attribute @code{regparm}.
23923 @xref{Function Attributes}.
23925 @strong{Warning:} if you use this switch, and
23926 @var{num} is nonzero, then you must build all modules with the same
23927 value, including any libraries. This includes the system libraries and
23931 @opindex msseregparm
23932 Use SSE register passing conventions for float and double arguments
23933 and return values. You can control this behavior for a specific
23934 function by using the function attribute @code{sseregparm}.
23935 @xref{Function Attributes}.
23937 @strong{Warning:} if you use this switch then you must build all
23938 modules with the same value, including any libraries. This includes
23939 the system libraries and startup modules.
23941 @item -mvect8-ret-in-mem
23942 @opindex mvect8-ret-in-mem
23943 Return 8-byte vectors in memory instead of MMX registers. This is the
23944 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
23945 Studio compilers until version 12. Later compiler versions (starting
23946 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
23947 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
23948 you need to remain compatible with existing code produced by those
23949 previous compiler versions or older versions of GCC@.
23958 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
23959 is specified, the significands of results of floating-point operations are
23960 rounded to 24 bits (single precision); @option{-mpc64} rounds the
23961 significands of results of floating-point operations to 53 bits (double
23962 precision) and @option{-mpc80} rounds the significands of results of
23963 floating-point operations to 64 bits (extended double precision), which is
23964 the default. When this option is used, floating-point operations in higher
23965 precisions are not available to the programmer without setting the FPU
23966 control word explicitly.
23968 Setting the rounding of floating-point operations to less than the default
23969 80 bits can speed some programs by 2% or more. Note that some mathematical
23970 libraries assume that extended-precision (80-bit) floating-point operations
23971 are enabled by default; routines in such libraries could suffer significant
23972 loss of accuracy, typically through so-called ``catastrophic cancellation'',
23973 when this option is used to set the precision to less than extended precision.
23975 @item -mstackrealign
23976 @opindex mstackrealign
23977 Realign the stack at entry. On the x86, the @option{-mstackrealign}
23978 option generates an alternate prologue and epilogue that realigns the
23979 run-time stack if necessary. This supports mixing legacy codes that keep
23980 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
23981 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
23982 applicable to individual functions.
23984 @item -mpreferred-stack-boundary=@var{num}
23985 @opindex mpreferred-stack-boundary
23986 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23987 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23988 the default is 4 (16 bytes or 128 bits).
23990 @strong{Warning:} When generating code for the x86-64 architecture with
23991 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
23992 used to keep the stack boundary aligned to 8 byte boundary. Since
23993 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
23994 intended to be used in controlled environment where stack space is
23995 important limitation. This option leads to wrong code when functions
23996 compiled with 16 byte stack alignment (such as functions from a standard
23997 library) are called with misaligned stack. In this case, SSE
23998 instructions may lead to misaligned memory access traps. In addition,
23999 variable arguments are handled incorrectly for 16 byte aligned
24000 objects (including x87 long double and __int128), leading to wrong
24001 results. You must build all modules with
24002 @option{-mpreferred-stack-boundary=3}, including any libraries. This
24003 includes the system libraries and startup modules.
24005 @item -mincoming-stack-boundary=@var{num}
24006 @opindex mincoming-stack-boundary
24007 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
24008 boundary. If @option{-mincoming-stack-boundary} is not specified,
24009 the one specified by @option{-mpreferred-stack-boundary} is used.
24011 On Pentium and Pentium Pro, @code{double} and @code{long double} values
24012 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
24013 suffer significant run time performance penalties. On Pentium III, the
24014 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
24015 properly if it is not 16-byte aligned.
24017 To ensure proper alignment of this values on the stack, the stack boundary
24018 must be as aligned as that required by any value stored on the stack.
24019 Further, every function must be generated such that it keeps the stack
24020 aligned. Thus calling a function compiled with a higher preferred
24021 stack boundary from a function compiled with a lower preferred stack
24022 boundary most likely misaligns the stack. It is recommended that
24023 libraries that use callbacks always use the default setting.
24025 This extra alignment does consume extra stack space, and generally
24026 increases code size. Code that is sensitive to stack space usage, such
24027 as embedded systems and operating system kernels, may want to reduce the
24028 preferred alignment to @option{-mpreferred-stack-boundary=2}.
24085 @itemx -mavx512ifma
24086 @opindex mavx512ifma
24088 @itemx -mavx512vbmi
24089 @opindex mavx512vbmi
24101 @opindex mclfushopt
24118 @itemx -mprefetchwt1
24119 @opindex mprefetchwt1
24175 These switches enable the use of instructions in the MMX, SSE,
24176 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
24177 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
24178 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
24179 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU or 3DNow!@:
24180 extended instruction sets. Each has a corresponding @option{-mno-} option
24181 to disable use of these instructions.
24183 These extensions are also available as built-in functions: see
24184 @ref{x86 Built-in Functions}, for details of the functions enabled and
24185 disabled by these switches.
24187 To generate SSE/SSE2 instructions automatically from floating-point
24188 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
24190 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
24191 generates new AVX instructions or AVX equivalence for all SSEx instructions
24194 These options enable GCC to use these extended instructions in
24195 generated code, even without @option{-mfpmath=sse}. Applications that
24196 perform run-time CPU detection must compile separate files for each
24197 supported architecture, using the appropriate flags. In particular,
24198 the file containing the CPU detection code should be compiled without
24201 @item -mdump-tune-features
24202 @opindex mdump-tune-features
24203 This option instructs GCC to dump the names of the x86 performance
24204 tuning features and default settings. The names can be used in
24205 @option{-mtune-ctrl=@var{feature-list}}.
24207 @item -mtune-ctrl=@var{feature-list}
24208 @opindex mtune-ctrl=@var{feature-list}
24209 This option is used to do fine grain control of x86 code generation features.
24210 @var{feature-list} is a comma separated list of @var{feature} names. See also
24211 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
24212 on if it is not preceded with @samp{^}, otherwise, it is turned off.
24213 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
24214 developers. Using it may lead to code paths not covered by testing and can
24215 potentially result in compiler ICEs or runtime errors.
24218 @opindex mno-default
24219 This option instructs GCC to turn off all tunable features. See also
24220 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
24224 This option instructs GCC to emit a @code{cld} instruction in the prologue
24225 of functions that use string instructions. String instructions depend on
24226 the DF flag to select between autoincrement or autodecrement mode. While the
24227 ABI specifies the DF flag to be cleared on function entry, some operating
24228 systems violate this specification by not clearing the DF flag in their
24229 exception dispatchers. The exception handler can be invoked with the DF flag
24230 set, which leads to wrong direction mode when string instructions are used.
24231 This option can be enabled by default on 32-bit x86 targets by configuring
24232 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
24233 instructions can be suppressed with the @option{-mno-cld} compiler option
24237 @opindex mvzeroupper
24238 This option instructs GCC to emit a @code{vzeroupper} instruction
24239 before a transfer of control flow out of the function to minimize
24240 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
24243 @item -mprefer-avx128
24244 @opindex mprefer-avx128
24245 This option instructs GCC to use 128-bit AVX instructions instead of
24246 256-bit AVX instructions in the auto-vectorizer.
24250 This option enables GCC to generate @code{CMPXCHG16B} instructions.
24251 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
24252 (or oword) data types.
24253 This is useful for high-resolution counters that can be updated
24254 by multiple processors (or cores). This instruction is generated as part of
24255 atomic built-in functions: see @ref{__sync Builtins} or
24256 @ref{__atomic Builtins} for details.
24260 This option enables generation of @code{SAHF} instructions in 64-bit code.
24261 Early Intel Pentium 4 CPUs with Intel 64 support,
24262 prior to the introduction of Pentium 4 G1 step in December 2005,
24263 lacked the @code{LAHF} and @code{SAHF} instructions
24264 which are supported by AMD64.
24265 These are load and store instructions, respectively, for certain status flags.
24266 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
24267 @code{drem}, and @code{remainder} built-in functions;
24268 see @ref{Other Builtins} for details.
24272 This option enables use of the @code{movbe} instruction to implement
24273 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
24277 This option enables built-in functions @code{__builtin_ia32_crc32qi},
24278 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
24279 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
24283 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
24284 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
24285 with an additional Newton-Raphson step
24286 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
24287 (and their vectorized
24288 variants) for single-precision floating-point arguments. These instructions
24289 are generated only when @option{-funsafe-math-optimizations} is enabled
24290 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
24291 Note that while the throughput of the sequence is higher than the throughput
24292 of the non-reciprocal instruction, the precision of the sequence can be
24293 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
24295 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
24296 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
24297 combination), and doesn't need @option{-mrecip}.
24299 Also note that GCC emits the above sequence with additional Newton-Raphson step
24300 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
24301 already with @option{-ffast-math} (or the above option combination), and
24302 doesn't need @option{-mrecip}.
24304 @item -mrecip=@var{opt}
24305 @opindex mrecip=opt
24306 This option controls which reciprocal estimate instructions
24307 may be used. @var{opt} is a comma-separated list of options, which may
24308 be preceded by a @samp{!} to invert the option:
24312 Enable all estimate instructions.
24315 Enable the default instructions, equivalent to @option{-mrecip}.
24318 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24321 Enable the approximation for scalar division.
24324 Enable the approximation for vectorized division.
24327 Enable the approximation for scalar square root.
24330 Enable the approximation for vectorized square root.
24333 So, for example, @option{-mrecip=all,!sqrt} enables
24334 all of the reciprocal approximations, except for square root.
24336 @item -mveclibabi=@var{type}
24337 @opindex mveclibabi
24338 Specifies the ABI type to use for vectorizing intrinsics using an
24339 external library. Supported values for @var{type} are @samp{svml}
24340 for the Intel short
24341 vector math library and @samp{acml} for the AMD math core library.
24342 To use this option, both @option{-ftree-vectorize} and
24343 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
24344 ABI-compatible library must be specified at link time.
24346 GCC currently emits calls to @code{vmldExp2},
24347 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
24348 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
24349 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
24350 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
24351 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
24352 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
24353 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
24354 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
24355 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
24356 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
24357 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
24358 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
24359 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
24360 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
24361 when @option{-mveclibabi=acml} is used.
24363 @item -mabi=@var{name}
24365 Generate code for the specified calling convention. Permissible values
24366 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
24367 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
24368 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
24369 You can control this behavior for specific functions by
24370 using the function attributes @code{ms_abi} and @code{sysv_abi}.
24371 @xref{Function Attributes}.
24373 @item -mtls-dialect=@var{type}
24374 @opindex mtls-dialect
24375 Generate code to access thread-local storage using the @samp{gnu} or
24376 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
24377 @samp{gnu2} is more efficient, but it may add compile- and run-time
24378 requirements that cannot be satisfied on all systems.
24381 @itemx -mno-push-args
24382 @opindex mpush-args
24383 @opindex mno-push-args
24384 Use PUSH operations to store outgoing parameters. This method is shorter
24385 and usually equally fast as method using SUB/MOV operations and is enabled
24386 by default. In some cases disabling it may improve performance because of
24387 improved scheduling and reduced dependencies.
24389 @item -maccumulate-outgoing-args
24390 @opindex maccumulate-outgoing-args
24391 If enabled, the maximum amount of space required for outgoing arguments is
24392 computed in the function prologue. This is faster on most modern CPUs
24393 because of reduced dependencies, improved scheduling and reduced stack usage
24394 when the preferred stack boundary is not equal to 2. The drawback is a notable
24395 increase in code size. This switch implies @option{-mno-push-args}.
24399 Support thread-safe exception handling on MinGW. Programs that rely
24400 on thread-safe exception handling must compile and link all code with the
24401 @option{-mthreads} option. When compiling, @option{-mthreads} defines
24402 @option{-D_MT}; when linking, it links in a special thread helper library
24403 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
24405 @item -mms-bitfields
24406 @itemx -mno-ms-bitfields
24407 @opindex mms-bitfields
24408 @opindex mno-ms-bitfields
24410 Enable/disable bit-field layout compatible with the native Microsoft
24413 If @code{packed} is used on a structure, or if bit-fields are used,
24414 it may be that the Microsoft ABI lays out the structure differently
24415 than the way GCC normally does. Particularly when moving packed
24416 data between functions compiled with GCC and the native Microsoft compiler
24417 (either via function call or as data in a file), it may be necessary to access
24420 This option is enabled by default for Microsoft Windows
24421 targets. This behavior can also be controlled locally by use of variable
24422 or type attributes. For more information, see @ref{x86 Variable Attributes}
24423 and @ref{x86 Type Attributes}.
24425 The Microsoft structure layout algorithm is fairly simple with the exception
24426 of the bit-field packing.
24427 The padding and alignment of members of structures and whether a bit-field
24428 can straddle a storage-unit boundary are determine by these rules:
24431 @item Structure members are stored sequentially in the order in which they are
24432 declared: the first member has the lowest memory address and the last member
24435 @item Every data object has an alignment requirement. The alignment requirement
24436 for all data except structures, unions, and arrays is either the size of the
24437 object or the current packing size (specified with either the
24438 @code{aligned} attribute or the @code{pack} pragma),
24439 whichever is less. For structures, unions, and arrays,
24440 the alignment requirement is the largest alignment requirement of its members.
24441 Every object is allocated an offset so that:
24444 offset % alignment_requirement == 0
24447 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
24448 unit if the integral types are the same size and if the next bit-field fits
24449 into the current allocation unit without crossing the boundary imposed by the
24450 common alignment requirements of the bit-fields.
24453 MSVC interprets zero-length bit-fields in the following ways:
24456 @item If a zero-length bit-field is inserted between two bit-fields that
24457 are normally coalesced, the bit-fields are not coalesced.
24464 unsigned long bf_1 : 12;
24466 unsigned long bf_2 : 12;
24471 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
24472 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
24474 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
24475 alignment of the zero-length bit-field is greater than the member that follows it,
24476 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
24497 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
24498 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
24499 bit-field does not affect the alignment of @code{bar} or, as a result, the size
24502 Taking this into account, it is important to note the following:
24505 @item If a zero-length bit-field follows a normal bit-field, the type of the
24506 zero-length bit-field may affect the alignment of the structure as whole. For
24507 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
24508 normal bit-field, and is of type short.
24510 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
24511 still affect the alignment of the structure:
24522 Here, @code{t4} takes up 4 bytes.
24525 @item Zero-length bit-fields following non-bit-field members are ignored:
24537 Here, @code{t5} takes up 2 bytes.
24541 @item -mno-align-stringops
24542 @opindex mno-align-stringops
24543 Do not align the destination of inlined string operations. This switch reduces
24544 code size and improves performance in case the destination is already aligned,
24545 but GCC doesn't know about it.
24547 @item -minline-all-stringops
24548 @opindex minline-all-stringops
24549 By default GCC inlines string operations only when the destination is
24550 known to be aligned to least a 4-byte boundary.
24551 This enables more inlining and increases code
24552 size, but may improve performance of code that depends on fast
24553 @code{memcpy}, @code{strlen},
24554 and @code{memset} for short lengths.
24556 @item -minline-stringops-dynamically
24557 @opindex minline-stringops-dynamically
24558 For string operations of unknown size, use run-time checks with
24559 inline code for small blocks and a library call for large blocks.
24561 @item -mstringop-strategy=@var{alg}
24562 @opindex mstringop-strategy=@var{alg}
24563 Override the internal decision heuristic for the particular algorithm to use
24564 for inlining string operations. The allowed values for @var{alg} are:
24570 Expand using i386 @code{rep} prefix of the specified size.
24574 @itemx unrolled_loop
24575 Expand into an inline loop.
24578 Always use a library call.
24581 @item -mmemcpy-strategy=@var{strategy}
24582 @opindex mmemcpy-strategy=@var{strategy}
24583 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
24584 should be inlined and what inline algorithm to use when the expected size
24585 of the copy operation is known. @var{strategy}
24586 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
24587 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
24588 the max byte size with which inline algorithm @var{alg} is allowed. For the last
24589 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
24590 in the list must be specified in increasing order. The minimal byte size for
24591 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
24594 @item -mmemset-strategy=@var{strategy}
24595 @opindex mmemset-strategy=@var{strategy}
24596 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
24597 @code{__builtin_memset} expansion.
24599 @item -momit-leaf-frame-pointer
24600 @opindex momit-leaf-frame-pointer
24601 Don't keep the frame pointer in a register for leaf functions. This
24602 avoids the instructions to save, set up, and restore frame pointers and
24603 makes an extra register available in leaf functions. The option
24604 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
24605 which might make debugging harder.
24607 @item -mtls-direct-seg-refs
24608 @itemx -mno-tls-direct-seg-refs
24609 @opindex mtls-direct-seg-refs
24610 Controls whether TLS variables may be accessed with offsets from the
24611 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
24612 or whether the thread base pointer must be added. Whether or not this
24613 is valid depends on the operating system, and whether it maps the
24614 segment to cover the entire TLS area.
24616 For systems that use the GNU C Library, the default is on.
24619 @itemx -mno-sse2avx
24621 Specify that the assembler should encode SSE instructions with VEX
24622 prefix. The option @option{-mavx} turns this on by default.
24627 If profiling is active (@option{-pg}), put the profiling
24628 counter call before the prologue.
24629 Note: On x86 architectures the attribute @code{ms_hook_prologue}
24630 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
24632 @item -mrecord-mcount
24633 @itemx -mno-record-mcount
24634 @opindex mrecord-mcount
24635 If profiling is active (@option{-pg}), generate a __mcount_loc section
24636 that contains pointers to each profiling call. This is useful for
24637 automatically patching and out calls.
24640 @itemx -mno-nop-mcount
24641 @opindex mnop-mcount
24642 If profiling is active (@option{-pg}), generate the calls to
24643 the profiling functions as nops. This is useful when they
24644 should be patched in later dynamically. This is likely only
24645 useful together with @option{-mrecord-mcount}.
24647 @item -mskip-rax-setup
24648 @itemx -mno-skip-rax-setup
24649 @opindex mskip-rax-setup
24650 When generating code for the x86-64 architecture with SSE extensions
24651 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
24652 register when there are no variable arguments passed in vector registers.
24654 @strong{Warning:} Since RAX register is used to avoid unnecessarily
24655 saving vector registers on stack when passing variable arguments, the
24656 impacts of this option are callees may waste some stack space,
24657 misbehave or jump to a random location. GCC 4.4 or newer don't have
24658 those issues, regardless the RAX register value.
24661 @itemx -mno-8bit-idiv
24662 @opindex m8bit-idiv
24663 On some processors, like Intel Atom, 8-bit unsigned integer divide is
24664 much faster than 32-bit/64-bit integer divide. This option generates a
24665 run-time check. If both dividend and divisor are within range of 0
24666 to 255, 8-bit unsigned integer divide is used instead of
24667 32-bit/64-bit integer divide.
24669 @item -mavx256-split-unaligned-load
24670 @itemx -mavx256-split-unaligned-store
24671 @opindex mavx256-split-unaligned-load
24672 @opindex mavx256-split-unaligned-store
24673 Split 32-byte AVX unaligned load and store.
24675 @item -mstack-protector-guard=@var{guard}
24676 @opindex mstack-protector-guard=@var{guard}
24677 Generate stack protection code using canary at @var{guard}. Supported
24678 locations are @samp{global} for global canary or @samp{tls} for per-thread
24679 canary in the TLS block (the default). This option has effect only when
24680 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
24682 @item -mmitigate-rop
24683 @opindex mmitigate-rop
24684 Try to avoid generating code sequences that contain unintended return
24685 opcodes, to mitigate against certain forms of attack. At the moment,
24686 this option is limited in what it can do and should not be relied
24687 on to provide serious protection.
24689 @item -mgeneral-regs-only
24690 @opindex mgeneral-regs-only
24691 Generate code that uses only the general-purpose registers. This
24692 prevents the compiler from using floating-point, vector, mask and bound
24697 These @samp{-m} switches are supported in addition to the above
24698 on x86-64 processors in 64-bit environments.
24711 Generate code for a 16-bit, 32-bit or 64-bit environment.
24712 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
24714 generates code that runs on any i386 system.
24716 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
24717 types to 64 bits, and generates code for the x86-64 architecture.
24718 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
24719 and @option{-mdynamic-no-pic} options.
24721 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
24723 generates code for the x86-64 architecture.
24725 The @option{-m16} option is the same as @option{-m32}, except for that
24726 it outputs the @code{.code16gcc} assembly directive at the beginning of
24727 the assembly output so that the binary can run in 16-bit mode.
24729 The @option{-miamcu} option generates code which conforms to Intel MCU
24730 psABI. It requires the @option{-m32} option to be turned on.
24732 @item -mno-red-zone
24733 @opindex mno-red-zone
24734 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
24735 by the x86-64 ABI; it is a 128-byte area beyond the location of the
24736 stack pointer that is not modified by signal or interrupt handlers
24737 and therefore can be used for temporary data without adjusting the stack
24738 pointer. The flag @option{-mno-red-zone} disables this red zone.
24740 @item -mcmodel=small
24741 @opindex mcmodel=small
24742 Generate code for the small code model: the program and its symbols must
24743 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
24744 Programs can be statically or dynamically linked. This is the default
24747 @item -mcmodel=kernel
24748 @opindex mcmodel=kernel
24749 Generate code for the kernel code model. The kernel runs in the
24750 negative 2 GB of the address space.
24751 This model has to be used for Linux kernel code.
24753 @item -mcmodel=medium
24754 @opindex mcmodel=medium
24755 Generate code for the medium model: the program is linked in the lower 2
24756 GB of the address space. Small symbols are also placed there. Symbols
24757 with sizes larger than @option{-mlarge-data-threshold} are put into
24758 large data or BSS sections and can be located above 2GB. Programs can
24759 be statically or dynamically linked.
24761 @item -mcmodel=large
24762 @opindex mcmodel=large
24763 Generate code for the large model. This model makes no assumptions
24764 about addresses and sizes of sections.
24766 @item -maddress-mode=long
24767 @opindex maddress-mode=long
24768 Generate code for long address mode. This is only supported for 64-bit
24769 and x32 environments. It is the default address mode for 64-bit
24772 @item -maddress-mode=short
24773 @opindex maddress-mode=short
24774 Generate code for short address mode. This is only supported for 32-bit
24775 and x32 environments. It is the default address mode for 32-bit and
24779 @node x86 Windows Options
24780 @subsection x86 Windows Options
24781 @cindex x86 Windows Options
24782 @cindex Windows Options for x86
24784 These additional options are available for Microsoft Windows targets:
24790 specifies that a console application is to be generated, by
24791 instructing the linker to set the PE header subsystem type
24792 required for console applications.
24793 This option is available for Cygwin and MinGW targets and is
24794 enabled by default on those targets.
24798 This option is available for Cygwin and MinGW targets. It
24799 specifies that a DLL---a dynamic link library---is to be
24800 generated, enabling the selection of the required runtime
24801 startup object and entry point.
24803 @item -mnop-fun-dllimport
24804 @opindex mnop-fun-dllimport
24805 This option is available for Cygwin and MinGW targets. It
24806 specifies that the @code{dllimport} attribute should be ignored.
24810 This option is available for MinGW targets. It specifies
24811 that MinGW-specific thread support is to be used.
24815 This option is available for MinGW-w64 targets. It causes
24816 the @code{UNICODE} preprocessor macro to be predefined, and
24817 chooses Unicode-capable runtime startup code.
24821 This option is available for Cygwin and MinGW targets. It
24822 specifies that the typical Microsoft Windows predefined macros are to
24823 be set in the pre-processor, but does not influence the choice
24824 of runtime library/startup code.
24828 This option is available for Cygwin and MinGW targets. It
24829 specifies that a GUI application is to be generated by
24830 instructing the linker to set the PE header subsystem type
24833 @item -fno-set-stack-executable
24834 @opindex fno-set-stack-executable
24835 This option is available for MinGW targets. It specifies that
24836 the executable flag for the stack used by nested functions isn't
24837 set. This is necessary for binaries running in kernel mode of
24838 Microsoft Windows, as there the User32 API, which is used to set executable
24839 privileges, isn't available.
24841 @item -fwritable-relocated-rdata
24842 @opindex fno-writable-relocated-rdata
24843 This option is available for MinGW and Cygwin targets. It specifies
24844 that relocated-data in read-only section is put into the @code{.data}
24845 section. This is a necessary for older runtimes not supporting
24846 modification of @code{.rdata} sections for pseudo-relocation.
24848 @item -mpe-aligned-commons
24849 @opindex mpe-aligned-commons
24850 This option is available for Cygwin and MinGW targets. It
24851 specifies that the GNU extension to the PE file format that
24852 permits the correct alignment of COMMON variables should be
24853 used when generating code. It is enabled by default if
24854 GCC detects that the target assembler found during configuration
24855 supports the feature.
24858 See also under @ref{x86 Options} for standard options.
24860 @node Xstormy16 Options
24861 @subsection Xstormy16 Options
24862 @cindex Xstormy16 Options
24864 These options are defined for Xstormy16:
24869 Choose startup files and linker script suitable for the simulator.
24872 @node Xtensa Options
24873 @subsection Xtensa Options
24874 @cindex Xtensa Options
24876 These options are supported for Xtensa targets:
24880 @itemx -mno-const16
24882 @opindex mno-const16
24883 Enable or disable use of @code{CONST16} instructions for loading
24884 constant values. The @code{CONST16} instruction is currently not a
24885 standard option from Tensilica. When enabled, @code{CONST16}
24886 instructions are always used in place of the standard @code{L32R}
24887 instructions. The use of @code{CONST16} is enabled by default only if
24888 the @code{L32R} instruction is not available.
24891 @itemx -mno-fused-madd
24892 @opindex mfused-madd
24893 @opindex mno-fused-madd
24894 Enable or disable use of fused multiply/add and multiply/subtract
24895 instructions in the floating-point option. This has no effect if the
24896 floating-point option is not also enabled. Disabling fused multiply/add
24897 and multiply/subtract instructions forces the compiler to use separate
24898 instructions for the multiply and add/subtract operations. This may be
24899 desirable in some cases where strict IEEE 754-compliant results are
24900 required: the fused multiply add/subtract instructions do not round the
24901 intermediate result, thereby producing results with @emph{more} bits of
24902 precision than specified by the IEEE standard. Disabling fused multiply
24903 add/subtract instructions also ensures that the program output is not
24904 sensitive to the compiler's ability to combine multiply and add/subtract
24907 @item -mserialize-volatile
24908 @itemx -mno-serialize-volatile
24909 @opindex mserialize-volatile
24910 @opindex mno-serialize-volatile
24911 When this option is enabled, GCC inserts @code{MEMW} instructions before
24912 @code{volatile} memory references to guarantee sequential consistency.
24913 The default is @option{-mserialize-volatile}. Use
24914 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
24916 @item -mforce-no-pic
24917 @opindex mforce-no-pic
24918 For targets, like GNU/Linux, where all user-mode Xtensa code must be
24919 position-independent code (PIC), this option disables PIC for compiling
24922 @item -mtext-section-literals
24923 @itemx -mno-text-section-literals
24924 @opindex mtext-section-literals
24925 @opindex mno-text-section-literals
24926 These options control the treatment of literal pools. The default is
24927 @option{-mno-text-section-literals}, which places literals in a separate
24928 section in the output file. This allows the literal pool to be placed
24929 in a data RAM/ROM, and it also allows the linker to combine literal
24930 pools from separate object files to remove redundant literals and
24931 improve code size. With @option{-mtext-section-literals}, the literals
24932 are interspersed in the text section in order to keep them as close as
24933 possible to their references. This may be necessary for large assembly
24934 files. Literals for each function are placed right before that function.
24936 @item -mauto-litpools
24937 @itemx -mno-auto-litpools
24938 @opindex mauto-litpools
24939 @opindex mno-auto-litpools
24940 These options control the treatment of literal pools. The default is
24941 @option{-mno-auto-litpools}, which places literals in a separate
24942 section in the output file unless @option{-mtext-section-literals} is
24943 used. With @option{-mauto-litpools} the literals are interspersed in
24944 the text section by the assembler. Compiler does not produce explicit
24945 @code{.literal} directives and loads literals into registers with
24946 @code{MOVI} instructions instead of @code{L32R} to let the assembler
24947 do relaxation and place literals as necessary. This option allows
24948 assembler to create several literal pools per function and assemble
24949 very big functions, which may not be possible with
24950 @option{-mtext-section-literals}.
24952 @item -mtarget-align
24953 @itemx -mno-target-align
24954 @opindex mtarget-align
24955 @opindex mno-target-align
24956 When this option is enabled, GCC instructs the assembler to
24957 automatically align instructions to reduce branch penalties at the
24958 expense of some code density. The assembler attempts to widen density
24959 instructions to align branch targets and the instructions following call
24960 instructions. If there are not enough preceding safe density
24961 instructions to align a target, no widening is performed. The
24962 default is @option{-mtarget-align}. These options do not affect the
24963 treatment of auto-aligned instructions like @code{LOOP}, which the
24964 assembler always aligns, either by widening density instructions or
24965 by inserting NOP instructions.
24968 @itemx -mno-longcalls
24969 @opindex mlongcalls
24970 @opindex mno-longcalls
24971 When this option is enabled, GCC instructs the assembler to translate
24972 direct calls to indirect calls unless it can determine that the target
24973 of a direct call is in the range allowed by the call instruction. This
24974 translation typically occurs for calls to functions in other source
24975 files. Specifically, the assembler translates a direct @code{CALL}
24976 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
24977 The default is @option{-mno-longcalls}. This option should be used in
24978 programs where the call target can potentially be out of range. This
24979 option is implemented in the assembler, not the compiler, so the
24980 assembly code generated by GCC still shows direct call
24981 instructions---look at the disassembled object code to see the actual
24982 instructions. Note that the assembler uses an indirect call for
24983 every cross-file call, not just those that really are out of range.
24986 @node zSeries Options
24987 @subsection zSeries Options
24988 @cindex zSeries options
24990 These are listed under @xref{S/390 and zSeries Options}.
24996 @section Specifying Subprocesses and the Switches to Pass to Them
24999 @command{gcc} is a driver program. It performs its job by invoking a
25000 sequence of other programs to do the work of compiling, assembling and
25001 linking. GCC interprets its command-line parameters and uses these to
25002 deduce which programs it should invoke, and which command-line options
25003 it ought to place on their command lines. This behavior is controlled
25004 by @dfn{spec strings}. In most cases there is one spec string for each
25005 program that GCC can invoke, but a few programs have multiple spec
25006 strings to control their behavior. The spec strings built into GCC can
25007 be overridden by using the @option{-specs=} command-line switch to specify
25010 @dfn{Spec files} are plain-text files that are used to construct spec
25011 strings. They consist of a sequence of directives separated by blank
25012 lines. The type of directive is determined by the first non-whitespace
25013 character on the line, which can be one of the following:
25016 @item %@var{command}
25017 Issues a @var{command} to the spec file processor. The commands that can
25021 @item %include <@var{file}>
25022 @cindex @code{%include}
25023 Search for @var{file} and insert its text at the current point in the
25026 @item %include_noerr <@var{file}>
25027 @cindex @code{%include_noerr}
25028 Just like @samp{%include}, but do not generate an error message if the include
25029 file cannot be found.
25031 @item %rename @var{old_name} @var{new_name}
25032 @cindex @code{%rename}
25033 Rename the spec string @var{old_name} to @var{new_name}.
25037 @item *[@var{spec_name}]:
25038 This tells the compiler to create, override or delete the named spec
25039 string. All lines after this directive up to the next directive or
25040 blank line are considered to be the text for the spec string. If this
25041 results in an empty string then the spec is deleted. (Or, if the
25042 spec did not exist, then nothing happens.) Otherwise, if the spec
25043 does not currently exist a new spec is created. If the spec does
25044 exist then its contents are overridden by the text of this
25045 directive, unless the first character of that text is the @samp{+}
25046 character, in which case the text is appended to the spec.
25048 @item [@var{suffix}]:
25049 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
25050 and up to the next directive or blank line are considered to make up the
25051 spec string for the indicated suffix. When the compiler encounters an
25052 input file with the named suffix, it processes the spec string in
25053 order to work out how to compile that file. For example:
25057 z-compile -input %i
25060 This says that any input file whose name ends in @samp{.ZZ} should be
25061 passed to the program @samp{z-compile}, which should be invoked with the
25062 command-line switch @option{-input} and with the result of performing the
25063 @samp{%i} substitution. (See below.)
25065 As an alternative to providing a spec string, the text following a
25066 suffix directive can be one of the following:
25069 @item @@@var{language}
25070 This says that the suffix is an alias for a known @var{language}. This is
25071 similar to using the @option{-x} command-line switch to GCC to specify a
25072 language explicitly. For example:
25079 Says that .ZZ files are, in fact, C++ source files.
25082 This causes an error messages saying:
25085 @var{name} compiler not installed on this system.
25089 GCC already has an extensive list of suffixes built into it.
25090 This directive adds an entry to the end of the list of suffixes, but
25091 since the list is searched from the end backwards, it is effectively
25092 possible to override earlier entries using this technique.
25096 GCC has the following spec strings built into it. Spec files can
25097 override these strings or create their own. Note that individual
25098 targets can also add their own spec strings to this list.
25101 asm Options to pass to the assembler
25102 asm_final Options to pass to the assembler post-processor
25103 cpp Options to pass to the C preprocessor
25104 cc1 Options to pass to the C compiler
25105 cc1plus Options to pass to the C++ compiler
25106 endfile Object files to include at the end of the link
25107 link Options to pass to the linker
25108 lib Libraries to include on the command line to the linker
25109 libgcc Decides which GCC support library to pass to the linker
25110 linker Sets the name of the linker
25111 predefines Defines to be passed to the C preprocessor
25112 signed_char Defines to pass to CPP to say whether @code{char} is signed
25114 startfile Object files to include at the start of the link
25117 Here is a small example of a spec file:
25120 %rename lib old_lib
25123 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
25126 This example renames the spec called @samp{lib} to @samp{old_lib} and
25127 then overrides the previous definition of @samp{lib} with a new one.
25128 The new definition adds in some extra command-line options before
25129 including the text of the old definition.
25131 @dfn{Spec strings} are a list of command-line options to be passed to their
25132 corresponding program. In addition, the spec strings can contain
25133 @samp{%}-prefixed sequences to substitute variable text or to
25134 conditionally insert text into the command line. Using these constructs
25135 it is possible to generate quite complex command lines.
25137 Here is a table of all defined @samp{%}-sequences for spec
25138 strings. Note that spaces are not generated automatically around the
25139 results of expanding these sequences. Therefore you can concatenate them
25140 together or combine them with constant text in a single argument.
25144 Substitute one @samp{%} into the program name or argument.
25147 Substitute the name of the input file being processed.
25150 Substitute the basename of the input file being processed.
25151 This is the substring up to (and not including) the last period
25152 and not including the directory.
25155 This is the same as @samp{%b}, but include the file suffix (text after
25159 Marks the argument containing or following the @samp{%d} as a
25160 temporary file name, so that that file is deleted if GCC exits
25161 successfully. Unlike @samp{%g}, this contributes no text to the
25164 @item %g@var{suffix}
25165 Substitute a file name that has suffix @var{suffix} and is chosen
25166 once per compilation, and mark the argument in the same way as
25167 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
25168 name is now chosen in a way that is hard to predict even when previously
25169 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
25170 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
25171 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
25172 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
25173 was simply substituted with a file name chosen once per compilation,
25174 without regard to any appended suffix (which was therefore treated
25175 just like ordinary text), making such attacks more likely to succeed.
25177 @item %u@var{suffix}
25178 Like @samp{%g}, but generates a new temporary file name
25179 each time it appears instead of once per compilation.
25181 @item %U@var{suffix}
25182 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
25183 new one if there is no such last file name. In the absence of any
25184 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
25185 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
25186 involves the generation of two distinct file names, one
25187 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
25188 simply substituted with a file name chosen for the previous @samp{%u},
25189 without regard to any appended suffix.
25191 @item %j@var{suffix}
25192 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
25193 writable, and if @option{-save-temps} is not used;
25194 otherwise, substitute the name
25195 of a temporary file, just like @samp{%u}. This temporary file is not
25196 meant for communication between processes, but rather as a junk
25197 disposal mechanism.
25199 @item %|@var{suffix}
25200 @itemx %m@var{suffix}
25201 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
25202 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
25203 all. These are the two most common ways to instruct a program that it
25204 should read from standard input or write to standard output. If you
25205 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
25206 construct: see for example @file{f/lang-specs.h}.
25208 @item %.@var{SUFFIX}
25209 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
25210 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
25211 terminated by the next space or %.
25214 Marks the argument containing or following the @samp{%w} as the
25215 designated output file of this compilation. This puts the argument
25216 into the sequence of arguments that @samp{%o} substitutes.
25219 Substitutes the names of all the output files, with spaces
25220 automatically placed around them. You should write spaces
25221 around the @samp{%o} as well or the results are undefined.
25222 @samp{%o} is for use in the specs for running the linker.
25223 Input files whose names have no recognized suffix are not compiled
25224 at all, but they are included among the output files, so they are
25228 Substitutes the suffix for object files. Note that this is
25229 handled specially when it immediately follows @samp{%g, %u, or %U},
25230 because of the need for those to form complete file names. The
25231 handling is such that @samp{%O} is treated exactly as if it had already
25232 been substituted, except that @samp{%g, %u, and %U} do not currently
25233 support additional @var{suffix} characters following @samp{%O} as they do
25234 following, for example, @samp{.o}.
25237 Substitutes the standard macro predefinitions for the
25238 current target machine. Use this when running @command{cpp}.
25241 Like @samp{%p}, but puts @samp{__} before and after the name of each
25242 predefined macro, except for macros that start with @samp{__} or with
25243 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
25247 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
25248 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
25249 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
25250 and @option{-imultilib} as necessary.
25253 Current argument is the name of a library or startup file of some sort.
25254 Search for that file in a standard list of directories and substitute
25255 the full name found. The current working directory is included in the
25256 list of directories scanned.
25259 Current argument is the name of a linker script. Search for that file
25260 in the current list of directories to scan for libraries. If the file
25261 is located insert a @option{--script} option into the command line
25262 followed by the full path name found. If the file is not found then
25263 generate an error message. Note: the current working directory is not
25267 Print @var{str} as an error message. @var{str} is terminated by a newline.
25268 Use this when inconsistent options are detected.
25270 @item %(@var{name})
25271 Substitute the contents of spec string @var{name} at this point.
25273 @item %x@{@var{option}@}
25274 Accumulate an option for @samp{%X}.
25277 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
25281 Output the accumulated assembler options specified by @option{-Wa}.
25284 Output the accumulated preprocessor options specified by @option{-Wp}.
25287 Process the @code{asm} spec. This is used to compute the
25288 switches to be passed to the assembler.
25291 Process the @code{asm_final} spec. This is a spec string for
25292 passing switches to an assembler post-processor, if such a program is
25296 Process the @code{link} spec. This is the spec for computing the
25297 command line passed to the linker. Typically it makes use of the
25298 @samp{%L %G %S %D and %E} sequences.
25301 Dump out a @option{-L} option for each directory that GCC believes might
25302 contain startup files. If the target supports multilibs then the
25303 current multilib directory is prepended to each of these paths.
25306 Process the @code{lib} spec. This is a spec string for deciding which
25307 libraries are included on the command line to the linker.
25310 Process the @code{libgcc} spec. This is a spec string for deciding
25311 which GCC support library is included on the command line to the linker.
25314 Process the @code{startfile} spec. This is a spec for deciding which
25315 object files are the first ones passed to the linker. Typically
25316 this might be a file named @file{crt0.o}.
25319 Process the @code{endfile} spec. This is a spec string that specifies
25320 the last object files that are passed to the linker.
25323 Process the @code{cpp} spec. This is used to construct the arguments
25324 to be passed to the C preprocessor.
25327 Process the @code{cc1} spec. This is used to construct the options to be
25328 passed to the actual C compiler (@command{cc1}).
25331 Process the @code{cc1plus} spec. This is used to construct the options to be
25332 passed to the actual C++ compiler (@command{cc1plus}).
25335 Substitute the variable part of a matched option. See below.
25336 Note that each comma in the substituted string is replaced by
25340 Remove all occurrences of @code{-S} from the command line. Note---this
25341 command is position dependent. @samp{%} commands in the spec string
25342 before this one see @code{-S}, @samp{%} commands in the spec string
25343 after this one do not.
25345 @item %:@var{function}(@var{args})
25346 Call the named function @var{function}, passing it @var{args}.
25347 @var{args} is first processed as a nested spec string, then split
25348 into an argument vector in the usual fashion. The function returns
25349 a string which is processed as if it had appeared literally as part
25350 of the current spec.
25352 The following built-in spec functions are provided:
25355 @item @code{getenv}
25356 The @code{getenv} spec function takes two arguments: an environment
25357 variable name and a string. If the environment variable is not
25358 defined, a fatal error is issued. Otherwise, the return value is the
25359 value of the environment variable concatenated with the string. For
25360 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
25363 %:getenv(TOPDIR /include)
25366 expands to @file{/path/to/top/include}.
25368 @item @code{if-exists}
25369 The @code{if-exists} spec function takes one argument, an absolute
25370 pathname to a file. If the file exists, @code{if-exists} returns the
25371 pathname. Here is a small example of its usage:
25375 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
25378 @item @code{if-exists-else}
25379 The @code{if-exists-else} spec function is similar to the @code{if-exists}
25380 spec function, except that it takes two arguments. The first argument is
25381 an absolute pathname to a file. If the file exists, @code{if-exists-else}
25382 returns the pathname. If it does not exist, it returns the second argument.
25383 This way, @code{if-exists-else} can be used to select one file or another,
25384 based on the existence of the first. Here is a small example of its usage:
25388 crt0%O%s %:if-exists(crti%O%s) \
25389 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
25392 @item @code{replace-outfile}
25393 The @code{replace-outfile} spec function takes two arguments. It looks for the
25394 first argument in the outfiles array and replaces it with the second argument. Here
25395 is a small example of its usage:
25398 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
25401 @item @code{remove-outfile}
25402 The @code{remove-outfile} spec function takes one argument. It looks for the
25403 first argument in the outfiles array and removes it. Here is a small example
25407 %:remove-outfile(-lm)
25410 @item @code{pass-through-libs}
25411 The @code{pass-through-libs} spec function takes any number of arguments. It
25412 finds any @option{-l} options and any non-options ending in @file{.a} (which it
25413 assumes are the names of linker input library archive files) and returns a
25414 result containing all the found arguments each prepended by
25415 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
25416 intended to be passed to the LTO linker plugin.
25419 %:pass-through-libs(%G %L %G)
25422 @item @code{print-asm-header}
25423 The @code{print-asm-header} function takes no arguments and simply
25424 prints a banner like:
25430 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
25433 It is used to separate compiler options from assembler options
25434 in the @option{--target-help} output.
25437 @item %@{@code{S}@}
25438 Substitutes the @code{-S} switch, if that switch is given to GCC@.
25439 If that switch is not specified, this substitutes nothing. Note that
25440 the leading dash is omitted when specifying this option, and it is
25441 automatically inserted if the substitution is performed. Thus the spec
25442 string @samp{%@{foo@}} matches the command-line option @option{-foo}
25443 and outputs the command-line option @option{-foo}.
25445 @item %W@{@code{S}@}
25446 Like %@{@code{S}@} but mark last argument supplied within as a file to be
25447 deleted on failure.
25449 @item %@{@code{S}*@}
25450 Substitutes all the switches specified to GCC whose names start
25451 with @code{-S}, but which also take an argument. This is used for
25452 switches like @option{-o}, @option{-D}, @option{-I}, etc.
25453 GCC considers @option{-o foo} as being
25454 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
25455 text, including the space. Thus two arguments are generated.
25457 @item %@{@code{S}*&@code{T}*@}
25458 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
25459 (the order of @code{S} and @code{T} in the spec is not significant).
25460 There can be any number of ampersand-separated variables; for each the
25461 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
25463 @item %@{@code{S}:@code{X}@}
25464 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
25466 @item %@{!@code{S}:@code{X}@}
25467 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
25469 @item %@{@code{S}*:@code{X}@}
25470 Substitutes @code{X} if one or more switches whose names start with
25471 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
25472 once, no matter how many such switches appeared. However, if @code{%*}
25473 appears somewhere in @code{X}, then @code{X} is substituted once
25474 for each matching switch, with the @code{%*} replaced by the part of
25475 that switch matching the @code{*}.
25477 If @code{%*} appears as the last part of a spec sequence then a space
25478 is added after the end of the last substitution. If there is more
25479 text in the sequence, however, then a space is not generated. This
25480 allows the @code{%*} substitution to be used as part of a larger
25481 string. For example, a spec string like this:
25484 %@{mcu=*:--script=%*/memory.ld@}
25488 when matching an option like @option{-mcu=newchip} produces:
25491 --script=newchip/memory.ld
25494 @item %@{.@code{S}:@code{X}@}
25495 Substitutes @code{X}, if processing a file with suffix @code{S}.
25497 @item %@{!.@code{S}:@code{X}@}
25498 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
25500 @item %@{,@code{S}:@code{X}@}
25501 Substitutes @code{X}, if processing a file for language @code{S}.
25503 @item %@{!,@code{S}:@code{X}@}
25504 Substitutes @code{X}, if not processing a file for language @code{S}.
25506 @item %@{@code{S}|@code{P}:@code{X}@}
25507 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
25508 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
25509 @code{*} sequences as well, although they have a stronger binding than
25510 the @samp{|}. If @code{%*} appears in @code{X}, all of the
25511 alternatives must be starred, and only the first matching alternative
25514 For example, a spec string like this:
25517 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
25521 outputs the following command-line options from the following input
25522 command-line options:
25527 -d fred.c -foo -baz -boggle
25528 -d jim.d -bar -baz -boggle
25531 @item %@{S:X; T:Y; :D@}
25533 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
25534 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
25535 be as many clauses as you need. This may be combined with @code{.},
25536 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
25541 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
25542 construct may contain other nested @samp{%} constructs or spaces, or
25543 even newlines. They are processed as usual, as described above.
25544 Trailing white space in @code{X} is ignored. White space may also
25545 appear anywhere on the left side of the colon in these constructs,
25546 except between @code{.} or @code{*} and the corresponding word.
25548 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
25549 handled specifically in these constructs. If another value of
25550 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
25551 @option{-W} switch is found later in the command line, the earlier
25552 switch value is ignored, except with @{@code{S}*@} where @code{S} is
25553 just one letter, which passes all matching options.
25555 The character @samp{|} at the beginning of the predicate text is used to
25556 indicate that a command should be piped to the following command, but
25557 only if @option{-pipe} is specified.
25559 It is built into GCC which switches take arguments and which do not.
25560 (You might think it would be useful to generalize this to allow each
25561 compiler's spec to say which switches take arguments. But this cannot
25562 be done in a consistent fashion. GCC cannot even decide which input
25563 files have been specified without knowing which switches take arguments,
25564 and it must know which input files to compile in order to tell which
25567 GCC also knows implicitly that arguments starting in @option{-l} are to be
25568 treated as compiler output files, and passed to the linker in their
25569 proper position among the other output files.
25571 @node Environment Variables
25572 @section Environment Variables Affecting GCC
25573 @cindex environment variables
25575 @c man begin ENVIRONMENT
25576 This section describes several environment variables that affect how GCC
25577 operates. Some of them work by specifying directories or prefixes to use
25578 when searching for various kinds of files. Some are used to specify other
25579 aspects of the compilation environment.
25581 Note that you can also specify places to search using options such as
25582 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
25583 take precedence over places specified using environment variables, which
25584 in turn take precedence over those specified by the configuration of GCC@.
25585 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
25586 GNU Compiler Collection (GCC) Internals}.
25591 @c @itemx LC_COLLATE
25593 @c @itemx LC_MONETARY
25594 @c @itemx LC_NUMERIC
25599 @c @findex LC_COLLATE
25600 @findex LC_MESSAGES
25601 @c @findex LC_MONETARY
25602 @c @findex LC_NUMERIC
25606 These environment variables control the way that GCC uses
25607 localization information which allows GCC to work with different
25608 national conventions. GCC inspects the locale categories
25609 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
25610 so. These locale categories can be set to any value supported by your
25611 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
25612 Kingdom encoded in UTF-8.
25614 The @env{LC_CTYPE} environment variable specifies character
25615 classification. GCC uses it to determine the character boundaries in
25616 a string; this is needed for some multibyte encodings that contain quote
25617 and escape characters that are otherwise interpreted as a string
25620 The @env{LC_MESSAGES} environment variable specifies the language to
25621 use in diagnostic messages.
25623 If the @env{LC_ALL} environment variable is set, it overrides the value
25624 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
25625 and @env{LC_MESSAGES} default to the value of the @env{LANG}
25626 environment variable. If none of these variables are set, GCC
25627 defaults to traditional C English behavior.
25631 If @env{TMPDIR} is set, it specifies the directory to use for temporary
25632 files. GCC uses temporary files to hold the output of one stage of
25633 compilation which is to be used as input to the next stage: for example,
25634 the output of the preprocessor, which is the input to the compiler
25637 @item GCC_COMPARE_DEBUG
25638 @findex GCC_COMPARE_DEBUG
25639 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
25640 @option{-fcompare-debug} to the compiler driver. See the documentation
25641 of this option for more details.
25643 @item GCC_EXEC_PREFIX
25644 @findex GCC_EXEC_PREFIX
25645 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
25646 names of the subprograms executed by the compiler. No slash is added
25647 when this prefix is combined with the name of a subprogram, but you can
25648 specify a prefix that ends with a slash if you wish.
25650 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
25651 an appropriate prefix to use based on the pathname it is invoked with.
25653 If GCC cannot find the subprogram using the specified prefix, it
25654 tries looking in the usual places for the subprogram.
25656 The default value of @env{GCC_EXEC_PREFIX} is
25657 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
25658 the installed compiler. In many cases @var{prefix} is the value
25659 of @code{prefix} when you ran the @file{configure} script.
25661 Other prefixes specified with @option{-B} take precedence over this prefix.
25663 This prefix is also used for finding files such as @file{crt0.o} that are
25666 In addition, the prefix is used in an unusual way in finding the
25667 directories to search for header files. For each of the standard
25668 directories whose name normally begins with @samp{/usr/local/lib/gcc}
25669 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
25670 replacing that beginning with the specified prefix to produce an
25671 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
25672 @file{foo/bar} just before it searches the standard directory
25673 @file{/usr/local/lib/bar}.
25674 If a standard directory begins with the configured
25675 @var{prefix} then the value of @var{prefix} is replaced by
25676 @env{GCC_EXEC_PREFIX} when looking for header files.
25678 @item COMPILER_PATH
25679 @findex COMPILER_PATH
25680 The value of @env{COMPILER_PATH} is a colon-separated list of
25681 directories, much like @env{PATH}. GCC tries the directories thus
25682 specified when searching for subprograms, if it can't find the
25683 subprograms using @env{GCC_EXEC_PREFIX}.
25686 @findex LIBRARY_PATH
25687 The value of @env{LIBRARY_PATH} is a colon-separated list of
25688 directories, much like @env{PATH}. When configured as a native compiler,
25689 GCC tries the directories thus specified when searching for special
25690 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
25691 using GCC also uses these directories when searching for ordinary
25692 libraries for the @option{-l} option (but directories specified with
25693 @option{-L} come first).
25697 @cindex locale definition
25698 This variable is used to pass locale information to the compiler. One way in
25699 which this information is used is to determine the character set to be used
25700 when character literals, string literals and comments are parsed in C and C++.
25701 When the compiler is configured to allow multibyte characters,
25702 the following values for @env{LANG} are recognized:
25706 Recognize JIS characters.
25708 Recognize SJIS characters.
25710 Recognize EUCJP characters.
25713 If @env{LANG} is not defined, or if it has some other value, then the
25714 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
25715 recognize and translate multibyte characters.
25719 Some additional environment variables affect the behavior of the
25722 @include cppenv.texi
25726 @node Precompiled Headers
25727 @section Using Precompiled Headers
25728 @cindex precompiled headers
25729 @cindex speed of compilation
25731 Often large projects have many header files that are included in every
25732 source file. The time the compiler takes to process these header files
25733 over and over again can account for nearly all of the time required to
25734 build the project. To make builds faster, GCC allows you to
25735 @dfn{precompile} a header file.
25737 To create a precompiled header file, simply compile it as you would any
25738 other file, if necessary using the @option{-x} option to make the driver
25739 treat it as a C or C++ header file. You may want to use a
25740 tool like @command{make} to keep the precompiled header up-to-date when
25741 the headers it contains change.
25743 A precompiled header file is searched for when @code{#include} is
25744 seen in the compilation. As it searches for the included file
25745 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
25746 compiler looks for a precompiled header in each directory just before it
25747 looks for the include file in that directory. The name searched for is
25748 the name specified in the @code{#include} with @samp{.gch} appended. If
25749 the precompiled header file can't be used, it is ignored.
25751 For instance, if you have @code{#include "all.h"}, and you have
25752 @file{all.h.gch} in the same directory as @file{all.h}, then the
25753 precompiled header file is used if possible, and the original
25754 header is used otherwise.
25756 Alternatively, you might decide to put the precompiled header file in a
25757 directory and use @option{-I} to ensure that directory is searched
25758 before (or instead of) the directory containing the original header.
25759 Then, if you want to check that the precompiled header file is always
25760 used, you can put a file of the same name as the original header in this
25761 directory containing an @code{#error} command.
25763 This also works with @option{-include}. So yet another way to use
25764 precompiled headers, good for projects not designed with precompiled
25765 header files in mind, is to simply take most of the header files used by
25766 a project, include them from another header file, precompile that header
25767 file, and @option{-include} the precompiled header. If the header files
25768 have guards against multiple inclusion, they are skipped because
25769 they've already been included (in the precompiled header).
25771 If you need to precompile the same header file for different
25772 languages, targets, or compiler options, you can instead make a
25773 @emph{directory} named like @file{all.h.gch}, and put each precompiled
25774 header in the directory, perhaps using @option{-o}. It doesn't matter
25775 what you call the files in the directory; every precompiled header in
25776 the directory is considered. The first precompiled header
25777 encountered in the directory that is valid for this compilation is
25778 used; they're searched in no particular order.
25780 There are many other possibilities, limited only by your imagination,
25781 good sense, and the constraints of your build system.
25783 A precompiled header file can be used only when these conditions apply:
25787 Only one precompiled header can be used in a particular compilation.
25790 A precompiled header can't be used once the first C token is seen. You
25791 can have preprocessor directives before a precompiled header; you cannot
25792 include a precompiled header from inside another header.
25795 The precompiled header file must be produced for the same language as
25796 the current compilation. You can't use a C precompiled header for a C++
25800 The precompiled header file must have been produced by the same compiler
25801 binary as the current compilation is using.
25804 Any macros defined before the precompiled header is included must
25805 either be defined in the same way as when the precompiled header was
25806 generated, or must not affect the precompiled header, which usually
25807 means that they don't appear in the precompiled header at all.
25809 The @option{-D} option is one way to define a macro before a
25810 precompiled header is included; using a @code{#define} can also do it.
25811 There are also some options that define macros implicitly, like
25812 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
25815 @item If debugging information is output when using the precompiled
25816 header, using @option{-g} or similar, the same kind of debugging information
25817 must have been output when building the precompiled header. However,
25818 a precompiled header built using @option{-g} can be used in a compilation
25819 when no debugging information is being output.
25821 @item The same @option{-m} options must generally be used when building
25822 and using the precompiled header. @xref{Submodel Options},
25823 for any cases where this rule is relaxed.
25825 @item Each of the following options must be the same when building and using
25826 the precompiled header:
25828 @gccoptlist{-fexceptions}
25831 Some other command-line options starting with @option{-f},
25832 @option{-p}, or @option{-O} must be defined in the same way as when
25833 the precompiled header was generated. At present, it's not clear
25834 which options are safe to change and which are not; the safest choice
25835 is to use exactly the same options when generating and using the
25836 precompiled header. The following are known to be safe:
25838 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
25839 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
25840 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
25845 For all of these except the last, the compiler automatically
25846 ignores the precompiled header if the conditions aren't met. If you
25847 find an option combination that doesn't work and doesn't cause the
25848 precompiled header to be ignored, please consider filing a bug report,
25851 If you do use differing options when generating and using the
25852 precompiled header, the actual behavior is a mixture of the
25853 behavior for the options. For instance, if you use @option{-g} to
25854 generate the precompiled header but not when using it, you may or may
25855 not get debugging information for routines in the precompiled header.