1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
3 @c Free Software Foundation, Inc.
4 @c This is part of the GCC manual.
5 @c For copying conditions, see the file gcc.texi.
12 @c man begin COPYRIGHT
13 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
14 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
15 Free Software Foundation, Inc.
17 Permission is granted to copy, distribute and/or modify this document
18 under the terms of the GNU Free Documentation License, Version 1.2 or
19 any later version published by the Free Software Foundation; with the
20 Invariant Sections being ``GNU General Public License'' and ``Funding
21 Free Software'', the Front-Cover texts being (a) (see below), and with
22 the Back-Cover Texts being (b) (see below). A copy of the license is
23 included in the gfdl(7) man page.
25 (a) The FSF's Front-Cover Text is:
29 (b) The FSF's Back-Cover Text is:
31 You have freedom to copy and modify this GNU Manual, like GNU
32 software. Copies published by the Free Software Foundation raise
33 funds for GNU development.
35 @c Set file name and title for the man page.
37 @settitle GNU project C and C++ compiler
39 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
40 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
41 [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
42 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
43 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
44 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
45 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
47 Only the most useful options are listed here; see below for the
48 remainder. @samp{g++} accepts mostly the same options as @samp{gcc}.
51 gpl(7), gfdl(7), fsf-funding(7),
52 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
53 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
54 @file{ld}, @file{binutils} and @file{gdb}.
57 For instructions on reporting bugs, see
61 See the Info entry for @command{gcc}, or
62 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
63 for contributors to GCC@.
68 @chapter GCC Command Options
69 @cindex GCC command options
70 @cindex command options
71 @cindex options, GCC command
73 @c man begin DESCRIPTION
74 When you invoke GCC, it normally does preprocessing, compilation,
75 assembly and linking. The ``overall options'' allow you to stop this
76 process at an intermediate stage. For example, the @option{-c} option
77 says not to run the linker. Then the output consists of object files
78 output by the assembler.
80 Other options are passed on to one stage of processing. Some options
81 control the preprocessor and others the compiler itself. Yet other
82 options control the assembler and linker; most of these are not
83 documented here, since you rarely need to use any of them.
85 @cindex C compilation options
86 Most of the command line options that you can use with GCC are useful
87 for C programs; when an option is only useful with another language
88 (usually C++), the explanation says so explicitly. If the description
89 for a particular option does not mention a source language, you can use
90 that option with all supported languages.
92 @cindex C++ compilation options
93 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
94 options for compiling C++ programs.
96 @cindex grouping options
97 @cindex options, grouping
98 The @command{gcc} program accepts options and file names as operands. Many
99 options have multi-letter names; therefore multiple single-letter options
100 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
103 @cindex order of options
104 @cindex options, order
105 You can mix options and other arguments. For the most part, the order
106 you use doesn't matter. Order does matter when you use several
107 options of the same kind; for example, if you specify @option{-L} more
108 than once, the directories are searched in the order specified. Also,
109 the placement of the @option{-l} option is significant.
111 Many options have long names starting with @samp{-f} or with
112 @samp{-W}---for example,
113 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
114 these have both positive and negative forms; the negative form of
115 @option{-ffoo} would be @option{-fno-foo}. This manual documents
116 only one of these two forms, whichever one is not the default.
120 @xref{Option Index}, for an index to GCC's options.
123 * Option Summary:: Brief list of all options, without explanations.
124 * Overall Options:: Controlling the kind of output:
125 an executable, object files, assembler files,
126 or preprocessed source.
127 * Invoking G++:: Compiling C++ programs.
128 * C Dialect Options:: Controlling the variant of C language compiled.
129 * C++ Dialect Options:: Variations on C++.
130 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
132 * Language Independent Options:: Controlling how diagnostics should be
134 * Warning Options:: How picky should the compiler be?
135 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
136 * Optimize Options:: How much optimization?
137 * Preprocessor Options:: Controlling header files and macro definitions.
138 Also, getting dependency information for Make.
139 * Assembler Options:: Passing options to the assembler.
140 * Link Options:: Specifying libraries and so on.
141 * Directory Options:: Where to find header files and libraries.
142 Where to find the compiler executable files.
143 * Spec Files:: How to pass switches to sub-processes.
144 * Target Options:: Running a cross-compiler, or an old version of GCC.
145 * Submodel Options:: Specifying minor hardware or convention variations,
146 such as 68010 vs 68020.
147 * Code Gen Options:: Specifying conventions for function calls, data layout
149 * Environment Variables:: Env vars that affect GCC.
150 * Precompiled Headers:: Compiling a header once, and using it many times.
156 @section Option Summary
158 Here is a summary of all the options, grouped by type. Explanations are
159 in the following sections.
162 @item Overall Options
163 @xref{Overall Options,,Options Controlling the Kind of Output}.
164 @gccoptlist{-c -S -E -o @var{file} -combine -no-canonical-prefixes @gol
165 -pipe -pass-exit-codes @gol
166 -x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
167 --version -wrapper@@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg}}
169 @item C Language Options
170 @xref{C Dialect Options,,Options Controlling C Dialect}.
171 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
172 -aux-info @var{filename} @gol
173 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
174 -fhosted -ffreestanding -fopenmp -fms-extensions @gol
175 -trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
176 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
177 -fsigned-bitfields -fsigned-char @gol
178 -funsigned-bitfields -funsigned-char}
180 @item C++ Language Options
181 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
182 @gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
183 -fconserve-space -ffriend-injection @gol
184 -fno-elide-constructors @gol
185 -fno-enforce-eh-specs @gol
186 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
187 -fno-implicit-templates @gol
188 -fno-implicit-inline-templates @gol
189 -fno-implement-inlines -fms-extensions @gol
190 -fno-nonansi-builtins -fno-operator-names @gol
191 -fno-optional-diags -fpermissive @gol
192 -fno-pretty-templates @gol
193 -frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
194 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
195 -fno-default-inline -fvisibility-inlines-hidden @gol
196 -fvisibility-ms-compat @gol
197 -Wabi -Wctor-dtor-privacy @gol
198 -Wnon-virtual-dtor -Wreorder @gol
199 -Weffc++ -Wstrict-null-sentinel @gol
200 -Wno-non-template-friend -Wold-style-cast @gol
201 -Woverloaded-virtual -Wno-pmf-conversions @gol
204 @item Objective-C and Objective-C++ Language Options
205 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
206 Objective-C and Objective-C++ Dialects}.
207 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
208 -fgnu-runtime -fnext-runtime @gol
209 -fno-nil-receivers @gol
210 -fobjc-call-cxx-cdtors @gol
211 -fobjc-direct-dispatch @gol
212 -fobjc-exceptions @gol
214 -freplace-objc-classes @gol
217 -Wassign-intercept @gol
218 -Wno-protocol -Wselector @gol
219 -Wstrict-selector-match @gol
220 -Wundeclared-selector}
222 @item Language Independent Options
223 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
224 @gccoptlist{-fmessage-length=@var{n} @gol
225 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
226 -fdiagnostics-show-option}
228 @item Warning Options
229 @xref{Warning Options,,Options to Request or Suppress Warnings}.
230 @gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol
231 -w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
232 -Wno-attributes -Wno-builtin-macro-redefined @gol
233 -Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual @gol
234 -Wchar-subscripts -Wclobbered -Wcomment @gol
235 -Wconversion -Wcoverage-mismatch -Wno-deprecated @gol
236 -Wno-deprecated-declarations -Wdisabled-optimization @gol
237 -Wno-div-by-zero -Wempty-body -Wenum-compare -Wno-endif-labels @gol
238 -Werror -Werror=* @gol
239 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
240 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
241 -Wformat-security -Wformat-y2k @gol
242 -Wframe-larger-than=@var{len} -Wjump-misses-init -Wignored-qualifiers @gol
243 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
244 -Winit-self -Winline @gol
245 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
246 -Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
247 -Wlogical-op -Wlong-long @gol
248 -Wmain -Wmissing-braces -Wmissing-field-initializers @gol
249 -Wmissing-format-attribute -Wmissing-include-dirs @gol
250 -Wmissing-noreturn -Wno-mudflap @gol
251 -Wno-multichar -Wnonnull -Wno-overflow @gol
252 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
253 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
254 -Wpointer-arith -Wno-pointer-to-int-cast @gol
255 -Wredundant-decls @gol
256 -Wreturn-type -Wsequence-point -Wshadow @gol
257 -Wsign-compare -Wsign-conversion -Wstack-protector @gol
258 -Wstrict-aliasing -Wstrict-aliasing=n @gol
259 -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
260 -Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol
261 -Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized @gol
262 -Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol
263 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
264 -Wunused-label -Wunused-parameter -Wno-unused-result -Wunused-value -Wunused-variable @gol
265 -Wvariadic-macros -Wvla @gol
266 -Wvolatile-register-var -Wwrite-strings}
268 @item C and Objective-C-only Warning Options
269 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
270 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
271 -Wold-style-declaration -Wold-style-definition @gol
272 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
273 -Wdeclaration-after-statement -Wpointer-sign}
275 @item Debugging Options
276 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
277 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
278 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
279 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
280 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
281 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
282 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
283 -fdump-statistics @gol
285 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
286 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
287 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
289 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
290 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
291 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
292 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
293 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
294 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
295 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
296 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
297 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
298 -fdump-tree-nrv -fdump-tree-vect @gol
299 -fdump-tree-sink @gol
300 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
301 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
302 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
303 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
304 -ftree-vectorizer-verbose=@var{n} @gol
305 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
306 -fdump-final-insns=@var{file} @gol
307 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
308 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
309 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
310 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
311 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
312 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
313 -ftest-coverage -ftime-report -fvar-tracking @gol
314 -g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
315 -ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol
316 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
317 -fdebug-prefix-map=@var{old}=@var{new} @gol
318 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
319 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
320 -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
321 -print-multi-directory -print-multi-lib @gol
322 -print-prog-name=@var{program} -print-search-dirs -Q @gol
323 -print-sysroot -print-sysroot-headers-suffix @gol
324 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
326 @item Optimization Options
327 @xref{Optimize Options,,Options that Control Optimization}.
329 -falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol
330 -falign-labels[=@var{n}] -falign-loops[=@var{n}] -fassociative-math @gol
331 -fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize @gol
332 -fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves @gol
333 -fcheck-data-deps -fconserve-stack -fcprop-registers -fcrossjumping @gol
334 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules -fcx-limited-range @gol
335 -fdata-sections -fdce -fdce @gol
336 -fdelayed-branch -fdelete-null-pointer-checks -fdse -fdse @gol
337 -fearly-inlining -fexpensive-optimizations -ffast-math @gol
338 -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
339 -fforward-propagate -ffunction-sections @gol
340 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm @gol
341 -fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
342 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
343 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg -fipa-pta @gol
344 -fipa-pure-const -fipa-reference -fipa-struct-reorg @gol
345 -fipa-type-escape -fira-algorithm=@var{algorithm} @gol
346 -fira-region=@var{region} -fira-coalesce -fno-ira-share-save-slots @gol
347 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
348 -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
349 -floop-block -floop-interchange -floop-strip-mine -fgraphite-identity @gol
350 -floop-parallelize-all @gol
351 -fmerge-all-constants -fmerge-constants -fmodulo-sched @gol
352 -fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap @gol
353 -fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline @gol
354 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
355 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
356 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
357 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
358 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
359 -fpeel-loops -fpredictive-commoning -fprefetch-loop-arrays @gol
360 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
361 -fprofile-generate=@var{path} @gol
362 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
363 -freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
364 -freorder-blocks-and-partition -freorder-functions @gol
365 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
366 -frounding-math -fsched2-use-superblocks @gol
367 -fsched2-use-traces -fsched-spec-load -fsched-spec-load-dangerous @gol
368 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
369 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
370 -fsched-spec-insn-heuristic -fsched-reg-pressure-heuristic @gol
371 -fsched-rank-heuristic -fsched-last-insn-heuristic @gol
372 -fsched-dep-count-heuristic @gol
373 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
374 -fselective-scheduling -fselective-scheduling2 @gol
375 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
376 -fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
377 -fsplit-wide-types -fstack-protector -fstack-protector-all @gol
378 -fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
379 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
380 -ftree-copyrename -ftree-dce @gol
381 -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-im @gol
382 -ftree-phiprop -ftree-loop-distribution @gol
383 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
384 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
385 -ftree-sink -ftree-sra -ftree-switch-conversion @gol
386 -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
387 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
388 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
389 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
391 --param @var{name}=@var{value}
392 -O -O0 -O1 -O2 -O3 -Os}
394 @item Preprocessor Options
395 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
396 @gccoptlist{-A@var{question}=@var{answer} @gol
397 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
398 -C -dD -dI -dM -dN @gol
399 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
400 -idirafter @var{dir} @gol
401 -include @var{file} -imacros @var{file} @gol
402 -iprefix @var{file} -iwithprefix @var{dir} @gol
403 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
404 -imultilib @var{dir} -isysroot @var{dir} @gol
405 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
406 -P -fworking-directory -remap @gol
407 -trigraphs -undef -U@var{macro} -Wp,@var{option} @gol
408 -Xpreprocessor @var{option}}
410 @item Assembler Option
411 @xref{Assembler Options,,Passing Options to the Assembler}.
412 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
415 @xref{Link Options,,Options for Linking}.
416 @gccoptlist{@var{object-file-name} -l@var{library} @gol
417 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
418 -s -static -static-libgcc -static-libstdc++ -shared @gol
419 -shared-libgcc -symbolic @gol
420 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
423 @item Directory Options
424 @xref{Directory Options,,Options for Directory Search}.
425 @gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir}
426 -specs=@var{file} -I- --sysroot=@var{dir}}
429 @c I wrote this xref this way to avoid overfull hbox. -- rms
430 @xref{Target Options}.
431 @gccoptlist{-V @var{version} -b @var{machine}}
433 @item Machine Dependent Options
434 @xref{Submodel Options,,Hardware Models and Configurations}.
435 @c This list is ordered alphanumerically by subsection name.
436 @c Try and put the significant identifier (CPU or system) first,
437 @c so users have a clue at guessing where the ones they want will be.
440 @gccoptlist{-EB -EL @gol
441 -mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol
442 -mdata=@var{data-section} -mrodata=@var{readonly-data-section}}
445 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
446 -mabi=@var{name} @gol
447 -mapcs-stack-check -mno-apcs-stack-check @gol
448 -mapcs-float -mno-apcs-float @gol
449 -mapcs-reentrant -mno-apcs-reentrant @gol
450 -msched-prolog -mno-sched-prolog @gol
451 -mlittle-endian -mbig-endian -mwords-little-endian @gol
452 -mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol
453 -mfp16-format=@var{name}
454 -mthumb-interwork -mno-thumb-interwork @gol
455 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
456 -mstructure-size-boundary=@var{n} @gol
457 -mabort-on-noreturn @gol
458 -mlong-calls -mno-long-calls @gol
459 -msingle-pic-base -mno-single-pic-base @gol
460 -mpic-register=@var{reg} @gol
461 -mnop-fun-dllimport @gol
462 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
463 -mpoke-function-name @gol
465 -mtpcs-frame -mtpcs-leaf-frame @gol
466 -mcaller-super-interworking -mcallee-super-interworking @gol
468 -mword-relocations @gol
469 -mfix-cortex-m3-ldrd}
472 @gccoptlist{-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol
473 -mcall-prologues -mtiny-stack -mint8}
475 @emph{Blackfin Options}
476 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
477 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
478 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
479 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
480 -mno-id-shared-library -mshared-library-id=@var{n} @gol
481 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
482 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
483 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
487 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
488 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
489 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
490 -mstack-align -mdata-align -mconst-align @gol
491 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
492 -melf -maout -melinux -mlinux -sim -sim2 @gol
493 -mmul-bug-workaround -mno-mul-bug-workaround}
496 @gccoptlist{-mmac -mpush-args}
498 @emph{Darwin Options}
499 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
500 -arch_only -bind_at_load -bundle -bundle_loader @gol
501 -client_name -compatibility_version -current_version @gol
503 -dependency-file -dylib_file -dylinker_install_name @gol
504 -dynamic -dynamiclib -exported_symbols_list @gol
505 -filelist -flat_namespace -force_cpusubtype_ALL @gol
506 -force_flat_namespace -headerpad_max_install_names @gol
508 -image_base -init -install_name -keep_private_externs @gol
509 -multi_module -multiply_defined -multiply_defined_unused @gol
510 -noall_load -no_dead_strip_inits_and_terms @gol
511 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
512 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
513 -private_bundle -read_only_relocs -sectalign @gol
514 -sectobjectsymbols -whyload -seg1addr @gol
515 -sectcreate -sectobjectsymbols -sectorder @gol
516 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
517 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
518 -segprot -segs_read_only_addr -segs_read_write_addr @gol
519 -single_module -static -sub_library -sub_umbrella @gol
520 -twolevel_namespace -umbrella -undefined @gol
521 -unexported_symbols_list -weak_reference_mismatches @gol
522 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
523 -mkernel -mone-byte-bool}
525 @emph{DEC Alpha Options}
526 @gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol
527 -mieee -mieee-with-inexact -mieee-conformant @gol
528 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
529 -mtrap-precision=@var{mode} -mbuild-constants @gol
530 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
531 -mbwx -mmax -mfix -mcix @gol
532 -mfloat-vax -mfloat-ieee @gol
533 -mexplicit-relocs -msmall-data -mlarge-data @gol
534 -msmall-text -mlarge-text @gol
535 -mmemory-latency=@var{time}}
537 @emph{DEC Alpha/VMS Options}
538 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix}}
541 @gccoptlist{-msmall-model -mno-lsim}
544 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
545 -mhard-float -msoft-float @gol
546 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
547 -mdouble -mno-double @gol
548 -mmedia -mno-media -mmuladd -mno-muladd @gol
549 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
550 -mlinked-fp -mlong-calls -malign-labels @gol
551 -mlibrary-pic -macc-4 -macc-8 @gol
552 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
553 -moptimize-membar -mno-optimize-membar @gol
554 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
555 -mvliw-branch -mno-vliw-branch @gol
556 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
557 -mno-nested-cond-exec -mtomcat-stats @gol
561 @emph{GNU/Linux Options}
562 @gccoptlist{-muclibc}
564 @emph{H8/300 Options}
565 @gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300}
568 @gccoptlist{-march=@var{architecture-type} @gol
569 -mbig-switch -mdisable-fpregs -mdisable-indexing @gol
570 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
571 -mfixed-range=@var{register-range} @gol
572 -mjump-in-delay -mlinker-opt -mlong-calls @gol
573 -mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
574 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
575 -mno-jump-in-delay -mno-long-load-store @gol
576 -mno-portable-runtime -mno-soft-float @gol
577 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
578 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
579 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
580 -munix=@var{unix-std} -nolibdld -static -threads}
582 @emph{i386 and x86-64 Options}
583 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
584 -mfpmath=@var{unit} @gol
585 -masm=@var{dialect} -mno-fancy-math-387 @gol
586 -mno-fp-ret-in-387 -msoft-float @gol
587 -mno-wide-multiply -mrtd -malign-double @gol
588 -mpreferred-stack-boundary=@var{num}
589 -mincoming-stack-boundary=@var{num}
590 -mcld -mcx16 -msahf -mmovbe -mcrc32 -mrecip @gol
591 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
593 -msse4a -m3dnow -mpopcnt -mabm -msse5 @gol
594 -mthreads -mno-align-stringops -minline-all-stringops @gol
595 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
596 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
597 -m96bit-long-double -mregparm=@var{num} -msseregparm @gol
598 -mveclibabi=@var{type} -mpc32 -mpc64 -mpc80 -mstackrealign @gol
599 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
600 -mcmodel=@var{code-model} -mabi=@var{name} @gol
601 -m32 -m64 -mlarge-data-threshold=@var{num} @gol
602 -mfused-madd -mno-fused-madd -msse2avx}
605 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
606 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
607 -mconstant-gp -mauto-pic -mfused-madd @gol
608 -minline-float-divide-min-latency @gol
609 -minline-float-divide-max-throughput @gol
610 -mno-inline-float-divide @gol
611 -minline-int-divide-min-latency @gol
612 -minline-int-divide-max-throughput @gol
613 -mno-inline-int-divide @gol
614 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
615 -mno-inline-sqrt @gol
616 -mdwarf2-asm -mearly-stop-bits @gol
617 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
618 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
619 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
620 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
621 -msched-spec-ldc -msched-spec-control-ldc @gol
622 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
623 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
624 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
625 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
627 @emph{M32R/D Options}
628 @gccoptlist{-m32r2 -m32rx -m32r @gol
630 -malign-loops -mno-align-loops @gol
631 -missue-rate=@var{number} @gol
632 -mbranch-cost=@var{number} @gol
633 -mmodel=@var{code-size-model-type} @gol
634 -msdata=@var{sdata-type} @gol
635 -mno-flush-func -mflush-func=@var{name} @gol
636 -mno-flush-trap -mflush-trap=@var{number} @gol
640 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
642 @emph{M680x0 Options}
643 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
644 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
645 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
646 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
647 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
648 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
649 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
650 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
653 @emph{M68hc1x Options}
654 @gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol
655 -mauto-incdec -minmax -mlong-calls -mshort @gol
656 -msoft-reg-count=@var{count}}
659 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
660 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
661 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
662 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
663 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
666 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
667 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
668 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
669 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
673 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
674 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 @gol
675 -mips64 -mips64r2 @gol
676 -mips16 -mno-mips16 -mflip-mips16 @gol
677 -minterlink-mips16 -mno-interlink-mips16 @gol
678 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
679 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
680 -mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float @gol
681 -msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
682 -mfpu=@var{fpu-type} @gol
683 -msmartmips -mno-smartmips @gol
684 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
685 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
686 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
687 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
688 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
689 -membedded-data -mno-embedded-data @gol
690 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
691 -mcode-readable=@var{setting} @gol
692 -msplit-addresses -mno-split-addresses @gol
693 -mexplicit-relocs -mno-explicit-relocs @gol
694 -mcheck-zero-division -mno-check-zero-division @gol
695 -mdivide-traps -mdivide-breaks @gol
696 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
697 -mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol
698 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
699 -mfix-r10000 -mno-fix-r10000 -mfix-vr4120 -mno-fix-vr4120 @gol
700 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
701 -mflush-func=@var{func} -mno-flush-func @gol
702 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
703 -mfp-exceptions -mno-fp-exceptions @gol
704 -mvr4130-align -mno-vr4130-align -msynci -mno-synci}
707 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
708 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
709 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
710 -mno-base-addresses -msingle-exit -mno-single-exit}
712 @emph{MN10300 Options}
713 @gccoptlist{-mmult-bug -mno-mult-bug @gol
714 -mam33 -mno-am33 @gol
715 -mam33-2 -mno-am33-2 @gol
716 -mreturn-pointer-on-d0 @gol
719 @emph{PDP-11 Options}
720 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
721 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
722 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
723 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
724 -mbranch-expensive -mbranch-cheap @gol
725 -msplit -mno-split -munix-asm -mdec-asm}
727 @emph{picoChip Options}
728 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N}
729 -msymbol-as-address -mno-inefficient-warnings}
731 @emph{PowerPC Options}
732 See RS/6000 and PowerPC Options.
734 @emph{RS/6000 and PowerPC Options}
735 @gccoptlist{-mcpu=@var{cpu-type} @gol
736 -mtune=@var{cpu-type} @gol
737 -mpower -mno-power -mpower2 -mno-power2 @gol
738 -mpowerpc -mpowerpc64 -mno-powerpc @gol
739 -maltivec -mno-altivec @gol
740 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
741 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
742 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
743 -mfprnd -mno-fprnd @gol
744 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
745 -mnew-mnemonics -mold-mnemonics @gol
746 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
747 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
748 -malign-power -malign-natural @gol
749 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
750 -msingle-float -mdouble-float -msimple-fpu @gol
751 -mstring -mno-string -mupdate -mno-update @gol
752 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
753 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
754 -mstrict-align -mno-strict-align -mrelocatable @gol
755 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
756 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
757 -mdynamic-no-pic -maltivec -mswdiv @gol
758 -mprioritize-restricted-insns=@var{priority} @gol
759 -msched-costly-dep=@var{dependence_type} @gol
760 -minsert-sched-nops=@var{scheme} @gol
761 -mcall-sysv -mcall-netbsd @gol
762 -maix-struct-return -msvr4-struct-return @gol
763 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
764 -misel -mno-isel @gol
765 -misel=yes -misel=no @gol
767 -mspe=yes -mspe=no @gol
769 -mgen-cell-microcode -mwarn-cell-microcode @gol
770 -mvrsave -mno-vrsave @gol
771 -mmulhw -mno-mulhw @gol
772 -mdlmzb -mno-dlmzb @gol
773 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
774 -mprototype -mno-prototype @gol
775 -msim -mmvme -mads -myellowknife -memb -msdata @gol
776 -msdata=@var{opt} -mvxworks -G @var{num} -pthread}
778 @emph{S/390 and zSeries Options}
779 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
780 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
781 -mlong-double-64 -mlong-double-128 @gol
782 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
783 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
784 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
785 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
786 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard}
789 @gccoptlist{-meb -mel @gol
793 -mscore5 -mscore5u -mscore7 -mscore7d}
796 @gccoptlist{-m1 -m2 -m2e @gol
797 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
799 -m4-nofpu -m4-single-only -m4-single -m4 @gol
800 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
801 -m5-64media -m5-64media-nofpu @gol
802 -m5-32media -m5-32media-nofpu @gol
803 -m5-compact -m5-compact-nofpu @gol
804 -mb -ml -mdalign -mrelax @gol
805 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
806 -mieee -mbitops -misize -minline-ic_invalidate -mpadstruct -mspace @gol
807 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
808 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
809 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
813 @gccoptlist{-mcpu=@var{cpu-type} @gol
814 -mtune=@var{cpu-type} @gol
815 -mcmodel=@var{code-model} @gol
816 -m32 -m64 -mapp-regs -mno-app-regs @gol
817 -mfaster-structs -mno-faster-structs @gol
818 -mfpu -mno-fpu -mhard-float -msoft-float @gol
819 -mhard-quad-float -msoft-quad-float @gol
820 -mimpure-text -mno-impure-text -mlittle-endian @gol
821 -mstack-bias -mno-stack-bias @gol
822 -munaligned-doubles -mno-unaligned-doubles @gol
823 -mv8plus -mno-v8plus -mvis -mno-vis
824 -threads -pthreads -pthread}
827 @gccoptlist{-mwarn-reloc -merror-reloc @gol
828 -msafe-dma -munsafe-dma @gol
830 -msmall-mem -mlarge-mem -mstdmain @gol
831 -mfixed-range=@var{register-range}}
833 @emph{System V Options}
834 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
837 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
838 -mprolog-function -mno-prolog-function -mspace @gol
839 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
840 -mapp-regs -mno-app-regs @gol
841 -mdisable-callt -mno-disable-callt @gol
847 @gccoptlist{-mg -mgnu -munix}
849 @emph{VxWorks Options}
850 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
851 -Xbind-lazy -Xbind-now}
853 @emph{x86-64 Options}
854 See i386 and x86-64 Options.
856 @emph{i386 and x86-64 Windows Options}
857 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll
858 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows}
860 @emph{Xstormy16 Options}
863 @emph{Xtensa Options}
864 @gccoptlist{-mconst16 -mno-const16 @gol
865 -mfused-madd -mno-fused-madd @gol
866 -mserialize-volatile -mno-serialize-volatile @gol
867 -mtext-section-literals -mno-text-section-literals @gol
868 -mtarget-align -mno-target-align @gol
869 -mlongcalls -mno-longcalls}
871 @emph{zSeries Options}
872 See S/390 and zSeries Options.
874 @item Code Generation Options
875 @xref{Code Gen Options,,Options for Code Generation Conventions}.
876 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
877 -ffixed-@var{reg} -fexceptions @gol
878 -fnon-call-exceptions -funwind-tables @gol
879 -fasynchronous-unwind-tables @gol
880 -finhibit-size-directive -finstrument-functions @gol
881 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
882 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
883 -fno-common -fno-ident @gol
884 -fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
885 -fno-jump-tables @gol
886 -frecord-gcc-switches @gol
887 -freg-struct-return -fshort-enums @gol
888 -fshort-double -fshort-wchar @gol
889 -fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
890 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
891 -fno-stack-limit -fargument-alias -fargument-noalias @gol
892 -fargument-noalias-global -fargument-noalias-anything @gol
893 -fleading-underscore -ftls-model=@var{model} @gol
894 -ftrapv -fwrapv -fbounds-check @gol
899 * Overall Options:: Controlling the kind of output:
900 an executable, object files, assembler files,
901 or preprocessed source.
902 * C Dialect Options:: Controlling the variant of C language compiled.
903 * C++ Dialect Options:: Variations on C++.
904 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
906 * Language Independent Options:: Controlling how diagnostics should be
908 * Warning Options:: How picky should the compiler be?
909 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
910 * Optimize Options:: How much optimization?
911 * Preprocessor Options:: Controlling header files and macro definitions.
912 Also, getting dependency information for Make.
913 * Assembler Options:: Passing options to the assembler.
914 * Link Options:: Specifying libraries and so on.
915 * Directory Options:: Where to find header files and libraries.
916 Where to find the compiler executable files.
917 * Spec Files:: How to pass switches to sub-processes.
918 * Target Options:: Running a cross-compiler, or an old version of GCC.
921 @node Overall Options
922 @section Options Controlling the Kind of Output
924 Compilation can involve up to four stages: preprocessing, compilation
925 proper, assembly and linking, always in that order. GCC is capable of
926 preprocessing and compiling several files either into several
927 assembler input files, or into one assembler input file; then each
928 assembler input file produces an object file, and linking combines all
929 the object files (those newly compiled, and those specified as input)
930 into an executable file.
932 @cindex file name suffix
933 For any given input file, the file name suffix determines what kind of
938 C source code which must be preprocessed.
941 C source code which should not be preprocessed.
944 C++ source code which should not be preprocessed.
947 Objective-C source code. Note that you must link with the @file{libobjc}
948 library to make an Objective-C program work.
951 Objective-C source code which should not be preprocessed.
955 Objective-C++ source code. Note that you must link with the @file{libobjc}
956 library to make an Objective-C++ program work. Note that @samp{.M} refers
957 to a literal capital M@.
960 Objective-C++ source code which should not be preprocessed.
963 C, C++, Objective-C or Objective-C++ header file to be turned into a
968 @itemx @var{file}.cxx
969 @itemx @var{file}.cpp
970 @itemx @var{file}.CPP
971 @itemx @var{file}.c++
973 C++ source code which must be preprocessed. Note that in @samp{.cxx},
974 the last two letters must both be literally @samp{x}. Likewise,
975 @samp{.C} refers to a literal capital C@.
979 Objective-C++ source code which must be preprocessed.
982 Objective-C++ source code which should not be preprocessed.
987 @itemx @var{file}.hxx
988 @itemx @var{file}.hpp
989 @itemx @var{file}.HPP
990 @itemx @var{file}.h++
991 @itemx @var{file}.tcc
992 C++ header file to be turned into a precompiled header.
995 @itemx @var{file}.for
996 @itemx @var{file}.ftn
997 Fixed form Fortran source code which should not be preprocessed.
1000 @itemx @var{file}.FOR
1001 @itemx @var{file}.fpp
1002 @itemx @var{file}.FPP
1003 @itemx @var{file}.FTN
1004 Fixed form Fortran source code which must be preprocessed (with the traditional
1007 @item @var{file}.f90
1008 @itemx @var{file}.f95
1009 @itemx @var{file}.f03
1010 @itemx @var{file}.f08
1011 Free form Fortran source code which should not be preprocessed.
1013 @item @var{file}.F90
1014 @itemx @var{file}.F95
1015 @itemx @var{file}.F03
1016 @itemx @var{file}.F08
1017 Free form Fortran source code which must be preprocessed (with the
1018 traditional preprocessor).
1020 @c FIXME: Descriptions of Java file types.
1026 @item @var{file}.ads
1027 Ada source code file which contains a library unit declaration (a
1028 declaration of a package, subprogram, or generic, or a generic
1029 instantiation), or a library unit renaming declaration (a package,
1030 generic, or subprogram renaming declaration). Such files are also
1033 @item @var{file}.adb
1034 Ada source code file containing a library unit body (a subprogram or
1035 package body). Such files are also called @dfn{bodies}.
1037 @c GCC also knows about some suffixes for languages not yet included:
1048 @itemx @var{file}.sx
1049 Assembler code which must be preprocessed.
1052 An object file to be fed straight into linking.
1053 Any file name with no recognized suffix is treated this way.
1057 You can specify the input language explicitly with the @option{-x} option:
1060 @item -x @var{language}
1061 Specify explicitly the @var{language} for the following input files
1062 (rather than letting the compiler choose a default based on the file
1063 name suffix). This option applies to all following input files until
1064 the next @option{-x} option. Possible values for @var{language} are:
1066 c c-header c-cpp-output
1067 c++ c++-header c++-cpp-output
1068 objective-c objective-c-header objective-c-cpp-output
1069 objective-c++ objective-c++-header objective-c++-cpp-output
1070 assembler assembler-with-cpp
1072 f77 f77-cpp-input f95 f95-cpp-input
1077 Turn off any specification of a language, so that subsequent files are
1078 handled according to their file name suffixes (as they are if @option{-x}
1079 has not been used at all).
1081 @item -pass-exit-codes
1082 @opindex pass-exit-codes
1083 Normally the @command{gcc} program will exit with the code of 1 if any
1084 phase of the compiler returns a non-success return code. If you specify
1085 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
1086 numerically highest error produced by any phase that returned an error
1087 indication. The C, C++, and Fortran frontends return 4, if an internal
1088 compiler error is encountered.
1091 If you only want some of the stages of compilation, you can use
1092 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1093 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1094 @command{gcc} is to stop. Note that some combinations (for example,
1095 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1100 Compile or assemble the source files, but do not link. The linking
1101 stage simply is not done. The ultimate output is in the form of an
1102 object file for each source file.
1104 By default, the object file name for a source file is made by replacing
1105 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1107 Unrecognized input files, not requiring compilation or assembly, are
1112 Stop after the stage of compilation proper; do not assemble. The output
1113 is in the form of an assembler code file for each non-assembler input
1116 By default, the assembler file name for a source file is made by
1117 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1119 Input files that don't require compilation are ignored.
1123 Stop after the preprocessing stage; do not run the compiler proper. The
1124 output is in the form of preprocessed source code, which is sent to the
1127 Input files which don't require preprocessing are ignored.
1129 @cindex output file option
1132 Place output in file @var{file}. This applies regardless to whatever
1133 sort of output is being produced, whether it be an executable file,
1134 an object file, an assembler file or preprocessed C code.
1136 If @option{-o} is not specified, the default is to put an executable
1137 file in @file{a.out}, the object file for
1138 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1139 assembler file in @file{@var{source}.s}, a precompiled header file in
1140 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1145 Print (on standard error output) the commands executed to run the stages
1146 of compilation. Also print the version number of the compiler driver
1147 program and of the preprocessor and the compiler proper.
1151 Like @option{-v} except the commands are not executed and all command
1152 arguments are quoted. This is useful for shell scripts to capture the
1153 driver-generated command lines.
1157 Use pipes rather than temporary files for communication between the
1158 various stages of compilation. This fails to work on some systems where
1159 the assembler is unable to read from a pipe; but the GNU assembler has
1164 If you are compiling multiple source files, this option tells the driver
1165 to pass all the source files to the compiler at once (for those
1166 languages for which the compiler can handle this). This will allow
1167 intermodule analysis (IMA) to be performed by the compiler. Currently the only
1168 language for which this is supported is C@. If you pass source files for
1169 multiple languages to the driver, using this option, the driver will invoke
1170 the compiler(s) that support IMA once each, passing each compiler all the
1171 source files appropriate for it. For those languages that do not support
1172 IMA this option will be ignored, and the compiler will be invoked once for
1173 each source file in that language. If you use this option in conjunction
1174 with @option{-save-temps}, the compiler will generate multiple
1176 (one for each source file), but only one (combined) @file{.o} or
1181 Print (on the standard output) a description of the command line options
1182 understood by @command{gcc}. If the @option{-v} option is also specified
1183 then @option{--help} will also be passed on to the various processes
1184 invoked by @command{gcc}, so that they can display the command line options
1185 they accept. If the @option{-Wextra} option has also been specified
1186 (prior to the @option{--help} option), then command line options which
1187 have no documentation associated with them will also be displayed.
1190 @opindex target-help
1191 Print (on the standard output) a description of target-specific command
1192 line options for each tool. For some targets extra target-specific
1193 information may also be printed.
1195 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1196 Print (on the standard output) a description of the command line
1197 options understood by the compiler that fit into all specified classes
1198 and qualifiers. These are the supported classes:
1201 @item @samp{optimizers}
1202 This will display all of the optimization options supported by the
1205 @item @samp{warnings}
1206 This will display all of the options controlling warning messages
1207 produced by the compiler.
1210 This will display target-specific options. Unlike the
1211 @option{--target-help} option however, target-specific options of the
1212 linker and assembler will not be displayed. This is because those
1213 tools do not currently support the extended @option{--help=} syntax.
1216 This will display the values recognized by the @option{--param}
1219 @item @var{language}
1220 This will display the options supported for @var{language}, where
1221 @var{language} is the name of one of the languages supported in this
1225 This will display the options that are common to all languages.
1228 These are the supported qualifiers:
1231 @item @samp{undocumented}
1232 Display only those options which are undocumented.
1235 Display options which take an argument that appears after an equal
1236 sign in the same continuous piece of text, such as:
1237 @samp{--help=target}.
1239 @item @samp{separate}
1240 Display options which take an argument that appears as a separate word
1241 following the original option, such as: @samp{-o output-file}.
1244 Thus for example to display all the undocumented target-specific
1245 switches supported by the compiler the following can be used:
1248 --help=target,undocumented
1251 The sense of a qualifier can be inverted by prefixing it with the
1252 @samp{^} character, so for example to display all binary warning
1253 options (i.e., ones that are either on or off and that do not take an
1254 argument), which have a description the following can be used:
1257 --help=warnings,^joined,^undocumented
1260 The argument to @option{--help=} should not consist solely of inverted
1263 Combining several classes is possible, although this usually
1264 restricts the output by so much that there is nothing to display. One
1265 case where it does work however is when one of the classes is
1266 @var{target}. So for example to display all the target-specific
1267 optimization options the following can be used:
1270 --help=target,optimizers
1273 The @option{--help=} option can be repeated on the command line. Each
1274 successive use will display its requested class of options, skipping
1275 those that have already been displayed.
1277 If the @option{-Q} option appears on the command line before the
1278 @option{--help=} option, then the descriptive text displayed by
1279 @option{--help=} is changed. Instead of describing the displayed
1280 options, an indication is given as to whether the option is enabled,
1281 disabled or set to a specific value (assuming that the compiler
1282 knows this at the point where the @option{--help=} option is used).
1284 Here is a truncated example from the ARM port of @command{gcc}:
1287 % gcc -Q -mabi=2 --help=target -c
1288 The following options are target specific:
1290 -mabort-on-noreturn [disabled]
1294 The output is sensitive to the effects of previous command line
1295 options, so for example it is possible to find out which optimizations
1296 are enabled at @option{-O2} by using:
1299 -Q -O2 --help=optimizers
1302 Alternatively you can discover which binary optimizations are enabled
1303 by @option{-O3} by using:
1306 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1307 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1308 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1311 @item -no-canonical-prefixes
1312 @opindex no-canonical-prefixes
1313 Do not expand any symbolic links, resolve references to @samp{/../}
1314 or @samp{/./}, or make the path absolute when generating a relative
1319 Display the version number and copyrights of the invoked GCC@.
1323 Invoke all subcommands under a wrapper program. It takes a single
1324 comma separated list as an argument, which will be used to invoke
1328 gcc -c t.c -wrapper gdb,--args
1331 This will invoke all subprograms of gcc under "gdb --args",
1332 thus cc1 invocation will be "gdb --args cc1 ...".
1334 @item -fplugin=@var{name}.so
1335 Load the plugin code in file @var{name}.so, assumed to be a
1336 shared object to be dlopen'd by the compiler. The base name of
1337 the shared object file is used to identify the plugin for the
1338 purposes of argument parsing (See
1339 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1340 Each plugin should define the callback functions specified in the
1343 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1344 Define an argument called @var{key} with a value of @var{value}
1345 for the plugin called @var{name}.
1347 @include @value{srcdir}/../libiberty/at-file.texi
1351 @section Compiling C++ Programs
1353 @cindex suffixes for C++ source
1354 @cindex C++ source file suffixes
1355 C++ source files conventionally use one of the suffixes @samp{.C},
1356 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1357 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1358 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1359 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1360 files with these names and compiles them as C++ programs even if you
1361 call the compiler the same way as for compiling C programs (usually
1362 with the name @command{gcc}).
1366 However, the use of @command{gcc} does not add the C++ library.
1367 @command{g++} is a program that calls GCC and treats @samp{.c},
1368 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1369 files unless @option{-x} is used, and automatically specifies linking
1370 against the C++ library. This program is also useful when
1371 precompiling a C header file with a @samp{.h} extension for use in C++
1372 compilations. On many systems, @command{g++} is also installed with
1373 the name @command{c++}.
1375 @cindex invoking @command{g++}
1376 When you compile C++ programs, you may specify many of the same
1377 command-line options that you use for compiling programs in any
1378 language; or command-line options meaningful for C and related
1379 languages; or options that are meaningful only for C++ programs.
1380 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1381 explanations of options for languages related to C@.
1382 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1383 explanations of options that are meaningful only for C++ programs.
1385 @node C Dialect Options
1386 @section Options Controlling C Dialect
1387 @cindex dialect options
1388 @cindex language dialect options
1389 @cindex options, dialect
1391 The following options control the dialect of C (or languages derived
1392 from C, such as C++, Objective-C and Objective-C++) that the compiler
1396 @cindex ANSI support
1400 In C mode, this is equivalent to @samp{-std=c89}. In C++ mode, it is
1401 equivalent to @samp{-std=c++98}.
1403 This turns off certain features of GCC that are incompatible with ISO
1404 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1405 such as the @code{asm} and @code{typeof} keywords, and
1406 predefined macros such as @code{unix} and @code{vax} that identify the
1407 type of system you are using. It also enables the undesirable and
1408 rarely used ISO trigraph feature. For the C compiler,
1409 it disables recognition of C++ style @samp{//} comments as well as
1410 the @code{inline} keyword.
1412 The alternate keywords @code{__asm__}, @code{__extension__},
1413 @code{__inline__} and @code{__typeof__} continue to work despite
1414 @option{-ansi}. You would not want to use them in an ISO C program, of
1415 course, but it is useful to put them in header files that might be included
1416 in compilations done with @option{-ansi}. Alternate predefined macros
1417 such as @code{__unix__} and @code{__vax__} are also available, with or
1418 without @option{-ansi}.
1420 The @option{-ansi} option does not cause non-ISO programs to be
1421 rejected gratuitously. For that, @option{-pedantic} is required in
1422 addition to @option{-ansi}. @xref{Warning Options}.
1424 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1425 option is used. Some header files may notice this macro and refrain
1426 from declaring certain functions or defining certain macros that the
1427 ISO standard doesn't call for; this is to avoid interfering with any
1428 programs that might use these names for other things.
1430 Functions that would normally be built in but do not have semantics
1431 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1432 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1433 built-in functions provided by GCC}, for details of the functions
1438 Determine the language standard. @xref{Standards,,Language Standards
1439 Supported by GCC}, for details of these standard versions. This option
1440 is currently only supported when compiling C or C++.
1442 The compiler can accept several base standards, such as @samp{c89} or
1443 @samp{c++98}, and GNU dialects of those standards, such as
1444 @samp{gnu89} or @samp{gnu++98}. By specifying a base standard, the
1445 compiler will accept all programs following that standard and those
1446 using GNU extensions that do not contradict it. For example,
1447 @samp{-std=c89} turns off certain features of GCC that are
1448 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1449 keywords, but not other GNU extensions that do not have a meaning in
1450 ISO C90, such as omitting the middle term of a @code{?:}
1451 expression. On the other hand, by specifying a GNU dialect of a
1452 standard, all features the compiler support are enabled, even when
1453 those features change the meaning of the base standard and some
1454 strict-conforming programs may be rejected. The particular standard
1455 is used by @option{-pedantic} to identify which features are GNU
1456 extensions given that version of the standard. For example
1457 @samp{-std=gnu89 -pedantic} would warn about C++ style @samp{//}
1458 comments, while @samp{-std=gnu99 -pedantic} would not.
1460 A value for this option must be provided; possible values are
1465 Support all ISO C90 programs (certain GNU extensions that conflict
1466 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1468 @item iso9899:199409
1469 ISO C90 as modified in amendment 1.
1475 ISO C99. Note that this standard is not yet fully supported; see
1476 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1477 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1480 GNU dialect of ISO C90 (including some C99 features). This
1481 is the default for C code.
1485 GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC,
1486 this will become the default. The name @samp{gnu9x} is deprecated.
1489 The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
1493 GNU dialect of @option{-std=c++98}. This is the default for
1497 The working draft of the upcoming ISO C++0x standard. This option
1498 enables experimental features that are likely to be included in
1499 C++0x. The working draft is constantly changing, and any feature that is
1500 enabled by this flag may be removed from future versions of GCC if it is
1501 not part of the C++0x standard.
1504 GNU dialect of @option{-std=c++0x}. This option enables
1505 experimental features that may be removed in future versions of GCC.
1508 @item -fgnu89-inline
1509 @opindex fgnu89-inline
1510 The option @option{-fgnu89-inline} tells GCC to use the traditional
1511 GNU semantics for @code{inline} functions when in C99 mode.
1512 @xref{Inline,,An Inline Function is As Fast As a Macro}. This option
1513 is accepted and ignored by GCC versions 4.1.3 up to but not including
1514 4.3. In GCC versions 4.3 and later it changes the behavior of GCC in
1515 C99 mode. Using this option is roughly equivalent to adding the
1516 @code{gnu_inline} function attribute to all inline functions
1517 (@pxref{Function Attributes}).
1519 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1520 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1521 specifies the default behavior). This option was first supported in
1522 GCC 4.3. This option is not supported in C89 or gnu89 mode.
1524 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1525 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1526 in effect for @code{inline} functions. @xref{Common Predefined
1527 Macros,,,cpp,The C Preprocessor}.
1529 @item -aux-info @var{filename}
1531 Output to the given filename prototyped declarations for all functions
1532 declared and/or defined in a translation unit, including those in header
1533 files. This option is silently ignored in any language other than C@.
1535 Besides declarations, the file indicates, in comments, the origin of
1536 each declaration (source file and line), whether the declaration was
1537 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1538 @samp{O} for old, respectively, in the first character after the line
1539 number and the colon), and whether it came from a declaration or a
1540 definition (@samp{C} or @samp{F}, respectively, in the following
1541 character). In the case of function definitions, a K&R-style list of
1542 arguments followed by their declarations is also provided, inside
1543 comments, after the declaration.
1547 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1548 keyword, so that code can use these words as identifiers. You can use
1549 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1550 instead. @option{-ansi} implies @option{-fno-asm}.
1552 In C++, this switch only affects the @code{typeof} keyword, since
1553 @code{asm} and @code{inline} are standard keywords. You may want to
1554 use the @option{-fno-gnu-keywords} flag instead, which has the same
1555 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1556 switch only affects the @code{asm} and @code{typeof} keywords, since
1557 @code{inline} is a standard keyword in ISO C99.
1560 @itemx -fno-builtin-@var{function}
1561 @opindex fno-builtin
1562 @cindex built-in functions
1563 Don't recognize built-in functions that do not begin with
1564 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1565 functions provided by GCC}, for details of the functions affected,
1566 including those which are not built-in functions when @option{-ansi} or
1567 @option{-std} options for strict ISO C conformance are used because they
1568 do not have an ISO standard meaning.
1570 GCC normally generates special code to handle certain built-in functions
1571 more efficiently; for instance, calls to @code{alloca} may become single
1572 instructions that adjust the stack directly, and calls to @code{memcpy}
1573 may become inline copy loops. The resulting code is often both smaller
1574 and faster, but since the function calls no longer appear as such, you
1575 cannot set a breakpoint on those calls, nor can you change the behavior
1576 of the functions by linking with a different library. In addition,
1577 when a function is recognized as a built-in function, GCC may use
1578 information about that function to warn about problems with calls to
1579 that function, or to generate more efficient code, even if the
1580 resulting code still contains calls to that function. For example,
1581 warnings are given with @option{-Wformat} for bad calls to
1582 @code{printf}, when @code{printf} is built in, and @code{strlen} is
1583 known not to modify global memory.
1585 With the @option{-fno-builtin-@var{function}} option
1586 only the built-in function @var{function} is
1587 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1588 function is named that is not built-in in this version of GCC, this
1589 option is ignored. There is no corresponding
1590 @option{-fbuiltin-@var{function}} option; if you wish to enable
1591 built-in functions selectively when using @option{-fno-builtin} or
1592 @option{-ffreestanding}, you may define macros such as:
1595 #define abs(n) __builtin_abs ((n))
1596 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1601 @cindex hosted environment
1603 Assert that compilation takes place in a hosted environment. This implies
1604 @option{-fbuiltin}. A hosted environment is one in which the
1605 entire standard library is available, and in which @code{main} has a return
1606 type of @code{int}. Examples are nearly everything except a kernel.
1607 This is equivalent to @option{-fno-freestanding}.
1609 @item -ffreestanding
1610 @opindex ffreestanding
1611 @cindex hosted environment
1613 Assert that compilation takes place in a freestanding environment. This
1614 implies @option{-fno-builtin}. A freestanding environment
1615 is one in which the standard library may not exist, and program startup may
1616 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1617 This is equivalent to @option{-fno-hosted}.
1619 @xref{Standards,,Language Standards Supported by GCC}, for details of
1620 freestanding and hosted environments.
1624 @cindex openmp parallel
1625 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1626 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1627 compiler generates parallel code according to the OpenMP Application
1628 Program Interface v3.0 @w{@uref{http://www.openmp.org/}}. This option
1629 implies @option{-pthread}, and thus is only supported on targets that
1630 have support for @option{-pthread}.
1632 @item -fms-extensions
1633 @opindex fms-extensions
1634 Accept some non-standard constructs used in Microsoft header files.
1636 Some cases of unnamed fields in structures and unions are only
1637 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1638 fields within structs/unions}, for details.
1642 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1643 options for strict ISO C conformance) implies @option{-trigraphs}.
1645 @item -no-integrated-cpp
1646 @opindex no-integrated-cpp
1647 Performs a compilation in two passes: preprocessing and compiling. This
1648 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1649 @option{-B} option. The user supplied compilation step can then add in
1650 an additional preprocessing step after normal preprocessing but before
1651 compiling. The default is to use the integrated cpp (internal cpp)
1653 The semantics of this option will change if "cc1", "cc1plus", and
1654 "cc1obj" are merged.
1656 @cindex traditional C language
1657 @cindex C language, traditional
1659 @itemx -traditional-cpp
1660 @opindex traditional-cpp
1661 @opindex traditional
1662 Formerly, these options caused GCC to attempt to emulate a pre-standard
1663 C compiler. They are now only supported with the @option{-E} switch.
1664 The preprocessor continues to support a pre-standard mode. See the GNU
1665 CPP manual for details.
1667 @item -fcond-mismatch
1668 @opindex fcond-mismatch
1669 Allow conditional expressions with mismatched types in the second and
1670 third arguments. The value of such an expression is void. This option
1671 is not supported for C++.
1673 @item -flax-vector-conversions
1674 @opindex flax-vector-conversions
1675 Allow implicit conversions between vectors with differing numbers of
1676 elements and/or incompatible element types. This option should not be
1679 @item -funsigned-char
1680 @opindex funsigned-char
1681 Let the type @code{char} be unsigned, like @code{unsigned char}.
1683 Each kind of machine has a default for what @code{char} should
1684 be. It is either like @code{unsigned char} by default or like
1685 @code{signed char} by default.
1687 Ideally, a portable program should always use @code{signed char} or
1688 @code{unsigned char} when it depends on the signedness of an object.
1689 But many programs have been written to use plain @code{char} and
1690 expect it to be signed, or expect it to be unsigned, depending on the
1691 machines they were written for. This option, and its inverse, let you
1692 make such a program work with the opposite default.
1694 The type @code{char} is always a distinct type from each of
1695 @code{signed char} or @code{unsigned char}, even though its behavior
1696 is always just like one of those two.
1699 @opindex fsigned-char
1700 Let the type @code{char} be signed, like @code{signed char}.
1702 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1703 the negative form of @option{-funsigned-char}. Likewise, the option
1704 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1706 @item -fsigned-bitfields
1707 @itemx -funsigned-bitfields
1708 @itemx -fno-signed-bitfields
1709 @itemx -fno-unsigned-bitfields
1710 @opindex fsigned-bitfields
1711 @opindex funsigned-bitfields
1712 @opindex fno-signed-bitfields
1713 @opindex fno-unsigned-bitfields
1714 These options control whether a bit-field is signed or unsigned, when the
1715 declaration does not use either @code{signed} or @code{unsigned}. By
1716 default, such a bit-field is signed, because this is consistent: the
1717 basic integer types such as @code{int} are signed types.
1720 @node C++ Dialect Options
1721 @section Options Controlling C++ Dialect
1723 @cindex compiler options, C++
1724 @cindex C++ options, command line
1725 @cindex options, C++
1726 This section describes the command-line options that are only meaningful
1727 for C++ programs; but you can also use most of the GNU compiler options
1728 regardless of what language your program is in. For example, you
1729 might compile a file @code{firstClass.C} like this:
1732 g++ -g -frepo -O -c firstClass.C
1736 In this example, only @option{-frepo} is an option meant
1737 only for C++ programs; you can use the other options with any
1738 language supported by GCC@.
1740 Here is a list of options that are @emph{only} for compiling C++ programs:
1744 @item -fabi-version=@var{n}
1745 @opindex fabi-version
1746 Use version @var{n} of the C++ ABI@. Version 2 is the version of the
1747 C++ ABI that first appeared in G++ 3.4. Version 1 is the version of
1748 the C++ ABI that first appeared in G++ 3.2. Version 0 will always be
1749 the version that conforms most closely to the C++ ABI specification.
1750 Therefore, the ABI obtained using version 0 will change as ABI bugs
1753 The default is version 2.
1755 @item -fno-access-control
1756 @opindex fno-access-control
1757 Turn off all access checking. This switch is mainly useful for working
1758 around bugs in the access control code.
1762 Check that the pointer returned by @code{operator new} is non-null
1763 before attempting to modify the storage allocated. This check is
1764 normally unnecessary because the C++ standard specifies that
1765 @code{operator new} will only return @code{0} if it is declared
1766 @samp{throw()}, in which case the compiler will always check the
1767 return value even without this option. In all other cases, when
1768 @code{operator new} has a non-empty exception specification, memory
1769 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
1770 @samp{new (nothrow)}.
1772 @item -fconserve-space
1773 @opindex fconserve-space
1774 Put uninitialized or runtime-initialized global variables into the
1775 common segment, as C does. This saves space in the executable at the
1776 cost of not diagnosing duplicate definitions. If you compile with this
1777 flag and your program mysteriously crashes after @code{main()} has
1778 completed, you may have an object that is being destroyed twice because
1779 two definitions were merged.
1781 This option is no longer useful on most targets, now that support has
1782 been added for putting variables into BSS without making them common.
1784 @item -ffriend-injection
1785 @opindex ffriend-injection
1786 Inject friend functions into the enclosing namespace, so that they are
1787 visible outside the scope of the class in which they are declared.
1788 Friend functions were documented to work this way in the old Annotated
1789 C++ Reference Manual, and versions of G++ before 4.1 always worked
1790 that way. However, in ISO C++ a friend function which is not declared
1791 in an enclosing scope can only be found using argument dependent
1792 lookup. This option causes friends to be injected as they were in
1795 This option is for compatibility, and may be removed in a future
1798 @item -fno-elide-constructors
1799 @opindex fno-elide-constructors
1800 The C++ standard allows an implementation to omit creating a temporary
1801 which is only used to initialize another object of the same type.
1802 Specifying this option disables that optimization, and forces G++ to
1803 call the copy constructor in all cases.
1805 @item -fno-enforce-eh-specs
1806 @opindex fno-enforce-eh-specs
1807 Don't generate code to check for violation of exception specifications
1808 at runtime. This option violates the C++ standard, but may be useful
1809 for reducing code size in production builds, much like defining
1810 @samp{NDEBUG}. This does not give user code permission to throw
1811 exceptions in violation of the exception specifications; the compiler
1812 will still optimize based on the specifications, so throwing an
1813 unexpected exception will result in undefined behavior.
1816 @itemx -fno-for-scope
1818 @opindex fno-for-scope
1819 If @option{-ffor-scope} is specified, the scope of variables declared in
1820 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1821 as specified by the C++ standard.
1822 If @option{-fno-for-scope} is specified, the scope of variables declared in
1823 a @i{for-init-statement} extends to the end of the enclosing scope,
1824 as was the case in old versions of G++, and other (traditional)
1825 implementations of C++.
1827 The default if neither flag is given to follow the standard,
1828 but to allow and give a warning for old-style code that would
1829 otherwise be invalid, or have different behavior.
1831 @item -fno-gnu-keywords
1832 @opindex fno-gnu-keywords
1833 Do not recognize @code{typeof} as a keyword, so that code can use this
1834 word as an identifier. You can use the keyword @code{__typeof__} instead.
1835 @option{-ansi} implies @option{-fno-gnu-keywords}.
1837 @item -fno-implicit-templates
1838 @opindex fno-implicit-templates
1839 Never emit code for non-inline templates which are instantiated
1840 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1841 @xref{Template Instantiation}, for more information.
1843 @item -fno-implicit-inline-templates
1844 @opindex fno-implicit-inline-templates
1845 Don't emit code for implicit instantiations of inline templates, either.
1846 The default is to handle inlines differently so that compiles with and
1847 without optimization will need the same set of explicit instantiations.
1849 @item -fno-implement-inlines
1850 @opindex fno-implement-inlines
1851 To save space, do not emit out-of-line copies of inline functions
1852 controlled by @samp{#pragma implementation}. This will cause linker
1853 errors if these functions are not inlined everywhere they are called.
1855 @item -fms-extensions
1856 @opindex fms-extensions
1857 Disable pedantic warnings about constructs used in MFC, such as implicit
1858 int and getting a pointer to member function via non-standard syntax.
1860 @item -fno-nonansi-builtins
1861 @opindex fno-nonansi-builtins
1862 Disable built-in declarations of functions that are not mandated by
1863 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
1864 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1866 @item -fno-operator-names
1867 @opindex fno-operator-names
1868 Do not treat the operator name keywords @code{and}, @code{bitand},
1869 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1870 synonyms as keywords.
1872 @item -fno-optional-diags
1873 @opindex fno-optional-diags
1874 Disable diagnostics that the standard says a compiler does not need to
1875 issue. Currently, the only such diagnostic issued by G++ is the one for
1876 a name having multiple meanings within a class.
1879 @opindex fpermissive
1880 Downgrade some diagnostics about nonconformant code from errors to
1881 warnings. Thus, using @option{-fpermissive} will allow some
1882 nonconforming code to compile.
1884 @item -fno-pretty-templates
1885 @opindex fno-pretty-templates
1886 When an error message refers to a specialization of a function
1887 template, the compiler will normally print the signature of the
1888 template followed by the template arguments and any typedefs or
1889 typenames in the signature (e.g. @code{void f(T) [with T = int]}
1890 rather than @code{void f(int)}) so that it's clear which template is
1891 involved. When an error message refers to a specialization of a class
1892 template, the compiler will omit any template arguments which match
1893 the default template arguments for that template. If either of these
1894 behaviors make it harder to understand the error message rather than
1895 easier, using @option{-fno-pretty-templates} will disable them.
1899 Enable automatic template instantiation at link time. This option also
1900 implies @option{-fno-implicit-templates}. @xref{Template
1901 Instantiation}, for more information.
1905 Disable generation of information about every class with virtual
1906 functions for use by the C++ runtime type identification features
1907 (@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
1908 of the language, you can save some space by using this flag. Note that
1909 exception handling uses the same information, but it will generate it as
1910 needed. The @samp{dynamic_cast} operator can still be used for casts that
1911 do not require runtime type information, i.e.@: casts to @code{void *} or to
1912 unambiguous base classes.
1916 Emit statistics about front-end processing at the end of the compilation.
1917 This information is generally only useful to the G++ development team.
1919 @item -ftemplate-depth-@var{n}
1920 @opindex ftemplate-depth
1921 Set the maximum instantiation depth for template classes to @var{n}.
1922 A limit on the template instantiation depth is needed to detect
1923 endless recursions during template class instantiation. ANSI/ISO C++
1924 conforming programs must not rely on a maximum depth greater than 17.
1926 @item -fno-threadsafe-statics
1927 @opindex fno-threadsafe-statics
1928 Do not emit the extra code to use the routines specified in the C++
1929 ABI for thread-safe initialization of local statics. You can use this
1930 option to reduce code size slightly in code that doesn't need to be
1933 @item -fuse-cxa-atexit
1934 @opindex fuse-cxa-atexit
1935 Register destructors for objects with static storage duration with the
1936 @code{__cxa_atexit} function rather than the @code{atexit} function.
1937 This option is required for fully standards-compliant handling of static
1938 destructors, but will only work if your C library supports
1939 @code{__cxa_atexit}.
1941 @item -fno-use-cxa-get-exception-ptr
1942 @opindex fno-use-cxa-get-exception-ptr
1943 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
1944 will cause @code{std::uncaught_exception} to be incorrect, but is necessary
1945 if the runtime routine is not available.
1947 @item -fvisibility-inlines-hidden
1948 @opindex fvisibility-inlines-hidden
1949 This switch declares that the user does not attempt to compare
1950 pointers to inline methods where the addresses of the two functions
1951 were taken in different shared objects.
1953 The effect of this is that GCC may, effectively, mark inline methods with
1954 @code{__attribute__ ((visibility ("hidden")))} so that they do not
1955 appear in the export table of a DSO and do not require a PLT indirection
1956 when used within the DSO@. Enabling this option can have a dramatic effect
1957 on load and link times of a DSO as it massively reduces the size of the
1958 dynamic export table when the library makes heavy use of templates.
1960 The behavior of this switch is not quite the same as marking the
1961 methods as hidden directly, because it does not affect static variables
1962 local to the function or cause the compiler to deduce that
1963 the function is defined in only one shared object.
1965 You may mark a method as having a visibility explicitly to negate the
1966 effect of the switch for that method. For example, if you do want to
1967 compare pointers to a particular inline method, you might mark it as
1968 having default visibility. Marking the enclosing class with explicit
1969 visibility will have no effect.
1971 Explicitly instantiated inline methods are unaffected by this option
1972 as their linkage might otherwise cross a shared library boundary.
1973 @xref{Template Instantiation}.
1975 @item -fvisibility-ms-compat
1976 @opindex fvisibility-ms-compat
1977 This flag attempts to use visibility settings to make GCC's C++
1978 linkage model compatible with that of Microsoft Visual Studio.
1980 The flag makes these changes to GCC's linkage model:
1984 It sets the default visibility to @code{hidden}, like
1985 @option{-fvisibility=hidden}.
1988 Types, but not their members, are not hidden by default.
1991 The One Definition Rule is relaxed for types without explicit
1992 visibility specifications which are defined in more than one different
1993 shared object: those declarations are permitted if they would have
1994 been permitted when this option was not used.
1997 In new code it is better to use @option{-fvisibility=hidden} and
1998 export those classes which are intended to be externally visible.
1999 Unfortunately it is possible for code to rely, perhaps accidentally,
2000 on the Visual Studio behavior.
2002 Among the consequences of these changes are that static data members
2003 of the same type with the same name but defined in different shared
2004 objects will be different, so changing one will not change the other;
2005 and that pointers to function members defined in different shared
2006 objects may not compare equal. When this flag is given, it is a
2007 violation of the ODR to define types with the same name differently.
2011 Do not use weak symbol support, even if it is provided by the linker.
2012 By default, G++ will use weak symbols if they are available. This
2013 option exists only for testing, and should not be used by end-users;
2014 it will result in inferior code and has no benefits. This option may
2015 be removed in a future release of G++.
2019 Do not search for header files in the standard directories specific to
2020 C++, but do still search the other standard directories. (This option
2021 is used when building the C++ library.)
2024 In addition, these optimization, warning, and code generation options
2025 have meanings only for C++ programs:
2028 @item -fno-default-inline
2029 @opindex fno-default-inline
2030 Do not assume @samp{inline} for functions defined inside a class scope.
2031 @xref{Optimize Options,,Options That Control Optimization}. Note that these
2032 functions will have linkage like inline functions; they just won't be
2035 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2038 Warn when G++ generates code that is probably not compatible with the
2039 vendor-neutral C++ ABI@. Although an effort has been made to warn about
2040 all such cases, there are probably some cases that are not warned about,
2041 even though G++ is generating incompatible code. There may also be
2042 cases where warnings are emitted even though the code that is generated
2045 You should rewrite your code to avoid these warnings if you are
2046 concerned about the fact that code generated by G++ may not be binary
2047 compatible with code generated by other compilers.
2049 The known incompatibilities at this point include:
2054 Incorrect handling of tail-padding for bit-fields. G++ may attempt to
2055 pack data into the same byte as a base class. For example:
2058 struct A @{ virtual void f(); int f1 : 1; @};
2059 struct B : public A @{ int f2 : 1; @};
2063 In this case, G++ will place @code{B::f2} into the same byte
2064 as@code{A::f1}; other compilers will not. You can avoid this problem
2065 by explicitly padding @code{A} so that its size is a multiple of the
2066 byte size on your platform; that will cause G++ and other compilers to
2067 layout @code{B} identically.
2070 Incorrect handling of tail-padding for virtual bases. G++ does not use
2071 tail padding when laying out virtual bases. For example:
2074 struct A @{ virtual void f(); char c1; @};
2075 struct B @{ B(); char c2; @};
2076 struct C : public A, public virtual B @{@};
2080 In this case, G++ will not place @code{B} into the tail-padding for
2081 @code{A}; other compilers will. You can avoid this problem by
2082 explicitly padding @code{A} so that its size is a multiple of its
2083 alignment (ignoring virtual base classes); that will cause G++ and other
2084 compilers to layout @code{C} identically.
2087 Incorrect handling of bit-fields with declared widths greater than that
2088 of their underlying types, when the bit-fields appear in a union. For
2092 union U @{ int i : 4096; @};
2096 Assuming that an @code{int} does not have 4096 bits, G++ will make the
2097 union too small by the number of bits in an @code{int}.
2100 Empty classes can be placed at incorrect offsets. For example:
2110 struct C : public B, public A @{@};
2114 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
2115 it should be placed at offset zero. G++ mistakenly believes that the
2116 @code{A} data member of @code{B} is already at offset zero.
2119 Names of template functions whose types involve @code{typename} or
2120 template template parameters can be mangled incorrectly.
2123 template <typename Q>
2124 void f(typename Q::X) @{@}
2126 template <template <typename> class Q>
2127 void f(typename Q<int>::X) @{@}
2131 Instantiations of these templates may be mangled incorrectly.
2135 It also warns psABI related changes. The known psABI changes at this
2141 For SYSV/x86-64, when passing union with long double, it is changed to
2142 pass in memory as specified in psABI. For example:
2152 @code{union U} will always be passed in memory.
2156 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2157 @opindex Wctor-dtor-privacy
2158 @opindex Wno-ctor-dtor-privacy
2159 Warn when a class seems unusable because all the constructors or
2160 destructors in that class are private, and it has neither friends nor
2161 public static member functions.
2163 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2164 @opindex Wnon-virtual-dtor
2165 @opindex Wno-non-virtual-dtor
2166 Warn when a class has virtual functions and accessible non-virtual
2167 destructor, in which case it would be possible but unsafe to delete
2168 an instance of a derived class through a pointer to the base class.
2169 This warning is also enabled if -Weffc++ is specified.
2171 @item -Wreorder @r{(C++ and Objective-C++ only)}
2173 @opindex Wno-reorder
2174 @cindex reordering, warning
2175 @cindex warning for reordering of member initializers
2176 Warn when the order of member initializers given in the code does not
2177 match the order in which they must be executed. For instance:
2183 A(): j (0), i (1) @{ @}
2187 The compiler will rearrange the member initializers for @samp{i}
2188 and @samp{j} to match the declaration order of the members, emitting
2189 a warning to that effect. This warning is enabled by @option{-Wall}.
2192 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2195 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2198 Warn about violations of the following style guidelines from Scott Meyers'
2199 @cite{Effective C++} book:
2203 Item 11: Define a copy constructor and an assignment operator for classes
2204 with dynamically allocated memory.
2207 Item 12: Prefer initialization to assignment in constructors.
2210 Item 14: Make destructors virtual in base classes.
2213 Item 15: Have @code{operator=} return a reference to @code{*this}.
2216 Item 23: Don't try to return a reference when you must return an object.
2220 Also warn about violations of the following style guidelines from
2221 Scott Meyers' @cite{More Effective C++} book:
2225 Item 6: Distinguish between prefix and postfix forms of increment and
2226 decrement operators.
2229 Item 7: Never overload @code{&&}, @code{||}, or @code{,}.
2233 When selecting this option, be aware that the standard library
2234 headers do not obey all of these guidelines; use @samp{grep -v}
2235 to filter out those warnings.
2237 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2238 @opindex Wstrict-null-sentinel
2239 @opindex Wno-strict-null-sentinel
2240 Warn also about the use of an uncasted @code{NULL} as sentinel. When
2241 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2242 to @code{__null}. Although it is a null pointer constant not a null pointer,
2243 it is guaranteed to be of the same size as a pointer. But this use is
2244 not portable across different compilers.
2246 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2247 @opindex Wno-non-template-friend
2248 @opindex Wnon-template-friend
2249 Disable warnings when non-templatized friend functions are declared
2250 within a template. Since the advent of explicit template specification
2251 support in G++, if the name of the friend is an unqualified-id (i.e.,
2252 @samp{friend foo(int)}), the C++ language specification demands that the
2253 friend declare or define an ordinary, nontemplate function. (Section
2254 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2255 could be interpreted as a particular specialization of a templatized
2256 function. Because this non-conforming behavior is no longer the default
2257 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2258 check existing code for potential trouble spots and is on by default.
2259 This new compiler behavior can be turned off with
2260 @option{-Wno-non-template-friend} which keeps the conformant compiler code
2261 but disables the helpful warning.
2263 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2264 @opindex Wold-style-cast
2265 @opindex Wno-old-style-cast
2266 Warn if an old-style (C-style) cast to a non-void type is used within
2267 a C++ program. The new-style casts (@samp{dynamic_cast},
2268 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2269 less vulnerable to unintended effects and much easier to search for.
2271 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2272 @opindex Woverloaded-virtual
2273 @opindex Wno-overloaded-virtual
2274 @cindex overloaded virtual fn, warning
2275 @cindex warning for overloaded virtual fn
2276 Warn when a function declaration hides virtual functions from a
2277 base class. For example, in:
2284 struct B: public A @{
2289 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2297 will fail to compile.
2299 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2300 @opindex Wno-pmf-conversions
2301 @opindex Wpmf-conversions
2302 Disable the diagnostic for converting a bound pointer to member function
2305 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2306 @opindex Wsign-promo
2307 @opindex Wno-sign-promo
2308 Warn when overload resolution chooses a promotion from unsigned or
2309 enumerated type to a signed type, over a conversion to an unsigned type of
2310 the same size. Previous versions of G++ would try to preserve
2311 unsignedness, but the standard mandates the current behavior.
2316 A& operator = (int);
2326 In this example, G++ will synthesize a default @samp{A& operator =
2327 (const A&);}, while cfront will use the user-defined @samp{operator =}.
2330 @node Objective-C and Objective-C++ Dialect Options
2331 @section Options Controlling Objective-C and Objective-C++ Dialects
2333 @cindex compiler options, Objective-C and Objective-C++
2334 @cindex Objective-C and Objective-C++ options, command line
2335 @cindex options, Objective-C and Objective-C++
2336 (NOTE: This manual does not describe the Objective-C and Objective-C++
2337 languages themselves. See @xref{Standards,,Language Standards
2338 Supported by GCC}, for references.)
2340 This section describes the command-line options that are only meaningful
2341 for Objective-C and Objective-C++ programs, but you can also use most of
2342 the language-independent GNU compiler options.
2343 For example, you might compile a file @code{some_class.m} like this:
2346 gcc -g -fgnu-runtime -O -c some_class.m
2350 In this example, @option{-fgnu-runtime} is an option meant only for
2351 Objective-C and Objective-C++ programs; you can use the other options with
2352 any language supported by GCC@.
2354 Note that since Objective-C is an extension of the C language, Objective-C
2355 compilations may also use options specific to the C front-end (e.g.,
2356 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2357 C++-specific options (e.g., @option{-Wabi}).
2359 Here is a list of options that are @emph{only} for compiling Objective-C
2360 and Objective-C++ programs:
2363 @item -fconstant-string-class=@var{class-name}
2364 @opindex fconstant-string-class
2365 Use @var{class-name} as the name of the class to instantiate for each
2366 literal string specified with the syntax @code{@@"@dots{}"}. The default
2367 class name is @code{NXConstantString} if the GNU runtime is being used, and
2368 @code{NSConstantString} if the NeXT runtime is being used (see below). The
2369 @option{-fconstant-cfstrings} option, if also present, will override the
2370 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2371 to be laid out as constant CoreFoundation strings.
2374 @opindex fgnu-runtime
2375 Generate object code compatible with the standard GNU Objective-C
2376 runtime. This is the default for most types of systems.
2378 @item -fnext-runtime
2379 @opindex fnext-runtime
2380 Generate output compatible with the NeXT runtime. This is the default
2381 for NeXT-based systems, including Darwin and Mac OS X@. The macro
2382 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2385 @item -fno-nil-receivers
2386 @opindex fno-nil-receivers
2387 Assume that all Objective-C message dispatches (e.g.,
2388 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
2389 is not @code{nil}. This allows for more efficient entry points in the runtime
2390 to be used. Currently, this option is only available in conjunction with
2391 the NeXT runtime on Mac OS X 10.3 and later.
2393 @item -fobjc-call-cxx-cdtors
2394 @opindex fobjc-call-cxx-cdtors
2395 For each Objective-C class, check if any of its instance variables is a
2396 C++ object with a non-trivial default constructor. If so, synthesize a
2397 special @code{- (id) .cxx_construct} instance method that will run
2398 non-trivial default constructors on any such instance variables, in order,
2399 and then return @code{self}. Similarly, check if any instance variable
2400 is a C++ object with a non-trivial destructor, and if so, synthesize a
2401 special @code{- (void) .cxx_destruct} method that will run
2402 all such default destructors, in reverse order.
2404 The @code{- (id) .cxx_construct} and/or @code{- (void) .cxx_destruct} methods
2405 thusly generated will only operate on instance variables declared in the
2406 current Objective-C class, and not those inherited from superclasses. It
2407 is the responsibility of the Objective-C runtime to invoke all such methods
2408 in an object's inheritance hierarchy. The @code{- (id) .cxx_construct} methods
2409 will be invoked by the runtime immediately after a new object
2410 instance is allocated; the @code{- (void) .cxx_destruct} methods will
2411 be invoked immediately before the runtime deallocates an object instance.
2413 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2414 support for invoking the @code{- (id) .cxx_construct} and
2415 @code{- (void) .cxx_destruct} methods.
2417 @item -fobjc-direct-dispatch
2418 @opindex fobjc-direct-dispatch
2419 Allow fast jumps to the message dispatcher. On Darwin this is
2420 accomplished via the comm page.
2422 @item -fobjc-exceptions
2423 @opindex fobjc-exceptions
2424 Enable syntactic support for structured exception handling in Objective-C,
2425 similar to what is offered by C++ and Java. This option is
2426 unavailable in conjunction with the NeXT runtime on Mac OS X 10.2 and
2435 @@catch (AnObjCClass *exc) @{
2442 @@catch (AnotherClass *exc) @{
2445 @@catch (id allOthers) @{
2455 The @code{@@throw} statement may appear anywhere in an Objective-C or
2456 Objective-C++ program; when used inside of a @code{@@catch} block, the
2457 @code{@@throw} may appear without an argument (as shown above), in which case
2458 the object caught by the @code{@@catch} will be rethrown.
2460 Note that only (pointers to) Objective-C objects may be thrown and
2461 caught using this scheme. When an object is thrown, it will be caught
2462 by the nearest @code{@@catch} clause capable of handling objects of that type,
2463 analogously to how @code{catch} blocks work in C++ and Java. A
2464 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
2465 any and all Objective-C exceptions not caught by previous @code{@@catch}
2468 The @code{@@finally} clause, if present, will be executed upon exit from the
2469 immediately preceding @code{@@try @dots{} @@catch} section. This will happen
2470 regardless of whether any exceptions are thrown, caught or rethrown
2471 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
2472 of the @code{finally} clause in Java.
2474 There are several caveats to using the new exception mechanism:
2478 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
2479 idioms provided by the @code{NSException} class, the new
2480 exceptions can only be used on Mac OS X 10.3 (Panther) and later
2481 systems, due to additional functionality needed in the (NeXT) Objective-C
2485 As mentioned above, the new exceptions do not support handling
2486 types other than Objective-C objects. Furthermore, when used from
2487 Objective-C++, the Objective-C exception model does not interoperate with C++
2488 exceptions at this time. This means you cannot @code{@@throw} an exception
2489 from Objective-C and @code{catch} it in C++, or vice versa
2490 (i.e., @code{throw @dots{} @@catch}).
2493 The @option{-fobjc-exceptions} switch also enables the use of synchronization
2494 blocks for thread-safe execution:
2497 @@synchronized (ObjCClass *guard) @{
2502 Upon entering the @code{@@synchronized} block, a thread of execution shall
2503 first check whether a lock has been placed on the corresponding @code{guard}
2504 object by another thread. If it has, the current thread shall wait until
2505 the other thread relinquishes its lock. Once @code{guard} becomes available,
2506 the current thread will place its own lock on it, execute the code contained in
2507 the @code{@@synchronized} block, and finally relinquish the lock (thereby
2508 making @code{guard} available to other threads).
2510 Unlike Java, Objective-C does not allow for entire methods to be marked
2511 @code{@@synchronized}. Note that throwing exceptions out of
2512 @code{@@synchronized} blocks is allowed, and will cause the guarding object
2513 to be unlocked properly.
2517 Enable garbage collection (GC) in Objective-C and Objective-C++ programs.
2519 @item -freplace-objc-classes
2520 @opindex freplace-objc-classes
2521 Emit a special marker instructing @command{ld(1)} not to statically link in
2522 the resulting object file, and allow @command{dyld(1)} to load it in at
2523 run time instead. This is used in conjunction with the Fix-and-Continue
2524 debugging mode, where the object file in question may be recompiled and
2525 dynamically reloaded in the course of program execution, without the need
2526 to restart the program itself. Currently, Fix-and-Continue functionality
2527 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2532 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2533 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2534 compile time) with static class references that get initialized at load time,
2535 which improves run-time performance. Specifying the @option{-fzero-link} flag
2536 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2537 to be retained. This is useful in Zero-Link debugging mode, since it allows
2538 for individual class implementations to be modified during program execution.
2542 Dump interface declarations for all classes seen in the source file to a
2543 file named @file{@var{sourcename}.decl}.
2545 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
2546 @opindex Wassign-intercept
2547 @opindex Wno-assign-intercept
2548 Warn whenever an Objective-C assignment is being intercepted by the
2551 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
2552 @opindex Wno-protocol
2554 If a class is declared to implement a protocol, a warning is issued for
2555 every method in the protocol that is not implemented by the class. The
2556 default behavior is to issue a warning for every method not explicitly
2557 implemented in the class, even if a method implementation is inherited
2558 from the superclass. If you use the @option{-Wno-protocol} option, then
2559 methods inherited from the superclass are considered to be implemented,
2560 and no warning is issued for them.
2562 @item -Wselector @r{(Objective-C and Objective-C++ only)}
2564 @opindex Wno-selector
2565 Warn if multiple methods of different types for the same selector are
2566 found during compilation. The check is performed on the list of methods
2567 in the final stage of compilation. Additionally, a check is performed
2568 for each selector appearing in a @code{@@selector(@dots{})}
2569 expression, and a corresponding method for that selector has been found
2570 during compilation. Because these checks scan the method table only at
2571 the end of compilation, these warnings are not produced if the final
2572 stage of compilation is not reached, for example because an error is
2573 found during compilation, or because the @option{-fsyntax-only} option is
2576 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
2577 @opindex Wstrict-selector-match
2578 @opindex Wno-strict-selector-match
2579 Warn if multiple methods with differing argument and/or return types are
2580 found for a given selector when attempting to send a message using this
2581 selector to a receiver of type @code{id} or @code{Class}. When this flag
2582 is off (which is the default behavior), the compiler will omit such warnings
2583 if any differences found are confined to types which share the same size
2586 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
2587 @opindex Wundeclared-selector
2588 @opindex Wno-undeclared-selector
2589 Warn if a @code{@@selector(@dots{})} expression referring to an
2590 undeclared selector is found. A selector is considered undeclared if no
2591 method with that name has been declared before the
2592 @code{@@selector(@dots{})} expression, either explicitly in an
2593 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2594 an @code{@@implementation} section. This option always performs its
2595 checks as soon as a @code{@@selector(@dots{})} expression is found,
2596 while @option{-Wselector} only performs its checks in the final stage of
2597 compilation. This also enforces the coding style convention
2598 that methods and selectors must be declared before being used.
2600 @item -print-objc-runtime-info
2601 @opindex print-objc-runtime-info
2602 Generate C header describing the largest structure that is passed by
2607 @node Language Independent Options
2608 @section Options to Control Diagnostic Messages Formatting
2609 @cindex options to control diagnostics formatting
2610 @cindex diagnostic messages
2611 @cindex message formatting
2613 Traditionally, diagnostic messages have been formatted irrespective of
2614 the output device's aspect (e.g.@: its width, @dots{}). The options described
2615 below can be used to control the diagnostic messages formatting
2616 algorithm, e.g.@: how many characters per line, how often source location
2617 information should be reported. Right now, only the C++ front end can
2618 honor these options. However it is expected, in the near future, that
2619 the remaining front ends would be able to digest them correctly.
2622 @item -fmessage-length=@var{n}
2623 @opindex fmessage-length
2624 Try to format error messages so that they fit on lines of about @var{n}
2625 characters. The default is 72 characters for @command{g++} and 0 for the rest of
2626 the front ends supported by GCC@. If @var{n} is zero, then no
2627 line-wrapping will be done; each error message will appear on a single
2630 @opindex fdiagnostics-show-location
2631 @item -fdiagnostics-show-location=once
2632 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
2633 reporter to emit @emph{once} source location information; that is, in
2634 case the message is too long to fit on a single physical line and has to
2635 be wrapped, the source location won't be emitted (as prefix) again,
2636 over and over, in subsequent continuation lines. This is the default
2639 @item -fdiagnostics-show-location=every-line
2640 Only meaningful in line-wrapping mode. Instructs the diagnostic
2641 messages reporter to emit the same source location information (as
2642 prefix) for physical lines that result from the process of breaking
2643 a message which is too long to fit on a single line.
2645 @item -fdiagnostics-show-option
2646 @opindex fdiagnostics-show-option
2647 This option instructs the diagnostic machinery to add text to each
2648 diagnostic emitted, which indicates which command line option directly
2649 controls that diagnostic, when such an option is known to the
2650 diagnostic machinery.
2652 @item -Wcoverage-mismatch
2653 @opindex Wcoverage-mismatch
2654 Warn if feedback profiles do not match when using the
2655 @option{-fprofile-use} option.
2656 If a source file was changed between @option{-fprofile-gen} and
2657 @option{-fprofile-use}, the files with the profile feedback can fail
2658 to match the source file and GCC can not use the profile feedback
2659 information. By default, GCC emits an error message in this case.
2660 The option @option{-Wcoverage-mismatch} emits a warning instead of an
2661 error. GCC does not use appropriate feedback profiles, so using this
2662 option can result in poorly optimized code. This option is useful
2663 only in the case of very minor changes such as bug fixes to an
2668 @node Warning Options
2669 @section Options to Request or Suppress Warnings
2670 @cindex options to control warnings
2671 @cindex warning messages
2672 @cindex messages, warning
2673 @cindex suppressing warnings
2675 Warnings are diagnostic messages that report constructions which
2676 are not inherently erroneous but which are risky or suggest there
2677 may have been an error.
2679 The following language-independent options do not enable specific
2680 warnings but control the kinds of diagnostics produced by GCC.
2683 @cindex syntax checking
2685 @opindex fsyntax-only
2686 Check the code for syntax errors, but don't do anything beyond that.
2690 Inhibit all warning messages.
2695 Make all warnings into errors.
2700 Make the specified warning into an error. The specifier for a warning
2701 is appended, for example @option{-Werror=switch} turns the warnings
2702 controlled by @option{-Wswitch} into errors. This switch takes a
2703 negative form, to be used to negate @option{-Werror} for specific
2704 warnings, for example @option{-Wno-error=switch} makes
2705 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
2706 is in effect. You can use the @option{-fdiagnostics-show-option}
2707 option to have each controllable warning amended with the option which
2708 controls it, to determine what to use with this option.
2710 Note that specifying @option{-Werror=}@var{foo} automatically implies
2711 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
2714 @item -Wfatal-errors
2715 @opindex Wfatal-errors
2716 @opindex Wno-fatal-errors
2717 This option causes the compiler to abort compilation on the first error
2718 occurred rather than trying to keep going and printing further error
2723 You can request many specific warnings with options beginning
2724 @samp{-W}, for example @option{-Wimplicit} to request warnings on
2725 implicit declarations. Each of these specific warning options also
2726 has a negative form beginning @samp{-Wno-} to turn off warnings; for
2727 example, @option{-Wno-implicit}. This manual lists only one of the
2728 two forms, whichever is not the default. For further,
2729 language-specific options also refer to @ref{C++ Dialect Options} and
2730 @ref{Objective-C and Objective-C++ Dialect Options}.
2735 Issue all the warnings demanded by strict ISO C and ISO C++;
2736 reject all programs that use forbidden extensions, and some other
2737 programs that do not follow ISO C and ISO C++. For ISO C, follows the
2738 version of the ISO C standard specified by any @option{-std} option used.
2740 Valid ISO C and ISO C++ programs should compile properly with or without
2741 this option (though a rare few will require @option{-ansi} or a
2742 @option{-std} option specifying the required version of ISO C)@. However,
2743 without this option, certain GNU extensions and traditional C and C++
2744 features are supported as well. With this option, they are rejected.
2746 @option{-pedantic} does not cause warning messages for use of the
2747 alternate keywords whose names begin and end with @samp{__}. Pedantic
2748 warnings are also disabled in the expression that follows
2749 @code{__extension__}. However, only system header files should use
2750 these escape routes; application programs should avoid them.
2751 @xref{Alternate Keywords}.
2753 Some users try to use @option{-pedantic} to check programs for strict ISO
2754 C conformance. They soon find that it does not do quite what they want:
2755 it finds some non-ISO practices, but not all---only those for which
2756 ISO C @emph{requires} a diagnostic, and some others for which
2757 diagnostics have been added.
2759 A feature to report any failure to conform to ISO C might be useful in
2760 some instances, but would require considerable additional work and would
2761 be quite different from @option{-pedantic}. We don't have plans to
2762 support such a feature in the near future.
2764 Where the standard specified with @option{-std} represents a GNU
2765 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2766 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2767 extended dialect is based. Warnings from @option{-pedantic} are given
2768 where they are required by the base standard. (It would not make sense
2769 for such warnings to be given only for features not in the specified GNU
2770 C dialect, since by definition the GNU dialects of C include all
2771 features the compiler supports with the given option, and there would be
2772 nothing to warn about.)
2774 @item -pedantic-errors
2775 @opindex pedantic-errors
2776 Like @option{-pedantic}, except that errors are produced rather than
2782 This enables all the warnings about constructions that some users
2783 consider questionable, and that are easy to avoid (or modify to
2784 prevent the warning), even in conjunction with macros. This also
2785 enables some language-specific warnings described in @ref{C++ Dialect
2786 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
2788 @option{-Wall} turns on the following warning flags:
2790 @gccoptlist{-Waddress @gol
2791 -Warray-bounds @r{(only with} @option{-O2}@r{)} @gol
2793 -Wchar-subscripts @gol
2794 -Wenum-compare @r{(in C/Objc; this is on by default in C++)} @gol
2796 -Wimplicit-function-declaration @gol
2799 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
2800 -Wmissing-braces @gol
2806 -Wsequence-point @gol
2807 -Wsign-compare @r{(only in C++)} @gol
2808 -Wstrict-aliasing @gol
2809 -Wstrict-overflow=1 @gol
2812 -Wuninitialized @gol
2813 -Wunknown-pragmas @gol
2814 -Wunused-function @gol
2817 -Wunused-variable @gol
2818 -Wvolatile-register-var @gol
2821 Note that some warning flags are not implied by @option{-Wall}. Some of
2822 them warn about constructions that users generally do not consider
2823 questionable, but which occasionally you might wish to check for;
2824 others warn about constructions that are necessary or hard to avoid in
2825 some cases, and there is no simple way to modify the code to suppress
2826 the warning. Some of them are enabled by @option{-Wextra} but many of
2827 them must be enabled individually.
2833 This enables some extra warning flags that are not enabled by
2834 @option{-Wall}. (This option used to be called @option{-W}. The older
2835 name is still supported, but the newer name is more descriptive.)
2837 @gccoptlist{-Wclobbered @gol
2839 -Wignored-qualifiers @gol
2840 -Wmissing-field-initializers @gol
2841 -Wmissing-parameter-type @r{(C only)} @gol
2842 -Wold-style-declaration @r{(C only)} @gol
2843 -Woverride-init @gol
2846 -Wuninitialized @gol
2847 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
2850 The option @option{-Wextra} also prints warning messages for the
2856 A pointer is compared against integer zero with @samp{<}, @samp{<=},
2857 @samp{>}, or @samp{>=}.
2860 (C++ only) An enumerator and a non-enumerator both appear in a
2861 conditional expression.
2864 (C++ only) Ambiguous virtual bases.
2867 (C++ only) Subscripting an array which has been declared @samp{register}.
2870 (C++ only) Taking the address of a variable which has been declared
2874 (C++ only) A base class is not initialized in a derived class' copy
2879 @item -Wchar-subscripts
2880 @opindex Wchar-subscripts
2881 @opindex Wno-char-subscripts
2882 Warn if an array subscript has type @code{char}. This is a common cause
2883 of error, as programmers often forget that this type is signed on some
2885 This warning is enabled by @option{-Wall}.
2889 @opindex Wno-comment
2890 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2891 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2892 This warning is enabled by @option{-Wall}.
2897 @opindex ffreestanding
2898 @opindex fno-builtin
2899 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2900 the arguments supplied have types appropriate to the format string
2901 specified, and that the conversions specified in the format string make
2902 sense. This includes standard functions, and others specified by format
2903 attributes (@pxref{Function Attributes}), in the @code{printf},
2904 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2905 not in the C standard) families (or other target-specific families).
2906 Which functions are checked without format attributes having been
2907 specified depends on the standard version selected, and such checks of
2908 functions without the attribute specified are disabled by
2909 @option{-ffreestanding} or @option{-fno-builtin}.
2911 The formats are checked against the format features supported by GNU
2912 libc version 2.2. These include all ISO C90 and C99 features, as well
2913 as features from the Single Unix Specification and some BSD and GNU
2914 extensions. Other library implementations may not support all these
2915 features; GCC does not support warning about features that go beyond a
2916 particular library's limitations. However, if @option{-pedantic} is used
2917 with @option{-Wformat}, warnings will be given about format features not
2918 in the selected standard version (but not for @code{strfmon} formats,
2919 since those are not in any version of the C standard). @xref{C Dialect
2920 Options,,Options Controlling C Dialect}.
2922 Since @option{-Wformat} also checks for null format arguments for
2923 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2925 @option{-Wformat} is included in @option{-Wall}. For more control over some
2926 aspects of format checking, the options @option{-Wformat-y2k},
2927 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2928 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2929 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2932 @opindex Wformat-y2k
2933 @opindex Wno-format-y2k
2934 If @option{-Wformat} is specified, also warn about @code{strftime}
2935 formats which may yield only a two-digit year.
2937 @item -Wno-format-contains-nul
2938 @opindex Wno-format-contains-nul
2939 @opindex Wformat-contains-nul
2940 If @option{-Wformat} is specified, do not warn about format strings that
2943 @item -Wno-format-extra-args
2944 @opindex Wno-format-extra-args
2945 @opindex Wformat-extra-args
2946 If @option{-Wformat} is specified, do not warn about excess arguments to a
2947 @code{printf} or @code{scanf} format function. The C standard specifies
2948 that such arguments are ignored.
2950 Where the unused arguments lie between used arguments that are
2951 specified with @samp{$} operand number specifications, normally
2952 warnings are still given, since the implementation could not know what
2953 type to pass to @code{va_arg} to skip the unused arguments. However,
2954 in the case of @code{scanf} formats, this option will suppress the
2955 warning if the unused arguments are all pointers, since the Single
2956 Unix Specification says that such unused arguments are allowed.
2958 @item -Wno-format-zero-length @r{(C and Objective-C only)}
2959 @opindex Wno-format-zero-length
2960 @opindex Wformat-zero-length
2961 If @option{-Wformat} is specified, do not warn about zero-length formats.
2962 The C standard specifies that zero-length formats are allowed.
2964 @item -Wformat-nonliteral
2965 @opindex Wformat-nonliteral
2966 @opindex Wno-format-nonliteral
2967 If @option{-Wformat} is specified, also warn if the format string is not a
2968 string literal and so cannot be checked, unless the format function
2969 takes its format arguments as a @code{va_list}.
2971 @item -Wformat-security
2972 @opindex Wformat-security
2973 @opindex Wno-format-security
2974 If @option{-Wformat} is specified, also warn about uses of format
2975 functions that represent possible security problems. At present, this
2976 warns about calls to @code{printf} and @code{scanf} functions where the
2977 format string is not a string literal and there are no format arguments,
2978 as in @code{printf (foo);}. This may be a security hole if the format
2979 string came from untrusted input and contains @samp{%n}. (This is
2980 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2981 in future warnings may be added to @option{-Wformat-security} that are not
2982 included in @option{-Wformat-nonliteral}.)
2986 @opindex Wno-format=2
2987 Enable @option{-Wformat} plus format checks not included in
2988 @option{-Wformat}. Currently equivalent to @samp{-Wformat
2989 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2991 @item -Wnonnull @r{(C and Objective-C only)}
2993 @opindex Wno-nonnull
2994 Warn about passing a null pointer for arguments marked as
2995 requiring a non-null value by the @code{nonnull} function attribute.
2997 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
2998 can be disabled with the @option{-Wno-nonnull} option.
3000 @item -Wjump-misses-init @r{(C, Objective-C only)}
3001 @opindex Wjump-misses-init
3002 @opindex Wno-jump-misses-init
3003 Warn if a @code{goto} statement or a @code{switch} statement jumps
3004 forward across the initialization of a variable, or jumps backward to a
3005 label after the variable has been initialized. This only warns about
3006 variables which are initialized when they are declared. This warning is
3007 only supported for C and Objective C; in C++ this sort of branch is an
3010 @option{-Wjump-misses-init} is included in @option{-Wall} and
3011 @option{-Wc++-compat}. It can be disabled with the
3012 @option{-Wno-jump-misses-init} option.
3014 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3016 @opindex Wno-init-self
3017 Warn about uninitialized variables which are initialized with themselves.
3018 Note this option can only be used with the @option{-Wuninitialized} option.
3020 For example, GCC will warn about @code{i} being uninitialized in the
3021 following snippet only when @option{-Winit-self} has been specified:
3032 @item -Wimplicit-int @r{(C and Objective-C only)}
3033 @opindex Wimplicit-int
3034 @opindex Wno-implicit-int
3035 Warn when a declaration does not specify a type.
3036 This warning is enabled by @option{-Wall}.
3038 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3039 @opindex Wimplicit-function-declaration
3040 @opindex Wno-implicit-function-declaration
3041 Give a warning whenever a function is used before being declared. In
3042 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3043 enabled by default and it is made into an error by
3044 @option{-pedantic-errors}. This warning is also enabled by
3049 @opindex Wno-implicit
3050 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3051 This warning is enabled by @option{-Wall}.
3053 @item -Wignored-qualifiers @r{(C and C++ only)}
3054 @opindex Wignored-qualifiers
3055 @opindex Wno-ignored-qualifiers
3056 Warn if the return type of a function has a type qualifier
3057 such as @code{const}. For ISO C such a type qualifier has no effect,
3058 since the value returned by a function is not an lvalue.
3059 For C++, the warning is only emitted for scalar types or @code{void}.
3060 ISO C prohibits qualified @code{void} return types on function
3061 definitions, so such return types always receive a warning
3062 even without this option.
3064 This warning is also enabled by @option{-Wextra}.
3069 Warn if the type of @samp{main} is suspicious. @samp{main} should be
3070 a function with external linkage, returning int, taking either zero
3071 arguments, two, or three arguments of appropriate types. This warning
3072 is enabled by default in C++ and is enabled by either @option{-Wall}
3073 or @option{-pedantic}.
3075 @item -Wmissing-braces
3076 @opindex Wmissing-braces
3077 @opindex Wno-missing-braces
3078 Warn if an aggregate or union initializer is not fully bracketed. In
3079 the following example, the initializer for @samp{a} is not fully
3080 bracketed, but that for @samp{b} is fully bracketed.
3083 int a[2][2] = @{ 0, 1, 2, 3 @};
3084 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3087 This warning is enabled by @option{-Wall}.
3089 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3090 @opindex Wmissing-include-dirs
3091 @opindex Wno-missing-include-dirs
3092 Warn if a user-supplied include directory does not exist.
3095 @opindex Wparentheses
3096 @opindex Wno-parentheses
3097 Warn if parentheses are omitted in certain contexts, such
3098 as when there is an assignment in a context where a truth value
3099 is expected, or when operators are nested whose precedence people
3100 often get confused about.
3102 Also warn if a comparison like @samp{x<=y<=z} appears; this is
3103 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3104 interpretation from that of ordinary mathematical notation.
3106 Also warn about constructions where there may be confusion to which
3107 @code{if} statement an @code{else} branch belongs. Here is an example of
3122 In C/C++, every @code{else} branch belongs to the innermost possible
3123 @code{if} statement, which in this example is @code{if (b)}. This is
3124 often not what the programmer expected, as illustrated in the above
3125 example by indentation the programmer chose. When there is the
3126 potential for this confusion, GCC will issue a warning when this flag
3127 is specified. To eliminate the warning, add explicit braces around
3128 the innermost @code{if} statement so there is no way the @code{else}
3129 could belong to the enclosing @code{if}. The resulting code would
3146 This warning is enabled by @option{-Wall}.
3148 @item -Wsequence-point
3149 @opindex Wsequence-point
3150 @opindex Wno-sequence-point
3151 Warn about code that may have undefined semantics because of violations
3152 of sequence point rules in the C and C++ standards.
3154 The C and C++ standards defines the order in which expressions in a C/C++
3155 program are evaluated in terms of @dfn{sequence points}, which represent
3156 a partial ordering between the execution of parts of the program: those
3157 executed before the sequence point, and those executed after it. These
3158 occur after the evaluation of a full expression (one which is not part
3159 of a larger expression), after the evaluation of the first operand of a
3160 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3161 function is called (but after the evaluation of its arguments and the
3162 expression denoting the called function), and in certain other places.
3163 Other than as expressed by the sequence point rules, the order of
3164 evaluation of subexpressions of an expression is not specified. All
3165 these rules describe only a partial order rather than a total order,
3166 since, for example, if two functions are called within one expression
3167 with no sequence point between them, the order in which the functions
3168 are called is not specified. However, the standards committee have
3169 ruled that function calls do not overlap.
3171 It is not specified when between sequence points modifications to the
3172 values of objects take effect. Programs whose behavior depends on this
3173 have undefined behavior; the C and C++ standards specify that ``Between
3174 the previous and next sequence point an object shall have its stored
3175 value modified at most once by the evaluation of an expression.
3176 Furthermore, the prior value shall be read only to determine the value
3177 to be stored.''. If a program breaks these rules, the results on any
3178 particular implementation are entirely unpredictable.
3180 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
3181 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
3182 diagnosed by this option, and it may give an occasional false positive
3183 result, but in general it has been found fairly effective at detecting
3184 this sort of problem in programs.
3186 The standard is worded confusingly, therefore there is some debate
3187 over the precise meaning of the sequence point rules in subtle cases.
3188 Links to discussions of the problem, including proposed formal
3189 definitions, may be found on the GCC readings page, at
3190 @w{@uref{http://gcc.gnu.org/readings.html}}.
3192 This warning is enabled by @option{-Wall} for C and C++.
3195 @opindex Wreturn-type
3196 @opindex Wno-return-type
3197 Warn whenever a function is defined with a return-type that defaults
3198 to @code{int}. Also warn about any @code{return} statement with no
3199 return-value in a function whose return-type is not @code{void}
3200 (falling off the end of the function body is considered returning
3201 without a value), and about a @code{return} statement with an
3202 expression in a function whose return-type is @code{void}.
3204 For C++, a function without return type always produces a diagnostic
3205 message, even when @option{-Wno-return-type} is specified. The only
3206 exceptions are @samp{main} and functions defined in system headers.
3208 This warning is enabled by @option{-Wall}.
3213 Warn whenever a @code{switch} statement has an index of enumerated type
3214 and lacks a @code{case} for one or more of the named codes of that
3215 enumeration. (The presence of a @code{default} label prevents this
3216 warning.) @code{case} labels outside the enumeration range also
3217 provoke warnings when this option is used (even if there is a
3218 @code{default} label).
3219 This warning is enabled by @option{-Wall}.
3221 @item -Wswitch-default
3222 @opindex Wswitch-default
3223 @opindex Wno-switch-default
3224 Warn whenever a @code{switch} statement does not have a @code{default}
3228 @opindex Wswitch-enum
3229 @opindex Wno-switch-enum
3230 Warn whenever a @code{switch} statement has an index of enumerated type
3231 and lacks a @code{case} for one or more of the named codes of that
3232 enumeration. @code{case} labels outside the enumeration range also
3233 provoke warnings when this option is used. The only difference
3234 between @option{-Wswitch} and this option is that this option gives a
3235 warning about an omitted enumeration code even if there is a
3236 @code{default} label.
3238 @item -Wsync-nand @r{(C and C++ only)}
3240 @opindex Wno-sync-nand
3241 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3242 built-in functions are used. These functions changed semantics in GCC 4.4.
3246 @opindex Wno-trigraphs
3247 Warn if any trigraphs are encountered that might change the meaning of
3248 the program (trigraphs within comments are not warned about).
3249 This warning is enabled by @option{-Wall}.
3251 @item -Wunused-function
3252 @opindex Wunused-function
3253 @opindex Wno-unused-function
3254 Warn whenever a static function is declared but not defined or a
3255 non-inline static function is unused.
3256 This warning is enabled by @option{-Wall}.
3258 @item -Wunused-label
3259 @opindex Wunused-label
3260 @opindex Wno-unused-label
3261 Warn whenever a label is declared but not used.
3262 This warning is enabled by @option{-Wall}.
3264 To suppress this warning use the @samp{unused} attribute
3265 (@pxref{Variable Attributes}).
3267 @item -Wunused-parameter
3268 @opindex Wunused-parameter
3269 @opindex Wno-unused-parameter
3270 Warn whenever a function parameter is unused aside from its declaration.
3272 To suppress this warning use the @samp{unused} attribute
3273 (@pxref{Variable Attributes}).
3275 @item -Wno-unused-result
3276 @opindex Wunused-result
3277 @opindex Wno-unused-result
3278 Do not warn if a caller of a function marked with attribute
3279 @code{warn_unused_result} (@pxref{Variable Attributes}) does not use
3280 its return value. The default is @option{-Wunused-result}.
3282 @item -Wunused-variable
3283 @opindex Wunused-variable
3284 @opindex Wno-unused-variable
3285 Warn whenever a local variable or non-constant static variable is unused
3286 aside from its declaration.
3287 This warning is enabled by @option{-Wall}.
3289 To suppress this warning use the @samp{unused} attribute
3290 (@pxref{Variable Attributes}).
3292 @item -Wunused-value
3293 @opindex Wunused-value
3294 @opindex Wno-unused-value
3295 Warn whenever a statement computes a result that is explicitly not
3296 used. To suppress this warning cast the unused expression to
3297 @samp{void}. This includes an expression-statement or the left-hand
3298 side of a comma expression that contains no side effects. For example,
3299 an expression such as @samp{x[i,j]} will cause a warning, while
3300 @samp{x[(void)i,j]} will not.
3302 This warning is enabled by @option{-Wall}.
3307 All the above @option{-Wunused} options combined.
3309 In order to get a warning about an unused function parameter, you must
3310 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
3311 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
3313 @item -Wuninitialized
3314 @opindex Wuninitialized
3315 @opindex Wno-uninitialized
3316 Warn if an automatic variable is used without first being initialized
3317 or if a variable may be clobbered by a @code{setjmp} call. In C++,
3318 warn if a non-static reference or non-static @samp{const} member
3319 appears in a class without constructors.
3321 If you want to warn about code which uses the uninitialized value of the
3322 variable in its own initializer, use the @option{-Winit-self} option.
3324 These warnings occur for individual uninitialized or clobbered
3325 elements of structure, union or array variables as well as for
3326 variables which are uninitialized or clobbered as a whole. They do
3327 not occur for variables or elements declared @code{volatile}. Because
3328 these warnings depend on optimization, the exact variables or elements
3329 for which there are warnings will depend on the precise optimization
3330 options and version of GCC used.
3332 Note that there may be no warning about a variable that is used only
3333 to compute a value that itself is never used, because such
3334 computations may be deleted by data flow analysis before the warnings
3337 These warnings are made optional because GCC is not smart
3338 enough to see all the reasons why the code might be correct
3339 despite appearing to have an error. Here is one example of how
3360 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
3361 always initialized, but GCC doesn't know this. Here is
3362 another common case:
3367 if (change_y) save_y = y, y = new_y;
3369 if (change_y) y = save_y;
3374 This has no bug because @code{save_y} is used only if it is set.
3376 @cindex @code{longjmp} warnings
3377 This option also warns when a non-volatile automatic variable might be
3378 changed by a call to @code{longjmp}. These warnings as well are possible
3379 only in optimizing compilation.
3381 The compiler sees only the calls to @code{setjmp}. It cannot know
3382 where @code{longjmp} will be called; in fact, a signal handler could
3383 call it at any point in the code. As a result, you may get a warning
3384 even when there is in fact no problem because @code{longjmp} cannot
3385 in fact be called at the place which would cause a problem.
3387 Some spurious warnings can be avoided if you declare all the functions
3388 you use that never return as @code{noreturn}. @xref{Function
3391 This warning is enabled by @option{-Wall} or @option{-Wextra}.
3393 @item -Wunknown-pragmas
3394 @opindex Wunknown-pragmas
3395 @opindex Wno-unknown-pragmas
3396 @cindex warning for unknown pragmas
3397 @cindex unknown pragmas, warning
3398 @cindex pragmas, warning of unknown
3399 Warn when a #pragma directive is encountered which is not understood by
3400 GCC@. If this command line option is used, warnings will even be issued
3401 for unknown pragmas in system header files. This is not the case if
3402 the warnings were only enabled by the @option{-Wall} command line option.
3405 @opindex Wno-pragmas
3407 Do not warn about misuses of pragmas, such as incorrect parameters,
3408 invalid syntax, or conflicts between pragmas. See also
3409 @samp{-Wunknown-pragmas}.
3411 @item -Wstrict-aliasing
3412 @opindex Wstrict-aliasing
3413 @opindex Wno-strict-aliasing
3414 This option is only active when @option{-fstrict-aliasing} is active.
3415 It warns about code which might break the strict aliasing rules that the
3416 compiler is using for optimization. The warning does not catch all
3417 cases, but does attempt to catch the more common pitfalls. It is
3418 included in @option{-Wall}.
3419 It is equivalent to @option{-Wstrict-aliasing=3}
3421 @item -Wstrict-aliasing=n
3422 @opindex Wstrict-aliasing=n
3423 @opindex Wno-strict-aliasing=n
3424 This option is only active when @option{-fstrict-aliasing} is active.
3425 It warns about code which might break the strict aliasing rules that the
3426 compiler is using for optimization.
3427 Higher levels correspond to higher accuracy (fewer false positives).
3428 Higher levels also correspond to more effort, similar to the way -O works.
3429 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
3432 Level 1: Most aggressive, quick, least accurate.
3433 Possibly useful when higher levels
3434 do not warn but -fstrict-aliasing still breaks the code, as it has very few
3435 false negatives. However, it has many false positives.
3436 Warns for all pointer conversions between possibly incompatible types,
3437 even if never dereferenced. Runs in the frontend only.
3439 Level 2: Aggressive, quick, not too precise.
3440 May still have many false positives (not as many as level 1 though),
3441 and few false negatives (but possibly more than level 1).
3442 Unlike level 1, it only warns when an address is taken. Warns about
3443 incomplete types. Runs in the frontend only.
3445 Level 3 (default for @option{-Wstrict-aliasing}):
3446 Should have very few false positives and few false
3447 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
3448 Takes care of the common punn+dereference pattern in the frontend:
3449 @code{*(int*)&some_float}.
3450 If optimization is enabled, it also runs in the backend, where it deals
3451 with multiple statement cases using flow-sensitive points-to information.
3452 Only warns when the converted pointer is dereferenced.
3453 Does not warn about incomplete types.
3455 @item -Wstrict-overflow
3456 @itemx -Wstrict-overflow=@var{n}
3457 @opindex Wstrict-overflow
3458 @opindex Wno-strict-overflow
3459 This option is only active when @option{-fstrict-overflow} is active.
3460 It warns about cases where the compiler optimizes based on the
3461 assumption that signed overflow does not occur. Note that it does not
3462 warn about all cases where the code might overflow: it only warns
3463 about cases where the compiler implements some optimization. Thus
3464 this warning depends on the optimization level.
3466 An optimization which assumes that signed overflow does not occur is
3467 perfectly safe if the values of the variables involved are such that
3468 overflow never does, in fact, occur. Therefore this warning can
3469 easily give a false positive: a warning about code which is not
3470 actually a problem. To help focus on important issues, several
3471 warning levels are defined. No warnings are issued for the use of
3472 undefined signed overflow when estimating how many iterations a loop
3473 will require, in particular when determining whether a loop will be
3477 @item -Wstrict-overflow=1
3478 Warn about cases which are both questionable and easy to avoid. For
3479 example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
3480 compiler will simplify this to @code{1}. This level of
3481 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3482 are not, and must be explicitly requested.
3484 @item -Wstrict-overflow=2
3485 Also warn about other cases where a comparison is simplified to a
3486 constant. For example: @code{abs (x) >= 0}. This can only be
3487 simplified when @option{-fstrict-overflow} is in effect, because
3488 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
3489 zero. @option{-Wstrict-overflow} (with no level) is the same as
3490 @option{-Wstrict-overflow=2}.
3492 @item -Wstrict-overflow=3
3493 Also warn about other cases where a comparison is simplified. For
3494 example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
3496 @item -Wstrict-overflow=4
3497 Also warn about other simplifications not covered by the above cases.
3498 For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
3500 @item -Wstrict-overflow=5
3501 Also warn about cases where the compiler reduces the magnitude of a
3502 constant involved in a comparison. For example: @code{x + 2 > y} will
3503 be simplified to @code{x + 1 >= y}. This is reported only at the
3504 highest warning level because this simplification applies to many
3505 comparisons, so this warning level will give a very large number of
3509 @item -Warray-bounds
3510 @opindex Wno-array-bounds
3511 @opindex Warray-bounds
3512 This option is only active when @option{-ftree-vrp} is active
3513 (default for -O2 and above). It warns about subscripts to arrays
3514 that are always out of bounds. This warning is enabled by @option{-Wall}.
3516 @item -Wno-div-by-zero
3517 @opindex Wno-div-by-zero
3518 @opindex Wdiv-by-zero
3519 Do not warn about compile-time integer division by zero. Floating point
3520 division by zero is not warned about, as it can be a legitimate way of
3521 obtaining infinities and NaNs.
3523 @item -Wsystem-headers
3524 @opindex Wsystem-headers
3525 @opindex Wno-system-headers
3526 @cindex warnings from system headers
3527 @cindex system headers, warnings from
3528 Print warning messages for constructs found in system header files.
3529 Warnings from system headers are normally suppressed, on the assumption
3530 that they usually do not indicate real problems and would only make the
3531 compiler output harder to read. Using this command line option tells
3532 GCC to emit warnings from system headers as if they occurred in user
3533 code. However, note that using @option{-Wall} in conjunction with this
3534 option will @emph{not} warn about unknown pragmas in system
3535 headers---for that, @option{-Wunknown-pragmas} must also be used.
3538 @opindex Wfloat-equal
3539 @opindex Wno-float-equal
3540 Warn if floating point values are used in equality comparisons.
3542 The idea behind this is that sometimes it is convenient (for the
3543 programmer) to consider floating-point values as approximations to
3544 infinitely precise real numbers. If you are doing this, then you need
3545 to compute (by analyzing the code, or in some other way) the maximum or
3546 likely maximum error that the computation introduces, and allow for it
3547 when performing comparisons (and when producing output, but that's a
3548 different problem). In particular, instead of testing for equality, you
3549 would check to see whether the two values have ranges that overlap; and
3550 this is done with the relational operators, so equality comparisons are
3553 @item -Wtraditional @r{(C and Objective-C only)}
3554 @opindex Wtraditional
3555 @opindex Wno-traditional
3556 Warn about certain constructs that behave differently in traditional and
3557 ISO C@. Also warn about ISO C constructs that have no traditional C
3558 equivalent, and/or problematic constructs which should be avoided.
3562 Macro parameters that appear within string literals in the macro body.
3563 In traditional C macro replacement takes place within string literals,
3564 but does not in ISO C@.
3567 In traditional C, some preprocessor directives did not exist.
3568 Traditional preprocessors would only consider a line to be a directive
3569 if the @samp{#} appeared in column 1 on the line. Therefore
3570 @option{-Wtraditional} warns about directives that traditional C
3571 understands but would ignore because the @samp{#} does not appear as the
3572 first character on the line. It also suggests you hide directives like
3573 @samp{#pragma} not understood by traditional C by indenting them. Some
3574 traditional implementations would not recognize @samp{#elif}, so it
3575 suggests avoiding it altogether.
3578 A function-like macro that appears without arguments.
3581 The unary plus operator.
3584 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
3585 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
3586 constants.) Note, these suffixes appear in macros defined in the system
3587 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
3588 Use of these macros in user code might normally lead to spurious
3589 warnings, however GCC's integrated preprocessor has enough context to
3590 avoid warning in these cases.
3593 A function declared external in one block and then used after the end of
3597 A @code{switch} statement has an operand of type @code{long}.
3600 A non-@code{static} function declaration follows a @code{static} one.
3601 This construct is not accepted by some traditional C compilers.
3604 The ISO type of an integer constant has a different width or
3605 signedness from its traditional type. This warning is only issued if
3606 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
3607 typically represent bit patterns, are not warned about.
3610 Usage of ISO string concatenation is detected.
3613 Initialization of automatic aggregates.
3616 Identifier conflicts with labels. Traditional C lacks a separate
3617 namespace for labels.
3620 Initialization of unions. If the initializer is zero, the warning is
3621 omitted. This is done under the assumption that the zero initializer in
3622 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
3623 initializer warnings and relies on default initialization to zero in the
3627 Conversions by prototypes between fixed/floating point values and vice
3628 versa. The absence of these prototypes when compiling with traditional
3629 C would cause serious problems. This is a subset of the possible
3630 conversion warnings, for the full set use @option{-Wtraditional-conversion}.
3633 Use of ISO C style function definitions. This warning intentionally is
3634 @emph{not} issued for prototype declarations or variadic functions
3635 because these ISO C features will appear in your code when using
3636 libiberty's traditional C compatibility macros, @code{PARAMS} and
3637 @code{VPARAMS}. This warning is also bypassed for nested functions
3638 because that feature is already a GCC extension and thus not relevant to
3639 traditional C compatibility.
3642 @item -Wtraditional-conversion @r{(C and Objective-C only)}
3643 @opindex Wtraditional-conversion
3644 @opindex Wno-traditional-conversion
3645 Warn if a prototype causes a type conversion that is different from what
3646 would happen to the same argument in the absence of a prototype. This
3647 includes conversions of fixed point to floating and vice versa, and
3648 conversions changing the width or signedness of a fixed point argument
3649 except when the same as the default promotion.
3651 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
3652 @opindex Wdeclaration-after-statement
3653 @opindex Wno-declaration-after-statement
3654 Warn when a declaration is found after a statement in a block. This
3655 construct, known from C++, was introduced with ISO C99 and is by default
3656 allowed in GCC@. It is not supported by ISO C90 and was not supported by
3657 GCC versions before GCC 3.0. @xref{Mixed Declarations}.
3662 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3664 @item -Wno-endif-labels
3665 @opindex Wno-endif-labels
3666 @opindex Wendif-labels
3667 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
3672 Warn whenever a local variable shadows another local variable, parameter or
3673 global variable or whenever a built-in function is shadowed.
3675 @item -Wlarger-than=@var{len}
3676 @opindex Wlarger-than=@var{len}
3677 @opindex Wlarger-than-@var{len}
3678 Warn whenever an object of larger than @var{len} bytes is defined.
3680 @item -Wframe-larger-than=@var{len}
3681 @opindex Wframe-larger-than
3682 Warn if the size of a function frame is larger than @var{len} bytes.
3683 The computation done to determine the stack frame size is approximate
3684 and not conservative.
3685 The actual requirements may be somewhat greater than @var{len}
3686 even if you do not get a warning. In addition, any space allocated
3687 via @code{alloca}, variable-length arrays, or related constructs
3688 is not included by the compiler when determining
3689 whether or not to issue a warning.
3691 @item -Wunsafe-loop-optimizations
3692 @opindex Wunsafe-loop-optimizations
3693 @opindex Wno-unsafe-loop-optimizations
3694 Warn if the loop cannot be optimized because the compiler could not
3695 assume anything on the bounds of the loop indices. With
3696 @option{-funsafe-loop-optimizations} warn if the compiler made
3699 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
3700 @opindex Wno-pedantic-ms-format
3701 @opindex Wpedantic-ms-format
3702 Disables the warnings about non-ISO @code{printf} / @code{scanf} format
3703 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets
3704 depending on the MS runtime, when you are using the options @option{-Wformat}
3705 and @option{-pedantic} without gnu-extensions.
3707 @item -Wpointer-arith
3708 @opindex Wpointer-arith
3709 @opindex Wno-pointer-arith
3710 Warn about anything that depends on the ``size of'' a function type or
3711 of @code{void}. GNU C assigns these types a size of 1, for
3712 convenience in calculations with @code{void *} pointers and pointers
3713 to functions. In C++, warn also when an arithmetic operation involves
3714 @code{NULL}. This warning is also enabled by @option{-pedantic}.
3717 @opindex Wtype-limits
3718 @opindex Wno-type-limits
3719 Warn if a comparison is always true or always false due to the limited
3720 range of the data type, but do not warn for constant expressions. For
3721 example, warn if an unsigned variable is compared against zero with
3722 @samp{<} or @samp{>=}. This warning is also enabled by
3725 @item -Wbad-function-cast @r{(C and Objective-C only)}
3726 @opindex Wbad-function-cast
3727 @opindex Wno-bad-function-cast
3728 Warn whenever a function call is cast to a non-matching type.
3729 For example, warn if @code{int malloc()} is cast to @code{anything *}.
3731 @item -Wc++-compat @r{(C and Objective-C only)}
3732 Warn about ISO C constructs that are outside of the common subset of
3733 ISO C and ISO C++, e.g.@: request for implicit conversion from
3734 @code{void *} to a pointer to non-@code{void} type.
3736 @item -Wc++0x-compat @r{(C++ and Objective-C++ only)}
3737 Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
3738 ISO C++ 200x, e.g., identifiers in ISO C++ 1998 that will become keywords
3739 in ISO C++ 200x. This warning is enabled by @option{-Wall}.
3743 @opindex Wno-cast-qual
3744 Warn whenever a pointer is cast so as to remove a type qualifier from
3745 the target type. For example, warn if a @code{const char *} is cast
3746 to an ordinary @code{char *}.
3748 Also warn when making a cast which introduces a type qualifier in an
3749 unsafe way. For example, casting @code{char **} to @code{const char **}
3750 is unsafe, as in this example:
3753 /* p is char ** value. */
3754 const char **q = (const char **) p;
3755 /* Assignment of readonly string to const char * is OK. */
3757 /* Now char** pointer points to read-only memory. */
3762 @opindex Wcast-align
3763 @opindex Wno-cast-align
3764 Warn whenever a pointer is cast such that the required alignment of the
3765 target is increased. For example, warn if a @code{char *} is cast to
3766 an @code{int *} on machines where integers can only be accessed at
3767 two- or four-byte boundaries.
3769 @item -Wwrite-strings
3770 @opindex Wwrite-strings
3771 @opindex Wno-write-strings
3772 When compiling C, give string constants the type @code{const
3773 char[@var{length}]} so that copying the address of one into a
3774 non-@code{const} @code{char *} pointer will get a warning. These
3775 warnings will help you find at compile time code that can try to write
3776 into a string constant, but only if you have been very careful about
3777 using @code{const} in declarations and prototypes. Otherwise, it will
3778 just be a nuisance. This is why we did not make @option{-Wall} request
3781 When compiling C++, warn about the deprecated conversion from string
3782 literals to @code{char *}. This warning is enabled by default for C++
3787 @opindex Wno-clobbered
3788 Warn for variables that might be changed by @samp{longjmp} or
3789 @samp{vfork}. This warning is also enabled by @option{-Wextra}.
3792 @opindex Wconversion
3793 @opindex Wno-conversion
3794 Warn for implicit conversions that may alter a value. This includes
3795 conversions between real and integer, like @code{abs (x)} when
3796 @code{x} is @code{double}; conversions between signed and unsigned,
3797 like @code{unsigned ui = -1}; and conversions to smaller types, like
3798 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
3799 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
3800 changed by the conversion like in @code{abs (2.0)}. Warnings about
3801 conversions between signed and unsigned integers can be disabled by
3802 using @option{-Wno-sign-conversion}.
3804 For C++, also warn for conversions between @code{NULL} and non-pointer
3805 types; confusing overload resolution for user-defined conversions; and
3806 conversions that will never use a type conversion operator:
3807 conversions to @code{void}, the same type, a base class or a reference
3808 to them. Warnings about conversions between signed and unsigned
3809 integers are disabled by default in C++ unless
3810 @option{-Wsign-conversion} is explicitly enabled.
3813 @opindex Wempty-body
3814 @opindex Wno-empty-body
3815 Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
3816 while} statement. This warning is also enabled by @option{-Wextra}.
3818 @item -Wenum-compare
3819 @opindex Wenum-compare
3820 @opindex Wno-enum-compare
3821 Warn about a comparison between values of different enum types. In C++
3822 this warning is enabled by default. In C this warning is enabled by
3825 @item -Wsign-compare
3826 @opindex Wsign-compare
3827 @opindex Wno-sign-compare
3828 @cindex warning for comparison of signed and unsigned values
3829 @cindex comparison of signed and unsigned values, warning
3830 @cindex signed and unsigned values, comparison warning
3831 Warn when a comparison between signed and unsigned values could produce
3832 an incorrect result when the signed value is converted to unsigned.
3833 This warning is also enabled by @option{-Wextra}; to get the other warnings
3834 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
3836 @item -Wsign-conversion
3837 @opindex Wsign-conversion
3838 @opindex Wno-sign-conversion
3839 Warn for implicit conversions that may change the sign of an integer
3840 value, like assigning a signed integer expression to an unsigned
3841 integer variable. An explicit cast silences the warning. In C, this
3842 option is enabled also by @option{-Wconversion}.
3846 @opindex Wno-address
3847 Warn about suspicious uses of memory addresses. These include using
3848 the address of a function in a conditional expression, such as
3849 @code{void func(void); if (func)}, and comparisons against the memory
3850 address of a string literal, such as @code{if (x == "abc")}. Such
3851 uses typically indicate a programmer error: the address of a function
3852 always evaluates to true, so their use in a conditional usually
3853 indicate that the programmer forgot the parentheses in a function
3854 call; and comparisons against string literals result in unspecified
3855 behavior and are not portable in C, so they usually indicate that the
3856 programmer intended to use @code{strcmp}. This warning is enabled by
3860 @opindex Wlogical-op
3861 @opindex Wno-logical-op
3862 Warn about suspicious uses of logical operators in expressions.
3863 This includes using logical operators in contexts where a
3864 bit-wise operator is likely to be expected.
3866 @item -Waggregate-return
3867 @opindex Waggregate-return
3868 @opindex Wno-aggregate-return
3869 Warn if any functions that return structures or unions are defined or
3870 called. (In languages where you can return an array, this also elicits
3873 @item -Wno-attributes
3874 @opindex Wno-attributes
3875 @opindex Wattributes
3876 Do not warn if an unexpected @code{__attribute__} is used, such as
3877 unrecognized attributes, function attributes applied to variables,
3878 etc. This will not stop errors for incorrect use of supported
3881 @item -Wno-builtin-macro-redefined
3882 @opindex Wno-builtin-macro-redefined
3883 @opindex Wbuiltin-macro-redefined
3884 Do not warn if certain built-in macros are redefined. This suppresses
3885 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
3886 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
3888 @item -Wstrict-prototypes @r{(C and Objective-C only)}
3889 @opindex Wstrict-prototypes
3890 @opindex Wno-strict-prototypes
3891 Warn if a function is declared or defined without specifying the
3892 argument types. (An old-style function definition is permitted without
3893 a warning if preceded by a declaration which specifies the argument
3896 @item -Wold-style-declaration @r{(C and Objective-C only)}
3897 @opindex Wold-style-declaration
3898 @opindex Wno-old-style-declaration
3899 Warn for obsolescent usages, according to the C Standard, in a
3900 declaration. For example, warn if storage-class specifiers like
3901 @code{static} are not the first things in a declaration. This warning
3902 is also enabled by @option{-Wextra}.
3904 @item -Wold-style-definition @r{(C and Objective-C only)}
3905 @opindex Wold-style-definition
3906 @opindex Wno-old-style-definition
3907 Warn if an old-style function definition is used. A warning is given
3908 even if there is a previous prototype.
3910 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
3911 @opindex Wmissing-parameter-type
3912 @opindex Wno-missing-parameter-type
3913 A function parameter is declared without a type specifier in K&R-style
3920 This warning is also enabled by @option{-Wextra}.
3922 @item -Wmissing-prototypes @r{(C and Objective-C only)}
3923 @opindex Wmissing-prototypes
3924 @opindex Wno-missing-prototypes
3925 Warn if a global function is defined without a previous prototype
3926 declaration. This warning is issued even if the definition itself
3927 provides a prototype. The aim is to detect global functions that fail
3928 to be declared in header files.
3930 @item -Wmissing-declarations
3931 @opindex Wmissing-declarations
3932 @opindex Wno-missing-declarations
3933 Warn if a global function is defined without a previous declaration.
3934 Do so even if the definition itself provides a prototype.
3935 Use this option to detect global functions that are not declared in
3936 header files. In C++, no warnings are issued for function templates,
3937 or for inline functions, or for functions in anonymous namespaces.
3939 @item -Wmissing-field-initializers
3940 @opindex Wmissing-field-initializers
3941 @opindex Wno-missing-field-initializers
3945 Warn if a structure's initializer has some fields missing. For
3946 example, the following code would cause such a warning, because
3947 @code{x.h} is implicitly zero:
3950 struct s @{ int f, g, h; @};
3951 struct s x = @{ 3, 4 @};
3954 This option does not warn about designated initializers, so the following
3955 modification would not trigger a warning:
3958 struct s @{ int f, g, h; @};
3959 struct s x = @{ .f = 3, .g = 4 @};
3962 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
3963 warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
3965 @item -Wmissing-noreturn
3966 @opindex Wmissing-noreturn
3967 @opindex Wno-missing-noreturn
3968 Warn about functions which might be candidates for attribute @code{noreturn}.
3969 Note these are only possible candidates, not absolute ones. Care should
3970 be taken to manually verify functions actually do not ever return before
3971 adding the @code{noreturn} attribute, otherwise subtle code generation
3972 bugs could be introduced. You will not get a warning for @code{main} in
3973 hosted C environments.
3975 @item -Wmissing-format-attribute
3976 @opindex Wmissing-format-attribute
3977 @opindex Wno-missing-format-attribute
3980 Warn about function pointers which might be candidates for @code{format}
3981 attributes. Note these are only possible candidates, not absolute ones.
3982 GCC will guess that function pointers with @code{format} attributes that
3983 are used in assignment, initialization, parameter passing or return
3984 statements should have a corresponding @code{format} attribute in the
3985 resulting type. I.e.@: the left-hand side of the assignment or
3986 initialization, the type of the parameter variable, or the return type
3987 of the containing function respectively should also have a @code{format}
3988 attribute to avoid the warning.
3990 GCC will also warn about function definitions which might be
3991 candidates for @code{format} attributes. Again, these are only
3992 possible candidates. GCC will guess that @code{format} attributes
3993 might be appropriate for any function that calls a function like
3994 @code{vprintf} or @code{vscanf}, but this might not always be the
3995 case, and some functions for which @code{format} attributes are
3996 appropriate may not be detected.
3998 @item -Wno-multichar
3999 @opindex Wno-multichar
4001 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
4002 Usually they indicate a typo in the user's code, as they have
4003 implementation-defined values, and should not be used in portable code.
4005 @item -Wnormalized=<none|id|nfc|nfkc>
4006 @opindex Wnormalized=
4009 @cindex character set, input normalization
4010 In ISO C and ISO C++, two identifiers are different if they are
4011 different sequences of characters. However, sometimes when characters
4012 outside the basic ASCII character set are used, you can have two
4013 different character sequences that look the same. To avoid confusion,
4014 the ISO 10646 standard sets out some @dfn{normalization rules} which
4015 when applied ensure that two sequences that look the same are turned into
4016 the same sequence. GCC can warn you if you are using identifiers which
4017 have not been normalized; this option controls that warning.
4019 There are four levels of warning that GCC supports. The default is
4020 @option{-Wnormalized=nfc}, which warns about any identifier which is
4021 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
4022 recommended form for most uses.
4024 Unfortunately, there are some characters which ISO C and ISO C++ allow
4025 in identifiers that when turned into NFC aren't allowable as
4026 identifiers. That is, there's no way to use these symbols in portable
4027 ISO C or C++ and have all your identifiers in NFC@.
4028 @option{-Wnormalized=id} suppresses the warning for these characters.
4029 It is hoped that future versions of the standards involved will correct
4030 this, which is why this option is not the default.
4032 You can switch the warning off for all characters by writing
4033 @option{-Wnormalized=none}. You would only want to do this if you
4034 were using some other normalization scheme (like ``D''), because
4035 otherwise you can easily create bugs that are literally impossible to see.
4037 Some characters in ISO 10646 have distinct meanings but look identical
4038 in some fonts or display methodologies, especially once formatting has
4039 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
4040 LETTER N'', will display just like a regular @code{n} which has been
4041 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
4042 normalization scheme to convert all these into a standard form as
4043 well, and GCC will warn if your code is not in NFKC if you use
4044 @option{-Wnormalized=nfkc}. This warning is comparable to warning
4045 about every identifier that contains the letter O because it might be
4046 confused with the digit 0, and so is not the default, but may be
4047 useful as a local coding convention if the programming environment is
4048 unable to be fixed to display these characters distinctly.
4050 @item -Wno-deprecated
4051 @opindex Wno-deprecated
4052 @opindex Wdeprecated
4053 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
4055 @item -Wno-deprecated-declarations
4056 @opindex Wno-deprecated-declarations
4057 @opindex Wdeprecated-declarations
4058 Do not warn about uses of functions (@pxref{Function Attributes}),
4059 variables (@pxref{Variable Attributes}), and types (@pxref{Type
4060 Attributes}) marked as deprecated by using the @code{deprecated}
4064 @opindex Wno-overflow
4066 Do not warn about compile-time overflow in constant expressions.
4068 @item -Woverride-init @r{(C and Objective-C only)}
4069 @opindex Woverride-init
4070 @opindex Wno-override-init
4074 Warn if an initialized field without side effects is overridden when
4075 using designated initializers (@pxref{Designated Inits, , Designated
4078 This warning is included in @option{-Wextra}. To get other
4079 @option{-Wextra} warnings without this one, use @samp{-Wextra
4080 -Wno-override-init}.
4085 Warn if a structure is given the packed attribute, but the packed
4086 attribute has no effect on the layout or size of the structure.
4087 Such structures may be mis-aligned for little benefit. For
4088 instance, in this code, the variable @code{f.x} in @code{struct bar}
4089 will be misaligned even though @code{struct bar} does not itself
4090 have the packed attribute:
4097 @} __attribute__((packed));
4105 @item -Wpacked-bitfield-compat
4106 @opindex Wpacked-bitfield-compat
4107 @opindex Wno-packed-bitfield-compat
4108 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
4109 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
4110 the change can lead to differences in the structure layout. GCC
4111 informs you when the offset of such a field has changed in GCC 4.4.
4112 For example there is no longer a 4-bit padding between field @code{a}
4113 and @code{b} in this structure:
4120 @} __attribute__ ((packed));
4123 This warning is enabled by default. Use
4124 @option{-Wno-packed-bitfield-compat} to disable this warning.
4129 Warn if padding is included in a structure, either to align an element
4130 of the structure or to align the whole structure. Sometimes when this
4131 happens it is possible to rearrange the fields of the structure to
4132 reduce the padding and so make the structure smaller.
4134 @item -Wredundant-decls
4135 @opindex Wredundant-decls
4136 @opindex Wno-redundant-decls
4137 Warn if anything is declared more than once in the same scope, even in
4138 cases where multiple declaration is valid and changes nothing.
4140 @item -Wnested-externs @r{(C and Objective-C only)}
4141 @opindex Wnested-externs
4142 @opindex Wno-nested-externs
4143 Warn if an @code{extern} declaration is encountered within a function.
4145 @item -Wunreachable-code
4146 @opindex Wunreachable-code
4147 @opindex Wno-unreachable-code
4148 Warn if the compiler detects that code will never be executed.
4150 This option is intended to warn when the compiler detects that at
4151 least a whole line of source code will never be executed, because
4152 some condition is never satisfied or because it is after a
4153 procedure that never returns.
4155 It is possible for this option to produce a warning even though there
4156 are circumstances under which part of the affected line can be executed,
4157 so care should be taken when removing apparently-unreachable code.
4159 For instance, when a function is inlined, a warning may mean that the
4160 line is unreachable in only one inlined copy of the function.
4162 This option is not made part of @option{-Wall} because in a debugging
4163 version of a program there is often substantial code which checks
4164 correct functioning of the program and is, hopefully, unreachable
4165 because the program does work. Another common use of unreachable
4166 code is to provide behavior which is selectable at compile-time.
4171 Warn if a function can not be inlined and it was declared as inline.
4172 Even with this option, the compiler will not warn about failures to
4173 inline functions declared in system headers.
4175 The compiler uses a variety of heuristics to determine whether or not
4176 to inline a function. For example, the compiler takes into account
4177 the size of the function being inlined and the amount of inlining
4178 that has already been done in the current function. Therefore,
4179 seemingly insignificant changes in the source program can cause the
4180 warnings produced by @option{-Winline} to appear or disappear.
4182 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4183 @opindex Wno-invalid-offsetof
4184 @opindex Winvalid-offsetof
4185 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
4186 type. According to the 1998 ISO C++ standard, applying @samp{offsetof}
4187 to a non-POD type is undefined. In existing C++ implementations,
4188 however, @samp{offsetof} typically gives meaningful results even when
4189 applied to certain kinds of non-POD types. (Such as a simple
4190 @samp{struct} that fails to be a POD type only by virtue of having a
4191 constructor.) This flag is for users who are aware that they are
4192 writing nonportable code and who have deliberately chosen to ignore the
4195 The restrictions on @samp{offsetof} may be relaxed in a future version
4196 of the C++ standard.
4198 @item -Wno-int-to-pointer-cast @r{(C and Objective-C only)}
4199 @opindex Wno-int-to-pointer-cast
4200 @opindex Wint-to-pointer-cast
4201 Suppress warnings from casts to pointer type of an integer of a
4204 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
4205 @opindex Wno-pointer-to-int-cast
4206 @opindex Wpointer-to-int-cast
4207 Suppress warnings from casts from a pointer to an integer type of a
4211 @opindex Winvalid-pch
4212 @opindex Wno-invalid-pch
4213 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
4214 the search path but can't be used.
4218 @opindex Wno-long-long
4219 Warn if @samp{long long} type is used. This is enabled by either
4220 @option{-pedantic} or @option{-Wtraditional} in ISO C90 and C++98
4221 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
4223 @item -Wvariadic-macros
4224 @opindex Wvariadic-macros
4225 @opindex Wno-variadic-macros
4226 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
4227 alternate syntax when in pedantic ISO C99 mode. This is default.
4228 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
4233 Warn if variable length array is used in the code.
4234 @option{-Wno-vla} will prevent the @option{-pedantic} warning of
4235 the variable length array.
4237 @item -Wvolatile-register-var
4238 @opindex Wvolatile-register-var
4239 @opindex Wno-volatile-register-var
4240 Warn if a register variable is declared volatile. The volatile
4241 modifier does not inhibit all optimizations that may eliminate reads
4242 and/or writes to register variables. This warning is enabled by
4245 @item -Wdisabled-optimization
4246 @opindex Wdisabled-optimization
4247 @opindex Wno-disabled-optimization
4248 Warn if a requested optimization pass is disabled. This warning does
4249 not generally indicate that there is anything wrong with your code; it
4250 merely indicates that GCC's optimizers were unable to handle the code
4251 effectively. Often, the problem is that your code is too big or too
4252 complex; GCC will refuse to optimize programs when the optimization
4253 itself is likely to take inordinate amounts of time.
4255 @item -Wpointer-sign @r{(C and Objective-C only)}
4256 @opindex Wpointer-sign
4257 @opindex Wno-pointer-sign
4258 Warn for pointer argument passing or assignment with different signedness.
4259 This option is only supported for C and Objective-C@. It is implied by
4260 @option{-Wall} and by @option{-pedantic}, which can be disabled with
4261 @option{-Wno-pointer-sign}.
4263 @item -Wstack-protector
4264 @opindex Wstack-protector
4265 @opindex Wno-stack-protector
4266 This option is only active when @option{-fstack-protector} is active. It
4267 warns about functions that will not be protected against stack smashing.
4270 @opindex Wno-mudflap
4271 Suppress warnings about constructs that cannot be instrumented by
4274 @item -Woverlength-strings
4275 @opindex Woverlength-strings
4276 @opindex Wno-overlength-strings
4277 Warn about string constants which are longer than the ``minimum
4278 maximum'' length specified in the C standard. Modern compilers
4279 generally allow string constants which are much longer than the
4280 standard's minimum limit, but very portable programs should avoid
4281 using longer strings.
4283 The limit applies @emph{after} string constant concatenation, and does
4284 not count the trailing NUL@. In C89, the limit was 509 characters; in
4285 C99, it was raised to 4095. C++98 does not specify a normative
4286 minimum maximum, so we do not diagnose overlength strings in C++@.
4288 This option is implied by @option{-pedantic}, and can be disabled with
4289 @option{-Wno-overlength-strings}.
4291 @item -Wunsuffixed-float-constants
4292 @opindex Wunsuffixed-float-constants
4294 GCC will issue a warning for any floating constant that does not have
4295 a suffix. When used together with @option{-Wsystem-headers} it will
4296 warn about such constants in system header files. This can be useful
4297 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
4298 from the decimal floating-point extension to C99.
4301 @node Debugging Options
4302 @section Options for Debugging Your Program or GCC
4303 @cindex options, debugging
4304 @cindex debugging information options
4306 GCC has various special options that are used for debugging
4307 either your program or GCC:
4312 Produce debugging information in the operating system's native format
4313 (stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
4316 On most systems that use stabs format, @option{-g} enables use of extra
4317 debugging information that only GDB can use; this extra information
4318 makes debugging work better in GDB but will probably make other debuggers
4320 refuse to read the program. If you want to control for certain whether
4321 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
4322 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
4324 GCC allows you to use @option{-g} with
4325 @option{-O}. The shortcuts taken by optimized code may occasionally
4326 produce surprising results: some variables you declared may not exist
4327 at all; flow of control may briefly move where you did not expect it;
4328 some statements may not be executed because they compute constant
4329 results or their values were already at hand; some statements may
4330 execute in different places because they were moved out of loops.
4332 Nevertheless it proves possible to debug optimized output. This makes
4333 it reasonable to use the optimizer for programs that might have bugs.
4335 The following options are useful when GCC is generated with the
4336 capability for more than one debugging format.
4340 Produce debugging information for use by GDB@. This means to use the
4341 most expressive format available (DWARF 2, stabs, or the native format
4342 if neither of those are supported), including GDB extensions if at all
4347 Produce debugging information in stabs format (if that is supported),
4348 without GDB extensions. This is the format used by DBX on most BSD
4349 systems. On MIPS, Alpha and System V Release 4 systems this option
4350 produces stabs debugging output which is not understood by DBX or SDB@.
4351 On System V Release 4 systems this option requires the GNU assembler.
4353 @item -feliminate-unused-debug-symbols
4354 @opindex feliminate-unused-debug-symbols
4355 Produce debugging information in stabs format (if that is supported),
4356 for only symbols that are actually used.
4358 @item -femit-class-debug-always
4359 Instead of emitting debugging information for a C++ class in only one
4360 object file, emit it in all object files using the class. This option
4361 should be used only with debuggers that are unable to handle the way GCC
4362 normally emits debugging information for classes because using this
4363 option will increase the size of debugging information by as much as a
4368 Produce debugging information in stabs format (if that is supported),
4369 using GNU extensions understood only by the GNU debugger (GDB)@. The
4370 use of these extensions is likely to make other debuggers crash or
4371 refuse to read the program.
4375 Produce debugging information in COFF format (if that is supported).
4376 This is the format used by SDB on most System V systems prior to
4381 Produce debugging information in XCOFF format (if that is supported).
4382 This is the format used by the DBX debugger on IBM RS/6000 systems.
4386 Produce debugging information in XCOFF format (if that is supported),
4387 using GNU extensions understood only by the GNU debugger (GDB)@. The
4388 use of these extensions is likely to make other debuggers crash or
4389 refuse to read the program, and may cause assemblers other than the GNU
4390 assembler (GAS) to fail with an error.
4392 @item -gdwarf-@var{version}
4393 @opindex gdwarf-@var{version}
4394 Produce debugging information in DWARF format (if that is
4395 supported). This is the format used by DBX on IRIX 6. The value
4396 of @var{version} may be either 2 or 3; the default version is 2.
4398 Note that with DWARF version 2 some ports require, and will always
4399 use, some non-conflicting DWARF 3 extensions in the unwind tables.
4403 Produce debugging information in VMS debug format (if that is
4404 supported). This is the format used by DEBUG on VMS systems.
4407 @itemx -ggdb@var{level}
4408 @itemx -gstabs@var{level}
4409 @itemx -gcoff@var{level}
4410 @itemx -gxcoff@var{level}
4411 @itemx -gvms@var{level}
4412 Request debugging information and also use @var{level} to specify how
4413 much information. The default level is 2.
4415 Level 0 produces no debug information at all. Thus, @option{-g0} negates
4418 Level 1 produces minimal information, enough for making backtraces in
4419 parts of the program that you don't plan to debug. This includes
4420 descriptions of functions and external variables, but no information
4421 about local variables and no line numbers.
4423 Level 3 includes extra information, such as all the macro definitions
4424 present in the program. Some debuggers support macro expansion when
4425 you use @option{-g3}.
4427 @option{-gdwarf-2} does not accept a concatenated debug level, because
4428 GCC used to support an option @option{-gdwarf} that meant to generate
4429 debug information in version 1 of the DWARF format (which is very
4430 different from version 2), and it would have been too confusing. That
4431 debug format is long obsolete, but the option cannot be changed now.
4432 Instead use an additional @option{-g@var{level}} option to change the
4433 debug level for DWARF.
4437 Turn off generation of debug info, if leaving out this option would have
4438 generated it, or turn it on at level 2 otherwise. The position of this
4439 argument in the command line does not matter, it takes effect after all
4440 other options are processed, and it does so only once, no matter how
4441 many times it is given. This is mainly intended to be used with
4442 @option{-fcompare-debug}.
4444 @item -fdump-final-insns=@var{file}
4445 @opindex fdump-final-insns=
4446 Dump the final internal representation (RTL) to @var{file}.
4448 @item -fcompare-debug@r{[}=@var{opts}@r{]}
4449 @opindex fcompare-debug
4450 @opindex fno-compare-debug
4451 If no error occurs during compilation, run the compiler a second time,
4452 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
4453 passed to the second compilation. Dump the final internal
4454 representation in both compilations, and print an error if they differ.
4456 If the equal sign is omitted, the default @option{-gtoggle} is used.
4458 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
4459 and nonzero, implicitly enables @option{-fcompare-debug}. If
4460 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
4461 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
4464 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
4465 is equivalent to @option{-fno-compare-debug}, which disables the dumping
4466 of the final representation and the second compilation, preventing even
4467 @env{GCC_COMPARE_DEBUG} from taking effect.
4469 To verify full coverage during @option{-fcompare-debug} testing, set
4470 @env{GCC_COMPARE_DEBUG} to say @samp{-fcompare-debug-not-overridden},
4471 which GCC will reject as an invalid option in any actual compilation
4472 (rather than preprocessing, assembly or linking). To get just a
4473 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
4474 not overridden} will do.
4476 @item -fcompare-debug-second
4477 @opindex fcompare-debug-second
4478 This option is implicitly passed to the compiler for the second
4479 compilation requested by @option{-fcompare-debug}, along with options to
4480 silence warnings, and omitting other options that would cause
4481 side-effect compiler outputs to files or to the standard output. Dump
4482 files and preserved temporary files are renamed so as to contain the
4483 @code{.gk} additional extension during the second compilation, to avoid
4484 overwriting those generated by the first.
4486 When this option is passed to the compiler driver, it causes the
4487 @emph{first} compilation to be skipped, which makes it useful for little
4488 other than debugging the compiler proper.
4490 @item -feliminate-dwarf2-dups
4491 @opindex feliminate-dwarf2-dups
4492 Compress DWARF2 debugging information by eliminating duplicated
4493 information about each symbol. This option only makes sense when
4494 generating DWARF2 debugging information with @option{-gdwarf-2}.
4496 @item -femit-struct-debug-baseonly
4497 Emit debug information for struct-like types
4498 only when the base name of the compilation source file
4499 matches the base name of file in which the struct was defined.
4501 This option substantially reduces the size of debugging information,
4502 but at significant potential loss in type information to the debugger.
4503 See @option{-femit-struct-debug-reduced} for a less aggressive option.
4504 See @option{-femit-struct-debug-detailed} for more detailed control.
4506 This option works only with DWARF 2.
4508 @item -femit-struct-debug-reduced
4509 Emit debug information for struct-like types
4510 only when the base name of the compilation source file
4511 matches the base name of file in which the type was defined,
4512 unless the struct is a template or defined in a system header.
4514 This option significantly reduces the size of debugging information,
4515 with some potential loss in type information to the debugger.
4516 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
4517 See @option{-femit-struct-debug-detailed} for more detailed control.
4519 This option works only with DWARF 2.
4521 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
4522 Specify the struct-like types
4523 for which the compiler will generate debug information.
4524 The intent is to reduce duplicate struct debug information
4525 between different object files within the same program.
4527 This option is a detailed version of
4528 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
4529 which will serve for most needs.
4531 A specification has the syntax
4532 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
4534 The optional first word limits the specification to
4535 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
4536 A struct type is used directly when it is the type of a variable, member.
4537 Indirect uses arise through pointers to structs.
4538 That is, when use of an incomplete struct would be legal, the use is indirect.
4540 @samp{struct one direct; struct two * indirect;}.
4542 The optional second word limits the specification to
4543 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
4544 Generic structs are a bit complicated to explain.
4545 For C++, these are non-explicit specializations of template classes,
4546 or non-template classes within the above.
4547 Other programming languages have generics,
4548 but @samp{-femit-struct-debug-detailed} does not yet implement them.
4550 The third word specifies the source files for those
4551 structs for which the compiler will emit debug information.
4552 The values @samp{none} and @samp{any} have the normal meaning.
4553 The value @samp{base} means that
4554 the base of name of the file in which the type declaration appears
4555 must match the base of the name of the main compilation file.
4556 In practice, this means that
4557 types declared in @file{foo.c} and @file{foo.h} will have debug information,
4558 but types declared in other header will not.
4559 The value @samp{sys} means those types satisfying @samp{base}
4560 or declared in system or compiler headers.
4562 You may need to experiment to determine the best settings for your application.
4564 The default is @samp{-femit-struct-debug-detailed=all}.
4566 This option works only with DWARF 2.
4568 @item -fno-merge-debug-strings
4569 @opindex fmerge-debug-strings
4570 @opindex fno-merge-debug-strings
4571 Direct the linker to not merge together strings in the debugging
4572 information which are identical in different object files. Merging is
4573 not supported by all assemblers or linkers. Merging decreases the size
4574 of the debug information in the output file at the cost of increasing
4575 link processing time. Merging is enabled by default.
4577 @item -fdebug-prefix-map=@var{old}=@var{new}
4578 @opindex fdebug-prefix-map
4579 When compiling files in directory @file{@var{old}}, record debugging
4580 information describing them as in @file{@var{new}} instead.
4582 @item -fno-dwarf2-cfi-asm
4583 @opindex fdwarf2-cfi-asm
4584 @opindex fno-dwarf2-cfi-asm
4585 Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
4586 instead of using GAS @code{.cfi_*} directives.
4588 @cindex @command{prof}
4591 Generate extra code to write profile information suitable for the
4592 analysis program @command{prof}. You must use this option when compiling
4593 the source files you want data about, and you must also use it when
4596 @cindex @command{gprof}
4599 Generate extra code to write profile information suitable for the
4600 analysis program @command{gprof}. You must use this option when compiling
4601 the source files you want data about, and you must also use it when
4606 Makes the compiler print out each function name as it is compiled, and
4607 print some statistics about each pass when it finishes.
4610 @opindex ftime-report
4611 Makes the compiler print some statistics about the time consumed by each
4612 pass when it finishes.
4615 @opindex fmem-report
4616 Makes the compiler print some statistics about permanent memory
4617 allocation when it finishes.
4619 @item -fpre-ipa-mem-report
4620 @opindex fpre-ipa-mem-report
4621 @item -fpost-ipa-mem-report
4622 @opindex fpost-ipa-mem-report
4623 Makes the compiler print some statistics about permanent memory
4624 allocation before or after interprocedural optimization.
4626 @item -fprofile-arcs
4627 @opindex fprofile-arcs
4628 Add code so that program flow @dfn{arcs} are instrumented. During
4629 execution the program records how many times each branch and call is
4630 executed and how many times it is taken or returns. When the compiled
4631 program exits it saves this data to a file called
4632 @file{@var{auxname}.gcda} for each source file. The data may be used for
4633 profile-directed optimizations (@option{-fbranch-probabilities}), or for
4634 test coverage analysis (@option{-ftest-coverage}). Each object file's
4635 @var{auxname} is generated from the name of the output file, if
4636 explicitly specified and it is not the final executable, otherwise it is
4637 the basename of the source file. In both cases any suffix is removed
4638 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
4639 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
4640 @xref{Cross-profiling}.
4642 @cindex @command{gcov}
4646 This option is used to compile and link code instrumented for coverage
4647 analysis. The option is a synonym for @option{-fprofile-arcs}
4648 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
4649 linking). See the documentation for those options for more details.
4654 Compile the source files with @option{-fprofile-arcs} plus optimization
4655 and code generation options. For test coverage analysis, use the
4656 additional @option{-ftest-coverage} option. You do not need to profile
4657 every source file in a program.
4660 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
4661 (the latter implies the former).
4664 Run the program on a representative workload to generate the arc profile
4665 information. This may be repeated any number of times. You can run
4666 concurrent instances of your program, and provided that the file system
4667 supports locking, the data files will be correctly updated. Also
4668 @code{fork} calls are detected and correctly handled (double counting
4672 For profile-directed optimizations, compile the source files again with
4673 the same optimization and code generation options plus
4674 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
4675 Control Optimization}).
4678 For test coverage analysis, use @command{gcov} to produce human readable
4679 information from the @file{.gcno} and @file{.gcda} files. Refer to the
4680 @command{gcov} documentation for further information.
4684 With @option{-fprofile-arcs}, for each function of your program GCC
4685 creates a program flow graph, then finds a spanning tree for the graph.
4686 Only arcs that are not on the spanning tree have to be instrumented: the
4687 compiler adds code to count the number of times that these arcs are
4688 executed. When an arc is the only exit or only entrance to a block, the
4689 instrumentation code can be added to the block; otherwise, a new basic
4690 block must be created to hold the instrumentation code.
4693 @item -ftest-coverage
4694 @opindex ftest-coverage
4695 Produce a notes file that the @command{gcov} code-coverage utility
4696 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
4697 show program coverage. Each source file's note file is called
4698 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
4699 above for a description of @var{auxname} and instructions on how to
4700 generate test coverage data. Coverage data will match the source files
4701 more closely, if you do not optimize.
4703 @item -fdbg-cnt-list
4704 @opindex fdbg-cnt-list
4705 Print the name and the counter upperbound for all debug counters.
4707 @item -fdbg-cnt=@var{counter-value-list}
4709 Set the internal debug counter upperbound. @var{counter-value-list}
4710 is a comma-separated list of @var{name}:@var{value} pairs
4711 which sets the upperbound of each debug counter @var{name} to @var{value}.
4712 All debug counters have the initial upperbound of @var{UINT_MAX},
4713 thus dbg_cnt() returns true always unless the upperbound is set by this option.
4714 e.g. With -fdbg-cnt=dce:10,tail_call:0
4715 dbg_cnt(dce) will return true only for first 10 invocations
4716 and dbg_cnt(tail_call) will return false always.
4718 @item -d@var{letters}
4719 @itemx -fdump-rtl-@var{pass}
4721 Says to make debugging dumps during compilation at times specified by
4722 @var{letters}. This is used for debugging the RTL-based passes of the
4723 compiler. The file names for most of the dumps are made by appending
4724 a pass number and a word to the @var{dumpname}, and the files are
4725 created in the directory of the output file. @var{dumpname} is
4726 generated from the name of the output file, if explicitly specified
4727 and it is not an executable, otherwise it is the basename of the
4728 source file. These switches may have different effects when
4729 @option{-E} is used for preprocessing.
4731 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
4732 @option{-d} option @var{letters}. Here are the possible
4733 letters for use in @var{pass} and @var{letters}, and their meanings:
4737 @item -fdump-rtl-alignments
4738 @opindex fdump-rtl-alignments
4739 Dump after branch alignments have been computed.
4741 @item -fdump-rtl-asmcons
4742 @opindex fdump-rtl-asmcons
4743 Dump after fixing rtl statements that have unsatisfied in/out constraints.
4745 @item -fdump-rtl-auto_inc_dec
4746 @opindex fdump-rtl-auto_inc_dec
4747 Dump after auto-inc-dec discovery. This pass is only run on
4748 architectures that have auto inc or auto dec instructions.
4750 @item -fdump-rtl-barriers
4751 @opindex fdump-rtl-barriers
4752 Dump after cleaning up the barrier instructions.
4754 @item -fdump-rtl-bbpart
4755 @opindex fdump-rtl-bbpart
4756 Dump after partitioning hot and cold basic blocks.
4758 @item -fdump-rtl-bbro
4759 @opindex fdump-rtl-bbro
4760 Dump after block reordering.
4762 @item -fdump-rtl-btl1
4763 @itemx -fdump-rtl-btl2
4764 @opindex fdump-rtl-btl2
4765 @opindex fdump-rtl-btl2
4766 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
4767 after the two branch
4768 target load optimization passes.
4770 @item -fdump-rtl-bypass
4771 @opindex fdump-rtl-bypass
4772 Dump after jump bypassing and control flow optimizations.
4774 @item -fdump-rtl-combine
4775 @opindex fdump-rtl-combine
4776 Dump after the RTL instruction combination pass.
4778 @item -fdump-rtl-compgotos
4779 @opindex fdump-rtl-compgotos
4780 Dump after duplicating the computed gotos.
4782 @item -fdump-rtl-ce1
4783 @itemx -fdump-rtl-ce2
4784 @itemx -fdump-rtl-ce3
4785 @opindex fdump-rtl-ce1
4786 @opindex fdump-rtl-ce2
4787 @opindex fdump-rtl-ce3
4788 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
4789 @option{-fdump-rtl-ce3} enable dumping after the three
4790 if conversion passes.
4792 @itemx -fdump-rtl-cprop_hardreg
4793 @opindex fdump-rtl-cprop_hardreg
4794 Dump after hard register copy propagation.
4796 @itemx -fdump-rtl-csa
4797 @opindex fdump-rtl-csa
4798 Dump after combining stack adjustments.
4800 @item -fdump-rtl-cse1
4801 @itemx -fdump-rtl-cse2
4802 @opindex fdump-rtl-cse1
4803 @opindex fdump-rtl-cse2
4804 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
4805 the two common sub-expression elimination passes.
4807 @itemx -fdump-rtl-dce
4808 @opindex fdump-rtl-dce
4809 Dump after the standalone dead code elimination passes.
4811 @itemx -fdump-rtl-dbr
4812 @opindex fdump-rtl-dbr
4813 Dump after delayed branch scheduling.
4815 @item -fdump-rtl-dce1
4816 @itemx -fdump-rtl-dce2
4817 @opindex fdump-rtl-dce1
4818 @opindex fdump-rtl-dce2
4819 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
4820 the two dead store elimination passes.
4823 @opindex fdump-rtl-eh
4824 Dump after finalization of EH handling code.
4826 @item -fdump-rtl-eh_ranges
4827 @opindex fdump-rtl-eh_ranges
4828 Dump after conversion of EH handling range regions.
4830 @item -fdump-rtl-expand
4831 @opindex fdump-rtl-expand
4832 Dump after RTL generation.
4834 @item -fdump-rtl-fwprop1
4835 @itemx -fdump-rtl-fwprop2
4836 @opindex fdump-rtl-fwprop1
4837 @opindex fdump-rtl-fwprop2
4838 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
4839 dumping after the two forward propagation passes.
4841 @item -fdump-rtl-gcse1
4842 @itemx -fdump-rtl-gcse2
4843 @opindex fdump-rtl-gcse1
4844 @opindex fdump-rtl-gcse2
4845 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
4846 after global common subexpression elimination.
4848 @item -fdump-rtl-init-regs
4849 @opindex fdump-rtl-init-regs
4850 Dump after the initialization of the registers.
4852 @item -fdump-rtl-initvals
4853 @opindex fdump-rtl-initvals
4854 Dump after the computation of the initial value sets.
4856 @itemx -fdump-rtl-into_cfglayout
4857 @opindex fdump-rtl-into_cfglayout
4858 Dump after converting to cfglayout mode.
4860 @item -fdump-rtl-ira
4861 @opindex fdump-rtl-ira
4862 Dump after iterated register allocation.
4864 @item -fdump-rtl-jump
4865 @opindex fdump-rtl-jump
4866 Dump after the second jump optimization.
4868 @item -fdump-rtl-loop2
4869 @opindex fdump-rtl-loop2
4870 @option{-fdump-rtl-loop2} enables dumping after the rtl
4871 loop optimization passes.
4873 @item -fdump-rtl-mach
4874 @opindex fdump-rtl-mach
4875 Dump after performing the machine dependent reorganization pass, if that
4878 @item -fdump-rtl-mode_sw
4879 @opindex fdump-rtl-mode_sw
4880 Dump after removing redundant mode switches.
4882 @item -fdump-rtl-rnreg
4883 @opindex fdump-rtl-rnreg
4884 Dump after register renumbering.
4886 @itemx -fdump-rtl-outof_cfglayout
4887 @opindex fdump-rtl-outof_cfglayout
4888 Dump after converting from cfglayout mode.
4890 @item -fdump-rtl-peephole2
4891 @opindex fdump-rtl-peephole2
4892 Dump after the peephole pass.
4894 @item -fdump-rtl-postreload
4895 @opindex fdump-rtl-postreload
4896 Dump after post-reload optimizations.
4898 @itemx -fdump-rtl-pro_and_epilogue
4899 @opindex fdump-rtl-pro_and_epilogue
4900 Dump after generating the function pro and epilogues.
4902 @item -fdump-rtl-regmove
4903 @opindex fdump-rtl-regmove
4904 Dump after the register move pass.
4906 @item -fdump-rtl-sched1
4907 @itemx -fdump-rtl-sched2
4908 @opindex fdump-rtl-sched1
4909 @opindex fdump-rtl-sched2
4910 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
4911 after the basic block scheduling passes.
4913 @item -fdump-rtl-see
4914 @opindex fdump-rtl-see
4915 Dump after sign extension elimination.
4917 @item -fdump-rtl-seqabstr
4918 @opindex fdump-rtl-seqabstr
4919 Dump after common sequence discovery.
4921 @item -fdump-rtl-shorten
4922 @opindex fdump-rtl-shorten
4923 Dump after shortening branches.
4925 @item -fdump-rtl-sibling
4926 @opindex fdump-rtl-sibling
4927 Dump after sibling call optimizations.
4929 @item -fdump-rtl-split1
4930 @itemx -fdump-rtl-split2
4931 @itemx -fdump-rtl-split3
4932 @itemx -fdump-rtl-split4
4933 @itemx -fdump-rtl-split5
4934 @opindex fdump-rtl-split1
4935 @opindex fdump-rtl-split2
4936 @opindex fdump-rtl-split3
4937 @opindex fdump-rtl-split4
4938 @opindex fdump-rtl-split5
4939 @option{-fdump-rtl-split1}, @option{-fdump-rtl-split2},
4940 @option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and
4941 @option{-fdump-rtl-split5} enable dumping after five rounds of
4942 instruction splitting.
4944 @item -fdump-rtl-sms
4945 @opindex fdump-rtl-sms
4946 Dump after modulo scheduling. This pass is only run on some
4949 @item -fdump-rtl-stack
4950 @opindex fdump-rtl-stack
4951 Dump after conversion from GCC's "flat register file" registers to the
4952 x87's stack-like registers. This pass is only run on x86 variants.
4954 @item -fdump-rtl-subreg1
4955 @itemx -fdump-rtl-subreg2
4956 @opindex fdump-rtl-subreg1
4957 @opindex fdump-rtl-subreg2
4958 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
4959 the two subreg expansion passes.
4961 @item -fdump-rtl-unshare
4962 @opindex fdump-rtl-unshare
4963 Dump after all rtl has been unshared.
4965 @item -fdump-rtl-vartrack
4966 @opindex fdump-rtl-vartrack
4967 Dump after variable tracking.
4969 @item -fdump-rtl-vregs
4970 @opindex fdump-rtl-vregs
4971 Dump after converting virtual registers to hard registers.
4973 @item -fdump-rtl-web
4974 @opindex fdump-rtl-web
4975 Dump after live range splitting.
4977 @item -fdump-rtl-regclass
4978 @itemx -fdump-rtl-subregs_of_mode_init
4979 @itemx -fdump-rtl-subregs_of_mode_finish
4980 @itemx -fdump-rtl-dfinit
4981 @itemx -fdump-rtl-dfinish
4982 @opindex fdump-rtl-regclass
4983 @opindex fdump-rtl-subregs_of_mode_init
4984 @opindex fdump-rtl-subregs_of_mode_finish
4985 @opindex fdump-rtl-dfinit
4986 @opindex fdump-rtl-dfinish
4987 These dumps are defined but always produce empty files.
4989 @item -fdump-rtl-all
4990 @opindex fdump-rtl-all
4991 Produce all the dumps listed above.
4995 Annotate the assembler output with miscellaneous debugging information.
4999 Dump all macro definitions, at the end of preprocessing, in addition to
5004 Produce a core dump whenever an error occurs.
5008 Print statistics on memory usage, at the end of the run, to
5013 Annotate the assembler output with a comment indicating which
5014 pattern and alternative was used. The length of each instruction is
5019 Dump the RTL in the assembler output as a comment before each instruction.
5020 Also turns on @option{-dp} annotation.
5024 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
5025 dump a representation of the control flow graph suitable for viewing with VCG
5026 to @file{@var{file}.@var{pass}.vcg}.
5030 Just generate RTL for a function instead of compiling it. Usually used
5031 with @option{-fdump-rtl-expand}.
5035 Dump debugging information during parsing, to standard error.
5039 @opindex fdump-noaddr
5040 When doing debugging dumps, suppress address output. This makes it more
5041 feasible to use diff on debugging dumps for compiler invocations with
5042 different compiler binaries and/or different
5043 text / bss / data / heap / stack / dso start locations.
5045 @item -fdump-unnumbered
5046 @opindex fdump-unnumbered
5047 When doing debugging dumps, suppress instruction numbers and address output.
5048 This makes it more feasible to use diff on debugging dumps for compiler
5049 invocations with different options, in particular with and without
5052 @item -fdump-unnumbered-links
5053 @opindex fdump-unnumbered-links
5054 When doing debugging dumps (see @option{-d} option above), suppress
5055 instruction numbers for the links to the previous and next instructions
5058 @item -fdump-translation-unit @r{(C++ only)}
5059 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
5060 @opindex fdump-translation-unit
5061 Dump a representation of the tree structure for the entire translation
5062 unit to a file. The file name is made by appending @file{.tu} to the
5063 source file name, and the file is created in the same directory as the
5064 output file. If the @samp{-@var{options}} form is used, @var{options}
5065 controls the details of the dump as described for the
5066 @option{-fdump-tree} options.
5068 @item -fdump-class-hierarchy @r{(C++ only)}
5069 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
5070 @opindex fdump-class-hierarchy
5071 Dump a representation of each class's hierarchy and virtual function
5072 table layout to a file. The file name is made by appending
5073 @file{.class} to the source file name, and the file is created in the
5074 same directory as the output file. If the @samp{-@var{options}} form
5075 is used, @var{options} controls the details of the dump as described
5076 for the @option{-fdump-tree} options.
5078 @item -fdump-ipa-@var{switch}
5080 Control the dumping at various stages of inter-procedural analysis
5081 language tree to a file. The file name is generated by appending a
5082 switch specific suffix to the source file name, and the file is created
5083 in the same directory as the output file. The following dumps are
5088 Enables all inter-procedural analysis dumps.
5091 Dumps information about call-graph optimization, unused function removal,
5092 and inlining decisions.
5095 Dump after function inlining.
5099 @item -fdump-statistics-@var{option}
5100 @opindex fdump-statistics
5101 Enable and control dumping of pass statistics in a separate file. The
5102 file name is generated by appending a suffix ending in
5103 @samp{.statistics} to the source file name, and the file is created in
5104 the same directory as the output file. If the @samp{-@var{option}}
5105 form is used, @samp{-stats} will cause counters to be summed over the
5106 whole compilation unit while @samp{-details} will dump every event as
5107 the passes generate them. The default with no option is to sum
5108 counters for each function compiled.
5110 @item -fdump-tree-@var{switch}
5111 @itemx -fdump-tree-@var{switch}-@var{options}
5113 Control the dumping at various stages of processing the intermediate
5114 language tree to a file. The file name is generated by appending a
5115 switch specific suffix to the source file name, and the file is
5116 created in the same directory as the output file. If the
5117 @samp{-@var{options}} form is used, @var{options} is a list of
5118 @samp{-} separated options that control the details of the dump. Not
5119 all options are applicable to all dumps, those which are not
5120 meaningful will be ignored. The following options are available
5124 Print the address of each node. Usually this is not meaningful as it
5125 changes according to the environment and source file. Its primary use
5126 is for tying up a dump file with a debug environment.
5128 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
5129 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
5130 use working backward from mangled names in the assembly file.
5132 Inhibit dumping of members of a scope or body of a function merely
5133 because that scope has been reached. Only dump such items when they
5134 are directly reachable by some other path. When dumping pretty-printed
5135 trees, this option inhibits dumping the bodies of control structures.
5137 Print a raw representation of the tree. By default, trees are
5138 pretty-printed into a C-like representation.
5140 Enable more detailed dumps (not honored by every dump option).
5142 Enable dumping various statistics about the pass (not honored by every dump
5145 Enable showing basic block boundaries (disabled in raw dumps).
5147 Enable showing virtual operands for every statement.
5149 Enable showing line numbers for statements.
5151 Enable showing the unique ID (@code{DECL_UID}) for each variable.
5153 Enable showing the tree dump for each statement.
5155 Enable showing the EH region number holding each statement.
5157 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
5158 and @option{lineno}.
5161 The following tree dumps are possible:
5165 @opindex fdump-tree-original
5166 Dump before any tree based optimization, to @file{@var{file}.original}.
5169 @opindex fdump-tree-optimized
5170 Dump after all tree based optimization, to @file{@var{file}.optimized}.
5173 @opindex fdump-tree-gimple
5174 Dump each function before and after the gimplification pass to a file. The
5175 file name is made by appending @file{.gimple} to the source file name.
5178 @opindex fdump-tree-cfg
5179 Dump the control flow graph of each function to a file. The file name is
5180 made by appending @file{.cfg} to the source file name.
5183 @opindex fdump-tree-vcg
5184 Dump the control flow graph of each function to a file in VCG format. The
5185 file name is made by appending @file{.vcg} to the source file name. Note
5186 that if the file contains more than one function, the generated file cannot
5187 be used directly by VCG@. You will need to cut and paste each function's
5188 graph into its own separate file first.
5191 @opindex fdump-tree-ch
5192 Dump each function after copying loop headers. The file name is made by
5193 appending @file{.ch} to the source file name.
5196 @opindex fdump-tree-ssa
5197 Dump SSA related information to a file. The file name is made by appending
5198 @file{.ssa} to the source file name.
5201 @opindex fdump-tree-alias
5202 Dump aliasing information for each function. The file name is made by
5203 appending @file{.alias} to the source file name.
5206 @opindex fdump-tree-ccp
5207 Dump each function after CCP@. The file name is made by appending
5208 @file{.ccp} to the source file name.
5211 @opindex fdump-tree-storeccp
5212 Dump each function after STORE-CCP@. The file name is made by appending
5213 @file{.storeccp} to the source file name.
5216 @opindex fdump-tree-pre
5217 Dump trees after partial redundancy elimination. The file name is made
5218 by appending @file{.pre} to the source file name.
5221 @opindex fdump-tree-fre
5222 Dump trees after full redundancy elimination. The file name is made
5223 by appending @file{.fre} to the source file name.
5226 @opindex fdump-tree-copyprop
5227 Dump trees after copy propagation. The file name is made
5228 by appending @file{.copyprop} to the source file name.
5230 @item store_copyprop
5231 @opindex fdump-tree-store_copyprop
5232 Dump trees after store copy-propagation. The file name is made
5233 by appending @file{.store_copyprop} to the source file name.
5236 @opindex fdump-tree-dce
5237 Dump each function after dead code elimination. The file name is made by
5238 appending @file{.dce} to the source file name.
5241 @opindex fdump-tree-mudflap
5242 Dump each function after adding mudflap instrumentation. The file name is
5243 made by appending @file{.mudflap} to the source file name.
5246 @opindex fdump-tree-sra
5247 Dump each function after performing scalar replacement of aggregates. The
5248 file name is made by appending @file{.sra} to the source file name.
5251 @opindex fdump-tree-sink
5252 Dump each function after performing code sinking. The file name is made
5253 by appending @file{.sink} to the source file name.
5256 @opindex fdump-tree-dom
5257 Dump each function after applying dominator tree optimizations. The file
5258 name is made by appending @file{.dom} to the source file name.
5261 @opindex fdump-tree-dse
5262 Dump each function after applying dead store elimination. The file
5263 name is made by appending @file{.dse} to the source file name.
5266 @opindex fdump-tree-phiopt
5267 Dump each function after optimizing PHI nodes into straightline code. The file
5268 name is made by appending @file{.phiopt} to the source file name.
5271 @opindex fdump-tree-forwprop
5272 Dump each function after forward propagating single use variables. The file
5273 name is made by appending @file{.forwprop} to the source file name.
5276 @opindex fdump-tree-copyrename
5277 Dump each function after applying the copy rename optimization. The file
5278 name is made by appending @file{.copyrename} to the source file name.
5281 @opindex fdump-tree-nrv
5282 Dump each function after applying the named return value optimization on
5283 generic trees. The file name is made by appending @file{.nrv} to the source
5287 @opindex fdump-tree-vect
5288 Dump each function after applying vectorization of loops. The file name is
5289 made by appending @file{.vect} to the source file name.
5292 @opindex fdump-tree-vrp
5293 Dump each function after Value Range Propagation (VRP). The file name
5294 is made by appending @file{.vrp} to the source file name.
5297 @opindex fdump-tree-all
5298 Enable all the available tree dumps with the flags provided in this option.
5301 @item -ftree-vectorizer-verbose=@var{n}
5302 @opindex ftree-vectorizer-verbose
5303 This option controls the amount of debugging output the vectorizer prints.
5304 This information is written to standard error, unless
5305 @option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified,
5306 in which case it is output to the usual dump listing file, @file{.vect}.
5307 For @var{n}=0 no diagnostic information is reported.
5308 If @var{n}=1 the vectorizer reports each loop that got vectorized,
5309 and the total number of loops that got vectorized.
5310 If @var{n}=2 the vectorizer also reports non-vectorized loops that passed
5311 the first analysis phase (vect_analyze_loop_form) - i.e.@: countable,
5312 inner-most, single-bb, single-entry/exit loops. This is the same verbosity
5313 level that @option{-fdump-tree-vect-stats} uses.
5314 Higher verbosity levels mean either more information dumped for each
5315 reported loop, or same amount of information reported for more loops:
5316 If @var{n}=3, alignment related information is added to the reports.
5317 If @var{n}=4, data-references related information (e.g.@: memory dependences,
5318 memory access-patterns) is added to the reports.
5319 If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops
5320 that did not pass the first analysis phase (i.e., may not be countable, or
5321 may have complicated control-flow).
5322 If @var{n}=6, the vectorizer reports also non-vectorized nested loops.
5323 For @var{n}=7, all the information the vectorizer generates during its
5324 analysis and transformation is reported. This is the same verbosity level
5325 that @option{-fdump-tree-vect-details} uses.
5327 @item -frandom-seed=@var{string}
5328 @opindex frandom-seed
5329 This option provides a seed that GCC uses when it would otherwise use
5330 random numbers. It is used to generate certain symbol names
5331 that have to be different in every compiled file. It is also used to
5332 place unique stamps in coverage data files and the object files that
5333 produce them. You can use the @option{-frandom-seed} option to produce
5334 reproducibly identical object files.
5336 The @var{string} should be different for every file you compile.
5338 @item -fsched-verbose=@var{n}
5339 @opindex fsched-verbose
5340 On targets that use instruction scheduling, this option controls the
5341 amount of debugging output the scheduler prints. This information is
5342 written to standard error, unless @option{-fdump-rtl-sched1} or
5343 @option{-fdump-rtl-sched2} is specified, in which case it is output
5344 to the usual dump listing file, @file{.sched} or @file{.sched2}
5345 respectively. However for @var{n} greater than nine, the output is
5346 always printed to standard error.
5348 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
5349 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
5350 For @var{n} greater than one, it also output basic block probabilities,
5351 detailed ready list information and unit/insn info. For @var{n} greater
5352 than two, it includes RTL at abort point, control-flow and regions info.
5353 And for @var{n} over four, @option{-fsched-verbose} also includes
5357 @itemx -save-temps=cwd
5359 Store the usual ``temporary'' intermediate files permanently; place them
5360 in the current directory and name them based on the source file. Thus,
5361 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
5362 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
5363 preprocessed @file{foo.i} output file even though the compiler now
5364 normally uses an integrated preprocessor.
5366 When used in combination with the @option{-x} command line option,
5367 @option{-save-temps} is sensible enough to avoid over writing an
5368 input source file with the same extension as an intermediate file.
5369 The corresponding intermediate file may be obtained by renaming the
5370 source file before using @option{-save-temps}.
5372 If you invoke GCC in parallel, compiling several different source
5373 files that share a common base name in different subdirectories or the
5374 same source file compiled for multiple output destinations, it is
5375 likely that the different parallel compilers will interfere with each
5376 other, and overwrite the temporary files. For instance:
5379 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
5380 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
5383 may result in @file{foo.i} and @file{foo.o} being written to
5384 simultaneously by both compilers.
5386 @item -save-temps=obj
5387 @opindex save-temps=obj
5388 Store the usual ``temporary'' intermediate files permanently. If the
5389 @option{-o} option is used, the temporary files are based on the
5390 object file. If the @option{-o} option is not used, the
5391 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
5396 gcc -save-temps=obj -c foo.c
5397 gcc -save-temps=obj -c bar.c -o dir/xbar.o
5398 gcc -save-temps=obj foobar.c -o dir2/yfoobar
5401 would create @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
5402 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
5403 @file{dir2/yfoobar.o}.
5405 @item -time@r{[}=@var{file}@r{]}
5407 Report the CPU time taken by each subprocess in the compilation
5408 sequence. For C source files, this is the compiler proper and assembler
5409 (plus the linker if linking is done).
5411 Without the specification of an output file, the output looks like this:
5418 The first number on each line is the ``user time'', that is time spent
5419 executing the program itself. The second number is ``system time'',
5420 time spent executing operating system routines on behalf of the program.
5421 Both numbers are in seconds.
5423 With the specification of an output file, the output is appended to the
5424 named file, and it looks like this:
5427 0.12 0.01 cc1 @var{options}
5428 0.00 0.01 as @var{options}
5431 The ``user time'' and the ``system time'' are moved before the program
5432 name, and the options passed to the program are displayed, so that one
5433 can later tell what file was being compiled, and with which options.
5435 @item -fvar-tracking
5436 @opindex fvar-tracking
5437 Run variable tracking pass. It computes where variables are stored at each
5438 position in code. Better debugging information is then generated
5439 (if the debugging information format supports this information).
5441 It is enabled by default when compiling with optimization (@option{-Os},
5442 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
5443 the debug info format supports it.
5445 @item -print-file-name=@var{library}
5446 @opindex print-file-name
5447 Print the full absolute name of the library file @var{library} that
5448 would be used when linking---and don't do anything else. With this
5449 option, GCC does not compile or link anything; it just prints the
5452 @item -print-multi-directory
5453 @opindex print-multi-directory
5454 Print the directory name corresponding to the multilib selected by any
5455 other switches present in the command line. This directory is supposed
5456 to exist in @env{GCC_EXEC_PREFIX}.
5458 @item -print-multi-lib
5459 @opindex print-multi-lib
5460 Print the mapping from multilib directory names to compiler switches
5461 that enable them. The directory name is separated from the switches by
5462 @samp{;}, and each switch starts with an @samp{@@} instead of the
5463 @samp{-}, without spaces between multiple switches. This is supposed to
5464 ease shell-processing.
5466 @item -print-prog-name=@var{program}
5467 @opindex print-prog-name
5468 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
5470 @item -print-libgcc-file-name
5471 @opindex print-libgcc-file-name
5472 Same as @option{-print-file-name=libgcc.a}.
5474 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
5475 but you do want to link with @file{libgcc.a}. You can do
5478 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
5481 @item -print-search-dirs
5482 @opindex print-search-dirs
5483 Print the name of the configured installation directory and a list of
5484 program and library directories @command{gcc} will search---and don't do anything else.
5486 This is useful when @command{gcc} prints the error message
5487 @samp{installation problem, cannot exec cpp0: No such file or directory}.
5488 To resolve this you either need to put @file{cpp0} and the other compiler
5489 components where @command{gcc} expects to find them, or you can set the environment
5490 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
5491 Don't forget the trailing @samp{/}.
5492 @xref{Environment Variables}.
5494 @item -print-sysroot
5495 @opindex print-sysroot
5496 Print the target sysroot directory that will be used during
5497 compilation. This is the target sysroot specified either at configure
5498 time or using the @option{--sysroot} option, possibly with an extra
5499 suffix that depends on compilation options. If no target sysroot is
5500 specified, the option prints nothing.
5502 @item -print-sysroot-headers-suffix
5503 @opindex print-sysroot-headers-suffix
5504 Print the suffix added to the target sysroot when searching for
5505 headers, or give an error if the compiler is not configured with such
5506 a suffix---and don't do anything else.
5509 @opindex dumpmachine
5510 Print the compiler's target machine (for example,
5511 @samp{i686-pc-linux-gnu})---and don't do anything else.
5514 @opindex dumpversion
5515 Print the compiler version (for example, @samp{3.0})---and don't do
5520 Print the compiler's built-in specs---and don't do anything else. (This
5521 is used when GCC itself is being built.) @xref{Spec Files}.
5523 @item -feliminate-unused-debug-types
5524 @opindex feliminate-unused-debug-types
5525 Normally, when producing DWARF2 output, GCC will emit debugging
5526 information for all types declared in a compilation
5527 unit, regardless of whether or not they are actually used
5528 in that compilation unit. Sometimes this is useful, such as
5529 if, in the debugger, you want to cast a value to a type that is
5530 not actually used in your program (but is declared). More often,
5531 however, this results in a significant amount of wasted space.
5532 With this option, GCC will avoid producing debug symbol output
5533 for types that are nowhere used in the source file being compiled.
5536 @node Optimize Options
5537 @section Options That Control Optimization
5538 @cindex optimize options
5539 @cindex options, optimization
5541 These options control various sorts of optimizations.
5543 Without any optimization option, the compiler's goal is to reduce the
5544 cost of compilation and to make debugging produce the expected
5545 results. Statements are independent: if you stop the program with a
5546 breakpoint between statements, you can then assign a new value to any
5547 variable or change the program counter to any other statement in the
5548 function and get exactly the results you would expect from the source
5551 Turning on optimization flags makes the compiler attempt to improve
5552 the performance and/or code size at the expense of compilation time
5553 and possibly the ability to debug the program.
5555 The compiler performs optimization based on the knowledge it has of the
5556 program. Compiling multiple files at once to a single output file mode allows
5557 the compiler to use information gained from all of the files when compiling
5560 Not all optimizations are controlled directly by a flag. Only
5561 optimizations that have a flag are listed in this section.
5563 Depending on the target and how GCC was configured, a slightly different
5564 set of optimizations may be enabled at each @option{-O} level than
5565 those listed here. You can invoke GCC with @samp{-Q --help=optimizers}
5566 to find out the exact set of optimizations that are enabled at each level.
5567 @xref{Overall Options}, for examples.
5574 Optimize. Optimizing compilation takes somewhat more time, and a lot
5575 more memory for a large function.
5577 With @option{-O}, the compiler tries to reduce code size and execution
5578 time, without performing any optimizations that take a great deal of
5581 @option{-O} turns on the following optimization flags:
5584 -fcprop-registers @gol
5587 -fdelayed-branch @gol
5589 -fguess-branch-probability @gol
5590 -fif-conversion2 @gol
5591 -fif-conversion @gol
5592 -finline-small-functions @gol
5593 -fipa-pure-const @gol
5594 -fipa-reference @gol
5596 -fsplit-wide-types @gol
5597 -ftree-builtin-call-dce @gol
5600 -ftree-copyrename @gol
5602 -ftree-dominator-opts @gol
5604 -ftree-forwprop @gol
5612 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
5613 where doing so does not interfere with debugging.
5617 Optimize even more. GCC performs nearly all supported optimizations
5618 that do not involve a space-speed tradeoff.
5619 As compared to @option{-O}, this option increases both compilation time
5620 and the performance of the generated code.
5622 @option{-O2} turns on all optimization flags specified by @option{-O}. It
5623 also turns on the following optimization flags:
5624 @gccoptlist{-fthread-jumps @gol
5625 -falign-functions -falign-jumps @gol
5626 -falign-loops -falign-labels @gol
5629 -fcse-follow-jumps -fcse-skip-blocks @gol
5630 -fdelete-null-pointer-checks @gol
5631 -fexpensive-optimizations @gol
5632 -fgcse -fgcse-lm @gol
5633 -findirect-inlining @gol
5634 -foptimize-sibling-calls @gol
5637 -freorder-blocks -freorder-functions @gol
5638 -frerun-cse-after-loop @gol
5639 -fsched-interblock -fsched-spec @gol
5640 -fschedule-insns -fschedule-insns2 @gol
5641 -fstrict-aliasing -fstrict-overflow @gol
5642 -ftree-switch-conversion @gol
5646 Please note the warning under @option{-fgcse} about
5647 invoking @option{-O2} on programs that use computed gotos.
5651 Optimize yet more. @option{-O3} turns on all optimizations specified
5652 by @option{-O2} and also turns on the @option{-finline-functions},
5653 @option{-funswitch-loops}, @option{-fpredictive-commoning},
5654 @option{-fgcse-after-reload} and @option{-ftree-vectorize} options.
5658 Reduce compilation time and make debugging produce the expected
5659 results. This is the default.
5663 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
5664 do not typically increase code size. It also performs further
5665 optimizations designed to reduce code size.
5667 @option{-Os} disables the following optimization flags:
5668 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
5669 -falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
5670 -fprefetch-loop-arrays -ftree-vect-loop-version}
5672 If you use multiple @option{-O} options, with or without level numbers,
5673 the last such option is the one that is effective.
5676 Options of the form @option{-f@var{flag}} specify machine-independent
5677 flags. Most flags have both positive and negative forms; the negative
5678 form of @option{-ffoo} would be @option{-fno-foo}. In the table
5679 below, only one of the forms is listed---the one you typically will
5680 use. You can figure out the other form by either removing @samp{no-}
5683 The following options control specific optimizations. They are either
5684 activated by @option{-O} options or are related to ones that are. You
5685 can use the following flags in the rare cases when ``fine-tuning'' of
5686 optimizations to be performed is desired.
5689 @item -fno-default-inline
5690 @opindex fno-default-inline
5691 Do not make member functions inline by default merely because they are
5692 defined inside the class scope (C++ only). Otherwise, when you specify
5693 @w{@option{-O}}, member functions defined inside class scope are compiled
5694 inline by default; i.e., you don't need to add @samp{inline} in front of
5695 the member function name.
5697 @item -fno-defer-pop
5698 @opindex fno-defer-pop
5699 Always pop the arguments to each function call as soon as that function
5700 returns. For machines which must pop arguments after a function call,
5701 the compiler normally lets arguments accumulate on the stack for several
5702 function calls and pops them all at once.
5704 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5706 @item -fforward-propagate
5707 @opindex fforward-propagate
5708 Perform a forward propagation pass on RTL@. The pass tries to combine two
5709 instructions and checks if the result can be simplified. If loop unrolling
5710 is active, two passes are performed and the second is scheduled after
5713 This option is enabled by default at optimization levels @option{-O},
5714 @option{-O2}, @option{-O3}, @option{-Os}.
5716 @item -fomit-frame-pointer
5717 @opindex fomit-frame-pointer
5718 Don't keep the frame pointer in a register for functions that
5719 don't need one. This avoids the instructions to save, set up and
5720 restore frame pointers; it also makes an extra register available
5721 in many functions. @strong{It also makes debugging impossible on
5724 On some machines, such as the VAX, this flag has no effect, because
5725 the standard calling sequence automatically handles the frame pointer
5726 and nothing is saved by pretending it doesn't exist. The
5727 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
5728 whether a target machine supports this flag. @xref{Registers,,Register
5729 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
5731 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5733 @item -foptimize-sibling-calls
5734 @opindex foptimize-sibling-calls
5735 Optimize sibling and tail recursive calls.
5737 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5741 Don't pay attention to the @code{inline} keyword. Normally this option
5742 is used to keep the compiler from expanding any functions inline.
5743 Note that if you are not optimizing, no functions can be expanded inline.
5745 @item -finline-small-functions
5746 @opindex finline-small-functions
5747 Integrate functions into their callers when their body is smaller than expected
5748 function call code (so overall size of program gets smaller). The compiler
5749 heuristically decides which functions are simple enough to be worth integrating
5752 Enabled at level @option{-O2}.
5754 @item -findirect-inlining
5755 @opindex findirect-inlining
5756 Inline also indirect calls that are discovered to be known at compile
5757 time thanks to previous inlining. This option has any effect only
5758 when inlining itself is turned on by the @option{-finline-functions}
5759 or @option{-finline-small-functions} options.
5761 Enabled at level @option{-O2}.
5763 @item -finline-functions
5764 @opindex finline-functions
5765 Integrate all simple functions into their callers. The compiler
5766 heuristically decides which functions are simple enough to be worth
5767 integrating in this way.
5769 If all calls to a given function are integrated, and the function is
5770 declared @code{static}, then the function is normally not output as
5771 assembler code in its own right.
5773 Enabled at level @option{-O3}.
5775 @item -finline-functions-called-once
5776 @opindex finline-functions-called-once
5777 Consider all @code{static} functions called once for inlining into their
5778 caller even if they are not marked @code{inline}. If a call to a given
5779 function is integrated, then the function is not output as assembler code
5782 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
5784 @item -fearly-inlining
5785 @opindex fearly-inlining
5786 Inline functions marked by @code{always_inline} and functions whose body seems
5787 smaller than the function call overhead early before doing
5788 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
5789 makes profiling significantly cheaper and usually inlining faster on programs
5790 having large chains of nested wrapper functions.
5794 @item -finline-limit=@var{n}
5795 @opindex finline-limit
5796 By default, GCC limits the size of functions that can be inlined. This flag
5797 allows coarse control of this limit. @var{n} is the size of functions that
5798 can be inlined in number of pseudo instructions.
5800 Inlining is actually controlled by a number of parameters, which may be
5801 specified individually by using @option{--param @var{name}=@var{value}}.
5802 The @option{-finline-limit=@var{n}} option sets some of these parameters
5806 @item max-inline-insns-single
5807 is set to @var{n}/2.
5808 @item max-inline-insns-auto
5809 is set to @var{n}/2.
5812 See below for a documentation of the individual
5813 parameters controlling inlining and for the defaults of these parameters.
5815 @emph{Note:} there may be no value to @option{-finline-limit} that results
5816 in default behavior.
5818 @emph{Note:} pseudo instruction represents, in this particular context, an
5819 abstract measurement of function's size. In no way does it represent a count
5820 of assembly instructions and as such its exact meaning might change from one
5821 release to an another.
5823 @item -fkeep-inline-functions
5824 @opindex fkeep-inline-functions
5825 In C, emit @code{static} functions that are declared @code{inline}
5826 into the object file, even if the function has been inlined into all
5827 of its callers. This switch does not affect functions using the
5828 @code{extern inline} extension in GNU C89@. In C++, emit any and all
5829 inline functions into the object file.
5831 @item -fkeep-static-consts
5832 @opindex fkeep-static-consts
5833 Emit variables declared @code{static const} when optimization isn't turned
5834 on, even if the variables aren't referenced.
5836 GCC enables this option by default. If you want to force the compiler to
5837 check if the variable was referenced, regardless of whether or not
5838 optimization is turned on, use the @option{-fno-keep-static-consts} option.
5840 @item -fmerge-constants
5841 @opindex fmerge-constants
5842 Attempt to merge identical constants (string constants and floating point
5843 constants) across compilation units.
5845 This option is the default for optimized compilation if the assembler and
5846 linker support it. Use @option{-fno-merge-constants} to inhibit this
5849 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5851 @item -fmerge-all-constants
5852 @opindex fmerge-all-constants
5853 Attempt to merge identical constants and identical variables.
5855 This option implies @option{-fmerge-constants}. In addition to
5856 @option{-fmerge-constants} this considers e.g.@: even constant initialized
5857 arrays or initialized constant variables with integral or floating point
5858 types. Languages like C or C++ require each variable, including multiple
5859 instances of the same variable in recursive calls, to have distinct locations,
5860 so using this option will result in non-conforming
5863 @item -fmodulo-sched
5864 @opindex fmodulo-sched
5865 Perform swing modulo scheduling immediately before the first scheduling
5866 pass. This pass looks at innermost loops and reorders their
5867 instructions by overlapping different iterations.
5869 @item -fmodulo-sched-allow-regmoves
5870 @opindex fmodulo-sched-allow-regmoves
5871 Perform more aggressive SMS based modulo scheduling with register moves
5872 allowed. By setting this flag certain anti-dependences edges will be
5873 deleted which will trigger the generation of reg-moves based on the
5874 life-range analysis. This option is effective only with
5875 @option{-fmodulo-sched} enabled.
5877 @item -fno-branch-count-reg
5878 @opindex fno-branch-count-reg
5879 Do not use ``decrement and branch'' instructions on a count register,
5880 but instead generate a sequence of instructions that decrement a
5881 register, compare it against zero, then branch based upon the result.
5882 This option is only meaningful on architectures that support such
5883 instructions, which include x86, PowerPC, IA-64 and S/390.
5885 The default is @option{-fbranch-count-reg}.
5887 @item -fno-function-cse
5888 @opindex fno-function-cse
5889 Do not put function addresses in registers; make each instruction that
5890 calls a constant function contain the function's address explicitly.
5892 This option results in less efficient code, but some strange hacks
5893 that alter the assembler output may be confused by the optimizations
5894 performed when this option is not used.
5896 The default is @option{-ffunction-cse}
5898 @item -fno-zero-initialized-in-bss
5899 @opindex fno-zero-initialized-in-bss
5900 If the target supports a BSS section, GCC by default puts variables that
5901 are initialized to zero into BSS@. This can save space in the resulting
5904 This option turns off this behavior because some programs explicitly
5905 rely on variables going to the data section. E.g., so that the
5906 resulting executable can find the beginning of that section and/or make
5907 assumptions based on that.
5909 The default is @option{-fzero-initialized-in-bss}.
5911 @item -fmudflap -fmudflapth -fmudflapir
5915 @cindex bounds checking
5917 For front-ends that support it (C and C++), instrument all risky
5918 pointer/array dereferencing operations, some standard library
5919 string/heap functions, and some other associated constructs with
5920 range/validity tests. Modules so instrumented should be immune to
5921 buffer overflows, invalid heap use, and some other classes of C/C++
5922 programming errors. The instrumentation relies on a separate runtime
5923 library (@file{libmudflap}), which will be linked into a program if
5924 @option{-fmudflap} is given at link time. Run-time behavior of the
5925 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
5926 environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out}
5929 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
5930 link if your program is multi-threaded. Use @option{-fmudflapir}, in
5931 addition to @option{-fmudflap} or @option{-fmudflapth}, if
5932 instrumentation should ignore pointer reads. This produces less
5933 instrumentation (and therefore faster execution) and still provides
5934 some protection against outright memory corrupting writes, but allows
5935 erroneously read data to propagate within a program.
5937 @item -fthread-jumps
5938 @opindex fthread-jumps
5939 Perform optimizations where we check to see if a jump branches to a
5940 location where another comparison subsumed by the first is found. If
5941 so, the first branch is redirected to either the destination of the
5942 second branch or a point immediately following it, depending on whether
5943 the condition is known to be true or false.
5945 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5947 @item -fsplit-wide-types
5948 @opindex fsplit-wide-types
5949 When using a type that occupies multiple registers, such as @code{long
5950 long} on a 32-bit system, split the registers apart and allocate them
5951 independently. This normally generates better code for those types,
5952 but may make debugging more difficult.
5954 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
5957 @item -fcse-follow-jumps
5958 @opindex fcse-follow-jumps
5959 In common subexpression elimination (CSE), scan through jump instructions
5960 when the target of the jump is not reached by any other path. For
5961 example, when CSE encounters an @code{if} statement with an
5962 @code{else} clause, CSE will follow the jump when the condition
5965 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5967 @item -fcse-skip-blocks
5968 @opindex fcse-skip-blocks
5969 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
5970 follow jumps which conditionally skip over blocks. When CSE
5971 encounters a simple @code{if} statement with no else clause,
5972 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
5973 body of the @code{if}.
5975 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5977 @item -frerun-cse-after-loop
5978 @opindex frerun-cse-after-loop
5979 Re-run common subexpression elimination after loop optimizations has been
5982 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5986 Perform a global common subexpression elimination pass.
5987 This pass also performs global constant and copy propagation.
5989 @emph{Note:} When compiling a program using computed gotos, a GCC
5990 extension, you may get better runtime performance if you disable
5991 the global common subexpression elimination pass by adding
5992 @option{-fno-gcse} to the command line.
5994 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5998 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
5999 attempt to move loads which are only killed by stores into themselves. This
6000 allows a loop containing a load/store sequence to be changed to a load outside
6001 the loop, and a copy/store within the loop.
6003 Enabled by default when gcse is enabled.
6007 When @option{-fgcse-sm} is enabled, a store motion pass is run after
6008 global common subexpression elimination. This pass will attempt to move
6009 stores out of loops. When used in conjunction with @option{-fgcse-lm},
6010 loops containing a load/store sequence can be changed to a load before
6011 the loop and a store after the loop.
6013 Not enabled at any optimization level.
6017 When @option{-fgcse-las} is enabled, the global common subexpression
6018 elimination pass eliminates redundant loads that come after stores to the
6019 same memory location (both partial and full redundancies).
6021 Not enabled at any optimization level.
6023 @item -fgcse-after-reload
6024 @opindex fgcse-after-reload
6025 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6026 pass is performed after reload. The purpose of this pass is to cleanup
6029 @item -funsafe-loop-optimizations
6030 @opindex funsafe-loop-optimizations
6031 If given, the loop optimizer will assume that loop indices do not
6032 overflow, and that the loops with nontrivial exit condition are not
6033 infinite. This enables a wider range of loop optimizations even if
6034 the loop optimizer itself cannot prove that these assumptions are valid.
6035 Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
6036 if it finds this kind of loop.
6038 @item -fcrossjumping
6039 @opindex fcrossjumping
6040 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
6041 resulting code may or may not perform better than without cross-jumping.
6043 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6045 @item -fauto-inc-dec
6046 @opindex fauto-inc-dec
6047 Combine increments or decrements of addresses with memory accesses.
6048 This pass is always skipped on architectures that do not have
6049 instructions to support this. Enabled by default at @option{-O} and
6050 higher on architectures that support this.
6054 Perform dead code elimination (DCE) on RTL@.
6055 Enabled by default at @option{-O} and higher.
6059 Perform dead store elimination (DSE) on RTL@.
6060 Enabled by default at @option{-O} and higher.
6062 @item -fif-conversion
6063 @opindex fif-conversion
6064 Attempt to transform conditional jumps into branch-less equivalents. This
6065 include use of conditional moves, min, max, set flags and abs instructions, and
6066 some tricks doable by standard arithmetics. The use of conditional execution
6067 on chips where it is available is controlled by @code{if-conversion2}.
6069 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6071 @item -fif-conversion2
6072 @opindex fif-conversion2
6073 Use conditional execution (where available) to transform conditional jumps into
6074 branch-less equivalents.
6076 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6078 @item -fdelete-null-pointer-checks
6079 @opindex fdelete-null-pointer-checks
6080 Assume that programs cannot safely dereference null pointers, and that
6081 no code or data element resides there. This enables simple constant
6082 folding optimizations at all optimization levels. In addition, other
6083 optimization passes in GCC use this flag to control global dataflow
6084 analyses that eliminate useless checks for null pointers; these assume
6085 that if a pointer is checked after it has already been dereferenced,
6088 Note however that in some environments this assumption is not true.
6089 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
6090 for programs which depend on that behavior.
6092 Some targets, especially embedded ones, disable this option at all levels.
6093 Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
6094 @option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information
6095 are enabled independently at different optimization levels.
6097 @item -fexpensive-optimizations
6098 @opindex fexpensive-optimizations
6099 Perform a number of minor optimizations that are relatively expensive.
6101 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6103 @item -foptimize-register-move
6105 @opindex foptimize-register-move
6107 Attempt to reassign register numbers in move instructions and as
6108 operands of other simple instructions in order to maximize the amount of
6109 register tying. This is especially helpful on machines with two-operand
6112 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
6115 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6117 @item -fira-algorithm=@var{algorithm}
6118 Use specified coloring algorithm for the integrated register
6119 allocator. The @var{algorithm} argument should be @code{priority} or
6120 @code{CB}. The first algorithm specifies Chow's priority coloring,
6121 the second one specifies Chaitin-Briggs coloring. The second
6122 algorithm can be unimplemented for some architectures. If it is
6123 implemented, it is the default because Chaitin-Briggs coloring as a
6124 rule generates a better code.
6126 @item -fira-region=@var{region}
6127 Use specified regions for the integrated register allocator. The
6128 @var{region} argument should be one of @code{all}, @code{mixed}, or
6129 @code{one}. The first value means using all loops as register
6130 allocation regions, the second value which is the default means using
6131 all loops except for loops with small register pressure as the
6132 regions, and third one means using all function as a single region.
6133 The first value can give best result for machines with small size and
6134 irregular register set, the third one results in faster and generates
6135 decent code and the smallest size code, and the default value usually
6136 give the best results in most cases and for most architectures.
6138 @item -fira-coalesce
6139 @opindex fira-coalesce
6140 Do optimistic register coalescing. This option might be profitable for
6141 architectures with big regular register files.
6143 @item -fno-ira-share-save-slots
6144 @opindex fno-ira-share-save-slots
6145 Switch off sharing stack slots used for saving call used hard
6146 registers living through a call. Each hard register will get a
6147 separate stack slot and as a result function stack frame will be
6150 @item -fno-ira-share-spill-slots
6151 @opindex fno-ira-share-spill-slots
6152 Switch off sharing stack slots allocated for pseudo-registers. Each
6153 pseudo-register which did not get a hard register will get a separate
6154 stack slot and as a result function stack frame will be bigger.
6156 @item -fira-verbose=@var{n}
6157 @opindex fira-verbose
6158 Set up how verbose dump file for the integrated register allocator
6159 will be. Default value is 5. If the value is greater or equal to 10,
6160 the dump file will be stderr as if the value were @var{n} minus 10.
6162 @item -fdelayed-branch
6163 @opindex fdelayed-branch
6164 If supported for the target machine, attempt to reorder instructions
6165 to exploit instruction slots available after delayed branch
6168 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6170 @item -fschedule-insns
6171 @opindex fschedule-insns
6172 If supported for the target machine, attempt to reorder instructions to
6173 eliminate execution stalls due to required data being unavailable. This
6174 helps machines that have slow floating point or memory load instructions
6175 by allowing other instructions to be issued until the result of the load
6176 or floating point instruction is required.
6178 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6180 @item -fschedule-insns2
6181 @opindex fschedule-insns2
6182 Similar to @option{-fschedule-insns}, but requests an additional pass of
6183 instruction scheduling after register allocation has been done. This is
6184 especially useful on machines with a relatively small number of
6185 registers and where memory load instructions take more than one cycle.
6187 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6189 @item -fno-sched-interblock
6190 @opindex fno-sched-interblock
6191 Don't schedule instructions across basic blocks. This is normally
6192 enabled by default when scheduling before register allocation, i.e.@:
6193 with @option{-fschedule-insns} or at @option{-O2} or higher.
6195 @item -fno-sched-spec
6196 @opindex fno-sched-spec
6197 Don't allow speculative motion of non-load instructions. This is normally
6198 enabled by default when scheduling before register allocation, i.e.@:
6199 with @option{-fschedule-insns} or at @option{-O2} or higher.
6201 @item -fsched-spec-load
6202 @opindex fsched-spec-load
6203 Allow speculative motion of some load instructions. This only makes
6204 sense when scheduling before register allocation, i.e.@: with
6205 @option{-fschedule-insns} or at @option{-O2} or higher.
6207 @item -fsched-spec-load-dangerous
6208 @opindex fsched-spec-load-dangerous
6209 Allow speculative motion of more load instructions. This only makes
6210 sense when scheduling before register allocation, i.e.@: with
6211 @option{-fschedule-insns} or at @option{-O2} or higher.
6213 @item -fsched-stalled-insns
6214 @itemx -fsched-stalled-insns=@var{n}
6215 @opindex fsched-stalled-insns
6216 Define how many insns (if any) can be moved prematurely from the queue
6217 of stalled insns into the ready list, during the second scheduling pass.
6218 @option{-fno-sched-stalled-insns} means that no insns will be moved
6219 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
6220 on how many queued insns can be moved prematurely.
6221 @option{-fsched-stalled-insns} without a value is equivalent to
6222 @option{-fsched-stalled-insns=1}.
6224 @item -fsched-stalled-insns-dep
6225 @itemx -fsched-stalled-insns-dep=@var{n}
6226 @opindex fsched-stalled-insns-dep
6227 Define how many insn groups (cycles) will be examined for a dependency
6228 on a stalled insn that is candidate for premature removal from the queue
6229 of stalled insns. This has an effect only during the second scheduling pass,
6230 and only if @option{-fsched-stalled-insns} is used.
6231 @option{-fno-sched-stalled-insns-dep} is equivalent to
6232 @option{-fsched-stalled-insns-dep=0}.
6233 @option{-fsched-stalled-insns-dep} without a value is equivalent to
6234 @option{-fsched-stalled-insns-dep=1}.
6236 @item -fsched2-use-superblocks
6237 @opindex fsched2-use-superblocks
6238 When scheduling after register allocation, do use superblock scheduling
6239 algorithm. Superblock scheduling allows motion across basic block boundaries
6240 resulting on faster schedules. This option is experimental, as not all machine
6241 descriptions used by GCC model the CPU closely enough to avoid unreliable
6242 results from the algorithm.
6244 This only makes sense when scheduling after register allocation, i.e.@: with
6245 @option{-fschedule-insns2} or at @option{-O2} or higher.
6247 @item -fsched-group-heuristic
6248 @opindex fsched-group-heuristic
6249 Enable the group heuristic in the scheduler. This heuristic favors
6250 the instruction that belongs to a schedule group. This is enabled
6251 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
6252 or @option{-fschedule-insns2} or at @option{-O2} or higher.
6254 @item -fsched-critical-path-heuristic
6255 @opindex fsched-critical-path-heuristic
6256 Enable the critical-path heuristic in the scheduler. This heuristic favors
6257 instructions on the critical path. This is enabled by default when
6258 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
6259 or @option{-fschedule-insns2} or at @option{-O2} or higher.
6261 @item -fsched-spec-insn-heuristic
6262 @opindex fsched-spec-insn-heuristic
6263 Enable the speculative instruction heuristic in the scheduler. This
6264 heuristic favors speculative instructions with greater dependency weakness.
6265 This is enabled by default when scheduling is enabled, i.e.@:
6266 with @option{-fschedule-insns} or @option{-fschedule-insns2}
6267 or at @option{-O2} or higher.
6269 @item -fsched-reg-pressure-heuristic
6270 @opindex fsched-reg-pressure-heuristic
6271 Enable the register pressure heuristic in the scheduler. This heuristic
6272 favors the instruction with smaller contribution to register pressure.
6273 This only makes sense when scheduling before register allocation, i.e.@:
6274 with @option{-fschedule-insns} or at @option{-O2} or higher.
6276 @item -fsched-rank-heuristic
6277 @opindex fsched-rank-heuristic
6278 Enable the rank heuristic in the scheduler. This heuristic favors
6279 the instruction belonging to a basic block with greater size or frequency.
6280 This is enabled by default when scheduling is enabled, i.e.@:
6281 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6282 at @option{-O2} or higher.
6284 @item -fsched-last-insn-heuristic
6285 @opindex fsched-last-insn-heuristic
6286 Enable the last-instruction heuristic in the scheduler. This heuristic
6287 favors the instruction that is less dependent on the last instruction
6288 scheduled. This is enabled by default when scheduling is enabled,
6289 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6290 at @option{-O2} or higher.
6292 @item -fsched-dep-count-heuristic
6293 @opindex fsched-dep-count-heuristic
6294 Enable the dependent-count heuristic in the scheduler. This heuristic
6295 favors the instruction that has more instructions depending on it.
6296 This is enabled by default when scheduling is enabled, i.e.@:
6297 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6298 at @option{-O2} or higher.
6300 @item -fsched2-use-traces
6301 @opindex fsched2-use-traces
6302 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
6303 allocation and additionally perform code duplication in order to increase the
6304 size of superblocks using tracer pass. See @option{-ftracer} for details on
6307 This mode should produce faster but significantly longer programs. Also
6308 without @option{-fbranch-probabilities} the traces constructed may not
6309 match the reality and hurt the performance. This only makes
6310 sense when scheduling after register allocation, i.e.@: with
6311 @option{-fschedule-insns2} or at @option{-O2} or higher.
6313 @item -freschedule-modulo-scheduled-loops
6314 @opindex freschedule-modulo-scheduled-loops
6315 The modulo scheduling comes before the traditional scheduling, if a loop
6316 was modulo scheduled we may want to prevent the later scheduling passes
6317 from changing its schedule, we use this option to control that.
6319 @item -fselective-scheduling
6320 @opindex fselective-scheduling
6321 Schedule instructions using selective scheduling algorithm. Selective
6322 scheduling runs instead of the first scheduler pass.
6324 @item -fselective-scheduling2
6325 @opindex fselective-scheduling2
6326 Schedule instructions using selective scheduling algorithm. Selective
6327 scheduling runs instead of the second scheduler pass.
6329 @item -fsel-sched-pipelining
6330 @opindex fsel-sched-pipelining
6331 Enable software pipelining of innermost loops during selective scheduling.
6332 This option has no effect until one of @option{-fselective-scheduling} or
6333 @option{-fselective-scheduling2} is turned on.
6335 @item -fsel-sched-pipelining-outer-loops
6336 @opindex fsel-sched-pipelining-outer-loops
6337 When pipelining loops during selective scheduling, also pipeline outer loops.
6338 This option has no effect until @option{-fsel-sched-pipelining} is turned on.
6340 @item -fcaller-saves
6341 @opindex fcaller-saves
6342 Enable values to be allocated in registers that will be clobbered by
6343 function calls, by emitting extra instructions to save and restore the
6344 registers around such calls. Such allocation is done only when it
6345 seems to result in better code than would otherwise be produced.
6347 This option is always enabled by default on certain machines, usually
6348 those which have no call-preserved registers to use instead.
6350 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6352 @item -fconserve-stack
6353 @opindex fconserve-stack
6354 Attempt to minimize stack usage. The compiler will attempt to use less
6355 stack space, even if that makes the program slower. This option
6356 implies setting the @option{large-stack-frame} parameter to 100
6357 and the @option{large-stack-frame-growth} parameter to 400.
6359 @item -ftree-reassoc
6360 @opindex ftree-reassoc
6361 Perform reassociation on trees. This flag is enabled by default
6362 at @option{-O} and higher.
6366 Perform partial redundancy elimination (PRE) on trees. This flag is
6367 enabled by default at @option{-O2} and @option{-O3}.
6369 @item -ftree-forwprop
6370 @opindex ftree-forwprop
6371 Perform forward propagation on trees. This flag is enabled by default
6372 at @option{-O} and higher.
6376 Perform full redundancy elimination (FRE) on trees. The difference
6377 between FRE and PRE is that FRE only considers expressions
6378 that are computed on all paths leading to the redundant computation.
6379 This analysis is faster than PRE, though it exposes fewer redundancies.
6380 This flag is enabled by default at @option{-O} and higher.
6382 @item -ftree-phiprop
6383 @opindex ftree-phiprop
6384 Perform hoisting of loads from conditional pointers on trees. This
6385 pass is enabled by default at @option{-O} and higher.
6387 @item -ftree-copy-prop
6388 @opindex ftree-copy-prop
6389 Perform copy propagation on trees. This pass eliminates unnecessary
6390 copy operations. This flag is enabled by default at @option{-O} and
6393 @item -fipa-pure-const
6394 @opindex fipa-pure-const
6395 Discover which functions are pure or constant.
6396 Enabled by default at @option{-O} and higher.
6398 @item -fipa-reference
6399 @opindex fipa-reference
6400 Discover which static variables do not escape cannot escape the
6402 Enabled by default at @option{-O} and higher.
6404 @item -fipa-struct-reorg
6405 @opindex fipa-struct-reorg
6406 Perform structure reorganization optimization, that change C-like structures
6407 layout in order to better utilize spatial locality. This transformation is
6408 affective for programs containing arrays of structures. Available in two
6409 compilation modes: profile-based (enabled with @option{-fprofile-generate})
6410 or static (which uses built-in heuristics). Require @option{-fipa-type-escape}
6411 to provide the safety of this transformation. It works only in whole program
6412 mode, so it requires @option{-fwhole-program} and @option{-combine} to be
6413 enabled. Structures considered @samp{cold} by this transformation are not
6414 affected (see @option{--param struct-reorg-cold-struct-ratio=@var{value}}).
6416 With this flag, the program debug info reflects a new structure layout.
6420 Perform interprocedural pointer analysis. This option is experimental
6421 and does not affect generated code.
6425 Perform interprocedural constant propagation.
6426 This optimization analyzes the program to determine when values passed
6427 to functions are constants and then optimizes accordingly.
6428 This optimization can substantially increase performance
6429 if the application has constants passed to functions.
6430 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
6432 @item -fipa-cp-clone
6433 @opindex fipa-cp-clone
6434 Perform function cloning to make interprocedural constant propagation stronger.
6435 When enabled, interprocedural constant propagation will perform function cloning
6436 when externally visible function can be called with constant arguments.
6437 Because this optimization can create multiple copies of functions,
6438 it may significantly increase code size
6439 (see @option{--param ipcp-unit-growth=@var{value}}).
6440 This flag is enabled by default at @option{-O3}.
6442 @item -fipa-matrix-reorg
6443 @opindex fipa-matrix-reorg
6444 Perform matrix flattening and transposing.
6445 Matrix flattening tries to replace an @math{m}-dimensional matrix
6446 with its equivalent @math{n}-dimensional matrix, where @math{n < m}.
6447 This reduces the level of indirection needed for accessing the elements
6448 of the matrix. The second optimization is matrix transposing that
6449 attempts to change the order of the matrix's dimensions in order to
6450 improve cache locality.
6451 Both optimizations need the @option{-fwhole-program} flag.
6452 Transposing is enabled only if profiling information is available.
6456 Perform forward store motion on trees. This flag is
6457 enabled by default at @option{-O} and higher.
6461 Perform sparse conditional constant propagation (CCP) on trees. This
6462 pass only operates on local scalar variables and is enabled by default
6463 at @option{-O} and higher.
6465 @item -ftree-switch-conversion
6466 Perform conversion of simple initializations in a switch to
6467 initializations from a scalar array. This flag is enabled by default
6468 at @option{-O2} and higher.
6472 Perform dead code elimination (DCE) on trees. This flag is enabled by
6473 default at @option{-O} and higher.
6475 @item -ftree-builtin-call-dce
6476 @opindex ftree-builtin-call-dce
6477 Perform conditional dead code elimination (DCE) for calls to builtin functions
6478 that may set @code{errno} but are otherwise side-effect free. This flag is
6479 enabled by default at @option{-O2} and higher if @option{-Os} is not also
6482 @item -ftree-dominator-opts
6483 @opindex ftree-dominator-opts
6484 Perform a variety of simple scalar cleanups (constant/copy
6485 propagation, redundancy elimination, range propagation and expression
6486 simplification) based on a dominator tree traversal. This also
6487 performs jump threading (to reduce jumps to jumps). This flag is
6488 enabled by default at @option{-O} and higher.
6492 Perform dead store elimination (DSE) on trees. A dead store is a store into
6493 a memory location which will later be overwritten by another store without
6494 any intervening loads. In this case the earlier store can be deleted. This
6495 flag is enabled by default at @option{-O} and higher.
6499 Perform loop header copying on trees. This is beneficial since it increases
6500 effectiveness of code motion optimizations. It also saves one jump. This flag
6501 is enabled by default at @option{-O} and higher. It is not enabled
6502 for @option{-Os}, since it usually increases code size.
6504 @item -ftree-loop-optimize
6505 @opindex ftree-loop-optimize
6506 Perform loop optimizations on trees. This flag is enabled by default
6507 at @option{-O} and higher.
6509 @item -ftree-loop-linear
6510 @opindex ftree-loop-linear
6511 Perform linear loop transformations on tree. This flag can improve cache
6512 performance and allow further loop optimizations to take place.
6514 @item -floop-interchange
6515 Perform loop interchange transformations on loops. Interchanging two
6516 nested loops switches the inner and outer loops. For example, given a
6521 A(J, I) = A(J, I) * C
6525 loop interchange will transform the loop as if the user had written:
6529 A(J, I) = A(J, I) * C
6533 which can be beneficial when @code{N} is larger than the caches,
6534 because in Fortran, the elements of an array are stored in memory
6535 contiguously by column, and the original loop iterates over rows,
6536 potentially creating at each access a cache miss. This optimization
6537 applies to all the languages supported by GCC and is not limited to
6538 Fortran. To use this code transformation, GCC has to be configured
6539 with @option{--with-ppl} and @option{--with-cloog} to enable the
6540 Graphite loop transformation infrastructure.
6542 @item -floop-strip-mine
6543 Perform loop strip mining transformations on loops. Strip mining
6544 splits a loop into two nested loops. The outer loop has strides
6545 equal to the strip size and the inner loop has strides of the
6546 original loop within a strip. For example, given a loop like:
6552 loop strip mining will transform the loop as if the user had written:
6555 DO I = II, min (II + 3, N)
6560 This optimization applies to all the languages supported by GCC and is
6561 not limited to Fortran. To use this code transformation, GCC has to
6562 be configured with @option{--with-ppl} and @option{--with-cloog} to
6563 enable the Graphite loop transformation infrastructure.
6566 Perform loop blocking transformations on loops. Blocking strip mines
6567 each loop in the loop nest such that the memory accesses of the
6568 element loops fit inside caches. For example, given a loop like:
6572 A(J, I) = B(I) + C(J)
6576 loop blocking will transform the loop as if the user had written:
6580 DO I = II, min (II + 63, N)
6581 DO J = JJ, min (JJ + 63, M)
6582 A(J, I) = B(I) + C(J)
6588 which can be beneficial when @code{M} is larger than the caches,
6589 because the innermost loop will iterate over a smaller amount of data
6590 that can be kept in the caches. This optimization applies to all the
6591 languages supported by GCC and is not limited to Fortran. To use this
6592 code transformation, GCC has to be configured with @option{--with-ppl}
6593 and @option{--with-cloog} to enable the Graphite loop transformation
6596 @item -fgraphite-identity
6597 @opindex fgraphite-identity
6598 Enable the identity transformation for graphite. For every SCoP we generate
6599 the polyhedral representation and transform it back to gimple. Using
6600 @option{-fgraphite-identity} we can check the costs or benefits of the
6601 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
6602 are also performed by the code generator CLooG, like index splitting and
6603 dead code elimination in loops.
6605 @item -floop-parallelize-all
6606 Use the Graphite data dependence analysis to identify loops that can
6607 be parallelized. Parallelize all the loops that can be analyzed to
6608 not contain loop carried dependences without checking that it is
6609 profitable to parallelize the loops.
6611 @item -fcheck-data-deps
6612 @opindex fcheck-data-deps
6613 Compare the results of several data dependence analyzers. This option
6614 is used for debugging the data dependence analyzers.
6616 @item -ftree-loop-distribution
6617 Perform loop distribution. This flag can improve cache performance on
6618 big loop bodies and allow further loop optimizations, like
6619 parallelization or vectorization, to take place. For example, the loop
6636 @item -ftree-loop-im
6637 @opindex ftree-loop-im
6638 Perform loop invariant motion on trees. This pass moves only invariants that
6639 would be hard to handle at RTL level (function calls, operations that expand to
6640 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
6641 operands of conditions that are invariant out of the loop, so that we can use
6642 just trivial invariantness analysis in loop unswitching. The pass also includes
6645 @item -ftree-loop-ivcanon
6646 @opindex ftree-loop-ivcanon
6647 Create a canonical counter for number of iterations in the loop for that
6648 determining number of iterations requires complicated analysis. Later
6649 optimizations then may determine the number easily. Useful especially
6650 in connection with unrolling.
6654 Perform induction variable optimizations (strength reduction, induction
6655 variable merging and induction variable elimination) on trees.
6657 @item -ftree-parallelize-loops=n
6658 @opindex ftree-parallelize-loops
6659 Parallelize loops, i.e., split their iteration space to run in n threads.
6660 This is only possible for loops whose iterations are independent
6661 and can be arbitrarily reordered. The optimization is only
6662 profitable on multiprocessor machines, for loops that are CPU-intensive,
6663 rather than constrained e.g.@: by memory bandwidth. This option
6664 implies @option{-pthread}, and thus is only supported on targets
6665 that have support for @option{-pthread}.
6669 Perform function-local points-to analysis on trees. This flag is
6670 enabled by default at @option{-O} and higher.
6674 Perform scalar replacement of aggregates. This pass replaces structure
6675 references with scalars to prevent committing structures to memory too
6676 early. This flag is enabled by default at @option{-O} and higher.
6678 @item -ftree-copyrename
6679 @opindex ftree-copyrename
6680 Perform copy renaming on trees. This pass attempts to rename compiler
6681 temporaries to other variables at copy locations, usually resulting in
6682 variable names which more closely resemble the original variables. This flag
6683 is enabled by default at @option{-O} and higher.
6687 Perform temporary expression replacement during the SSA->normal phase. Single
6688 use/single def temporaries are replaced at their use location with their
6689 defining expression. This results in non-GIMPLE code, but gives the expanders
6690 much more complex trees to work on resulting in better RTL generation. This is
6691 enabled by default at @option{-O} and higher.
6693 @item -ftree-vectorize
6694 @opindex ftree-vectorize
6695 Perform loop vectorization on trees. This flag is enabled by default at
6698 @item -ftree-vect-loop-version
6699 @opindex ftree-vect-loop-version
6700 Perform loop versioning when doing loop vectorization on trees. When a loop
6701 appears to be vectorizable except that data alignment or data dependence cannot
6702 be determined at compile time then vectorized and non-vectorized versions of
6703 the loop are generated along with runtime checks for alignment or dependence
6704 to control which version is executed. This option is enabled by default
6705 except at level @option{-Os} where it is disabled.
6707 @item -fvect-cost-model
6708 @opindex fvect-cost-model
6709 Enable cost model for vectorization.
6713 Perform Value Range Propagation on trees. This is similar to the
6714 constant propagation pass, but instead of values, ranges of values are
6715 propagated. This allows the optimizers to remove unnecessary range
6716 checks like array bound checks and null pointer checks. This is
6717 enabled by default at @option{-O2} and higher. Null pointer check
6718 elimination is only done if @option{-fdelete-null-pointer-checks} is
6723 Perform tail duplication to enlarge superblock size. This transformation
6724 simplifies the control flow of the function allowing other optimizations to do
6727 @item -funroll-loops
6728 @opindex funroll-loops
6729 Unroll loops whose number of iterations can be determined at compile
6730 time or upon entry to the loop. @option{-funroll-loops} implies
6731 @option{-frerun-cse-after-loop}. This option makes code larger,
6732 and may or may not make it run faster.
6734 @item -funroll-all-loops
6735 @opindex funroll-all-loops
6736 Unroll all loops, even if their number of iterations is uncertain when
6737 the loop is entered. This usually makes programs run more slowly.
6738 @option{-funroll-all-loops} implies the same options as
6739 @option{-funroll-loops},
6741 @item -fsplit-ivs-in-unroller
6742 @opindex fsplit-ivs-in-unroller
6743 Enables expressing of values of induction variables in later iterations
6744 of the unrolled loop using the value in the first iteration. This breaks
6745 long dependency chains, thus improving efficiency of the scheduling passes.
6747 Combination of @option{-fweb} and CSE is often sufficient to obtain the
6748 same effect. However in cases the loop body is more complicated than
6749 a single basic block, this is not reliable. It also does not work at all
6750 on some of the architectures due to restrictions in the CSE pass.
6752 This optimization is enabled by default.
6754 @item -fvariable-expansion-in-unroller
6755 @opindex fvariable-expansion-in-unroller
6756 With this option, the compiler will create multiple copies of some
6757 local variables when unrolling a loop which can result in superior code.
6759 @item -fpredictive-commoning
6760 @opindex fpredictive-commoning
6761 Perform predictive commoning optimization, i.e., reusing computations
6762 (especially memory loads and stores) performed in previous
6763 iterations of loops.
6765 This option is enabled at level @option{-O3}.
6767 @item -fprefetch-loop-arrays
6768 @opindex fprefetch-loop-arrays
6769 If supported by the target machine, generate instructions to prefetch
6770 memory to improve the performance of loops that access large arrays.
6772 This option may generate better or worse code; results are highly
6773 dependent on the structure of loops within the source code.
6775 Disabled at level @option{-Os}.
6778 @itemx -fno-peephole2
6779 @opindex fno-peephole
6780 @opindex fno-peephole2
6781 Disable any machine-specific peephole optimizations. The difference
6782 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
6783 are implemented in the compiler; some targets use one, some use the
6784 other, a few use both.
6786 @option{-fpeephole} is enabled by default.
6787 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6789 @item -fno-guess-branch-probability
6790 @opindex fno-guess-branch-probability
6791 Do not guess branch probabilities using heuristics.
6793 GCC will use heuristics to guess branch probabilities if they are
6794 not provided by profiling feedback (@option{-fprofile-arcs}). These
6795 heuristics are based on the control flow graph. If some branch probabilities
6796 are specified by @samp{__builtin_expect}, then the heuristics will be
6797 used to guess branch probabilities for the rest of the control flow graph,
6798 taking the @samp{__builtin_expect} info into account. The interactions
6799 between the heuristics and @samp{__builtin_expect} can be complex, and in
6800 some cases, it may be useful to disable the heuristics so that the effects
6801 of @samp{__builtin_expect} are easier to understand.
6803 The default is @option{-fguess-branch-probability} at levels
6804 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6806 @item -freorder-blocks
6807 @opindex freorder-blocks
6808 Reorder basic blocks in the compiled function in order to reduce number of
6809 taken branches and improve code locality.
6811 Enabled at levels @option{-O2}, @option{-O3}.
6813 @item -freorder-blocks-and-partition
6814 @opindex freorder-blocks-and-partition
6815 In addition to reordering basic blocks in the compiled function, in order
6816 to reduce number of taken branches, partitions hot and cold basic blocks
6817 into separate sections of the assembly and .o files, to improve
6818 paging and cache locality performance.
6820 This optimization is automatically turned off in the presence of
6821 exception handling, for linkonce sections, for functions with a user-defined
6822 section attribute and on any architecture that does not support named
6825 @item -freorder-functions
6826 @opindex freorder-functions
6827 Reorder functions in the object file in order to
6828 improve code locality. This is implemented by using special
6829 subsections @code{.text.hot} for most frequently executed functions and
6830 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
6831 the linker so object file format must support named sections and linker must
6832 place them in a reasonable way.
6834 Also profile feedback must be available in to make this option effective. See
6835 @option{-fprofile-arcs} for details.
6837 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6839 @item -fstrict-aliasing
6840 @opindex fstrict-aliasing
6841 Allows the compiler to assume the strictest aliasing rules applicable to
6842 the language being compiled. For C (and C++), this activates
6843 optimizations based on the type of expressions. In particular, an
6844 object of one type is assumed never to reside at the same address as an
6845 object of a different type, unless the types are almost the same. For
6846 example, an @code{unsigned int} can alias an @code{int}, but not a
6847 @code{void*} or a @code{double}. A character type may alias any other
6850 @anchor{Type-punning}Pay special attention to code like this:
6863 The practice of reading from a different union member than the one most
6864 recently written to (called ``type-punning'') is common. Even with
6865 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
6866 is accessed through the union type. So, the code above will work as
6867 expected. @xref{Structures unions enumerations and bit-fields
6868 implementation}. However, this code might not:
6879 Similarly, access by taking the address, casting the resulting pointer
6880 and dereferencing the result has undefined behavior, even if the cast
6881 uses a union type, e.g.:
6885 return ((union a_union *) &d)->i;
6889 The @option{-fstrict-aliasing} option is enabled at levels
6890 @option{-O2}, @option{-O3}, @option{-Os}.
6892 @item -fstrict-overflow
6893 @opindex fstrict-overflow
6894 Allow the compiler to assume strict signed overflow rules, depending
6895 on the language being compiled. For C (and C++) this means that
6896 overflow when doing arithmetic with signed numbers is undefined, which
6897 means that the compiler may assume that it will not happen. This
6898 permits various optimizations. For example, the compiler will assume
6899 that an expression like @code{i + 10 > i} will always be true for
6900 signed @code{i}. This assumption is only valid if signed overflow is
6901 undefined, as the expression is false if @code{i + 10} overflows when
6902 using twos complement arithmetic. When this option is in effect any
6903 attempt to determine whether an operation on signed numbers will
6904 overflow must be written carefully to not actually involve overflow.
6906 This option also allows the compiler to assume strict pointer
6907 semantics: given a pointer to an object, if adding an offset to that
6908 pointer does not produce a pointer to the same object, the addition is
6909 undefined. This permits the compiler to conclude that @code{p + u >
6910 p} is always true for a pointer @code{p} and unsigned integer
6911 @code{u}. This assumption is only valid because pointer wraparound is
6912 undefined, as the expression is false if @code{p + u} overflows using
6913 twos complement arithmetic.
6915 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
6916 that integer signed overflow is fully defined: it wraps. When
6917 @option{-fwrapv} is used, there is no difference between
6918 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
6919 integers. With @option{-fwrapv} certain types of overflow are
6920 permitted. For example, if the compiler gets an overflow when doing
6921 arithmetic on constants, the overflowed value can still be used with
6922 @option{-fwrapv}, but not otherwise.
6924 The @option{-fstrict-overflow} option is enabled at levels
6925 @option{-O2}, @option{-O3}, @option{-Os}.
6927 @item -falign-functions
6928 @itemx -falign-functions=@var{n}
6929 @opindex falign-functions
6930 Align the start of functions to the next power-of-two greater than
6931 @var{n}, skipping up to @var{n} bytes. For instance,
6932 @option{-falign-functions=32} aligns functions to the next 32-byte
6933 boundary, but @option{-falign-functions=24} would align to the next
6934 32-byte boundary only if this can be done by skipping 23 bytes or less.
6936 @option{-fno-align-functions} and @option{-falign-functions=1} are
6937 equivalent and mean that functions will not be aligned.
6939 Some assemblers only support this flag when @var{n} is a power of two;
6940 in that case, it is rounded up.
6942 If @var{n} is not specified or is zero, use a machine-dependent default.
6944 Enabled at levels @option{-O2}, @option{-O3}.
6946 @item -falign-labels
6947 @itemx -falign-labels=@var{n}
6948 @opindex falign-labels
6949 Align all branch targets to a power-of-two boundary, skipping up to
6950 @var{n} bytes like @option{-falign-functions}. This option can easily
6951 make code slower, because it must insert dummy operations for when the
6952 branch target is reached in the usual flow of the code.
6954 @option{-fno-align-labels} and @option{-falign-labels=1} are
6955 equivalent and mean that labels will not be aligned.
6957 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
6958 are greater than this value, then their values are used instead.
6960 If @var{n} is not specified or is zero, use a machine-dependent default
6961 which is very likely to be @samp{1}, meaning no alignment.
6963 Enabled at levels @option{-O2}, @option{-O3}.
6966 @itemx -falign-loops=@var{n}
6967 @opindex falign-loops
6968 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
6969 like @option{-falign-functions}. The hope is that the loop will be
6970 executed many times, which will make up for any execution of the dummy
6973 @option{-fno-align-loops} and @option{-falign-loops=1} are
6974 equivalent and mean that loops will not be aligned.
6976 If @var{n} is not specified or is zero, use a machine-dependent default.
6978 Enabled at levels @option{-O2}, @option{-O3}.
6981 @itemx -falign-jumps=@var{n}
6982 @opindex falign-jumps
6983 Align branch targets to a power-of-two boundary, for branch targets
6984 where the targets can only be reached by jumping, skipping up to @var{n}
6985 bytes like @option{-falign-functions}. In this case, no dummy operations
6988 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
6989 equivalent and mean that loops will not be aligned.
6991 If @var{n} is not specified or is zero, use a machine-dependent default.
6993 Enabled at levels @option{-O2}, @option{-O3}.
6995 @item -funit-at-a-time
6996 @opindex funit-at-a-time
6997 This option is left for compatibility reasons. @option{-funit-at-a-time}
6998 has no effect, while @option{-fno-unit-at-a-time} implies
6999 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
7003 @item -fno-toplevel-reorder
7004 @opindex fno-toplevel-reorder
7005 Do not reorder top-level functions, variables, and @code{asm}
7006 statements. Output them in the same order that they appear in the
7007 input file. When this option is used, unreferenced static variables
7008 will not be removed. This option is intended to support existing code
7009 which relies on a particular ordering. For new code, it is better to
7012 Enabled at level @option{-O0}. When disabled explicitly, it also imply
7013 @option{-fno-section-anchors} that is otherwise enabled at @option{-O0} on some
7018 Constructs webs as commonly used for register allocation purposes and assign
7019 each web individual pseudo register. This allows the register allocation pass
7020 to operate on pseudos directly, but also strengthens several other optimization
7021 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
7022 however, make debugging impossible, since variables will no longer stay in a
7025 Enabled by default with @option{-funroll-loops}.
7027 @item -fwhole-program
7028 @opindex fwhole-program
7029 Assume that the current compilation unit represents the whole program being
7030 compiled. All public functions and variables with the exception of @code{main}
7031 and those merged by attribute @code{externally_visible} become static functions
7032 and in effect are optimized more aggressively by interprocedural optimizers.
7033 While this option is equivalent to proper use of the @code{static} keyword for
7034 programs consisting of a single file, in combination with option
7035 @option{--combine} this flag can be used to compile many smaller scale C
7036 programs since the functions and variables become local for the whole combined
7037 compilation unit, not for the single source file itself.
7039 This option implies @option{-fwhole-file} for Fortran programs.
7041 @item -fcprop-registers
7042 @opindex fcprop-registers
7043 After register allocation and post-register allocation instruction splitting,
7044 we perform a copy-propagation pass to try to reduce scheduling dependencies
7045 and occasionally eliminate the copy.
7047 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7049 @item -fprofile-correction
7050 @opindex fprofile-correction
7051 Profiles collected using an instrumented binary for multi-threaded programs may
7052 be inconsistent due to missed counter updates. When this option is specified,
7053 GCC will use heuristics to correct or smooth out such inconsistencies. By
7054 default, GCC will emit an error message when an inconsistent profile is detected.
7056 @item -fprofile-dir=@var{path}
7057 @opindex fprofile-dir
7059 Set the directory to search the profile data files in to @var{path}.
7060 This option affects only the profile data generated by
7061 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
7062 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
7063 and its related options.
7064 By default, GCC will use the current directory as @var{path}
7065 thus the profile data file will appear in the same directory as the object file.
7067 @item -fprofile-generate
7068 @itemx -fprofile-generate=@var{path}
7069 @opindex fprofile-generate
7071 Enable options usually used for instrumenting application to produce
7072 profile useful for later recompilation with profile feedback based
7073 optimization. You must use @option{-fprofile-generate} both when
7074 compiling and when linking your program.
7076 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
7078 If @var{path} is specified, GCC will look at the @var{path} to find
7079 the profile feedback data files. See @option{-fprofile-dir}.
7082 @itemx -fprofile-use=@var{path}
7083 @opindex fprofile-use
7084 Enable profile feedback directed optimizations, and optimizations
7085 generally profitable only with profile feedback available.
7087 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
7088 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
7090 By default, GCC emits an error message if the feedback profiles do not
7091 match the source code. This error can be turned into a warning by using
7092 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
7095 If @var{path} is specified, GCC will look at the @var{path} to find
7096 the profile feedback data files. See @option{-fprofile-dir}.
7099 The following options control compiler behavior regarding floating
7100 point arithmetic. These options trade off between speed and
7101 correctness. All must be specifically enabled.
7105 @opindex ffloat-store
7106 Do not store floating point variables in registers, and inhibit other
7107 options that might change whether a floating point value is taken from a
7110 @cindex floating point precision
7111 This option prevents undesirable excess precision on machines such as
7112 the 68000 where the floating registers (of the 68881) keep more
7113 precision than a @code{double} is supposed to have. Similarly for the
7114 x86 architecture. For most programs, the excess precision does only
7115 good, but a few programs rely on the precise definition of IEEE floating
7116 point. Use @option{-ffloat-store} for such programs, after modifying
7117 them to store all pertinent intermediate computations into variables.
7119 @item -fexcess-precision=@var{style}
7120 @opindex fexcess-precision
7121 This option allows further control over excess precision on machines
7122 where floating-point registers have more precision than the IEEE
7123 @code{float} and @code{double} types and the processor does not
7124 support operations rounding to those types. By default,
7125 @option{-fexcess-precision=fast} is in effect; this means that
7126 operations are carried out in the precision of the registers and that
7127 it is unpredictable when rounding to the types specified in the source
7128 code takes place. When compiling C, if
7129 @option{-fexcess-precision=standard} is specified then excess
7130 precision will follow the rules specified in ISO C99; in particular,
7131 both casts and assignments cause values to be rounded to their
7132 semantic types (whereas @option{-ffloat-store} only affects
7133 assignments). This option is enabled by default for C if a strict
7134 conformance option such as @option{-std=c99} is used.
7137 @option{-fexcess-precision=standard} is not implemented for languages
7138 other than C, and has no effect if
7139 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
7140 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
7141 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
7142 semantics apply without excess precision, and in the latter, rounding
7147 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
7148 @option{-ffinite-math-only}, @option{-fno-rounding-math},
7149 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
7151 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
7153 This option is not turned on by any @option{-O} option since
7154 it can result in incorrect output for programs which depend on
7155 an exact implementation of IEEE or ISO rules/specifications for
7156 math functions. It may, however, yield faster code for programs
7157 that do not require the guarantees of these specifications.
7159 @item -fno-math-errno
7160 @opindex fno-math-errno
7161 Do not set ERRNO after calling math functions that are executed
7162 with a single instruction, e.g., sqrt. A program that relies on
7163 IEEE exceptions for math error handling may want to use this flag
7164 for speed while maintaining IEEE arithmetic compatibility.
7166 This option is not turned on by any @option{-O} option since
7167 it can result in incorrect output for programs which depend on
7168 an exact implementation of IEEE or ISO rules/specifications for
7169 math functions. It may, however, yield faster code for programs
7170 that do not require the guarantees of these specifications.
7172 The default is @option{-fmath-errno}.
7174 On Darwin systems, the math library never sets @code{errno}. There is
7175 therefore no reason for the compiler to consider the possibility that
7176 it might, and @option{-fno-math-errno} is the default.
7178 @item -funsafe-math-optimizations
7179 @opindex funsafe-math-optimizations
7181 Allow optimizations for floating-point arithmetic that (a) assume
7182 that arguments and results are valid and (b) may violate IEEE or
7183 ANSI standards. When used at link-time, it may include libraries
7184 or startup files that change the default FPU control word or other
7185 similar optimizations.
7187 This option is not turned on by any @option{-O} option since
7188 it can result in incorrect output for programs which depend on
7189 an exact implementation of IEEE or ISO rules/specifications for
7190 math functions. It may, however, yield faster code for programs
7191 that do not require the guarantees of these specifications.
7192 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
7193 @option{-fassociative-math} and @option{-freciprocal-math}.
7195 The default is @option{-fno-unsafe-math-optimizations}.
7197 @item -fassociative-math
7198 @opindex fassociative-math
7200 Allow re-association of operands in series of floating-point operations.
7201 This violates the ISO C and C++ language standard by possibly changing
7202 computation result. NOTE: re-ordering may change the sign of zero as
7203 well as ignore NaNs and inhibit or create underflow or overflow (and
7204 thus cannot be used on a code which relies on rounding behavior like
7205 @code{(x + 2**52) - 2**52)}. May also reorder floating-point comparisons
7206 and thus may not be used when ordered comparisons are required.
7207 This option requires that both @option{-fno-signed-zeros} and
7208 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
7209 much sense with @option{-frounding-math}.
7211 The default is @option{-fno-associative-math}.
7213 @item -freciprocal-math
7214 @opindex freciprocal-math
7216 Allow the reciprocal of a value to be used instead of dividing by
7217 the value if this enables optimizations. For example @code{x / y}
7218 can be replaced with @code{x * (1/y)} which is useful if @code{(1/y)}
7219 is subject to common subexpression elimination. Note that this loses
7220 precision and increases the number of flops operating on the value.
7222 The default is @option{-fno-reciprocal-math}.
7224 @item -ffinite-math-only
7225 @opindex ffinite-math-only
7226 Allow optimizations for floating-point arithmetic that assume
7227 that arguments and results are not NaNs or +-Infs.
7229 This option is not turned on by any @option{-O} option since
7230 it can result in incorrect output for programs which depend on
7231 an exact implementation of IEEE or ISO rules/specifications for
7232 math functions. It may, however, yield faster code for programs
7233 that do not require the guarantees of these specifications.
7235 The default is @option{-fno-finite-math-only}.
7237 @item -fno-signed-zeros
7238 @opindex fno-signed-zeros
7239 Allow optimizations for floating point arithmetic that ignore the
7240 signedness of zero. IEEE arithmetic specifies the behavior of
7241 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
7242 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
7243 This option implies that the sign of a zero result isn't significant.
7245 The default is @option{-fsigned-zeros}.
7247 @item -fno-trapping-math
7248 @opindex fno-trapping-math
7249 Compile code assuming that floating-point operations cannot generate
7250 user-visible traps. These traps include division by zero, overflow,
7251 underflow, inexact result and invalid operation. This option requires
7252 that @option{-fno-signaling-nans} be in effect. Setting this option may
7253 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
7255 This option should never be turned on by any @option{-O} option since
7256 it can result in incorrect output for programs which depend on
7257 an exact implementation of IEEE or ISO rules/specifications for
7260 The default is @option{-ftrapping-math}.
7262 @item -frounding-math
7263 @opindex frounding-math
7264 Disable transformations and optimizations that assume default floating
7265 point rounding behavior. This is round-to-zero for all floating point
7266 to integer conversions, and round-to-nearest for all other arithmetic
7267 truncations. This option should be specified for programs that change
7268 the FP rounding mode dynamically, or that may be executed with a
7269 non-default rounding mode. This option disables constant folding of
7270 floating point expressions at compile-time (which may be affected by
7271 rounding mode) and arithmetic transformations that are unsafe in the
7272 presence of sign-dependent rounding modes.
7274 The default is @option{-fno-rounding-math}.
7276 This option is experimental and does not currently guarantee to
7277 disable all GCC optimizations that are affected by rounding mode.
7278 Future versions of GCC may provide finer control of this setting
7279 using C99's @code{FENV_ACCESS} pragma. This command line option
7280 will be used to specify the default state for @code{FENV_ACCESS}.
7282 @item -fsignaling-nans
7283 @opindex fsignaling-nans
7284 Compile code assuming that IEEE signaling NaNs may generate user-visible
7285 traps during floating-point operations. Setting this option disables
7286 optimizations that may change the number of exceptions visible with
7287 signaling NaNs. This option implies @option{-ftrapping-math}.
7289 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
7292 The default is @option{-fno-signaling-nans}.
7294 This option is experimental and does not currently guarantee to
7295 disable all GCC optimizations that affect signaling NaN behavior.
7297 @item -fsingle-precision-constant
7298 @opindex fsingle-precision-constant
7299 Treat floating point constant as single precision constant instead of
7300 implicitly converting it to double precision constant.
7302 @item -fcx-limited-range
7303 @opindex fcx-limited-range
7304 When enabled, this option states that a range reduction step is not
7305 needed when performing complex division. Also, there is no checking
7306 whether the result of a complex multiplication or division is @code{NaN
7307 + I*NaN}, with an attempt to rescue the situation in that case. The
7308 default is @option{-fno-cx-limited-range}, but is enabled by
7309 @option{-ffast-math}.
7311 This option controls the default setting of the ISO C99
7312 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
7315 @item -fcx-fortran-rules
7316 @opindex fcx-fortran-rules
7317 Complex multiplication and division follow Fortran rules. Range
7318 reduction is done as part of complex division, but there is no checking
7319 whether the result of a complex multiplication or division is @code{NaN
7320 + I*NaN}, with an attempt to rescue the situation in that case.
7322 The default is @option{-fno-cx-fortran-rules}.
7326 The following options control optimizations that may improve
7327 performance, but are not enabled by any @option{-O} options. This
7328 section includes experimental options that may produce broken code.
7331 @item -fbranch-probabilities
7332 @opindex fbranch-probabilities
7333 After running a program compiled with @option{-fprofile-arcs}
7334 (@pxref{Debugging Options,, Options for Debugging Your Program or
7335 @command{gcc}}), you can compile it a second time using
7336 @option{-fbranch-probabilities}, to improve optimizations based on
7337 the number of times each branch was taken. When the program
7338 compiled with @option{-fprofile-arcs} exits it saves arc execution
7339 counts to a file called @file{@var{sourcename}.gcda} for each source
7340 file. The information in this data file is very dependent on the
7341 structure of the generated code, so you must use the same source code
7342 and the same optimization options for both compilations.
7344 With @option{-fbranch-probabilities}, GCC puts a
7345 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
7346 These can be used to improve optimization. Currently, they are only
7347 used in one place: in @file{reorg.c}, instead of guessing which path a
7348 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
7349 exactly determine which path is taken more often.
7351 @item -fprofile-values
7352 @opindex fprofile-values
7353 If combined with @option{-fprofile-arcs}, it adds code so that some
7354 data about values of expressions in the program is gathered.
7356 With @option{-fbranch-probabilities}, it reads back the data gathered
7357 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
7358 notes to instructions for their later usage in optimizations.
7360 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
7364 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
7365 a code to gather information about values of expressions.
7367 With @option{-fbranch-probabilities}, it reads back the data gathered
7368 and actually performs the optimizations based on them.
7369 Currently the optimizations include specialization of division operation
7370 using the knowledge about the value of the denominator.
7372 @item -frename-registers
7373 @opindex frename-registers
7374 Attempt to avoid false dependencies in scheduled code by making use
7375 of registers left over after register allocation. This optimization
7376 will most benefit processors with lots of registers. Depending on the
7377 debug information format adopted by the target, however, it can
7378 make debugging impossible, since variables will no longer stay in
7379 a ``home register''.
7381 Enabled by default with @option{-funroll-loops}.
7385 Perform tail duplication to enlarge superblock size. This transformation
7386 simplifies the control flow of the function allowing other optimizations to do
7389 Enabled with @option{-fprofile-use}.
7391 @item -funroll-loops
7392 @opindex funroll-loops
7393 Unroll loops whose number of iterations can be determined at compile time or
7394 upon entry to the loop. @option{-funroll-loops} implies
7395 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
7396 It also turns on complete loop peeling (i.e.@: complete removal of loops with
7397 small constant number of iterations). This option makes code larger, and may
7398 or may not make it run faster.
7400 Enabled with @option{-fprofile-use}.
7402 @item -funroll-all-loops
7403 @opindex funroll-all-loops
7404 Unroll all loops, even if their number of iterations is uncertain when
7405 the loop is entered. This usually makes programs run more slowly.
7406 @option{-funroll-all-loops} implies the same options as
7407 @option{-funroll-loops}.
7410 @opindex fpeel-loops
7411 Peels the loops for that there is enough information that they do not
7412 roll much (from profile feedback). It also turns on complete loop peeling
7413 (i.e.@: complete removal of loops with small constant number of iterations).
7415 Enabled with @option{-fprofile-use}.
7417 @item -fmove-loop-invariants
7418 @opindex fmove-loop-invariants
7419 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
7420 at level @option{-O1}
7422 @item -funswitch-loops
7423 @opindex funswitch-loops
7424 Move branches with loop invariant conditions out of the loop, with duplicates
7425 of the loop on both branches (modified according to result of the condition).
7427 @item -ffunction-sections
7428 @itemx -fdata-sections
7429 @opindex ffunction-sections
7430 @opindex fdata-sections
7431 Place each function or data item into its own section in the output
7432 file if the target supports arbitrary sections. The name of the
7433 function or the name of the data item determines the section's name
7436 Use these options on systems where the linker can perform optimizations
7437 to improve locality of reference in the instruction space. Most systems
7438 using the ELF object format and SPARC processors running Solaris 2 have
7439 linkers with such optimizations. AIX may have these optimizations in
7442 Only use these options when there are significant benefits from doing
7443 so. When you specify these options, the assembler and linker will
7444 create larger object and executable files and will also be slower.
7445 You will not be able to use @code{gprof} on all systems if you
7446 specify this option and you may have problems with debugging if
7447 you specify both this option and @option{-g}.
7449 @item -fbranch-target-load-optimize
7450 @opindex fbranch-target-load-optimize
7451 Perform branch target register load optimization before prologue / epilogue
7453 The use of target registers can typically be exposed only during reload,
7454 thus hoisting loads out of loops and doing inter-block scheduling needs
7455 a separate optimization pass.
7457 @item -fbranch-target-load-optimize2
7458 @opindex fbranch-target-load-optimize2
7459 Perform branch target register load optimization after prologue / epilogue
7462 @item -fbtr-bb-exclusive
7463 @opindex fbtr-bb-exclusive
7464 When performing branch target register load optimization, don't reuse
7465 branch target registers in within any basic block.
7467 @item -fstack-protector
7468 @opindex fstack-protector
7469 Emit extra code to check for buffer overflows, such as stack smashing
7470 attacks. This is done by adding a guard variable to functions with
7471 vulnerable objects. This includes functions that call alloca, and
7472 functions with buffers larger than 8 bytes. The guards are initialized
7473 when a function is entered and then checked when the function exits.
7474 If a guard check fails, an error message is printed and the program exits.
7476 @item -fstack-protector-all
7477 @opindex fstack-protector-all
7478 Like @option{-fstack-protector} except that all functions are protected.
7480 @item -fsection-anchors
7481 @opindex fsection-anchors
7482 Try to reduce the number of symbolic address calculations by using
7483 shared ``anchor'' symbols to address nearby objects. This transformation
7484 can help to reduce the number of GOT entries and GOT accesses on some
7487 For example, the implementation of the following function @code{foo}:
7491 int foo (void) @{ return a + b + c; @}
7494 would usually calculate the addresses of all three variables, but if you
7495 compile it with @option{-fsection-anchors}, it will access the variables
7496 from a common anchor point instead. The effect is similar to the
7497 following pseudocode (which isn't valid C):
7502 register int *xr = &x;
7503 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
7507 Not all targets support this option.
7509 @item --param @var{name}=@var{value}
7511 In some places, GCC uses various constants to control the amount of
7512 optimization that is done. For example, GCC will not inline functions
7513 that contain more that a certain number of instructions. You can
7514 control some of these constants on the command-line using the
7515 @option{--param} option.
7517 The names of specific parameters, and the meaning of the values, are
7518 tied to the internals of the compiler, and are subject to change
7519 without notice in future releases.
7521 In each case, the @var{value} is an integer. The allowable choices for
7522 @var{name} are given in the following table:
7525 @item struct-reorg-cold-struct-ratio
7526 The threshold ratio (as a percentage) between a structure frequency
7527 and the frequency of the hottest structure in the program. This parameter
7528 is used by struct-reorg optimization enabled by @option{-fipa-struct-reorg}.
7529 We say that if the ratio of a structure frequency, calculated by profiling,
7530 to the hottest structure frequency in the program is less than this
7531 parameter, then structure reorganization is not applied to this structure.
7534 @item predictable-branch-cost-outcome
7535 When branch is predicted to be taken with probability lower than this threshold
7536 (in percent), then it is considered well predictable. The default is 10.
7538 @item max-crossjump-edges
7539 The maximum number of incoming edges to consider for crossjumping.
7540 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
7541 the number of edges incoming to each block. Increasing values mean
7542 more aggressive optimization, making the compile time increase with
7543 probably small improvement in executable size.
7545 @item min-crossjump-insns
7546 The minimum number of instructions which must be matched at the end
7547 of two blocks before crossjumping will be performed on them. This
7548 value is ignored in the case where all instructions in the block being
7549 crossjumped from are matched. The default value is 5.
7551 @item max-grow-copy-bb-insns
7552 The maximum code size expansion factor when copying basic blocks
7553 instead of jumping. The expansion is relative to a jump instruction.
7554 The default value is 8.
7556 @item max-goto-duplication-insns
7557 The maximum number of instructions to duplicate to a block that jumps
7558 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
7559 passes, GCC factors computed gotos early in the compilation process,
7560 and unfactors them as late as possible. Only computed jumps at the
7561 end of a basic blocks with no more than max-goto-duplication-insns are
7562 unfactored. The default value is 8.
7564 @item max-delay-slot-insn-search
7565 The maximum number of instructions to consider when looking for an
7566 instruction to fill a delay slot. If more than this arbitrary number of
7567 instructions is searched, the time savings from filling the delay slot
7568 will be minimal so stop searching. Increasing values mean more
7569 aggressive optimization, making the compile time increase with probably
7570 small improvement in executable run time.
7572 @item max-delay-slot-live-search
7573 When trying to fill delay slots, the maximum number of instructions to
7574 consider when searching for a block with valid live register
7575 information. Increasing this arbitrarily chosen value means more
7576 aggressive optimization, increasing the compile time. This parameter
7577 should be removed when the delay slot code is rewritten to maintain the
7580 @item max-gcse-memory
7581 The approximate maximum amount of memory that will be allocated in
7582 order to perform the global common subexpression elimination
7583 optimization. If more memory than specified is required, the
7584 optimization will not be done.
7586 @item max-pending-list-length
7587 The maximum number of pending dependencies scheduling will allow
7588 before flushing the current state and starting over. Large functions
7589 with few branches or calls can create excessively large lists which
7590 needlessly consume memory and resources.
7592 @item max-inline-insns-single
7593 Several parameters control the tree inliner used in gcc.
7594 This number sets the maximum number of instructions (counted in GCC's
7595 internal representation) in a single function that the tree inliner
7596 will consider for inlining. This only affects functions declared
7597 inline and methods implemented in a class declaration (C++).
7598 The default value is 300.
7600 @item max-inline-insns-auto
7601 When you use @option{-finline-functions} (included in @option{-O3}),
7602 a lot of functions that would otherwise not be considered for inlining
7603 by the compiler will be investigated. To those functions, a different
7604 (more restrictive) limit compared to functions declared inline can
7606 The default value is 60.
7608 @item large-function-insns
7609 The limit specifying really large functions. For functions larger than this
7610 limit after inlining, inlining is constrained by
7611 @option{--param large-function-growth}. This parameter is useful primarily
7612 to avoid extreme compilation time caused by non-linear algorithms used by the
7614 The default value is 2700.
7616 @item large-function-growth
7617 Specifies maximal growth of large function caused by inlining in percents.
7618 The default value is 100 which limits large function growth to 2.0 times
7621 @item large-unit-insns
7622 The limit specifying large translation unit. Growth caused by inlining of
7623 units larger than this limit is limited by @option{--param inline-unit-growth}.
7624 For small units this might be too tight (consider unit consisting of function A
7625 that is inline and B that just calls A three time. If B is small relative to
7626 A, the growth of unit is 300\% and yet such inlining is very sane. For very
7627 large units consisting of small inlineable functions however the overall unit
7628 growth limit is needed to avoid exponential explosion of code size. Thus for
7629 smaller units, the size is increased to @option{--param large-unit-insns}
7630 before applying @option{--param inline-unit-growth}. The default is 10000
7632 @item inline-unit-growth
7633 Specifies maximal overall growth of the compilation unit caused by inlining.
7634 The default value is 30 which limits unit growth to 1.3 times the original
7637 @item ipcp-unit-growth
7638 Specifies maximal overall growth of the compilation unit caused by
7639 interprocedural constant propagation. The default value is 10 which limits
7640 unit growth to 1.1 times the original size.
7642 @item large-stack-frame
7643 The limit specifying large stack frames. While inlining the algorithm is trying
7644 to not grow past this limit too much. Default value is 256 bytes.
7646 @item large-stack-frame-growth
7647 Specifies maximal growth of large stack frames caused by inlining in percents.
7648 The default value is 1000 which limits large stack frame growth to 11 times
7651 @item max-inline-insns-recursive
7652 @itemx max-inline-insns-recursive-auto
7653 Specifies maximum number of instructions out-of-line copy of self recursive inline
7654 function can grow into by performing recursive inlining.
7656 For functions declared inline @option{--param max-inline-insns-recursive} is
7657 taken into account. For function not declared inline, recursive inlining
7658 happens only when @option{-finline-functions} (included in @option{-O3}) is
7659 enabled and @option{--param max-inline-insns-recursive-auto} is used. The
7660 default value is 450.
7662 @item max-inline-recursive-depth
7663 @itemx max-inline-recursive-depth-auto
7664 Specifies maximum recursion depth used by the recursive inlining.
7666 For functions declared inline @option{--param max-inline-recursive-depth} is
7667 taken into account. For function not declared inline, recursive inlining
7668 happens only when @option{-finline-functions} (included in @option{-O3}) is
7669 enabled and @option{--param max-inline-recursive-depth-auto} is used. The
7672 @item min-inline-recursive-probability
7673 Recursive inlining is profitable only for function having deep recursion
7674 in average and can hurt for function having little recursion depth by
7675 increasing the prologue size or complexity of function body to other
7678 When profile feedback is available (see @option{-fprofile-generate}) the actual
7679 recursion depth can be guessed from probability that function will recurse via
7680 given call expression. This parameter limits inlining only to call expression
7681 whose probability exceeds given threshold (in percents). The default value is
7684 @item early-inlining-insns
7685 Specify growth that early inliner can make. In effect it increases amount of
7686 inlining for code having large abstraction penalty. The default value is 12.
7688 @item max-early-inliner-iterations
7689 @itemx max-early-inliner-iterations
7690 Limit of iterations of early inliner. This basically bounds number of nested
7691 indirect calls early inliner can resolve. Deeper chains are still handled by
7694 @item min-vect-loop-bound
7695 The minimum number of iterations under which a loop will not get vectorized
7696 when @option{-ftree-vectorize} is used. The number of iterations after
7697 vectorization needs to be greater than the value specified by this option
7698 to allow vectorization. The default value is 0.
7700 @item max-unrolled-insns
7701 The maximum number of instructions that a loop should have if that loop
7702 is unrolled, and if the loop is unrolled, it determines how many times
7703 the loop code is unrolled.
7705 @item max-average-unrolled-insns
7706 The maximum number of instructions biased by probabilities of their execution
7707 that a loop should have if that loop is unrolled, and if the loop is unrolled,
7708 it determines how many times the loop code is unrolled.
7710 @item max-unroll-times
7711 The maximum number of unrollings of a single loop.
7713 @item max-peeled-insns
7714 The maximum number of instructions that a loop should have if that loop
7715 is peeled, and if the loop is peeled, it determines how many times
7716 the loop code is peeled.
7718 @item max-peel-times
7719 The maximum number of peelings of a single loop.
7721 @item max-completely-peeled-insns
7722 The maximum number of insns of a completely peeled loop.
7724 @item max-completely-peel-times
7725 The maximum number of iterations of a loop to be suitable for complete peeling.
7727 @item max-unswitch-insns
7728 The maximum number of insns of an unswitched loop.
7730 @item max-unswitch-level
7731 The maximum number of branches unswitched in a single loop.
7734 The minimum cost of an expensive expression in the loop invariant motion.
7736 @item iv-consider-all-candidates-bound
7737 Bound on number of candidates for induction variables below that
7738 all candidates are considered for each use in induction variable
7739 optimizations. Only the most relevant candidates are considered
7740 if there are more candidates, to avoid quadratic time complexity.
7742 @item iv-max-considered-uses
7743 The induction variable optimizations give up on loops that contain more
7744 induction variable uses.
7746 @item iv-always-prune-cand-set-bound
7747 If number of candidates in the set is smaller than this value,
7748 we always try to remove unnecessary ivs from the set during its
7749 optimization when a new iv is added to the set.
7751 @item scev-max-expr-size
7752 Bound on size of expressions used in the scalar evolutions analyzer.
7753 Large expressions slow the analyzer.
7755 @item omega-max-vars
7756 The maximum number of variables in an Omega constraint system.
7757 The default value is 128.
7759 @item omega-max-geqs
7760 The maximum number of inequalities in an Omega constraint system.
7761 The default value is 256.
7764 The maximum number of equalities in an Omega constraint system.
7765 The default value is 128.
7767 @item omega-max-wild-cards
7768 The maximum number of wildcard variables that the Omega solver will
7769 be able to insert. The default value is 18.
7771 @item omega-hash-table-size
7772 The size of the hash table in the Omega solver. The default value is
7775 @item omega-max-keys
7776 The maximal number of keys used by the Omega solver. The default
7779 @item omega-eliminate-redundant-constraints
7780 When set to 1, use expensive methods to eliminate all redundant
7781 constraints. The default value is 0.
7783 @item vect-max-version-for-alignment-checks
7784 The maximum number of runtime checks that can be performed when
7785 doing loop versioning for alignment in the vectorizer. See option
7786 ftree-vect-loop-version for more information.
7788 @item vect-max-version-for-alias-checks
7789 The maximum number of runtime checks that can be performed when
7790 doing loop versioning for alias in the vectorizer. See option
7791 ftree-vect-loop-version for more information.
7793 @item max-iterations-to-track
7795 The maximum number of iterations of a loop the brute force algorithm
7796 for analysis of # of iterations of the loop tries to evaluate.
7798 @item hot-bb-count-fraction
7799 Select fraction of the maximal count of repetitions of basic block in program
7800 given basic block needs to have to be considered hot.
7802 @item hot-bb-frequency-fraction
7803 Select fraction of the maximal frequency of executions of basic block in
7804 function given basic block needs to have to be considered hot
7806 @item max-predicted-iterations
7807 The maximum number of loop iterations we predict statically. This is useful
7808 in cases where function contain single loop with known bound and other loop
7809 with unknown. We predict the known number of iterations correctly, while
7810 the unknown number of iterations average to roughly 10. This means that the
7811 loop without bounds would appear artificially cold relative to the other one.
7813 @item align-threshold
7815 Select fraction of the maximal frequency of executions of basic block in
7816 function given basic block will get aligned.
7818 @item align-loop-iterations
7820 A loop expected to iterate at lest the selected number of iterations will get
7823 @item tracer-dynamic-coverage
7824 @itemx tracer-dynamic-coverage-feedback
7826 This value is used to limit superblock formation once the given percentage of
7827 executed instructions is covered. This limits unnecessary code size
7830 The @option{tracer-dynamic-coverage-feedback} is used only when profile
7831 feedback is available. The real profiles (as opposed to statically estimated
7832 ones) are much less balanced allowing the threshold to be larger value.
7834 @item tracer-max-code-growth
7835 Stop tail duplication once code growth has reached given percentage. This is
7836 rather hokey argument, as most of the duplicates will be eliminated later in
7837 cross jumping, so it may be set to much higher values than is the desired code
7840 @item tracer-min-branch-ratio
7842 Stop reverse growth when the reverse probability of best edge is less than this
7843 threshold (in percent).
7845 @item tracer-min-branch-ratio
7846 @itemx tracer-min-branch-ratio-feedback
7848 Stop forward growth if the best edge do have probability lower than this
7851 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
7852 compilation for profile feedback and one for compilation without. The value
7853 for compilation with profile feedback needs to be more conservative (higher) in
7854 order to make tracer effective.
7856 @item max-cse-path-length
7858 Maximum number of basic blocks on path that cse considers. The default is 10.
7861 The maximum instructions CSE process before flushing. The default is 1000.
7863 @item ggc-min-expand
7865 GCC uses a garbage collector to manage its own memory allocation. This
7866 parameter specifies the minimum percentage by which the garbage
7867 collector's heap should be allowed to expand between collections.
7868 Tuning this may improve compilation speed; it has no effect on code
7871 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
7872 RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is
7873 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
7874 GCC is not able to calculate RAM on a particular platform, the lower
7875 bound of 30% is used. Setting this parameter and
7876 @option{ggc-min-heapsize} to zero causes a full collection to occur at
7877 every opportunity. This is extremely slow, but can be useful for
7880 @item ggc-min-heapsize
7882 Minimum size of the garbage collector's heap before it begins bothering
7883 to collect garbage. The first collection occurs after the heap expands
7884 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
7885 tuning this may improve compilation speed, and has no effect on code
7888 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
7889 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
7890 with a lower bound of 4096 (four megabytes) and an upper bound of
7891 131072 (128 megabytes). If GCC is not able to calculate RAM on a
7892 particular platform, the lower bound is used. Setting this parameter
7893 very large effectively disables garbage collection. Setting this
7894 parameter and @option{ggc-min-expand} to zero causes a full collection
7895 to occur at every opportunity.
7897 @item max-reload-search-insns
7898 The maximum number of instruction reload should look backward for equivalent
7899 register. Increasing values mean more aggressive optimization, making the
7900 compile time increase with probably slightly better performance. The default
7903 @item max-cselib-memory-locations
7904 The maximum number of memory locations cselib should take into account.
7905 Increasing values mean more aggressive optimization, making the compile time
7906 increase with probably slightly better performance. The default value is 500.
7908 @item reorder-blocks-duplicate
7909 @itemx reorder-blocks-duplicate-feedback
7911 Used by basic block reordering pass to decide whether to use unconditional
7912 branch or duplicate the code on its destination. Code is duplicated when its
7913 estimated size is smaller than this value multiplied by the estimated size of
7914 unconditional jump in the hot spots of the program.
7916 The @option{reorder-block-duplicate-feedback} is used only when profile
7917 feedback is available and may be set to higher values than
7918 @option{reorder-block-duplicate} since information about the hot spots is more
7921 @item max-sched-ready-insns
7922 The maximum number of instructions ready to be issued the scheduler should
7923 consider at any given time during the first scheduling pass. Increasing
7924 values mean more thorough searches, making the compilation time increase
7925 with probably little benefit. The default value is 100.
7927 @item max-sched-region-blocks
7928 The maximum number of blocks in a region to be considered for
7929 interblock scheduling. The default value is 10.
7931 @item max-pipeline-region-blocks
7932 The maximum number of blocks in a region to be considered for
7933 pipelining in the selective scheduler. The default value is 15.
7935 @item max-sched-region-insns
7936 The maximum number of insns in a region to be considered for
7937 interblock scheduling. The default value is 100.
7939 @item max-pipeline-region-insns
7940 The maximum number of insns in a region to be considered for
7941 pipelining in the selective scheduler. The default value is 200.
7944 The minimum probability (in percents) of reaching a source block
7945 for interblock speculative scheduling. The default value is 40.
7947 @item max-sched-extend-regions-iters
7948 The maximum number of iterations through CFG to extend regions.
7949 0 - disable region extension,
7950 N - do at most N iterations.
7951 The default value is 0.
7953 @item max-sched-insn-conflict-delay
7954 The maximum conflict delay for an insn to be considered for speculative motion.
7955 The default value is 3.
7957 @item sched-spec-prob-cutoff
7958 The minimal probability of speculation success (in percents), so that
7959 speculative insn will be scheduled.
7960 The default value is 40.
7962 @item sched-mem-true-dep-cost
7963 Minimal distance (in CPU cycles) between store and load targeting same
7964 memory locations. The default value is 1.
7966 @item selsched-max-lookahead
7967 The maximum size of the lookahead window of selective scheduling. It is a
7968 depth of search for available instructions.
7969 The default value is 50.
7971 @item selsched-max-sched-times
7972 The maximum number of times that an instruction will be scheduled during
7973 selective scheduling. This is the limit on the number of iterations
7974 through which the instruction may be pipelined. The default value is 2.
7976 @item selsched-max-insns-to-rename
7977 The maximum number of best instructions in the ready list that are considered
7978 for renaming in the selective scheduler. The default value is 2.
7980 @item max-last-value-rtl
7981 The maximum size measured as number of RTLs that can be recorded in an expression
7982 in combiner for a pseudo register as last known value of that register. The default
7985 @item integer-share-limit
7986 Small integer constants can use a shared data structure, reducing the
7987 compiler's memory usage and increasing its speed. This sets the maximum
7988 value of a shared integer constant. The default value is 256.
7990 @item min-virtual-mappings
7991 Specifies the minimum number of virtual mappings in the incremental
7992 SSA updater that should be registered to trigger the virtual mappings
7993 heuristic defined by virtual-mappings-ratio. The default value is
7996 @item virtual-mappings-ratio
7997 If the number of virtual mappings is virtual-mappings-ratio bigger
7998 than the number of virtual symbols to be updated, then the incremental
7999 SSA updater switches to a full update for those symbols. The default
8002 @item ssp-buffer-size
8003 The minimum size of buffers (i.e.@: arrays) that will receive stack smashing
8004 protection when @option{-fstack-protection} is used.
8006 @item max-jump-thread-duplication-stmts
8007 Maximum number of statements allowed in a block that needs to be
8008 duplicated when threading jumps.
8010 @item max-fields-for-field-sensitive
8011 Maximum number of fields in a structure we will treat in
8012 a field sensitive manner during pointer analysis. The default is zero
8013 for -O0, and -O1 and 100 for -Os, -O2, and -O3.
8015 @item prefetch-latency
8016 Estimate on average number of instructions that are executed before
8017 prefetch finishes. The distance we prefetch ahead is proportional
8018 to this constant. Increasing this number may also lead to less
8019 streams being prefetched (see @option{simultaneous-prefetches}).
8021 @item simultaneous-prefetches
8022 Maximum number of prefetches that can run at the same time.
8024 @item l1-cache-line-size
8025 The size of cache line in L1 cache, in bytes.
8028 The size of L1 cache, in kilobytes.
8031 The size of L2 cache, in kilobytes.
8033 @item min-insn-to-prefetch-ratio
8034 The minimum ratio between the number of instructions and the
8035 number of prefetches to enable prefetching in a loop with an
8038 @item prefetch-min-insn-to-mem-ratio
8039 The minimum ratio between the number of instructions and the
8040 number of memory references to enable prefetching in a loop.
8042 @item use-canonical-types
8043 Whether the compiler should use the ``canonical'' type system. By
8044 default, this should always be 1, which uses a more efficient internal
8045 mechanism for comparing types in C++ and Objective-C++. However, if
8046 bugs in the canonical type system are causing compilation failures,
8047 set this value to 0 to disable canonical types.
8049 @item switch-conversion-max-branch-ratio
8050 Switch initialization conversion will refuse to create arrays that are
8051 bigger than @option{switch-conversion-max-branch-ratio} times the number of
8052 branches in the switch.
8054 @item max-partial-antic-length
8055 Maximum length of the partial antic set computed during the tree
8056 partial redundancy elimination optimization (@option{-ftree-pre}) when
8057 optimizing at @option{-O3} and above. For some sorts of source code
8058 the enhanced partial redundancy elimination optimization can run away,
8059 consuming all of the memory available on the host machine. This
8060 parameter sets a limit on the length of the sets that are computed,
8061 which prevents the runaway behavior. Setting a value of 0 for
8062 this parameter will allow an unlimited set length.
8064 @item sccvn-max-scc-size
8065 Maximum size of a strongly connected component (SCC) during SCCVN
8066 processing. If this limit is hit, SCCVN processing for the whole
8067 function will not be done and optimizations depending on it will
8068 be disabled. The default maximum SCC size is 10000.
8070 @item ira-max-loops-num
8071 IRA uses a regional register allocation by default. If a function
8072 contains loops more than number given by the parameter, only at most
8073 given number of the most frequently executed loops will form regions
8074 for the regional register allocation. The default value of the
8077 @item ira-max-conflict-table-size
8078 Although IRA uses a sophisticated algorithm of compression conflict
8079 table, the table can be still big for huge functions. If the conflict
8080 table for a function could be more than size in MB given by the
8081 parameter, the conflict table is not built and faster, simpler, and
8082 lower quality register allocation algorithm will be used. The
8083 algorithm do not use pseudo-register conflicts. The default value of
8084 the parameter is 2000.
8086 @item loop-invariant-max-bbs-in-loop
8087 Loop invariant motion can be very expensive, both in compile time and
8088 in amount of needed compile time memory, with very large loops. Loops
8089 with more basic blocks than this parameter won't have loop invariant
8090 motion optimization performed on them. The default value of the
8091 parameter is 1000 for -O1 and 10000 for -O2 and above.
8096 @node Preprocessor Options
8097 @section Options Controlling the Preprocessor
8098 @cindex preprocessor options
8099 @cindex options, preprocessor
8101 These options control the C preprocessor, which is run on each C source
8102 file before actual compilation.
8104 If you use the @option{-E} option, nothing is done except preprocessing.
8105 Some of these options make sense only together with @option{-E} because
8106 they cause the preprocessor output to be unsuitable for actual
8110 @item -Wp,@var{option}
8112 You can use @option{-Wp,@var{option}} to bypass the compiler driver
8113 and pass @var{option} directly through to the preprocessor. If
8114 @var{option} contains commas, it is split into multiple options at the
8115 commas. However, many options are modified, translated or interpreted
8116 by the compiler driver before being passed to the preprocessor, and
8117 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
8118 interface is undocumented and subject to change, so whenever possible
8119 you should avoid using @option{-Wp} and let the driver handle the
8122 @item -Xpreprocessor @var{option}
8123 @opindex Xpreprocessor
8124 Pass @var{option} as an option to the preprocessor. You can use this to
8125 supply system-specific preprocessor options which GCC does not know how to
8128 If you want to pass an option that takes an argument, you must use
8129 @option{-Xpreprocessor} twice, once for the option and once for the argument.
8132 @include cppopts.texi
8134 @node Assembler Options
8135 @section Passing Options to the Assembler
8137 @c prevent bad page break with this line
8138 You can pass options to the assembler.
8141 @item -Wa,@var{option}
8143 Pass @var{option} as an option to the assembler. If @var{option}
8144 contains commas, it is split into multiple options at the commas.
8146 @item -Xassembler @var{option}
8148 Pass @var{option} as an option to the assembler. You can use this to
8149 supply system-specific assembler options which GCC does not know how to
8152 If you want to pass an option that takes an argument, you must use
8153 @option{-Xassembler} twice, once for the option and once for the argument.
8158 @section Options for Linking
8159 @cindex link options
8160 @cindex options, linking
8162 These options come into play when the compiler links object files into
8163 an executable output file. They are meaningless if the compiler is
8164 not doing a link step.
8168 @item @var{object-file-name}
8169 A file name that does not end in a special recognized suffix is
8170 considered to name an object file or library. (Object files are
8171 distinguished from libraries by the linker according to the file
8172 contents.) If linking is done, these object files are used as input
8181 If any of these options is used, then the linker is not run, and
8182 object file names should not be used as arguments. @xref{Overall
8186 @item -l@var{library}
8187 @itemx -l @var{library}
8189 Search the library named @var{library} when linking. (The second
8190 alternative with the library as a separate argument is only for
8191 POSIX compliance and is not recommended.)
8193 It makes a difference where in the command you write this option; the
8194 linker searches and processes libraries and object files in the order they
8195 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
8196 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
8197 to functions in @samp{z}, those functions may not be loaded.
8199 The linker searches a standard list of directories for the library,
8200 which is actually a file named @file{lib@var{library}.a}. The linker
8201 then uses this file as if it had been specified precisely by name.
8203 The directories searched include several standard system directories
8204 plus any that you specify with @option{-L}.
8206 Normally the files found this way are library files---archive files
8207 whose members are object files. The linker handles an archive file by
8208 scanning through it for members which define symbols that have so far
8209 been referenced but not defined. But if the file that is found is an
8210 ordinary object file, it is linked in the usual fashion. The only
8211 difference between using an @option{-l} option and specifying a file name
8212 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
8213 and searches several directories.
8217 You need this special case of the @option{-l} option in order to
8218 link an Objective-C or Objective-C++ program.
8221 @opindex nostartfiles
8222 Do not use the standard system startup files when linking.
8223 The standard system libraries are used normally, unless @option{-nostdlib}
8224 or @option{-nodefaultlibs} is used.
8226 @item -nodefaultlibs
8227 @opindex nodefaultlibs
8228 Do not use the standard system libraries when linking.
8229 Only the libraries you specify will be passed to the linker, options
8230 specifying linkage of the system libraries, such as @code{-static-libgcc}
8231 or @code{-shared-libgcc}, will be ignored.
8232 The standard startup files are used normally, unless @option{-nostartfiles}
8233 is used. The compiler may generate calls to @code{memcmp},
8234 @code{memset}, @code{memcpy} and @code{memmove}.
8235 These entries are usually resolved by entries in
8236 libc. These entry points should be supplied through some other
8237 mechanism when this option is specified.
8241 Do not use the standard system startup files or libraries when linking.
8242 No startup files and only the libraries you specify will be passed to
8243 the linker, options specifying linkage of the system libraries, such as
8244 @code{-static-libgcc} or @code{-shared-libgcc}, will be ignored.
8245 The compiler may generate calls to @code{memcmp}, @code{memset},
8246 @code{memcpy} and @code{memmove}.
8247 These entries are usually resolved by entries in
8248 libc. These entry points should be supplied through some other
8249 mechanism when this option is specified.
8251 @cindex @option{-lgcc}, use with @option{-nostdlib}
8252 @cindex @option{-nostdlib} and unresolved references
8253 @cindex unresolved references and @option{-nostdlib}
8254 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
8255 @cindex @option{-nodefaultlibs} and unresolved references
8256 @cindex unresolved references and @option{-nodefaultlibs}
8257 One of the standard libraries bypassed by @option{-nostdlib} and
8258 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
8259 that GCC uses to overcome shortcomings of particular machines, or special
8260 needs for some languages.
8261 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
8262 Collection (GCC) Internals},
8263 for more discussion of @file{libgcc.a}.)
8264 In most cases, you need @file{libgcc.a} even when you want to avoid
8265 other standard libraries. In other words, when you specify @option{-nostdlib}
8266 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
8267 This ensures that you have no unresolved references to internal GCC
8268 library subroutines. (For example, @samp{__main}, used to ensure C++
8269 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
8270 GNU Compiler Collection (GCC) Internals}.)
8274 Produce a position independent executable on targets which support it.
8275 For predictable results, you must also specify the same set of options
8276 that were used to generate code (@option{-fpie}, @option{-fPIE},
8277 or model suboptions) when you specify this option.
8281 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
8282 that support it. This instructs the linker to add all symbols, not
8283 only used ones, to the dynamic symbol table. This option is needed
8284 for some uses of @code{dlopen} or to allow obtaining backtraces
8285 from within a program.
8289 Remove all symbol table and relocation information from the executable.
8293 On systems that support dynamic linking, this prevents linking with the shared
8294 libraries. On other systems, this option has no effect.
8298 Produce a shared object which can then be linked with other objects to
8299 form an executable. Not all systems support this option. For predictable
8300 results, you must also specify the same set of options that were used to
8301 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
8302 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
8303 needs to build supplementary stub code for constructors to work. On
8304 multi-libbed systems, @samp{gcc -shared} must select the correct support
8305 libraries to link against. Failing to supply the correct flags may lead
8306 to subtle defects. Supplying them in cases where they are not necessary
8309 @item -shared-libgcc
8310 @itemx -static-libgcc
8311 @opindex shared-libgcc
8312 @opindex static-libgcc
8313 On systems that provide @file{libgcc} as a shared library, these options
8314 force the use of either the shared or static version respectively.
8315 If no shared version of @file{libgcc} was built when the compiler was
8316 configured, these options have no effect.
8318 There are several situations in which an application should use the
8319 shared @file{libgcc} instead of the static version. The most common
8320 of these is when the application wishes to throw and catch exceptions
8321 across different shared libraries. In that case, each of the libraries
8322 as well as the application itself should use the shared @file{libgcc}.
8324 Therefore, the G++ and GCJ drivers automatically add
8325 @option{-shared-libgcc} whenever you build a shared library or a main
8326 executable, because C++ and Java programs typically use exceptions, so
8327 this is the right thing to do.
8329 If, instead, you use the GCC driver to create shared libraries, you may
8330 find that they will not always be linked with the shared @file{libgcc}.
8331 If GCC finds, at its configuration time, that you have a non-GNU linker
8332 or a GNU linker that does not support option @option{--eh-frame-hdr},
8333 it will link the shared version of @file{libgcc} into shared libraries
8334 by default. Otherwise, it will take advantage of the linker and optimize
8335 away the linking with the shared version of @file{libgcc}, linking with
8336 the static version of libgcc by default. This allows exceptions to
8337 propagate through such shared libraries, without incurring relocation
8338 costs at library load time.
8340 However, if a library or main executable is supposed to throw or catch
8341 exceptions, you must link it using the G++ or GCJ driver, as appropriate
8342 for the languages used in the program, or using the option
8343 @option{-shared-libgcc}, such that it is linked with the shared
8346 @item -static-libstdc++
8347 When the @command{g++} program is used to link a C++ program, it will
8348 normally automatically link against @option{libstdc++}. If
8349 @file{libstdc++} is available as a shared library, and the
8350 @option{-static} option is not used, then this will link against the
8351 shared version of @file{libstdc++}. That is normally fine. However, it
8352 is sometimes useful to freeze the version of @file{libstdc++} used by
8353 the program without going all the way to a fully static link. The
8354 @option{-static-libstdc++} option directs the @command{g++} driver to
8355 link @file{libstdc++} statically, without necessarily linking other
8356 libraries statically.
8360 Bind references to global symbols when building a shared object. Warn
8361 about any unresolved references (unless overridden by the link editor
8362 option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
8365 @item -T @var{script}
8367 @cindex linker script
8368 Use @var{script} as the linker script. This option is supported by most
8369 systems using the GNU linker. On some targets, such as bare-board
8370 targets without an operating system, the @option{-T} option may be required
8371 when linking to avoid references to undefined symbols.
8373 @item -Xlinker @var{option}
8375 Pass @var{option} as an option to the linker. You can use this to
8376 supply system-specific linker options which GCC does not know how to
8379 If you want to pass an option that takes a separate argument, you must use
8380 @option{-Xlinker} twice, once for the option and once for the argument.
8381 For example, to pass @option{-assert definitions}, you must write
8382 @samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
8383 @option{-Xlinker "-assert definitions"}, because this passes the entire
8384 string as a single argument, which is not what the linker expects.
8386 When using the GNU linker, it is usually more convenient to pass
8387 arguments to linker options using the @option{@var{option}=@var{value}}
8388 syntax than as separate arguments. For example, you can specify
8389 @samp{-Xlinker -Map=output.map} rather than
8390 @samp{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
8391 this syntax for command-line options.
8393 @item -Wl,@var{option}
8395 Pass @var{option} as an option to the linker. If @var{option} contains
8396 commas, it is split into multiple options at the commas. You can use this
8397 syntax to pass an argument to the option.
8398 For example, @samp{-Wl,-Map,output.map} passes @samp{-Map output.map} to the
8399 linker. When using the GNU linker, you can also get the same effect with
8400 @samp{-Wl,-Map=output.map}.
8402 @item -u @var{symbol}
8404 Pretend the symbol @var{symbol} is undefined, to force linking of
8405 library modules to define it. You can use @option{-u} multiple times with
8406 different symbols to force loading of additional library modules.
8409 @node Directory Options
8410 @section Options for Directory Search
8411 @cindex directory options
8412 @cindex options, directory search
8415 These options specify directories to search for header files, for
8416 libraries and for parts of the compiler:
8421 Add the directory @var{dir} to the head of the list of directories to be
8422 searched for header files. This can be used to override a system header
8423 file, substituting your own version, since these directories are
8424 searched before the system header file directories. However, you should
8425 not use this option to add directories that contain vendor-supplied
8426 system header files (use @option{-isystem} for that). If you use more than
8427 one @option{-I} option, the directories are scanned in left-to-right
8428 order; the standard system directories come after.
8430 If a standard system include directory, or a directory specified with
8431 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
8432 option will be ignored. The directory will still be searched but as a
8433 system directory at its normal position in the system include chain.
8434 This is to ensure that GCC's procedure to fix buggy system headers and
8435 the ordering for the include_next directive are not inadvertently changed.
8436 If you really need to change the search order for system directories,
8437 use the @option{-nostdinc} and/or @option{-isystem} options.
8439 @item -iquote@var{dir}
8441 Add the directory @var{dir} to the head of the list of directories to
8442 be searched for header files only for the case of @samp{#include
8443 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
8444 otherwise just like @option{-I}.
8448 Add directory @var{dir} to the list of directories to be searched
8451 @item -B@var{prefix}
8453 This option specifies where to find the executables, libraries,
8454 include files, and data files of the compiler itself.
8456 The compiler driver program runs one or more of the subprograms
8457 @file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
8458 @var{prefix} as a prefix for each program it tries to run, both with and
8459 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
8461 For each subprogram to be run, the compiler driver first tries the
8462 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
8463 was not specified, the driver tries two standard prefixes, which are
8464 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
8465 those results in a file name that is found, the unmodified program
8466 name is searched for using the directories specified in your
8467 @env{PATH} environment variable.
8469 The compiler will check to see if the path provided by the @option{-B}
8470 refers to a directory, and if necessary it will add a directory
8471 separator character at the end of the path.
8473 @option{-B} prefixes that effectively specify directory names also apply
8474 to libraries in the linker, because the compiler translates these
8475 options into @option{-L} options for the linker. They also apply to
8476 includes files in the preprocessor, because the compiler translates these
8477 options into @option{-isystem} options for the preprocessor. In this case,
8478 the compiler appends @samp{include} to the prefix.
8480 The run-time support file @file{libgcc.a} can also be searched for using
8481 the @option{-B} prefix, if needed. If it is not found there, the two
8482 standard prefixes above are tried, and that is all. The file is left
8483 out of the link if it is not found by those means.
8485 Another way to specify a prefix much like the @option{-B} prefix is to use
8486 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
8489 As a special kludge, if the path provided by @option{-B} is
8490 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
8491 9, then it will be replaced by @file{[dir/]include}. This is to help
8492 with boot-strapping the compiler.
8494 @item -specs=@var{file}
8496 Process @var{file} after the compiler reads in the standard @file{specs}
8497 file, in order to override the defaults that the @file{gcc} driver
8498 program uses when determining what switches to pass to @file{cc1},
8499 @file{cc1plus}, @file{as}, @file{ld}, etc. More than one
8500 @option{-specs=@var{file}} can be specified on the command line, and they
8501 are processed in order, from left to right.
8503 @item --sysroot=@var{dir}
8505 Use @var{dir} as the logical root directory for headers and libraries.
8506 For example, if the compiler would normally search for headers in
8507 @file{/usr/include} and libraries in @file{/usr/lib}, it will instead
8508 search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
8510 If you use both this option and the @option{-isysroot} option, then
8511 the @option{--sysroot} option will apply to libraries, but the
8512 @option{-isysroot} option will apply to header files.
8514 The GNU linker (beginning with version 2.16) has the necessary support
8515 for this option. If your linker does not support this option, the
8516 header file aspect of @option{--sysroot} will still work, but the
8517 library aspect will not.
8521 This option has been deprecated. Please use @option{-iquote} instead for
8522 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
8523 Any directories you specify with @option{-I} options before the @option{-I-}
8524 option are searched only for the case of @samp{#include "@var{file}"};
8525 they are not searched for @samp{#include <@var{file}>}.
8527 If additional directories are specified with @option{-I} options after
8528 the @option{-I-}, these directories are searched for all @samp{#include}
8529 directives. (Ordinarily @emph{all} @option{-I} directories are used
8532 In addition, the @option{-I-} option inhibits the use of the current
8533 directory (where the current input file came from) as the first search
8534 directory for @samp{#include "@var{file}"}. There is no way to
8535 override this effect of @option{-I-}. With @option{-I.} you can specify
8536 searching the directory which was current when the compiler was
8537 invoked. That is not exactly the same as what the preprocessor does
8538 by default, but it is often satisfactory.
8540 @option{-I-} does not inhibit the use of the standard system directories
8541 for header files. Thus, @option{-I-} and @option{-nostdinc} are
8548 @section Specifying subprocesses and the switches to pass to them
8551 @command{gcc} is a driver program. It performs its job by invoking a
8552 sequence of other programs to do the work of compiling, assembling and
8553 linking. GCC interprets its command-line parameters and uses these to
8554 deduce which programs it should invoke, and which command-line options
8555 it ought to place on their command lines. This behavior is controlled
8556 by @dfn{spec strings}. In most cases there is one spec string for each
8557 program that GCC can invoke, but a few programs have multiple spec
8558 strings to control their behavior. The spec strings built into GCC can
8559 be overridden by using the @option{-specs=} command-line switch to specify
8562 @dfn{Spec files} are plaintext files that are used to construct spec
8563 strings. They consist of a sequence of directives separated by blank
8564 lines. The type of directive is determined by the first non-whitespace
8565 character on the line and it can be one of the following:
8568 @item %@var{command}
8569 Issues a @var{command} to the spec file processor. The commands that can
8573 @item %include <@var{file}>
8575 Search for @var{file} and insert its text at the current point in the
8578 @item %include_noerr <@var{file}>
8579 @cindex %include_noerr
8580 Just like @samp{%include}, but do not generate an error message if the include
8581 file cannot be found.
8583 @item %rename @var{old_name} @var{new_name}
8585 Rename the spec string @var{old_name} to @var{new_name}.
8589 @item *[@var{spec_name}]:
8590 This tells the compiler to create, override or delete the named spec
8591 string. All lines after this directive up to the next directive or
8592 blank line are considered to be the text for the spec string. If this
8593 results in an empty string then the spec will be deleted. (Or, if the
8594 spec did not exist, then nothing will happened.) Otherwise, if the spec
8595 does not currently exist a new spec will be created. If the spec does
8596 exist then its contents will be overridden by the text of this
8597 directive, unless the first character of that text is the @samp{+}
8598 character, in which case the text will be appended to the spec.
8600 @item [@var{suffix}]:
8601 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
8602 and up to the next directive or blank line are considered to make up the
8603 spec string for the indicated suffix. When the compiler encounters an
8604 input file with the named suffix, it will processes the spec string in
8605 order to work out how to compile that file. For example:
8612 This says that any input file whose name ends in @samp{.ZZ} should be
8613 passed to the program @samp{z-compile}, which should be invoked with the
8614 command-line switch @option{-input} and with the result of performing the
8615 @samp{%i} substitution. (See below.)
8617 As an alternative to providing a spec string, the text that follows a
8618 suffix directive can be one of the following:
8621 @item @@@var{language}
8622 This says that the suffix is an alias for a known @var{language}. This is
8623 similar to using the @option{-x} command-line switch to GCC to specify a
8624 language explicitly. For example:
8631 Says that .ZZ files are, in fact, C++ source files.
8634 This causes an error messages saying:
8637 @var{name} compiler not installed on this system.
8641 GCC already has an extensive list of suffixes built into it.
8642 This directive will add an entry to the end of the list of suffixes, but
8643 since the list is searched from the end backwards, it is effectively
8644 possible to override earlier entries using this technique.
8648 GCC has the following spec strings built into it. Spec files can
8649 override these strings or create their own. Note that individual
8650 targets can also add their own spec strings to this list.
8653 asm Options to pass to the assembler
8654 asm_final Options to pass to the assembler post-processor
8655 cpp Options to pass to the C preprocessor
8656 cc1 Options to pass to the C compiler
8657 cc1plus Options to pass to the C++ compiler
8658 endfile Object files to include at the end of the link
8659 link Options to pass to the linker
8660 lib Libraries to include on the command line to the linker
8661 libgcc Decides which GCC support library to pass to the linker
8662 linker Sets the name of the linker
8663 predefines Defines to be passed to the C preprocessor
8664 signed_char Defines to pass to CPP to say whether @code{char} is signed
8666 startfile Object files to include at the start of the link
8669 Here is a small example of a spec file:
8675 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
8678 This example renames the spec called @samp{lib} to @samp{old_lib} and
8679 then overrides the previous definition of @samp{lib} with a new one.
8680 The new definition adds in some extra command-line options before
8681 including the text of the old definition.
8683 @dfn{Spec strings} are a list of command-line options to be passed to their
8684 corresponding program. In addition, the spec strings can contain
8685 @samp{%}-prefixed sequences to substitute variable text or to
8686 conditionally insert text into the command line. Using these constructs
8687 it is possible to generate quite complex command lines.
8689 Here is a table of all defined @samp{%}-sequences for spec
8690 strings. Note that spaces are not generated automatically around the
8691 results of expanding these sequences. Therefore you can concatenate them
8692 together or combine them with constant text in a single argument.
8696 Substitute one @samp{%} into the program name or argument.
8699 Substitute the name of the input file being processed.
8702 Substitute the basename of the input file being processed.
8703 This is the substring up to (and not including) the last period
8704 and not including the directory.
8707 This is the same as @samp{%b}, but include the file suffix (text after
8711 Marks the argument containing or following the @samp{%d} as a
8712 temporary file name, so that that file will be deleted if GCC exits
8713 successfully. Unlike @samp{%g}, this contributes no text to the
8716 @item %g@var{suffix}
8717 Substitute a file name that has suffix @var{suffix} and is chosen
8718 once per compilation, and mark the argument in the same way as
8719 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
8720 name is now chosen in a way that is hard to predict even when previously
8721 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
8722 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
8723 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
8724 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
8725 was simply substituted with a file name chosen once per compilation,
8726 without regard to any appended suffix (which was therefore treated
8727 just like ordinary text), making such attacks more likely to succeed.
8729 @item %u@var{suffix}
8730 Like @samp{%g}, but generates a new temporary file name even if
8731 @samp{%u@var{suffix}} was already seen.
8733 @item %U@var{suffix}
8734 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
8735 new one if there is no such last file name. In the absence of any
8736 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
8737 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
8738 would involve the generation of two distinct file names, one
8739 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
8740 simply substituted with a file name chosen for the previous @samp{%u},
8741 without regard to any appended suffix.
8743 @item %j@var{suffix}
8744 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
8745 writable, and if save-temps is off; otherwise, substitute the name
8746 of a temporary file, just like @samp{%u}. This temporary file is not
8747 meant for communication between processes, but rather as a junk
8750 @item %|@var{suffix}
8751 @itemx %m@var{suffix}
8752 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
8753 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
8754 all. These are the two most common ways to instruct a program that it
8755 should read from standard input or write to standard output. If you
8756 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
8757 construct: see for example @file{f/lang-specs.h}.
8759 @item %.@var{SUFFIX}
8760 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
8761 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
8762 terminated by the next space or %.
8765 Marks the argument containing or following the @samp{%w} as the
8766 designated output file of this compilation. This puts the argument
8767 into the sequence of arguments that @samp{%o} will substitute later.
8770 Substitutes the names of all the output files, with spaces
8771 automatically placed around them. You should write spaces
8772 around the @samp{%o} as well or the results are undefined.
8773 @samp{%o} is for use in the specs for running the linker.
8774 Input files whose names have no recognized suffix are not compiled
8775 at all, but they are included among the output files, so they will
8779 Substitutes the suffix for object files. Note that this is
8780 handled specially when it immediately follows @samp{%g, %u, or %U},
8781 because of the need for those to form complete file names. The
8782 handling is such that @samp{%O} is treated exactly as if it had already
8783 been substituted, except that @samp{%g, %u, and %U} do not currently
8784 support additional @var{suffix} characters following @samp{%O} as they would
8785 following, for example, @samp{.o}.
8788 Substitutes the standard macro predefinitions for the
8789 current target machine. Use this when running @code{cpp}.
8792 Like @samp{%p}, but puts @samp{__} before and after the name of each
8793 predefined macro, except for macros that start with @samp{__} or with
8794 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
8798 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
8799 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
8800 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
8801 and @option{-imultilib} as necessary.
8804 Current argument is the name of a library or startup file of some sort.
8805 Search for that file in a standard list of directories and substitute
8806 the full name found.
8809 Print @var{str} as an error message. @var{str} is terminated by a newline.
8810 Use this when inconsistent options are detected.
8813 Substitute the contents of spec string @var{name} at this point.
8816 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
8818 @item %x@{@var{option}@}
8819 Accumulate an option for @samp{%X}.
8822 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
8826 Output the accumulated assembler options specified by @option{-Wa}.
8829 Output the accumulated preprocessor options specified by @option{-Wp}.
8832 Process the @code{asm} spec. This is used to compute the
8833 switches to be passed to the assembler.
8836 Process the @code{asm_final} spec. This is a spec string for
8837 passing switches to an assembler post-processor, if such a program is
8841 Process the @code{link} spec. This is the spec for computing the
8842 command line passed to the linker. Typically it will make use of the
8843 @samp{%L %G %S %D and %E} sequences.
8846 Dump out a @option{-L} option for each directory that GCC believes might
8847 contain startup files. If the target supports multilibs then the
8848 current multilib directory will be prepended to each of these paths.
8851 Process the @code{lib} spec. This is a spec string for deciding which
8852 libraries should be included on the command line to the linker.
8855 Process the @code{libgcc} spec. This is a spec string for deciding
8856 which GCC support library should be included on the command line to the linker.
8859 Process the @code{startfile} spec. This is a spec for deciding which
8860 object files should be the first ones passed to the linker. Typically
8861 this might be a file named @file{crt0.o}.
8864 Process the @code{endfile} spec. This is a spec string that specifies
8865 the last object files that will be passed to the linker.
8868 Process the @code{cpp} spec. This is used to construct the arguments
8869 to be passed to the C preprocessor.
8872 Process the @code{cc1} spec. This is used to construct the options to be
8873 passed to the actual C compiler (@samp{cc1}).
8876 Process the @code{cc1plus} spec. This is used to construct the options to be
8877 passed to the actual C++ compiler (@samp{cc1plus}).
8880 Substitute the variable part of a matched option. See below.
8881 Note that each comma in the substituted string is replaced by
8885 Remove all occurrences of @code{-S} from the command line. Note---this
8886 command is position dependent. @samp{%} commands in the spec string
8887 before this one will see @code{-S}, @samp{%} commands in the spec string
8888 after this one will not.
8890 @item %:@var{function}(@var{args})
8891 Call the named function @var{function}, passing it @var{args}.
8892 @var{args} is first processed as a nested spec string, then split
8893 into an argument vector in the usual fashion. The function returns
8894 a string which is processed as if it had appeared literally as part
8895 of the current spec.
8897 The following built-in spec functions are provided:
8901 The @code{getenv} spec function takes two arguments: an environment
8902 variable name and a string. If the environment variable is not
8903 defined, a fatal error is issued. Otherwise, the return value is the
8904 value of the environment variable concatenated with the string. For
8905 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
8908 %:getenv(TOPDIR /include)
8911 expands to @file{/path/to/top/include}.
8913 @item @code{if-exists}
8914 The @code{if-exists} spec function takes one argument, an absolute
8915 pathname to a file. If the file exists, @code{if-exists} returns the
8916 pathname. Here is a small example of its usage:
8920 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
8923 @item @code{if-exists-else}
8924 The @code{if-exists-else} spec function is similar to the @code{if-exists}
8925 spec function, except that it takes two arguments. The first argument is
8926 an absolute pathname to a file. If the file exists, @code{if-exists-else}
8927 returns the pathname. If it does not exist, it returns the second argument.
8928 This way, @code{if-exists-else} can be used to select one file or another,
8929 based on the existence of the first. Here is a small example of its usage:
8933 crt0%O%s %:if-exists(crti%O%s) \
8934 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
8937 @item @code{replace-outfile}
8938 The @code{replace-outfile} spec function takes two arguments. It looks for the
8939 first argument in the outfiles array and replaces it with the second argument. Here
8940 is a small example of its usage:
8943 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
8946 @item @code{print-asm-header}
8947 The @code{print-asm-header} function takes no arguments and simply
8948 prints a banner like:
8954 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
8957 It is used to separate compiler options from assembler options
8958 in the @option{--target-help} output.
8962 Substitutes the @code{-S} switch, if that switch was given to GCC@.
8963 If that switch was not specified, this substitutes nothing. Note that
8964 the leading dash is omitted when specifying this option, and it is
8965 automatically inserted if the substitution is performed. Thus the spec
8966 string @samp{%@{foo@}} would match the command-line option @option{-foo}
8967 and would output the command line option @option{-foo}.
8969 @item %W@{@code{S}@}
8970 Like %@{@code{S}@} but mark last argument supplied within as a file to be
8973 @item %@{@code{S}*@}
8974 Substitutes all the switches specified to GCC whose names start
8975 with @code{-S}, but which also take an argument. This is used for
8976 switches like @option{-o}, @option{-D}, @option{-I}, etc.
8977 GCC considers @option{-o foo} as being
8978 one switch whose names starts with @samp{o}. %@{o*@} would substitute this
8979 text, including the space. Thus two arguments would be generated.
8981 @item %@{@code{S}*&@code{T}*@}
8982 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
8983 (the order of @code{S} and @code{T} in the spec is not significant).
8984 There can be any number of ampersand-separated variables; for each the
8985 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
8987 @item %@{@code{S}:@code{X}@}
8988 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
8990 @item %@{!@code{S}:@code{X}@}
8991 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
8993 @item %@{@code{S}*:@code{X}@}
8994 Substitutes @code{X} if one or more switches whose names start with
8995 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
8996 once, no matter how many such switches appeared. However, if @code{%*}
8997 appears somewhere in @code{X}, then @code{X} will be substituted once
8998 for each matching switch, with the @code{%*} replaced by the part of
8999 that switch that matched the @code{*}.
9001 @item %@{.@code{S}:@code{X}@}
9002 Substitutes @code{X}, if processing a file with suffix @code{S}.
9004 @item %@{!.@code{S}:@code{X}@}
9005 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
9007 @item %@{,@code{S}:@code{X}@}
9008 Substitutes @code{X}, if processing a file for language @code{S}.
9010 @item %@{!,@code{S}:@code{X}@}
9011 Substitutes @code{X}, if not processing a file for language @code{S}.
9013 @item %@{@code{S}|@code{P}:@code{X}@}
9014 Substitutes @code{X} if either @code{-S} or @code{-P} was given to
9015 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
9016 @code{*} sequences as well, although they have a stronger binding than
9017 the @samp{|}. If @code{%*} appears in @code{X}, all of the
9018 alternatives must be starred, and only the first matching alternative
9021 For example, a spec string like this:
9024 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
9027 will output the following command-line options from the following input
9028 command-line options:
9033 -d fred.c -foo -baz -boggle
9034 -d jim.d -bar -baz -boggle
9037 @item %@{S:X; T:Y; :D@}
9039 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
9040 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
9041 be as many clauses as you need. This may be combined with @code{.},
9042 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
9047 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
9048 construct may contain other nested @samp{%} constructs or spaces, or
9049 even newlines. They are processed as usual, as described above.
9050 Trailing white space in @code{X} is ignored. White space may also
9051 appear anywhere on the left side of the colon in these constructs,
9052 except between @code{.} or @code{*} and the corresponding word.
9054 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
9055 handled specifically in these constructs. If another value of
9056 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
9057 @option{-W} switch is found later in the command line, the earlier
9058 switch value is ignored, except with @{@code{S}*@} where @code{S} is
9059 just one letter, which passes all matching options.
9061 The character @samp{|} at the beginning of the predicate text is used to
9062 indicate that a command should be piped to the following command, but
9063 only if @option{-pipe} is specified.
9065 It is built into GCC which switches take arguments and which do not.
9066 (You might think it would be useful to generalize this to allow each
9067 compiler's spec to say which switches take arguments. But this cannot
9068 be done in a consistent fashion. GCC cannot even decide which input
9069 files have been specified without knowing which switches take arguments,
9070 and it must know which input files to compile in order to tell which
9073 GCC also knows implicitly that arguments starting in @option{-l} are to be
9074 treated as compiler output files, and passed to the linker in their
9075 proper position among the other output files.
9077 @c man begin OPTIONS
9079 @node Target Options
9080 @section Specifying Target Machine and Compiler Version
9081 @cindex target options
9082 @cindex cross compiling
9083 @cindex specifying machine version
9084 @cindex specifying compiler version and target machine
9085 @cindex compiler version, specifying
9086 @cindex target machine, specifying
9088 The usual way to run GCC is to run the executable called @file{gcc}, or
9089 @file{<machine>-gcc} when cross-compiling, or
9090 @file{<machine>-gcc-<version>} to run a version other than the one that
9091 was installed last. Sometimes this is inconvenient, so GCC provides
9092 options that will switch to another cross-compiler or version.
9095 @item -b @var{machine}
9097 The argument @var{machine} specifies the target machine for compilation.
9099 The value to use for @var{machine} is the same as was specified as the
9100 machine type when configuring GCC as a cross-compiler. For
9101 example, if a cross-compiler was configured with @samp{configure
9102 arm-elf}, meaning to compile for an arm processor with elf binaries,
9103 then you would specify @option{-b arm-elf} to run that cross compiler.
9104 Because there are other options beginning with @option{-b}, the
9105 configuration must contain a hyphen, or @option{-b} alone should be one
9106 argument followed by the configuration in the next argument.
9108 @item -V @var{version}
9110 The argument @var{version} specifies which version of GCC to run.
9111 This is useful when multiple versions are installed. For example,
9112 @var{version} might be @samp{4.0}, meaning to run GCC version 4.0.
9115 The @option{-V} and @option{-b} options work by running the
9116 @file{<machine>-gcc-<version>} executable, so there's no real reason to
9117 use them if you can just run that directly.
9119 @node Submodel Options
9120 @section Hardware Models and Configurations
9121 @cindex submodel options
9122 @cindex specifying hardware config
9123 @cindex hardware models and configurations, specifying
9124 @cindex machine dependent options
9126 Earlier we discussed the standard option @option{-b} which chooses among
9127 different installed compilers for completely different target
9128 machines, such as VAX vs.@: 68000 vs.@: 80386.
9130 In addition, each of these target machine types can have its own
9131 special options, starting with @samp{-m}, to choose among various
9132 hardware models or configurations---for example, 68010 vs 68020,
9133 floating coprocessor or none. A single installed version of the
9134 compiler can compile for any model or configuration, according to the
9137 Some configurations of the compiler also support additional special
9138 options, usually for compatibility with other compilers on the same
9141 @c This list is ordered alphanumerically by subsection name.
9142 @c It should be the same order and spelling as these options are listed
9143 @c in Machine Dependent Options
9149 * Blackfin Options::
9153 * DEC Alpha Options::
9154 * DEC Alpha/VMS Options::
9157 * GNU/Linux Options::
9160 * i386 and x86-64 Options::
9161 * i386 and x86-64 Windows Options::
9173 * picoChip Options::
9175 * RS/6000 and PowerPC Options::
9176 * S/390 and zSeries Options::
9181 * System V Options::
9186 * Xstormy16 Options::
9192 @subsection ARC Options
9195 These options are defined for ARC implementations:
9200 Compile code for little endian mode. This is the default.
9204 Compile code for big endian mode.
9207 @opindex mmangle-cpu
9208 Prepend the name of the cpu to all public symbol names.
9209 In multiple-processor systems, there are many ARC variants with different
9210 instruction and register set characteristics. This flag prevents code
9211 compiled for one cpu to be linked with code compiled for another.
9212 No facility exists for handling variants that are ``almost identical''.
9213 This is an all or nothing option.
9215 @item -mcpu=@var{cpu}
9217 Compile code for ARC variant @var{cpu}.
9218 Which variants are supported depend on the configuration.
9219 All variants support @option{-mcpu=base}, this is the default.
9221 @item -mtext=@var{text-section}
9222 @itemx -mdata=@var{data-section}
9223 @itemx -mrodata=@var{readonly-data-section}
9227 Put functions, data, and readonly data in @var{text-section},
9228 @var{data-section}, and @var{readonly-data-section} respectively
9229 by default. This can be overridden with the @code{section} attribute.
9230 @xref{Variable Attributes}.
9232 @item -mfix-cortex-m3-ldrd
9233 @opindex mfix-cortex-m3-ldrd
9234 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
9235 with overlapping destination and base registers are used. This option avoids
9236 generating these instructions. This option is enabled by default when
9237 @option{-mcpu=cortex-m3} is specified.
9242 @subsection ARM Options
9245 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
9249 @item -mabi=@var{name}
9251 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
9252 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
9255 @opindex mapcs-frame
9256 Generate a stack frame that is compliant with the ARM Procedure Call
9257 Standard for all functions, even if this is not strictly necessary for
9258 correct execution of the code. Specifying @option{-fomit-frame-pointer}
9259 with this option will cause the stack frames not to be generated for
9260 leaf functions. The default is @option{-mno-apcs-frame}.
9264 This is a synonym for @option{-mapcs-frame}.
9267 @c not currently implemented
9268 @item -mapcs-stack-check
9269 @opindex mapcs-stack-check
9270 Generate code to check the amount of stack space available upon entry to
9271 every function (that actually uses some stack space). If there is
9272 insufficient space available then either the function
9273 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
9274 called, depending upon the amount of stack space required. The run time
9275 system is required to provide these functions. The default is
9276 @option{-mno-apcs-stack-check}, since this produces smaller code.
9278 @c not currently implemented
9280 @opindex mapcs-float
9281 Pass floating point arguments using the float point registers. This is
9282 one of the variants of the APCS@. This option is recommended if the
9283 target hardware has a floating point unit or if a lot of floating point
9284 arithmetic is going to be performed by the code. The default is
9285 @option{-mno-apcs-float}, since integer only code is slightly increased in
9286 size if @option{-mapcs-float} is used.
9288 @c not currently implemented
9289 @item -mapcs-reentrant
9290 @opindex mapcs-reentrant
9291 Generate reentrant, position independent code. The default is
9292 @option{-mno-apcs-reentrant}.
9295 @item -mthumb-interwork
9296 @opindex mthumb-interwork
9297 Generate code which supports calling between the ARM and Thumb
9298 instruction sets. Without this option the two instruction sets cannot
9299 be reliably used inside one program. The default is
9300 @option{-mno-thumb-interwork}, since slightly larger code is generated
9301 when @option{-mthumb-interwork} is specified.
9303 @item -mno-sched-prolog
9304 @opindex mno-sched-prolog
9305 Prevent the reordering of instructions in the function prolog, or the
9306 merging of those instruction with the instructions in the function's
9307 body. This means that all functions will start with a recognizable set
9308 of instructions (or in fact one of a choice from a small set of
9309 different function prologues), and this information can be used to
9310 locate the start if functions inside an executable piece of code. The
9311 default is @option{-msched-prolog}.
9313 @item -mfloat-abi=@var{name}
9315 Specifies which floating-point ABI to use. Permissible values
9316 are: @samp{soft}, @samp{softfp} and @samp{hard}.
9318 Specifying @samp{soft} causes GCC to generate output containing
9319 library calls for floating-point operations.
9320 @samp{softfp} allows the generation of code using hardware floating-point
9321 instructions, but still uses the soft-float calling conventions.
9322 @samp{hard} allows generation of floating-point instructions
9323 and uses FPU-specific calling conventions.
9325 The default depends on the specific target configuration. Note that
9326 the hard-float and soft-float ABIs are not link-compatible; you must
9327 compile your entire program with the same ABI, and link with a
9328 compatible set of libraries.
9331 @opindex mhard-float
9332 Equivalent to @option{-mfloat-abi=hard}.
9335 @opindex msoft-float
9336 Equivalent to @option{-mfloat-abi=soft}.
9338 @item -mlittle-endian
9339 @opindex mlittle-endian
9340 Generate code for a processor running in little-endian mode. This is
9341 the default for all standard configurations.
9344 @opindex mbig-endian
9345 Generate code for a processor running in big-endian mode; the default is
9346 to compile code for a little-endian processor.
9348 @item -mwords-little-endian
9349 @opindex mwords-little-endian
9350 This option only applies when generating code for big-endian processors.
9351 Generate code for a little-endian word order but a big-endian byte
9352 order. That is, a byte order of the form @samp{32107654}. Note: this
9353 option should only be used if you require compatibility with code for
9354 big-endian ARM processors generated by versions of the compiler prior to
9357 @item -mcpu=@var{name}
9359 This specifies the name of the target ARM processor. GCC uses this name
9360 to determine what kind of instructions it can emit when generating
9361 assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
9362 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
9363 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
9364 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
9365 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
9367 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
9368 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
9369 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
9370 @samp{strongarm1110},
9371 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
9372 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
9373 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
9374 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
9375 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
9376 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
9377 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
9378 @samp{cortex-a8}, @samp{cortex-a9},
9379 @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m3},
9382 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
9384 @item -mtune=@var{name}
9386 This option is very similar to the @option{-mcpu=} option, except that
9387 instead of specifying the actual target processor type, and hence
9388 restricting which instructions can be used, it specifies that GCC should
9389 tune the performance of the code as if the target were of the type
9390 specified in this option, but still choosing the instructions that it
9391 will generate based on the cpu specified by a @option{-mcpu=} option.
9392 For some ARM implementations better performance can be obtained by using
9395 @item -march=@var{name}
9397 This specifies the name of the target ARM architecture. GCC uses this
9398 name to determine what kind of instructions it can emit when generating
9399 assembly code. This option can be used in conjunction with or instead
9400 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
9401 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
9402 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
9403 @samp{armv6}, @samp{armv6j},
9404 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
9405 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
9406 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
9408 @item -mfpu=@var{name}
9409 @itemx -mfpe=@var{number}
9410 @itemx -mfp=@var{number}
9414 This specifies what floating point hardware (or hardware emulation) is
9415 available on the target. Permissible names are: @samp{fpa}, @samp{fpe2},
9416 @samp{fpe3}, @samp{maverick}, @samp{vfp}, @samp{vfpv3}, @samp{vfpv3-d16},
9417 @samp{neon}, and @samp{neon-fp16}. @option{-mfp} and @option{-mfpe}
9418 are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
9419 with older versions of GCC@.
9421 If @option{-msoft-float} is specified this specifies the format of
9422 floating point values.
9424 @item -mfp16-format=@var{name}
9425 @opindex mfp16-format
9426 Specify the format of the @code{__fp16} half-precision floating-point type.
9427 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
9428 the default is @samp{none}, in which case the @code{__fp16} type is not
9429 defined. @xref{Half-Precision}, for more information.
9431 @item -mstructure-size-boundary=@var{n}
9432 @opindex mstructure-size-boundary
9433 The size of all structures and unions will be rounded up to a multiple
9434 of the number of bits set by this option. Permissible values are 8, 32
9435 and 64. The default value varies for different toolchains. For the COFF
9436 targeted toolchain the default value is 8. A value of 64 is only allowed
9437 if the underlying ABI supports it.
9439 Specifying the larger number can produce faster, more efficient code, but
9440 can also increase the size of the program. Different values are potentially
9441 incompatible. Code compiled with one value cannot necessarily expect to
9442 work with code or libraries compiled with another value, if they exchange
9443 information using structures or unions.
9445 @item -mabort-on-noreturn
9446 @opindex mabort-on-noreturn
9447 Generate a call to the function @code{abort} at the end of a
9448 @code{noreturn} function. It will be executed if the function tries to
9452 @itemx -mno-long-calls
9453 @opindex mlong-calls
9454 @opindex mno-long-calls
9455 Tells the compiler to perform function calls by first loading the
9456 address of the function into a register and then performing a subroutine
9457 call on this register. This switch is needed if the target function
9458 will lie outside of the 64 megabyte addressing range of the offset based
9459 version of subroutine call instruction.
9461 Even if this switch is enabled, not all function calls will be turned
9462 into long calls. The heuristic is that static functions, functions
9463 which have the @samp{short-call} attribute, functions that are inside
9464 the scope of a @samp{#pragma no_long_calls} directive and functions whose
9465 definitions have already been compiled within the current compilation
9466 unit, will not be turned into long calls. The exception to this rule is
9467 that weak function definitions, functions with the @samp{long-call}
9468 attribute or the @samp{section} attribute, and functions that are within
9469 the scope of a @samp{#pragma long_calls} directive, will always be
9470 turned into long calls.
9472 This feature is not enabled by default. Specifying
9473 @option{-mno-long-calls} will restore the default behavior, as will
9474 placing the function calls within the scope of a @samp{#pragma
9475 long_calls_off} directive. Note these switches have no effect on how
9476 the compiler generates code to handle function calls via function
9479 @item -msingle-pic-base
9480 @opindex msingle-pic-base
9481 Treat the register used for PIC addressing as read-only, rather than
9482 loading it in the prologue for each function. The run-time system is
9483 responsible for initializing this register with an appropriate value
9484 before execution begins.
9486 @item -mpic-register=@var{reg}
9487 @opindex mpic-register
9488 Specify the register to be used for PIC addressing. The default is R10
9489 unless stack-checking is enabled, when R9 is used.
9491 @item -mcirrus-fix-invalid-insns
9492 @opindex mcirrus-fix-invalid-insns
9493 @opindex mno-cirrus-fix-invalid-insns
9494 Insert NOPs into the instruction stream to in order to work around
9495 problems with invalid Maverick instruction combinations. This option
9496 is only valid if the @option{-mcpu=ep9312} option has been used to
9497 enable generation of instructions for the Cirrus Maverick floating
9498 point co-processor. This option is not enabled by default, since the
9499 problem is only present in older Maverick implementations. The default
9500 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
9503 @item -mpoke-function-name
9504 @opindex mpoke-function-name
9505 Write the name of each function into the text section, directly
9506 preceding the function prologue. The generated code is similar to this:
9510 .ascii "arm_poke_function_name", 0
9513 .word 0xff000000 + (t1 - t0)
9514 arm_poke_function_name
9516 stmfd sp!, @{fp, ip, lr, pc@}
9520 When performing a stack backtrace, code can inspect the value of
9521 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
9522 location @code{pc - 12} and the top 8 bits are set, then we know that
9523 there is a function name embedded immediately preceding this location
9524 and has length @code{((pc[-3]) & 0xff000000)}.
9528 Generate code for the Thumb instruction set. The default is to
9529 use the 32-bit ARM instruction set.
9530 This option automatically enables either 16-bit Thumb-1 or
9531 mixed 16/32-bit Thumb-2 instructions based on the @option{-mcpu=@var{name}}
9532 and @option{-march=@var{name}} options. This option is not passed to the
9533 assembler. If you want to force assembler files to be interpreted as Thumb code,
9534 either add a @samp{.thumb} directive to the source or pass the @option{-mthumb}
9535 option directly to the assembler by prefixing it with @option{-Wa}.
9538 @opindex mtpcs-frame
9539 Generate a stack frame that is compliant with the Thumb Procedure Call
9540 Standard for all non-leaf functions. (A leaf function is one that does
9541 not call any other functions.) The default is @option{-mno-tpcs-frame}.
9543 @item -mtpcs-leaf-frame
9544 @opindex mtpcs-leaf-frame
9545 Generate a stack frame that is compliant with the Thumb Procedure Call
9546 Standard for all leaf functions. (A leaf function is one that does
9547 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
9549 @item -mcallee-super-interworking
9550 @opindex mcallee-super-interworking
9551 Gives all externally visible functions in the file being compiled an ARM
9552 instruction set header which switches to Thumb mode before executing the
9553 rest of the function. This allows these functions to be called from
9554 non-interworking code. This option is not valid in AAPCS configurations
9555 because interworking is enabled by default.
9557 @item -mcaller-super-interworking
9558 @opindex mcaller-super-interworking
9559 Allows calls via function pointers (including virtual functions) to
9560 execute correctly regardless of whether the target code has been
9561 compiled for interworking or not. There is a small overhead in the cost
9562 of executing a function pointer if this option is enabled. This option
9563 is not valid in AAPCS configurations because interworking is enabled
9566 @item -mtp=@var{name}
9568 Specify the access model for the thread local storage pointer. The valid
9569 models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
9570 @option{cp15}, which fetches the thread pointer from @code{cp15} directly
9571 (supported in the arm6k architecture), and @option{auto}, which uses the
9572 best available method for the selected processor. The default setting is
9575 @item -mword-relocations
9576 @opindex mword-relocations
9577 Only generate absolute relocations on word sized values (i.e. R_ARM_ABS32).
9578 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
9579 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
9585 @subsection AVR Options
9588 These options are defined for AVR implementations:
9591 @item -mmcu=@var{mcu}
9593 Specify ATMEL AVR instruction set or MCU type.
9595 Instruction set avr1 is for the minimal AVR core, not supported by the C
9596 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
9597 attiny11, attiny12, attiny15, attiny28).
9599 Instruction set avr2 (default) is for the classic AVR core with up to
9600 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
9601 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
9602 at90c8534, at90s8535).
9604 Instruction set avr3 is for the classic AVR core with up to 128K program
9605 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
9607 Instruction set avr4 is for the enhanced AVR core with up to 8K program
9608 memory space (MCU types: atmega8, atmega83, atmega85).
9610 Instruction set avr5 is for the enhanced AVR core with up to 128K program
9611 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
9612 atmega64, atmega128, at43usb355, at94k).
9616 Output instruction sizes to the asm file.
9618 @item -minit-stack=@var{N}
9619 @opindex minit-stack
9620 Specify the initial stack address, which may be a symbol or numeric value,
9621 @samp{__stack} is the default.
9623 @item -mno-interrupts
9624 @opindex mno-interrupts
9625 Generated code is not compatible with hardware interrupts.
9626 Code size will be smaller.
9628 @item -mcall-prologues
9629 @opindex mcall-prologues
9630 Functions prologues/epilogues expanded as call to appropriate
9631 subroutines. Code size will be smaller.
9634 @opindex mtiny-stack
9635 Change only the low 8 bits of the stack pointer.
9639 Assume int to be 8 bit integer. This affects the sizes of all types: A
9640 char will be 1 byte, an int will be 1 byte, a long will be 2 bytes
9641 and long long will be 4 bytes. Please note that this option does not
9642 comply to the C standards, but it will provide you with smaller code
9646 @node Blackfin Options
9647 @subsection Blackfin Options
9648 @cindex Blackfin Options
9651 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
9653 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
9654 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
9655 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
9656 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
9657 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
9658 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
9660 The optional @var{sirevision} specifies the silicon revision of the target
9661 Blackfin processor. Any workarounds available for the targeted silicon revision
9662 will be enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
9663 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
9664 will be enabled. The @code{__SILICON_REVISION__} macro is defined to two
9665 hexadecimal digits representing the major and minor numbers in the silicon
9666 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
9667 is not defined. If @var{sirevision} is @samp{any}, the
9668 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
9669 If this optional @var{sirevision} is not used, GCC assumes the latest known
9670 silicon revision of the targeted Blackfin processor.
9672 Support for @samp{bf561} is incomplete. For @samp{bf561},
9673 Only the processor macro is defined.
9674 Without this option, @samp{bf532} is used as the processor by default.
9675 The corresponding predefined processor macros for @var{cpu} is to
9676 be defined. And for @samp{bfin-elf} toolchain, this causes the hardware BSP
9677 provided by libgloss to be linked in if @option{-msim} is not given.
9681 Specifies that the program will be run on the simulator. This causes
9682 the simulator BSP provided by libgloss to be linked in. This option
9683 has effect only for @samp{bfin-elf} toolchain.
9684 Certain other options, such as @option{-mid-shared-library} and
9685 @option{-mfdpic}, imply @option{-msim}.
9687 @item -momit-leaf-frame-pointer
9688 @opindex momit-leaf-frame-pointer
9689 Don't keep the frame pointer in a register for leaf functions. This
9690 avoids the instructions to save, set up and restore frame pointers and
9691 makes an extra register available in leaf functions. The option
9692 @option{-fomit-frame-pointer} removes the frame pointer for all functions
9693 which might make debugging harder.
9695 @item -mspecld-anomaly
9696 @opindex mspecld-anomaly
9697 When enabled, the compiler will ensure that the generated code does not
9698 contain speculative loads after jump instructions. If this option is used,
9699 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
9701 @item -mno-specld-anomaly
9702 @opindex mno-specld-anomaly
9703 Don't generate extra code to prevent speculative loads from occurring.
9705 @item -mcsync-anomaly
9706 @opindex mcsync-anomaly
9707 When enabled, the compiler will ensure that the generated code does not
9708 contain CSYNC or SSYNC instructions too soon after conditional branches.
9709 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
9711 @item -mno-csync-anomaly
9712 @opindex mno-csync-anomaly
9713 Don't generate extra code to prevent CSYNC or SSYNC instructions from
9714 occurring too soon after a conditional branch.
9718 When enabled, the compiler is free to take advantage of the knowledge that
9719 the entire program fits into the low 64k of memory.
9722 @opindex mno-low-64k
9723 Assume that the program is arbitrarily large. This is the default.
9725 @item -mstack-check-l1
9726 @opindex mstack-check-l1
9727 Do stack checking using information placed into L1 scratchpad memory by the
9730 @item -mid-shared-library
9731 @opindex mid-shared-library
9732 Generate code that supports shared libraries via the library ID method.
9733 This allows for execute in place and shared libraries in an environment
9734 without virtual memory management. This option implies @option{-fPIC}.
9735 With a @samp{bfin-elf} target, this option implies @option{-msim}.
9737 @item -mno-id-shared-library
9738 @opindex mno-id-shared-library
9739 Generate code that doesn't assume ID based shared libraries are being used.
9740 This is the default.
9742 @item -mleaf-id-shared-library
9743 @opindex mleaf-id-shared-library
9744 Generate code that supports shared libraries via the library ID method,
9745 but assumes that this library or executable won't link against any other
9746 ID shared libraries. That allows the compiler to use faster code for jumps
9749 @item -mno-leaf-id-shared-library
9750 @opindex mno-leaf-id-shared-library
9751 Do not assume that the code being compiled won't link against any ID shared
9752 libraries. Slower code will be generated for jump and call insns.
9754 @item -mshared-library-id=n
9755 @opindex mshared-library-id
9756 Specified the identification number of the ID based shared library being
9757 compiled. Specifying a value of 0 will generate more compact code, specifying
9758 other values will force the allocation of that number to the current
9759 library but is no more space or time efficient than omitting this option.
9763 Generate code that allows the data segment to be located in a different
9764 area of memory from the text segment. This allows for execute in place in
9765 an environment without virtual memory management by eliminating relocations
9766 against the text section.
9769 @opindex mno-sep-data
9770 Generate code that assumes that the data segment follows the text segment.
9771 This is the default.
9774 @itemx -mno-long-calls
9775 @opindex mlong-calls
9776 @opindex mno-long-calls
9777 Tells the compiler to perform function calls by first loading the
9778 address of the function into a register and then performing a subroutine
9779 call on this register. This switch is needed if the target function
9780 will lie outside of the 24 bit addressing range of the offset based
9781 version of subroutine call instruction.
9783 This feature is not enabled by default. Specifying
9784 @option{-mno-long-calls} will restore the default behavior. Note these
9785 switches have no effect on how the compiler generates code to handle
9786 function calls via function pointers.
9790 Link with the fast floating-point library. This library relaxes some of
9791 the IEEE floating-point standard's rules for checking inputs against
9792 Not-a-Number (NAN), in the interest of performance.
9795 @opindex minline-plt
9796 Enable inlining of PLT entries in function calls to functions that are
9797 not known to bind locally. It has no effect without @option{-mfdpic}.
9801 Build standalone application for multicore Blackfin processor. Proper
9802 start files and link scripts will be used to support multicore.
9803 This option defines @code{__BFIN_MULTICORE}. It can only be used with
9804 @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. It can be used with
9805 @option{-mcorea} or @option{-mcoreb}. If it's used without
9806 @option{-mcorea} or @option{-mcoreb}, single application/dual core
9807 programming model is used. In this model, the main function of Core B
9808 should be named as coreb_main. If it's used with @option{-mcorea} or
9809 @option{-mcoreb}, one application per core programming model is used.
9810 If this option is not used, single core application programming
9815 Build standalone application for Core A of BF561 when using
9816 one application per core programming model. Proper start files
9817 and link scripts will be used to support Core A. This option
9818 defines @code{__BFIN_COREA}. It must be used with @option{-mmulticore}.
9822 Build standalone application for Core B of BF561 when using
9823 one application per core programming model. Proper start files
9824 and link scripts will be used to support Core B. This option
9825 defines @code{__BFIN_COREB}. When this option is used, coreb_main
9826 should be used instead of main. It must be used with
9827 @option{-mmulticore}.
9831 Build standalone application for SDRAM. Proper start files and
9832 link scripts will be used to put the application into SDRAM.
9833 Loader should initialize SDRAM before loading the application
9834 into SDRAM. This option defines @code{__BFIN_SDRAM}.
9838 Assume that ICPLBs are enabled at runtime. This has an effect on certain
9839 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
9840 are enabled; for standalone applications the default is off.
9844 @subsection CRIS Options
9845 @cindex CRIS Options
9847 These options are defined specifically for the CRIS ports.
9850 @item -march=@var{architecture-type}
9851 @itemx -mcpu=@var{architecture-type}
9854 Generate code for the specified architecture. The choices for
9855 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
9856 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
9857 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
9860 @item -mtune=@var{architecture-type}
9862 Tune to @var{architecture-type} everything applicable about the generated
9863 code, except for the ABI and the set of available instructions. The
9864 choices for @var{architecture-type} are the same as for
9865 @option{-march=@var{architecture-type}}.
9867 @item -mmax-stack-frame=@var{n}
9868 @opindex mmax-stack-frame
9869 Warn when the stack frame of a function exceeds @var{n} bytes.
9875 The options @option{-metrax4} and @option{-metrax100} are synonyms for
9876 @option{-march=v3} and @option{-march=v8} respectively.
9878 @item -mmul-bug-workaround
9879 @itemx -mno-mul-bug-workaround
9880 @opindex mmul-bug-workaround
9881 @opindex mno-mul-bug-workaround
9882 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
9883 models where it applies. This option is active by default.
9887 Enable CRIS-specific verbose debug-related information in the assembly
9888 code. This option also has the effect to turn off the @samp{#NO_APP}
9889 formatted-code indicator to the assembler at the beginning of the
9894 Do not use condition-code results from previous instruction; always emit
9895 compare and test instructions before use of condition codes.
9897 @item -mno-side-effects
9898 @opindex mno-side-effects
9899 Do not emit instructions with side-effects in addressing modes other than
9903 @itemx -mno-stack-align
9905 @itemx -mno-data-align
9906 @itemx -mconst-align
9907 @itemx -mno-const-align
9908 @opindex mstack-align
9909 @opindex mno-stack-align
9910 @opindex mdata-align
9911 @opindex mno-data-align
9912 @opindex mconst-align
9913 @opindex mno-const-align
9914 These options (no-options) arranges (eliminate arrangements) for the
9915 stack-frame, individual data and constants to be aligned for the maximum
9916 single data access size for the chosen CPU model. The default is to
9917 arrange for 32-bit alignment. ABI details such as structure layout are
9918 not affected by these options.
9926 Similar to the stack- data- and const-align options above, these options
9927 arrange for stack-frame, writable data and constants to all be 32-bit,
9928 16-bit or 8-bit aligned. The default is 32-bit alignment.
9930 @item -mno-prologue-epilogue
9931 @itemx -mprologue-epilogue
9932 @opindex mno-prologue-epilogue
9933 @opindex mprologue-epilogue
9934 With @option{-mno-prologue-epilogue}, the normal function prologue and
9935 epilogue that sets up the stack-frame are omitted and no return
9936 instructions or return sequences are generated in the code. Use this
9937 option only together with visual inspection of the compiled code: no
9938 warnings or errors are generated when call-saved registers must be saved,
9939 or storage for local variable needs to be allocated.
9945 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
9946 instruction sequences that load addresses for functions from the PLT part
9947 of the GOT rather than (traditional on other architectures) calls to the
9948 PLT@. The default is @option{-mgotplt}.
9952 Legacy no-op option only recognized with the cris-axis-elf and
9953 cris-axis-linux-gnu targets.
9957 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
9961 This option, recognized for the cris-axis-elf arranges
9962 to link with input-output functions from a simulator library. Code,
9963 initialized data and zero-initialized data are allocated consecutively.
9967 Like @option{-sim}, but pass linker options to locate initialized data at
9968 0x40000000 and zero-initialized data at 0x80000000.
9972 @subsection CRX Options
9975 These options are defined specifically for the CRX ports.
9981 Enable the use of multiply-accumulate instructions. Disabled by default.
9985 Push instructions will be used to pass outgoing arguments when functions
9986 are called. Enabled by default.
9989 @node Darwin Options
9990 @subsection Darwin Options
9991 @cindex Darwin options
9993 These options are defined for all architectures running the Darwin operating
9996 FSF GCC on Darwin does not create ``fat'' object files; it will create
9997 an object file for the single architecture that it was built to
9998 target. Apple's GCC on Darwin does create ``fat'' files if multiple
9999 @option{-arch} options are used; it does so by running the compiler or
10000 linker multiple times and joining the results together with
10003 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
10004 @samp{i686}) is determined by the flags that specify the ISA
10005 that GCC is targetting, like @option{-mcpu} or @option{-march}. The
10006 @option{-force_cpusubtype_ALL} option can be used to override this.
10008 The Darwin tools vary in their behavior when presented with an ISA
10009 mismatch. The assembler, @file{as}, will only permit instructions to
10010 be used that are valid for the subtype of the file it is generating,
10011 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
10012 The linker for shared libraries, @file{/usr/bin/libtool}, will fail
10013 and print an error if asked to create a shared library with a less
10014 restrictive subtype than its input files (for instance, trying to put
10015 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
10016 for executables, @file{ld}, will quietly give the executable the most
10017 restrictive subtype of any of its input files.
10022 Add the framework directory @var{dir} to the head of the list of
10023 directories to be searched for header files. These directories are
10024 interleaved with those specified by @option{-I} options and are
10025 scanned in a left-to-right order.
10027 A framework directory is a directory with frameworks in it. A
10028 framework is a directory with a @samp{"Headers"} and/or
10029 @samp{"PrivateHeaders"} directory contained directly in it that ends
10030 in @samp{".framework"}. The name of a framework is the name of this
10031 directory excluding the @samp{".framework"}. Headers associated with
10032 the framework are found in one of those two directories, with
10033 @samp{"Headers"} being searched first. A subframework is a framework
10034 directory that is in a framework's @samp{"Frameworks"} directory.
10035 Includes of subframework headers can only appear in a header of a
10036 framework that contains the subframework, or in a sibling subframework
10037 header. Two subframeworks are siblings if they occur in the same
10038 framework. A subframework should not have the same name as a
10039 framework, a warning will be issued if this is violated. Currently a
10040 subframework cannot have subframeworks, in the future, the mechanism
10041 may be extended to support this. The standard frameworks can be found
10042 in @samp{"/System/Library/Frameworks"} and
10043 @samp{"/Library/Frameworks"}. An example include looks like
10044 @code{#include <Framework/header.h>}, where @samp{Framework} denotes
10045 the name of the framework and header.h is found in the
10046 @samp{"PrivateHeaders"} or @samp{"Headers"} directory.
10048 @item -iframework@var{dir}
10049 @opindex iframework
10050 Like @option{-F} except the directory is a treated as a system
10051 directory. The main difference between this @option{-iframework} and
10052 @option{-F} is that with @option{-iframework} the compiler does not
10053 warn about constructs contained within header files found via
10054 @var{dir}. This option is valid only for the C family of languages.
10058 Emit debugging information for symbols that are used. For STABS
10059 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
10060 This is by default ON@.
10064 Emit debugging information for all symbols and types.
10066 @item -mmacosx-version-min=@var{version}
10067 The earliest version of MacOS X that this executable will run on
10068 is @var{version}. Typical values of @var{version} include @code{10.1},
10069 @code{10.2}, and @code{10.3.9}.
10071 If the compiler was built to use the system's headers by default,
10072 then the default for this option is the system version on which the
10073 compiler is running, otherwise the default is to make choices which
10074 are compatible with as many systems and code bases as possible.
10078 Enable kernel development mode. The @option{-mkernel} option sets
10079 @option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
10080 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
10081 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
10082 applicable. This mode also sets @option{-mno-altivec},
10083 @option{-msoft-float}, @option{-fno-builtin} and
10084 @option{-mlong-branch} for PowerPC targets.
10086 @item -mone-byte-bool
10087 @opindex mone-byte-bool
10088 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
10089 By default @samp{sizeof(bool)} is @samp{4} when compiling for
10090 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
10091 option has no effect on x86.
10093 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
10094 to generate code that is not binary compatible with code generated
10095 without that switch. Using this switch may require recompiling all
10096 other modules in a program, including system libraries. Use this
10097 switch to conform to a non-default data model.
10099 @item -mfix-and-continue
10100 @itemx -ffix-and-continue
10101 @itemx -findirect-data
10102 @opindex mfix-and-continue
10103 @opindex ffix-and-continue
10104 @opindex findirect-data
10105 Generate code suitable for fast turn around development. Needed to
10106 enable gdb to dynamically load @code{.o} files into already running
10107 programs. @option{-findirect-data} and @option{-ffix-and-continue}
10108 are provided for backwards compatibility.
10112 Loads all members of static archive libraries.
10113 See man ld(1) for more information.
10115 @item -arch_errors_fatal
10116 @opindex arch_errors_fatal
10117 Cause the errors having to do with files that have the wrong architecture
10120 @item -bind_at_load
10121 @opindex bind_at_load
10122 Causes the output file to be marked such that the dynamic linker will
10123 bind all undefined references when the file is loaded or launched.
10127 Produce a Mach-o bundle format file.
10128 See man ld(1) for more information.
10130 @item -bundle_loader @var{executable}
10131 @opindex bundle_loader
10132 This option specifies the @var{executable} that will be loading the build
10133 output file being linked. See man ld(1) for more information.
10136 @opindex dynamiclib
10137 When passed this option, GCC will produce a dynamic library instead of
10138 an executable when linking, using the Darwin @file{libtool} command.
10140 @item -force_cpusubtype_ALL
10141 @opindex force_cpusubtype_ALL
10142 This causes GCC's output file to have the @var{ALL} subtype, instead of
10143 one controlled by the @option{-mcpu} or @option{-march} option.
10145 @item -allowable_client @var{client_name}
10146 @itemx -client_name
10147 @itemx -compatibility_version
10148 @itemx -current_version
10150 @itemx -dependency-file
10152 @itemx -dylinker_install_name
10154 @itemx -exported_symbols_list
10156 @itemx -flat_namespace
10157 @itemx -force_flat_namespace
10158 @itemx -headerpad_max_install_names
10161 @itemx -install_name
10162 @itemx -keep_private_externs
10163 @itemx -multi_module
10164 @itemx -multiply_defined
10165 @itemx -multiply_defined_unused
10167 @itemx -no_dead_strip_inits_and_terms
10168 @itemx -nofixprebinding
10169 @itemx -nomultidefs
10171 @itemx -noseglinkedit
10172 @itemx -pagezero_size
10174 @itemx -prebind_all_twolevel_modules
10175 @itemx -private_bundle
10176 @itemx -read_only_relocs
10178 @itemx -sectobjectsymbols
10182 @itemx -sectobjectsymbols
10185 @itemx -segs_read_only_addr
10186 @itemx -segs_read_write_addr
10187 @itemx -seg_addr_table
10188 @itemx -seg_addr_table_filename
10189 @itemx -seglinkedit
10191 @itemx -segs_read_only_addr
10192 @itemx -segs_read_write_addr
10193 @itemx -single_module
10195 @itemx -sub_library
10196 @itemx -sub_umbrella
10197 @itemx -twolevel_namespace
10200 @itemx -unexported_symbols_list
10201 @itemx -weak_reference_mismatches
10202 @itemx -whatsloaded
10203 @opindex allowable_client
10204 @opindex client_name
10205 @opindex compatibility_version
10206 @opindex current_version
10207 @opindex dead_strip
10208 @opindex dependency-file
10209 @opindex dylib_file
10210 @opindex dylinker_install_name
10212 @opindex exported_symbols_list
10214 @opindex flat_namespace
10215 @opindex force_flat_namespace
10216 @opindex headerpad_max_install_names
10217 @opindex image_base
10219 @opindex install_name
10220 @opindex keep_private_externs
10221 @opindex multi_module
10222 @opindex multiply_defined
10223 @opindex multiply_defined_unused
10224 @opindex noall_load
10225 @opindex no_dead_strip_inits_and_terms
10226 @opindex nofixprebinding
10227 @opindex nomultidefs
10229 @opindex noseglinkedit
10230 @opindex pagezero_size
10232 @opindex prebind_all_twolevel_modules
10233 @opindex private_bundle
10234 @opindex read_only_relocs
10236 @opindex sectobjectsymbols
10239 @opindex sectcreate
10240 @opindex sectobjectsymbols
10243 @opindex segs_read_only_addr
10244 @opindex segs_read_write_addr
10245 @opindex seg_addr_table
10246 @opindex seg_addr_table_filename
10247 @opindex seglinkedit
10249 @opindex segs_read_only_addr
10250 @opindex segs_read_write_addr
10251 @opindex single_module
10253 @opindex sub_library
10254 @opindex sub_umbrella
10255 @opindex twolevel_namespace
10258 @opindex unexported_symbols_list
10259 @opindex weak_reference_mismatches
10260 @opindex whatsloaded
10261 These options are passed to the Darwin linker. The Darwin linker man page
10262 describes them in detail.
10265 @node DEC Alpha Options
10266 @subsection DEC Alpha Options
10268 These @samp{-m} options are defined for the DEC Alpha implementations:
10271 @item -mno-soft-float
10272 @itemx -msoft-float
10273 @opindex mno-soft-float
10274 @opindex msoft-float
10275 Use (do not use) the hardware floating-point instructions for
10276 floating-point operations. When @option{-msoft-float} is specified,
10277 functions in @file{libgcc.a} will be used to perform floating-point
10278 operations. Unless they are replaced by routines that emulate the
10279 floating-point operations, or compiled in such a way as to call such
10280 emulations routines, these routines will issue floating-point
10281 operations. If you are compiling for an Alpha without floating-point
10282 operations, you must ensure that the library is built so as not to call
10285 Note that Alpha implementations without floating-point operations are
10286 required to have floating-point registers.
10289 @itemx -mno-fp-regs
10291 @opindex mno-fp-regs
10292 Generate code that uses (does not use) the floating-point register set.
10293 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
10294 register set is not used, floating point operands are passed in integer
10295 registers as if they were integers and floating-point results are passed
10296 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
10297 so any function with a floating-point argument or return value called by code
10298 compiled with @option{-mno-fp-regs} must also be compiled with that
10301 A typical use of this option is building a kernel that does not use,
10302 and hence need not save and restore, any floating-point registers.
10306 The Alpha architecture implements floating-point hardware optimized for
10307 maximum performance. It is mostly compliant with the IEEE floating
10308 point standard. However, for full compliance, software assistance is
10309 required. This option generates code fully IEEE compliant code
10310 @emph{except} that the @var{inexact-flag} is not maintained (see below).
10311 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
10312 defined during compilation. The resulting code is less efficient but is
10313 able to correctly support denormalized numbers and exceptional IEEE
10314 values such as not-a-number and plus/minus infinity. Other Alpha
10315 compilers call this option @option{-ieee_with_no_inexact}.
10317 @item -mieee-with-inexact
10318 @opindex mieee-with-inexact
10319 This is like @option{-mieee} except the generated code also maintains
10320 the IEEE @var{inexact-flag}. Turning on this option causes the
10321 generated code to implement fully-compliant IEEE math. In addition to
10322 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
10323 macro. On some Alpha implementations the resulting code may execute
10324 significantly slower than the code generated by default. Since there is
10325 very little code that depends on the @var{inexact-flag}, you should
10326 normally not specify this option. Other Alpha compilers call this
10327 option @option{-ieee_with_inexact}.
10329 @item -mfp-trap-mode=@var{trap-mode}
10330 @opindex mfp-trap-mode
10331 This option controls what floating-point related traps are enabled.
10332 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
10333 The trap mode can be set to one of four values:
10337 This is the default (normal) setting. The only traps that are enabled
10338 are the ones that cannot be disabled in software (e.g., division by zero
10342 In addition to the traps enabled by @samp{n}, underflow traps are enabled
10346 Like @samp{u}, but the instructions are marked to be safe for software
10347 completion (see Alpha architecture manual for details).
10350 Like @samp{su}, but inexact traps are enabled as well.
10353 @item -mfp-rounding-mode=@var{rounding-mode}
10354 @opindex mfp-rounding-mode
10355 Selects the IEEE rounding mode. Other Alpha compilers call this option
10356 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
10361 Normal IEEE rounding mode. Floating point numbers are rounded towards
10362 the nearest machine number or towards the even machine number in case
10366 Round towards minus infinity.
10369 Chopped rounding mode. Floating point numbers are rounded towards zero.
10372 Dynamic rounding mode. A field in the floating point control register
10373 (@var{fpcr}, see Alpha architecture reference manual) controls the
10374 rounding mode in effect. The C library initializes this register for
10375 rounding towards plus infinity. Thus, unless your program modifies the
10376 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
10379 @item -mtrap-precision=@var{trap-precision}
10380 @opindex mtrap-precision
10381 In the Alpha architecture, floating point traps are imprecise. This
10382 means without software assistance it is impossible to recover from a
10383 floating trap and program execution normally needs to be terminated.
10384 GCC can generate code that can assist operating system trap handlers
10385 in determining the exact location that caused a floating point trap.
10386 Depending on the requirements of an application, different levels of
10387 precisions can be selected:
10391 Program precision. This option is the default and means a trap handler
10392 can only identify which program caused a floating point exception.
10395 Function precision. The trap handler can determine the function that
10396 caused a floating point exception.
10399 Instruction precision. The trap handler can determine the exact
10400 instruction that caused a floating point exception.
10403 Other Alpha compilers provide the equivalent options called
10404 @option{-scope_safe} and @option{-resumption_safe}.
10406 @item -mieee-conformant
10407 @opindex mieee-conformant
10408 This option marks the generated code as IEEE conformant. You must not
10409 use this option unless you also specify @option{-mtrap-precision=i} and either
10410 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
10411 is to emit the line @samp{.eflag 48} in the function prologue of the
10412 generated assembly file. Under DEC Unix, this has the effect that
10413 IEEE-conformant math library routines will be linked in.
10415 @item -mbuild-constants
10416 @opindex mbuild-constants
10417 Normally GCC examines a 32- or 64-bit integer constant to
10418 see if it can construct it from smaller constants in two or three
10419 instructions. If it cannot, it will output the constant as a literal and
10420 generate code to load it from the data segment at runtime.
10422 Use this option to require GCC to construct @emph{all} integer constants
10423 using code, even if it takes more instructions (the maximum is six).
10425 You would typically use this option to build a shared library dynamic
10426 loader. Itself a shared library, it must relocate itself in memory
10427 before it can find the variables and constants in its own data segment.
10433 Select whether to generate code to be assembled by the vendor-supplied
10434 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
10452 Indicate whether GCC should generate code to use the optional BWX,
10453 CIX, FIX and MAX instruction sets. The default is to use the instruction
10454 sets supported by the CPU type specified via @option{-mcpu=} option or that
10455 of the CPU on which GCC was built if none was specified.
10458 @itemx -mfloat-ieee
10459 @opindex mfloat-vax
10460 @opindex mfloat-ieee
10461 Generate code that uses (does not use) VAX F and G floating point
10462 arithmetic instead of IEEE single and double precision.
10464 @item -mexplicit-relocs
10465 @itemx -mno-explicit-relocs
10466 @opindex mexplicit-relocs
10467 @opindex mno-explicit-relocs
10468 Older Alpha assemblers provided no way to generate symbol relocations
10469 except via assembler macros. Use of these macros does not allow
10470 optimal instruction scheduling. GNU binutils as of version 2.12
10471 supports a new syntax that allows the compiler to explicitly mark
10472 which relocations should apply to which instructions. This option
10473 is mostly useful for debugging, as GCC detects the capabilities of
10474 the assembler when it is built and sets the default accordingly.
10477 @itemx -mlarge-data
10478 @opindex msmall-data
10479 @opindex mlarge-data
10480 When @option{-mexplicit-relocs} is in effect, static data is
10481 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
10482 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
10483 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
10484 16-bit relocations off of the @code{$gp} register. This limits the
10485 size of the small data area to 64KB, but allows the variables to be
10486 directly accessed via a single instruction.
10488 The default is @option{-mlarge-data}. With this option the data area
10489 is limited to just below 2GB@. Programs that require more than 2GB of
10490 data must use @code{malloc} or @code{mmap} to allocate the data in the
10491 heap instead of in the program's data segment.
10493 When generating code for shared libraries, @option{-fpic} implies
10494 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
10497 @itemx -mlarge-text
10498 @opindex msmall-text
10499 @opindex mlarge-text
10500 When @option{-msmall-text} is used, the compiler assumes that the
10501 code of the entire program (or shared library) fits in 4MB, and is
10502 thus reachable with a branch instruction. When @option{-msmall-data}
10503 is used, the compiler can assume that all local symbols share the
10504 same @code{$gp} value, and thus reduce the number of instructions
10505 required for a function call from 4 to 1.
10507 The default is @option{-mlarge-text}.
10509 @item -mcpu=@var{cpu_type}
10511 Set the instruction set and instruction scheduling parameters for
10512 machine type @var{cpu_type}. You can specify either the @samp{EV}
10513 style name or the corresponding chip number. GCC supports scheduling
10514 parameters for the EV4, EV5 and EV6 family of processors and will
10515 choose the default values for the instruction set from the processor
10516 you specify. If you do not specify a processor type, GCC will default
10517 to the processor on which the compiler was built.
10519 Supported values for @var{cpu_type} are
10525 Schedules as an EV4 and has no instruction set extensions.
10529 Schedules as an EV5 and has no instruction set extensions.
10533 Schedules as an EV5 and supports the BWX extension.
10538 Schedules as an EV5 and supports the BWX and MAX extensions.
10542 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
10546 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
10549 Native Linux/GNU toolchains also support the value @samp{native},
10550 which selects the best architecture option for the host processor.
10551 @option{-mcpu=native} has no effect if GCC does not recognize
10554 @item -mtune=@var{cpu_type}
10556 Set only the instruction scheduling parameters for machine type
10557 @var{cpu_type}. The instruction set is not changed.
10559 Native Linux/GNU toolchains also support the value @samp{native},
10560 which selects the best architecture option for the host processor.
10561 @option{-mtune=native} has no effect if GCC does not recognize
10564 @item -mmemory-latency=@var{time}
10565 @opindex mmemory-latency
10566 Sets the latency the scheduler should assume for typical memory
10567 references as seen by the application. This number is highly
10568 dependent on the memory access patterns used by the application
10569 and the size of the external cache on the machine.
10571 Valid options for @var{time} are
10575 A decimal number representing clock cycles.
10581 The compiler contains estimates of the number of clock cycles for
10582 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
10583 (also called Dcache, Scache, and Bcache), as well as to main memory.
10584 Note that L3 is only valid for EV5.
10589 @node DEC Alpha/VMS Options
10590 @subsection DEC Alpha/VMS Options
10592 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
10595 @item -mvms-return-codes
10596 @opindex mvms-return-codes
10597 Return VMS condition codes from main. The default is to return POSIX
10598 style condition (e.g.@: error) codes.
10600 @item -mdebug-main=@var{prefix}
10601 @opindex mdebug-main=@var{prefix}
10602 Flag the first routine whose name starts with @var{prefix} as the main
10603 routine for the debugger.
10607 @subsection FR30 Options
10608 @cindex FR30 Options
10610 These options are defined specifically for the FR30 port.
10614 @item -msmall-model
10615 @opindex msmall-model
10616 Use the small address space model. This can produce smaller code, but
10617 it does assume that all symbolic values and addresses will fit into a
10622 Assume that run-time support has been provided and so there is no need
10623 to include the simulator library (@file{libsim.a}) on the linker
10629 @subsection FRV Options
10630 @cindex FRV Options
10636 Only use the first 32 general purpose registers.
10641 Use all 64 general purpose registers.
10646 Use only the first 32 floating point registers.
10651 Use all 64 floating point registers
10654 @opindex mhard-float
10656 Use hardware instructions for floating point operations.
10659 @opindex msoft-float
10661 Use library routines for floating point operations.
10666 Dynamically allocate condition code registers.
10671 Do not try to dynamically allocate condition code registers, only
10672 use @code{icc0} and @code{fcc0}.
10677 Change ABI to use double word insns.
10682 Do not use double word instructions.
10687 Use floating point double instructions.
10690 @opindex mno-double
10692 Do not use floating point double instructions.
10697 Use media instructions.
10702 Do not use media instructions.
10707 Use multiply and add/subtract instructions.
10710 @opindex mno-muladd
10712 Do not use multiply and add/subtract instructions.
10717 Select the FDPIC ABI, that uses function descriptors to represent
10718 pointers to functions. Without any PIC/PIE-related options, it
10719 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
10720 assumes GOT entries and small data are within a 12-bit range from the
10721 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
10722 are computed with 32 bits.
10723 With a @samp{bfin-elf} target, this option implies @option{-msim}.
10726 @opindex minline-plt
10728 Enable inlining of PLT entries in function calls to functions that are
10729 not known to bind locally. It has no effect without @option{-mfdpic}.
10730 It's enabled by default if optimizing for speed and compiling for
10731 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
10732 optimization option such as @option{-O3} or above is present in the
10738 Assume a large TLS segment when generating thread-local code.
10743 Do not assume a large TLS segment when generating thread-local code.
10748 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
10749 that is known to be in read-only sections. It's enabled by default,
10750 except for @option{-fpic} or @option{-fpie}: even though it may help
10751 make the global offset table smaller, it trades 1 instruction for 4.
10752 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
10753 one of which may be shared by multiple symbols, and it avoids the need
10754 for a GOT entry for the referenced symbol, so it's more likely to be a
10755 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
10757 @item -multilib-library-pic
10758 @opindex multilib-library-pic
10760 Link with the (library, not FD) pic libraries. It's implied by
10761 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
10762 @option{-fpic} without @option{-mfdpic}. You should never have to use
10766 @opindex mlinked-fp
10768 Follow the EABI requirement of always creating a frame pointer whenever
10769 a stack frame is allocated. This option is enabled by default and can
10770 be disabled with @option{-mno-linked-fp}.
10773 @opindex mlong-calls
10775 Use indirect addressing to call functions outside the current
10776 compilation unit. This allows the functions to be placed anywhere
10777 within the 32-bit address space.
10779 @item -malign-labels
10780 @opindex malign-labels
10782 Try to align labels to an 8-byte boundary by inserting nops into the
10783 previous packet. This option only has an effect when VLIW packing
10784 is enabled. It doesn't create new packets; it merely adds nops to
10787 @item -mlibrary-pic
10788 @opindex mlibrary-pic
10790 Generate position-independent EABI code.
10795 Use only the first four media accumulator registers.
10800 Use all eight media accumulator registers.
10805 Pack VLIW instructions.
10810 Do not pack VLIW instructions.
10813 @opindex mno-eflags
10815 Do not mark ABI switches in e_flags.
10818 @opindex mcond-move
10820 Enable the use of conditional-move instructions (default).
10822 This switch is mainly for debugging the compiler and will likely be removed
10823 in a future version.
10825 @item -mno-cond-move
10826 @opindex mno-cond-move
10828 Disable the use of conditional-move instructions.
10830 This switch is mainly for debugging the compiler and will likely be removed
10831 in a future version.
10836 Enable the use of conditional set instructions (default).
10838 This switch is mainly for debugging the compiler and will likely be removed
10839 in a future version.
10844 Disable the use of conditional set instructions.
10846 This switch is mainly for debugging the compiler and will likely be removed
10847 in a future version.
10850 @opindex mcond-exec
10852 Enable the use of conditional execution (default).
10854 This switch is mainly for debugging the compiler and will likely be removed
10855 in a future version.
10857 @item -mno-cond-exec
10858 @opindex mno-cond-exec
10860 Disable the use of conditional execution.
10862 This switch is mainly for debugging the compiler and will likely be removed
10863 in a future version.
10865 @item -mvliw-branch
10866 @opindex mvliw-branch
10868 Run a pass to pack branches into VLIW instructions (default).
10870 This switch is mainly for debugging the compiler and will likely be removed
10871 in a future version.
10873 @item -mno-vliw-branch
10874 @opindex mno-vliw-branch
10876 Do not run a pass to pack branches into VLIW instructions.
10878 This switch is mainly for debugging the compiler and will likely be removed
10879 in a future version.
10881 @item -mmulti-cond-exec
10882 @opindex mmulti-cond-exec
10884 Enable optimization of @code{&&} and @code{||} in conditional execution
10887 This switch is mainly for debugging the compiler and will likely be removed
10888 in a future version.
10890 @item -mno-multi-cond-exec
10891 @opindex mno-multi-cond-exec
10893 Disable optimization of @code{&&} and @code{||} in conditional execution.
10895 This switch is mainly for debugging the compiler and will likely be removed
10896 in a future version.
10898 @item -mnested-cond-exec
10899 @opindex mnested-cond-exec
10901 Enable nested conditional execution optimizations (default).
10903 This switch is mainly for debugging the compiler and will likely be removed
10904 in a future version.
10906 @item -mno-nested-cond-exec
10907 @opindex mno-nested-cond-exec
10909 Disable nested conditional execution optimizations.
10911 This switch is mainly for debugging the compiler and will likely be removed
10912 in a future version.
10914 @item -moptimize-membar
10915 @opindex moptimize-membar
10917 This switch removes redundant @code{membar} instructions from the
10918 compiler generated code. It is enabled by default.
10920 @item -mno-optimize-membar
10921 @opindex mno-optimize-membar
10923 This switch disables the automatic removal of redundant @code{membar}
10924 instructions from the generated code.
10926 @item -mtomcat-stats
10927 @opindex mtomcat-stats
10929 Cause gas to print out tomcat statistics.
10931 @item -mcpu=@var{cpu}
10934 Select the processor type for which to generate code. Possible values are
10935 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
10936 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
10940 @node GNU/Linux Options
10941 @subsection GNU/Linux Options
10943 These @samp{-m} options are defined for GNU/Linux targets:
10948 Use the GNU C library instead of uClibc. This is the default except
10949 on @samp{*-*-linux-*uclibc*} targets.
10953 Use uClibc instead of the GNU C library. This is the default on
10954 @samp{*-*-linux-*uclibc*} targets.
10957 @node H8/300 Options
10958 @subsection H8/300 Options
10960 These @samp{-m} options are defined for the H8/300 implementations:
10965 Shorten some address references at link time, when possible; uses the
10966 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
10967 ld, Using ld}, for a fuller description.
10971 Generate code for the H8/300H@.
10975 Generate code for the H8S@.
10979 Generate code for the H8S and H8/300H in the normal mode. This switch
10980 must be used either with @option{-mh} or @option{-ms}.
10984 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
10988 Make @code{int} data 32 bits by default.
10991 @opindex malign-300
10992 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
10993 The default for the H8/300H and H8S is to align longs and floats on 4
10995 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
10996 This option has no effect on the H8/300.
11000 @subsection HPPA Options
11001 @cindex HPPA Options
11003 These @samp{-m} options are defined for the HPPA family of computers:
11006 @item -march=@var{architecture-type}
11008 Generate code for the specified architecture. The choices for
11009 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
11010 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
11011 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
11012 architecture option for your machine. Code compiled for lower numbered
11013 architectures will run on higher numbered architectures, but not the
11016 @item -mpa-risc-1-0
11017 @itemx -mpa-risc-1-1
11018 @itemx -mpa-risc-2-0
11019 @opindex mpa-risc-1-0
11020 @opindex mpa-risc-1-1
11021 @opindex mpa-risc-2-0
11022 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
11025 @opindex mbig-switch
11026 Generate code suitable for big switch tables. Use this option only if
11027 the assembler/linker complain about out of range branches within a switch
11030 @item -mjump-in-delay
11031 @opindex mjump-in-delay
11032 Fill delay slots of function calls with unconditional jump instructions
11033 by modifying the return pointer for the function call to be the target
11034 of the conditional jump.
11036 @item -mdisable-fpregs
11037 @opindex mdisable-fpregs
11038 Prevent floating point registers from being used in any manner. This is
11039 necessary for compiling kernels which perform lazy context switching of
11040 floating point registers. If you use this option and attempt to perform
11041 floating point operations, the compiler will abort.
11043 @item -mdisable-indexing
11044 @opindex mdisable-indexing
11045 Prevent the compiler from using indexing address modes. This avoids some
11046 rather obscure problems when compiling MIG generated code under MACH@.
11048 @item -mno-space-regs
11049 @opindex mno-space-regs
11050 Generate code that assumes the target has no space registers. This allows
11051 GCC to generate faster indirect calls and use unscaled index address modes.
11053 Such code is suitable for level 0 PA systems and kernels.
11055 @item -mfast-indirect-calls
11056 @opindex mfast-indirect-calls
11057 Generate code that assumes calls never cross space boundaries. This
11058 allows GCC to emit code which performs faster indirect calls.
11060 This option will not work in the presence of shared libraries or nested
11063 @item -mfixed-range=@var{register-range}
11064 @opindex mfixed-range
11065 Generate code treating the given register range as fixed registers.
11066 A fixed register is one that the register allocator can not use. This is
11067 useful when compiling kernel code. A register range is specified as
11068 two registers separated by a dash. Multiple register ranges can be
11069 specified separated by a comma.
11071 @item -mlong-load-store
11072 @opindex mlong-load-store
11073 Generate 3-instruction load and store sequences as sometimes required by
11074 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
11077 @item -mportable-runtime
11078 @opindex mportable-runtime
11079 Use the portable calling conventions proposed by HP for ELF systems.
11083 Enable the use of assembler directives only GAS understands.
11085 @item -mschedule=@var{cpu-type}
11087 Schedule code according to the constraints for the machine type
11088 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
11089 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
11090 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
11091 proper scheduling option for your machine. The default scheduling is
11095 @opindex mlinker-opt
11096 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
11097 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
11098 linkers in which they give bogus error messages when linking some programs.
11101 @opindex msoft-float
11102 Generate output containing library calls for floating point.
11103 @strong{Warning:} the requisite libraries are not available for all HPPA
11104 targets. Normally the facilities of the machine's usual C compiler are
11105 used, but this cannot be done directly in cross-compilation. You must make
11106 your own arrangements to provide suitable library functions for
11109 @option{-msoft-float} changes the calling convention in the output file;
11110 therefore, it is only useful if you compile @emph{all} of a program with
11111 this option. In particular, you need to compile @file{libgcc.a}, the
11112 library that comes with GCC, with @option{-msoft-float} in order for
11117 Generate the predefine, @code{_SIO}, for server IO@. The default is
11118 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
11119 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
11120 options are available under HP-UX and HI-UX@.
11124 Use GNU ld specific options. This passes @option{-shared} to ld when
11125 building a shared library. It is the default when GCC is configured,
11126 explicitly or implicitly, with the GNU linker. This option does not
11127 have any affect on which ld is called, it only changes what parameters
11128 are passed to that ld. The ld that is called is determined by the
11129 @option{--with-ld} configure option, GCC's program search path, and
11130 finally by the user's @env{PATH}. The linker used by GCC can be printed
11131 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
11132 on the 64 bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
11136 Use HP ld specific options. This passes @option{-b} to ld when building
11137 a shared library and passes @option{+Accept TypeMismatch} to ld on all
11138 links. It is the default when GCC is configured, explicitly or
11139 implicitly, with the HP linker. This option does not have any affect on
11140 which ld is called, it only changes what parameters are passed to that
11141 ld. The ld that is called is determined by the @option{--with-ld}
11142 configure option, GCC's program search path, and finally by the user's
11143 @env{PATH}. The linker used by GCC can be printed using @samp{which
11144 `gcc -print-prog-name=ld`}. This option is only available on the 64 bit
11145 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
11148 @opindex mno-long-calls
11149 Generate code that uses long call sequences. This ensures that a call
11150 is always able to reach linker generated stubs. The default is to generate
11151 long calls only when the distance from the call site to the beginning
11152 of the function or translation unit, as the case may be, exceeds a
11153 predefined limit set by the branch type being used. The limits for
11154 normal calls are 7,600,000 and 240,000 bytes, respectively for the
11155 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
11158 Distances are measured from the beginning of functions when using the
11159 @option{-ffunction-sections} option, or when using the @option{-mgas}
11160 and @option{-mno-portable-runtime} options together under HP-UX with
11163 It is normally not desirable to use this option as it will degrade
11164 performance. However, it may be useful in large applications,
11165 particularly when partial linking is used to build the application.
11167 The types of long calls used depends on the capabilities of the
11168 assembler and linker, and the type of code being generated. The
11169 impact on systems that support long absolute calls, and long pic
11170 symbol-difference or pc-relative calls should be relatively small.
11171 However, an indirect call is used on 32-bit ELF systems in pic code
11172 and it is quite long.
11174 @item -munix=@var{unix-std}
11176 Generate compiler predefines and select a startfile for the specified
11177 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
11178 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
11179 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
11180 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
11181 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
11184 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
11185 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
11186 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
11187 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
11188 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
11189 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
11191 It is @emph{important} to note that this option changes the interfaces
11192 for various library routines. It also affects the operational behavior
11193 of the C library. Thus, @emph{extreme} care is needed in using this
11196 Library code that is intended to operate with more than one UNIX
11197 standard must test, set and restore the variable @var{__xpg4_extended_mask}
11198 as appropriate. Most GNU software doesn't provide this capability.
11202 Suppress the generation of link options to search libdld.sl when the
11203 @option{-static} option is specified on HP-UX 10 and later.
11207 The HP-UX implementation of setlocale in libc has a dependency on
11208 libdld.sl. There isn't an archive version of libdld.sl. Thus,
11209 when the @option{-static} option is specified, special link options
11210 are needed to resolve this dependency.
11212 On HP-UX 10 and later, the GCC driver adds the necessary options to
11213 link with libdld.sl when the @option{-static} option is specified.
11214 This causes the resulting binary to be dynamic. On the 64-bit port,
11215 the linkers generate dynamic binaries by default in any case. The
11216 @option{-nolibdld} option can be used to prevent the GCC driver from
11217 adding these link options.
11221 Add support for multithreading with the @dfn{dce thread} library
11222 under HP-UX@. This option sets flags for both the preprocessor and
11226 @node i386 and x86-64 Options
11227 @subsection Intel 386 and AMD x86-64 Options
11228 @cindex i386 Options
11229 @cindex x86-64 Options
11230 @cindex Intel 386 Options
11231 @cindex AMD x86-64 Options
11233 These @samp{-m} options are defined for the i386 and x86-64 family of
11237 @item -mtune=@var{cpu-type}
11239 Tune to @var{cpu-type} everything applicable about the generated code, except
11240 for the ABI and the set of available instructions. The choices for
11241 @var{cpu-type} are:
11244 Produce code optimized for the most common IA32/AMD64/EM64T processors.
11245 If you know the CPU on which your code will run, then you should use
11246 the corresponding @option{-mtune} option instead of
11247 @option{-mtune=generic}. But, if you do not know exactly what CPU users
11248 of your application will have, then you should use this option.
11250 As new processors are deployed in the marketplace, the behavior of this
11251 option will change. Therefore, if you upgrade to a newer version of
11252 GCC, the code generated option will change to reflect the processors
11253 that were most common when that version of GCC was released.
11255 There is no @option{-march=generic} option because @option{-march}
11256 indicates the instruction set the compiler can use, and there is no
11257 generic instruction set applicable to all processors. In contrast,
11258 @option{-mtune} indicates the processor (or, in this case, collection of
11259 processors) for which the code is optimized.
11261 This selects the CPU to tune for at compilation time by determining
11262 the processor type of the compiling machine. Using @option{-mtune=native}
11263 will produce code optimized for the local machine under the constraints
11264 of the selected instruction set. Using @option{-march=native} will
11265 enable all instruction subsets supported by the local machine (hence
11266 the result might not run on different machines).
11268 Original Intel's i386 CPU@.
11270 Intel's i486 CPU@. (No scheduling is implemented for this chip.)
11271 @item i586, pentium
11272 Intel Pentium CPU with no MMX support.
11274 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
11276 Intel PentiumPro CPU@.
11278 Same as @code{generic}, but when used as @code{march} option, PentiumPro
11279 instruction set will be used, so the code will run on all i686 family chips.
11281 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
11282 @item pentium3, pentium3m
11283 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
11286 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
11287 support. Used by Centrino notebooks.
11288 @item pentium4, pentium4m
11289 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
11291 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
11294 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
11295 SSE2 and SSE3 instruction set support.
11297 Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
11298 instruction set support.
11300 Intel Atom CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
11301 instruction set support.
11303 AMD K6 CPU with MMX instruction set support.
11305 Improved versions of AMD K6 CPU with MMX and 3dNOW!@: instruction set support.
11306 @item athlon, athlon-tbird
11307 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW!@: and SSE prefetch instructions
11309 @item athlon-4, athlon-xp, athlon-mp
11310 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW!@: and full SSE
11311 instruction set support.
11312 @item k8, opteron, athlon64, athlon-fx
11313 AMD K8 core based CPUs with x86-64 instruction set support. (This supersets
11314 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW!@: and 64-bit instruction set extensions.)
11315 @item k8-sse3, opteron-sse3, athlon64-sse3
11316 Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
11317 @item amdfam10, barcelona
11318 AMD Family 10h core based CPUs with x86-64 instruction set support. (This
11319 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit
11320 instruction set extensions.)
11322 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
11325 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!@:
11326 instruction set support.
11328 Via C3 CPU with MMX and 3dNOW!@: instruction set support. (No scheduling is
11329 implemented for this chip.)
11331 Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is
11332 implemented for this chip.)
11334 Embedded AMD CPU with MMX and 3dNOW! instruction set support.
11337 While picking a specific @var{cpu-type} will schedule things appropriately
11338 for that particular chip, the compiler will not generate any code that
11339 does not run on the i386 without the @option{-march=@var{cpu-type}} option
11342 @item -march=@var{cpu-type}
11344 Generate instructions for the machine type @var{cpu-type}. The choices
11345 for @var{cpu-type} are the same as for @option{-mtune}. Moreover,
11346 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
11348 @item -mcpu=@var{cpu-type}
11350 A deprecated synonym for @option{-mtune}.
11352 @item -mfpmath=@var{unit}
11354 Generate floating point arithmetics for selected unit @var{unit}. The choices
11355 for @var{unit} are:
11359 Use the standard 387 floating point coprocessor present majority of chips and
11360 emulated otherwise. Code compiled with this option will run almost everywhere.
11361 The temporary results are computed in 80bit precision instead of precision
11362 specified by the type resulting in slightly different results compared to most
11363 of other chips. See @option{-ffloat-store} for more detailed description.
11365 This is the default choice for i386 compiler.
11368 Use scalar floating point instructions present in the SSE instruction set.
11369 This instruction set is supported by Pentium3 and newer chips, in the AMD line
11370 by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
11371 instruction set supports only single precision arithmetics, thus the double and
11372 extended precision arithmetics is still done using 387. Later version, present
11373 only in Pentium4 and the future AMD x86-64 chips supports double precision
11376 For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
11377 or @option{-msse2} switches to enable SSE extensions and make this option
11378 effective. For the x86-64 compiler, these extensions are enabled by default.
11380 The resulting code should be considerably faster in the majority of cases and avoid
11381 the numerical instability problems of 387 code, but may break some existing
11382 code that expects temporaries to be 80bit.
11384 This is the default choice for the x86-64 compiler.
11389 Attempt to utilize both instruction sets at once. This effectively double the
11390 amount of available registers and on chips with separate execution units for
11391 387 and SSE the execution resources too. Use this option with care, as it is
11392 still experimental, because the GCC register allocator does not model separate
11393 functional units well resulting in instable performance.
11396 @item -masm=@var{dialect}
11397 @opindex masm=@var{dialect}
11398 Output asm instructions using selected @var{dialect}. Supported
11399 choices are @samp{intel} or @samp{att} (the default one). Darwin does
11400 not support @samp{intel}.
11403 @itemx -mno-ieee-fp
11405 @opindex mno-ieee-fp
11406 Control whether or not the compiler uses IEEE floating point
11407 comparisons. These handle correctly the case where the result of a
11408 comparison is unordered.
11411 @opindex msoft-float
11412 Generate output containing library calls for floating point.
11413 @strong{Warning:} the requisite libraries are not part of GCC@.
11414 Normally the facilities of the machine's usual C compiler are used, but
11415 this can't be done directly in cross-compilation. You must make your
11416 own arrangements to provide suitable library functions for
11419 On machines where a function returns floating point results in the 80387
11420 register stack, some floating point opcodes may be emitted even if
11421 @option{-msoft-float} is used.
11423 @item -mno-fp-ret-in-387
11424 @opindex mno-fp-ret-in-387
11425 Do not use the FPU registers for return values of functions.
11427 The usual calling convention has functions return values of types
11428 @code{float} and @code{double} in an FPU register, even if there
11429 is no FPU@. The idea is that the operating system should emulate
11432 The option @option{-mno-fp-ret-in-387} causes such values to be returned
11433 in ordinary CPU registers instead.
11435 @item -mno-fancy-math-387
11436 @opindex mno-fancy-math-387
11437 Some 387 emulators do not support the @code{sin}, @code{cos} and
11438 @code{sqrt} instructions for the 387. Specify this option to avoid
11439 generating those instructions. This option is the default on FreeBSD,
11440 OpenBSD and NetBSD@. This option is overridden when @option{-march}
11441 indicates that the target cpu will always have an FPU and so the
11442 instruction will not need emulation. As of revision 2.6.1, these
11443 instructions are not generated unless you also use the
11444 @option{-funsafe-math-optimizations} switch.
11446 @item -malign-double
11447 @itemx -mno-align-double
11448 @opindex malign-double
11449 @opindex mno-align-double
11450 Control whether GCC aligns @code{double}, @code{long double}, and
11451 @code{long long} variables on a two word boundary or a one word
11452 boundary. Aligning @code{double} variables on a two word boundary will
11453 produce code that runs somewhat faster on a @samp{Pentium} at the
11454 expense of more memory.
11456 On x86-64, @option{-malign-double} is enabled by default.
11458 @strong{Warning:} if you use the @option{-malign-double} switch,
11459 structures containing the above types will be aligned differently than
11460 the published application binary interface specifications for the 386
11461 and will not be binary compatible with structures in code compiled
11462 without that switch.
11464 @item -m96bit-long-double
11465 @itemx -m128bit-long-double
11466 @opindex m96bit-long-double
11467 @opindex m128bit-long-double
11468 These switches control the size of @code{long double} type. The i386
11469 application binary interface specifies the size to be 96 bits,
11470 so @option{-m96bit-long-double} is the default in 32 bit mode.
11472 Modern architectures (Pentium and newer) would prefer @code{long double}
11473 to be aligned to an 8 or 16 byte boundary. In arrays or structures
11474 conforming to the ABI, this would not be possible. So specifying a
11475 @option{-m128bit-long-double} will align @code{long double}
11476 to a 16 byte boundary by padding the @code{long double} with an additional
11479 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
11480 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
11482 Notice that neither of these options enable any extra precision over the x87
11483 standard of 80 bits for a @code{long double}.
11485 @strong{Warning:} if you override the default value for your target ABI, the
11486 structures and arrays containing @code{long double} variables will change
11487 their size as well as function calling convention for function taking
11488 @code{long double} will be modified. Hence they will not be binary
11489 compatible with arrays or structures in code compiled without that switch.
11491 @item -mlarge-data-threshold=@var{number}
11492 @opindex mlarge-data-threshold=@var{number}
11493 When @option{-mcmodel=medium} is specified, the data greater than
11494 @var{threshold} are placed in large data section. This value must be the
11495 same across all object linked into the binary and defaults to 65535.
11499 Use a different function-calling convention, in which functions that
11500 take a fixed number of arguments return with the @code{ret} @var{num}
11501 instruction, which pops their arguments while returning. This saves one
11502 instruction in the caller since there is no need to pop the arguments
11505 You can specify that an individual function is called with this calling
11506 sequence with the function attribute @samp{stdcall}. You can also
11507 override the @option{-mrtd} option by using the function attribute
11508 @samp{cdecl}. @xref{Function Attributes}.
11510 @strong{Warning:} this calling convention is incompatible with the one
11511 normally used on Unix, so you cannot use it if you need to call
11512 libraries compiled with the Unix compiler.
11514 Also, you must provide function prototypes for all functions that
11515 take variable numbers of arguments (including @code{printf});
11516 otherwise incorrect code will be generated for calls to those
11519 In addition, seriously incorrect code will result if you call a
11520 function with too many arguments. (Normally, extra arguments are
11521 harmlessly ignored.)
11523 @item -mregparm=@var{num}
11525 Control how many registers are used to pass integer arguments. By
11526 default, no registers are used to pass arguments, and at most 3
11527 registers can be used. You can control this behavior for a specific
11528 function by using the function attribute @samp{regparm}.
11529 @xref{Function Attributes}.
11531 @strong{Warning:} if you use this switch, and
11532 @var{num} is nonzero, then you must build all modules with the same
11533 value, including any libraries. This includes the system libraries and
11537 @opindex msseregparm
11538 Use SSE register passing conventions for float and double arguments
11539 and return values. You can control this behavior for a specific
11540 function by using the function attribute @samp{sseregparm}.
11541 @xref{Function Attributes}.
11543 @strong{Warning:} if you use this switch then you must build all
11544 modules with the same value, including any libraries. This includes
11545 the system libraries and startup modules.
11554 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
11555 is specified, the significands of results of floating-point operations are
11556 rounded to 24 bits (single precision); @option{-mpc64} rounds the
11557 significands of results of floating-point operations to 53 bits (double
11558 precision) and @option{-mpc80} rounds the significands of results of
11559 floating-point operations to 64 bits (extended double precision), which is
11560 the default. When this option is used, floating-point operations in higher
11561 precisions are not available to the programmer without setting the FPU
11562 control word explicitly.
11564 Setting the rounding of floating-point operations to less than the default
11565 80 bits can speed some programs by 2% or more. Note that some mathematical
11566 libraries assume that extended precision (80 bit) floating-point operations
11567 are enabled by default; routines in such libraries could suffer significant
11568 loss of accuracy, typically through so-called "catastrophic cancellation",
11569 when this option is used to set the precision to less than extended precision.
11571 @item -mstackrealign
11572 @opindex mstackrealign
11573 Realign the stack at entry. On the Intel x86, the @option{-mstackrealign}
11574 option will generate an alternate prologue and epilogue that realigns the
11575 runtime stack if necessary. This supports mixing legacy codes that keep
11576 a 4-byte aligned stack with modern codes that keep a 16-byte stack for
11577 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
11578 applicable to individual functions.
11580 @item -mpreferred-stack-boundary=@var{num}
11581 @opindex mpreferred-stack-boundary
11582 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
11583 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
11584 the default is 4 (16 bytes or 128 bits).
11586 @item -mincoming-stack-boundary=@var{num}
11587 @opindex mincoming-stack-boundary
11588 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
11589 boundary. If @option{-mincoming-stack-boundary} is not specified,
11590 the one specified by @option{-mpreferred-stack-boundary} will be used.
11592 On Pentium and PentiumPro, @code{double} and @code{long double} values
11593 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
11594 suffer significant run time performance penalties. On Pentium III, the
11595 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
11596 properly if it is not 16 byte aligned.
11598 To ensure proper alignment of this values on the stack, the stack boundary
11599 must be as aligned as that required by any value stored on the stack.
11600 Further, every function must be generated such that it keeps the stack
11601 aligned. Thus calling a function compiled with a higher preferred
11602 stack boundary from a function compiled with a lower preferred stack
11603 boundary will most likely misalign the stack. It is recommended that
11604 libraries that use callbacks always use the default setting.
11606 This extra alignment does consume extra stack space, and generally
11607 increases code size. Code that is sensitive to stack space usage, such
11608 as embedded systems and operating system kernels, may want to reduce the
11609 preferred alignment to @option{-mpreferred-stack-boundary=2}.
11649 These switches enable or disable the use of instructions in the MMX,
11650 SSE, SSE2, SSE3, SSSE3, SSE4.1, AVX, AES, PCLMUL, SSE4A, SSE5, ABM or
11651 3DNow!@: extended instruction sets.
11652 These extensions are also available as built-in functions: see
11653 @ref{X86 Built-in Functions}, for details of the functions enabled and
11654 disabled by these switches.
11656 To have SSE/SSE2 instructions generated automatically from floating-point
11657 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
11659 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
11660 generates new AVX instructions or AVX equivalence for all SSEx instructions
11663 These options will enable GCC to use these extended instructions in
11664 generated code, even without @option{-mfpmath=sse}. Applications which
11665 perform runtime CPU detection must compile separate files for each
11666 supported architecture, using the appropriate flags. In particular,
11667 the file containing the CPU detection code should be compiled without
11672 This option instructs GCC to emit a @code{cld} instruction in the prologue
11673 of functions that use string instructions. String instructions depend on
11674 the DF flag to select between autoincrement or autodecrement mode. While the
11675 ABI specifies the DF flag to be cleared on function entry, some operating
11676 systems violate this specification by not clearing the DF flag in their
11677 exception dispatchers. The exception handler can be invoked with the DF flag
11678 set which leads to wrong direction mode, when string instructions are used.
11679 This option can be enabled by default on 32-bit x86 targets by configuring
11680 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
11681 instructions can be suppressed with the @option{-mno-cld} compiler option
11686 This option will enable GCC to use CMPXCHG16B instruction in generated code.
11687 CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword)
11688 data types. This is useful for high resolution counters that could be updated
11689 by multiple processors (or cores). This instruction is generated as part of
11690 atomic built-in functions: see @ref{Atomic Builtins} for details.
11694 This option will enable GCC to use SAHF instruction in generated 64-bit code.
11695 Early Intel CPUs with Intel 64 lacked LAHF and SAHF instructions supported
11696 by AMD64 until introduction of Pentium 4 G1 step in December 2005. LAHF and
11697 SAHF are load and store instructions, respectively, for certain status flags.
11698 In 64-bit mode, SAHF instruction is used to optimize @code{fmod}, @code{drem}
11699 or @code{remainder} built-in functions: see @ref{Other Builtins} for details.
11703 This option will enable GCC to use movbe instruction to implement
11704 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
11708 This option will enable built-in functions, @code{__builtin_ia32_crc32qi},
11709 @code{__builtin_ia32_crc32hi}. @code{__builtin_ia32_crc32si} and
11710 @code{__builtin_ia32_crc32di} to generate the crc32 machine instruction.
11714 This option will enable GCC to use RCPSS and RSQRTSS instructions (and their
11715 vectorized variants RCPPS and RSQRTPS) with an additional Newton-Raphson step
11716 to increase precision instead of DIVSS and SQRTSS (and their vectorized
11717 variants) for single precision floating point arguments. These instructions
11718 are generated only when @option{-funsafe-math-optimizations} is enabled
11719 together with @option{-finite-math-only} and @option{-fno-trapping-math}.
11720 Note that while the throughput of the sequence is higher than the throughput
11721 of the non-reciprocal instruction, the precision of the sequence can be
11722 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
11724 @item -mveclibabi=@var{type}
11725 @opindex mveclibabi
11726 Specifies the ABI type to use for vectorizing intrinsics using an
11727 external library. Supported types are @code{svml} for the Intel short
11728 vector math library and @code{acml} for the AMD math core library style
11729 of interfacing. GCC will currently emit calls to @code{vmldExp2},
11730 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
11731 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
11732 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
11733 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
11734 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
11735 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
11736 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
11737 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
11738 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
11739 function type when @option{-mveclibabi=svml} is used and @code{__vrd2_sin},
11740 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
11741 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
11742 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
11743 @code{__vrs4_log10f} and @code{__vrs4_powf} for corresponding function type
11744 when @option{-mveclibabi=acml} is used. Both @option{-ftree-vectorize} and
11745 @option{-funsafe-math-optimizations} have to be enabled. A SVML or ACML ABI
11746 compatible library will have to be specified at link time.
11748 @item -mabi=@var{name}
11750 Generate code for the specified calling convention. Permissible values
11751 are: @samp{sysv} for the ABI used on GNU/Linux and other systems and
11752 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
11753 ABI when targeting Windows. On all other systems, the default is the
11754 SYSV ABI. You can control this behavior for a specific function by
11755 using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
11756 @xref{Function Attributes}.
11759 @itemx -mno-push-args
11760 @opindex mpush-args
11761 @opindex mno-push-args
11762 Use PUSH operations to store outgoing parameters. This method is shorter
11763 and usually equally fast as method using SUB/MOV operations and is enabled
11764 by default. In some cases disabling it may improve performance because of
11765 improved scheduling and reduced dependencies.
11767 @item -maccumulate-outgoing-args
11768 @opindex maccumulate-outgoing-args
11769 If enabled, the maximum amount of space required for outgoing arguments will be
11770 computed in the function prologue. This is faster on most modern CPUs
11771 because of reduced dependencies, improved scheduling and reduced stack usage
11772 when preferred stack boundary is not equal to 2. The drawback is a notable
11773 increase in code size. This switch implies @option{-mno-push-args}.
11777 Support thread-safe exception handling on @samp{Mingw32}. Code that relies
11778 on thread-safe exception handling must compile and link all code with the
11779 @option{-mthreads} option. When compiling, @option{-mthreads} defines
11780 @option{-D_MT}; when linking, it links in a special thread helper library
11781 @option{-lmingwthrd} which cleans up per thread exception handling data.
11783 @item -mno-align-stringops
11784 @opindex mno-align-stringops
11785 Do not align destination of inlined string operations. This switch reduces
11786 code size and improves performance in case the destination is already aligned,
11787 but GCC doesn't know about it.
11789 @item -minline-all-stringops
11790 @opindex minline-all-stringops
11791 By default GCC inlines string operations only when destination is known to be
11792 aligned at least to 4 byte boundary. This enables more inlining, increase code
11793 size, but may improve performance of code that depends on fast memcpy, strlen
11794 and memset for short lengths.
11796 @item -minline-stringops-dynamically
11797 @opindex minline-stringops-dynamically
11798 For string operation of unknown size, inline runtime checks so for small
11799 blocks inline code is used, while for large blocks library call is used.
11801 @item -mstringop-strategy=@var{alg}
11802 @opindex mstringop-strategy=@var{alg}
11803 Overwrite internal decision heuristic about particular algorithm to inline
11804 string operation with. The allowed values are @code{rep_byte},
11805 @code{rep_4byte}, @code{rep_8byte} for expanding using i386 @code{rep} prefix
11806 of specified size, @code{byte_loop}, @code{loop}, @code{unrolled_loop} for
11807 expanding inline loop, @code{libcall} for always expanding library call.
11809 @item -momit-leaf-frame-pointer
11810 @opindex momit-leaf-frame-pointer
11811 Don't keep the frame pointer in a register for leaf functions. This
11812 avoids the instructions to save, set up and restore frame pointers and
11813 makes an extra register available in leaf functions. The option
11814 @option{-fomit-frame-pointer} removes the frame pointer for all functions
11815 which might make debugging harder.
11817 @item -mtls-direct-seg-refs
11818 @itemx -mno-tls-direct-seg-refs
11819 @opindex mtls-direct-seg-refs
11820 Controls whether TLS variables may be accessed with offsets from the
11821 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
11822 or whether the thread base pointer must be added. Whether or not this
11823 is legal depends on the operating system, and whether it maps the
11824 segment to cover the entire TLS area.
11826 For systems that use GNU libc, the default is on.
11829 @itemx -mno-fused-madd
11830 @opindex mfused-madd
11831 Enable automatic generation of fused floating point multiply-add instructions
11832 if the ISA supports such instructions. The -mfused-madd option is on by
11833 default. The fused multiply-add instructions have a different
11834 rounding behavior compared to executing a multiply followed by an add.
11837 @itemx -mno-sse2avx
11839 Specify that the assembler should encode SSE instructions with VEX
11840 prefix. The option @option{-mavx} turns this on by default.
11843 These @samp{-m} switches are supported in addition to the above
11844 on AMD x86-64 processors in 64-bit environments.
11851 Generate code for a 32-bit or 64-bit environment.
11852 The 32-bit environment sets int, long and pointer to 32 bits and
11853 generates code that runs on any i386 system.
11854 The 64-bit environment sets int to 32 bits and long and pointer
11855 to 64 bits and generates code for AMD's x86-64 architecture. For
11856 darwin only the -m64 option turns off the @option{-fno-pic} and
11857 @option{-mdynamic-no-pic} options.
11859 @item -mno-red-zone
11860 @opindex mno-red-zone
11861 Do not use a so called red zone for x86-64 code. The red zone is mandated
11862 by the x86-64 ABI, it is a 128-byte area beyond the location of the
11863 stack pointer that will not be modified by signal or interrupt handlers
11864 and therefore can be used for temporary data without adjusting the stack
11865 pointer. The flag @option{-mno-red-zone} disables this red zone.
11867 @item -mcmodel=small
11868 @opindex mcmodel=small
11869 Generate code for the small code model: the program and its symbols must
11870 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
11871 Programs can be statically or dynamically linked. This is the default
11874 @item -mcmodel=kernel
11875 @opindex mcmodel=kernel
11876 Generate code for the kernel code model. The kernel runs in the
11877 negative 2 GB of the address space.
11878 This model has to be used for Linux kernel code.
11880 @item -mcmodel=medium
11881 @opindex mcmodel=medium
11882 Generate code for the medium model: The program is linked in the lower 2
11883 GB of the address space. Small symbols are also placed there. Symbols
11884 with sizes larger than @option{-mlarge-data-threshold} are put into
11885 large data or bss sections and can be located above 2GB. Programs can
11886 be statically or dynamically linked.
11888 @item -mcmodel=large
11889 @opindex mcmodel=large
11890 Generate code for the large model: This model makes no assumptions
11891 about addresses and sizes of sections.
11894 @node IA-64 Options
11895 @subsection IA-64 Options
11896 @cindex IA-64 Options
11898 These are the @samp{-m} options defined for the Intel IA-64 architecture.
11902 @opindex mbig-endian
11903 Generate code for a big endian target. This is the default for HP-UX@.
11905 @item -mlittle-endian
11906 @opindex mlittle-endian
11907 Generate code for a little endian target. This is the default for AIX5
11913 @opindex mno-gnu-as
11914 Generate (or don't) code for the GNU assembler. This is the default.
11915 @c Also, this is the default if the configure option @option{--with-gnu-as}
11921 @opindex mno-gnu-ld
11922 Generate (or don't) code for the GNU linker. This is the default.
11923 @c Also, this is the default if the configure option @option{--with-gnu-ld}
11928 Generate code that does not use a global pointer register. The result
11929 is not position independent code, and violates the IA-64 ABI@.
11931 @item -mvolatile-asm-stop
11932 @itemx -mno-volatile-asm-stop
11933 @opindex mvolatile-asm-stop
11934 @opindex mno-volatile-asm-stop
11935 Generate (or don't) a stop bit immediately before and after volatile asm
11938 @item -mregister-names
11939 @itemx -mno-register-names
11940 @opindex mregister-names
11941 @opindex mno-register-names
11942 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
11943 the stacked registers. This may make assembler output more readable.
11949 Disable (or enable) optimizations that use the small data section. This may
11950 be useful for working around optimizer bugs.
11952 @item -mconstant-gp
11953 @opindex mconstant-gp
11954 Generate code that uses a single constant global pointer value. This is
11955 useful when compiling kernel code.
11959 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
11960 This is useful when compiling firmware code.
11962 @item -minline-float-divide-min-latency
11963 @opindex minline-float-divide-min-latency
11964 Generate code for inline divides of floating point values
11965 using the minimum latency algorithm.
11967 @item -minline-float-divide-max-throughput
11968 @opindex minline-float-divide-max-throughput
11969 Generate code for inline divides of floating point values
11970 using the maximum throughput algorithm.
11972 @item -mno-inline-float-divide
11973 @opindex mno-inline-float-divide
11974 Do not generate inline code for divides of floating point values.
11976 @item -minline-int-divide-min-latency
11977 @opindex minline-int-divide-min-latency
11978 Generate code for inline divides of integer values
11979 using the minimum latency algorithm.
11981 @item -minline-int-divide-max-throughput
11982 @opindex minline-int-divide-max-throughput
11983 Generate code for inline divides of integer values
11984 using the maximum throughput algorithm.
11986 @item -mno-inline-int-divide
11987 @opindex mno-inline-int-divide
11988 Do not generate inline code for divides of integer values.
11990 @item -minline-sqrt-min-latency
11991 @opindex minline-sqrt-min-latency
11992 Generate code for inline square roots
11993 using the minimum latency algorithm.
11995 @item -minline-sqrt-max-throughput
11996 @opindex minline-sqrt-max-throughput
11997 Generate code for inline square roots
11998 using the maximum throughput algorithm.
12000 @item -mno-inline-sqrt
12001 @opindex mno-inline-sqrt
12002 Do not generate inline code for sqrt.
12005 @itemx -mno-fused-madd
12006 @opindex mfused-madd
12007 @opindex mno-fused-madd
12008 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
12009 instructions. The default is to use these instructions.
12011 @item -mno-dwarf2-asm
12012 @itemx -mdwarf2-asm
12013 @opindex mno-dwarf2-asm
12014 @opindex mdwarf2-asm
12015 Don't (or do) generate assembler code for the DWARF2 line number debugging
12016 info. This may be useful when not using the GNU assembler.
12018 @item -mearly-stop-bits
12019 @itemx -mno-early-stop-bits
12020 @opindex mearly-stop-bits
12021 @opindex mno-early-stop-bits
12022 Allow stop bits to be placed earlier than immediately preceding the
12023 instruction that triggered the stop bit. This can improve instruction
12024 scheduling, but does not always do so.
12026 @item -mfixed-range=@var{register-range}
12027 @opindex mfixed-range
12028 Generate code treating the given register range as fixed registers.
12029 A fixed register is one that the register allocator can not use. This is
12030 useful when compiling kernel code. A register range is specified as
12031 two registers separated by a dash. Multiple register ranges can be
12032 specified separated by a comma.
12034 @item -mtls-size=@var{tls-size}
12036 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
12039 @item -mtune=@var{cpu-type}
12041 Tune the instruction scheduling for a particular CPU, Valid values are
12042 itanium, itanium1, merced, itanium2, and mckinley.
12048 Generate code for a 32-bit or 64-bit environment.
12049 The 32-bit environment sets int, long and pointer to 32 bits.
12050 The 64-bit environment sets int to 32 bits and long and pointer
12051 to 64 bits. These are HP-UX specific flags.
12053 @item -mno-sched-br-data-spec
12054 @itemx -msched-br-data-spec
12055 @opindex mno-sched-br-data-spec
12056 @opindex msched-br-data-spec
12057 (Dis/En)able data speculative scheduling before reload.
12058 This will result in generation of the ld.a instructions and
12059 the corresponding check instructions (ld.c / chk.a).
12060 The default is 'disable'.
12062 @item -msched-ar-data-spec
12063 @itemx -mno-sched-ar-data-spec
12064 @opindex msched-ar-data-spec
12065 @opindex mno-sched-ar-data-spec
12066 (En/Dis)able data speculative scheduling after reload.
12067 This will result in generation of the ld.a instructions and
12068 the corresponding check instructions (ld.c / chk.a).
12069 The default is 'enable'.
12071 @item -mno-sched-control-spec
12072 @itemx -msched-control-spec
12073 @opindex mno-sched-control-spec
12074 @opindex msched-control-spec
12075 (Dis/En)able control speculative scheduling. This feature is
12076 available only during region scheduling (i.e.@: before reload).
12077 This will result in generation of the ld.s instructions and
12078 the corresponding check instructions chk.s .
12079 The default is 'disable'.
12081 @item -msched-br-in-data-spec
12082 @itemx -mno-sched-br-in-data-spec
12083 @opindex msched-br-in-data-spec
12084 @opindex mno-sched-br-in-data-spec
12085 (En/Dis)able speculative scheduling of the instructions that
12086 are dependent on the data speculative loads before reload.
12087 This is effective only with @option{-msched-br-data-spec} enabled.
12088 The default is 'enable'.
12090 @item -msched-ar-in-data-spec
12091 @itemx -mno-sched-ar-in-data-spec
12092 @opindex msched-ar-in-data-spec
12093 @opindex mno-sched-ar-in-data-spec
12094 (En/Dis)able speculative scheduling of the instructions that
12095 are dependent on the data speculative loads after reload.
12096 This is effective only with @option{-msched-ar-data-spec} enabled.
12097 The default is 'enable'.
12099 @item -msched-in-control-spec
12100 @itemx -mno-sched-in-control-spec
12101 @opindex msched-in-control-spec
12102 @opindex mno-sched-in-control-spec
12103 (En/Dis)able speculative scheduling of the instructions that
12104 are dependent on the control speculative loads.
12105 This is effective only with @option{-msched-control-spec} enabled.
12106 The default is 'enable'.
12108 @item -mno-sched-prefer-non-data-spec-insns
12109 @itemx -msched-prefer-non-data-spec-insns
12110 @opindex mno-sched-prefer-non-data-spec-insns
12111 @opindex msched-prefer-non-data-spec-insns
12112 If enabled, data speculative instructions will be chosen for schedule
12113 only if there are no other choices at the moment. This will make
12114 the use of the data speculation much more conservative.
12115 The default is 'disable'.
12117 @item -mno-sched-prefer-non-control-spec-insns
12118 @itemx -msched-prefer-non-control-spec-insns
12119 @opindex mno-sched-prefer-non-control-spec-insns
12120 @opindex msched-prefer-non-control-spec-insns
12121 If enabled, control speculative instructions will be chosen for schedule
12122 only if there are no other choices at the moment. This will make
12123 the use of the control speculation much more conservative.
12124 The default is 'disable'.
12126 @item -mno-sched-count-spec-in-critical-path
12127 @itemx -msched-count-spec-in-critical-path
12128 @opindex mno-sched-count-spec-in-critical-path
12129 @opindex msched-count-spec-in-critical-path
12130 If enabled, speculative dependencies will be considered during
12131 computation of the instructions priorities. This will make the use of the
12132 speculation a bit more conservative.
12133 The default is 'disable'.
12135 @item -msched-spec-ldc
12136 @opindex msched-spec-ldc
12137 Use a simple data speculation check. This option is on by default.
12139 @item -msched-control-spec-ldc
12140 @opindex msched-spec-ldc
12141 Use a simple check for control speculation. This option is on by default.
12143 @item -msched-stop-bits-after-every-cycle
12144 @opindex msched-stop-bits-after-every-cycle
12145 Place a stop bit after every cycle when scheduling. This option is on
12148 @item -msched-fp-mem-deps-zero-cost
12149 @opindex msched-fp-mem-deps-zero-cost
12150 Assume that floating-point stores and loads are not likely to cause a conflict
12151 when placed into the same instruction group. This option is disabled by
12154 @item -msel-sched-dont-check-control-spec
12155 @opindex msel-sched-dont-check-control-spec
12156 Generate checks for control speculation in selective scheduling.
12157 This flag is disabled by default.
12159 @item -msched-max-memory-insns=@var{max-insns}
12160 @opindex msched-max-memory-insns
12161 Limit on the number of memory insns per instruction group, giving lower
12162 priority to subsequent memory insns attempting to schedule in the same
12163 instruction group. Frequently useful to prevent cache bank conflicts.
12164 The default value is 1.
12166 @item -msched-max-memory-insns-hard-limit
12167 @opindex msched-max-memory-insns-hard-limit
12168 Disallow more than `msched-max-memory-insns' in instruction group.
12169 Otherwise, limit is `soft' meaning that we would prefer non-memory operations
12170 when limit is reached but may still schedule memory operations.
12175 @subsection M32C Options
12176 @cindex M32C options
12179 @item -mcpu=@var{name}
12181 Select the CPU for which code is generated. @var{name} may be one of
12182 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
12183 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
12184 the M32C/80 series.
12188 Specifies that the program will be run on the simulator. This causes
12189 an alternate runtime library to be linked in which supports, for
12190 example, file I/O@. You must not use this option when generating
12191 programs that will run on real hardware; you must provide your own
12192 runtime library for whatever I/O functions are needed.
12194 @item -memregs=@var{number}
12196 Specifies the number of memory-based pseudo-registers GCC will use
12197 during code generation. These pseudo-registers will be used like real
12198 registers, so there is a tradeoff between GCC's ability to fit the
12199 code into available registers, and the performance penalty of using
12200 memory instead of registers. Note that all modules in a program must
12201 be compiled with the same value for this option. Because of that, you
12202 must not use this option with the default runtime libraries gcc
12207 @node M32R/D Options
12208 @subsection M32R/D Options
12209 @cindex M32R/D options
12211 These @option{-m} options are defined for Renesas M32R/D architectures:
12216 Generate code for the M32R/2@.
12220 Generate code for the M32R/X@.
12224 Generate code for the M32R@. This is the default.
12226 @item -mmodel=small
12227 @opindex mmodel=small
12228 Assume all objects live in the lower 16MB of memory (so that their addresses
12229 can be loaded with the @code{ld24} instruction), and assume all subroutines
12230 are reachable with the @code{bl} instruction.
12231 This is the default.
12233 The addressability of a particular object can be set with the
12234 @code{model} attribute.
12236 @item -mmodel=medium
12237 @opindex mmodel=medium
12238 Assume objects may be anywhere in the 32-bit address space (the compiler
12239 will generate @code{seth/add3} instructions to load their addresses), and
12240 assume all subroutines are reachable with the @code{bl} instruction.
12242 @item -mmodel=large
12243 @opindex mmodel=large
12244 Assume objects may be anywhere in the 32-bit address space (the compiler
12245 will generate @code{seth/add3} instructions to load their addresses), and
12246 assume subroutines may not be reachable with the @code{bl} instruction
12247 (the compiler will generate the much slower @code{seth/add3/jl}
12248 instruction sequence).
12251 @opindex msdata=none
12252 Disable use of the small data area. Variables will be put into
12253 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
12254 @code{section} attribute has been specified).
12255 This is the default.
12257 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
12258 Objects may be explicitly put in the small data area with the
12259 @code{section} attribute using one of these sections.
12261 @item -msdata=sdata
12262 @opindex msdata=sdata
12263 Put small global and static data in the small data area, but do not
12264 generate special code to reference them.
12267 @opindex msdata=use
12268 Put small global and static data in the small data area, and generate
12269 special instructions to reference them.
12273 @cindex smaller data references
12274 Put global and static objects less than or equal to @var{num} bytes
12275 into the small data or bss sections instead of the normal data or bss
12276 sections. The default value of @var{num} is 8.
12277 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
12278 for this option to have any effect.
12280 All modules should be compiled with the same @option{-G @var{num}} value.
12281 Compiling with different values of @var{num} may or may not work; if it
12282 doesn't the linker will give an error message---incorrect code will not be
12287 Makes the M32R specific code in the compiler display some statistics
12288 that might help in debugging programs.
12290 @item -malign-loops
12291 @opindex malign-loops
12292 Align all loops to a 32-byte boundary.
12294 @item -mno-align-loops
12295 @opindex mno-align-loops
12296 Do not enforce a 32-byte alignment for loops. This is the default.
12298 @item -missue-rate=@var{number}
12299 @opindex missue-rate=@var{number}
12300 Issue @var{number} instructions per cycle. @var{number} can only be 1
12303 @item -mbranch-cost=@var{number}
12304 @opindex mbranch-cost=@var{number}
12305 @var{number} can only be 1 or 2. If it is 1 then branches will be
12306 preferred over conditional code, if it is 2, then the opposite will
12309 @item -mflush-trap=@var{number}
12310 @opindex mflush-trap=@var{number}
12311 Specifies the trap number to use to flush the cache. The default is
12312 12. Valid numbers are between 0 and 15 inclusive.
12314 @item -mno-flush-trap
12315 @opindex mno-flush-trap
12316 Specifies that the cache cannot be flushed by using a trap.
12318 @item -mflush-func=@var{name}
12319 @opindex mflush-func=@var{name}
12320 Specifies the name of the operating system function to call to flush
12321 the cache. The default is @emph{_flush_cache}, but a function call
12322 will only be used if a trap is not available.
12324 @item -mno-flush-func
12325 @opindex mno-flush-func
12326 Indicates that there is no OS function for flushing the cache.
12330 @node M680x0 Options
12331 @subsection M680x0 Options
12332 @cindex M680x0 options
12334 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
12335 The default settings depend on which architecture was selected when
12336 the compiler was configured; the defaults for the most common choices
12340 @item -march=@var{arch}
12342 Generate code for a specific M680x0 or ColdFire instruction set
12343 architecture. Permissible values of @var{arch} for M680x0
12344 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
12345 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
12346 architectures are selected according to Freescale's ISA classification
12347 and the permissible values are: @samp{isaa}, @samp{isaaplus},
12348 @samp{isab} and @samp{isac}.
12350 gcc defines a macro @samp{__mcf@var{arch}__} whenever it is generating
12351 code for a ColdFire target. The @var{arch} in this macro is one of the
12352 @option{-march} arguments given above.
12354 When used together, @option{-march} and @option{-mtune} select code
12355 that runs on a family of similar processors but that is optimized
12356 for a particular microarchitecture.
12358 @item -mcpu=@var{cpu}
12360 Generate code for a specific M680x0 or ColdFire processor.
12361 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
12362 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
12363 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
12364 below, which also classifies the CPUs into families:
12366 @multitable @columnfractions 0.20 0.80
12367 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
12368 @item @samp{51} @tab @samp{51} @samp{51ac} @samp{51cn} @samp{51em} @samp{51qe}
12369 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
12370 @item @samp{5206e} @tab @samp{5206e}
12371 @item @samp{5208} @tab @samp{5207} @samp{5208}
12372 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
12373 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
12374 @item @samp{5216} @tab @samp{5214} @samp{5216}
12375 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
12376 @item @samp{5225} @tab @samp{5224} @samp{5225}
12377 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
12378 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
12379 @item @samp{5249} @tab @samp{5249}
12380 @item @samp{5250} @tab @samp{5250}
12381 @item @samp{5271} @tab @samp{5270} @samp{5271}
12382 @item @samp{5272} @tab @samp{5272}
12383 @item @samp{5275} @tab @samp{5274} @samp{5275}
12384 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
12385 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
12386 @item @samp{5307} @tab @samp{5307}
12387 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
12388 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
12389 @item @samp{5407} @tab @samp{5407}
12390 @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}
12393 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
12394 @var{arch} is compatible with @var{cpu}. Other combinations of
12395 @option{-mcpu} and @option{-march} are rejected.
12397 gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
12398 @var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}},
12399 where the value of @var{family} is given by the table above.
12401 @item -mtune=@var{tune}
12403 Tune the code for a particular microarchitecture, within the
12404 constraints set by @option{-march} and @option{-mcpu}.
12405 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
12406 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
12407 and @samp{cpu32}. The ColdFire microarchitectures
12408 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
12410 You can also use @option{-mtune=68020-40} for code that needs
12411 to run relatively well on 68020, 68030 and 68040 targets.
12412 @option{-mtune=68020-60} is similar but includes 68060 targets
12413 as well. These two options select the same tuning decisions as
12414 @option{-m68020-40} and @option{-m68020-60} respectively.
12416 gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
12417 when tuning for 680x0 architecture @var{arch}. It also defines
12418 @samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
12419 option is used. If gcc is tuning for a range of architectures,
12420 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
12421 it defines the macros for every architecture in the range.
12423 gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
12424 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
12425 of the arguments given above.
12431 Generate output for a 68000. This is the default
12432 when the compiler is configured for 68000-based systems.
12433 It is equivalent to @option{-march=68000}.
12435 Use this option for microcontrollers with a 68000 or EC000 core,
12436 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
12440 Generate output for a 68010. This is the default
12441 when the compiler is configured for 68010-based systems.
12442 It is equivalent to @option{-march=68010}.
12448 Generate output for a 68020. This is the default
12449 when the compiler is configured for 68020-based systems.
12450 It is equivalent to @option{-march=68020}.
12454 Generate output for a 68030. This is the default when the compiler is
12455 configured for 68030-based systems. It is equivalent to
12456 @option{-march=68030}.
12460 Generate output for a 68040. This is the default when the compiler is
12461 configured for 68040-based systems. It is equivalent to
12462 @option{-march=68040}.
12464 This option inhibits the use of 68881/68882 instructions that have to be
12465 emulated by software on the 68040. Use this option if your 68040 does not
12466 have code to emulate those instructions.
12470 Generate output for a 68060. This is the default when the compiler is
12471 configured for 68060-based systems. It is equivalent to
12472 @option{-march=68060}.
12474 This option inhibits the use of 68020 and 68881/68882 instructions that
12475 have to be emulated by software on the 68060. Use this option if your 68060
12476 does not have code to emulate those instructions.
12480 Generate output for a CPU32. This is the default
12481 when the compiler is configured for CPU32-based systems.
12482 It is equivalent to @option{-march=cpu32}.
12484 Use this option for microcontrollers with a
12485 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
12486 68336, 68340, 68341, 68349 and 68360.
12490 Generate output for a 520X ColdFire CPU@. This is the default
12491 when the compiler is configured for 520X-based systems.
12492 It is equivalent to @option{-mcpu=5206}, and is now deprecated
12493 in favor of that option.
12495 Use this option for microcontroller with a 5200 core, including
12496 the MCF5202, MCF5203, MCF5204 and MCF5206.
12500 Generate output for a 5206e ColdFire CPU@. The option is now
12501 deprecated in favor of the equivalent @option{-mcpu=5206e}.
12505 Generate output for a member of the ColdFire 528X family.
12506 The option is now deprecated in favor of the equivalent
12507 @option{-mcpu=528x}.
12511 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
12512 in favor of the equivalent @option{-mcpu=5307}.
12516 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
12517 in favor of the equivalent @option{-mcpu=5407}.
12521 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
12522 This includes use of hardware floating point instructions.
12523 The option is equivalent to @option{-mcpu=547x}, and is now
12524 deprecated in favor of that option.
12528 Generate output for a 68040, without using any of the new instructions.
12529 This results in code which can run relatively efficiently on either a
12530 68020/68881 or a 68030 or a 68040. The generated code does use the
12531 68881 instructions that are emulated on the 68040.
12533 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
12537 Generate output for a 68060, without using any of the new instructions.
12538 This results in code which can run relatively efficiently on either a
12539 68020/68881 or a 68030 or a 68040. The generated code does use the
12540 68881 instructions that are emulated on the 68060.
12542 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
12546 @opindex mhard-float
12548 Generate floating-point instructions. This is the default for 68020
12549 and above, and for ColdFire devices that have an FPU@. It defines the
12550 macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
12551 on ColdFire targets.
12554 @opindex msoft-float
12555 Do not generate floating-point instructions; use library calls instead.
12556 This is the default for 68000, 68010, and 68832 targets. It is also
12557 the default for ColdFire devices that have no FPU.
12563 Generate (do not generate) ColdFire hardware divide and remainder
12564 instructions. If @option{-march} is used without @option{-mcpu},
12565 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
12566 architectures. Otherwise, the default is taken from the target CPU
12567 (either the default CPU, or the one specified by @option{-mcpu}). For
12568 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
12569 @option{-mcpu=5206e}.
12571 gcc defines the macro @samp{__mcfhwdiv__} when this option is enabled.
12575 Consider type @code{int} to be 16 bits wide, like @code{short int}.
12576 Additionally, parameters passed on the stack are also aligned to a
12577 16-bit boundary even on targets whose API mandates promotion to 32-bit.
12581 Do not consider type @code{int} to be 16 bits wide. This is the default.
12584 @itemx -mno-bitfield
12585 @opindex mnobitfield
12586 @opindex mno-bitfield
12587 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
12588 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
12592 Do use the bit-field instructions. The @option{-m68020} option implies
12593 @option{-mbitfield}. This is the default if you use a configuration
12594 designed for a 68020.
12598 Use a different function-calling convention, in which functions
12599 that take a fixed number of arguments return with the @code{rtd}
12600 instruction, which pops their arguments while returning. This
12601 saves one instruction in the caller since there is no need to pop
12602 the arguments there.
12604 This calling convention is incompatible with the one normally
12605 used on Unix, so you cannot use it if you need to call libraries
12606 compiled with the Unix compiler.
12608 Also, you must provide function prototypes for all functions that
12609 take variable numbers of arguments (including @code{printf});
12610 otherwise incorrect code will be generated for calls to those
12613 In addition, seriously incorrect code will result if you call a
12614 function with too many arguments. (Normally, extra arguments are
12615 harmlessly ignored.)
12617 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
12618 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
12622 Do not use the calling conventions selected by @option{-mrtd}.
12623 This is the default.
12626 @itemx -mno-align-int
12627 @opindex malign-int
12628 @opindex mno-align-int
12629 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
12630 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
12631 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
12632 Aligning variables on 32-bit boundaries produces code that runs somewhat
12633 faster on processors with 32-bit busses at the expense of more memory.
12635 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
12636 align structures containing the above types differently than
12637 most published application binary interface specifications for the m68k.
12641 Use the pc-relative addressing mode of the 68000 directly, instead of
12642 using a global offset table. At present, this option implies @option{-fpic},
12643 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
12644 not presently supported with @option{-mpcrel}, though this could be supported for
12645 68020 and higher processors.
12647 @item -mno-strict-align
12648 @itemx -mstrict-align
12649 @opindex mno-strict-align
12650 @opindex mstrict-align
12651 Do not (do) assume that unaligned memory references will be handled by
12655 Generate code that allows the data segment to be located in a different
12656 area of memory from the text segment. This allows for execute in place in
12657 an environment without virtual memory management. This option implies
12660 @item -mno-sep-data
12661 Generate code that assumes that the data segment follows the text segment.
12662 This is the default.
12664 @item -mid-shared-library
12665 Generate code that supports shared libraries via the library ID method.
12666 This allows for execute in place and shared libraries in an environment
12667 without virtual memory management. This option implies @option{-fPIC}.
12669 @item -mno-id-shared-library
12670 Generate code that doesn't assume ID based shared libraries are being used.
12671 This is the default.
12673 @item -mshared-library-id=n
12674 Specified the identification number of the ID based shared library being
12675 compiled. Specifying a value of 0 will generate more compact code, specifying
12676 other values will force the allocation of that number to the current
12677 library but is no more space or time efficient than omitting this option.
12683 When generating position-independent code for ColdFire, generate code
12684 that works if the GOT has more than 8192 entries. This code is
12685 larger and slower than code generated without this option. On M680x0
12686 processors, this option is not needed; @option{-fPIC} suffices.
12688 GCC normally uses a single instruction to load values from the GOT@.
12689 While this is relatively efficient, it only works if the GOT
12690 is smaller than about 64k. Anything larger causes the linker
12691 to report an error such as:
12693 @cindex relocation truncated to fit (ColdFire)
12695 relocation truncated to fit: R_68K_GOT16O foobar
12698 If this happens, you should recompile your code with @option{-mxgot}.
12699 It should then work with very large GOTs. However, code generated with
12700 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
12701 the value of a global symbol.
12703 Note that some linkers, including newer versions of the GNU linker,
12704 can create multiple GOTs and sort GOT entries. If you have such a linker,
12705 you should only need to use @option{-mxgot} when compiling a single
12706 object file that accesses more than 8192 GOT entries. Very few do.
12708 These options have no effect unless GCC is generating
12709 position-independent code.
12713 @node M68hc1x Options
12714 @subsection M68hc1x Options
12715 @cindex M68hc1x options
12717 These are the @samp{-m} options defined for the 68hc11 and 68hc12
12718 microcontrollers. The default values for these options depends on
12719 which style of microcontroller was selected when the compiler was configured;
12720 the defaults for the most common choices are given below.
12727 Generate output for a 68HC11. This is the default
12728 when the compiler is configured for 68HC11-based systems.
12734 Generate output for a 68HC12. This is the default
12735 when the compiler is configured for 68HC12-based systems.
12741 Generate output for a 68HCS12.
12743 @item -mauto-incdec
12744 @opindex mauto-incdec
12745 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
12752 Enable the use of 68HC12 min and max instructions.
12755 @itemx -mno-long-calls
12756 @opindex mlong-calls
12757 @opindex mno-long-calls
12758 Treat all calls as being far away (near). If calls are assumed to be
12759 far away, the compiler will use the @code{call} instruction to
12760 call a function and the @code{rtc} instruction for returning.
12764 Consider type @code{int} to be 16 bits wide, like @code{short int}.
12766 @item -msoft-reg-count=@var{count}
12767 @opindex msoft-reg-count
12768 Specify the number of pseudo-soft registers which are used for the
12769 code generation. The maximum number is 32. Using more pseudo-soft
12770 register may or may not result in better code depending on the program.
12771 The default is 4 for 68HC11 and 2 for 68HC12.
12775 @node MCore Options
12776 @subsection MCore Options
12777 @cindex MCore options
12779 These are the @samp{-m} options defined for the Motorola M*Core
12785 @itemx -mno-hardlit
12787 @opindex mno-hardlit
12788 Inline constants into the code stream if it can be done in two
12789 instructions or less.
12795 Use the divide instruction. (Enabled by default).
12797 @item -mrelax-immediate
12798 @itemx -mno-relax-immediate
12799 @opindex mrelax-immediate
12800 @opindex mno-relax-immediate
12801 Allow arbitrary sized immediates in bit operations.
12803 @item -mwide-bitfields
12804 @itemx -mno-wide-bitfields
12805 @opindex mwide-bitfields
12806 @opindex mno-wide-bitfields
12807 Always treat bit-fields as int-sized.
12809 @item -m4byte-functions
12810 @itemx -mno-4byte-functions
12811 @opindex m4byte-functions
12812 @opindex mno-4byte-functions
12813 Force all functions to be aligned to a four byte boundary.
12815 @item -mcallgraph-data
12816 @itemx -mno-callgraph-data
12817 @opindex mcallgraph-data
12818 @opindex mno-callgraph-data
12819 Emit callgraph information.
12822 @itemx -mno-slow-bytes
12823 @opindex mslow-bytes
12824 @opindex mno-slow-bytes
12825 Prefer word access when reading byte quantities.
12827 @item -mlittle-endian
12828 @itemx -mbig-endian
12829 @opindex mlittle-endian
12830 @opindex mbig-endian
12831 Generate code for a little endian target.
12837 Generate code for the 210 processor.
12841 Assume that run-time support has been provided and so omit the
12842 simulator library (@file{libsim.a)} from the linker command line.
12844 @item -mstack-increment=@var{size}
12845 @opindex mstack-increment
12846 Set the maximum amount for a single stack increment operation. Large
12847 values can increase the speed of programs which contain functions
12848 that need a large amount of stack space, but they can also trigger a
12849 segmentation fault if the stack is extended too much. The default
12855 @subsection MeP Options
12856 @cindex MeP options
12862 Enables the @code{abs} instruction, which is the absolute difference
12863 between two registers.
12867 Enables all the optional instructions - average, multiply, divide, bit
12868 operations, leading zero, absolute difference, min/max, clip, and
12874 Enables the @code{ave} instruction, which computes the average of two
12877 @item -mbased=@var{n}
12879 Variables of size @var{n} bytes or smaller will be placed in the
12880 @code{.based} section by default. Based variables use the @code{$tp}
12881 register as a base register, and there is a 128 byte limit to the
12882 @code{.based} section.
12886 Enables the bit operation instructions - bit test (@code{btstm}), set
12887 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
12888 test-and-set (@code{tas}).
12890 @item -mc=@var{name}
12892 Selects which section constant data will be placed in. @var{name} may
12893 be @code{tiny}, @code{near}, or @code{far}.
12897 Enables the @code{clip} instruction. Note that @code{-mclip} is not
12898 useful unless you also provide @code{-mminmax}.
12900 @item -mconfig=@var{name}
12902 Selects one of the build-in core configurations. Each MeP chip has
12903 one or more modules in it; each module has a core CPU and a variety of
12904 coprocessors, optional instructions, and peripherals. The
12905 @code{MeP-Integrator} tool, not part of GCC, provides these
12906 configurations through this option; using this option is the same as
12907 using all the corresponding command line options. The default
12908 configuration is @code{default}.
12912 Enables the coprocessor instructions. By default, this is a 32-bit
12913 coprocessor. Note that the coprocessor is normally enabled via the
12914 @code{-mconfig=} option.
12918 Enables the 32-bit coprocessor's instructions.
12922 Enables the 64-bit coprocessor's instructions.
12926 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
12930 Causes constant variables to be placed in the @code{.near} section.
12934 Enables the @code{div} and @code{divu} instructions.
12938 Generate big-endian code.
12942 Generate little-endian code.
12944 @item -mio-volatile
12945 @opindex mio-volatile
12946 Tells the compiler that any variable marked with the @code{io}
12947 attribute is to be considered volatile.
12951 Causes variables to be assigned to the @code{.far} section by default.
12955 Enables the @code{leadz} (leading zero) instruction.
12959 Causes variables to be assigned to the @code{.near} section by default.
12963 Enables the @code{min} and @code{max} instructions.
12967 Enables the multiplication and multiply-accumulate instructions.
12971 Disables all the optional instructions enabled by @code{-mall-opts}.
12975 Enables the @code{repeat} and @code{erepeat} instructions, used for
12976 low-overhead looping.
12980 Causes all variables to default to the @code{.tiny} section. Note
12981 that there is a 65536 byte limit to this section. Accesses to these
12982 variables use the @code{%gp} base register.
12986 Enables the saturation instructions. Note that the compiler does not
12987 currently generate these itself, but this option is included for
12988 compatibility with other tools, like @code{as}.
12992 Link the SDRAM-based runtime instead of the default ROM-based runtime.
12996 Link the simulator runtime libraries.
13000 Link the simulator runtime libraries, excluding built-in support
13001 for reset and exception vectors and tables.
13005 Causes all functions to default to the @code{.far} section. Without
13006 this option, functions default to the @code{.near} section.
13008 @item -mtiny=@var{n}
13010 Variables that are @var{n} bytes or smaller will be allocated to the
13011 @code{.tiny} section. These variables use the @code{$gp} base
13012 register. The default for this option is 4, but note that there's a
13013 65536 byte limit to the @code{.tiny} section.
13018 @subsection MIPS Options
13019 @cindex MIPS options
13025 Generate big-endian code.
13029 Generate little-endian code. This is the default for @samp{mips*el-*-*}
13032 @item -march=@var{arch}
13034 Generate code that will run on @var{arch}, which can be the name of a
13035 generic MIPS ISA, or the name of a particular processor.
13037 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
13038 @samp{mips32}, @samp{mips32r2}, @samp{mips64} and @samp{mips64r2}.
13039 The processor names are:
13040 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
13041 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
13042 @samp{5kc}, @samp{5kf},
13044 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
13045 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
13046 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1},
13047 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
13048 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
13049 @samp{loongson2e}, @samp{loongson2f},
13053 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
13054 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
13055 @samp{rm7000}, @samp{rm9000},
13056 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
13059 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
13060 @samp{vr5000}, @samp{vr5400}, @samp{vr5500}
13062 The special value @samp{from-abi} selects the
13063 most compatible architecture for the selected ABI (that is,
13064 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
13066 Native Linux/GNU toolchains also support the value @samp{native},
13067 which selects the best architecture option for the host processor.
13068 @option{-march=native} has no effect if GCC does not recognize
13071 In processor names, a final @samp{000} can be abbreviated as @samp{k}
13072 (for example, @samp{-march=r2k}). Prefixes are optional, and
13073 @samp{vr} may be written @samp{r}.
13075 Names of the form @samp{@var{n}f2_1} refer to processors with
13076 FPUs clocked at half the rate of the core, names of the form
13077 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
13078 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
13079 processors with FPUs clocked a ratio of 3:2 with respect to the core.
13080 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
13081 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
13082 accepted as synonyms for @samp{@var{n}f1_1}.
13084 GCC defines two macros based on the value of this option. The first
13085 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
13086 a string. The second has the form @samp{_MIPS_ARCH_@var{foo}},
13087 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
13088 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
13089 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
13091 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
13092 above. In other words, it will have the full prefix and will not
13093 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
13094 the macro names the resolved architecture (either @samp{"mips1"} or
13095 @samp{"mips3"}). It names the default architecture when no
13096 @option{-march} option is given.
13098 @item -mtune=@var{arch}
13100 Optimize for @var{arch}. Among other things, this option controls
13101 the way instructions are scheduled, and the perceived cost of arithmetic
13102 operations. The list of @var{arch} values is the same as for
13105 When this option is not used, GCC will optimize for the processor
13106 specified by @option{-march}. By using @option{-march} and
13107 @option{-mtune} together, it is possible to generate code that will
13108 run on a family of processors, but optimize the code for one
13109 particular member of that family.
13111 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
13112 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
13113 @samp{-march} ones described above.
13117 Equivalent to @samp{-march=mips1}.
13121 Equivalent to @samp{-march=mips2}.
13125 Equivalent to @samp{-march=mips3}.
13129 Equivalent to @samp{-march=mips4}.
13133 Equivalent to @samp{-march=mips32}.
13137 Equivalent to @samp{-march=mips32r2}.
13141 Equivalent to @samp{-march=mips64}.
13145 Equivalent to @samp{-march=mips64r2}.
13150 @opindex mno-mips16
13151 Generate (do not generate) MIPS16 code. If GCC is targetting a
13152 MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
13154 MIPS16 code generation can also be controlled on a per-function basis
13155 by means of @code{mips16} and @code{nomips16} attributes.
13156 @xref{Function Attributes}, for more information.
13158 @item -mflip-mips16
13159 @opindex mflip-mips16
13160 Generate MIPS16 code on alternating functions. This option is provided
13161 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
13162 not intended for ordinary use in compiling user code.
13164 @item -minterlink-mips16
13165 @itemx -mno-interlink-mips16
13166 @opindex minterlink-mips16
13167 @opindex mno-interlink-mips16
13168 Require (do not require) that non-MIPS16 code be link-compatible with
13171 For example, non-MIPS16 code cannot jump directly to MIPS16 code;
13172 it must either use a call or an indirect jump. @option{-minterlink-mips16}
13173 therefore disables direct jumps unless GCC knows that the target of the
13174 jump is not MIPS16.
13186 Generate code for the given ABI@.
13188 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
13189 generates 64-bit code when you select a 64-bit architecture, but you
13190 can use @option{-mgp32} to get 32-bit code instead.
13192 For information about the O64 ABI, see
13193 @w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
13195 GCC supports a variant of the o32 ABI in which floating-point registers
13196 are 64 rather than 32 bits wide. You can select this combination with
13197 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @samp{mthc1}
13198 and @samp{mfhc1} instructions and is therefore only supported for
13199 MIPS32R2 processors.
13201 The register assignments for arguments and return values remain the
13202 same, but each scalar value is passed in a single 64-bit register
13203 rather than a pair of 32-bit registers. For example, scalar
13204 floating-point values are returned in @samp{$f0} only, not a
13205 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
13206 remains the same, but all 64 bits are saved.
13209 @itemx -mno-abicalls
13211 @opindex mno-abicalls
13212 Generate (do not generate) code that is suitable for SVR4-style
13213 dynamic objects. @option{-mabicalls} is the default for SVR4-based
13218 Generate (do not generate) code that is fully position-independent,
13219 and that can therefore be linked into shared libraries. This option
13220 only affects @option{-mabicalls}.
13222 All @option{-mabicalls} code has traditionally been position-independent,
13223 regardless of options like @option{-fPIC} and @option{-fpic}. However,
13224 as an extension, the GNU toolchain allows executables to use absolute
13225 accesses for locally-binding symbols. It can also use shorter GP
13226 initialization sequences and generate direct calls to locally-defined
13227 functions. This mode is selected by @option{-mno-shared}.
13229 @option{-mno-shared} depends on binutils 2.16 or higher and generates
13230 objects that can only be linked by the GNU linker. However, the option
13231 does not affect the ABI of the final executable; it only affects the ABI
13232 of relocatable objects. Using @option{-mno-shared} will generally make
13233 executables both smaller and quicker.
13235 @option{-mshared} is the default.
13241 Assume (do not assume) that the static and dynamic linkers
13242 support PLTs and copy relocations. This option only affects
13243 @samp{-mno-shared -mabicalls}. For the n64 ABI, this option
13244 has no effect without @samp{-msym32}.
13246 You can make @option{-mplt} the default by configuring
13247 GCC with @option{--with-mips-plt}. The default is
13248 @option{-mno-plt} otherwise.
13254 Lift (do not lift) the usual restrictions on the size of the global
13257 GCC normally uses a single instruction to load values from the GOT@.
13258 While this is relatively efficient, it will only work if the GOT
13259 is smaller than about 64k. Anything larger will cause the linker
13260 to report an error such as:
13262 @cindex relocation truncated to fit (MIPS)
13264 relocation truncated to fit: R_MIPS_GOT16 foobar
13267 If this happens, you should recompile your code with @option{-mxgot}.
13268 It should then work with very large GOTs, although it will also be
13269 less efficient, since it will take three instructions to fetch the
13270 value of a global symbol.
13272 Note that some linkers can create multiple GOTs. If you have such a
13273 linker, you should only need to use @option{-mxgot} when a single object
13274 file accesses more than 64k's worth of GOT entries. Very few do.
13276 These options have no effect unless GCC is generating position
13281 Assume that general-purpose registers are 32 bits wide.
13285 Assume that general-purpose registers are 64 bits wide.
13289 Assume that floating-point registers are 32 bits wide.
13293 Assume that floating-point registers are 64 bits wide.
13296 @opindex mhard-float
13297 Use floating-point coprocessor instructions.
13300 @opindex msoft-float
13301 Do not use floating-point coprocessor instructions. Implement
13302 floating-point calculations using library calls instead.
13304 @item -msingle-float
13305 @opindex msingle-float
13306 Assume that the floating-point coprocessor only supports single-precision
13309 @item -mdouble-float
13310 @opindex mdouble-float
13311 Assume that the floating-point coprocessor supports double-precision
13312 operations. This is the default.
13318 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
13319 implement atomic memory built-in functions. When neither option is
13320 specified, GCC will use the instructions if the target architecture
13323 @option{-mllsc} is useful if the runtime environment can emulate the
13324 instructions and @option{-mno-llsc} can be useful when compiling for
13325 nonstandard ISAs. You can make either option the default by
13326 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
13327 respectively. @option{--with-llsc} is the default for some
13328 configurations; see the installation documentation for details.
13334 Use (do not use) revision 1 of the MIPS DSP ASE@.
13335 @xref{MIPS DSP Built-in Functions}. This option defines the
13336 preprocessor macro @samp{__mips_dsp}. It also defines
13337 @samp{__mips_dsp_rev} to 1.
13343 Use (do not use) revision 2 of the MIPS DSP ASE@.
13344 @xref{MIPS DSP Built-in Functions}. This option defines the
13345 preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
13346 It also defines @samp{__mips_dsp_rev} to 2.
13349 @itemx -mno-smartmips
13350 @opindex msmartmips
13351 @opindex mno-smartmips
13352 Use (do not use) the MIPS SmartMIPS ASE.
13354 @item -mpaired-single
13355 @itemx -mno-paired-single
13356 @opindex mpaired-single
13357 @opindex mno-paired-single
13358 Use (do not use) paired-single floating-point instructions.
13359 @xref{MIPS Paired-Single Support}. This option requires
13360 hardware floating-point support to be enabled.
13366 Use (do not use) MIPS Digital Media Extension instructions.
13367 This option can only be used when generating 64-bit code and requires
13368 hardware floating-point support to be enabled.
13373 @opindex mno-mips3d
13374 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
13375 The option @option{-mips3d} implies @option{-mpaired-single}.
13381 Use (do not use) MT Multithreading instructions.
13385 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
13386 an explanation of the default and the way that the pointer size is
13391 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
13393 The default size of @code{int}s, @code{long}s and pointers depends on
13394 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
13395 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
13396 32-bit @code{long}s. Pointers are the same size as @code{long}s,
13397 or the same size as integer registers, whichever is smaller.
13403 Assume (do not assume) that all symbols have 32-bit values, regardless
13404 of the selected ABI@. This option is useful in combination with
13405 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
13406 to generate shorter and faster references to symbolic addresses.
13410 Put definitions of externally-visible data in a small data section
13411 if that data is no bigger than @var{num} bytes. GCC can then access
13412 the data more efficiently; see @option{-mgpopt} for details.
13414 The default @option{-G} option depends on the configuration.
13416 @item -mlocal-sdata
13417 @itemx -mno-local-sdata
13418 @opindex mlocal-sdata
13419 @opindex mno-local-sdata
13420 Extend (do not extend) the @option{-G} behavior to local data too,
13421 such as to static variables in C@. @option{-mlocal-sdata} is the
13422 default for all configurations.
13424 If the linker complains that an application is using too much small data,
13425 you might want to try rebuilding the less performance-critical parts with
13426 @option{-mno-local-sdata}. You might also want to build large
13427 libraries with @option{-mno-local-sdata}, so that the libraries leave
13428 more room for the main program.
13430 @item -mextern-sdata
13431 @itemx -mno-extern-sdata
13432 @opindex mextern-sdata
13433 @opindex mno-extern-sdata
13434 Assume (do not assume) that externally-defined data will be in
13435 a small data section if that data is within the @option{-G} limit.
13436 @option{-mextern-sdata} is the default for all configurations.
13438 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
13439 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
13440 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
13441 is placed in a small data section. If @var{Var} is defined by another
13442 module, you must either compile that module with a high-enough
13443 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
13444 definition. If @var{Var} is common, you must link the application
13445 with a high-enough @option{-G} setting.
13447 The easiest way of satisfying these restrictions is to compile
13448 and link every module with the same @option{-G} option. However,
13449 you may wish to build a library that supports several different
13450 small data limits. You can do this by compiling the library with
13451 the highest supported @option{-G} setting and additionally using
13452 @option{-mno-extern-sdata} to stop the library from making assumptions
13453 about externally-defined data.
13459 Use (do not use) GP-relative accesses for symbols that are known to be
13460 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
13461 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
13464 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
13465 might not hold the value of @code{_gp}. For example, if the code is
13466 part of a library that might be used in a boot monitor, programs that
13467 call boot monitor routines will pass an unknown value in @code{$gp}.
13468 (In such situations, the boot monitor itself would usually be compiled
13469 with @option{-G0}.)
13471 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
13472 @option{-mno-extern-sdata}.
13474 @item -membedded-data
13475 @itemx -mno-embedded-data
13476 @opindex membedded-data
13477 @opindex mno-embedded-data
13478 Allocate variables to the read-only data section first if possible, then
13479 next in the small data section if possible, otherwise in data. This gives
13480 slightly slower code than the default, but reduces the amount of RAM required
13481 when executing, and thus may be preferred for some embedded systems.
13483 @item -muninit-const-in-rodata
13484 @itemx -mno-uninit-const-in-rodata
13485 @opindex muninit-const-in-rodata
13486 @opindex mno-uninit-const-in-rodata
13487 Put uninitialized @code{const} variables in the read-only data section.
13488 This option is only meaningful in conjunction with @option{-membedded-data}.
13490 @item -mcode-readable=@var{setting}
13491 @opindex mcode-readable
13492 Specify whether GCC may generate code that reads from executable sections.
13493 There are three possible settings:
13496 @item -mcode-readable=yes
13497 Instructions may freely access executable sections. This is the
13500 @item -mcode-readable=pcrel
13501 MIPS16 PC-relative load instructions can access executable sections,
13502 but other instructions must not do so. This option is useful on 4KSc
13503 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
13504 It is also useful on processors that can be configured to have a dual
13505 instruction/data SRAM interface and that, like the M4K, automatically
13506 redirect PC-relative loads to the instruction RAM.
13508 @item -mcode-readable=no
13509 Instructions must not access executable sections. This option can be
13510 useful on targets that are configured to have a dual instruction/data
13511 SRAM interface but that (unlike the M4K) do not automatically redirect
13512 PC-relative loads to the instruction RAM.
13515 @item -msplit-addresses
13516 @itemx -mno-split-addresses
13517 @opindex msplit-addresses
13518 @opindex mno-split-addresses
13519 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
13520 relocation operators. This option has been superseded by
13521 @option{-mexplicit-relocs} but is retained for backwards compatibility.
13523 @item -mexplicit-relocs
13524 @itemx -mno-explicit-relocs
13525 @opindex mexplicit-relocs
13526 @opindex mno-explicit-relocs
13527 Use (do not use) assembler relocation operators when dealing with symbolic
13528 addresses. The alternative, selected by @option{-mno-explicit-relocs},
13529 is to use assembler macros instead.
13531 @option{-mexplicit-relocs} is the default if GCC was configured
13532 to use an assembler that supports relocation operators.
13534 @item -mcheck-zero-division
13535 @itemx -mno-check-zero-division
13536 @opindex mcheck-zero-division
13537 @opindex mno-check-zero-division
13538 Trap (do not trap) on integer division by zero.
13540 The default is @option{-mcheck-zero-division}.
13542 @item -mdivide-traps
13543 @itemx -mdivide-breaks
13544 @opindex mdivide-traps
13545 @opindex mdivide-breaks
13546 MIPS systems check for division by zero by generating either a
13547 conditional trap or a break instruction. Using traps results in
13548 smaller code, but is only supported on MIPS II and later. Also, some
13549 versions of the Linux kernel have a bug that prevents trap from
13550 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
13551 allow conditional traps on architectures that support them and
13552 @option{-mdivide-breaks} to force the use of breaks.
13554 The default is usually @option{-mdivide-traps}, but this can be
13555 overridden at configure time using @option{--with-divide=breaks}.
13556 Divide-by-zero checks can be completely disabled using
13557 @option{-mno-check-zero-division}.
13562 @opindex mno-memcpy
13563 Force (do not force) the use of @code{memcpy()} for non-trivial block
13564 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
13565 most constant-sized copies.
13568 @itemx -mno-long-calls
13569 @opindex mlong-calls
13570 @opindex mno-long-calls
13571 Disable (do not disable) use of the @code{jal} instruction. Calling
13572 functions using @code{jal} is more efficient but requires the caller
13573 and callee to be in the same 256 megabyte segment.
13575 This option has no effect on abicalls code. The default is
13576 @option{-mno-long-calls}.
13582 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
13583 instructions, as provided by the R4650 ISA@.
13586 @itemx -mno-fused-madd
13587 @opindex mfused-madd
13588 @opindex mno-fused-madd
13589 Enable (disable) use of the floating point multiply-accumulate
13590 instructions, when they are available. The default is
13591 @option{-mfused-madd}.
13593 When multiply-accumulate instructions are used, the intermediate
13594 product is calculated to infinite precision and is not subject to
13595 the FCSR Flush to Zero bit. This may be undesirable in some
13600 Tell the MIPS assembler to not run its preprocessor over user
13601 assembler files (with a @samp{.s} suffix) when assembling them.
13604 @itemx -mno-fix-r4000
13605 @opindex mfix-r4000
13606 @opindex mno-fix-r4000
13607 Work around certain R4000 CPU errata:
13610 A double-word or a variable shift may give an incorrect result if executed
13611 immediately after starting an integer division.
13613 A double-word or a variable shift may give an incorrect result if executed
13614 while an integer multiplication is in progress.
13616 An integer division may give an incorrect result if started in a delay slot
13617 of a taken branch or a jump.
13621 @itemx -mno-fix-r4400
13622 @opindex mfix-r4400
13623 @opindex mno-fix-r4400
13624 Work around certain R4400 CPU errata:
13627 A double-word or a variable shift may give an incorrect result if executed
13628 immediately after starting an integer division.
13632 @itemx -mno-fix-r10000
13633 @opindex mfix-r10000
13634 @opindex mno-fix-r10000
13635 Work around certain R10000 errata:
13638 @code{ll}/@code{sc} sequences may not behave atomically on revisions
13639 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
13642 This option can only be used if the target architecture supports
13643 branch-likely instructions. @option{-mfix-r10000} is the default when
13644 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
13648 @itemx -mno-fix-vr4120
13649 @opindex mfix-vr4120
13650 Work around certain VR4120 errata:
13653 @code{dmultu} does not always produce the correct result.
13655 @code{div} and @code{ddiv} do not always produce the correct result if one
13656 of the operands is negative.
13658 The workarounds for the division errata rely on special functions in
13659 @file{libgcc.a}. At present, these functions are only provided by
13660 the @code{mips64vr*-elf} configurations.
13662 Other VR4120 errata require a nop to be inserted between certain pairs of
13663 instructions. These errata are handled by the assembler, not by GCC itself.
13666 @opindex mfix-vr4130
13667 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
13668 workarounds are implemented by the assembler rather than by GCC,
13669 although GCC will avoid using @code{mflo} and @code{mfhi} if the
13670 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
13671 instructions are available instead.
13674 @itemx -mno-fix-sb1
13676 Work around certain SB-1 CPU core errata.
13677 (This flag currently works around the SB-1 revision 2
13678 ``F1'' and ``F2'' floating point errata.)
13680 @item -mr10k-cache-barrier=@var{setting}
13681 @opindex mr10k-cache-barrier
13682 Specify whether GCC should insert cache barriers to avoid the
13683 side-effects of speculation on R10K processors.
13685 In common with many processors, the R10K tries to predict the outcome
13686 of a conditional branch and speculatively executes instructions from
13687 the ``taken'' branch. It later aborts these instructions if the
13688 predicted outcome was wrong. However, on the R10K, even aborted
13689 instructions can have side effects.
13691 This problem only affects kernel stores and, depending on the system,
13692 kernel loads. As an example, a speculatively-executed store may load
13693 the target memory into cache and mark the cache line as dirty, even if
13694 the store itself is later aborted. If a DMA operation writes to the
13695 same area of memory before the ``dirty'' line is flushed, the cached
13696 data will overwrite the DMA-ed data. See the R10K processor manual
13697 for a full description, including other potential problems.
13699 One workaround is to insert cache barrier instructions before every memory
13700 access that might be speculatively executed and that might have side
13701 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
13702 controls GCC's implementation of this workaround. It assumes that
13703 aborted accesses to any byte in the following regions will not have
13708 the memory occupied by the current function's stack frame;
13711 the memory occupied by an incoming stack argument;
13714 the memory occupied by an object with a link-time-constant address.
13717 It is the kernel's responsibility to ensure that speculative
13718 accesses to these regions are indeed safe.
13720 If the input program contains a function declaration such as:
13726 then the implementation of @code{foo} must allow @code{j foo} and
13727 @code{jal foo} to be executed speculatively. GCC honors this
13728 restriction for functions it compiles itself. It expects non-GCC
13729 functions (such as hand-written assembly code) to do the same.
13731 The option has three forms:
13734 @item -mr10k-cache-barrier=load-store
13735 Insert a cache barrier before a load or store that might be
13736 speculatively executed and that might have side effects even
13739 @item -mr10k-cache-barrier=store
13740 Insert a cache barrier before a store that might be speculatively
13741 executed and that might have side effects even if aborted.
13743 @item -mr10k-cache-barrier=none
13744 Disable the insertion of cache barriers. This is the default setting.
13747 @item -mflush-func=@var{func}
13748 @itemx -mno-flush-func
13749 @opindex mflush-func
13750 Specifies the function to call to flush the I and D caches, or to not
13751 call any such function. If called, the function must take the same
13752 arguments as the common @code{_flush_func()}, that is, the address of the
13753 memory range for which the cache is being flushed, the size of the
13754 memory range, and the number 3 (to flush both caches). The default
13755 depends on the target GCC was configured for, but commonly is either
13756 @samp{_flush_func} or @samp{__cpu_flush}.
13758 @item mbranch-cost=@var{num}
13759 @opindex mbranch-cost
13760 Set the cost of branches to roughly @var{num} ``simple'' instructions.
13761 This cost is only a heuristic and is not guaranteed to produce
13762 consistent results across releases. A zero cost redundantly selects
13763 the default, which is based on the @option{-mtune} setting.
13765 @item -mbranch-likely
13766 @itemx -mno-branch-likely
13767 @opindex mbranch-likely
13768 @opindex mno-branch-likely
13769 Enable or disable use of Branch Likely instructions, regardless of the
13770 default for the selected architecture. By default, Branch Likely
13771 instructions may be generated if they are supported by the selected
13772 architecture. An exception is for the MIPS32 and MIPS64 architectures
13773 and processors which implement those architectures; for those, Branch
13774 Likely instructions will not be generated by default because the MIPS32
13775 and MIPS64 architectures specifically deprecate their use.
13777 @item -mfp-exceptions
13778 @itemx -mno-fp-exceptions
13779 @opindex mfp-exceptions
13780 Specifies whether FP exceptions are enabled. This affects how we schedule
13781 FP instructions for some processors. The default is that FP exceptions are
13784 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
13785 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
13788 @item -mvr4130-align
13789 @itemx -mno-vr4130-align
13790 @opindex mvr4130-align
13791 The VR4130 pipeline is two-way superscalar, but can only issue two
13792 instructions together if the first one is 8-byte aligned. When this
13793 option is enabled, GCC will align pairs of instructions that it
13794 thinks should execute in parallel.
13796 This option only has an effect when optimizing for the VR4130.
13797 It normally makes code faster, but at the expense of making it bigger.
13798 It is enabled by default at optimization level @option{-O3}.
13803 Enable (disable) generation of @code{synci} instructions on
13804 architectures that support it. The @code{synci} instructions (if
13805 enabled) will be generated when @code{__builtin___clear_cache()} is
13808 This option defaults to @code{-mno-synci}, but the default can be
13809 overridden by configuring with @code{--with-synci}.
13811 When compiling code for single processor systems, it is generally safe
13812 to use @code{synci}. However, on many multi-core (SMP) systems, it
13813 will not invalidate the instruction caches on all cores and may lead
13814 to undefined behavior.
13818 @subsection MMIX Options
13819 @cindex MMIX Options
13821 These options are defined for the MMIX:
13825 @itemx -mno-libfuncs
13827 @opindex mno-libfuncs
13828 Specify that intrinsic library functions are being compiled, passing all
13829 values in registers, no matter the size.
13832 @itemx -mno-epsilon
13834 @opindex mno-epsilon
13835 Generate floating-point comparison instructions that compare with respect
13836 to the @code{rE} epsilon register.
13838 @item -mabi=mmixware
13840 @opindex mabi=mmixware
13842 Generate code that passes function parameters and return values that (in
13843 the called function) are seen as registers @code{$0} and up, as opposed to
13844 the GNU ABI which uses global registers @code{$231} and up.
13846 @item -mzero-extend
13847 @itemx -mno-zero-extend
13848 @opindex mzero-extend
13849 @opindex mno-zero-extend
13850 When reading data from memory in sizes shorter than 64 bits, use (do not
13851 use) zero-extending load instructions by default, rather than
13852 sign-extending ones.
13855 @itemx -mno-knuthdiv
13857 @opindex mno-knuthdiv
13858 Make the result of a division yielding a remainder have the same sign as
13859 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
13860 remainder follows the sign of the dividend. Both methods are
13861 arithmetically valid, the latter being almost exclusively used.
13863 @item -mtoplevel-symbols
13864 @itemx -mno-toplevel-symbols
13865 @opindex mtoplevel-symbols
13866 @opindex mno-toplevel-symbols
13867 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
13868 code can be used with the @code{PREFIX} assembly directive.
13872 Generate an executable in the ELF format, rather than the default
13873 @samp{mmo} format used by the @command{mmix} simulator.
13875 @item -mbranch-predict
13876 @itemx -mno-branch-predict
13877 @opindex mbranch-predict
13878 @opindex mno-branch-predict
13879 Use (do not use) the probable-branch instructions, when static branch
13880 prediction indicates a probable branch.
13882 @item -mbase-addresses
13883 @itemx -mno-base-addresses
13884 @opindex mbase-addresses
13885 @opindex mno-base-addresses
13886 Generate (do not generate) code that uses @emph{base addresses}. Using a
13887 base address automatically generates a request (handled by the assembler
13888 and the linker) for a constant to be set up in a global register. The
13889 register is used for one or more base address requests within the range 0
13890 to 255 from the value held in the register. The generally leads to short
13891 and fast code, but the number of different data items that can be
13892 addressed is limited. This means that a program that uses lots of static
13893 data may require @option{-mno-base-addresses}.
13895 @item -msingle-exit
13896 @itemx -mno-single-exit
13897 @opindex msingle-exit
13898 @opindex mno-single-exit
13899 Force (do not force) generated code to have a single exit point in each
13903 @node MN10300 Options
13904 @subsection MN10300 Options
13905 @cindex MN10300 options
13907 These @option{-m} options are defined for Matsushita MN10300 architectures:
13912 Generate code to avoid bugs in the multiply instructions for the MN10300
13913 processors. This is the default.
13915 @item -mno-mult-bug
13916 @opindex mno-mult-bug
13917 Do not generate code to avoid bugs in the multiply instructions for the
13918 MN10300 processors.
13922 Generate code which uses features specific to the AM33 processor.
13926 Do not generate code which uses features specific to the AM33 processor. This
13929 @item -mreturn-pointer-on-d0
13930 @opindex mreturn-pointer-on-d0
13931 When generating a function which returns a pointer, return the pointer
13932 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
13933 only in a0, and attempts to call such functions without a prototype
13934 would result in errors. Note that this option is on by default; use
13935 @option{-mno-return-pointer-on-d0} to disable it.
13939 Do not link in the C run-time initialization object file.
13943 Indicate to the linker that it should perform a relaxation optimization pass
13944 to shorten branches, calls and absolute memory addresses. This option only
13945 has an effect when used on the command line for the final link step.
13947 This option makes symbolic debugging impossible.
13950 @node PDP-11 Options
13951 @subsection PDP-11 Options
13952 @cindex PDP-11 Options
13954 These options are defined for the PDP-11:
13959 Use hardware FPP floating point. This is the default. (FIS floating
13960 point on the PDP-11/40 is not supported.)
13963 @opindex msoft-float
13964 Do not use hardware floating point.
13968 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
13972 Return floating-point results in memory. This is the default.
13976 Generate code for a PDP-11/40.
13980 Generate code for a PDP-11/45. This is the default.
13984 Generate code for a PDP-11/10.
13986 @item -mbcopy-builtin
13987 @opindex mbcopy-builtin
13988 Use inline @code{movmemhi} patterns for copying memory. This is the
13993 Do not use inline @code{movmemhi} patterns for copying memory.
13999 Use 16-bit @code{int}. This is the default.
14005 Use 32-bit @code{int}.
14008 @itemx -mno-float32
14010 @opindex mno-float32
14011 Use 64-bit @code{float}. This is the default.
14014 @itemx -mno-float64
14016 @opindex mno-float64
14017 Use 32-bit @code{float}.
14021 Use @code{abshi2} pattern. This is the default.
14025 Do not use @code{abshi2} pattern.
14027 @item -mbranch-expensive
14028 @opindex mbranch-expensive
14029 Pretend that branches are expensive. This is for experimenting with
14030 code generation only.
14032 @item -mbranch-cheap
14033 @opindex mbranch-cheap
14034 Do not pretend that branches are expensive. This is the default.
14038 Generate code for a system with split I&D@.
14042 Generate code for a system without split I&D@. This is the default.
14046 Use Unix assembler syntax. This is the default when configured for
14047 @samp{pdp11-*-bsd}.
14051 Use DEC assembler syntax. This is the default when configured for any
14052 PDP-11 target other than @samp{pdp11-*-bsd}.
14055 @node picoChip Options
14056 @subsection picoChip Options
14057 @cindex picoChip options
14059 These @samp{-m} options are defined for picoChip implementations:
14063 @item -mae=@var{ae_type}
14065 Set the instruction set, register set, and instruction scheduling
14066 parameters for array element type @var{ae_type}. Supported values
14067 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
14069 @option{-mae=ANY} selects a completely generic AE type. Code
14070 generated with this option will run on any of the other AE types. The
14071 code will not be as efficient as it would be if compiled for a specific
14072 AE type, and some types of operation (e.g., multiplication) will not
14073 work properly on all types of AE.
14075 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
14076 for compiled code, and is the default.
14078 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
14079 option may suffer from poor performance of byte (char) manipulation,
14080 since the DSP AE does not provide hardware support for byte load/stores.
14082 @item -msymbol-as-address
14083 Enable the compiler to directly use a symbol name as an address in a
14084 load/store instruction, without first loading it into a
14085 register. Typically, the use of this option will generate larger
14086 programs, which run faster than when the option isn't used. However, the
14087 results vary from program to program, so it is left as a user option,
14088 rather than being permanently enabled.
14090 @item -mno-inefficient-warnings
14091 Disables warnings about the generation of inefficient code. These
14092 warnings can be generated, for example, when compiling code which
14093 performs byte-level memory operations on the MAC AE type. The MAC AE has
14094 no hardware support for byte-level memory operations, so all byte
14095 load/stores must be synthesized from word load/store operations. This is
14096 inefficient and a warning will be generated indicating to the programmer
14097 that they should rewrite the code to avoid byte operations, or to target
14098 an AE type which has the necessary hardware support. This option enables
14099 the warning to be turned off.
14103 @node PowerPC Options
14104 @subsection PowerPC Options
14105 @cindex PowerPC options
14107 These are listed under @xref{RS/6000 and PowerPC Options}.
14109 @node RS/6000 and PowerPC Options
14110 @subsection IBM RS/6000 and PowerPC Options
14111 @cindex RS/6000 and PowerPC Options
14112 @cindex IBM RS/6000 and PowerPC Options
14114 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
14121 @itemx -mno-powerpc
14122 @itemx -mpowerpc-gpopt
14123 @itemx -mno-powerpc-gpopt
14124 @itemx -mpowerpc-gfxopt
14125 @itemx -mno-powerpc-gfxopt
14127 @itemx -mno-powerpc64
14131 @itemx -mno-popcntb
14133 @itemx -mno-popcntd
14141 @itemx -mno-hard-dfp
14145 @opindex mno-power2
14147 @opindex mno-powerpc
14148 @opindex mpowerpc-gpopt
14149 @opindex mno-powerpc-gpopt
14150 @opindex mpowerpc-gfxopt
14151 @opindex mno-powerpc-gfxopt
14152 @opindex mpowerpc64
14153 @opindex mno-powerpc64
14157 @opindex mno-popcntb
14159 @opindex mno-popcntd
14165 @opindex mno-mfpgpr
14167 @opindex mno-hard-dfp
14168 GCC supports two related instruction set architectures for the
14169 RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
14170 instructions supported by the @samp{rios} chip set used in the original
14171 RS/6000 systems and the @dfn{PowerPC} instruction set is the
14172 architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
14173 the IBM 4xx, 6xx, and follow-on microprocessors.
14175 Neither architecture is a subset of the other. However there is a
14176 large common subset of instructions supported by both. An MQ
14177 register is included in processors supporting the POWER architecture.
14179 You use these options to specify which instructions are available on the
14180 processor you are using. The default value of these options is
14181 determined when configuring GCC@. Specifying the
14182 @option{-mcpu=@var{cpu_type}} overrides the specification of these
14183 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
14184 rather than the options listed above.
14186 The @option{-mpower} option allows GCC to generate instructions that
14187 are found only in the POWER architecture and to use the MQ register.
14188 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
14189 to generate instructions that are present in the POWER2 architecture but
14190 not the original POWER architecture.
14192 The @option{-mpowerpc} option allows GCC to generate instructions that
14193 are found only in the 32-bit subset of the PowerPC architecture.
14194 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
14195 GCC to use the optional PowerPC architecture instructions in the
14196 General Purpose group, including floating-point square root. Specifying
14197 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
14198 use the optional PowerPC architecture instructions in the Graphics
14199 group, including floating-point select.
14201 The @option{-mmfcrf} option allows GCC to generate the move from
14202 condition register field instruction implemented on the POWER4
14203 processor and other processors that support the PowerPC V2.01
14205 The @option{-mpopcntb} option allows GCC to generate the popcount and
14206 double precision FP reciprocal estimate instruction implemented on the
14207 POWER5 processor and other processors that support the PowerPC V2.02
14209 The @option{-mpopcntd} option allows GCC to generate the popcount
14210 instruction implemented on the POWER7 processor and other processors
14211 that support the PowerPC V2.06 architecture.
14212 The @option{-mfprnd} option allows GCC to generate the FP round to
14213 integer instructions implemented on the POWER5+ processor and other
14214 processors that support the PowerPC V2.03 architecture.
14215 The @option{-mcmpb} option allows GCC to generate the compare bytes
14216 instruction implemented on the POWER6 processor and other processors
14217 that support the PowerPC V2.05 architecture.
14218 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
14219 general purpose register instructions implemented on the POWER6X
14220 processor and other processors that support the extended PowerPC V2.05
14222 The @option{-mhard-dfp} option allows GCC to generate the decimal floating
14223 point instructions implemented on some POWER processors.
14225 The @option{-mpowerpc64} option allows GCC to generate the additional
14226 64-bit instructions that are found in the full PowerPC64 architecture
14227 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
14228 @option{-mno-powerpc64}.
14230 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
14231 will use only the instructions in the common subset of both
14232 architectures plus some special AIX common-mode calls, and will not use
14233 the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc}
14234 permits GCC to use any instruction from either architecture and to
14235 allow use of the MQ register; specify this for the Motorola MPC601.
14237 @item -mnew-mnemonics
14238 @itemx -mold-mnemonics
14239 @opindex mnew-mnemonics
14240 @opindex mold-mnemonics
14241 Select which mnemonics to use in the generated assembler code. With
14242 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
14243 the PowerPC architecture. With @option{-mold-mnemonics} it uses the
14244 assembler mnemonics defined for the POWER architecture. Instructions
14245 defined in only one architecture have only one mnemonic; GCC uses that
14246 mnemonic irrespective of which of these options is specified.
14248 GCC defaults to the mnemonics appropriate for the architecture in
14249 use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
14250 value of these option. Unless you are building a cross-compiler, you
14251 should normally not specify either @option{-mnew-mnemonics} or
14252 @option{-mold-mnemonics}, but should instead accept the default.
14254 @item -mcpu=@var{cpu_type}
14256 Set architecture type, register usage, choice of mnemonics, and
14257 instruction scheduling parameters for machine type @var{cpu_type}.
14258 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
14259 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
14260 @samp{505}, @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
14261 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
14262 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
14263 @samp{860}, @samp{970}, @samp{8540}, @samp{e300c2}, @samp{e300c3},
14264 @samp{e500mc}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
14265 @samp{power}, @samp{power2}, @samp{power3}, @samp{power4},
14266 @samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x}, @samp{power7}
14267 @samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
14268 @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
14270 @option{-mcpu=common} selects a completely generic processor. Code
14271 generated under this option will run on any POWER or PowerPC processor.
14272 GCC will use only the instructions in the common subset of both
14273 architectures, and will not use the MQ register. GCC assumes a generic
14274 processor model for scheduling purposes.
14276 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
14277 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
14278 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
14279 types, with an appropriate, generic processor model assumed for
14280 scheduling purposes.
14282 The other options specify a specific processor. Code generated under
14283 those options will run best on that processor, and may not run at all on
14286 The @option{-mcpu} options automatically enable or disable the
14289 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
14290 -mnew-mnemonics -mpopcntb -mpopcntd -mpower -mpower2 -mpowerpc64 @gol
14291 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
14292 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx}
14294 The particular options set for any particular CPU will vary between
14295 compiler versions, depending on what setting seems to produce optimal
14296 code for that CPU; it doesn't necessarily reflect the actual hardware's
14297 capabilities. If you wish to set an individual option to a particular
14298 value, you may specify it after the @option{-mcpu} option, like
14299 @samp{-mcpu=970 -mno-altivec}.
14301 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
14302 not enabled or disabled by the @option{-mcpu} option at present because
14303 AIX does not have full support for these options. You may still
14304 enable or disable them individually if you're sure it'll work in your
14307 @item -mtune=@var{cpu_type}
14309 Set the instruction scheduling parameters for machine type
14310 @var{cpu_type}, but do not set the architecture type, register usage, or
14311 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same
14312 values for @var{cpu_type} are used for @option{-mtune} as for
14313 @option{-mcpu}. If both are specified, the code generated will use the
14314 architecture, registers, and mnemonics set by @option{-mcpu}, but the
14315 scheduling parameters set by @option{-mtune}.
14321 Generate code to compute division as reciprocal estimate and iterative
14322 refinement, creating opportunities for increased throughput. This
14323 feature requires: optional PowerPC Graphics instruction set for single
14324 precision and FRE instruction for double precision, assuming divides
14325 cannot generate user-visible traps, and the domain values not include
14326 Infinities, denormals or zero denominator.
14329 @itemx -mno-altivec
14331 @opindex mno-altivec
14332 Generate code that uses (does not use) AltiVec instructions, and also
14333 enable the use of built-in functions that allow more direct access to
14334 the AltiVec instruction set. You may also need to set
14335 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
14341 @opindex mno-vrsave
14342 Generate VRSAVE instructions when generating AltiVec code.
14344 @item -mgen-cell-microcode
14345 @opindex mgen-cell-microcode
14346 Generate Cell microcode instructions
14348 @item -mwarn-cell-microcode
14349 @opindex mwarn-cell-microcode
14350 Warning when a Cell microcode instruction is going to emitted. An example
14351 of a Cell microcode instruction is a variable shift.
14354 @opindex msecure-plt
14355 Generate code that allows ld and ld.so to build executables and shared
14356 libraries with non-exec .plt and .got sections. This is a PowerPC
14357 32-bit SYSV ABI option.
14361 Generate code that uses a BSS .plt section that ld.so fills in, and
14362 requires .plt and .got sections that are both writable and executable.
14363 This is a PowerPC 32-bit SYSV ABI option.
14369 This switch enables or disables the generation of ISEL instructions.
14371 @item -misel=@var{yes/no}
14372 This switch has been deprecated. Use @option{-misel} and
14373 @option{-mno-isel} instead.
14379 This switch enables or disables the generation of SPE simd
14385 @opindex mno-paired
14386 This switch enables or disables the generation of PAIRED simd
14389 @item -mspe=@var{yes/no}
14390 This option has been deprecated. Use @option{-mspe} and
14391 @option{-mno-spe} instead.
14397 Generate code that uses (does not use) vector/scalar (VSX)
14398 instructions, and also enable the use of built-in functions that allow
14399 more direct access to the VSX instruction set.
14401 @item -mfloat-gprs=@var{yes/single/double/no}
14402 @itemx -mfloat-gprs
14403 @opindex mfloat-gprs
14404 This switch enables or disables the generation of floating point
14405 operations on the general purpose registers for architectures that
14408 The argument @var{yes} or @var{single} enables the use of
14409 single-precision floating point operations.
14411 The argument @var{double} enables the use of single and
14412 double-precision floating point operations.
14414 The argument @var{no} disables floating point operations on the
14415 general purpose registers.
14417 This option is currently only available on the MPC854x.
14423 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
14424 targets (including GNU/Linux). The 32-bit environment sets int, long
14425 and pointer to 32 bits and generates code that runs on any PowerPC
14426 variant. The 64-bit environment sets int to 32 bits and long and
14427 pointer to 64 bits, and generates code for PowerPC64, as for
14428 @option{-mpowerpc64}.
14431 @itemx -mno-fp-in-toc
14432 @itemx -mno-sum-in-toc
14433 @itemx -mminimal-toc
14435 @opindex mno-fp-in-toc
14436 @opindex mno-sum-in-toc
14437 @opindex mminimal-toc
14438 Modify generation of the TOC (Table Of Contents), which is created for
14439 every executable file. The @option{-mfull-toc} option is selected by
14440 default. In that case, GCC will allocate at least one TOC entry for
14441 each unique non-automatic variable reference in your program. GCC
14442 will also place floating-point constants in the TOC@. However, only
14443 16,384 entries are available in the TOC@.
14445 If you receive a linker error message that saying you have overflowed
14446 the available TOC space, you can reduce the amount of TOC space used
14447 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
14448 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
14449 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
14450 generate code to calculate the sum of an address and a constant at
14451 run-time instead of putting that sum into the TOC@. You may specify one
14452 or both of these options. Each causes GCC to produce very slightly
14453 slower and larger code at the expense of conserving TOC space.
14455 If you still run out of space in the TOC even when you specify both of
14456 these options, specify @option{-mminimal-toc} instead. This option causes
14457 GCC to make only one TOC entry for every file. When you specify this
14458 option, GCC will produce code that is slower and larger but which
14459 uses extremely little TOC space. You may wish to use this option
14460 only on files that contain less frequently executed code.
14466 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
14467 @code{long} type, and the infrastructure needed to support them.
14468 Specifying @option{-maix64} implies @option{-mpowerpc64} and
14469 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
14470 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
14473 @itemx -mno-xl-compat
14474 @opindex mxl-compat
14475 @opindex mno-xl-compat
14476 Produce code that conforms more closely to IBM XL compiler semantics
14477 when using AIX-compatible ABI@. Pass floating-point arguments to
14478 prototyped functions beyond the register save area (RSA) on the stack
14479 in addition to argument FPRs. Do not assume that most significant
14480 double in 128-bit long double value is properly rounded when comparing
14481 values and converting to double. Use XL symbol names for long double
14484 The AIX calling convention was extended but not initially documented to
14485 handle an obscure K&R C case of calling a function that takes the
14486 address of its arguments with fewer arguments than declared. IBM XL
14487 compilers access floating point arguments which do not fit in the
14488 RSA from the stack when a subroutine is compiled without
14489 optimization. Because always storing floating-point arguments on the
14490 stack is inefficient and rarely needed, this option is not enabled by
14491 default and only is necessary when calling subroutines compiled by IBM
14492 XL compilers without optimization.
14496 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
14497 application written to use message passing with special startup code to
14498 enable the application to run. The system must have PE installed in the
14499 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
14500 must be overridden with the @option{-specs=} option to specify the
14501 appropriate directory location. The Parallel Environment does not
14502 support threads, so the @option{-mpe} option and the @option{-pthread}
14503 option are incompatible.
14505 @item -malign-natural
14506 @itemx -malign-power
14507 @opindex malign-natural
14508 @opindex malign-power
14509 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
14510 @option{-malign-natural} overrides the ABI-defined alignment of larger
14511 types, such as floating-point doubles, on their natural size-based boundary.
14512 The option @option{-malign-power} instructs GCC to follow the ABI-specified
14513 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
14515 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
14519 @itemx -mhard-float
14520 @opindex msoft-float
14521 @opindex mhard-float
14522 Generate code that does not use (uses) the floating-point register set.
14523 Software floating point emulation is provided if you use the
14524 @option{-msoft-float} option, and pass the option to GCC when linking.
14526 @item -msingle-float
14527 @itemx -mdouble-float
14528 @opindex msingle-float
14529 @opindex mdouble-float
14530 Generate code for single or double-precision floating point operations.
14531 @option{-mdouble-float} implies @option{-msingle-float}.
14534 @opindex msimple-fpu
14535 Do not generate sqrt and div instructions for hardware floating point unit.
14539 Specify type of floating point unit. Valid values are @var{sp_lite}
14540 (equivalent to -msingle-float -msimple-fpu), @var{dp_lite} (equivalent
14541 to -mdouble-float -msimple-fpu), @var{sp_full} (equivalent to -msingle-float),
14542 and @var{dp_full} (equivalent to -mdouble-float).
14545 @opindex mxilinx-fpu
14546 Perform optimizations for floating point unit on Xilinx PPC 405/440.
14549 @itemx -mno-multiple
14551 @opindex mno-multiple
14552 Generate code that uses (does not use) the load multiple word
14553 instructions and the store multiple word instructions. These
14554 instructions are generated by default on POWER systems, and not
14555 generated on PowerPC systems. Do not use @option{-mmultiple} on little
14556 endian PowerPC systems, since those instructions do not work when the
14557 processor is in little endian mode. The exceptions are PPC740 and
14558 PPC750 which permit the instructions usage in little endian mode.
14563 @opindex mno-string
14564 Generate code that uses (does not use) the load string instructions
14565 and the store string word instructions to save multiple registers and
14566 do small block moves. These instructions are generated by default on
14567 POWER systems, and not generated on PowerPC systems. Do not use
14568 @option{-mstring} on little endian PowerPC systems, since those
14569 instructions do not work when the processor is in little endian mode.
14570 The exceptions are PPC740 and PPC750 which permit the instructions
14571 usage in little endian mode.
14576 @opindex mno-update
14577 Generate code that uses (does not use) the load or store instructions
14578 that update the base register to the address of the calculated memory
14579 location. These instructions are generated by default. If you use
14580 @option{-mno-update}, there is a small window between the time that the
14581 stack pointer is updated and the address of the previous frame is
14582 stored, which means code that walks the stack frame across interrupts or
14583 signals may get corrupted data.
14585 @item -mavoid-indexed-addresses
14586 @item -mno-avoid-indexed-addresses
14587 @opindex mavoid-indexed-addresses
14588 @opindex mno-avoid-indexed-addresses
14589 Generate code that tries to avoid (not avoid) the use of indexed load
14590 or store instructions. These instructions can incur a performance
14591 penalty on Power6 processors in certain situations, such as when
14592 stepping through large arrays that cross a 16M boundary. This option
14593 is enabled by default when targetting Power6 and disabled otherwise.
14596 @itemx -mno-fused-madd
14597 @opindex mfused-madd
14598 @opindex mno-fused-madd
14599 Generate code that uses (does not use) the floating point multiply and
14600 accumulate instructions. These instructions are generated by default if
14601 hardware floating is used.
14607 Generate code that uses (does not use) the half-word multiply and
14608 multiply-accumulate instructions on the IBM 405, 440 and 464 processors.
14609 These instructions are generated by default when targetting those
14616 Generate code that uses (does not use) the string-search @samp{dlmzb}
14617 instruction on the IBM 405, 440 and 464 processors. This instruction is
14618 generated by default when targetting those processors.
14620 @item -mno-bit-align
14622 @opindex mno-bit-align
14623 @opindex mbit-align
14624 On System V.4 and embedded PowerPC systems do not (do) force structures
14625 and unions that contain bit-fields to be aligned to the base type of the
14628 For example, by default a structure containing nothing but 8
14629 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
14630 boundary and have a size of 4 bytes. By using @option{-mno-bit-align},
14631 the structure would be aligned to a 1 byte boundary and be one byte in
14634 @item -mno-strict-align
14635 @itemx -mstrict-align
14636 @opindex mno-strict-align
14637 @opindex mstrict-align
14638 On System V.4 and embedded PowerPC systems do not (do) assume that
14639 unaligned memory references will be handled by the system.
14641 @item -mrelocatable
14642 @itemx -mno-relocatable
14643 @opindex mrelocatable
14644 @opindex mno-relocatable
14645 On embedded PowerPC systems generate code that allows (does not allow)
14646 the program to be relocated to a different address at runtime. If you
14647 use @option{-mrelocatable} on any module, all objects linked together must
14648 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
14650 @item -mrelocatable-lib
14651 @itemx -mno-relocatable-lib
14652 @opindex mrelocatable-lib
14653 @opindex mno-relocatable-lib
14654 On embedded PowerPC systems generate code that allows (does not allow)
14655 the program to be relocated to a different address at runtime. Modules
14656 compiled with @option{-mrelocatable-lib} can be linked with either modules
14657 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
14658 with modules compiled with the @option{-mrelocatable} options.
14664 On System V.4 and embedded PowerPC systems do not (do) assume that
14665 register 2 contains a pointer to a global area pointing to the addresses
14666 used in the program.
14669 @itemx -mlittle-endian
14671 @opindex mlittle-endian
14672 On System V.4 and embedded PowerPC systems compile code for the
14673 processor in little endian mode. The @option{-mlittle-endian} option is
14674 the same as @option{-mlittle}.
14677 @itemx -mbig-endian
14679 @opindex mbig-endian
14680 On System V.4 and embedded PowerPC systems compile code for the
14681 processor in big endian mode. The @option{-mbig-endian} option is
14682 the same as @option{-mbig}.
14684 @item -mdynamic-no-pic
14685 @opindex mdynamic-no-pic
14686 On Darwin and Mac OS X systems, compile code so that it is not
14687 relocatable, but that its external references are relocatable. The
14688 resulting code is suitable for applications, but not shared
14691 @item -mprioritize-restricted-insns=@var{priority}
14692 @opindex mprioritize-restricted-insns
14693 This option controls the priority that is assigned to
14694 dispatch-slot restricted instructions during the second scheduling
14695 pass. The argument @var{priority} takes the value @var{0/1/2} to assign
14696 @var{no/highest/second-highest} priority to dispatch slot restricted
14699 @item -msched-costly-dep=@var{dependence_type}
14700 @opindex msched-costly-dep
14701 This option controls which dependences are considered costly
14702 by the target during instruction scheduling. The argument
14703 @var{dependence_type} takes one of the following values:
14704 @var{no}: no dependence is costly,
14705 @var{all}: all dependences are costly,
14706 @var{true_store_to_load}: a true dependence from store to load is costly,
14707 @var{store_to_load}: any dependence from store to load is costly,
14708 @var{number}: any dependence which latency >= @var{number} is costly.
14710 @item -minsert-sched-nops=@var{scheme}
14711 @opindex minsert-sched-nops
14712 This option controls which nop insertion scheme will be used during
14713 the second scheduling pass. The argument @var{scheme} takes one of the
14715 @var{no}: Don't insert nops.
14716 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
14717 according to the scheduler's grouping.
14718 @var{regroup_exact}: Insert nops to force costly dependent insns into
14719 separate groups. Insert exactly as many nops as needed to force an insn
14720 to a new group, according to the estimated processor grouping.
14721 @var{number}: Insert nops to force costly dependent insns into
14722 separate groups. Insert @var{number} nops to force an insn to a new group.
14725 @opindex mcall-sysv
14726 On System V.4 and embedded PowerPC systems compile code using calling
14727 conventions that adheres to the March 1995 draft of the System V
14728 Application Binary Interface, PowerPC processor supplement. This is the
14729 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
14731 @item -mcall-sysv-eabi
14733 @opindex mcall-sysv-eabi
14734 @opindex mcall-eabi
14735 Specify both @option{-mcall-sysv} and @option{-meabi} options.
14737 @item -mcall-sysv-noeabi
14738 @opindex mcall-sysv-noeabi
14739 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
14741 @item -mcall-aixdesc
14743 On System V.4 and embedded PowerPC systems compile code for the AIX
14747 @opindex mcall-linux
14748 On System V.4 and embedded PowerPC systems compile code for the
14749 Linux-based GNU system.
14753 On System V.4 and embedded PowerPC systems compile code for the
14754 Hurd-based GNU system.
14756 @item -mcall-freebsd
14757 @opindex mcall-freebsd
14758 On System V.4 and embedded PowerPC systems compile code for the
14759 FreeBSD operating system.
14761 @item -mcall-netbsd
14762 @opindex mcall-netbsd
14763 On System V.4 and embedded PowerPC systems compile code for the
14764 NetBSD operating system.
14766 @item -mcall-openbsd
14767 @opindex mcall-netbsd
14768 On System V.4 and embedded PowerPC systems compile code for the
14769 OpenBSD operating system.
14771 @item -maix-struct-return
14772 @opindex maix-struct-return
14773 Return all structures in memory (as specified by the AIX ABI)@.
14775 @item -msvr4-struct-return
14776 @opindex msvr4-struct-return
14777 Return structures smaller than 8 bytes in registers (as specified by the
14780 @item -mabi=@var{abi-type}
14782 Extend the current ABI with a particular extension, or remove such extension.
14783 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
14784 @var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
14788 Extend the current ABI with SPE ABI extensions. This does not change
14789 the default ABI, instead it adds the SPE ABI extensions to the current
14793 @opindex mabi=no-spe
14794 Disable Booke SPE ABI extensions for the current ABI@.
14796 @item -mabi=ibmlongdouble
14797 @opindex mabi=ibmlongdouble
14798 Change the current ABI to use IBM extended precision long double.
14799 This is a PowerPC 32-bit SYSV ABI option.
14801 @item -mabi=ieeelongdouble
14802 @opindex mabi=ieeelongdouble
14803 Change the current ABI to use IEEE extended precision long double.
14804 This is a PowerPC 32-bit Linux ABI option.
14807 @itemx -mno-prototype
14808 @opindex mprototype
14809 @opindex mno-prototype
14810 On System V.4 and embedded PowerPC systems assume that all calls to
14811 variable argument functions are properly prototyped. Otherwise, the
14812 compiler must insert an instruction before every non prototyped call to
14813 set or clear bit 6 of the condition code register (@var{CR}) to
14814 indicate whether floating point values were passed in the floating point
14815 registers in case the function takes a variable arguments. With
14816 @option{-mprototype}, only calls to prototyped variable argument functions
14817 will set or clear the bit.
14821 On embedded PowerPC systems, assume that the startup module is called
14822 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
14823 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
14828 On embedded PowerPC systems, assume that the startup module is called
14829 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
14834 On embedded PowerPC systems, assume that the startup module is called
14835 @file{crt0.o} and the standard C libraries are @file{libads.a} and
14838 @item -myellowknife
14839 @opindex myellowknife
14840 On embedded PowerPC systems, assume that the startup module is called
14841 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
14846 On System V.4 and embedded PowerPC systems, specify that you are
14847 compiling for a VxWorks system.
14851 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
14852 header to indicate that @samp{eabi} extended relocations are used.
14858 On System V.4 and embedded PowerPC systems do (do not) adhere to the
14859 Embedded Applications Binary Interface (eabi) which is a set of
14860 modifications to the System V.4 specifications. Selecting @option{-meabi}
14861 means that the stack is aligned to an 8 byte boundary, a function
14862 @code{__eabi} is called to from @code{main} to set up the eabi
14863 environment, and the @option{-msdata} option can use both @code{r2} and
14864 @code{r13} to point to two separate small data areas. Selecting
14865 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
14866 do not call an initialization function from @code{main}, and the
14867 @option{-msdata} option will only use @code{r13} to point to a single
14868 small data area. The @option{-meabi} option is on by default if you
14869 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
14872 @opindex msdata=eabi
14873 On System V.4 and embedded PowerPC systems, put small initialized
14874 @code{const} global and static data in the @samp{.sdata2} section, which
14875 is pointed to by register @code{r2}. Put small initialized
14876 non-@code{const} global and static data in the @samp{.sdata} section,
14877 which is pointed to by register @code{r13}. Put small uninitialized
14878 global and static data in the @samp{.sbss} section, which is adjacent to
14879 the @samp{.sdata} section. The @option{-msdata=eabi} option is
14880 incompatible with the @option{-mrelocatable} option. The
14881 @option{-msdata=eabi} option also sets the @option{-memb} option.
14884 @opindex msdata=sysv
14885 On System V.4 and embedded PowerPC systems, put small global and static
14886 data in the @samp{.sdata} section, which is pointed to by register
14887 @code{r13}. Put small uninitialized global and static data in the
14888 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
14889 The @option{-msdata=sysv} option is incompatible with the
14890 @option{-mrelocatable} option.
14892 @item -msdata=default
14894 @opindex msdata=default
14896 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
14897 compile code the same as @option{-msdata=eabi}, otherwise compile code the
14898 same as @option{-msdata=sysv}.
14901 @opindex msdata=data
14902 On System V.4 and embedded PowerPC systems, put small global
14903 data in the @samp{.sdata} section. Put small uninitialized global
14904 data in the @samp{.sbss} section. Do not use register @code{r13}
14905 to address small data however. This is the default behavior unless
14906 other @option{-msdata} options are used.
14910 @opindex msdata=none
14912 On embedded PowerPC systems, put all initialized global and static data
14913 in the @samp{.data} section, and all uninitialized data in the
14914 @samp{.bss} section.
14918 @cindex smaller data references (PowerPC)
14919 @cindex .sdata/.sdata2 references (PowerPC)
14920 On embedded PowerPC systems, put global and static items less than or
14921 equal to @var{num} bytes into the small data or bss sections instead of
14922 the normal data or bss section. By default, @var{num} is 8. The
14923 @option{-G @var{num}} switch is also passed to the linker.
14924 All modules should be compiled with the same @option{-G @var{num}} value.
14927 @itemx -mno-regnames
14929 @opindex mno-regnames
14930 On System V.4 and embedded PowerPC systems do (do not) emit register
14931 names in the assembly language output using symbolic forms.
14934 @itemx -mno-longcall
14936 @opindex mno-longcall
14937 By default assume that all calls are far away so that a longer more
14938 expensive calling sequence is required. This is required for calls
14939 further than 32 megabytes (33,554,432 bytes) from the current location.
14940 A short call will be generated if the compiler knows
14941 the call cannot be that far away. This setting can be overridden by
14942 the @code{shortcall} function attribute, or by @code{#pragma
14945 Some linkers are capable of detecting out-of-range calls and generating
14946 glue code on the fly. On these systems, long calls are unnecessary and
14947 generate slower code. As of this writing, the AIX linker can do this,
14948 as can the GNU linker for PowerPC/64. It is planned to add this feature
14949 to the GNU linker for 32-bit PowerPC systems as well.
14951 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
14952 callee, L42'', plus a ``branch island'' (glue code). The two target
14953 addresses represent the callee and the ``branch island''. The
14954 Darwin/PPC linker will prefer the first address and generate a ``bl
14955 callee'' if the PPC ``bl'' instruction will reach the callee directly;
14956 otherwise, the linker will generate ``bl L42'' to call the ``branch
14957 island''. The ``branch island'' is appended to the body of the
14958 calling function; it computes the full 32-bit address of the callee
14961 On Mach-O (Darwin) systems, this option directs the compiler emit to
14962 the glue for every direct call, and the Darwin linker decides whether
14963 to use or discard it.
14965 In the future, we may cause GCC to ignore all longcall specifications
14966 when the linker is known to generate glue.
14968 @item -mtls-markers
14969 @itemx -mno-tls-markers
14970 @opindex mtls-markers
14971 @opindex mno-tls-markers
14972 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
14973 specifying the function argument. The relocation allows ld to
14974 reliably associate function call with argument setup instructions for
14975 TLS optimization, which in turn allows gcc to better schedule the
14980 Adds support for multithreading with the @dfn{pthreads} library.
14981 This option sets flags for both the preprocessor and linker.
14985 @node S/390 and zSeries Options
14986 @subsection S/390 and zSeries Options
14987 @cindex S/390 and zSeries Options
14989 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
14993 @itemx -msoft-float
14994 @opindex mhard-float
14995 @opindex msoft-float
14996 Use (do not use) the hardware floating-point instructions and registers
14997 for floating-point operations. When @option{-msoft-float} is specified,
14998 functions in @file{libgcc.a} will be used to perform floating-point
14999 operations. When @option{-mhard-float} is specified, the compiler
15000 generates IEEE floating-point instructions. This is the default.
15003 @itemx -mno-hard-dfp
15005 @opindex mno-hard-dfp
15006 Use (do not use) the hardware decimal-floating-point instructions for
15007 decimal-floating-point operations. When @option{-mno-hard-dfp} is
15008 specified, functions in @file{libgcc.a} will be used to perform
15009 decimal-floating-point operations. When @option{-mhard-dfp} is
15010 specified, the compiler generates decimal-floating-point hardware
15011 instructions. This is the default for @option{-march=z9-ec} or higher.
15013 @item -mlong-double-64
15014 @itemx -mlong-double-128
15015 @opindex mlong-double-64
15016 @opindex mlong-double-128
15017 These switches control the size of @code{long double} type. A size
15018 of 64bit makes the @code{long double} type equivalent to the @code{double}
15019 type. This is the default.
15022 @itemx -mno-backchain
15023 @opindex mbackchain
15024 @opindex mno-backchain
15025 Store (do not store) the address of the caller's frame as backchain pointer
15026 into the callee's stack frame.
15027 A backchain may be needed to allow debugging using tools that do not understand
15028 DWARF-2 call frame information.
15029 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
15030 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
15031 the backchain is placed into the topmost word of the 96/160 byte register
15034 In general, code compiled with @option{-mbackchain} is call-compatible with
15035 code compiled with @option{-mmo-backchain}; however, use of the backchain
15036 for debugging purposes usually requires that the whole binary is built with
15037 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
15038 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
15039 to build a linux kernel use @option{-msoft-float}.
15041 The default is to not maintain the backchain.
15043 @item -mpacked-stack
15044 @itemx -mno-packed-stack
15045 @opindex mpacked-stack
15046 @opindex mno-packed-stack
15047 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
15048 specified, the compiler uses the all fields of the 96/160 byte register save
15049 area only for their default purpose; unused fields still take up stack space.
15050 When @option{-mpacked-stack} is specified, register save slots are densely
15051 packed at the top of the register save area; unused space is reused for other
15052 purposes, allowing for more efficient use of the available stack space.
15053 However, when @option{-mbackchain} is also in effect, the topmost word of
15054 the save area is always used to store the backchain, and the return address
15055 register is always saved two words below the backchain.
15057 As long as the stack frame backchain is not used, code generated with
15058 @option{-mpacked-stack} is call-compatible with code generated with
15059 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
15060 S/390 or zSeries generated code that uses the stack frame backchain at run
15061 time, not just for debugging purposes. Such code is not call-compatible
15062 with code compiled with @option{-mpacked-stack}. Also, note that the
15063 combination of @option{-mbackchain},
15064 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
15065 to build a linux kernel use @option{-msoft-float}.
15067 The default is to not use the packed stack layout.
15070 @itemx -mno-small-exec
15071 @opindex msmall-exec
15072 @opindex mno-small-exec
15073 Generate (or do not generate) code using the @code{bras} instruction
15074 to do subroutine calls.
15075 This only works reliably if the total executable size does not
15076 exceed 64k. The default is to use the @code{basr} instruction instead,
15077 which does not have this limitation.
15083 When @option{-m31} is specified, generate code compliant to the
15084 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
15085 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
15086 particular to generate 64-bit instructions. For the @samp{s390}
15087 targets, the default is @option{-m31}, while the @samp{s390x}
15088 targets default to @option{-m64}.
15094 When @option{-mzarch} is specified, generate code using the
15095 instructions available on z/Architecture.
15096 When @option{-mesa} is specified, generate code using the
15097 instructions available on ESA/390. Note that @option{-mesa} is
15098 not possible with @option{-m64}.
15099 When generating code compliant to the GNU/Linux for S/390 ABI,
15100 the default is @option{-mesa}. When generating code compliant
15101 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
15107 Generate (or do not generate) code using the @code{mvcle} instruction
15108 to perform block moves. When @option{-mno-mvcle} is specified,
15109 use a @code{mvc} loop instead. This is the default unless optimizing for
15116 Print (or do not print) additional debug information when compiling.
15117 The default is to not print debug information.
15119 @item -march=@var{cpu-type}
15121 Generate code that will run on @var{cpu-type}, which is the name of a system
15122 representing a certain processor type. Possible values for
15123 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
15124 @samp{z9-109}, @samp{z9-ec} and @samp{z10}.
15125 When generating code using the instructions available on z/Architecture,
15126 the default is @option{-march=z900}. Otherwise, the default is
15127 @option{-march=g5}.
15129 @item -mtune=@var{cpu-type}
15131 Tune to @var{cpu-type} everything applicable about the generated code,
15132 except for the ABI and the set of available instructions.
15133 The list of @var{cpu-type} values is the same as for @option{-march}.
15134 The default is the value used for @option{-march}.
15137 @itemx -mno-tpf-trace
15138 @opindex mtpf-trace
15139 @opindex mno-tpf-trace
15140 Generate code that adds (does not add) in TPF OS specific branches to trace
15141 routines in the operating system. This option is off by default, even
15142 when compiling for the TPF OS@.
15145 @itemx -mno-fused-madd
15146 @opindex mfused-madd
15147 @opindex mno-fused-madd
15148 Generate code that uses (does not use) the floating point multiply and
15149 accumulate instructions. These instructions are generated by default if
15150 hardware floating point is used.
15152 @item -mwarn-framesize=@var{framesize}
15153 @opindex mwarn-framesize
15154 Emit a warning if the current function exceeds the given frame size. Because
15155 this is a compile time check it doesn't need to be a real problem when the program
15156 runs. It is intended to identify functions which most probably cause
15157 a stack overflow. It is useful to be used in an environment with limited stack
15158 size e.g.@: the linux kernel.
15160 @item -mwarn-dynamicstack
15161 @opindex mwarn-dynamicstack
15162 Emit a warning if the function calls alloca or uses dynamically
15163 sized arrays. This is generally a bad idea with a limited stack size.
15165 @item -mstack-guard=@var{stack-guard}
15166 @itemx -mstack-size=@var{stack-size}
15167 @opindex mstack-guard
15168 @opindex mstack-size
15169 If these options are provided the s390 back end emits additional instructions in
15170 the function prologue which trigger a trap if the stack size is @var{stack-guard}
15171 bytes above the @var{stack-size} (remember that the stack on s390 grows downward).
15172 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
15173 the frame size of the compiled function is chosen.
15174 These options are intended to be used to help debugging stack overflow problems.
15175 The additionally emitted code causes only little overhead and hence can also be
15176 used in production like systems without greater performance degradation. The given
15177 values have to be exact powers of 2 and @var{stack-size} has to be greater than
15178 @var{stack-guard} without exceeding 64k.
15179 In order to be efficient the extra code makes the assumption that the stack starts
15180 at an address aligned to the value given by @var{stack-size}.
15181 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
15184 @node Score Options
15185 @subsection Score Options
15186 @cindex Score Options
15188 These options are defined for Score implementations:
15193 Compile code for big endian mode. This is the default.
15197 Compile code for little endian mode.
15201 Disable generate bcnz instruction.
15205 Enable generate unaligned load and store instruction.
15209 Enable the use of multiply-accumulate instructions. Disabled by default.
15213 Specify the SCORE5 as the target architecture.
15217 Specify the SCORE5U of the target architecture.
15221 Specify the SCORE7 as the target architecture. This is the default.
15225 Specify the SCORE7D as the target architecture.
15229 @subsection SH Options
15231 These @samp{-m} options are defined for the SH implementations:
15236 Generate code for the SH1.
15240 Generate code for the SH2.
15243 Generate code for the SH2e.
15247 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
15248 that the floating-point unit is not used.
15250 @item -m2a-single-only
15251 @opindex m2a-single-only
15252 Generate code for the SH2a-FPU, in such a way that no double-precision
15253 floating point operations are used.
15256 @opindex m2a-single
15257 Generate code for the SH2a-FPU assuming the floating-point unit is in
15258 single-precision mode by default.
15262 Generate code for the SH2a-FPU assuming the floating-point unit is in
15263 double-precision mode by default.
15267 Generate code for the SH3.
15271 Generate code for the SH3e.
15275 Generate code for the SH4 without a floating-point unit.
15277 @item -m4-single-only
15278 @opindex m4-single-only
15279 Generate code for the SH4 with a floating-point unit that only
15280 supports single-precision arithmetic.
15284 Generate code for the SH4 assuming the floating-point unit is in
15285 single-precision mode by default.
15289 Generate code for the SH4.
15293 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
15294 floating-point unit is not used.
15296 @item -m4a-single-only
15297 @opindex m4a-single-only
15298 Generate code for the SH4a, in such a way that no double-precision
15299 floating point operations are used.
15302 @opindex m4a-single
15303 Generate code for the SH4a assuming the floating-point unit is in
15304 single-precision mode by default.
15308 Generate code for the SH4a.
15312 Same as @option{-m4a-nofpu}, except that it implicitly passes
15313 @option{-dsp} to the assembler. GCC doesn't generate any DSP
15314 instructions at the moment.
15318 Compile code for the processor in big endian mode.
15322 Compile code for the processor in little endian mode.
15326 Align doubles at 64-bit boundaries. Note that this changes the calling
15327 conventions, and thus some functions from the standard C library will
15328 not work unless you recompile it first with @option{-mdalign}.
15332 Shorten some address references at link time, when possible; uses the
15333 linker option @option{-relax}.
15337 Use 32-bit offsets in @code{switch} tables. The default is to use
15342 Enable the use of bit manipulation instructions on SH2A.
15346 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
15347 alignment constraints.
15351 Comply with the calling conventions defined by Renesas.
15355 Comply with the calling conventions defined by Renesas.
15359 Comply with the calling conventions defined for GCC before the Renesas
15360 conventions were available. This option is the default for all
15361 targets of the SH toolchain except for @samp{sh-symbianelf}.
15364 @opindex mnomacsave
15365 Mark the @code{MAC} register as call-clobbered, even if
15366 @option{-mhitachi} is given.
15370 Increase IEEE-compliance of floating-point code.
15371 At the moment, this is equivalent to @option{-fno-finite-math-only}.
15372 When generating 16 bit SH opcodes, getting IEEE-conforming results for
15373 comparisons of NANs / infinities incurs extra overhead in every
15374 floating point comparison, therefore the default is set to
15375 @option{-ffinite-math-only}.
15377 @item -minline-ic_invalidate
15378 @opindex minline-ic_invalidate
15379 Inline code to invalidate instruction cache entries after setting up
15380 nested function trampolines.
15381 This option has no effect if -musermode is in effect and the selected
15382 code generation option (e.g. -m4) does not allow the use of the icbi
15384 If the selected code generation option does not allow the use of the icbi
15385 instruction, and -musermode is not in effect, the inlined code will
15386 manipulate the instruction cache address array directly with an associative
15387 write. This not only requires privileged mode, but it will also
15388 fail if the cache line had been mapped via the TLB and has become unmapped.
15392 Dump instruction size and location in the assembly code.
15395 @opindex mpadstruct
15396 This option is deprecated. It pads structures to multiple of 4 bytes,
15397 which is incompatible with the SH ABI@.
15401 Optimize for space instead of speed. Implied by @option{-Os}.
15404 @opindex mprefergot
15405 When generating position-independent code, emit function calls using
15406 the Global Offset Table instead of the Procedure Linkage Table.
15410 Don't generate privileged mode only code; implies -mno-inline-ic_invalidate
15411 if the inlined code would not work in user mode.
15412 This is the default when the target is @code{sh-*-linux*}.
15414 @item -multcost=@var{number}
15415 @opindex multcost=@var{number}
15416 Set the cost to assume for a multiply insn.
15418 @item -mdiv=@var{strategy}
15419 @opindex mdiv=@var{strategy}
15420 Set the division strategy to use for SHmedia code. @var{strategy} must be
15421 one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
15422 inv:call2, inv:fp .
15423 "fp" performs the operation in floating point. This has a very high latency,
15424 but needs only a few instructions, so it might be a good choice if
15425 your code has enough easily exploitable ILP to allow the compiler to
15426 schedule the floating point instructions together with other instructions.
15427 Division by zero causes a floating point exception.
15428 "inv" uses integer operations to calculate the inverse of the divisor,
15429 and then multiplies the dividend with the inverse. This strategy allows
15430 cse and hoisting of the inverse calculation. Division by zero calculates
15431 an unspecified result, but does not trap.
15432 "inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
15433 have been found, or if the entire operation has been hoisted to the same
15434 place, the last stages of the inverse calculation are intertwined with the
15435 final multiply to reduce the overall latency, at the expense of using a few
15436 more instructions, and thus offering fewer scheduling opportunities with
15438 "call" calls a library function that usually implements the inv:minlat
15440 This gives high code density for m5-*media-nofpu compilations.
15441 "call2" uses a different entry point of the same library function, where it
15442 assumes that a pointer to a lookup table has already been set up, which
15443 exposes the pointer load to cse / code hoisting optimizations.
15444 "inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
15445 code generation, but if the code stays unoptimized, revert to the "call",
15446 "call2", or "fp" strategies, respectively. Note that the
15447 potentially-trapping side effect of division by zero is carried by a
15448 separate instruction, so it is possible that all the integer instructions
15449 are hoisted out, but the marker for the side effect stays where it is.
15450 A recombination to fp operations or a call is not possible in that case.
15451 "inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case
15452 that the inverse calculation was nor separated from the multiply, they speed
15453 up division where the dividend fits into 20 bits (plus sign where applicable),
15454 by inserting a test to skip a number of operations in this case; this test
15455 slows down the case of larger dividends. inv20u assumes the case of a such
15456 a small dividend to be unlikely, and inv20l assumes it to be likely.
15458 @item -mdivsi3_libfunc=@var{name}
15459 @opindex mdivsi3_libfunc=@var{name}
15460 Set the name of the library function used for 32 bit signed division to
15461 @var{name}. This only affect the name used in the call and inv:call
15462 division strategies, and the compiler will still expect the same
15463 sets of input/output/clobbered registers as if this option was not present.
15465 @item -mfixed-range=@var{register-range}
15466 @opindex mfixed-range
15467 Generate code treating the given register range as fixed registers.
15468 A fixed register is one that the register allocator can not use. This is
15469 useful when compiling kernel code. A register range is specified as
15470 two registers separated by a dash. Multiple register ranges can be
15471 specified separated by a comma.
15473 @item -madjust-unroll
15474 @opindex madjust-unroll
15475 Throttle unrolling to avoid thrashing target registers.
15476 This option only has an effect if the gcc code base supports the
15477 TARGET_ADJUST_UNROLL_MAX target hook.
15479 @item -mindexed-addressing
15480 @opindex mindexed-addressing
15481 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
15482 This is only safe if the hardware and/or OS implement 32 bit wrap-around
15483 semantics for the indexed addressing mode. The architecture allows the
15484 implementation of processors with 64 bit MMU, which the OS could use to
15485 get 32 bit addressing, but since no current hardware implementation supports
15486 this or any other way to make the indexed addressing mode safe to use in
15487 the 32 bit ABI, the default is -mno-indexed-addressing.
15489 @item -mgettrcost=@var{number}
15490 @opindex mgettrcost=@var{number}
15491 Set the cost assumed for the gettr instruction to @var{number}.
15492 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
15496 Assume pt* instructions won't trap. This will generally generate better
15497 scheduled code, but is unsafe on current hardware. The current architecture
15498 definition says that ptabs and ptrel trap when the target anded with 3 is 3.
15499 This has the unintentional effect of making it unsafe to schedule ptabs /
15500 ptrel before a branch, or hoist it out of a loop. For example,
15501 __do_global_ctors, a part of libgcc that runs constructors at program
15502 startup, calls functions in a list which is delimited by @minus{}1. With the
15503 -mpt-fixed option, the ptabs will be done before testing against @minus{}1.
15504 That means that all the constructors will be run a bit quicker, but when
15505 the loop comes to the end of the list, the program crashes because ptabs
15506 loads @minus{}1 into a target register. Since this option is unsafe for any
15507 hardware implementing the current architecture specification, the default
15508 is -mno-pt-fixed. Unless the user specifies a specific cost with
15509 @option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
15510 this deters register allocation using target registers for storing
15513 @item -minvalid-symbols
15514 @opindex minvalid-symbols
15515 Assume symbols might be invalid. Ordinary function symbols generated by
15516 the compiler will always be valid to load with movi/shori/ptabs or
15517 movi/shori/ptrel, but with assembler and/or linker tricks it is possible
15518 to generate symbols that will cause ptabs / ptrel to trap.
15519 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
15520 It will then prevent cross-basic-block cse, hoisting and most scheduling
15521 of symbol loads. The default is @option{-mno-invalid-symbols}.
15524 @node SPARC Options
15525 @subsection SPARC Options
15526 @cindex SPARC options
15528 These @samp{-m} options are supported on the SPARC:
15531 @item -mno-app-regs
15533 @opindex mno-app-regs
15535 Specify @option{-mapp-regs} to generate output using the global registers
15536 2 through 4, which the SPARC SVR4 ABI reserves for applications. This
15539 To be fully SVR4 ABI compliant at the cost of some performance loss,
15540 specify @option{-mno-app-regs}. You should compile libraries and system
15541 software with this option.
15544 @itemx -mhard-float
15546 @opindex mhard-float
15547 Generate output containing floating point instructions. This is the
15551 @itemx -msoft-float
15553 @opindex msoft-float
15554 Generate output containing library calls for floating point.
15555 @strong{Warning:} the requisite libraries are not available for all SPARC
15556 targets. Normally the facilities of the machine's usual C compiler are
15557 used, but this cannot be done directly in cross-compilation. You must make
15558 your own arrangements to provide suitable library functions for
15559 cross-compilation. The embedded targets @samp{sparc-*-aout} and
15560 @samp{sparclite-*-*} do provide software floating point support.
15562 @option{-msoft-float} changes the calling convention in the output file;
15563 therefore, it is only useful if you compile @emph{all} of a program with
15564 this option. In particular, you need to compile @file{libgcc.a}, the
15565 library that comes with GCC, with @option{-msoft-float} in order for
15568 @item -mhard-quad-float
15569 @opindex mhard-quad-float
15570 Generate output containing quad-word (long double) floating point
15573 @item -msoft-quad-float
15574 @opindex msoft-quad-float
15575 Generate output containing library calls for quad-word (long double)
15576 floating point instructions. The functions called are those specified
15577 in the SPARC ABI@. This is the default.
15579 As of this writing, there are no SPARC implementations that have hardware
15580 support for the quad-word floating point instructions. They all invoke
15581 a trap handler for one of these instructions, and then the trap handler
15582 emulates the effect of the instruction. Because of the trap handler overhead,
15583 this is much slower than calling the ABI library routines. Thus the
15584 @option{-msoft-quad-float} option is the default.
15586 @item -mno-unaligned-doubles
15587 @itemx -munaligned-doubles
15588 @opindex mno-unaligned-doubles
15589 @opindex munaligned-doubles
15590 Assume that doubles have 8 byte alignment. This is the default.
15592 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
15593 alignment only if they are contained in another type, or if they have an
15594 absolute address. Otherwise, it assumes they have 4 byte alignment.
15595 Specifying this option avoids some rare compatibility problems with code
15596 generated by other compilers. It is not the default because it results
15597 in a performance loss, especially for floating point code.
15599 @item -mno-faster-structs
15600 @itemx -mfaster-structs
15601 @opindex mno-faster-structs
15602 @opindex mfaster-structs
15603 With @option{-mfaster-structs}, the compiler assumes that structures
15604 should have 8 byte alignment. This enables the use of pairs of
15605 @code{ldd} and @code{std} instructions for copies in structure
15606 assignment, in place of twice as many @code{ld} and @code{st} pairs.
15607 However, the use of this changed alignment directly violates the SPARC
15608 ABI@. Thus, it's intended only for use on targets where the developer
15609 acknowledges that their resulting code will not be directly in line with
15610 the rules of the ABI@.
15612 @item -mimpure-text
15613 @opindex mimpure-text
15614 @option{-mimpure-text}, used in addition to @option{-shared}, tells
15615 the compiler to not pass @option{-z text} to the linker when linking a
15616 shared object. Using this option, you can link position-dependent
15617 code into a shared object.
15619 @option{-mimpure-text} suppresses the ``relocations remain against
15620 allocatable but non-writable sections'' linker error message.
15621 However, the necessary relocations will trigger copy-on-write, and the
15622 shared object is not actually shared across processes. Instead of
15623 using @option{-mimpure-text}, you should compile all source code with
15624 @option{-fpic} or @option{-fPIC}.
15626 This option is only available on SunOS and Solaris.
15628 @item -mcpu=@var{cpu_type}
15630 Set the instruction set, register set, and instruction scheduling parameters
15631 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
15632 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
15633 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
15634 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
15635 @samp{ultrasparc3}, @samp{niagara} and @samp{niagara2}.
15637 Default instruction scheduling parameters are used for values that select
15638 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
15639 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
15641 Here is a list of each supported architecture and their supported
15646 v8: supersparc, hypersparc
15647 sparclite: f930, f934, sparclite86x
15649 v9: ultrasparc, ultrasparc3, niagara, niagara2
15652 By default (unless configured otherwise), GCC generates code for the V7
15653 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
15654 additionally optimizes it for the Cypress CY7C602 chip, as used in the
15655 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
15656 SPARCStation 1, 2, IPX etc.
15658 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
15659 architecture. The only difference from V7 code is that the compiler emits
15660 the integer multiply and integer divide instructions which exist in SPARC-V8
15661 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
15662 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
15665 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
15666 the SPARC architecture. This adds the integer multiply, integer divide step
15667 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
15668 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
15669 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
15670 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
15671 MB86934 chip, which is the more recent SPARClite with FPU@.
15673 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
15674 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
15675 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
15676 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
15677 optimizes it for the TEMIC SPARClet chip.
15679 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
15680 architecture. This adds 64-bit integer and floating-point move instructions,
15681 3 additional floating-point condition code registers and conditional move
15682 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
15683 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
15684 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
15685 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
15686 @option{-mcpu=niagara}, the compiler additionally optimizes it for
15687 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
15688 additionally optimizes it for Sun UltraSPARC T2 chips.
15690 @item -mtune=@var{cpu_type}
15692 Set the instruction scheduling parameters for machine type
15693 @var{cpu_type}, but do not set the instruction set or register set that the
15694 option @option{-mcpu=@var{cpu_type}} would.
15696 The same values for @option{-mcpu=@var{cpu_type}} can be used for
15697 @option{-mtune=@var{cpu_type}}, but the only useful values are those
15698 that select a particular cpu implementation. Those are @samp{cypress},
15699 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
15700 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
15701 @samp{ultrasparc3}, @samp{niagara}, and @samp{niagara2}.
15706 @opindex mno-v8plus
15707 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
15708 difference from the V8 ABI is that the global and out registers are
15709 considered 64-bit wide. This is enabled by default on Solaris in 32-bit
15710 mode for all SPARC-V9 processors.
15716 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
15717 Visual Instruction Set extensions. The default is @option{-mno-vis}.
15720 These @samp{-m} options are supported in addition to the above
15721 on SPARC-V9 processors in 64-bit environments:
15724 @item -mlittle-endian
15725 @opindex mlittle-endian
15726 Generate code for a processor running in little-endian mode. It is only
15727 available for a few configurations and most notably not on Solaris and Linux.
15733 Generate code for a 32-bit or 64-bit environment.
15734 The 32-bit environment sets int, long and pointer to 32 bits.
15735 The 64-bit environment sets int to 32 bits and long and pointer
15738 @item -mcmodel=medlow
15739 @opindex mcmodel=medlow
15740 Generate code for the Medium/Low code model: 64-bit addresses, programs
15741 must be linked in the low 32 bits of memory. Programs can be statically
15742 or dynamically linked.
15744 @item -mcmodel=medmid
15745 @opindex mcmodel=medmid
15746 Generate code for the Medium/Middle code model: 64-bit addresses, programs
15747 must be linked in the low 44 bits of memory, the text and data segments must
15748 be less than 2GB in size and the data segment must be located within 2GB of
15751 @item -mcmodel=medany
15752 @opindex mcmodel=medany
15753 Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
15754 may be linked anywhere in memory, the text and data segments must be less
15755 than 2GB in size and the data segment must be located within 2GB of the
15758 @item -mcmodel=embmedany
15759 @opindex mcmodel=embmedany
15760 Generate code for the Medium/Anywhere code model for embedded systems:
15761 64-bit addresses, the text and data segments must be less than 2GB in
15762 size, both starting anywhere in memory (determined at link time). The
15763 global register %g4 points to the base of the data segment. Programs
15764 are statically linked and PIC is not supported.
15767 @itemx -mno-stack-bias
15768 @opindex mstack-bias
15769 @opindex mno-stack-bias
15770 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
15771 frame pointer if present, are offset by @minus{}2047 which must be added back
15772 when making stack frame references. This is the default in 64-bit mode.
15773 Otherwise, assume no such offset is present.
15776 These switches are supported in addition to the above on Solaris:
15781 Add support for multithreading using the Solaris threads library. This
15782 option sets flags for both the preprocessor and linker. This option does
15783 not affect the thread safety of object code produced by the compiler or
15784 that of libraries supplied with it.
15788 Add support for multithreading using the POSIX threads library. This
15789 option sets flags for both the preprocessor and linker. This option does
15790 not affect the thread safety of object code produced by the compiler or
15791 that of libraries supplied with it.
15795 This is a synonym for @option{-pthreads}.
15799 @subsection SPU Options
15800 @cindex SPU options
15802 These @samp{-m} options are supported on the SPU:
15806 @itemx -merror-reloc
15807 @opindex mwarn-reloc
15808 @opindex merror-reloc
15810 The loader for SPU does not handle dynamic relocations. By default, GCC
15811 will give an error when it generates code that requires a dynamic
15812 relocation. @option{-mno-error-reloc} disables the error,
15813 @option{-mwarn-reloc} will generate a warning instead.
15816 @itemx -munsafe-dma
15818 @opindex munsafe-dma
15820 Instructions which initiate or test completion of DMA must not be
15821 reordered with respect to loads and stores of the memory which is being
15822 accessed. Users typically address this problem using the volatile
15823 keyword, but that can lead to inefficient code in places where the
15824 memory is known to not change. Rather than mark the memory as volatile
15825 we treat the DMA instructions as potentially effecting all memory. With
15826 @option{-munsafe-dma} users must use the volatile keyword to protect
15829 @item -mbranch-hints
15830 @opindex mbranch-hints
15832 By default, GCC will generate a branch hint instruction to avoid
15833 pipeline stalls for always taken or probably taken branches. A hint
15834 will not be generated closer than 8 instructions away from its branch.
15835 There is little reason to disable them, except for debugging purposes,
15836 or to make an object a little bit smaller.
15840 @opindex msmall-mem
15841 @opindex mlarge-mem
15843 By default, GCC generates code assuming that addresses are never larger
15844 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
15845 a full 32 bit address.
15850 By default, GCC links against startup code that assumes the SPU-style
15851 main function interface (which has an unconventional parameter list).
15852 With @option{-mstdmain}, GCC will link your program against startup
15853 code that assumes a C99-style interface to @code{main}, including a
15854 local copy of @code{argv} strings.
15856 @item -mfixed-range=@var{register-range}
15857 @opindex mfixed-range
15858 Generate code treating the given register range as fixed registers.
15859 A fixed register is one that the register allocator can not use. This is
15860 useful when compiling kernel code. A register range is specified as
15861 two registers separated by a dash. Multiple register ranges can be
15862 specified separated by a comma.
15865 @itemx -mdual-nops=@var{n}
15866 @opindex mdual-nops
15867 By default, GCC will insert nops to increase dual issue when it expects
15868 it to increase performance. @var{n} can be a value from 0 to 10. A
15869 smaller @var{n} will insert fewer nops. 10 is the default, 0 is the
15870 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
15872 @item -mhint-max-nops=@var{n}
15873 @opindex mhint-max-nops
15874 Maximum number of nops to insert for a branch hint. A branch hint must
15875 be at least 8 instructions away from the branch it is effecting. GCC
15876 will insert up to @var{n} nops to enforce this, otherwise it will not
15877 generate the branch hint.
15879 @item -mhint-max-distance=@var{n}
15880 @opindex mhint-max-distance
15881 The encoding of the branch hint instruction limits the hint to be within
15882 256 instructions of the branch it is effecting. By default, GCC makes
15883 sure it is within 125.
15886 @opindex msafe-hints
15887 Work around a hardware bug which causes the SPU to stall indefinitely.
15888 By default, GCC will insert the @code{hbrp} instruction to make sure
15889 this stall won't happen.
15893 @node System V Options
15894 @subsection Options for System V
15896 These additional options are available on System V Release 4 for
15897 compatibility with other compilers on those systems:
15902 Create a shared object.
15903 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
15907 Identify the versions of each tool used by the compiler, in a
15908 @code{.ident} assembler directive in the output.
15912 Refrain from adding @code{.ident} directives to the output file (this is
15915 @item -YP,@var{dirs}
15917 Search the directories @var{dirs}, and no others, for libraries
15918 specified with @option{-l}.
15920 @item -Ym,@var{dir}
15922 Look in the directory @var{dir} to find the M4 preprocessor.
15923 The assembler uses this option.
15924 @c This is supposed to go with a -Yd for predefined M4 macro files, but
15925 @c the generic assembler that comes with Solaris takes just -Ym.
15929 @subsection V850 Options
15930 @cindex V850 Options
15932 These @samp{-m} options are defined for V850 implementations:
15936 @itemx -mno-long-calls
15937 @opindex mlong-calls
15938 @opindex mno-long-calls
15939 Treat all calls as being far away (near). If calls are assumed to be
15940 far away, the compiler will always load the functions address up into a
15941 register, and call indirect through the pointer.
15947 Do not optimize (do optimize) basic blocks that use the same index
15948 pointer 4 or more times to copy pointer into the @code{ep} register, and
15949 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
15950 option is on by default if you optimize.
15952 @item -mno-prolog-function
15953 @itemx -mprolog-function
15954 @opindex mno-prolog-function
15955 @opindex mprolog-function
15956 Do not use (do use) external functions to save and restore registers
15957 at the prologue and epilogue of a function. The external functions
15958 are slower, but use less code space if more than one function saves
15959 the same number of registers. The @option{-mprolog-function} option
15960 is on by default if you optimize.
15964 Try to make the code as small as possible. At present, this just turns
15965 on the @option{-mep} and @option{-mprolog-function} options.
15967 @item -mtda=@var{n}
15969 Put static or global variables whose size is @var{n} bytes or less into
15970 the tiny data area that register @code{ep} points to. The tiny data
15971 area can hold up to 256 bytes in total (128 bytes for byte references).
15973 @item -msda=@var{n}
15975 Put static or global variables whose size is @var{n} bytes or less into
15976 the small data area that register @code{gp} points to. The small data
15977 area can hold up to 64 kilobytes.
15979 @item -mzda=@var{n}
15981 Put static or global variables whose size is @var{n} bytes or less into
15982 the first 32 kilobytes of memory.
15986 Specify that the target processor is the V850.
15989 @opindex mbig-switch
15990 Generate code suitable for big switch tables. Use this option only if
15991 the assembler/linker complain about out of range branches within a switch
15996 This option will cause r2 and r5 to be used in the code generated by
15997 the compiler. This setting is the default.
15999 @item -mno-app-regs
16000 @opindex mno-app-regs
16001 This option will cause r2 and r5 to be treated as fixed registers.
16005 Specify that the target processor is the V850E1. The preprocessor
16006 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
16007 this option is used.
16011 Specify that the target processor is the V850E@. The preprocessor
16012 constant @samp{__v850e__} will be defined if this option is used.
16014 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
16015 are defined then a default target processor will be chosen and the
16016 relevant @samp{__v850*__} preprocessor constant will be defined.
16018 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
16019 defined, regardless of which processor variant is the target.
16021 @item -mdisable-callt
16022 @opindex mdisable-callt
16023 This option will suppress generation of the CALLT instruction for the
16024 v850e and v850e1 flavors of the v850 architecture. The default is
16025 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
16030 @subsection VAX Options
16031 @cindex VAX options
16033 These @samp{-m} options are defined for the VAX:
16038 Do not output certain jump instructions (@code{aobleq} and so on)
16039 that the Unix assembler for the VAX cannot handle across long
16044 Do output those jump instructions, on the assumption that you
16045 will assemble with the GNU assembler.
16049 Output code for g-format floating point numbers instead of d-format.
16052 @node VxWorks Options
16053 @subsection VxWorks Options
16054 @cindex VxWorks Options
16056 The options in this section are defined for all VxWorks targets.
16057 Options specific to the target hardware are listed with the other
16058 options for that target.
16063 GCC can generate code for both VxWorks kernels and real time processes
16064 (RTPs). This option switches from the former to the latter. It also
16065 defines the preprocessor macro @code{__RTP__}.
16068 @opindex non-static
16069 Link an RTP executable against shared libraries rather than static
16070 libraries. The options @option{-static} and @option{-shared} can
16071 also be used for RTPs (@pxref{Link Options}); @option{-static}
16078 These options are passed down to the linker. They are defined for
16079 compatibility with Diab.
16082 @opindex Xbind-lazy
16083 Enable lazy binding of function calls. This option is equivalent to
16084 @option{-Wl,-z,now} and is defined for compatibility with Diab.
16088 Disable lazy binding of function calls. This option is the default and
16089 is defined for compatibility with Diab.
16092 @node x86-64 Options
16093 @subsection x86-64 Options
16094 @cindex x86-64 options
16096 These are listed under @xref{i386 and x86-64 Options}.
16098 @node i386 and x86-64 Windows Options
16099 @subsection i386 and x86-64 Windows Options
16100 @cindex i386 and x86-64 Windows Options
16102 These additional options are available for Windows targets:
16107 This option is available for Cygwin and MinGW targets. It
16108 specifies that a console application is to be generated, by
16109 instructing the linker to set the PE header subsystem type
16110 required for console applications.
16111 This is the default behavior for Cygwin and MinGW targets.
16115 This option is available for Cygwin targets. It specifies that
16116 the Cygwin internal interface is to be used for predefined
16117 preprocessor macros, C runtime libraries and related linker
16118 paths and options. For Cygwin targets this is the default behavior.
16119 This option is deprecated and will be removed in a future release.
16122 @opindex mno-cygwin
16123 This option is available for Cygwin targets. It specifies that
16124 the MinGW internal interface is to be used instead of Cygwin's, by
16125 setting MinGW-related predefined macros and linker paths and default
16127 This option is deprecated and will be removed in a future release.
16131 This option is available for Cygwin and MinGW targets. It
16132 specifies that a DLL - a dynamic link library - is to be
16133 generated, enabling the selection of the required runtime
16134 startup object and entry point.
16136 @item -mnop-fun-dllimport
16137 @opindex mnop-fun-dllimport
16138 This option is available for Cygwin and MinGW targets. It
16139 specifies that the dllimport attribute should be ignored.
16143 This option is available for MinGW targets. It specifies
16144 that MinGW-specific thread support is to be used.
16148 This option is available for mingw-w64 targets. It specifies
16149 that the UNICODE macro is getting pre-defined and that the
16150 unicode capable runtime startup code is choosen.
16154 This option is available for Cygwin and MinGW targets. It
16155 specifies that the typical Windows pre-defined macros are to
16156 be set in the pre-processor, but does not influence the choice
16157 of runtime library/startup code.
16161 This option is available for Cygwin and MinGW targets. It
16162 specifies that a GUI application is to be generated by
16163 instructing the linker to set the PE header subsystem type
16166 @item -mpe-aligned-commons
16167 @opindex mpe-aligned-commons
16168 This option is available for Cygwin and MinGW targets. It
16169 specifies that the GNU extension to the PE file format that
16170 permits the correct alignment of COMMON variables should be
16171 used when generating code. It will be enabled by default if
16172 GCC detects that the target assembler found during configuration
16173 supports the feature.
16176 See also under @ref{i386 and x86-64 Options} for standard options.
16178 @node Xstormy16 Options
16179 @subsection Xstormy16 Options
16180 @cindex Xstormy16 Options
16182 These options are defined for Xstormy16:
16187 Choose startup files and linker script suitable for the simulator.
16190 @node Xtensa Options
16191 @subsection Xtensa Options
16192 @cindex Xtensa Options
16194 These options are supported for Xtensa targets:
16198 @itemx -mno-const16
16200 @opindex mno-const16
16201 Enable or disable use of @code{CONST16} instructions for loading
16202 constant values. The @code{CONST16} instruction is currently not a
16203 standard option from Tensilica. When enabled, @code{CONST16}
16204 instructions are always used in place of the standard @code{L32R}
16205 instructions. The use of @code{CONST16} is enabled by default only if
16206 the @code{L32R} instruction is not available.
16209 @itemx -mno-fused-madd
16210 @opindex mfused-madd
16211 @opindex mno-fused-madd
16212 Enable or disable use of fused multiply/add and multiply/subtract
16213 instructions in the floating-point option. This has no effect if the
16214 floating-point option is not also enabled. Disabling fused multiply/add
16215 and multiply/subtract instructions forces the compiler to use separate
16216 instructions for the multiply and add/subtract operations. This may be
16217 desirable in some cases where strict IEEE 754-compliant results are
16218 required: the fused multiply add/subtract instructions do not round the
16219 intermediate result, thereby producing results with @emph{more} bits of
16220 precision than specified by the IEEE standard. Disabling fused multiply
16221 add/subtract instructions also ensures that the program output is not
16222 sensitive to the compiler's ability to combine multiply and add/subtract
16225 @item -mserialize-volatile
16226 @itemx -mno-serialize-volatile
16227 @opindex mserialize-volatile
16228 @opindex mno-serialize-volatile
16229 When this option is enabled, GCC inserts @code{MEMW} instructions before
16230 @code{volatile} memory references to guarantee sequential consistency.
16231 The default is @option{-mserialize-volatile}. Use
16232 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
16234 @item -mtext-section-literals
16235 @itemx -mno-text-section-literals
16236 @opindex mtext-section-literals
16237 @opindex mno-text-section-literals
16238 Control the treatment of literal pools. The default is
16239 @option{-mno-text-section-literals}, which places literals in a separate
16240 section in the output file. This allows the literal pool to be placed
16241 in a data RAM/ROM, and it also allows the linker to combine literal
16242 pools from separate object files to remove redundant literals and
16243 improve code size. With @option{-mtext-section-literals}, the literals
16244 are interspersed in the text section in order to keep them as close as
16245 possible to their references. This may be necessary for large assembly
16248 @item -mtarget-align
16249 @itemx -mno-target-align
16250 @opindex mtarget-align
16251 @opindex mno-target-align
16252 When this option is enabled, GCC instructs the assembler to
16253 automatically align instructions to reduce branch penalties at the
16254 expense of some code density. The assembler attempts to widen density
16255 instructions to align branch targets and the instructions following call
16256 instructions. If there are not enough preceding safe density
16257 instructions to align a target, no widening will be performed. The
16258 default is @option{-mtarget-align}. These options do not affect the
16259 treatment of auto-aligned instructions like @code{LOOP}, which the
16260 assembler will always align, either by widening density instructions or
16261 by inserting no-op instructions.
16264 @itemx -mno-longcalls
16265 @opindex mlongcalls
16266 @opindex mno-longcalls
16267 When this option is enabled, GCC instructs the assembler to translate
16268 direct calls to indirect calls unless it can determine that the target
16269 of a direct call is in the range allowed by the call instruction. This
16270 translation typically occurs for calls to functions in other source
16271 files. Specifically, the assembler translates a direct @code{CALL}
16272 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
16273 The default is @option{-mno-longcalls}. This option should be used in
16274 programs where the call target can potentially be out of range. This
16275 option is implemented in the assembler, not the compiler, so the
16276 assembly code generated by GCC will still show direct call
16277 instructions---look at the disassembled object code to see the actual
16278 instructions. Note that the assembler will use an indirect call for
16279 every cross-file call, not just those that really will be out of range.
16282 @node zSeries Options
16283 @subsection zSeries Options
16284 @cindex zSeries options
16286 These are listed under @xref{S/390 and zSeries Options}.
16288 @node Code Gen Options
16289 @section Options for Code Generation Conventions
16290 @cindex code generation conventions
16291 @cindex options, code generation
16292 @cindex run-time options
16294 These machine-independent options control the interface conventions
16295 used in code generation.
16297 Most of them have both positive and negative forms; the negative form
16298 of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
16299 one of the forms is listed---the one which is not the default. You
16300 can figure out the other form by either removing @samp{no-} or adding
16304 @item -fbounds-check
16305 @opindex fbounds-check
16306 For front-ends that support it, generate additional code to check that
16307 indices used to access arrays are within the declared range. This is
16308 currently only supported by the Java and Fortran front-ends, where
16309 this option defaults to true and false respectively.
16313 This option generates traps for signed overflow on addition, subtraction,
16314 multiplication operations.
16318 This option instructs the compiler to assume that signed arithmetic
16319 overflow of addition, subtraction and multiplication wraps around
16320 using twos-complement representation. This flag enables some optimizations
16321 and disables others. This option is enabled by default for the Java
16322 front-end, as required by the Java language specification.
16325 @opindex fexceptions
16326 Enable exception handling. Generates extra code needed to propagate
16327 exceptions. For some targets, this implies GCC will generate frame
16328 unwind information for all functions, which can produce significant data
16329 size overhead, although it does not affect execution. If you do not
16330 specify this option, GCC will enable it by default for languages like
16331 C++ which normally require exception handling, and disable it for
16332 languages like C that do not normally require it. However, you may need
16333 to enable this option when compiling C code that needs to interoperate
16334 properly with exception handlers written in C++. You may also wish to
16335 disable this option if you are compiling older C++ programs that don't
16336 use exception handling.
16338 @item -fnon-call-exceptions
16339 @opindex fnon-call-exceptions
16340 Generate code that allows trapping instructions to throw exceptions.
16341 Note that this requires platform-specific runtime support that does
16342 not exist everywhere. Moreover, it only allows @emph{trapping}
16343 instructions to throw exceptions, i.e.@: memory references or floating
16344 point instructions. It does not allow exceptions to be thrown from
16345 arbitrary signal handlers such as @code{SIGALRM}.
16347 @item -funwind-tables
16348 @opindex funwind-tables
16349 Similar to @option{-fexceptions}, except that it will just generate any needed
16350 static data, but will not affect the generated code in any other way.
16351 You will normally not enable this option; instead, a language processor
16352 that needs this handling would enable it on your behalf.
16354 @item -fasynchronous-unwind-tables
16355 @opindex fasynchronous-unwind-tables
16356 Generate unwind table in dwarf2 format, if supported by target machine. The
16357 table is exact at each instruction boundary, so it can be used for stack
16358 unwinding from asynchronous events (such as debugger or garbage collector).
16360 @item -fpcc-struct-return
16361 @opindex fpcc-struct-return
16362 Return ``short'' @code{struct} and @code{union} values in memory like
16363 longer ones, rather than in registers. This convention is less
16364 efficient, but it has the advantage of allowing intercallability between
16365 GCC-compiled files and files compiled with other compilers, particularly
16366 the Portable C Compiler (pcc).
16368 The precise convention for returning structures in memory depends
16369 on the target configuration macros.
16371 Short structures and unions are those whose size and alignment match
16372 that of some integer type.
16374 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
16375 switch is not binary compatible with code compiled with the
16376 @option{-freg-struct-return} switch.
16377 Use it to conform to a non-default application binary interface.
16379 @item -freg-struct-return
16380 @opindex freg-struct-return
16381 Return @code{struct} and @code{union} values in registers when possible.
16382 This is more efficient for small structures than
16383 @option{-fpcc-struct-return}.
16385 If you specify neither @option{-fpcc-struct-return} nor
16386 @option{-freg-struct-return}, GCC defaults to whichever convention is
16387 standard for the target. If there is no standard convention, GCC
16388 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
16389 the principal compiler. In those cases, we can choose the standard, and
16390 we chose the more efficient register return alternative.
16392 @strong{Warning:} code compiled with the @option{-freg-struct-return}
16393 switch is not binary compatible with code compiled with the
16394 @option{-fpcc-struct-return} switch.
16395 Use it to conform to a non-default application binary interface.
16397 @item -fshort-enums
16398 @opindex fshort-enums
16399 Allocate to an @code{enum} type only as many bytes as it needs for the
16400 declared range of possible values. Specifically, the @code{enum} type
16401 will be equivalent to the smallest integer type which has enough room.
16403 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
16404 code that is not binary compatible with code generated without that switch.
16405 Use it to conform to a non-default application binary interface.
16407 @item -fshort-double
16408 @opindex fshort-double
16409 Use the same size for @code{double} as for @code{float}.
16411 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
16412 code that is not binary compatible with code generated without that switch.
16413 Use it to conform to a non-default application binary interface.
16415 @item -fshort-wchar
16416 @opindex fshort-wchar
16417 Override the underlying type for @samp{wchar_t} to be @samp{short
16418 unsigned int} instead of the default for the target. This option is
16419 useful for building programs to run under WINE@.
16421 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
16422 code that is not binary compatible with code generated without that switch.
16423 Use it to conform to a non-default application binary interface.
16426 @opindex fno-common
16427 In C code, controls the placement of uninitialized global variables.
16428 Unix C compilers have traditionally permitted multiple definitions of
16429 such variables in different compilation units by placing the variables
16431 This is the behavior specified by @option{-fcommon}, and is the default
16432 for GCC on most targets.
16433 On the other hand, this behavior is not required by ISO C, and on some
16434 targets may carry a speed or code size penalty on variable references.
16435 The @option{-fno-common} option specifies that the compiler should place
16436 uninitialized global variables in the data section of the object file,
16437 rather than generating them as common blocks.
16438 This has the effect that if the same variable is declared
16439 (without @code{extern}) in two different compilations,
16440 you will get a multiple-definition error when you link them.
16441 In this case, you must compile with @option{-fcommon} instead.
16442 Compiling with @option{-fno-common} is useful on targets for which
16443 it provides better performance, or if you wish to verify that the
16444 program will work on other systems which always treat uninitialized
16445 variable declarations this way.
16449 Ignore the @samp{#ident} directive.
16451 @item -finhibit-size-directive
16452 @opindex finhibit-size-directive
16453 Don't output a @code{.size} assembler directive, or anything else that
16454 would cause trouble if the function is split in the middle, and the
16455 two halves are placed at locations far apart in memory. This option is
16456 used when compiling @file{crtstuff.c}; you should not need to use it
16459 @item -fverbose-asm
16460 @opindex fverbose-asm
16461 Put extra commentary information in the generated assembly code to
16462 make it more readable. This option is generally only of use to those
16463 who actually need to read the generated assembly code (perhaps while
16464 debugging the compiler itself).
16466 @option{-fno-verbose-asm}, the default, causes the
16467 extra information to be omitted and is useful when comparing two assembler
16470 @item -frecord-gcc-switches
16471 @opindex frecord-gcc-switches
16472 This switch causes the command line that was used to invoke the
16473 compiler to be recorded into the object file that is being created.
16474 This switch is only implemented on some targets and the exact format
16475 of the recording is target and binary file format dependent, but it
16476 usually takes the form of a section containing ASCII text. This
16477 switch is related to the @option{-fverbose-asm} switch, but that
16478 switch only records information in the assembler output file as
16479 comments, so it never reaches the object file.
16483 @cindex global offset table
16485 Generate position-independent code (PIC) suitable for use in a shared
16486 library, if supported for the target machine. Such code accesses all
16487 constant addresses through a global offset table (GOT)@. The dynamic
16488 loader resolves the GOT entries when the program starts (the dynamic
16489 loader is not part of GCC; it is part of the operating system). If
16490 the GOT size for the linked executable exceeds a machine-specific
16491 maximum size, you get an error message from the linker indicating that
16492 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
16493 instead. (These maximums are 8k on the SPARC and 32k
16494 on the m68k and RS/6000. The 386 has no such limit.)
16496 Position-independent code requires special support, and therefore works
16497 only on certain machines. For the 386, GCC supports PIC for System V
16498 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
16499 position-independent.
16501 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
16506 If supported for the target machine, emit position-independent code,
16507 suitable for dynamic linking and avoiding any limit on the size of the
16508 global offset table. This option makes a difference on the m68k,
16509 PowerPC and SPARC@.
16511 Position-independent code requires special support, and therefore works
16512 only on certain machines.
16514 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
16521 These options are similar to @option{-fpic} and @option{-fPIC}, but
16522 generated position independent code can be only linked into executables.
16523 Usually these options are used when @option{-pie} GCC option will be
16524 used during linking.
16526 @option{-fpie} and @option{-fPIE} both define the macros
16527 @code{__pie__} and @code{__PIE__}. The macros have the value 1
16528 for @option{-fpie} and 2 for @option{-fPIE}.
16530 @item -fno-jump-tables
16531 @opindex fno-jump-tables
16532 Do not use jump tables for switch statements even where it would be
16533 more efficient than other code generation strategies. This option is
16534 of use in conjunction with @option{-fpic} or @option{-fPIC} for
16535 building code which forms part of a dynamic linker and cannot
16536 reference the address of a jump table. On some targets, jump tables
16537 do not require a GOT and this option is not needed.
16539 @item -ffixed-@var{reg}
16541 Treat the register named @var{reg} as a fixed register; generated code
16542 should never refer to it (except perhaps as a stack pointer, frame
16543 pointer or in some other fixed role).
16545 @var{reg} must be the name of a register. The register names accepted
16546 are machine-specific and are defined in the @code{REGISTER_NAMES}
16547 macro in the machine description macro file.
16549 This flag does not have a negative form, because it specifies a
16552 @item -fcall-used-@var{reg}
16553 @opindex fcall-used
16554 Treat the register named @var{reg} as an allocable register that is
16555 clobbered by function calls. It may be allocated for temporaries or
16556 variables that do not live across a call. Functions compiled this way
16557 will not save and restore the register @var{reg}.
16559 It is an error to used this flag with the frame pointer or stack pointer.
16560 Use of this flag for other registers that have fixed pervasive roles in
16561 the machine's execution model will produce disastrous results.
16563 This flag does not have a negative form, because it specifies a
16566 @item -fcall-saved-@var{reg}
16567 @opindex fcall-saved
16568 Treat the register named @var{reg} as an allocable register saved by
16569 functions. It may be allocated even for temporaries or variables that
16570 live across a call. Functions compiled this way will save and restore
16571 the register @var{reg} if they use it.
16573 It is an error to used this flag with the frame pointer or stack pointer.
16574 Use of this flag for other registers that have fixed pervasive roles in
16575 the machine's execution model will produce disastrous results.
16577 A different sort of disaster will result from the use of this flag for
16578 a register in which function values may be returned.
16580 This flag does not have a negative form, because it specifies a
16583 @item -fpack-struct[=@var{n}]
16584 @opindex fpack-struct
16585 Without a value specified, pack all structure members together without
16586 holes. When a value is specified (which must be a small power of two), pack
16587 structure members according to this value, representing the maximum
16588 alignment (that is, objects with default alignment requirements larger than
16589 this will be output potentially unaligned at the next fitting location.
16591 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
16592 code that is not binary compatible with code generated without that switch.
16593 Additionally, it makes the code suboptimal.
16594 Use it to conform to a non-default application binary interface.
16596 @item -finstrument-functions
16597 @opindex finstrument-functions
16598 Generate instrumentation calls for entry and exit to functions. Just
16599 after function entry and just before function exit, the following
16600 profiling functions will be called with the address of the current
16601 function and its call site. (On some platforms,
16602 @code{__builtin_return_address} does not work beyond the current
16603 function, so the call site information may not be available to the
16604 profiling functions otherwise.)
16607 void __cyg_profile_func_enter (void *this_fn,
16609 void __cyg_profile_func_exit (void *this_fn,
16613 The first argument is the address of the start of the current function,
16614 which may be looked up exactly in the symbol table.
16616 This instrumentation is also done for functions expanded inline in other
16617 functions. The profiling calls will indicate where, conceptually, the
16618 inline function is entered and exited. This means that addressable
16619 versions of such functions must be available. If all your uses of a
16620 function are expanded inline, this may mean an additional expansion of
16621 code size. If you use @samp{extern inline} in your C code, an
16622 addressable version of such functions must be provided. (This is
16623 normally the case anyways, but if you get lucky and the optimizer always
16624 expands the functions inline, you might have gotten away without
16625 providing static copies.)
16627 A function may be given the attribute @code{no_instrument_function}, in
16628 which case this instrumentation will not be done. This can be used, for
16629 example, for the profiling functions listed above, high-priority
16630 interrupt routines, and any functions from which the profiling functions
16631 cannot safely be called (perhaps signal handlers, if the profiling
16632 routines generate output or allocate memory).
16634 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
16635 @opindex finstrument-functions-exclude-file-list
16637 Set the list of functions that are excluded from instrumentation (see
16638 the description of @code{-finstrument-functions}). If the file that
16639 contains a function definition matches with one of @var{file}, then
16640 that function is not instrumented. The match is done on substrings:
16641 if the @var{file} parameter is a substring of the file name, it is
16642 considered to be a match.
16645 @code{-finstrument-functions-exclude-file-list=/bits/stl,include/sys}
16646 will exclude any inline function defined in files whose pathnames
16647 contain @code{/bits/stl} or @code{include/sys}.
16649 If, for some reason, you want to include letter @code{','} in one of
16650 @var{sym}, write @code{'\,'}. For example,
16651 @code{-finstrument-functions-exclude-file-list='\,\,tmp'}
16652 (note the single quote surrounding the option).
16654 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
16655 @opindex finstrument-functions-exclude-function-list
16657 This is similar to @code{-finstrument-functions-exclude-file-list},
16658 but this option sets the list of function names to be excluded from
16659 instrumentation. The function name to be matched is its user-visible
16660 name, such as @code{vector<int> blah(const vector<int> &)}, not the
16661 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
16662 match is done on substrings: if the @var{sym} parameter is a substring
16663 of the function name, it is considered to be a match. For C99 and C++
16664 extended identifiers, the function name must be given in UTF-8, not
16665 using universal character names.
16667 @item -fstack-check
16668 @opindex fstack-check
16669 Generate code to verify that you do not go beyond the boundary of the
16670 stack. You should specify this flag if you are running in an
16671 environment with multiple threads, but only rarely need to specify it in
16672 a single-threaded environment since stack overflow is automatically
16673 detected on nearly all systems if there is only one stack.
16675 Note that this switch does not actually cause checking to be done; the
16676 operating system or the language runtime must do that. The switch causes
16677 generation of code to ensure that they see the stack being extended.
16679 You can additionally specify a string parameter: @code{no} means no
16680 checking, @code{generic} means force the use of old-style checking,
16681 @code{specific} means use the best checking method and is equivalent
16682 to bare @option{-fstack-check}.
16684 Old-style checking is a generic mechanism that requires no specific
16685 target support in the compiler but comes with the following drawbacks:
16689 Modified allocation strategy for large objects: they will always be
16690 allocated dynamically if their size exceeds a fixed threshold.
16693 Fixed limit on the size of the static frame of functions: when it is
16694 topped by a particular function, stack checking is not reliable and
16695 a warning is issued by the compiler.
16698 Inefficiency: because of both the modified allocation strategy and the
16699 generic implementation, the performances of the code are hampered.
16702 Note that old-style stack checking is also the fallback method for
16703 @code{specific} if no target support has been added in the compiler.
16705 @item -fstack-limit-register=@var{reg}
16706 @itemx -fstack-limit-symbol=@var{sym}
16707 @itemx -fno-stack-limit
16708 @opindex fstack-limit-register
16709 @opindex fstack-limit-symbol
16710 @opindex fno-stack-limit
16711 Generate code to ensure that the stack does not grow beyond a certain value,
16712 either the value of a register or the address of a symbol. If the stack
16713 would grow beyond the value, a signal is raised. For most targets,
16714 the signal is raised before the stack overruns the boundary, so
16715 it is possible to catch the signal without taking special precautions.
16717 For instance, if the stack starts at absolute address @samp{0x80000000}
16718 and grows downwards, you can use the flags
16719 @option{-fstack-limit-symbol=__stack_limit} and
16720 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
16721 of 128KB@. Note that this may only work with the GNU linker.
16723 @cindex aliasing of parameters
16724 @cindex parameters, aliased
16725 @item -fargument-alias
16726 @itemx -fargument-noalias
16727 @itemx -fargument-noalias-global
16728 @itemx -fargument-noalias-anything
16729 @opindex fargument-alias
16730 @opindex fargument-noalias
16731 @opindex fargument-noalias-global
16732 @opindex fargument-noalias-anything
16733 Specify the possible relationships among parameters and between
16734 parameters and global data.
16736 @option{-fargument-alias} specifies that arguments (parameters) may
16737 alias each other and may alias global storage.@*
16738 @option{-fargument-noalias} specifies that arguments do not alias
16739 each other, but may alias global storage.@*
16740 @option{-fargument-noalias-global} specifies that arguments do not
16741 alias each other and do not alias global storage.
16742 @option{-fargument-noalias-anything} specifies that arguments do not
16743 alias any other storage.
16745 Each language will automatically use whatever option is required by
16746 the language standard. You should not need to use these options yourself.
16748 @item -fleading-underscore
16749 @opindex fleading-underscore
16750 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
16751 change the way C symbols are represented in the object file. One use
16752 is to help link with legacy assembly code.
16754 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
16755 generate code that is not binary compatible with code generated without that
16756 switch. Use it to conform to a non-default application binary interface.
16757 Not all targets provide complete support for this switch.
16759 @item -ftls-model=@var{model}
16760 @opindex ftls-model
16761 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
16762 The @var{model} argument should be one of @code{global-dynamic},
16763 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
16765 The default without @option{-fpic} is @code{initial-exec}; with
16766 @option{-fpic} the default is @code{global-dynamic}.
16768 @item -fvisibility=@var{default|internal|hidden|protected}
16769 @opindex fvisibility
16770 Set the default ELF image symbol visibility to the specified option---all
16771 symbols will be marked with this unless overridden within the code.
16772 Using this feature can very substantially improve linking and
16773 load times of shared object libraries, produce more optimized
16774 code, provide near-perfect API export and prevent symbol clashes.
16775 It is @strong{strongly} recommended that you use this in any shared objects
16778 Despite the nomenclature, @code{default} always means public ie;
16779 available to be linked against from outside the shared object.
16780 @code{protected} and @code{internal} are pretty useless in real-world
16781 usage so the only other commonly used option will be @code{hidden}.
16782 The default if @option{-fvisibility} isn't specified is
16783 @code{default}, i.e., make every
16784 symbol public---this causes the same behavior as previous versions of
16787 A good explanation of the benefits offered by ensuring ELF
16788 symbols have the correct visibility is given by ``How To Write
16789 Shared Libraries'' by Ulrich Drepper (which can be found at
16790 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
16791 solution made possible by this option to marking things hidden when
16792 the default is public is to make the default hidden and mark things
16793 public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
16794 and @code{__attribute__ ((visibility("default")))} instead of
16795 @code{__declspec(dllexport)} you get almost identical semantics with
16796 identical syntax. This is a great boon to those working with
16797 cross-platform projects.
16799 For those adding visibility support to existing code, you may find
16800 @samp{#pragma GCC visibility} of use. This works by you enclosing
16801 the declarations you wish to set visibility for with (for example)
16802 @samp{#pragma GCC visibility push(hidden)} and
16803 @samp{#pragma GCC visibility pop}.
16804 Bear in mind that symbol visibility should be viewed @strong{as
16805 part of the API interface contract} and thus all new code should
16806 always specify visibility when it is not the default ie; declarations
16807 only for use within the local DSO should @strong{always} be marked explicitly
16808 as hidden as so to avoid PLT indirection overheads---making this
16809 abundantly clear also aids readability and self-documentation of the code.
16810 Note that due to ISO C++ specification requirements, operator new and
16811 operator delete must always be of default visibility.
16813 Be aware that headers from outside your project, in particular system
16814 headers and headers from any other library you use, may not be
16815 expecting to be compiled with visibility other than the default. You
16816 may need to explicitly say @samp{#pragma GCC visibility push(default)}
16817 before including any such headers.
16819 @samp{extern} declarations are not affected by @samp{-fvisibility}, so
16820 a lot of code can be recompiled with @samp{-fvisibility=hidden} with
16821 no modifications. However, this means that calls to @samp{extern}
16822 functions with no explicit visibility will use the PLT, so it is more
16823 effective to use @samp{__attribute ((visibility))} and/or
16824 @samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
16825 declarations should be treated as hidden.
16827 Note that @samp{-fvisibility} does affect C++ vague linkage
16828 entities. This means that, for instance, an exception class that will
16829 be thrown between DSOs must be explicitly marked with default
16830 visibility so that the @samp{type_info} nodes will be unified between
16833 An overview of these techniques, their benefits and how to use them
16834 is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
16840 @node Environment Variables
16841 @section Environment Variables Affecting GCC
16842 @cindex environment variables
16844 @c man begin ENVIRONMENT
16845 This section describes several environment variables that affect how GCC
16846 operates. Some of them work by specifying directories or prefixes to use
16847 when searching for various kinds of files. Some are used to specify other
16848 aspects of the compilation environment.
16850 Note that you can also specify places to search using options such as
16851 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
16852 take precedence over places specified using environment variables, which
16853 in turn take precedence over those specified by the configuration of GCC@.
16854 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
16855 GNU Compiler Collection (GCC) Internals}.
16860 @c @itemx LC_COLLATE
16862 @c @itemx LC_MONETARY
16863 @c @itemx LC_NUMERIC
16868 @c @findex LC_COLLATE
16869 @findex LC_MESSAGES
16870 @c @findex LC_MONETARY
16871 @c @findex LC_NUMERIC
16875 These environment variables control the way that GCC uses
16876 localization information that allow GCC to work with different
16877 national conventions. GCC inspects the locale categories
16878 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
16879 so. These locale categories can be set to any value supported by your
16880 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
16881 Kingdom encoded in UTF-8.
16883 The @env{LC_CTYPE} environment variable specifies character
16884 classification. GCC uses it to determine the character boundaries in
16885 a string; this is needed for some multibyte encodings that contain quote
16886 and escape characters that would otherwise be interpreted as a string
16889 The @env{LC_MESSAGES} environment variable specifies the language to
16890 use in diagnostic messages.
16892 If the @env{LC_ALL} environment variable is set, it overrides the value
16893 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
16894 and @env{LC_MESSAGES} default to the value of the @env{LANG}
16895 environment variable. If none of these variables are set, GCC
16896 defaults to traditional C English behavior.
16900 If @env{TMPDIR} is set, it specifies the directory to use for temporary
16901 files. GCC uses temporary files to hold the output of one stage of
16902 compilation which is to be used as input to the next stage: for example,
16903 the output of the preprocessor, which is the input to the compiler
16906 @item GCC_EXEC_PREFIX
16907 @findex GCC_EXEC_PREFIX
16908 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
16909 names of the subprograms executed by the compiler. No slash is added
16910 when this prefix is combined with the name of a subprogram, but you can
16911 specify a prefix that ends with a slash if you wish.
16913 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
16914 an appropriate prefix to use based on the pathname it was invoked with.
16916 If GCC cannot find the subprogram using the specified prefix, it
16917 tries looking in the usual places for the subprogram.
16919 The default value of @env{GCC_EXEC_PREFIX} is
16920 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
16921 the installed compiler. In many cases @var{prefix} is the value
16922 of @code{prefix} when you ran the @file{configure} script.
16924 Other prefixes specified with @option{-B} take precedence over this prefix.
16926 This prefix is also used for finding files such as @file{crt0.o} that are
16929 In addition, the prefix is used in an unusual way in finding the
16930 directories to search for header files. For each of the standard
16931 directories whose name normally begins with @samp{/usr/local/lib/gcc}
16932 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
16933 replacing that beginning with the specified prefix to produce an
16934 alternate directory name. Thus, with @option{-Bfoo/}, GCC will search
16935 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
16936 These alternate directories are searched first; the standard directories
16937 come next. If a standard directory begins with the configured
16938 @var{prefix} then the value of @var{prefix} is replaced by
16939 @env{GCC_EXEC_PREFIX} when looking for header files.
16941 @item COMPILER_PATH
16942 @findex COMPILER_PATH
16943 The value of @env{COMPILER_PATH} is a colon-separated list of
16944 directories, much like @env{PATH}. GCC tries the directories thus
16945 specified when searching for subprograms, if it can't find the
16946 subprograms using @env{GCC_EXEC_PREFIX}.
16949 @findex LIBRARY_PATH
16950 The value of @env{LIBRARY_PATH} is a colon-separated list of
16951 directories, much like @env{PATH}. When configured as a native compiler,
16952 GCC tries the directories thus specified when searching for special
16953 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
16954 using GCC also uses these directories when searching for ordinary
16955 libraries for the @option{-l} option (but directories specified with
16956 @option{-L} come first).
16960 @cindex locale definition
16961 This variable is used to pass locale information to the compiler. One way in
16962 which this information is used is to determine the character set to be used
16963 when character literals, string literals and comments are parsed in C and C++.
16964 When the compiler is configured to allow multibyte characters,
16965 the following values for @env{LANG} are recognized:
16969 Recognize JIS characters.
16971 Recognize SJIS characters.
16973 Recognize EUCJP characters.
16976 If @env{LANG} is not defined, or if it has some other value, then the
16977 compiler will use mblen and mbtowc as defined by the default locale to
16978 recognize and translate multibyte characters.
16982 Some additional environments variables affect the behavior of the
16985 @include cppenv.texi
16989 @node Precompiled Headers
16990 @section Using Precompiled Headers
16991 @cindex precompiled headers
16992 @cindex speed of compilation
16994 Often large projects have many header files that are included in every
16995 source file. The time the compiler takes to process these header files
16996 over and over again can account for nearly all of the time required to
16997 build the project. To make builds faster, GCC allows users to
16998 `precompile' a header file; then, if builds can use the precompiled
16999 header file they will be much faster.
17001 To create a precompiled header file, simply compile it as you would any
17002 other file, if necessary using the @option{-x} option to make the driver
17003 treat it as a C or C++ header file. You will probably want to use a
17004 tool like @command{make} to keep the precompiled header up-to-date when
17005 the headers it contains change.
17007 A precompiled header file will be searched for when @code{#include} is
17008 seen in the compilation. As it searches for the included file
17009 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
17010 compiler looks for a precompiled header in each directory just before it
17011 looks for the include file in that directory. The name searched for is
17012 the name specified in the @code{#include} with @samp{.gch} appended. If
17013 the precompiled header file can't be used, it is ignored.
17015 For instance, if you have @code{#include "all.h"}, and you have
17016 @file{all.h.gch} in the same directory as @file{all.h}, then the
17017 precompiled header file will be used if possible, and the original
17018 header will be used otherwise.
17020 Alternatively, you might decide to put the precompiled header file in a
17021 directory and use @option{-I} to ensure that directory is searched
17022 before (or instead of) the directory containing the original header.
17023 Then, if you want to check that the precompiled header file is always
17024 used, you can put a file of the same name as the original header in this
17025 directory containing an @code{#error} command.
17027 This also works with @option{-include}. So yet another way to use
17028 precompiled headers, good for projects not designed with precompiled
17029 header files in mind, is to simply take most of the header files used by
17030 a project, include them from another header file, precompile that header
17031 file, and @option{-include} the precompiled header. If the header files
17032 have guards against multiple inclusion, they will be skipped because
17033 they've already been included (in the precompiled header).
17035 If you need to precompile the same header file for different
17036 languages, targets, or compiler options, you can instead make a
17037 @emph{directory} named like @file{all.h.gch}, and put each precompiled
17038 header in the directory, perhaps using @option{-o}. It doesn't matter
17039 what you call the files in the directory, every precompiled header in
17040 the directory will be considered. The first precompiled header
17041 encountered in the directory that is valid for this compilation will
17042 be used; they're searched in no particular order.
17044 There are many other possibilities, limited only by your imagination,
17045 good sense, and the constraints of your build system.
17047 A precompiled header file can be used only when these conditions apply:
17051 Only one precompiled header can be used in a particular compilation.
17054 A precompiled header can't be used once the first C token is seen. You
17055 can have preprocessor directives before a precompiled header; you can
17056 even include a precompiled header from inside another header, so long as
17057 there are no C tokens before the @code{#include}.
17060 The precompiled header file must be produced for the same language as
17061 the current compilation. You can't use a C precompiled header for a C++
17065 The precompiled header file must have been produced by the same compiler
17066 binary as the current compilation is using.
17069 Any macros defined before the precompiled header is included must
17070 either be defined in the same way as when the precompiled header was
17071 generated, or must not affect the precompiled header, which usually
17072 means that they don't appear in the precompiled header at all.
17074 The @option{-D} option is one way to define a macro before a
17075 precompiled header is included; using a @code{#define} can also do it.
17076 There are also some options that define macros implicitly, like
17077 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
17080 @item If debugging information is output when using the precompiled
17081 header, using @option{-g} or similar, the same kind of debugging information
17082 must have been output when building the precompiled header. However,
17083 a precompiled header built using @option{-g} can be used in a compilation
17084 when no debugging information is being output.
17086 @item The same @option{-m} options must generally be used when building
17087 and using the precompiled header. @xref{Submodel Options},
17088 for any cases where this rule is relaxed.
17090 @item Each of the following options must be the same when building and using
17091 the precompiled header:
17093 @gccoptlist{-fexceptions}
17096 Some other command-line options starting with @option{-f},
17097 @option{-p}, or @option{-O} must be defined in the same way as when
17098 the precompiled header was generated. At present, it's not clear
17099 which options are safe to change and which are not; the safest choice
17100 is to use exactly the same options when generating and using the
17101 precompiled header. The following are known to be safe:
17103 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
17104 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
17105 -fsched-verbose=<number> -fschedule-insns -fvisibility= @gol
17110 For all of these except the last, the compiler will automatically
17111 ignore the precompiled header if the conditions aren't met. If you
17112 find an option combination that doesn't work and doesn't cause the
17113 precompiled header to be ignored, please consider filing a bug report,
17116 If you do use differing options when generating and using the
17117 precompiled header, the actual behavior will be a mixture of the
17118 behavior for the options. For instance, if you use @option{-g} to
17119 generate the precompiled header but not when using it, you may or may
17120 not get debugging information for routines in the precompiled header.