1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
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 Free Software Foundation, Inc.
16 Permission is granted to copy, distribute and/or modify this document
17 under the terms of the GNU Free Documentation License, Version 1.2 or
18 any later version published by the Free Software Foundation; with the
19 Invariant Sections being ``GNU General Public License'' and ``Funding
20 Free Software'', the Front-Cover texts being (a) (see below), and with
21 the Back-Cover Texts being (b) (see below). A copy of the license is
22 included in the gfdl(7) man page.
24 (a) The FSF's Front-Cover Text is:
28 (b) The FSF's Back-Cover Text is:
30 You have freedom to copy and modify this GNU Manual, like GNU
31 software. Copies published by the Free Software Foundation raise
32 funds for GNU development.
34 @c Set file name and title for the man page.
36 @settitle GNU project C and C++ compiler
38 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
39 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
40 [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
41 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
42 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
43 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
44 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
46 Only the most useful options are listed here; see below for the
47 remainder. @samp{g++} accepts mostly the same options as @samp{gcc}.
50 gpl(7), gfdl(7), fsf-funding(7),
51 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
52 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
53 @file{ld}, @file{binutils} and @file{gdb}.
56 For instructions on reporting bugs, see
57 @w{@uref{http://gcc.gnu.org/bugs.html}}.
60 See the Info entry for @command{gcc}, or
61 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
62 for contributors to GCC@.
67 @chapter GCC Command Options
68 @cindex GCC command options
69 @cindex command options
70 @cindex options, GCC command
72 @c man begin DESCRIPTION
73 When you invoke GCC, it normally does preprocessing, compilation,
74 assembly and linking. The ``overall options'' allow you to stop this
75 process at an intermediate stage. For example, the @option{-c} option
76 says not to run the linker. Then the output consists of object files
77 output by the assembler.
79 Other options are passed on to one stage of processing. Some options
80 control the preprocessor and others the compiler itself. Yet other
81 options control the assembler and linker; most of these are not
82 documented here, since you rarely need to use any of them.
84 @cindex C compilation options
85 Most of the command line options that you can use with GCC are useful
86 for C programs; when an option is only useful with another language
87 (usually C++), the explanation says so explicitly. If the description
88 for a particular option does not mention a source language, you can use
89 that option with all supported languages.
91 @cindex C++ compilation options
92 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
93 options for compiling C++ programs.
95 @cindex grouping options
96 @cindex options, grouping
97 The @command{gcc} program accepts options and file names as operands. Many
98 options have multi-letter names; therefore multiple single-letter options
99 may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
102 @cindex order of options
103 @cindex options, order
104 You can mix options and other arguments. For the most part, the order
105 you use doesn't matter. Order does matter when you use several
106 options of the same kind; for example, if you specify @option{-L} more
107 than once, the directories are searched in the order specified. Also,
108 the placement of the @option{-l} option is significant.
110 Many options have long names starting with @samp{-f} or with
111 @samp{-W}---for example,
112 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
113 these have both positive and negative forms; the negative form of
114 @option{-ffoo} would be @option{-fno-foo}. This manual documents
115 only one of these two forms, whichever one is not the default.
119 @xref{Option Index}, for an index to GCC's options.
122 * Option Summary:: Brief list of all options, without explanations.
123 * Overall Options:: Controlling the kind of output:
124 an executable, object files, assembler files,
125 or preprocessed source.
126 * Invoking G++:: Compiling C++ programs.
127 * C Dialect Options:: Controlling the variant of C language compiled.
128 * C++ Dialect Options:: Variations on C++.
129 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
131 * Language Independent Options:: Controlling how diagnostics should be
133 * Warning Options:: How picky should the compiler be?
134 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
135 * Optimize Options:: How much optimization?
136 * Preprocessor Options:: Controlling header files and macro definitions.
137 Also, getting dependency information for Make.
138 * Assembler Options:: Passing options to the assembler.
139 * Link Options:: Specifying libraries and so on.
140 * Directory Options:: Where to find header files and libraries.
141 Where to find the compiler executable files.
142 * Spec Files:: How to pass switches to sub-processes.
143 * Target Options:: Running a cross-compiler, or an old version of GCC.
144 * Submodel Options:: Specifying minor hardware or convention variations,
145 such as 68010 vs 68020.
146 * Code Gen Options:: Specifying conventions for function calls, data layout
148 * Environment Variables:: Env vars that affect GCC.
149 * Precompiled Headers:: Compiling a header once, and using it many times.
150 * Running Protoize:: Automatically adding or removing function prototypes.
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 -pipe -pass-exit-codes @gol
165 -x @var{language} -v -### --help@r{[}=@var{class}@r{]} --target-help @gol
166 --version @@@var{file}}
168 @item C Language Options
169 @xref{C Dialect Options,,Options Controlling C Dialect}.
170 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
171 -aux-info @var{filename} @gol
172 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
173 -fhosted -ffreestanding -fopenmp -fms-extensions @gol
174 -trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
175 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
176 -fsigned-bitfields -fsigned-char @gol
177 -funsigned-bitfields -funsigned-char}
179 @item C++ Language Options
180 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
181 @gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
182 -fconserve-space -ffriend-injection @gol
183 -fno-elide-constructors @gol
184 -fno-enforce-eh-specs @gol
185 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
186 -fno-implicit-templates @gol
187 -fno-implicit-inline-templates @gol
188 -fno-implement-inlines -fms-extensions @gol
189 -fno-nonansi-builtins -fno-operator-names @gol
190 -fno-optional-diags -fpermissive @gol
191 -frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
192 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
193 -fno-default-inline -fvisibility-inlines-hidden @gol
194 -fvisibility-ms-compat @gol
195 -Wabi -Wctor-dtor-privacy @gol
196 -Wnon-virtual-dtor -Wreorder @gol
197 -Weffc++ -Wno-deprecated -Wstrict-null-sentinel @gol
198 -Wno-non-template-friend -Wold-style-cast @gol
199 -Woverloaded-virtual -Wno-pmf-conversions @gol
202 @item Objective-C and Objective-C++ Language Options
203 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
204 Objective-C and Objective-C++ Dialects}.
205 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
206 -fgnu-runtime -fnext-runtime @gol
207 -fno-nil-receivers @gol
208 -fobjc-call-cxx-cdtors @gol
209 -fobjc-direct-dispatch @gol
210 -fobjc-exceptions @gol
212 -freplace-objc-classes @gol
215 -Wassign-intercept @gol
216 -Wno-protocol -Wselector @gol
217 -Wstrict-selector-match @gol
218 -Wundeclared-selector}
220 @item Language Independent Options
221 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
222 @gccoptlist{-fmessage-length=@var{n} @gol
223 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
224 -fdiagnostics-show-option}
226 @item Warning Options
227 @xref{Warning Options,,Options to Request or Suppress Warnings}.
228 @gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol
229 -w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
230 -Wno-attributes -Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual @gol
231 -Wchar-subscripts -Wclobbered -Wcomment @gol
232 -Wconversion -Wcoverage-mismatch -Wno-deprecated-declarations @gol
233 -Wdisabled-optimization -Wno-div-by-zero @gol
234 -Wempty-body -Wno-endif-labels @gol
235 -Werror -Werror=* @gol
236 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
237 -Wno-format-extra-args -Wformat-nonliteral @gol
238 -Wformat-security -Wformat-y2k @gol
239 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
240 -Wimport -Wno-import -Winit-self -Winline @gol
241 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
242 -Winvalid-pch -Wlarger-than-@var{len} -Wunsafe-loop-optimizations @gol
243 -Wlogical-op -Wlong-long @gol
244 -Wmain -Wmissing-braces -Wmissing-field-initializers @gol
245 -Wmissing-format-attribute -Wmissing-include-dirs @gol
246 -Wmissing-noreturn @gol
247 -Wno-multichar -Wnonnull -Wno-overflow @gol
248 -Woverlength-strings -Wpacked -Wpadded @gol
249 -Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol
250 -Wredundant-decls @gol
251 -Wreturn-type -Wsequence-point -Wshadow @gol
252 -Wsign-compare -Wsign-conversion -Wstack-protector @gol
253 -Wstrict-aliasing -Wstrict-aliasing=n @gol
254 -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
255 -Wswitch -Wswitch-default -Wswitch-enum @gol
256 -Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized @gol
257 -Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol
258 -Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol
259 -Wunused-value -Wunused-variable @gol
260 -Wvariadic-macros -Wvla @gol
261 -Wvolatile-register-var -Wwrite-strings}
263 @item C-only Warning Options
264 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
265 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
266 -Wold-style-declaration -Wold-style-definition @gol
267 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
268 -Wdeclaration-after-statement -Wpointer-sign}
270 @item Debugging Options
271 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
272 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
273 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
274 -fdump-noaddr -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
275 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
276 -fdump-ipa-all -fdump-ipa-cgraph @gol
278 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
279 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
280 -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
281 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
283 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
284 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
285 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
286 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
287 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
288 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
289 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
290 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
291 -fdump-tree-nrv -fdump-tree-vect @gol
292 -fdump-tree-sink @gol
293 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
294 -fdump-tree-salias @gol
295 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
296 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
297 -ftree-vectorizer-verbose=@var{n} @gol
298 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
299 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
300 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
301 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
302 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
303 -ftest-coverage -ftime-report -fvar-tracking @gol
304 -g -g@var{level} -gcoff -gdwarf-2 @gol
305 -ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol
306 -fdebug-prefix-map=@var{old}=@var{new} @gol
307 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
308 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
309 -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
310 -print-multi-directory -print-multi-lib @gol
311 -print-prog-name=@var{program} -print-search-dirs -Q @gol
312 -print-sysroot-headers-suffix @gol
315 @item Optimization Options
316 @xref{Optimize Options,,Options that Control Optimization}.
317 @gccoptlist{-falign-functions=@var{n} -falign-jumps=@var{n} @gol
318 -falign-labels=@var{n} -falign-loops=@var{n} @gol
319 -fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
320 -fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
321 -fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
322 -fcaller-saves -fcprop-registers -fcse-follow-jumps @gol
323 -fcse-skip-blocks -fcx-limited-range -fdata-sections @gol
324 -fdelayed-branch -fdelete-null-pointer-checks -fearly-inlining @gol
325 -fexpensive-optimizations -ffast-math -ffloat-store @gol
326 -fforce-addr -fforward-propagate -ffunction-sections @gol
327 -fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol
328 -fcrossjumping -fif-conversion -fif-conversion2 @gol
329 -finline-functions -finline-functions-called-once @gol
330 -finline-limit=@var{n} -fkeep-inline-functions @gol
331 -fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol
332 -fmodulo-sched -fmodulo-sched-allow-regmoves -fno-branch-count-reg @gol
333 -fno-default-inline -fno-defer-pop -fmove-loop-invariants @gol
334 -fno-function-cse -fno-guess-branch-probability @gol
335 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
336 -funsafe-math-optimizations -funsafe-loop-optimizations @gol
337 -ffinite-math-only -fno-signed-zeros @gol
338 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
339 -fomit-frame-pointer -foptimize-register-move @gol
340 -foptimize-sibling-calls -fpredictive-commoning -fprefetch-loop-arrays @gol
341 -fprofile-generate -fprofile-use @gol
342 -fregmove -frename-registers @gol
343 -freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol
344 -frerun-cse-after-loop @gol
345 -frounding-math -frtl-abstract-sequences @gol
346 -fschedule-insns -fschedule-insns2 @gol
347 -fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol
348 -fsched-spec-load-dangerous @gol
349 -fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol
350 -fsched2-use-superblocks @gol
351 -fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol
352 -fsection-anchors -fsignaling-nans -fsingle-precision-constant @gol
353 -fno-split-wide-types -fstack-protector -fstack-protector-all @gol
354 -fstrict-aliasing -fstrict-overflow -ftracer -fthread-jumps @gol
355 -funroll-all-loops -funroll-loops -fpeel-loops @gol
356 -fsplit-ivs-in-unroller -funswitch-loops @gol
357 -fvariable-expansion-in-unroller -ftree-reassoc @gol
358 -ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol
359 -ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol
360 -fcheck-data-deps @gol
361 -ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol
362 -ftree-ch -ftree-sra -ftree-ter -ftree-fre -ftree-vectorize @gol
363 -ftree-vect-loop-version -fvect-cost-model -ftree-salias -fipa-pta -fweb @gol
364 -ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol
365 --param @var{name}=@var{value}
366 -O -O0 -O1 -O2 -O3 -Os}
368 @item Preprocessor Options
369 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
370 @gccoptlist{-A@var{question}=@var{answer} @gol
371 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
372 -C -dD -dI -dM -dN @gol
373 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
374 -idirafter @var{dir} @gol
375 -include @var{file} -imacros @var{file} @gol
376 -iprefix @var{file} -iwithprefix @var{dir} @gol
377 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
378 -imultilib @var{dir} -isysroot @var{dir} @gol
379 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
380 -P -fworking-directory -remap @gol
381 -trigraphs -undef -U@var{macro} -Wp,@var{option} @gol
382 -Xpreprocessor @var{option}}
384 @item Assembler Option
385 @xref{Assembler Options,,Passing Options to the Assembler}.
386 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
389 @xref{Link Options,,Options for Linking}.
390 @gccoptlist{@var{object-file-name} -l@var{library} @gol
391 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
392 -s -static -static-libgcc -shared -shared-libgcc -symbolic @gol
393 -Wl,@var{option} -Xlinker @var{option} @gol
396 @item Directory Options
397 @xref{Directory Options,,Options for Directory Search}.
398 @gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir}
399 -specs=@var{file} -I- --sysroot=@var{dir}}
402 @c I wrote this xref this way to avoid overfull hbox. -- rms
403 @xref{Target Options}.
404 @gccoptlist{-V @var{version} -b @var{machine}}
406 @item Machine Dependent Options
407 @xref{Submodel Options,,Hardware Models and Configurations}.
408 @c This list is ordered alphanumerically by subsection name.
409 @c Try and put the significant identifier (CPU or system) first,
410 @c so users have a clue at guessing where the ones they want will be.
413 @gccoptlist{-EB -EL @gol
414 -mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol
415 -mdata=@var{data-section} -mrodata=@var{readonly-data-section}}
418 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
419 -mabi=@var{name} @gol
420 -mapcs-stack-check -mno-apcs-stack-check @gol
421 -mapcs-float -mno-apcs-float @gol
422 -mapcs-reentrant -mno-apcs-reentrant @gol
423 -msched-prolog -mno-sched-prolog @gol
424 -mlittle-endian -mbig-endian -mwords-little-endian @gol
425 -mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol
426 -mthumb-interwork -mno-thumb-interwork @gol
427 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
428 -mstructure-size-boundary=@var{n} @gol
429 -mabort-on-noreturn @gol
430 -mlong-calls -mno-long-calls @gol
431 -msingle-pic-base -mno-single-pic-base @gol
432 -mpic-register=@var{reg} @gol
433 -mnop-fun-dllimport @gol
434 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
435 -mpoke-function-name @gol
437 -mtpcs-frame -mtpcs-leaf-frame @gol
438 -mcaller-super-interworking -mcallee-super-interworking @gol
442 @gccoptlist{-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol
443 -mcall-prologues -mno-tablejump -mtiny-stack -mint8}
445 @emph{Blackfin Options}
446 @gccoptlist{-mcpu=@var{cpu} -msim -momit-leaf-frame-pointer @gol
447 -mno-omit-leaf-frame-pointer -mspecld-anomaly -mno-specld-anomaly @gol
448 -mcsync-anomaly -mno-csync-anomaly -mlow-64k -mno-low64k @gol
449 -mstack-check-l1 -mid-shared-library -mno-id-shared-library @gol
450 -mshared-library-id=@var{n} -mleaf-id-shared-library @gol
451 -mno-leaf-id-shared-library -msep-data -mno-sep-data -mlong-calls @gol
455 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
456 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
457 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
458 -mstack-align -mdata-align -mconst-align @gol
459 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
460 -melf -maout -melinux -mlinux -sim -sim2 @gol
461 -mmul-bug-workaround -mno-mul-bug-workaround}
464 @gccoptlist{-mmac -mpush-args}
466 @emph{Darwin Options}
467 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
468 -arch_only -bind_at_load -bundle -bundle_loader @gol
469 -client_name -compatibility_version -current_version @gol
471 -dependency-file -dylib_file -dylinker_install_name @gol
472 -dynamic -dynamiclib -exported_symbols_list @gol
473 -filelist -flat_namespace -force_cpusubtype_ALL @gol
474 -force_flat_namespace -headerpad_max_install_names @gol
476 -image_base -init -install_name -keep_private_externs @gol
477 -multi_module -multiply_defined -multiply_defined_unused @gol
478 -noall_load -no_dead_strip_inits_and_terms @gol
479 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
480 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
481 -private_bundle -read_only_relocs -sectalign @gol
482 -sectobjectsymbols -whyload -seg1addr @gol
483 -sectcreate -sectobjectsymbols -sectorder @gol
484 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
485 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
486 -segprot -segs_read_only_addr -segs_read_write_addr @gol
487 -single_module -static -sub_library -sub_umbrella @gol
488 -twolevel_namespace -umbrella -undefined @gol
489 -unexported_symbols_list -weak_reference_mismatches @gol
490 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
491 -mkernel -mone-byte-bool}
493 @emph{DEC Alpha Options}
494 @gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol
495 -mieee -mieee-with-inexact -mieee-conformant @gol
496 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
497 -mtrap-precision=@var{mode} -mbuild-constants @gol
498 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
499 -mbwx -mmax -mfix -mcix @gol
500 -mfloat-vax -mfloat-ieee @gol
501 -mexplicit-relocs -msmall-data -mlarge-data @gol
502 -msmall-text -mlarge-text @gol
503 -mmemory-latency=@var{time}}
505 @emph{DEC Alpha/VMS Options}
506 @gccoptlist{-mvms-return-codes}
509 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
510 -mhard-float -msoft-float @gol
511 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
512 -mdouble -mno-double @gol
513 -mmedia -mno-media -mmuladd -mno-muladd @gol
514 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
515 -mlinked-fp -mlong-calls -malign-labels @gol
516 -mlibrary-pic -macc-4 -macc-8 @gol
517 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
518 -moptimize-membar -mno-optimize-membar @gol
519 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
520 -mvliw-branch -mno-vliw-branch @gol
521 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
522 -mno-nested-cond-exec -mtomcat-stats @gol
526 @emph{GNU/Linux Options}
527 @gccoptlist{-muclibc}
529 @emph{H8/300 Options}
530 @gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300}
533 @gccoptlist{-march=@var{architecture-type} @gol
534 -mbig-switch -mdisable-fpregs -mdisable-indexing @gol
535 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
536 -mfixed-range=@var{register-range} @gol
537 -mjump-in-delay -mlinker-opt -mlong-calls @gol
538 -mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
539 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
540 -mno-jump-in-delay -mno-long-load-store @gol
541 -mno-portable-runtime -mno-soft-float @gol
542 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
543 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
544 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
545 -munix=@var{unix-std} -nolibdld -static -threads}
547 @emph{i386 and x86-64 Options}
548 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
549 -mfpmath=@var{unit} @gol
550 -masm=@var{dialect} -mno-fancy-math-387 @gol
551 -mno-fp-ret-in-387 -msoft-float @gol
552 -mno-wide-multiply -mrtd -malign-double @gol
553 -mpreferred-stack-boundary=@var{num} -mcx16 -msahf -mrecip @gol
554 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 @gol
555 -msse4a -m3dnow -mpopcnt -mabm @gol
556 -mthreads -mno-align-stringops -minline-all-stringops @gol
557 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
558 -m96bit-long-double -mregparm=@var{num} -msseregparm @gol
559 -mpc32 -mpc64 -mpc80 mstackrealign @gol
560 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
561 -mcmodel=@var{code-model} @gol
562 -m32 -m64 -mlarge-data-threshold=@var{num}}
565 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
566 -mvolatile-asm-stop -mregister-names -mno-sdata @gol
567 -mconstant-gp -mauto-pic -minline-float-divide-min-latency @gol
568 -minline-float-divide-max-throughput @gol
569 -minline-int-divide-min-latency @gol
570 -minline-int-divide-max-throughput @gol
571 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
572 -mno-dwarf2-asm -mearly-stop-bits @gol
573 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
574 -mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol
575 -mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol
576 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
577 -msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol
578 -mno-sched-prefer-non-data-spec-insns @gol
579 -mno-sched-prefer-non-control-spec-insns @gol
580 -mno-sched-count-spec-in-critical-path}
582 @emph{M32R/D Options}
583 @gccoptlist{-m32r2 -m32rx -m32r @gol
585 -malign-loops -mno-align-loops @gol
586 -missue-rate=@var{number} @gol
587 -mbranch-cost=@var{number} @gol
588 -mmodel=@var{code-size-model-type} @gol
589 -msdata=@var{sdata-type} @gol
590 -mno-flush-func -mflush-func=@var{name} @gol
591 -mno-flush-trap -mflush-trap=@var{number} @gol
595 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
597 @emph{M680x0 Options}
598 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
599 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
600 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
601 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
602 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
603 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
604 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
605 -mshared-library-id=n -mid-shared-library -mno-id-shared-library}
607 @emph{M68hc1x Options}
608 @gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol
609 -mauto-incdec -minmax -mlong-calls -mshort @gol
610 -msoft-reg-count=@var{count}}
613 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
614 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
615 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
616 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
617 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
620 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
621 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol
622 -mips16 -mno-mips16 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
623 -mshared -mno-shared -mxgot -mno-xgot -mgp32 -mgp64 @gol
624 -mfp32 -mfp64 -mhard-float -msoft-float @gol
625 -msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
626 -msmartmips -mno-smartmips @gol
627 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
628 -mips3d -mno-mips3d -mmt -mno-mt @gol
629 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
630 -G@var{num} -membedded-data -mno-embedded-data @gol
631 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
632 -mcode-readable=@var{setting} @gol
633 -msplit-addresses -mno-split-addresses @gol
634 -mexplicit-relocs -mno-explicit-relocs @gol
635 -mcheck-zero-division -mno-check-zero-division @gol
636 -mdivide-traps -mdivide-breaks @gol
637 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
638 -mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol
639 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
640 -mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130 -mno-fix-vr4130 @gol
641 -mfix-sb1 -mno-fix-sb1 @gol
642 -mflush-func=@var{func} -mno-flush-func @gol
643 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
644 -mfp-exceptions -mno-fp-exceptions @gol
645 -mvr4130-align -mno-vr4130-align}
648 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
649 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
650 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
651 -mno-base-addresses -msingle-exit -mno-single-exit}
653 @emph{MN10300 Options}
654 @gccoptlist{-mmult-bug -mno-mult-bug @gol
655 -mam33 -mno-am33 @gol
656 -mam33-2 -mno-am33-2 @gol
657 -mreturn-pointer-on-d0 @gol
661 @gccoptlist{-mno-crt0 -mbacc -msim @gol
662 -march=@var{cpu-type} }
664 @emph{PDP-11 Options}
665 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
666 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
667 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
668 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
669 -mbranch-expensive -mbranch-cheap @gol
670 -msplit -mno-split -munix-asm -mdec-asm}
672 @emph{PowerPC Options}
673 See RS/6000 and PowerPC Options.
675 @emph{RS/6000 and PowerPC Options}
676 @gccoptlist{-mcpu=@var{cpu-type} @gol
677 -mtune=@var{cpu-type} @gol
678 -mpower -mno-power -mpower2 -mno-power2 @gol
679 -mpowerpc -mpowerpc64 -mno-powerpc @gol
680 -maltivec -mno-altivec @gol
681 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
682 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
683 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mfprnd -mno-fprnd @gol
684 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mdfp -mno-dfp @gol
685 -mnew-mnemonics -mold-mnemonics @gol
686 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
687 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
688 -malign-power -malign-natural @gol
689 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
690 -mstring -mno-string -mupdate -mno-update @gol
691 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
692 -mstrict-align -mno-strict-align -mrelocatable @gol
693 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
694 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
695 -mdynamic-no-pic -maltivec -mswdiv @gol
696 -mprioritize-restricted-insns=@var{priority} @gol
697 -msched-costly-dep=@var{dependence_type} @gol
698 -minsert-sched-nops=@var{scheme} @gol
699 -mcall-sysv -mcall-netbsd @gol
700 -maix-struct-return -msvr4-struct-return @gol
701 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
702 -misel -mno-isel @gol
703 -misel=yes -misel=no @gol
705 -mspe=yes -mspe=no @gol
706 -mvrsave -mno-vrsave @gol
707 -mmulhw -mno-mulhw @gol
708 -mdlmzb -mno-dlmzb @gol
709 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
710 -mprototype -mno-prototype @gol
711 -msim -mmvme -mads -myellowknife -memb -msdata @gol
712 -msdata=@var{opt} -mvxworks -mwindiss -G @var{num} -pthread}
714 @emph{S/390 and zSeries Options}
715 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
716 -mhard-float -msoft-float -mlong-double-64 -mlong-double-128 @gol
717 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
718 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
719 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
720 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
721 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard}
724 @gccoptlist{-meb -mel @gol
728 -mscore5 -mscore5u -mscore7 -mscore7d}
731 @gccoptlist{-m1 -m2 -m2e -m3 -m3e @gol
732 -m4-nofpu -m4-single-only -m4-single -m4 @gol
733 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
734 -m5-64media -m5-64media-nofpu @gol
735 -m5-32media -m5-32media-nofpu @gol
736 -m5-compact -m5-compact-nofpu @gol
737 -mb -ml -mdalign -mrelax @gol
738 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
739 -mieee -misize -minline-ic_invalidate -mpadstruct -mspace @gol
740 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
741 -mdivsi3_libfunc=@var{name} @gol
742 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
746 @gccoptlist{-mcpu=@var{cpu-type} @gol
747 -mtune=@var{cpu-type} @gol
748 -mcmodel=@var{code-model} @gol
749 -m32 -m64 -mapp-regs -mno-app-regs @gol
750 -mfaster-structs -mno-faster-structs @gol
751 -mfpu -mno-fpu -mhard-float -msoft-float @gol
752 -mhard-quad-float -msoft-quad-float @gol
753 -mimpure-text -mno-impure-text -mlittle-endian @gol
754 -mstack-bias -mno-stack-bias @gol
755 -munaligned-doubles -mno-unaligned-doubles @gol
756 -mv8plus -mno-v8plus -mvis -mno-vis
757 -threads -pthreads -pthread}
760 @gccoptlist{-mwarn-reloc -merror-reloc @gol
761 -msafe-dma -munsafe-dma @gol
763 -msmall-mem -mlarge-mem -mstdmain @gol
764 -mfixed-range=@var{register-range}}
766 @emph{System V Options}
767 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
769 @emph{TMS320C3x/C4x Options}
770 @gccoptlist{-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol
771 -mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol
772 -mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol
773 -mparallel-insns -mparallel-mpy -mpreserve-float}
776 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
777 -mprolog-function -mno-prolog-function -mspace @gol
778 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
779 -mapp-regs -mno-app-regs @gol
780 -mdisable-callt -mno-disable-callt @gol
786 @gccoptlist{-mg -mgnu -munix}
788 @emph{VxWorks Options}
789 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
790 -Xbind-lazy -Xbind-now}
792 @emph{x86-64 Options}
793 See i386 and x86-64 Options.
795 @emph{Xstormy16 Options}
798 @emph{Xtensa Options}
799 @gccoptlist{-mconst16 -mno-const16 @gol
800 -mfused-madd -mno-fused-madd @gol
801 -mtext-section-literals -mno-text-section-literals @gol
802 -mtarget-align -mno-target-align @gol
803 -mlongcalls -mno-longcalls}
805 @emph{zSeries Options}
806 See S/390 and zSeries Options.
808 @item Code Generation Options
809 @xref{Code Gen Options,,Options for Code Generation Conventions}.
810 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
811 -ffixed-@var{reg} -fexceptions @gol
812 -fnon-call-exceptions -funwind-tables @gol
813 -fasynchronous-unwind-tables @gol
814 -finhibit-size-directive -finstrument-functions @gol
815 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
816 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
817 -fno-common -fno-ident @gol
818 -fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
819 -fno-jump-tables @gol
820 -frecord-gcc-switches @gol
821 -freg-struct-return -fshort-enums @gol
822 -fshort-double -fshort-wchar @gol
823 -fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
824 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
825 -fargument-alias -fargument-noalias @gol
826 -fargument-noalias-global -fargument-noalias-anything
827 -fleading-underscore -ftls-model=@var{model} @gol
828 -ftrapv -fwrapv -fbounds-check @gol
833 * Overall Options:: Controlling the kind of output:
834 an executable, object files, assembler files,
835 or preprocessed source.
836 * C Dialect Options:: Controlling the variant of C language compiled.
837 * C++ Dialect Options:: Variations on C++.
838 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
840 * Language Independent Options:: Controlling how diagnostics should be
842 * Warning Options:: How picky should the compiler be?
843 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
844 * Optimize Options:: How much optimization?
845 * Preprocessor Options:: Controlling header files and macro definitions.
846 Also, getting dependency information for Make.
847 * Assembler Options:: Passing options to the assembler.
848 * Link Options:: Specifying libraries and so on.
849 * Directory Options:: Where to find header files and libraries.
850 Where to find the compiler executable files.
851 * Spec Files:: How to pass switches to sub-processes.
852 * Target Options:: Running a cross-compiler, or an old version of GCC.
855 @node Overall Options
856 @section Options Controlling the Kind of Output
858 Compilation can involve up to four stages: preprocessing, compilation
859 proper, assembly and linking, always in that order. GCC is capable of
860 preprocessing and compiling several files either into several
861 assembler input files, or into one assembler input file; then each
862 assembler input file produces an object file, and linking combines all
863 the object files (those newly compiled, and those specified as input)
864 into an executable file.
866 @cindex file name suffix
867 For any given input file, the file name suffix determines what kind of
872 C source code which must be preprocessed.
875 C source code which should not be preprocessed.
878 C++ source code which should not be preprocessed.
881 Objective-C source code. Note that you must link with the @file{libobjc}
882 library to make an Objective-C program work.
885 Objective-C source code which should not be preprocessed.
889 Objective-C++ source code. Note that you must link with the @file{libobjc}
890 library to make an Objective-C++ program work. Note that @samp{.M} refers
891 to a literal capital M@.
894 Objective-C++ source code which should not be preprocessed.
897 C, C++, Objective-C or Objective-C++ header file to be turned into a
902 @itemx @var{file}.cxx
903 @itemx @var{file}.cpp
904 @itemx @var{file}.CPP
905 @itemx @var{file}.c++
907 C++ source code which must be preprocessed. Note that in @samp{.cxx},
908 the last two letters must both be literally @samp{x}. Likewise,
909 @samp{.C} refers to a literal capital C@.
913 Objective-C++ source code which must be preprocessed.
916 Objective-C++ source code which should not be preprocessed.
921 @itemx @var{file}.hxx
922 @itemx @var{file}.hpp
923 @itemx @var{file}.HPP
924 @itemx @var{file}.h++
925 @itemx @var{file}.tcc
926 C++ header file to be turned into a precompiled header.
929 @itemx @var{file}.for
930 @itemx @var{file}.FOR
931 Fixed form Fortran source code which should not be preprocessed.
934 @itemx @var{file}.fpp
935 @itemx @var{file}.FPP
936 Fixed form Fortran source code which must be preprocessed (with the traditional
940 @itemx @var{file}.f95
941 Free form Fortran source code which should not be preprocessed.
944 @itemx @var{file}.F95
945 Free form Fortran source code which must be preprocessed (with the
946 traditional preprocessor).
948 @c FIXME: Descriptions of Java file types.
955 Ada source code file which contains a library unit declaration (a
956 declaration of a package, subprogram, or generic, or a generic
957 instantiation), or a library unit renaming declaration (a package,
958 generic, or subprogram renaming declaration). Such files are also
961 @itemx @var{file}.adb
962 Ada source code file containing a library unit body (a subprogram or
963 package body). Such files are also called @dfn{bodies}.
965 @c GCC also knows about some suffixes for languages not yet included:
976 Assembler code which must be preprocessed.
979 An object file to be fed straight into linking.
980 Any file name with no recognized suffix is treated this way.
984 You can specify the input language explicitly with the @option{-x} option:
987 @item -x @var{language}
988 Specify explicitly the @var{language} for the following input files
989 (rather than letting the compiler choose a default based on the file
990 name suffix). This option applies to all following input files until
991 the next @option{-x} option. Possible values for @var{language} are:
993 c c-header c-cpp-output
994 c++ c++-header c++-cpp-output
995 objective-c objective-c-header objective-c-cpp-output
996 objective-c++ objective-c++-header objective-c++-cpp-output
997 assembler assembler-with-cpp
1005 Turn off any specification of a language, so that subsequent files are
1006 handled according to their file name suffixes (as they are if @option{-x}
1007 has not been used at all).
1009 @item -pass-exit-codes
1010 @opindex pass-exit-codes
1011 Normally the @command{gcc} program will exit with the code of 1 if any
1012 phase of the compiler returns a non-success return code. If you specify
1013 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
1014 numerically highest error produced by any phase that returned an error
1015 indication. The C, C++, and Fortran frontends return 4, if an internal
1016 compiler error is encountered.
1019 If you only want some of the stages of compilation, you can use
1020 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1021 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1022 @command{gcc} is to stop. Note that some combinations (for example,
1023 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1028 Compile or assemble the source files, but do not link. The linking
1029 stage simply is not done. The ultimate output is in the form of an
1030 object file for each source file.
1032 By default, the object file name for a source file is made by replacing
1033 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1035 Unrecognized input files, not requiring compilation or assembly, are
1040 Stop after the stage of compilation proper; do not assemble. The output
1041 is in the form of an assembler code file for each non-assembler input
1044 By default, the assembler file name for a source file is made by
1045 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1047 Input files that don't require compilation are ignored.
1051 Stop after the preprocessing stage; do not run the compiler proper. The
1052 output is in the form of preprocessed source code, which is sent to the
1055 Input files which don't require preprocessing are ignored.
1057 @cindex output file option
1060 Place output in file @var{file}. This applies regardless to whatever
1061 sort of output is being produced, whether it be an executable file,
1062 an object file, an assembler file or preprocessed C code.
1064 If @option{-o} is not specified, the default is to put an executable
1065 file in @file{a.out}, the object file for
1066 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1067 assembler file in @file{@var{source}.s}, a precompiled header file in
1068 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1073 Print (on standard error output) the commands executed to run the stages
1074 of compilation. Also print the version number of the compiler driver
1075 program and of the preprocessor and the compiler proper.
1079 Like @option{-v} except the commands are not executed and all command
1080 arguments are quoted. This is useful for shell scripts to capture the
1081 driver-generated command lines.
1085 Use pipes rather than temporary files for communication between the
1086 various stages of compilation. This fails to work on some systems where
1087 the assembler is unable to read from a pipe; but the GNU assembler has
1092 If you are compiling multiple source files, this option tells the driver
1093 to pass all the source files to the compiler at once (for those
1094 languages for which the compiler can handle this). This will allow
1095 intermodule analysis (IMA) to be performed by the compiler. Currently the only
1096 language for which this is supported is C@. If you pass source files for
1097 multiple languages to the driver, using this option, the driver will invoke
1098 the compiler(s) that support IMA once each, passing each compiler all the
1099 source files appropriate for it. For those languages that do not support
1100 IMA this option will be ignored, and the compiler will be invoked once for
1101 each source file in that language. If you use this option in conjunction
1102 with @option{-save-temps}, the compiler will generate multiple
1104 (one for each source file), but only one (combined) @file{.o} or
1109 Print (on the standard output) a description of the command line options
1110 understood by @command{gcc}. If the @option{-v} option is also specified
1111 then @option{--help} will also be passed on to the various processes
1112 invoked by @command{gcc}, so that they can display the command line options
1113 they accept. If the @option{-Wextra} option has also been specified
1114 (prior to the @option{--help} option), then command line options which
1115 have no documentation associated with them will also be displayed.
1118 @opindex target-help
1119 Print (on the standard output) a description of target-specific command
1120 line options for each tool. For some targets extra target-specific
1121 information may also be printed.
1123 @item --help=@var{class}@r{[},@var{qualifier}@r{]}
1124 Print (on the standard output) a description of the command line
1125 options understood by the compiler that fit into a specific class.
1126 The class can be one of @samp{optimizers}, @samp{warnings}, @samp{target},
1127 @samp{params}, or @var{language}:
1130 @item @samp{optimizers}
1131 This will display all of the optimization options supported by the
1134 @item @samp{warnings}
1135 This will display all of the options controlling warning messages
1136 produced by the compiler.
1139 This will display target-specific options. Unlike the
1140 @option{--target-help} option however, target-specific options of the
1141 linker and assembler will not be displayed. This is because those
1142 tools do not currently support the extended @option{--help=} syntax.
1145 This will display the values recognized by the @option{--param}
1148 @item @var{language}
1149 This will display the options supported for @var{language}, where
1150 @var{language} is the name of one of the languages supported in this
1154 This will display the options that are common to all languages.
1157 It is possible to further refine the output of the @option{--help=}
1158 option by adding a comma separated list of qualifiers after the
1159 class. These can be any from the following list:
1162 @item @samp{undocumented}
1163 Display only those options which are undocumented.
1166 Display options which take an argument that appears after an equal
1167 sign in the same continuous piece of text, such as:
1168 @samp{--help=target}.
1170 @item @samp{separate}
1171 Display options which take an argument that appears as a separate word
1172 following the original option, such as: @samp{-o output-file}.
1175 Thus for example to display all the undocumented target-specific
1176 switches supported by the compiler the following can be used:
1179 --help=target,undocumented
1182 The sense of a qualifier can be inverted by prefixing it with the
1183 @var{^} character, so for example to display all binary warning
1184 options (i.e. ones that are either on or off and that do not take an
1185 argument), which have a description the following can be used:
1188 --help=warnings,^joined,^undocumented
1191 A class can also be used as a qualifier, although this usually
1192 restricts the output by so much that there is nothing to display. One
1193 case where it does work however is when one of the classes is
1194 @var{target}. So for example to display all the target-specific
1195 optimization options the following can be used:
1198 --help=target,optimizers
1201 The @option{--help=} option can be repeated on the command line. Each
1202 successive use will display its requested class of options, skipping
1203 those that have already been displayed.
1205 If the @option{-Q} option appears on the command line before the
1206 @option{--help=} option, then the descriptive text displayed by
1207 @option{--help=} is changed. Instead of describing the displayed
1208 options, an indication is given as to whether the option is enabled,
1209 disabled or set to a specific value (assuming that the compiler
1210 knows this at the point where the @option{--help=} option is used).
1212 Here is a truncated example from the ARM port of @command{gcc}:
1215 % gcc -Q -mabi=2 --help=target -c
1216 The following options are target specific:
1218 -mabort-on-noreturn [disabled]
1222 The output is sensitive to the effects of previous command line
1223 options, so for example it is possible to find out which optimizations
1224 are enabled at @option{-O2} by using:
1227 -O2 --help=optimizers
1230 Alternatively you can discover which binary optimizations are enabled
1231 by @option{-O3} by using:
1234 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1235 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1236 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1241 Display the version number and copyrights of the invoked GCC@.
1243 @include @value{srcdir}/../libiberty/at-file.texi
1247 @section Compiling C++ Programs
1249 @cindex suffixes for C++ source
1250 @cindex C++ source file suffixes
1251 C++ source files conventionally use one of the suffixes @samp{.C},
1252 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1253 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1254 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1255 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1256 files with these names and compiles them as C++ programs even if you
1257 call the compiler the same way as for compiling C programs (usually
1258 with the name @command{gcc}).
1262 However, the use of @command{gcc} does not add the C++ library.
1263 @command{g++} is a program that calls GCC and treats @samp{.c},
1264 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1265 files unless @option{-x} is used, and automatically specifies linking
1266 against the C++ library. This program is also useful when
1267 precompiling a C header file with a @samp{.h} extension for use in C++
1268 compilations. On many systems, @command{g++} is also installed with
1269 the name @command{c++}.
1271 @cindex invoking @command{g++}
1272 When you compile C++ programs, you may specify many of the same
1273 command-line options that you use for compiling programs in any
1274 language; or command-line options meaningful for C and related
1275 languages; or options that are meaningful only for C++ programs.
1276 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1277 explanations of options for languages related to C@.
1278 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1279 explanations of options that are meaningful only for C++ programs.
1281 @node C Dialect Options
1282 @section Options Controlling C Dialect
1283 @cindex dialect options
1284 @cindex language dialect options
1285 @cindex options, dialect
1287 The following options control the dialect of C (or languages derived
1288 from C, such as C++, Objective-C and Objective-C++) that the compiler
1292 @cindex ANSI support
1296 In C mode, support all ISO C90 programs. In C++ mode,
1297 remove GNU extensions that conflict with ISO C++.
1299 This turns off certain features of GCC that are incompatible with ISO
1300 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1301 such as the @code{asm} and @code{typeof} keywords, and
1302 predefined macros such as @code{unix} and @code{vax} that identify the
1303 type of system you are using. It also enables the undesirable and
1304 rarely used ISO trigraph feature. For the C compiler,
1305 it disables recognition of C++ style @samp{//} comments as well as
1306 the @code{inline} keyword.
1308 The alternate keywords @code{__asm__}, @code{__extension__},
1309 @code{__inline__} and @code{__typeof__} continue to work despite
1310 @option{-ansi}. You would not want to use them in an ISO C program, of
1311 course, but it is useful to put them in header files that might be included
1312 in compilations done with @option{-ansi}. Alternate predefined macros
1313 such as @code{__unix__} and @code{__vax__} are also available, with or
1314 without @option{-ansi}.
1316 The @option{-ansi} option does not cause non-ISO programs to be
1317 rejected gratuitously. For that, @option{-pedantic} is required in
1318 addition to @option{-ansi}. @xref{Warning Options}.
1320 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1321 option is used. Some header files may notice this macro and refrain
1322 from declaring certain functions or defining certain macros that the
1323 ISO standard doesn't call for; this is to avoid interfering with any
1324 programs that might use these names for other things.
1326 Functions which would normally be built in but do not have semantics
1327 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1328 functions with @option{-ansi} is used. @xref{Other Builtins,,Other
1329 built-in functions provided by GCC}, for details of the functions
1334 Determine the language standard. This option is currently only
1335 supported when compiling C or C++. A value for this option must be
1336 provided; possible values are
1341 ISO C90 (same as @option{-ansi}).
1343 @item iso9899:199409
1344 ISO C90 as modified in amendment 1.
1350 ISO C99. Note that this standard is not yet fully supported; see
1351 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1352 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1355 Default, ISO C90 plus GNU extensions (including some C99 features).
1359 ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC,
1360 this will become the default. The name @samp{gnu9x} is deprecated.
1363 The 1998 ISO C++ standard plus amendments.
1366 The same as @option{-std=c++98} plus GNU extensions. This is the
1367 default for C++ code.
1370 The working draft of the upcoming ISO C++0x standard. This option
1371 enables experimental features that are likely to be included in
1372 C++0x. The working draft is constantly changing, and any feature that is
1373 enabled by this flag may be removed from future versions of GCC if it is
1374 not part of the C++0x standard.
1377 The same as @option{-std=c++0x} plus GNU extensions. As with
1378 @option{-std=c++0x}, this option enables experimental features that may
1379 be removed in future versions of GCC.
1382 Even when this option is not specified, you can still use some of the
1383 features of newer standards in so far as they do not conflict with
1384 previous C standards. For example, you may use @code{__restrict__} even
1385 when @option{-std=c99} is not specified.
1387 The @option{-std} options specifying some version of ISO C have the same
1388 effects as @option{-ansi}, except that features that were not in ISO C90
1389 but are in the specified version (for example, @samp{//} comments and
1390 the @code{inline} keyword in ISO C99) are not disabled.
1392 @xref{Standards,,Language Standards Supported by GCC}, for details of
1393 these standard versions.
1395 @item -fgnu89-inline
1396 @opindex fgnu89-inline
1397 The option @option{-fgnu89-inline} tells GCC to use the traditional
1398 GNU semantics for @code{inline} functions when in C99 mode.
1399 @xref{Inline,,An Inline Function is As Fast As a Macro}. This option
1400 is accepted and ignored by GCC versions 4.1.3 up to but not including
1401 4.3. In GCC versions 4.3 and later it changes the behavior of GCC in
1402 C99 mode. Using this option is roughly equivalent to adding the
1403 @code{gnu_inline} function attribute to all inline functions
1404 (@pxref{Function Attributes}).
1406 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1407 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1408 specifies the default behavior). This option was first supported in
1409 GCC 4.3. This option is not supported in C89 or gnu89 mode.
1411 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1412 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1413 in effect for @code{inline} functions. @xref{Common Predefined
1414 Macros,,,cpp,The C Preprocessor}.
1416 @item -aux-info @var{filename}
1418 Output to the given filename prototyped declarations for all functions
1419 declared and/or defined in a translation unit, including those in header
1420 files. This option is silently ignored in any language other than C@.
1422 Besides declarations, the file indicates, in comments, the origin of
1423 each declaration (source file and line), whether the declaration was
1424 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1425 @samp{O} for old, respectively, in the first character after the line
1426 number and the colon), and whether it came from a declaration or a
1427 definition (@samp{C} or @samp{F}, respectively, in the following
1428 character). In the case of function definitions, a K&R-style list of
1429 arguments followed by their declarations is also provided, inside
1430 comments, after the declaration.
1434 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1435 keyword, so that code can use these words as identifiers. You can use
1436 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1437 instead. @option{-ansi} implies @option{-fno-asm}.
1439 In C++, this switch only affects the @code{typeof} keyword, since
1440 @code{asm} and @code{inline} are standard keywords. You may want to
1441 use the @option{-fno-gnu-keywords} flag instead, which has the same
1442 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1443 switch only affects the @code{asm} and @code{typeof} keywords, since
1444 @code{inline} is a standard keyword in ISO C99.
1447 @itemx -fno-builtin-@var{function}
1448 @opindex fno-builtin
1449 @cindex built-in functions
1450 Don't recognize built-in functions that do not begin with
1451 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1452 functions provided by GCC}, for details of the functions affected,
1453 including those which are not built-in functions when @option{-ansi} or
1454 @option{-std} options for strict ISO C conformance are used because they
1455 do not have an ISO standard meaning.
1457 GCC normally generates special code to handle certain built-in functions
1458 more efficiently; for instance, calls to @code{alloca} may become single
1459 instructions that adjust the stack directly, and calls to @code{memcpy}
1460 may become inline copy loops. The resulting code is often both smaller
1461 and faster, but since the function calls no longer appear as such, you
1462 cannot set a breakpoint on those calls, nor can you change the behavior
1463 of the functions by linking with a different library. In addition,
1464 when a function is recognized as a built-in function, GCC may use
1465 information about that function to warn about problems with calls to
1466 that function, or to generate more efficient code, even if the
1467 resulting code still contains calls to that function. For example,
1468 warnings are given with @option{-Wformat} for bad calls to
1469 @code{printf}, when @code{printf} is built in, and @code{strlen} is
1470 known not to modify global memory.
1472 With the @option{-fno-builtin-@var{function}} option
1473 only the built-in function @var{function} is
1474 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1475 function is named this is not built-in in this version of GCC, this
1476 option is ignored. There is no corresponding
1477 @option{-fbuiltin-@var{function}} option; if you wish to enable
1478 built-in functions selectively when using @option{-fno-builtin} or
1479 @option{-ffreestanding}, you may define macros such as:
1482 #define abs(n) __builtin_abs ((n))
1483 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1488 @cindex hosted environment
1490 Assert that compilation takes place in a hosted environment. This implies
1491 @option{-fbuiltin}. A hosted environment is one in which the
1492 entire standard library is available, and in which @code{main} has a return
1493 type of @code{int}. Examples are nearly everything except a kernel.
1494 This is equivalent to @option{-fno-freestanding}.
1496 @item -ffreestanding
1497 @opindex ffreestanding
1498 @cindex hosted environment
1500 Assert that compilation takes place in a freestanding environment. This
1501 implies @option{-fno-builtin}. A freestanding environment
1502 is one in which the standard library may not exist, and program startup may
1503 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1504 This is equivalent to @option{-fno-hosted}.
1506 @xref{Standards,,Language Standards Supported by GCC}, for details of
1507 freestanding and hosted environments.
1511 @cindex openmp parallel
1512 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1513 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1514 compiler generates parallel code according to the OpenMP Application
1515 Program Interface v2.5 @w{@uref{http://www.openmp.org/}}.
1517 @item -fms-extensions
1518 @opindex fms-extensions
1519 Accept some non-standard constructs used in Microsoft header files.
1521 Some cases of unnamed fields in structures and unions are only
1522 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1523 fields within structs/unions}, for details.
1527 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1528 options for strict ISO C conformance) implies @option{-trigraphs}.
1530 @item -no-integrated-cpp
1531 @opindex no-integrated-cpp
1532 Performs a compilation in two passes: preprocessing and compiling. This
1533 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1534 @option{-B} option. The user supplied compilation step can then add in
1535 an additional preprocessing step after normal preprocessing but before
1536 compiling. The default is to use the integrated cpp (internal cpp)
1538 The semantics of this option will change if "cc1", "cc1plus", and
1539 "cc1obj" are merged.
1541 @cindex traditional C language
1542 @cindex C language, traditional
1544 @itemx -traditional-cpp
1545 @opindex traditional-cpp
1546 @opindex traditional
1547 Formerly, these options caused GCC to attempt to emulate a pre-standard
1548 C compiler. They are now only supported with the @option{-E} switch.
1549 The preprocessor continues to support a pre-standard mode. See the GNU
1550 CPP manual for details.
1552 @item -fcond-mismatch
1553 @opindex fcond-mismatch
1554 Allow conditional expressions with mismatched types in the second and
1555 third arguments. The value of such an expression is void. This option
1556 is not supported for C++.
1558 @item -flax-vector-conversions
1559 @opindex flax-vector-conversions
1560 Allow implicit conversions between vectors with differing numbers of
1561 elements and/or incompatible element types. This option should not be
1564 @item -funsigned-char
1565 @opindex funsigned-char
1566 Let the type @code{char} be unsigned, like @code{unsigned char}.
1568 Each kind of machine has a default for what @code{char} should
1569 be. It is either like @code{unsigned char} by default or like
1570 @code{signed char} by default.
1572 Ideally, a portable program should always use @code{signed char} or
1573 @code{unsigned char} when it depends on the signedness of an object.
1574 But many programs have been written to use plain @code{char} and
1575 expect it to be signed, or expect it to be unsigned, depending on the
1576 machines they were written for. This option, and its inverse, let you
1577 make such a program work with the opposite default.
1579 The type @code{char} is always a distinct type from each of
1580 @code{signed char} or @code{unsigned char}, even though its behavior
1581 is always just like one of those two.
1584 @opindex fsigned-char
1585 Let the type @code{char} be signed, like @code{signed char}.
1587 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1588 the negative form of @option{-funsigned-char}. Likewise, the option
1589 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1591 @item -fsigned-bitfields
1592 @itemx -funsigned-bitfields
1593 @itemx -fno-signed-bitfields
1594 @itemx -fno-unsigned-bitfields
1595 @opindex fsigned-bitfields
1596 @opindex funsigned-bitfields
1597 @opindex fno-signed-bitfields
1598 @opindex fno-unsigned-bitfields
1599 These options control whether a bit-field is signed or unsigned, when the
1600 declaration does not use either @code{signed} or @code{unsigned}. By
1601 default, such a bit-field is signed, because this is consistent: the
1602 basic integer types such as @code{int} are signed types.
1605 @node C++ Dialect Options
1606 @section Options Controlling C++ Dialect
1608 @cindex compiler options, C++
1609 @cindex C++ options, command line
1610 @cindex options, C++
1611 This section describes the command-line options that are only meaningful
1612 for C++ programs; but you can also use most of the GNU compiler options
1613 regardless of what language your program is in. For example, you
1614 might compile a file @code{firstClass.C} like this:
1617 g++ -g -frepo -O -c firstClass.C
1621 In this example, only @option{-frepo} is an option meant
1622 only for C++ programs; you can use the other options with any
1623 language supported by GCC@.
1625 Here is a list of options that are @emph{only} for compiling C++ programs:
1629 @item -fabi-version=@var{n}
1630 @opindex fabi-version
1631 Use version @var{n} of the C++ ABI@. Version 2 is the version of the
1632 C++ ABI that first appeared in G++ 3.4. Version 1 is the version of
1633 the C++ ABI that first appeared in G++ 3.2. Version 0 will always be
1634 the version that conforms most closely to the C++ ABI specification.
1635 Therefore, the ABI obtained using version 0 will change as ABI bugs
1638 The default is version 2.
1640 @item -fno-access-control
1641 @opindex fno-access-control
1642 Turn off all access checking. This switch is mainly useful for working
1643 around bugs in the access control code.
1647 Check that the pointer returned by @code{operator new} is non-null
1648 before attempting to modify the storage allocated. This check is
1649 normally unnecessary because the C++ standard specifies that
1650 @code{operator new} will only return @code{0} if it is declared
1651 @samp{throw()}, in which case the compiler will always check the
1652 return value even without this option. In all other cases, when
1653 @code{operator new} has a non-empty exception specification, memory
1654 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
1655 @samp{new (nothrow)}.
1657 @item -fconserve-space
1658 @opindex fconserve-space
1659 Put uninitialized or runtime-initialized global variables into the
1660 common segment, as C does. This saves space in the executable at the
1661 cost of not diagnosing duplicate definitions. If you compile with this
1662 flag and your program mysteriously crashes after @code{main()} has
1663 completed, you may have an object that is being destroyed twice because
1664 two definitions were merged.
1666 This option is no longer useful on most targets, now that support has
1667 been added for putting variables into BSS without making them common.
1669 @item -ffriend-injection
1670 @opindex ffriend-injection
1671 Inject friend functions into the enclosing namespace, so that they are
1672 visible outside the scope of the class in which they are declared.
1673 Friend functions were documented to work this way in the old Annotated
1674 C++ Reference Manual, and versions of G++ before 4.1 always worked
1675 that way. However, in ISO C++ a friend function which is not declared
1676 in an enclosing scope can only be found using argument dependent
1677 lookup. This option causes friends to be injected as they were in
1680 This option is for compatibility, and may be removed in a future
1683 @item -fno-elide-constructors
1684 @opindex fno-elide-constructors
1685 The C++ standard allows an implementation to omit creating a temporary
1686 which is only used to initialize another object of the same type.
1687 Specifying this option disables that optimization, and forces G++ to
1688 call the copy constructor in all cases.
1690 @item -fno-enforce-eh-specs
1691 @opindex fno-enforce-eh-specs
1692 Don't generate code to check for violation of exception specifications
1693 at runtime. This option violates the C++ standard, but may be useful
1694 for reducing code size in production builds, much like defining
1695 @samp{NDEBUG}. This does not give user code permission to throw
1696 exceptions in violation of the exception specifications; the compiler
1697 will still optimize based on the specifications, so throwing an
1698 unexpected exception will result in undefined behavior.
1701 @itemx -fno-for-scope
1703 @opindex fno-for-scope
1704 If @option{-ffor-scope} is specified, the scope of variables declared in
1705 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1706 as specified by the C++ standard.
1707 If @option{-fno-for-scope} is specified, the scope of variables declared in
1708 a @i{for-init-statement} extends to the end of the enclosing scope,
1709 as was the case in old versions of G++, and other (traditional)
1710 implementations of C++.
1712 The default if neither flag is given to follow the standard,
1713 but to allow and give a warning for old-style code that would
1714 otherwise be invalid, or have different behavior.
1716 @item -fno-gnu-keywords
1717 @opindex fno-gnu-keywords
1718 Do not recognize @code{typeof} as a keyword, so that code can use this
1719 word as an identifier. You can use the keyword @code{__typeof__} instead.
1720 @option{-ansi} implies @option{-fno-gnu-keywords}.
1722 @item -fno-implicit-templates
1723 @opindex fno-implicit-templates
1724 Never emit code for non-inline templates which are instantiated
1725 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1726 @xref{Template Instantiation}, for more information.
1728 @item -fno-implicit-inline-templates
1729 @opindex fno-implicit-inline-templates
1730 Don't emit code for implicit instantiations of inline templates, either.
1731 The default is to handle inlines differently so that compiles with and
1732 without optimization will need the same set of explicit instantiations.
1734 @item -fno-implement-inlines
1735 @opindex fno-implement-inlines
1736 To save space, do not emit out-of-line copies of inline functions
1737 controlled by @samp{#pragma implementation}. This will cause linker
1738 errors if these functions are not inlined everywhere they are called.
1740 @item -fms-extensions
1741 @opindex fms-extensions
1742 Disable pedantic warnings about constructs used in MFC, such as implicit
1743 int and getting a pointer to member function via non-standard syntax.
1745 @item -fno-nonansi-builtins
1746 @opindex fno-nonansi-builtins
1747 Disable built-in declarations of functions that are not mandated by
1748 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
1749 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1751 @item -fno-operator-names
1752 @opindex fno-operator-names
1753 Do not treat the operator name keywords @code{and}, @code{bitand},
1754 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1755 synonyms as keywords.
1757 @item -fno-optional-diags
1758 @opindex fno-optional-diags
1759 Disable diagnostics that the standard says a compiler does not need to
1760 issue. Currently, the only such diagnostic issued by G++ is the one for
1761 a name having multiple meanings within a class.
1764 @opindex fpermissive
1765 Downgrade some diagnostics about nonconformant code from errors to
1766 warnings. Thus, using @option{-fpermissive} will allow some
1767 nonconforming code to compile.
1771 Enable automatic template instantiation at link time. This option also
1772 implies @option{-fno-implicit-templates}. @xref{Template
1773 Instantiation}, for more information.
1777 Disable generation of information about every class with virtual
1778 functions for use by the C++ runtime type identification features
1779 (@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
1780 of the language, you can save some space by using this flag. Note that
1781 exception handling uses the same information, but it will generate it as
1782 needed. The @samp{dynamic_cast} operator can still be used for casts that
1783 do not require runtime type information, i.e. casts to @code{void *} or to
1784 unambiguous base classes.
1788 Emit statistics about front-end processing at the end of the compilation.
1789 This information is generally only useful to the G++ development team.
1791 @item -ftemplate-depth-@var{n}
1792 @opindex ftemplate-depth
1793 Set the maximum instantiation depth for template classes to @var{n}.
1794 A limit on the template instantiation depth is needed to detect
1795 endless recursions during template class instantiation. ANSI/ISO C++
1796 conforming programs must not rely on a maximum depth greater than 17.
1798 @item -fno-threadsafe-statics
1799 @opindex fno-threadsafe-statics
1800 Do not emit the extra code to use the routines specified in the C++
1801 ABI for thread-safe initialization of local statics. You can use this
1802 option to reduce code size slightly in code that doesn't need to be
1805 @item -fuse-cxa-atexit
1806 @opindex fuse-cxa-atexit
1807 Register destructors for objects with static storage duration with the
1808 @code{__cxa_atexit} function rather than the @code{atexit} function.
1809 This option is required for fully standards-compliant handling of static
1810 destructors, but will only work if your C library supports
1811 @code{__cxa_atexit}.
1813 @item -fno-use-cxa-get-exception-ptr
1814 @opindex fno-use-cxa-get-exception-ptr
1815 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
1816 will cause @code{std::uncaught_exception} to be incorrect, but is necessary
1817 if the runtime routine is not available.
1819 @item -fvisibility-inlines-hidden
1820 @opindex fvisibility-inlines-hidden
1821 This switch declares that the user does not attempt to compare
1822 pointers to inline methods where the addresses of the two functions
1823 were taken in different shared objects.
1825 The effect of this is that GCC may, effectively, mark inline methods with
1826 @code{__attribute__ ((visibility ("hidden")))} so that they do not
1827 appear in the export table of a DSO and do not require a PLT indirection
1828 when used within the DSO@. Enabling this option can have a dramatic effect
1829 on load and link times of a DSO as it massively reduces the size of the
1830 dynamic export table when the library makes heavy use of templates.
1832 The behavior of this switch is not quite the same as marking the
1833 methods as hidden directly, because it does not affect static variables
1834 local to the function or cause the compiler to deduce that
1835 the function is defined in only one shared object.
1837 You may mark a method as having a visibility explicitly to negate the
1838 effect of the switch for that method. For example, if you do want to
1839 compare pointers to a particular inline method, you might mark it as
1840 having default visibility. Marking the enclosing class with explicit
1841 visibility will have no effect.
1843 Explicitly instantiated inline methods are unaffected by this option
1844 as their linkage might otherwise cross a shared library boundary.
1845 @xref{Template Instantiation}.
1847 @item -fvisibility-ms-compat
1848 @opindex fvisibility-ms-compat
1849 This flag attempts to use visibility settings to make GCC's C++
1850 linkage model compatible with that of Microsoft Visual Studio.
1852 The flag makes these changes to GCC's linkage model:
1856 It sets the default visibility to @code{hidden}, like
1857 @option{-fvisibility=hidden}.
1860 Types, but not their members, are not hidden by default.
1863 The One Definition Rule is relaxed for types without explicit
1864 visibility specifications which are defined in more than one different
1865 shared object: those declarations are permitted if they would have
1866 been permitted when this option was not used.
1869 In new code it is better to use @option{-fvisibility=hidden} and
1870 export those classes which are intended to be externally visible.
1871 Unfortunately it is possible for code to rely, perhaps accidentally,
1872 on the Visual Studio behavior.
1874 Among the consequences of these changes are that static data members
1875 of the same type with the same name but defined in different shared
1876 objects will be different, so changing one will not change the other;
1877 and that pointers to function members defined in different shared
1878 objects may not compare equal. When this flag is given, it is a
1879 violation of the ODR to define types with the same name differently.
1883 Do not use weak symbol support, even if it is provided by the linker.
1884 By default, G++ will use weak symbols if they are available. This
1885 option exists only for testing, and should not be used by end-users;
1886 it will result in inferior code and has no benefits. This option may
1887 be removed in a future release of G++.
1891 Do not search for header files in the standard directories specific to
1892 C++, but do still search the other standard directories. (This option
1893 is used when building the C++ library.)
1896 In addition, these optimization, warning, and code generation options
1897 have meanings only for C++ programs:
1900 @item -fno-default-inline
1901 @opindex fno-default-inline
1902 Do not assume @samp{inline} for functions defined inside a class scope.
1903 @xref{Optimize Options,,Options That Control Optimization}. Note that these
1904 functions will have linkage like inline functions; they just won't be
1907 @item -Wabi @r{(C++ only)}
1909 Warn when G++ generates code that is probably not compatible with the
1910 vendor-neutral C++ ABI@. Although an effort has been made to warn about
1911 all such cases, there are probably some cases that are not warned about,
1912 even though G++ is generating incompatible code. There may also be
1913 cases where warnings are emitted even though the code that is generated
1916 You should rewrite your code to avoid these warnings if you are
1917 concerned about the fact that code generated by G++ may not be binary
1918 compatible with code generated by other compilers.
1920 The known incompatibilities at this point include:
1925 Incorrect handling of tail-padding for bit-fields. G++ may attempt to
1926 pack data into the same byte as a base class. For example:
1929 struct A @{ virtual void f(); int f1 : 1; @};
1930 struct B : public A @{ int f2 : 1; @};
1934 In this case, G++ will place @code{B::f2} into the same byte
1935 as@code{A::f1}; other compilers will not. You can avoid this problem
1936 by explicitly padding @code{A} so that its size is a multiple of the
1937 byte size on your platform; that will cause G++ and other compilers to
1938 layout @code{B} identically.
1941 Incorrect handling of tail-padding for virtual bases. G++ does not use
1942 tail padding when laying out virtual bases. For example:
1945 struct A @{ virtual void f(); char c1; @};
1946 struct B @{ B(); char c2; @};
1947 struct C : public A, public virtual B @{@};
1951 In this case, G++ will not place @code{B} into the tail-padding for
1952 @code{A}; other compilers will. You can avoid this problem by
1953 explicitly padding @code{A} so that its size is a multiple of its
1954 alignment (ignoring virtual base classes); that will cause G++ and other
1955 compilers to layout @code{C} identically.
1958 Incorrect handling of bit-fields with declared widths greater than that
1959 of their underlying types, when the bit-fields appear in a union. For
1963 union U @{ int i : 4096; @};
1967 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1968 union too small by the number of bits in an @code{int}.
1971 Empty classes can be placed at incorrect offsets. For example:
1981 struct C : public B, public A @{@};
1985 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1986 it should be placed at offset zero. G++ mistakenly believes that the
1987 @code{A} data member of @code{B} is already at offset zero.
1990 Names of template functions whose types involve @code{typename} or
1991 template template parameters can be mangled incorrectly.
1994 template <typename Q>
1995 void f(typename Q::X) @{@}
1997 template <template <typename> class Q>
1998 void f(typename Q<int>::X) @{@}
2002 Instantiations of these templates may be mangled incorrectly.
2006 @item -Wctor-dtor-privacy @r{(C++ only)}
2007 @opindex Wctor-dtor-privacy
2008 Warn when a class seems unusable because all the constructors or
2009 destructors in that class are private, and it has neither friends nor
2010 public static member functions.
2012 @item -Wnon-virtual-dtor @r{(C++ only)}
2013 @opindex Wnon-virtual-dtor
2014 Warn when a class appears to be polymorphic, thereby requiring a virtual
2015 destructor, yet it declares a non-virtual one. This warning is also
2016 enabled if -Weffc++ is specified.
2018 @item -Wreorder @r{(C++ only)}
2020 @cindex reordering, warning
2021 @cindex warning for reordering of member initializers
2022 Warn when the order of member initializers given in the code does not
2023 match the order in which they must be executed. For instance:
2029 A(): j (0), i (1) @{ @}
2033 The compiler will rearrange the member initializers for @samp{i}
2034 and @samp{j} to match the declaration order of the members, emitting
2035 a warning to that effect. This warning is enabled by @option{-Wall}.
2038 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2041 @item -Weffc++ @r{(C++ only)}
2043 Warn about violations of the following style guidelines from Scott Meyers'
2044 @cite{Effective C++} book:
2048 Item 11: Define a copy constructor and an assignment operator for classes
2049 with dynamically allocated memory.
2052 Item 12: Prefer initialization to assignment in constructors.
2055 Item 14: Make destructors virtual in base classes.
2058 Item 15: Have @code{operator=} return a reference to @code{*this}.
2061 Item 23: Don't try to return a reference when you must return an object.
2065 Also warn about violations of the following style guidelines from
2066 Scott Meyers' @cite{More Effective C++} book:
2070 Item 6: Distinguish between prefix and postfix forms of increment and
2071 decrement operators.
2074 Item 7: Never overload @code{&&}, @code{||}, or @code{,}.
2078 When selecting this option, be aware that the standard library
2079 headers do not obey all of these guidelines; use @samp{grep -v}
2080 to filter out those warnings.
2082 @item -Wno-deprecated @r{(C++ only)}
2083 @opindex Wno-deprecated
2084 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
2086 @item -Wstrict-null-sentinel @r{(C++ only)}
2087 @opindex Wstrict-null-sentinel
2088 Warn also about the use of an uncasted @code{NULL} as sentinel. When
2089 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2090 to @code{__null}. Although it is a null pointer constant not a null pointer,
2091 it is guaranteed to of the same size as a pointer. But this use is
2092 not portable across different compilers.
2094 @item -Wno-non-template-friend @r{(C++ only)}
2095 @opindex Wno-non-template-friend
2096 Disable warnings when non-templatized friend functions are declared
2097 within a template. Since the advent of explicit template specification
2098 support in G++, if the name of the friend is an unqualified-id (i.e.,
2099 @samp{friend foo(int)}), the C++ language specification demands that the
2100 friend declare or define an ordinary, nontemplate function. (Section
2101 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2102 could be interpreted as a particular specialization of a templatized
2103 function. Because this non-conforming behavior is no longer the default
2104 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2105 check existing code for potential trouble spots and is on by default.
2106 This new compiler behavior can be turned off with
2107 @option{-Wno-non-template-friend} which keeps the conformant compiler code
2108 but disables the helpful warning.
2110 @item -Wold-style-cast @r{(C++ only)}
2111 @opindex Wold-style-cast
2112 Warn if an old-style (C-style) cast to a non-void type is used within
2113 a C++ program. The new-style casts (@samp{dynamic_cast},
2114 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2115 less vulnerable to unintended effects and much easier to search for.
2117 @item -Woverloaded-virtual @r{(C++ only)}
2118 @opindex Woverloaded-virtual
2119 @cindex overloaded virtual fn, warning
2120 @cindex warning for overloaded virtual fn
2121 Warn when a function declaration hides virtual functions from a
2122 base class. For example, in:
2129 struct B: public A @{
2134 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2142 will fail to compile.
2144 @item -Wno-pmf-conversions @r{(C++ only)}
2145 @opindex Wno-pmf-conversions
2146 Disable the diagnostic for converting a bound pointer to member function
2149 @item -Wsign-promo @r{(C++ only)}
2150 @opindex Wsign-promo
2151 Warn when overload resolution chooses a promotion from unsigned or
2152 enumerated type to a signed type, over a conversion to an unsigned type of
2153 the same size. Previous versions of G++ would try to preserve
2154 unsignedness, but the standard mandates the current behavior.
2159 A& operator = (int);
2169 In this example, G++ will synthesize a default @samp{A& operator =
2170 (const A&);}, while cfront will use the user-defined @samp{operator =}.
2173 @node Objective-C and Objective-C++ Dialect Options
2174 @section Options Controlling Objective-C and Objective-C++ Dialects
2176 @cindex compiler options, Objective-C and Objective-C++
2177 @cindex Objective-C and Objective-C++ options, command line
2178 @cindex options, Objective-C and Objective-C++
2179 (NOTE: This manual does not describe the Objective-C and Objective-C++
2180 languages themselves. See @xref{Standards,,Language Standards
2181 Supported by GCC}, for references.)
2183 This section describes the command-line options that are only meaningful
2184 for Objective-C and Objective-C++ programs, but you can also use most of
2185 the language-independent GNU compiler options.
2186 For example, you might compile a file @code{some_class.m} like this:
2189 gcc -g -fgnu-runtime -O -c some_class.m
2193 In this example, @option{-fgnu-runtime} is an option meant only for
2194 Objective-C and Objective-C++ programs; you can use the other options with
2195 any language supported by GCC@.
2197 Note that since Objective-C is an extension of the C language, Objective-C
2198 compilations may also use options specific to the C front-end (e.g.,
2199 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2200 C++-specific options (e.g., @option{-Wabi}).
2202 Here is a list of options that are @emph{only} for compiling Objective-C
2203 and Objective-C++ programs:
2206 @item -fconstant-string-class=@var{class-name}
2207 @opindex fconstant-string-class
2208 Use @var{class-name} as the name of the class to instantiate for each
2209 literal string specified with the syntax @code{@@"@dots{}"}. The default
2210 class name is @code{NXConstantString} if the GNU runtime is being used, and
2211 @code{NSConstantString} if the NeXT runtime is being used (see below). The
2212 @option{-fconstant-cfstrings} option, if also present, will override the
2213 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2214 to be laid out as constant CoreFoundation strings.
2217 @opindex fgnu-runtime
2218 Generate object code compatible with the standard GNU Objective-C
2219 runtime. This is the default for most types of systems.
2221 @item -fnext-runtime
2222 @opindex fnext-runtime
2223 Generate output compatible with the NeXT runtime. This is the default
2224 for NeXT-based systems, including Darwin and Mac OS X@. The macro
2225 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2228 @item -fno-nil-receivers
2229 @opindex fno-nil-receivers
2230 Assume that all Objective-C message dispatches (e.g.,
2231 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
2232 is not @code{nil}. This allows for more efficient entry points in the runtime
2233 to be used. Currently, this option is only available in conjunction with
2234 the NeXT runtime on Mac OS X 10.3 and later.
2236 @item -fobjc-call-cxx-cdtors
2237 @opindex fobjc-call-cxx-cdtors
2238 For each Objective-C class, check if any of its instance variables is a
2239 C++ object with a non-trivial default constructor. If so, synthesize a
2240 special @code{- (id) .cxx_construct} instance method that will run
2241 non-trivial default constructors on any such instance variables, in order,
2242 and then return @code{self}. Similarly, check if any instance variable
2243 is a C++ object with a non-trivial destructor, and if so, synthesize a
2244 special @code{- (void) .cxx_destruct} method that will run
2245 all such default destructors, in reverse order.
2247 The @code{- (id) .cxx_construct} and/or @code{- (void) .cxx_destruct} methods
2248 thusly generated will only operate on instance variables declared in the
2249 current Objective-C class, and not those inherited from superclasses. It
2250 is the responsibility of the Objective-C runtime to invoke all such methods
2251 in an object's inheritance hierarchy. The @code{- (id) .cxx_construct} methods
2252 will be invoked by the runtime immediately after a new object
2253 instance is allocated; the @code{- (void) .cxx_destruct} methods will
2254 be invoked immediately before the runtime deallocates an object instance.
2256 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2257 support for invoking the @code{- (id) .cxx_construct} and
2258 @code{- (void) .cxx_destruct} methods.
2260 @item -fobjc-direct-dispatch
2261 @opindex fobjc-direct-dispatch
2262 Allow fast jumps to the message dispatcher. On Darwin this is
2263 accomplished via the comm page.
2265 @item -fobjc-exceptions
2266 @opindex fobjc-exceptions
2267 Enable syntactic support for structured exception handling in Objective-C,
2268 similar to what is offered by C++ and Java. This option is
2269 unavailable in conjunction with the NeXT runtime on Mac OS X 10.2 and
2278 @@catch (AnObjCClass *exc) @{
2285 @@catch (AnotherClass *exc) @{
2288 @@catch (id allOthers) @{
2298 The @code{@@throw} statement may appear anywhere in an Objective-C or
2299 Objective-C++ program; when used inside of a @code{@@catch} block, the
2300 @code{@@throw} may appear without an argument (as shown above), in which case
2301 the object caught by the @code{@@catch} will be rethrown.
2303 Note that only (pointers to) Objective-C objects may be thrown and
2304 caught using this scheme. When an object is thrown, it will be caught
2305 by the nearest @code{@@catch} clause capable of handling objects of that type,
2306 analogously to how @code{catch} blocks work in C++ and Java. A
2307 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
2308 any and all Objective-C exceptions not caught by previous @code{@@catch}
2311 The @code{@@finally} clause, if present, will be executed upon exit from the
2312 immediately preceding @code{@@try @dots{} @@catch} section. This will happen
2313 regardless of whether any exceptions are thrown, caught or rethrown
2314 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
2315 of the @code{finally} clause in Java.
2317 There are several caveats to using the new exception mechanism:
2321 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
2322 idioms provided by the @code{NSException} class, the new
2323 exceptions can only be used on Mac OS X 10.3 (Panther) and later
2324 systems, due to additional functionality needed in the (NeXT) Objective-C
2328 As mentioned above, the new exceptions do not support handling
2329 types other than Objective-C objects. Furthermore, when used from
2330 Objective-C++, the Objective-C exception model does not interoperate with C++
2331 exceptions at this time. This means you cannot @code{@@throw} an exception
2332 from Objective-C and @code{catch} it in C++, or vice versa
2333 (i.e., @code{throw @dots{} @@catch}).
2336 The @option{-fobjc-exceptions} switch also enables the use of synchronization
2337 blocks for thread-safe execution:
2340 @@synchronized (ObjCClass *guard) @{
2345 Upon entering the @code{@@synchronized} block, a thread of execution shall
2346 first check whether a lock has been placed on the corresponding @code{guard}
2347 object by another thread. If it has, the current thread shall wait until
2348 the other thread relinquishes its lock. Once @code{guard} becomes available,
2349 the current thread will place its own lock on it, execute the code contained in
2350 the @code{@@synchronized} block, and finally relinquish the lock (thereby
2351 making @code{guard} available to other threads).
2353 Unlike Java, Objective-C does not allow for entire methods to be marked
2354 @code{@@synchronized}. Note that throwing exceptions out of
2355 @code{@@synchronized} blocks is allowed, and will cause the guarding object
2356 to be unlocked properly.
2360 Enable garbage collection (GC) in Objective-C and Objective-C++ programs.
2362 @item -freplace-objc-classes
2363 @opindex freplace-objc-classes
2364 Emit a special marker instructing @command{ld(1)} not to statically link in
2365 the resulting object file, and allow @command{dyld(1)} to load it in at
2366 run time instead. This is used in conjunction with the Fix-and-Continue
2367 debugging mode, where the object file in question may be recompiled and
2368 dynamically reloaded in the course of program execution, without the need
2369 to restart the program itself. Currently, Fix-and-Continue functionality
2370 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2375 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2376 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2377 compile time) with static class references that get initialized at load time,
2378 which improves run-time performance. Specifying the @option{-fzero-link} flag
2379 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2380 to be retained. This is useful in Zero-Link debugging mode, since it allows
2381 for individual class implementations to be modified during program execution.
2385 Dump interface declarations for all classes seen in the source file to a
2386 file named @file{@var{sourcename}.decl}.
2388 @item -Wassign-intercept
2389 @opindex Wassign-intercept
2390 Warn whenever an Objective-C assignment is being intercepted by the
2394 @opindex Wno-protocol
2395 If a class is declared to implement a protocol, a warning is issued for
2396 every method in the protocol that is not implemented by the class. The
2397 default behavior is to issue a warning for every method not explicitly
2398 implemented in the class, even if a method implementation is inherited
2399 from the superclass. If you use the @option{-Wno-protocol} option, then
2400 methods inherited from the superclass are considered to be implemented,
2401 and no warning is issued for them.
2405 Warn if multiple methods of different types for the same selector are
2406 found during compilation. The check is performed on the list of methods
2407 in the final stage of compilation. Additionally, a check is performed
2408 for each selector appearing in a @code{@@selector(@dots{})}
2409 expression, and a corresponding method for that selector has been found
2410 during compilation. Because these checks scan the method table only at
2411 the end of compilation, these warnings are not produced if the final
2412 stage of compilation is not reached, for example because an error is
2413 found during compilation, or because the @option{-fsyntax-only} option is
2416 @item -Wstrict-selector-match
2417 @opindex Wstrict-selector-match
2418 Warn if multiple methods with differing argument and/or return types are
2419 found for a given selector when attempting to send a message using this
2420 selector to a receiver of type @code{id} or @code{Class}. When this flag
2421 is off (which is the default behavior), the compiler will omit such warnings
2422 if any differences found are confined to types which share the same size
2425 @item -Wundeclared-selector
2426 @opindex Wundeclared-selector
2427 Warn if a @code{@@selector(@dots{})} expression referring to an
2428 undeclared selector is found. A selector is considered undeclared if no
2429 method with that name has been declared before the
2430 @code{@@selector(@dots{})} expression, either explicitly in an
2431 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2432 an @code{@@implementation} section. This option always performs its
2433 checks as soon as a @code{@@selector(@dots{})} expression is found,
2434 while @option{-Wselector} only performs its checks in the final stage of
2435 compilation. This also enforces the coding style convention
2436 that methods and selectors must be declared before being used.
2438 @item -print-objc-runtime-info
2439 @opindex print-objc-runtime-info
2440 Generate C header describing the largest structure that is passed by
2445 @node Language Independent Options
2446 @section Options to Control Diagnostic Messages Formatting
2447 @cindex options to control diagnostics formatting
2448 @cindex diagnostic messages
2449 @cindex message formatting
2451 Traditionally, diagnostic messages have been formatted irrespective of
2452 the output device's aspect (e.g.@: its width, @dots{}). The options described
2453 below can be used to control the diagnostic messages formatting
2454 algorithm, e.g.@: how many characters per line, how often source location
2455 information should be reported. Right now, only the C++ front end can
2456 honor these options. However it is expected, in the near future, that
2457 the remaining front ends would be able to digest them correctly.
2460 @item -fmessage-length=@var{n}
2461 @opindex fmessage-length
2462 Try to format error messages so that they fit on lines of about @var{n}
2463 characters. The default is 72 characters for @command{g++} and 0 for the rest of
2464 the front ends supported by GCC@. If @var{n} is zero, then no
2465 line-wrapping will be done; each error message will appear on a single
2468 @opindex fdiagnostics-show-location
2469 @item -fdiagnostics-show-location=once
2470 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
2471 reporter to emit @emph{once} source location information; that is, in
2472 case the message is too long to fit on a single physical line and has to
2473 be wrapped, the source location won't be emitted (as prefix) again,
2474 over and over, in subsequent continuation lines. This is the default
2477 @item -fdiagnostics-show-location=every-line
2478 Only meaningful in line-wrapping mode. Instructs the diagnostic
2479 messages reporter to emit the same source location information (as
2480 prefix) for physical lines that result from the process of breaking
2481 a message which is too long to fit on a single line.
2483 @item -fdiagnostics-show-option
2484 @opindex fdiagnostics-show-option
2485 This option instructs the diagnostic machinery to add text to each
2486 diagnostic emitted, which indicates which command line option directly
2487 controls that diagnostic, when such an option is known to the
2488 diagnostic machinery.
2490 @item -Wcoverage-mismatch
2491 @opindex Wcoverage-mismatch
2492 Warn if feedback profiles do not match when using the
2493 @option{-fprofile-use} option.
2494 If a source file was changed between @option{-fprofile-gen} and
2495 @option{-fprofile-use}, the files with the profile feedback can fail
2496 to match the source file and GCC can not use the profile feedback
2497 information. By default, GCC emits an error message in this case.
2498 The option @option{-Wcoverage-mismatch} emits a warning instead of an
2499 error. GCC does not use appropriate feedback profiles, so using this
2500 option can result in poorly optimized code. This option is useful
2501 only in the case of very minor changes such as bug fixes to an
2506 @node Warning Options
2507 @section Options to Request or Suppress Warnings
2508 @cindex options to control warnings
2509 @cindex warning messages
2510 @cindex messages, warning
2511 @cindex suppressing warnings
2513 Warnings are diagnostic messages that report constructions which
2514 are not inherently erroneous but which are risky or suggest there
2515 may have been an error.
2517 You can request many specific warnings with options beginning @samp{-W},
2518 for example @option{-Wimplicit} to request warnings on implicit
2519 declarations. Each of these specific warning options also has a
2520 negative form beginning @samp{-Wno-} to turn off warnings;
2521 for example, @option{-Wno-implicit}. This manual lists only one of the
2522 two forms, whichever is not the default.
2524 The following options control the amount and kinds of warnings produced
2525 by GCC; for further, language-specific options also refer to
2526 @ref{C++ Dialect Options} and @ref{Objective-C and Objective-C++ Dialect
2530 @cindex syntax checking
2532 @opindex fsyntax-only
2533 Check the code for syntax errors, but don't do anything beyond that.
2537 Issue all the warnings demanded by strict ISO C and ISO C++;
2538 reject all programs that use forbidden extensions, and some other
2539 programs that do not follow ISO C and ISO C++. For ISO C, follows the
2540 version of the ISO C standard specified by any @option{-std} option used.
2542 Valid ISO C and ISO C++ programs should compile properly with or without
2543 this option (though a rare few will require @option{-ansi} or a
2544 @option{-std} option specifying the required version of ISO C)@. However,
2545 without this option, certain GNU extensions and traditional C and C++
2546 features are supported as well. With this option, they are rejected.
2548 @option{-pedantic} does not cause warning messages for use of the
2549 alternate keywords whose names begin and end with @samp{__}. Pedantic
2550 warnings are also disabled in the expression that follows
2551 @code{__extension__}. However, only system header files should use
2552 these escape routes; application programs should avoid them.
2553 @xref{Alternate Keywords}.
2555 Some users try to use @option{-pedantic} to check programs for strict ISO
2556 C conformance. They soon find that it does not do quite what they want:
2557 it finds some non-ISO practices, but not all---only those for which
2558 ISO C @emph{requires} a diagnostic, and some others for which
2559 diagnostics have been added.
2561 A feature to report any failure to conform to ISO C might be useful in
2562 some instances, but would require considerable additional work and would
2563 be quite different from @option{-pedantic}. We don't have plans to
2564 support such a feature in the near future.
2566 Where the standard specified with @option{-std} represents a GNU
2567 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2568 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2569 extended dialect is based. Warnings from @option{-pedantic} are given
2570 where they are required by the base standard. (It would not make sense
2571 for such warnings to be given only for features not in the specified GNU
2572 C dialect, since by definition the GNU dialects of C include all
2573 features the compiler supports with the given option, and there would be
2574 nothing to warn about.)
2576 @item -pedantic-errors
2577 @opindex pedantic-errors
2578 Like @option{-pedantic}, except that errors are produced rather than
2583 Inhibit all warning messages.
2587 Inhibit warning messages about the use of @samp{#import}.
2589 @item -Wchar-subscripts
2590 @opindex Wchar-subscripts
2591 Warn if an array subscript has type @code{char}. This is a common cause
2592 of error, as programmers often forget that this type is signed on some
2594 This warning is enabled by @option{-Wall}.
2598 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2599 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2600 This warning is enabled by @option{-Wall}.
2602 @item -Wfatal-errors
2603 @opindex Wfatal-errors
2604 This option causes the compiler to abort compilation on the first error
2605 occurred rather than trying to keep going and printing further error
2610 @opindex ffreestanding
2611 @opindex fno-builtin
2612 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2613 the arguments supplied have types appropriate to the format string
2614 specified, and that the conversions specified in the format string make
2615 sense. This includes standard functions, and others specified by format
2616 attributes (@pxref{Function Attributes}), in the @code{printf},
2617 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2618 not in the C standard) families (or other target-specific families).
2619 Which functions are checked without format attributes having been
2620 specified depends on the standard version selected, and such checks of
2621 functions without the attribute specified are disabled by
2622 @option{-ffreestanding} or @option{-fno-builtin}.
2624 The formats are checked against the format features supported by GNU
2625 libc version 2.2. These include all ISO C90 and C99 features, as well
2626 as features from the Single Unix Specification and some BSD and GNU
2627 extensions. Other library implementations may not support all these
2628 features; GCC does not support warning about features that go beyond a
2629 particular library's limitations. However, if @option{-pedantic} is used
2630 with @option{-Wformat}, warnings will be given about format features not
2631 in the selected standard version (but not for @code{strfmon} formats,
2632 since those are not in any version of the C standard). @xref{C Dialect
2633 Options,,Options Controlling C Dialect}.
2635 Since @option{-Wformat} also checks for null format arguments for
2636 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2638 @option{-Wformat} is included in @option{-Wall}. For more control over some
2639 aspects of format checking, the options @option{-Wformat-y2k},
2640 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2641 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2642 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2645 @opindex Wformat-y2k
2646 If @option{-Wformat} is specified, also warn about @code{strftime}
2647 formats which may yield only a two-digit year.
2649 @item -Wno-format-extra-args
2650 @opindex Wno-format-extra-args
2651 If @option{-Wformat} is specified, do not warn about excess arguments to a
2652 @code{printf} or @code{scanf} format function. The C standard specifies
2653 that such arguments are ignored.
2655 Where the unused arguments lie between used arguments that are
2656 specified with @samp{$} operand number specifications, normally
2657 warnings are still given, since the implementation could not know what
2658 type to pass to @code{va_arg} to skip the unused arguments. However,
2659 in the case of @code{scanf} formats, this option will suppress the
2660 warning if the unused arguments are all pointers, since the Single
2661 Unix Specification says that such unused arguments are allowed.
2663 @item -Wno-format-zero-length
2664 @opindex Wno-format-zero-length
2665 If @option{-Wformat} is specified, do not warn about zero-length formats.
2666 The C standard specifies that zero-length formats are allowed.
2668 @item -Wformat-nonliteral
2669 @opindex Wformat-nonliteral
2670 If @option{-Wformat} is specified, also warn if the format string is not a
2671 string literal and so cannot be checked, unless the format function
2672 takes its format arguments as a @code{va_list}.
2674 @item -Wformat-security
2675 @opindex Wformat-security
2676 If @option{-Wformat} is specified, also warn about uses of format
2677 functions that represent possible security problems. At present, this
2678 warns about calls to @code{printf} and @code{scanf} functions where the
2679 format string is not a string literal and there are no format arguments,
2680 as in @code{printf (foo);}. This may be a security hole if the format
2681 string came from untrusted input and contains @samp{%n}. (This is
2682 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2683 in future warnings may be added to @option{-Wformat-security} that are not
2684 included in @option{-Wformat-nonliteral}.)
2688 Enable @option{-Wformat} plus format checks not included in
2689 @option{-Wformat}. Currently equivalent to @samp{-Wformat
2690 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2694 Warn about passing a null pointer for arguments marked as
2695 requiring a non-null value by the @code{nonnull} function attribute.
2697 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
2698 can be disabled with the @option{-Wno-nonnull} option.
2700 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
2702 Warn about uninitialized variables which are initialized with themselves.
2703 Note this option can only be used with the @option{-Wuninitialized} option,
2704 which in turn only works with @option{-O1} and above.
2706 For example, GCC will warn about @code{i} being uninitialized in the
2707 following snippet only when @option{-Winit-self} has been specified:
2718 @item -Wimplicit-int
2719 @opindex Wimplicit-int
2720 Warn when a declaration does not specify a type.
2721 This warning is enabled by @option{-Wall}.
2723 @item -Wimplicit-function-declaration
2724 @opindex Wimplicit-function-declaration
2725 @opindex Wno-implicit-function-declaration
2726 Give a warning whenever a function is used before being declared. In
2727 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
2728 enabled by default and it is made into an error by
2729 @option{-pedantic-errors}. This warning is also enabled by
2734 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2735 This warning is enabled by @option{-Wall}.
2739 Warn if the type of @samp{main} is suspicious. @samp{main} should be a
2740 function with external linkage, returning int, taking either zero
2741 arguments, two, or three arguments of appropriate types.
2742 This warning is enabled by @option{-Wall}.
2744 @item -Wmissing-braces
2745 @opindex Wmissing-braces
2746 Warn if an aggregate or union initializer is not fully bracketed. In
2747 the following example, the initializer for @samp{a} is not fully
2748 bracketed, but that for @samp{b} is fully bracketed.
2751 int a[2][2] = @{ 0, 1, 2, 3 @};
2752 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2755 This warning is enabled by @option{-Wall}.
2757 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
2758 @opindex Wmissing-include-dirs
2759 Warn if a user-supplied include directory does not exist.
2762 @opindex Wparentheses
2763 Warn if parentheses are omitted in certain contexts, such
2764 as when there is an assignment in a context where a truth value
2765 is expected, or when operators are nested whose precedence people
2766 often get confused about.
2768 Also warn if a comparison like @samp{x<=y<=z} appears; this is
2769 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
2770 interpretation from that of ordinary mathematical notation.
2772 Also warn about constructions where there may be confusion to which
2773 @code{if} statement an @code{else} branch belongs. Here is an example of
2788 In C/C++, every @code{else} branch belongs to the innermost possible
2789 @code{if} statement, which in this example is @code{if (b)}. This is
2790 often not what the programmer expected, as illustrated in the above
2791 example by indentation the programmer chose. When there is the
2792 potential for this confusion, GCC will issue a warning when this flag
2793 is specified. To eliminate the warning, add explicit braces around
2794 the innermost @code{if} statement so there is no way the @code{else}
2795 could belong to the enclosing @code{if}. The resulting code would
2812 This warning is enabled by @option{-Wall}.
2814 @item -Wsequence-point
2815 @opindex Wsequence-point
2816 Warn about code that may have undefined semantics because of violations
2817 of sequence point rules in the C and C++ standards.
2819 The C and C++ standards defines the order in which expressions in a C/C++
2820 program are evaluated in terms of @dfn{sequence points}, which represent
2821 a partial ordering between the execution of parts of the program: those
2822 executed before the sequence point, and those executed after it. These
2823 occur after the evaluation of a full expression (one which is not part
2824 of a larger expression), after the evaluation of the first operand of a
2825 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2826 function is called (but after the evaluation of its arguments and the
2827 expression denoting the called function), and in certain other places.
2828 Other than as expressed by the sequence point rules, the order of
2829 evaluation of subexpressions of an expression is not specified. All
2830 these rules describe only a partial order rather than a total order,
2831 since, for example, if two functions are called within one expression
2832 with no sequence point between them, the order in which the functions
2833 are called is not specified. However, the standards committee have
2834 ruled that function calls do not overlap.
2836 It is not specified when between sequence points modifications to the
2837 values of objects take effect. Programs whose behavior depends on this
2838 have undefined behavior; the C and C++ standards specify that ``Between
2839 the previous and next sequence point an object shall have its stored
2840 value modified at most once by the evaluation of an expression.
2841 Furthermore, the prior value shall be read only to determine the value
2842 to be stored.''. If a program breaks these rules, the results on any
2843 particular implementation are entirely unpredictable.
2845 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2846 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
2847 diagnosed by this option, and it may give an occasional false positive
2848 result, but in general it has been found fairly effective at detecting
2849 this sort of problem in programs.
2851 The standard is worded confusingly, therefore there is some debate
2852 over the precise meaning of the sequence point rules in subtle cases.
2853 Links to discussions of the problem, including proposed formal
2854 definitions, may be found on the GCC readings page, at
2855 @w{@uref{http://gcc.gnu.org/readings.html}}.
2857 This warning is enabled by @option{-Wall} for C and C++.
2860 @opindex Wreturn-type
2861 @opindex Wno-return-type
2862 Warn whenever a function is defined with a return-type that defaults
2863 to @code{int}. Also warn about any @code{return} statement with no
2864 return-value in a function whose return-type is not @code{void}
2865 (falling off the end of the function body is considered returning
2866 without a value), and about a @code{return} statement with a
2867 expression in a function whose return-type is @code{void}.
2869 Also warn if the return type of a function has a type qualifier
2870 such as @code{const}. For ISO C such a type qualifier has no effect,
2871 since the value returned by a function is not an lvalue.
2872 For C++, the warning is only emitted for scalar types or @code{void}.
2873 ISO C prohibits qualified @code{void} return types on function
2874 definitions, so such return types always receive a warning
2875 even without this option.
2877 For C++, a function without return type always produces a diagnostic
2878 message, even when @option{-Wno-return-type} is specified. The only
2879 exceptions are @samp{main} and functions defined in system headers.
2881 This warning is enabled by @option{-Wall}.
2885 Warn whenever a @code{switch} statement has an index of enumerated type
2886 and lacks a @code{case} for one or more of the named codes of that
2887 enumeration. (The presence of a @code{default} label prevents this
2888 warning.) @code{case} labels outside the enumeration range also
2889 provoke warnings when this option is used.
2890 This warning is enabled by @option{-Wall}.
2892 @item -Wswitch-default
2893 @opindex Wswitch-switch
2894 Warn whenever a @code{switch} statement does not have a @code{default}
2898 @opindex Wswitch-enum
2899 Warn whenever a @code{switch} statement has an index of enumerated type
2900 and lacks a @code{case} for one or more of the named codes of that
2901 enumeration. @code{case} labels outside the enumeration range also
2902 provoke warnings when this option is used.
2906 Warn if any trigraphs are encountered that might change the meaning of
2907 the program (trigraphs within comments are not warned about).
2908 This warning is enabled by @option{-Wall}.
2910 @item -Wunused-function
2911 @opindex Wunused-function
2912 Warn whenever a static function is declared but not defined or a
2913 non-inline static function is unused.
2914 This warning is enabled by @option{-Wall}.
2916 @item -Wunused-label
2917 @opindex Wunused-label
2918 Warn whenever a label is declared but not used.
2919 This warning is enabled by @option{-Wall}.
2921 To suppress this warning use the @samp{unused} attribute
2922 (@pxref{Variable Attributes}).
2924 @item -Wunused-parameter
2925 @opindex Wunused-parameter
2926 Warn whenever a function parameter is unused aside from its declaration.
2928 To suppress this warning use the @samp{unused} attribute
2929 (@pxref{Variable Attributes}).
2931 @item -Wunused-variable
2932 @opindex Wunused-variable
2933 Warn whenever a local variable or non-constant static variable is unused
2934 aside from its declaration.
2935 This warning is enabled by @option{-Wall}.
2937 To suppress this warning use the @samp{unused} attribute
2938 (@pxref{Variable Attributes}).
2940 @item -Wunused-value
2941 @opindex Wunused-value
2942 Warn whenever a statement computes a result that is explicitly not
2943 used. To suppress this warning cast the unused expression to
2944 @samp{void}. This includes an expression-statement or the left-hand
2945 side of a comma expression that contains no side effects. For example,
2946 an expression such as @samp{x[i,j]} will cause a warning, while
2947 @samp{x[(void)i,j]} will not.
2949 This warning is enabled by @option{-Wall}.
2953 All the above @option{-Wunused} options combined.
2955 In order to get a warning about an unused function parameter, you must
2956 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2957 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2959 @item -Wuninitialized
2960 @opindex Wuninitialized
2961 Warn if an automatic variable is used without first being initialized or
2962 if a variable may be clobbered by a @code{setjmp} call.
2964 These warnings are possible only in optimizing compilation,
2965 because they require data flow information that is computed only
2966 when optimizing. If you do not specify @option{-O}, you will not get
2967 these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized}
2968 requiring @option{-O}.
2970 If you want to warn about code which uses the uninitialized value of the
2971 variable in its own initializer, use the @option{-Winit-self} option.
2973 These warnings occur for individual uninitialized or clobbered
2974 elements of structure, union or array variables as well as for
2975 variables which are uninitialized or clobbered as a whole. They do
2976 not occur for variables or elements declared @code{volatile}. Because
2977 these warnings depend on optimization, the exact variables or elements
2978 for which there are warnings will depend on the precise optimization
2979 options and version of GCC used.
2981 Note that there may be no warning about a variable that is used only
2982 to compute a value that itself is never used, because such
2983 computations may be deleted by data flow analysis before the warnings
2986 These warnings are made optional because GCC is not smart
2987 enough to see all the reasons why the code might be correct
2988 despite appearing to have an error. Here is one example of how
3009 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
3010 always initialized, but GCC doesn't know this. Here is
3011 another common case:
3016 if (change_y) save_y = y, y = new_y;
3018 if (change_y) y = save_y;
3023 This has no bug because @code{save_y} is used only if it is set.
3025 @cindex @code{longjmp} warnings
3026 This option also warns when a non-volatile automatic variable might be
3027 changed by a call to @code{longjmp}. These warnings as well are possible
3028 only in optimizing compilation.
3030 The compiler sees only the calls to @code{setjmp}. It cannot know
3031 where @code{longjmp} will be called; in fact, a signal handler could
3032 call it at any point in the code. As a result, you may get a warning
3033 even when there is in fact no problem because @code{longjmp} cannot
3034 in fact be called at the place which would cause a problem.
3036 Some spurious warnings can be avoided if you declare all the functions
3037 you use that never return as @code{noreturn}. @xref{Function
3040 This warning is enabled by @option{-Wall}.
3042 @item -Wunknown-pragmas
3043 @opindex Wunknown-pragmas
3044 @cindex warning for unknown pragmas
3045 @cindex unknown pragmas, warning
3046 @cindex pragmas, warning of unknown
3047 Warn when a #pragma directive is encountered which is not understood by
3048 GCC@. If this command line option is used, warnings will even be issued
3049 for unknown pragmas in system header files. This is not the case if
3050 the warnings were only enabled by the @option{-Wall} command line option.
3053 @opindex Wno-pragmas
3055 Do not warn about misuses of pragmas, such as incorrect parameters,
3056 invalid syntax, or conflicts between pragmas. See also
3057 @samp{-Wunknown-pragmas}.
3059 @item -Wstrict-aliasing
3060 @opindex Wstrict-aliasing
3061 This option is only active when @option{-fstrict-aliasing} is active.
3062 It warns about code which might break the strict aliasing rules that the
3063 compiler is using for optimization. The warning does not catch all
3064 cases, but does attempt to catch the more common pitfalls. It is
3065 included in @option{-Wall}.
3066 It is equivalent to -Wstrict-aliasing=3
3068 @item -Wstrict-aliasing=n
3069 @opindex Wstrict-aliasing=n
3070 This option is only active when @option{-fstrict-aliasing} is active.
3071 It warns about code which might break the strict aliasing rules that the
3072 compiler is using for optimization.
3073 Higher levels correspond to higher accuracy (fewer false positives).
3074 Higher levels also correspond to more effort, similar to the way -O works.
3075 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
3078 Level 1: Most aggressive, quick, least accurate.
3079 Possibly useful when higher levels
3080 do not warn but -fstrict-aliasing still breaks the code, as it has very few
3081 false negatives. However, it has many false positives.
3082 Warns for all pointer conversions between possibly incompatible types,
3083 even if never dereferenced. Runs in the frontend only.
3085 Level 2: Aggressive, quick, not too precise.
3086 May still have many false positives (not as many as level 1 though),
3087 and few false negatives (but possibly more than level 1).
3088 Unlike level 1, it only warns when an address is taken. Warns about
3089 incomplete types. Runs in the frontend only.
3091 Level 3 (default for @option{-Wstrict-aliasing}):
3092 Should have very few false positives and few false
3093 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
3094 Takes care of the common punn+dereference pattern in the frontend:
3095 @code{*(int*)&some_float}.
3096 If optimization is enabled, it also runs in the backend, where it deals
3097 with multiple statement cases using flow-sensitive points-to information.
3098 Only warns when the converted pointer is dereferenced.
3099 Does not warn about incomplete types.
3101 @item -Wstrict-overflow
3102 @item -Wstrict-overflow=@var{n}
3103 @opindex Wstrict-overflow
3104 This option is only active when @option{-fstrict-overflow} is active.
3105 It warns about cases where the compiler optimizes based on the
3106 assumption that signed overflow does not occur. Note that it does not
3107 warn about all cases where the code might overflow: it only warns
3108 about cases where the compiler implements some optimization. Thus
3109 this warning depends on the optimization level.
3111 An optimization which assumes that signed overflow does not occur is
3112 perfectly safe if the values of the variables involved are such that
3113 overflow never does, in fact, occur. Therefore this warning can
3114 easily give a false positive: a warning about code which is not
3115 actually a problem. To help focus on important issues, several
3116 warning levels are defined. No warnings are issued for the use of
3117 undefined signed overflow when estimating how many iterations a loop
3118 will require, in particular when determining whether a loop will be
3122 @item -Wstrict-overflow=1
3123 Warn about cases which are both questionable and easy to avoid. For
3124 example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
3125 compiler will simplify this to @code{1}. This level of
3126 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3127 are not, and must be explicitly requested.
3129 @item -Wstrict-overflow=2
3130 Also warn about other cases where a comparison is simplified to a
3131 constant. For example: @code{abs (x) >= 0}. This can only be
3132 simplified when @option{-fstrict-overflow} is in effect, because
3133 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
3134 zero. @option{-Wstrict-overflow} (with no level) is the same as
3135 @option{-Wstrict-overflow=2}.
3137 @item -Wstrict-overflow=3
3138 Also warn about other cases where a comparison is simplified. For
3139 example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
3141 @item -Wstrict-overflow=4
3142 Also warn about other simplifications not covered by the above cases.
3143 For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
3145 @item -Wstrict-overflow=5
3146 Also warn about cases where the compiler reduces the magnitude of a
3147 constant involved in a comparison. For example: @code{x + 2 > y} will
3148 be simplified to @code{x + 1 >= y}. This is reported only at the
3149 highest warning level because this simplification applies to many
3150 comparisons, so this warning level will give a very large number of
3154 @item -Warray-bounds
3155 @opindex Wno-array-bounds
3156 @opindex Warray-bounds
3157 This option is only active when @option{-ftree-vrp} is active
3158 (default for -O2 and above). It warns about subscripts to arrays
3159 that are always out of bounds. This warning is enabled by @option{-Wall}.
3163 All of the above @samp{-W} options combined. This enables all the
3164 warnings about constructions that some users consider questionable, and
3165 that are easy to avoid (or modify to prevent the warning), even in
3166 conjunction with macros. This also enables some language-specific
3167 warnings described in @ref{C++ Dialect Options} and
3168 @ref{Objective-C and Objective-C++ Dialect Options}.
3171 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
3172 Some of them warn about constructions that users generally do not
3173 consider questionable, but which occasionally you might wish to check
3174 for; others warn about constructions that are necessary or hard to avoid
3175 in some cases, and there is no simple way to modify the code to suppress
3182 (This option used to be called @option{-W}. The older name is still
3183 supported, but the newer name is more descriptive.) Print extra warning
3184 messages for these events:
3188 Warn if a comparison is always true or always false due to the limited
3189 range of the data type, but do not warn for constant expressions. For
3190 example, warn if an unsigned variable is compared against zero with
3191 @samp{<} or @samp{>=}. This warning can be independently controlled
3192 by @option{-Wtype-limits}.
3195 Storage-class specifiers like @code{static} are not the first things
3196 in a declaration. According to the C Standard, this usage is
3197 obsolescent. This warning can be independently controlled by
3198 @option{-Wold-style-declaration}.
3201 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
3205 A comparison between signed and unsigned values could produce an
3206 incorrect result when the signed value is converted to unsigned.
3207 (But don't warn if @option{-Wno-sign-compare} is also specified.)
3210 An aggregate has an initializer which does not initialize all members.
3211 This warning can be independently controlled by
3212 @option{-Wmissing-field-initializers}.
3215 An initialized field without side effects is overridden when using
3216 designated initializers (@pxref{Designated Inits, , Designated
3217 Initializers}). This warning can be independently controlled by
3218 @option{-Woverride-init}.
3221 A function parameter is declared without a type specifier in K&R-style
3222 functions. This warning can be independently controlled by
3223 @option{-Wmissing-parameter-type}.
3226 An empty body occurs in an @samp{if}, @samp{else} or
3227 @samp{do while} statement. This warning can be independently
3228 controlled by @option{-Wempty-body}.
3230 @item @r{(C++ only)}
3231 An empty body occurs in a @samp{while} or @samp{for} statement with no
3232 whitespacing before the semicolon. This warning can be independently
3233 controlled by @option{-Wempty-body}.
3236 A pointer is compared against integer zero with @samp{<}, @samp{<=},
3237 @samp{>}, or @samp{>=}.
3240 A variable might be changed by @samp{longjmp} or @samp{vfork}.
3241 This warning can be independently controlled by @option{-Wclobbered}.
3243 @item @r{(C++ only)}
3244 An enumerator and a non-enumerator both appear in a conditional expression.
3246 @item @r{(C++ only)}
3247 A non-static reference or non-static @samp{const} member appears in a
3248 class without constructors.
3250 @item @r{(C++ only)}
3251 Ambiguous virtual bases.
3253 @item @r{(C++ only)}
3254 Subscripting an array which has been declared @samp{register}.
3256 @item @r{(C++ only)}
3257 Taking the address of a variable which has been declared @samp{register}.
3259 @item @r{(C++ only)}
3260 A base class is not initialized in a derived class' copy constructor.
3263 @item -Wno-div-by-zero
3264 @opindex Wno-div-by-zero
3265 @opindex Wdiv-by-zero
3266 Do not warn about compile-time integer division by zero. Floating point
3267 division by zero is not warned about, as it can be a legitimate way of
3268 obtaining infinities and NaNs.
3270 @item -Wsystem-headers
3271 @opindex Wsystem-headers
3272 @cindex warnings from system headers
3273 @cindex system headers, warnings from
3274 Print warning messages for constructs found in system header files.
3275 Warnings from system headers are normally suppressed, on the assumption
3276 that they usually do not indicate real problems and would only make the
3277 compiler output harder to read. Using this command line option tells
3278 GCC to emit warnings from system headers as if they occurred in user
3279 code. However, note that using @option{-Wall} in conjunction with this
3280 option will @emph{not} warn about unknown pragmas in system
3281 headers---for that, @option{-Wunknown-pragmas} must also be used.
3284 @opindex Wfloat-equal
3285 Warn if floating point values are used in equality comparisons.
3287 The idea behind this is that sometimes it is convenient (for the
3288 programmer) to consider floating-point values as approximations to
3289 infinitely precise real numbers. If you are doing this, then you need
3290 to compute (by analyzing the code, or in some other way) the maximum or
3291 likely maximum error that the computation introduces, and allow for it
3292 when performing comparisons (and when producing output, but that's a
3293 different problem). In particular, instead of testing for equality, you
3294 would check to see whether the two values have ranges that overlap; and
3295 this is done with the relational operators, so equality comparisons are
3298 @item -Wtraditional @r{(C only)}
3299 @opindex Wtraditional
3300 Warn about certain constructs that behave differently in traditional and
3301 ISO C@. Also warn about ISO C constructs that have no traditional C
3302 equivalent, and/or problematic constructs which should be avoided.
3306 Macro parameters that appear within string literals in the macro body.
3307 In traditional C macro replacement takes place within string literals,
3308 but does not in ISO C@.
3311 In traditional C, some preprocessor directives did not exist.
3312 Traditional preprocessors would only consider a line to be a directive
3313 if the @samp{#} appeared in column 1 on the line. Therefore
3314 @option{-Wtraditional} warns about directives that traditional C
3315 understands but would ignore because the @samp{#} does not appear as the
3316 first character on the line. It also suggests you hide directives like
3317 @samp{#pragma} not understood by traditional C by indenting them. Some
3318 traditional implementations would not recognize @samp{#elif}, so it
3319 suggests avoiding it altogether.
3322 A function-like macro that appears without arguments.
3325 The unary plus operator.
3328 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
3329 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
3330 constants.) Note, these suffixes appear in macros defined in the system
3331 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
3332 Use of these macros in user code might normally lead to spurious
3333 warnings, however GCC's integrated preprocessor has enough context to
3334 avoid warning in these cases.
3337 A function declared external in one block and then used after the end of
3341 A @code{switch} statement has an operand of type @code{long}.
3344 A non-@code{static} function declaration follows a @code{static} one.
3345 This construct is not accepted by some traditional C compilers.
3348 The ISO type of an integer constant has a different width or
3349 signedness from its traditional type. This warning is only issued if
3350 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
3351 typically represent bit patterns, are not warned about.
3354 Usage of ISO string concatenation is detected.
3357 Initialization of automatic aggregates.
3360 Identifier conflicts with labels. Traditional C lacks a separate
3361 namespace for labels.
3364 Initialization of unions. If the initializer is zero, the warning is
3365 omitted. This is done under the assumption that the zero initializer in
3366 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
3367 initializer warnings and relies on default initialization to zero in the
3371 Conversions by prototypes between fixed/floating point values and vice
3372 versa. The absence of these prototypes when compiling with traditional
3373 C would cause serious problems. This is a subset of the possible
3374 conversion warnings, for the full set use @option{-Wtraditional-conversion}.
3377 Use of ISO C style function definitions. This warning intentionally is
3378 @emph{not} issued for prototype declarations or variadic functions
3379 because these ISO C features will appear in your code when using
3380 libiberty's traditional C compatibility macros, @code{PARAMS} and
3381 @code{VPARAMS}. This warning is also bypassed for nested functions
3382 because that feature is already a GCC extension and thus not relevant to
3383 traditional C compatibility.
3386 @item -Wtraditional-conversion @r{(C only)}
3387 @opindex Wtraditional-conversion
3388 Warn if a prototype causes a type conversion that is different from what
3389 would happen to the same argument in the absence of a prototype. This
3390 includes conversions of fixed point to floating and vice versa, and
3391 conversions changing the width or signedness of a fixed point argument
3392 except when the same as the default promotion.
3394 @item -Wdeclaration-after-statement @r{(C only)}
3395 @opindex Wdeclaration-after-statement
3396 Warn when a declaration is found after a statement in a block. This
3397 construct, known from C++, was introduced with ISO C99 and is by default
3398 allowed in GCC@. It is not supported by ISO C90 and was not supported by
3399 GCC versions before GCC 3.0. @xref{Mixed Declarations}.
3403 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3405 @item -Wno-endif-labels
3406 @opindex Wno-endif-labels
3407 @opindex Wendif-labels
3408 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
3412 Warn whenever a local variable shadows another local variable, parameter or
3413 global variable or whenever a built-in function is shadowed.
3415 @item -Wlarger-than-@var{len}
3416 @opindex Wlarger-than
3417 Warn whenever an object of larger than @var{len} bytes is defined.
3419 @item -Wunsafe-loop-optimizations
3420 @opindex Wunsafe-loop-optimizations
3421 Warn if the loop cannot be optimized because the compiler could not
3422 assume anything on the bounds of the loop indices. With
3423 @option{-funsafe-loop-optimizations} warn if the compiler made
3426 @item -Wpointer-arith
3427 @opindex Wpointer-arith
3428 Warn about anything that depends on the ``size of'' a function type or
3429 of @code{void}. GNU C assigns these types a size of 1, for
3430 convenience in calculations with @code{void *} pointers and pointers
3431 to functions. In C++, warn also when an arithmetic operation involves
3432 @code{NULL}. This warning is also enabled by @option{-pedantic}.
3435 @opindex Wtype-limits
3436 @opindex Wno-type-limits
3437 Warn if a comparison is always true or always false due to the limited
3438 range of the data type, but do not warn for constant expressions. For
3439 example, warn if an unsigned variable is compared against zero with
3440 @samp{<} or @samp{>=}. This warning is also enabled by
3443 @item -Wbad-function-cast @r{(C only)}
3444 @opindex Wbad-function-cast
3445 Warn whenever a function call is cast to a non-matching type.
3446 For example, warn if @code{int malloc()} is cast to @code{anything *}.
3449 Warn about ISO C constructs that are outside of the common subset of
3450 ISO C and ISO C++, e.g.@: request for implicit conversion from
3451 @code{void *} to a pointer to non-@code{void} type.
3453 @item -Wc++0x-compat @r{(C++ and Objective-C++ only)}
3454 Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
3455 ISO C++ 200x, e.g., identifiers in ISO C++ 1998 that will become keywords
3456 in ISO C++ 200x. This warning is enabled by @option{-Wall}.
3460 Warn whenever a pointer is cast so as to remove a type qualifier from
3461 the target type. For example, warn if a @code{const char *} is cast
3462 to an ordinary @code{char *}.
3465 @opindex Wcast-align
3466 Warn whenever a pointer is cast such that the required alignment of the
3467 target is increased. For example, warn if a @code{char *} is cast to
3468 an @code{int *} on machines where integers can only be accessed at
3469 two- or four-byte boundaries.
3471 @item -Wwrite-strings
3472 @opindex Wwrite-strings
3473 When compiling C, give string constants the type @code{const
3474 char[@var{length}]} so that
3475 copying the address of one into a non-@code{const} @code{char *}
3476 pointer will get a warning; when compiling C++, warn about the
3477 deprecated conversion from string literals to @code{char *}. This
3478 warning, by default, is enabled for C++ programs.
3479 These warnings will help you find at
3480 compile time code that can try to write into a string constant, but
3481 only if you have been very careful about using @code{const} in
3482 declarations and prototypes. Otherwise, it will just be a nuisance;
3483 this is why we did not make @option{-Wall} request these warnings.
3487 Warn for variables that might be changed by @samp{longjmp} or
3488 @samp{vfork}. This warning is also enabled by @option{-Wextra}.
3491 @opindex Wconversion
3492 @opindex Wno-conversion
3493 Warn for implicit conversions that may alter a value. This includes
3494 conversions between real and integer, like @code{abs (x)} when
3495 @code{x} is @code{double}; conversions between signed and unsigned,
3496 like @code{unsigned ui = -1}; and conversions to smaller types, like
3497 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
3498 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
3499 changed by the conversion like in @code{abs (2.0)}. Warnings about
3500 conversions between signed and unsigned integers can be disabled by
3501 using @option{-Wno-sign-conversion}.
3503 For C++, also warn for conversions between @code{NULL} and non-pointer
3504 types; confusing overload resolution for user-defined conversions; and
3505 conversions that will never use a type conversion operator:
3506 conversions to @code{void}, the same type, a base class or a reference
3507 to them. Warnings about conversions between signed and unsigned
3508 integers are disabled by default in C++ unless
3509 @option{-Wsign-conversion} is explicitly enabled.
3512 @opindex Wempty-body
3513 Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
3514 while} statement. Additionally, in C++, warn when an empty body occurs
3515 in a @samp{while} or @samp{for} statement with no whitespacing before
3516 the semicolon. This warning is also enabled by @option{-Wextra}.
3518 @item -Wsign-compare
3519 @opindex Wsign-compare
3520 @cindex warning for comparison of signed and unsigned values
3521 @cindex comparison of signed and unsigned values, warning
3522 @cindex signed and unsigned values, comparison warning
3523 Warn when a comparison between signed and unsigned values could produce
3524 an incorrect result when the signed value is converted to unsigned.
3525 This warning is also enabled by @option{-Wextra}; to get the other warnings
3526 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
3528 @item -Wsign-conversion
3529 @opindex Wsign-conversion
3530 @opindex Wno-sign-conversion
3531 Warn for implicit conversions that may change the sign of an integer
3532 value, like assigning a signed integer expression to an unsigned
3533 integer variable. An explicit cast silences the warning. In C, this
3534 option is enabled also by @option{-Wconversion}.
3538 @opindex Wno-address
3539 Warn about suspicious uses of memory addresses. These include using
3540 the address of a function in a conditional expression, such as
3541 @code{void func(void); if (func)}, and comparisons against the memory
3542 address of a string literal, such as @code{if (x == "abc")}. Such
3543 uses typically indicate a programmer error: the address of a function
3544 always evaluates to true, so their use in a conditional usually
3545 indicate that the programmer forgot the parentheses in a function
3546 call; and comparisons against string literals result in unspecified
3547 behavior and are not portable in C, so they usually indicate that the
3548 programmer intended to use @code{strcmp}. This warning is enabled by
3552 @opindex Wlogical-op
3553 @opindex Wno-logical-op
3554 Warn about suspicious uses of logical operators in expressions.
3555 This includes using logical operators in contexts where a
3556 bit-wise operator is likely to be expected.
3558 @item -Waggregate-return
3559 @opindex Waggregate-return
3560 Warn if any functions that return structures or unions are defined or
3561 called. (In languages where you can return an array, this also elicits
3564 @item -Wno-attributes
3565 @opindex Wno-attributes
3566 @opindex Wattributes
3567 Do not warn if an unexpected @code{__attribute__} is used, such as
3568 unrecognized attributes, function attributes applied to variables,
3569 etc. This will not stop errors for incorrect use of supported
3572 @item -Wstrict-prototypes @r{(C only)}
3573 @opindex Wstrict-prototypes
3574 Warn if a function is declared or defined without specifying the
3575 argument types. (An old-style function definition is permitted without
3576 a warning if preceded by a declaration which specifies the argument
3579 @item -Wold-style-declaration @r{(C only)}
3580 @opindex Wold-style-declaration
3581 Warn for obsolescent usages, according to the C Standard, in a
3582 declaration. For example, warn if storage-class specifiers like
3583 @code{static} are not the first things in a declaration. This warning
3584 is also enabled by @option{-Wextra}.
3586 @item -Wold-style-definition @r{(C only)}
3587 @opindex Wold-style-definition
3588 Warn if an old-style function definition is used. A warning is given
3589 even if there is a previous prototype.
3591 @item -Wmissing-parameter-type @r{(C only)}
3592 @opindex Wmissing-parameter-type
3593 A function parameter is declared without a type specifier in K&R-style
3600 This warning is also enabled by @option{-Wextra}.
3602 @item -Wmissing-prototypes @r{(C only)}
3603 @opindex Wmissing-prototypes
3604 Warn if a global function is defined without a previous prototype
3605 declaration. This warning is issued even if the definition itself
3606 provides a prototype. The aim is to detect global functions that fail
3607 to be declared in header files.
3609 @item -Wmissing-declarations @r{(C and C++ only)}
3610 @opindex Wmissing-declarations
3611 Warn if a global function is defined without a previous declaration.
3612 Do so even if the definition itself provides a prototype.
3613 Use this option to detect global functions that are not declared in
3614 header files. In C++, no warnings are issued for function templates,
3615 or for inline functions, or for functions in anonymous namespaces.
3617 @item -Wmissing-field-initializers
3618 @opindex Wmissing-field-initializers
3621 Warn if a structure's initializer has some fields missing. For
3622 example, the following code would cause such a warning, because
3623 @code{x.h} is implicitly zero:
3626 struct s @{ int f, g, h; @};
3627 struct s x = @{ 3, 4 @};
3630 This option does not warn about designated initializers, so the following
3631 modification would not trigger a warning:
3634 struct s @{ int f, g, h; @};
3635 struct s x = @{ .f = 3, .g = 4 @};
3638 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
3639 warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
3641 @item -Wmissing-noreturn
3642 @opindex Wmissing-noreturn
3643 Warn about functions which might be candidates for attribute @code{noreturn}.
3644 Note these are only possible candidates, not absolute ones. Care should
3645 be taken to manually verify functions actually do not ever return before
3646 adding the @code{noreturn} attribute, otherwise subtle code generation
3647 bugs could be introduced. You will not get a warning for @code{main} in
3648 hosted C environments.
3650 @item -Wmissing-format-attribute
3651 @opindex Wmissing-format-attribute
3653 Warn about function pointers which might be candidates for @code{format}
3654 attributes. Note these are only possible candidates, not absolute ones.
3655 GCC will guess that function pointers with @code{format} attributes that
3656 are used in assignment, initialization, parameter passing or return
3657 statements should have a corresponding @code{format} attribute in the
3658 resulting type. I.e.@: the left-hand side of the assignment or
3659 initialization, the type of the parameter variable, or the return type
3660 of the containing function respectively should also have a @code{format}
3661 attribute to avoid the warning.
3663 GCC will also warn about function definitions which might be
3664 candidates for @code{format} attributes. Again, these are only
3665 possible candidates. GCC will guess that @code{format} attributes
3666 might be appropriate for any function that calls a function like
3667 @code{vprintf} or @code{vscanf}, but this might not always be the
3668 case, and some functions for which @code{format} attributes are
3669 appropriate may not be detected.
3671 @item -Wno-multichar
3672 @opindex Wno-multichar
3674 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
3675 Usually they indicate a typo in the user's code, as they have
3676 implementation-defined values, and should not be used in portable code.
3678 @item -Wnormalized=<none|id|nfc|nfkc>
3679 @opindex Wnormalized
3682 @cindex character set, input normalization
3683 In ISO C and ISO C++, two identifiers are different if they are
3684 different sequences of characters. However, sometimes when characters
3685 outside the basic ASCII character set are used, you can have two
3686 different character sequences that look the same. To avoid confusion,
3687 the ISO 10646 standard sets out some @dfn{normalization rules} which
3688 when applied ensure that two sequences that look the same are turned into
3689 the same sequence. GCC can warn you if you are using identifiers which
3690 have not been normalized; this option controls that warning.
3692 There are four levels of warning that GCC supports. The default is
3693 @option{-Wnormalized=nfc}, which warns about any identifier which is
3694 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
3695 recommended form for most uses.
3697 Unfortunately, there are some characters which ISO C and ISO C++ allow
3698 in identifiers that when turned into NFC aren't allowable as
3699 identifiers. That is, there's no way to use these symbols in portable
3700 ISO C or C++ and have all your identifiers in NFC.
3701 @option{-Wnormalized=id} suppresses the warning for these characters.
3702 It is hoped that future versions of the standards involved will correct
3703 this, which is why this option is not the default.
3705 You can switch the warning off for all characters by writing
3706 @option{-Wnormalized=none}. You would only want to do this if you
3707 were using some other normalization scheme (like ``D''), because
3708 otherwise you can easily create bugs that are literally impossible to see.
3710 Some characters in ISO 10646 have distinct meanings but look identical
3711 in some fonts or display methodologies, especially once formatting has
3712 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
3713 LETTER N'', will display just like a regular @code{n} which has been
3714 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
3715 normalization scheme to convert all these into a standard form as
3716 well, and GCC will warn if your code is not in NFKC if you use
3717 @option{-Wnormalized=nfkc}. This warning is comparable to warning
3718 about every identifier that contains the letter O because it might be
3719 confused with the digit 0, and so is not the default, but may be
3720 useful as a local coding convention if the programming environment is
3721 unable to be fixed to display these characters distinctly.
3723 @item -Wno-deprecated-declarations
3724 @opindex Wno-deprecated-declarations
3725 Do not warn about uses of functions (@pxref{Function Attributes}),
3726 variables (@pxref{Variable Attributes}), and types (@pxref{Type
3727 Attributes}) marked as deprecated by using the @code{deprecated}
3731 @opindex Wno-overflow
3732 Do not warn about compile-time overflow in constant expressions.
3734 @item -Woverride-init
3735 @opindex Woverride-init
3738 Warn if an initialized field without side effects is overridden when
3739 using designated initializers (@pxref{Designated Inits, , Designated
3742 This warning is included in @option{-Wextra}. To get other
3743 @option{-Wextra} warnings without this one, use @samp{-Wextra
3744 -Wno-override-init}.
3748 Warn if a structure is given the packed attribute, but the packed
3749 attribute has no effect on the layout or size of the structure.
3750 Such structures may be mis-aligned for little benefit. For
3751 instance, in this code, the variable @code{f.x} in @code{struct bar}
3752 will be misaligned even though @code{struct bar} does not itself
3753 have the packed attribute:
3760 @} __attribute__((packed));
3770 Warn if padding is included in a structure, either to align an element
3771 of the structure or to align the whole structure. Sometimes when this
3772 happens it is possible to rearrange the fields of the structure to
3773 reduce the padding and so make the structure smaller.
3775 @item -Wredundant-decls
3776 @opindex Wredundant-decls
3777 Warn if anything is declared more than once in the same scope, even in
3778 cases where multiple declaration is valid and changes nothing.
3780 @item -Wnested-externs @r{(C only)}
3781 @opindex Wnested-externs
3782 Warn if an @code{extern} declaration is encountered within a function.
3784 @item -Wunreachable-code
3785 @opindex Wunreachable-code
3786 Warn if the compiler detects that code will never be executed.
3788 This option is intended to warn when the compiler detects that at
3789 least a whole line of source code will never be executed, because
3790 some condition is never satisfied or because it is after a
3791 procedure that never returns.
3793 It is possible for this option to produce a warning even though there
3794 are circumstances under which part of the affected line can be executed,
3795 so care should be taken when removing apparently-unreachable code.
3797 For instance, when a function is inlined, a warning may mean that the
3798 line is unreachable in only one inlined copy of the function.
3800 This option is not made part of @option{-Wall} because in a debugging
3801 version of a program there is often substantial code which checks
3802 correct functioning of the program and is, hopefully, unreachable
3803 because the program does work. Another common use of unreachable
3804 code is to provide behavior which is selectable at compile-time.
3808 Warn if a function can not be inlined and it was declared as inline.
3809 Even with this option, the compiler will not warn about failures to
3810 inline functions declared in system headers.
3812 The compiler uses a variety of heuristics to determine whether or not
3813 to inline a function. For example, the compiler takes into account
3814 the size of the function being inlined and the amount of inlining
3815 that has already been done in the current function. Therefore,
3816 seemingly insignificant changes in the source program can cause the
3817 warnings produced by @option{-Winline} to appear or disappear.
3819 @item -Wno-invalid-offsetof @r{(C++ only)}
3820 @opindex Wno-invalid-offsetof
3821 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
3822 type. According to the 1998 ISO C++ standard, applying @samp{offsetof}
3823 to a non-POD type is undefined. In existing C++ implementations,
3824 however, @samp{offsetof} typically gives meaningful results even when
3825 applied to certain kinds of non-POD types. (Such as a simple
3826 @samp{struct} that fails to be a POD type only by virtue of having a
3827 constructor.) This flag is for users who are aware that they are
3828 writing nonportable code and who have deliberately chosen to ignore the
3831 The restrictions on @samp{offsetof} may be relaxed in a future version
3832 of the C++ standard.
3834 @item -Wno-int-to-pointer-cast @r{(C only)}
3835 @opindex Wno-int-to-pointer-cast
3836 Suppress warnings from casts to pointer type of an integer of a
3839 @item -Wno-pointer-to-int-cast @r{(C only)}
3840 @opindex Wno-pointer-to-int-cast
3841 Suppress warnings from casts from a pointer to an integer type of a
3845 @opindex Winvalid-pch
3846 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
3847 the search path but can't be used.
3851 @opindex Wno-long-long
3852 Warn if @samp{long long} type is used. This is default. To inhibit
3853 the warning messages, use @option{-Wno-long-long}. Flags
3854 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
3855 only when @option{-pedantic} flag is used.
3857 @item -Wvariadic-macros
3858 @opindex Wvariadic-macros
3859 @opindex Wno-variadic-macros
3860 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
3861 alternate syntax when in pedantic ISO C99 mode. This is default.
3862 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
3867 Warn if variable length array is used in the code.
3868 @option{-Wno-vla} will prevent the @option{-pedantic} warning of
3869 the variable length array.
3871 @item -Wvolatile-register-var
3872 @opindex Wvolatile-register-var
3873 @opindex Wno-volatile-register-var
3874 Warn if a register variable is declared volatile. The volatile
3875 modifier does not inhibit all optimizations that may eliminate reads
3876 and/or writes to register variables.
3878 @item -Wdisabled-optimization
3879 @opindex Wdisabled-optimization
3880 Warn if a requested optimization pass is disabled. This warning does
3881 not generally indicate that there is anything wrong with your code; it
3882 merely indicates that GCC's optimizers were unable to handle the code
3883 effectively. Often, the problem is that your code is too big or too
3884 complex; GCC will refuse to optimize programs when the optimization
3885 itself is likely to take inordinate amounts of time.
3887 @item -Wpointer-sign
3888 @opindex Wpointer-sign
3889 @opindex Wno-pointer-sign
3890 Warn for pointer argument passing or assignment with different signedness.
3891 This option is only supported for C and Objective-C@. It is implied by
3892 @option{-Wall} and by @option{-pedantic}, which can be disabled with
3893 @option{-Wno-pointer-sign}.
3897 Make all warnings into errors.
3901 Make the specified warning into an errors. The specifier for a
3902 warning is appended, for example @option{-Werror=switch} turns the
3903 warnings controlled by @option{-Wswitch} into errors. This switch
3904 takes a negative form, to be used to negate @option{-Werror} for
3905 specific warnings, for example @option{-Wno-error=switch} makes
3906 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3907 is in effect. You can use the @option{-fdiagnostics-show-option}
3908 option to have each controllable warning amended with the option which
3909 controls it, to determine what to use with this option.
3911 Note that specifying @option{-Werror=}@var{foo} automatically implies
3912 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3915 @item -Wstack-protector
3916 @opindex Wstack-protector
3917 This option is only active when @option{-fstack-protector} is active. It
3918 warns about functions that will not be protected against stack smashing.
3920 @item -Woverlength-strings
3921 @opindex Woverlength-strings
3922 Warn about string constants which are longer than the ``minimum
3923 maximum'' length specified in the C standard. Modern compilers
3924 generally allow string constants which are much longer than the
3925 standard's minimum limit, but very portable programs should avoid
3926 using longer strings.
3928 The limit applies @emph{after} string constant concatenation, and does
3929 not count the trailing NUL@. In C89, the limit was 509 characters; in
3930 C99, it was raised to 4095. C++98 does not specify a normative
3931 minimum maximum, so we do not diagnose overlength strings in C++@.
3933 This option is implied by @option{-pedantic}, and can be disabled with
3934 @option{-Wno-overlength-strings}.
3937 @node Debugging Options
3938 @section Options for Debugging Your Program or GCC
3939 @cindex options, debugging
3940 @cindex debugging information options
3942 GCC has various special options that are used for debugging
3943 either your program or GCC:
3948 Produce debugging information in the operating system's native format
3949 (stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
3952 On most systems that use stabs format, @option{-g} enables use of extra
3953 debugging information that only GDB can use; this extra information
3954 makes debugging work better in GDB but will probably make other debuggers
3956 refuse to read the program. If you want to control for certain whether
3957 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3958 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
3960 GCC allows you to use @option{-g} with
3961 @option{-O}. The shortcuts taken by optimized code may occasionally
3962 produce surprising results: some variables you declared may not exist
3963 at all; flow of control may briefly move where you did not expect it;
3964 some statements may not be executed because they compute constant
3965 results or their values were already at hand; some statements may
3966 execute in different places because they were moved out of loops.
3968 Nevertheless it proves possible to debug optimized output. This makes
3969 it reasonable to use the optimizer for programs that might have bugs.
3971 The following options are useful when GCC is generated with the
3972 capability for more than one debugging format.
3976 Produce debugging information for use by GDB@. This means to use the
3977 most expressive format available (DWARF 2, stabs, or the native format
3978 if neither of those are supported), including GDB extensions if at all
3983 Produce debugging information in stabs format (if that is supported),
3984 without GDB extensions. This is the format used by DBX on most BSD
3985 systems. On MIPS, Alpha and System V Release 4 systems this option
3986 produces stabs debugging output which is not understood by DBX or SDB@.
3987 On System V Release 4 systems this option requires the GNU assembler.
3989 @item -feliminate-unused-debug-symbols
3990 @opindex feliminate-unused-debug-symbols
3991 Produce debugging information in stabs format (if that is supported),
3992 for only symbols that are actually used.
3994 @item -femit-class-debug-always
3995 Instead of emitting debugging information for a C++ class in only one
3996 object file, emit it in all object files using the class. This option
3997 should be used only with debuggers that are unable to handle the way GCC
3998 normally emits debugging information for classes because using this
3999 option will increase the size of debugging information by as much as a
4004 Produce debugging information in stabs format (if that is supported),
4005 using GNU extensions understood only by the GNU debugger (GDB)@. The
4006 use of these extensions is likely to make other debuggers crash or
4007 refuse to read the program.
4011 Produce debugging information in COFF format (if that is supported).
4012 This is the format used by SDB on most System V systems prior to
4017 Produce debugging information in XCOFF format (if that is supported).
4018 This is the format used by the DBX debugger on IBM RS/6000 systems.
4022 Produce debugging information in XCOFF format (if that is supported),
4023 using GNU extensions understood only by the GNU debugger (GDB)@. The
4024 use of these extensions is likely to make other debuggers crash or
4025 refuse to read the program, and may cause assemblers other than the GNU
4026 assembler (GAS) to fail with an error.
4030 Produce debugging information in DWARF version 2 format (if that is
4031 supported). This is the format used by DBX on IRIX 6. With this
4032 option, GCC uses features of DWARF version 3 when they are useful;
4033 version 3 is upward compatible with version 2, but may still cause
4034 problems for older debuggers.
4038 Produce debugging information in VMS debug format (if that is
4039 supported). This is the format used by DEBUG on VMS systems.
4042 @itemx -ggdb@var{level}
4043 @itemx -gstabs@var{level}
4044 @itemx -gcoff@var{level}
4045 @itemx -gxcoff@var{level}
4046 @itemx -gvms@var{level}
4047 Request debugging information and also use @var{level} to specify how
4048 much information. The default level is 2.
4050 Level 0 produces no debug information at all. Thus, @option{-g0} negates
4053 Level 1 produces minimal information, enough for making backtraces in
4054 parts of the program that you don't plan to debug. This includes
4055 descriptions of functions and external variables, but no information
4056 about local variables and no line numbers.
4058 Level 3 includes extra information, such as all the macro definitions
4059 present in the program. Some debuggers support macro expansion when
4060 you use @option{-g3}.
4062 @option{-gdwarf-2} does not accept a concatenated debug level, because
4063 GCC used to support an option @option{-gdwarf} that meant to generate
4064 debug information in version 1 of the DWARF format (which is very
4065 different from version 2), and it would have been too confusing. That
4066 debug format is long obsolete, but the option cannot be changed now.
4067 Instead use an additional @option{-g@var{level}} option to change the
4068 debug level for DWARF2.
4070 @item -feliminate-dwarf2-dups
4071 @opindex feliminate-dwarf2-dups
4072 Compress DWARF2 debugging information by eliminating duplicated
4073 information about each symbol. This option only makes sense when
4074 generating DWARF2 debugging information with @option{-gdwarf-2}.
4076 @item -femit-struct-debug-baseonly
4077 Emit debug information for struct-like types
4078 only when the base name of the compilation source file
4079 matches the base name of file in which the struct was defined.
4081 This option substantially reduces the size of debugging information,
4082 but at significant potential loss in type information to the debugger.
4083 See @option{-femit-struct-debug-reduced} for a less aggressive option.
4084 See @option{-femit-struct-debug-detailed} for more detailed control.
4086 This option works only with DWARF 2.
4088 @item -femit-struct-debug-reduced
4089 Emit debug information for struct-like types
4090 only when the base name of the compilation source file
4091 matches the base name of file in which the type was defined,
4092 unless the struct is a template or defined in a system header.
4094 This option significantly reduces the size of debugging information,
4095 with some potential loss in type information to the debugger.
4096 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
4097 See @option{-femit-struct-debug-detailed} for more detailed control.
4099 This option works only with DWARF 2.
4101 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
4102 Specify the struct-like types
4103 for which the compiler will generate debug information.
4104 The intent is to reduce duplicate struct debug information
4105 between different object files within the same program.
4107 This option is a detailed version of
4108 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
4109 which will serve for most needs.
4111 A specification has the syntax
4112 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
4114 The optional first word limits the specification to
4115 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
4116 A struct type is used directly when it is the type of a variable, member.
4117 Indirect uses arise through pointers to structs.
4118 That is, when use of an incomplete struct would be legal, the use is indirect.
4120 @samp{struct one direct; struct two * indirect;}.
4122 The optional second word limits the specification to
4123 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
4124 Generic structs are a bit complicated to explain.
4125 For C++, these are non-explicit specializations of template classes,
4126 or non-template classes within the above.
4127 Other programming languages have generics,
4128 but @samp{-femit-struct-debug-detailed} does not yet implement them.
4130 The third word specifies the source files for those
4131 structs for which the compiler will emit debug information.
4132 The values @samp{none} and @samp{any} have the normal meaning.
4133 The value @samp{base} means that
4134 the base of name of the file in which the type declaration appears
4135 must match the base of the name of the main compilation file.
4136 In practice, this means that
4137 types declared in @file{foo.c} and @file{foo.h} will have debug information,
4138 but types declared in other header will not.
4139 The value @samp{sys} means those types satisfying @samp{base}
4140 or declared in system or compiler headers.
4142 You may need to experiment to determine the best settings for your application.
4144 The default is @samp{-femit-struct-debug-detailed=all}.
4146 This option works only with DWARF 2.
4148 @item -fdebug-prefix-map=@var{old}=@var{new}
4149 @opindex fdebug-prefix-map
4150 When compiling files in directory @file{@var{old}}, record debugging
4151 information describing them as in @file{@var{new}} instead.
4153 @cindex @command{prof}
4156 Generate extra code to write profile information suitable for the
4157 analysis program @command{prof}. You must use this option when compiling
4158 the source files you want data about, and you must also use it when
4161 @cindex @command{gprof}
4164 Generate extra code to write profile information suitable for the
4165 analysis program @command{gprof}. You must use this option when compiling
4166 the source files you want data about, and you must also use it when
4171 Makes the compiler print out each function name as it is compiled, and
4172 print some statistics about each pass when it finishes.
4175 @opindex ftime-report
4176 Makes the compiler print some statistics about the time consumed by each
4177 pass when it finishes.
4180 @opindex fmem-report
4181 Makes the compiler print some statistics about permanent memory
4182 allocation when it finishes.
4184 @item -fpre-ipa-mem-report
4185 @opindex fpre-ipa-mem-report
4186 @item -fpost-ipa-mem-report
4187 @opindex fpost-ipa-mem-report
4188 Makes the compiler print some statistics about permanent memory
4189 allocation before or after interprocedural optimization.
4191 @item -fprofile-arcs
4192 @opindex fprofile-arcs
4193 Add code so that program flow @dfn{arcs} are instrumented. During
4194 execution the program records how many times each branch and call is
4195 executed and how many times it is taken or returns. When the compiled
4196 program exits it saves this data to a file called
4197 @file{@var{auxname}.gcda} for each source file. The data may be used for
4198 profile-directed optimizations (@option{-fbranch-probabilities}), or for
4199 test coverage analysis (@option{-ftest-coverage}). Each object file's
4200 @var{auxname} is generated from the name of the output file, if
4201 explicitly specified and it is not the final executable, otherwise it is
4202 the basename of the source file. In both cases any suffix is removed
4203 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
4204 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
4205 @xref{Cross-profiling}.
4207 @cindex @command{gcov}
4211 This option is used to compile and link code instrumented for coverage
4212 analysis. The option is a synonym for @option{-fprofile-arcs}
4213 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
4214 linking). See the documentation for those options for more details.
4219 Compile the source files with @option{-fprofile-arcs} plus optimization
4220 and code generation options. For test coverage analysis, use the
4221 additional @option{-ftest-coverage} option. You do not need to profile
4222 every source file in a program.
4225 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
4226 (the latter implies the former).
4229 Run the program on a representative workload to generate the arc profile
4230 information. This may be repeated any number of times. You can run
4231 concurrent instances of your program, and provided that the file system
4232 supports locking, the data files will be correctly updated. Also
4233 @code{fork} calls are detected and correctly handled (double counting
4237 For profile-directed optimizations, compile the source files again with
4238 the same optimization and code generation options plus
4239 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
4240 Control Optimization}).
4243 For test coverage analysis, use @command{gcov} to produce human readable
4244 information from the @file{.gcno} and @file{.gcda} files. Refer to the
4245 @command{gcov} documentation for further information.
4249 With @option{-fprofile-arcs}, for each function of your program GCC
4250 creates a program flow graph, then finds a spanning tree for the graph.
4251 Only arcs that are not on the spanning tree have to be instrumented: the
4252 compiler adds code to count the number of times that these arcs are
4253 executed. When an arc is the only exit or only entrance to a block, the
4254 instrumentation code can be added to the block; otherwise, a new basic
4255 block must be created to hold the instrumentation code.
4258 @item -ftest-coverage
4259 @opindex ftest-coverage
4260 Produce a notes file that the @command{gcov} code-coverage utility
4261 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
4262 show program coverage. Each source file's note file is called
4263 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
4264 above for a description of @var{auxname} and instructions on how to
4265 generate test coverage data. Coverage data will match the source files
4266 more closely, if you do not optimize.
4268 @item -fdbg-cnt-list
4269 @opindex fdbg-cnt-list
4270 Print the name and the counter upperbound for all debug counters.
4272 @item -fdbg-cnt=@var{counter-value-list}
4274 Set the internal debug counter upperbound. @var{counter-value-list}
4275 is a comma-separated list of @var{name}:@var{value} pairs
4276 which sets the upperbound of each debug counter @var{name} to @var{value}.
4277 All debug counters have the initial upperbound of @var{UINT_MAX},
4278 thus dbg_cnt() returns true always unless the upperbound is set by this option.
4279 e.g. With -fdbg-cnt=dce:10,tail_call:0
4280 dbg_cnt(dce) will return true only for first 10 invocations
4281 and dbg_cnt(tail_call) will return false always.
4283 @item -d@var{letters}
4284 @item -fdump-rtl-@var{pass}
4286 Says to make debugging dumps during compilation at times specified by
4287 @var{letters}. This is used for debugging the RTL-based passes of the
4288 compiler. The file names for most of the dumps are made by appending a
4289 pass number and a word to the @var{dumpname}. @var{dumpname} is generated
4290 from the name of the output file, if explicitly specified and it is not
4291 an executable, otherwise it is the basename of the source file. These
4292 switches may have different effects when @option{-E} is used for
4295 Most debug dumps can be enabled either passing a letter to the @option{-d}
4296 option, or with a long @option{-fdump-rtl} switch; here are the possible
4297 letters for use in @var{letters} and @var{pass}, and their meanings:
4302 Annotate the assembler output with miscellaneous debugging information.
4305 @itemx -fdump-rtl-bbro
4307 @opindex fdump-rtl-bbro
4308 Dump after block reordering, to @file{@var{file}.148r.bbro}.
4311 @itemx -fdump-rtl-combine
4313 @opindex fdump-rtl-combine
4314 Dump after the RTL instruction combination pass, to the file
4315 @file{@var{file}.129r.combine}.
4318 @itemx -fdump-rtl-ce1
4319 @itemx -fdump-rtl-ce2
4321 @opindex fdump-rtl-ce1
4322 @opindex fdump-rtl-ce2
4323 @option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the
4324 first if conversion, to the file @file{@var{file}.117r.ce1}. @option{-dC}
4325 and @option{-fdump-rtl-ce2} enable dumping after the second if
4326 conversion, to the file @file{@var{file}.130r.ce2}.
4329 @itemx -fdump-rtl-btl
4330 @itemx -fdump-rtl-dbr
4332 @opindex fdump-rtl-btl
4333 @opindex fdump-rtl-dbr
4334 @option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch
4335 target load optimization, to @file{@var{file}.31.btl}. @option{-dd}
4336 and @option{-fdump-rtl-dbr} enable dumping after delayed branch
4337 scheduling, to @file{@var{file}.36.dbr}.
4341 Dump all macro definitions, at the end of preprocessing, in addition to
4345 @itemx -fdump-rtl-ce3
4347 @opindex fdump-rtl-ce3
4348 Dump after the third if conversion, to @file{@var{file}.146r.ce3}.
4351 @itemx -fdump-rtl-cfg
4352 @itemx -fdump-rtl-life
4354 @opindex fdump-rtl-cfg
4355 @opindex fdump-rtl-life
4356 @option{-df} and @option{-fdump-rtl-cfg} enable dumping after control
4357 and data flow analysis, to @file{@var{file}.116r.cfg}. @option{-df}
4358 and @option{-fdump-rtl-cfg} enable dumping dump after life analysis,
4359 to @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}.
4362 @itemx -fdump-rtl-greg
4364 @opindex fdump-rtl-greg
4365 Dump after global register allocation, to @file{@var{file}.139r.greg}.
4368 @itemx -fdump-rtl-gcse
4369 @itemx -fdump-rtl-bypass
4371 @opindex fdump-rtl-gcse
4372 @opindex fdump-rtl-bypass
4373 @option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to
4374 @file{@var{file}.114r.gcse}. @option{-dG} and @option{-fdump-rtl-bypass}
4375 enable dumping after jump bypassing and control flow optimizations, to
4376 @file{@var{file}.115r.bypass}.
4379 @itemx -fdump-rtl-eh
4381 @opindex fdump-rtl-eh
4382 Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
4385 @itemx -fdump-rtl-sibling
4387 @opindex fdump-rtl-sibling
4388 Dump after sibling call optimizations, to @file{@var{file}.106r.sibling}.
4391 @itemx -fdump-rtl-jump
4393 @opindex fdump-rtl-jump
4394 Dump after the first jump optimization, to @file{@var{file}.112r.jump}.
4397 @itemx -fdump-rtl-stack
4399 @opindex fdump-rtl-stack
4400 Dump after conversion from GCC's "flat register file" registers to the
4401 x87's stack-like registers, to @file{@var{file}.152r.stack}.
4404 @itemx -fdump-rtl-lreg
4406 @opindex fdump-rtl-lreg
4407 Dump after local register allocation, to @file{@var{file}.138r.lreg}.
4410 @itemx -fdump-rtl-loop2
4412 @opindex fdump-rtl-loop2
4413 @option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the
4414 loop optimization pass, to @file{@var{file}.119r.loop2},
4415 @file{@var{file}.120r.loop2_init},
4416 @file{@var{file}.121r.loop2_invariant}, and
4417 @file{@var{file}.125r.loop2_done}.
4420 @itemx -fdump-rtl-sms
4422 @opindex fdump-rtl-sms
4423 Dump after modulo scheduling, to @file{@var{file}.136r.sms}.
4426 @itemx -fdump-rtl-mach
4428 @opindex fdump-rtl-mach
4429 Dump after performing the machine dependent reorganization pass, to
4430 @file{@var{file}.155r.mach} if that pass exists.
4433 @itemx -fdump-rtl-rnreg
4435 @opindex fdump-rtl-rnreg
4436 Dump after register renumbering, to @file{@var{file}.147r.rnreg}.
4439 @itemx -fdump-rtl-regmove
4441 @opindex fdump-rtl-regmove
4442 Dump after the register move pass, to @file{@var{file}.132r.regmove}.
4445 @itemx -fdump-rtl-postreload
4447 @opindex fdump-rtl-postreload
4448 Dump after post-reload optimizations, to @file{@var{file}.24.postreload}.
4451 @itemx -fdump-rtl-expand
4453 @opindex fdump-rtl-expand
4454 Dump after RTL generation, to @file{@var{file}.104r.expand}.
4457 @itemx -fdump-rtl-sched2
4459 @opindex fdump-rtl-sched2
4460 Dump after the second scheduling pass, to @file{@var{file}.149r.sched2}.
4463 @itemx -fdump-rtl-cse
4465 @opindex fdump-rtl-cse
4466 Dump after CSE (including the jump optimization that sometimes follows
4467 CSE), to @file{@var{file}.113r.cse}.
4470 @itemx -fdump-rtl-sched1
4472 @opindex fdump-rtl-sched1
4473 Dump after the first scheduling pass, to @file{@var{file}.136r.sched1}.
4476 @itemx -fdump-rtl-cse2
4478 @opindex fdump-rtl-cse2
4479 Dump after the second CSE pass (including the jump optimization that
4480 sometimes follows CSE), to @file{@var{file}.127r.cse2}.
4483 @itemx -fdump-rtl-tracer
4485 @opindex fdump-rtl-tracer
4486 Dump after running tracer, to @file{@var{file}.118r.tracer}.
4489 @itemx -fdump-rtl-vpt
4490 @itemx -fdump-rtl-vartrack
4492 @opindex fdump-rtl-vpt
4493 @opindex fdump-rtl-vartrack
4494 @option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value
4495 profile transformations, to @file{@var{file}.10.vpt}. @option{-dV}
4496 and @option{-fdump-rtl-vartrack} enable dumping after variable tracking,
4497 to @file{@var{file}.154r.vartrack}.
4500 @itemx -fdump-rtl-flow2
4502 @opindex fdump-rtl-flow2
4503 Dump after the second flow pass, to @file{@var{file}.142r.flow2}.
4506 @itemx -fdump-rtl-peephole2
4508 @opindex fdump-rtl-peephole2
4509 Dump after the peephole pass, to @file{@var{file}.145r.peephole2}.
4512 @itemx -fdump-rtl-web
4514 @opindex fdump-rtl-web
4515 Dump after live range splitting, to @file{@var{file}.126r.web}.
4518 @itemx -fdump-rtl-all
4520 @opindex fdump-rtl-all
4521 Produce all the dumps listed above.
4525 Produce a core dump whenever an error occurs.
4529 Print statistics on memory usage, at the end of the run, to
4534 Annotate the assembler output with a comment indicating which
4535 pattern and alternative was used. The length of each instruction is
4540 Dump the RTL in the assembler output as a comment before each instruction.
4541 Also turns on @option{-dp} annotation.
4545 For each of the other indicated dump files (either with @option{-d} or
4546 @option{-fdump-rtl-@var{pass}}), dump a representation of the control flow
4547 graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
4551 Just generate RTL for a function instead of compiling it. Usually used
4552 with @samp{r} (@option{-fdump-rtl-expand}).
4556 Dump debugging information during parsing, to standard error.
4560 @opindex fdump-noaddr
4561 When doing debugging dumps (see @option{-d} option above), suppress
4562 address output. This makes it more feasible to use diff on debugging
4563 dumps for compiler invocations with different compiler binaries and/or
4564 different text / bss / data / heap / stack / dso start locations.
4566 @item -fdump-unnumbered
4567 @opindex fdump-unnumbered
4568 When doing debugging dumps (see @option{-d} option above), suppress instruction
4569 numbers and address output. This makes it more feasible to
4570 use diff on debugging dumps for compiler invocations with different
4571 options, in particular with and without @option{-g}.
4573 @item -fdump-translation-unit @r{(C++ only)}
4574 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
4575 @opindex fdump-translation-unit
4576 Dump a representation of the tree structure for the entire translation
4577 unit to a file. The file name is made by appending @file{.tu} to the
4578 source file name. If the @samp{-@var{options}} form is used, @var{options}
4579 controls the details of the dump as described for the
4580 @option{-fdump-tree} options.
4582 @item -fdump-class-hierarchy @r{(C++ only)}
4583 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
4584 @opindex fdump-class-hierarchy
4585 Dump a representation of each class's hierarchy and virtual function
4586 table layout to a file. The file name is made by appending @file{.class}
4587 to the source file name. If the @samp{-@var{options}} form is used,
4588 @var{options} controls the details of the dump as described for the
4589 @option{-fdump-tree} options.
4591 @item -fdump-ipa-@var{switch}
4593 Control the dumping at various stages of inter-procedural analysis
4594 language tree to a file. The file name is generated by appending a switch
4595 specific suffix to the source file name. The following dumps are possible:
4599 Enables all inter-procedural analysis dumps; currently the only produced
4600 dump is the @samp{cgraph} dump.
4603 Dumps information about call-graph optimization, unused function removal,
4604 and inlining decisions.
4607 @item -fdump-tree-@var{switch}
4608 @itemx -fdump-tree-@var{switch}-@var{options}
4610 Control the dumping at various stages of processing the intermediate
4611 language tree to a file. The file name is generated by appending a switch
4612 specific suffix to the source file name. If the @samp{-@var{options}}
4613 form is used, @var{options} is a list of @samp{-} separated options that
4614 control the details of the dump. Not all options are applicable to all
4615 dumps, those which are not meaningful will be ignored. The following
4616 options are available
4620 Print the address of each node. Usually this is not meaningful as it
4621 changes according to the environment and source file. Its primary use
4622 is for tying up a dump file with a debug environment.
4624 Inhibit dumping of members of a scope or body of a function merely
4625 because that scope has been reached. Only dump such items when they
4626 are directly reachable by some other path. When dumping pretty-printed
4627 trees, this option inhibits dumping the bodies of control structures.
4629 Print a raw representation of the tree. By default, trees are
4630 pretty-printed into a C-like representation.
4632 Enable more detailed dumps (not honored by every dump option).
4634 Enable dumping various statistics about the pass (not honored by every dump
4637 Enable showing basic block boundaries (disabled in raw dumps).
4639 Enable showing virtual operands for every statement.
4641 Enable showing line numbers for statements.
4643 Enable showing the unique ID (@code{DECL_UID}) for each variable.
4645 Turn on all options, except @option{raw}, @option{slim} and @option{lineno}.
4648 The following tree dumps are possible:
4652 Dump before any tree based optimization, to @file{@var{file}.original}.
4655 Dump after all tree based optimization, to @file{@var{file}.optimized}.
4658 Dump after function inlining, to @file{@var{file}.inlined}.
4661 @opindex fdump-tree-gimple
4662 Dump each function before and after the gimplification pass to a file. The
4663 file name is made by appending @file{.gimple} to the source file name.
4666 @opindex fdump-tree-cfg
4667 Dump the control flow graph of each function to a file. The file name is
4668 made by appending @file{.cfg} to the source file name.
4671 @opindex fdump-tree-vcg
4672 Dump the control flow graph of each function to a file in VCG format. The
4673 file name is made by appending @file{.vcg} to the source file name. Note
4674 that if the file contains more than one function, the generated file cannot
4675 be used directly by VCG@. You will need to cut and paste each function's
4676 graph into its own separate file first.
4679 @opindex fdump-tree-ch
4680 Dump each function after copying loop headers. The file name is made by
4681 appending @file{.ch} to the source file name.
4684 @opindex fdump-tree-ssa
4685 Dump SSA related information to a file. The file name is made by appending
4686 @file{.ssa} to the source file name.
4689 @opindex fdump-tree-salias
4690 Dump structure aliasing variable information to a file. This file name
4691 is made by appending @file{.salias} to the source file name.
4694 @opindex fdump-tree-alias
4695 Dump aliasing information for each function. The file name is made by
4696 appending @file{.alias} to the source file name.
4699 @opindex fdump-tree-ccp
4700 Dump each function after CCP@. The file name is made by appending
4701 @file{.ccp} to the source file name.
4704 @opindex fdump-tree-storeccp
4705 Dump each function after STORE-CCP. The file name is made by appending
4706 @file{.storeccp} to the source file name.
4709 @opindex fdump-tree-pre
4710 Dump trees after partial redundancy elimination. The file name is made
4711 by appending @file{.pre} to the source file name.
4714 @opindex fdump-tree-fre
4715 Dump trees after full redundancy elimination. The file name is made
4716 by appending @file{.fre} to the source file name.
4719 @opindex fdump-tree-copyprop
4720 Dump trees after copy propagation. The file name is made
4721 by appending @file{.copyprop} to the source file name.
4723 @item store_copyprop
4724 @opindex fdump-tree-store_copyprop
4725 Dump trees after store copy-propagation. The file name is made
4726 by appending @file{.store_copyprop} to the source file name.
4729 @opindex fdump-tree-dce
4730 Dump each function after dead code elimination. The file name is made by
4731 appending @file{.dce} to the source file name.
4734 @opindex fdump-tree-mudflap
4735 Dump each function after adding mudflap instrumentation. The file name is
4736 made by appending @file{.mudflap} to the source file name.
4739 @opindex fdump-tree-sra
4740 Dump each function after performing scalar replacement of aggregates. The
4741 file name is made by appending @file{.sra} to the source file name.
4744 @opindex fdump-tree-sink
4745 Dump each function after performing code sinking. The file name is made
4746 by appending @file{.sink} to the source file name.
4749 @opindex fdump-tree-dom
4750 Dump each function after applying dominator tree optimizations. The file
4751 name is made by appending @file{.dom} to the source file name.
4754 @opindex fdump-tree-dse
4755 Dump each function after applying dead store elimination. The file
4756 name is made by appending @file{.dse} to the source file name.
4759 @opindex fdump-tree-phiopt
4760 Dump each function after optimizing PHI nodes into straightline code. The file
4761 name is made by appending @file{.phiopt} to the source file name.
4764 @opindex fdump-tree-forwprop
4765 Dump each function after forward propagating single use variables. The file
4766 name is made by appending @file{.forwprop} to the source file name.
4769 @opindex fdump-tree-copyrename
4770 Dump each function after applying the copy rename optimization. The file
4771 name is made by appending @file{.copyrename} to the source file name.
4774 @opindex fdump-tree-nrv
4775 Dump each function after applying the named return value optimization on
4776 generic trees. The file name is made by appending @file{.nrv} to the source
4780 @opindex fdump-tree-vect
4781 Dump each function after applying vectorization of loops. The file name is
4782 made by appending @file{.vect} to the source file name.
4785 @opindex fdump-tree-vrp
4786 Dump each function after Value Range Propagation (VRP). The file name
4787 is made by appending @file{.vrp} to the source file name.
4790 @opindex fdump-tree-all
4791 Enable all the available tree dumps with the flags provided in this option.
4794 @item -ftree-vectorizer-verbose=@var{n}
4795 @opindex ftree-vectorizer-verbose
4796 This option controls the amount of debugging output the vectorizer prints.
4797 This information is written to standard error, unless
4798 @option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified,
4799 in which case it is output to the usual dump listing file, @file{.vect}.
4800 For @var{n}=0 no diagnostic information is reported.
4801 If @var{n}=1 the vectorizer reports each loop that got vectorized,
4802 and the total number of loops that got vectorized.
4803 If @var{n}=2 the vectorizer also reports non-vectorized loops that passed
4804 the first analysis phase (vect_analyze_loop_form) - i.e. countable,
4805 inner-most, single-bb, single-entry/exit loops. This is the same verbosity
4806 level that @option{-fdump-tree-vect-stats} uses.
4807 Higher verbosity levels mean either more information dumped for each
4808 reported loop, or same amount of information reported for more loops:
4809 If @var{n}=3, alignment related information is added to the reports.
4810 If @var{n}=4, data-references related information (e.g. memory dependences,
4811 memory access-patterns) is added to the reports.
4812 If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops
4813 that did not pass the first analysis phase (i.e. may not be countable, or
4814 may have complicated control-flow).
4815 If @var{n}=6, the vectorizer reports also non-vectorized nested loops.
4816 For @var{n}=7, all the information the vectorizer generates during its
4817 analysis and transformation is reported. This is the same verbosity level
4818 that @option{-fdump-tree-vect-details} uses.
4820 @item -frandom-seed=@var{string}
4821 @opindex frandom-string
4822 This option provides a seed that GCC uses when it would otherwise use
4823 random numbers. It is used to generate certain symbol names
4824 that have to be different in every compiled file. It is also used to
4825 place unique stamps in coverage data files and the object files that
4826 produce them. You can use the @option{-frandom-seed} option to produce
4827 reproducibly identical object files.
4829 The @var{string} should be different for every file you compile.
4831 @item -fsched-verbose=@var{n}
4832 @opindex fsched-verbose
4833 On targets that use instruction scheduling, this option controls the
4834 amount of debugging output the scheduler prints. This information is
4835 written to standard error, unless @option{-dS} or @option{-dR} is
4836 specified, in which case it is output to the usual dump
4837 listing file, @file{.sched} or @file{.sched2} respectively. However
4838 for @var{n} greater than nine, the output is always printed to standard
4841 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
4842 same information as @option{-dRS}. For @var{n} greater than one, it
4843 also output basic block probabilities, detailed ready list information
4844 and unit/insn info. For @var{n} greater than two, it includes RTL
4845 at abort point, control-flow and regions info. And for @var{n} over
4846 four, @option{-fsched-verbose} also includes dependence info.
4850 Store the usual ``temporary'' intermediate files permanently; place them
4851 in the current directory and name them based on the source file. Thus,
4852 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
4853 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
4854 preprocessed @file{foo.i} output file even though the compiler now
4855 normally uses an integrated preprocessor.
4857 When used in combination with the @option{-x} command line option,
4858 @option{-save-temps} is sensible enough to avoid over writing an
4859 input source file with the same extension as an intermediate file.
4860 The corresponding intermediate file may be obtained by renaming the
4861 source file before using @option{-save-temps}.
4865 Report the CPU time taken by each subprocess in the compilation
4866 sequence. For C source files, this is the compiler proper and assembler
4867 (plus the linker if linking is done). The output looks like this:
4874 The first number on each line is the ``user time'', that is time spent
4875 executing the program itself. The second number is ``system time'',
4876 time spent executing operating system routines on behalf of the program.
4877 Both numbers are in seconds.
4879 @item -fvar-tracking
4880 @opindex fvar-tracking
4881 Run variable tracking pass. It computes where variables are stored at each
4882 position in code. Better debugging information is then generated
4883 (if the debugging information format supports this information).
4885 It is enabled by default when compiling with optimization (@option{-Os},
4886 @option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
4887 the debug info format supports it.
4889 @item -print-file-name=@var{library}
4890 @opindex print-file-name
4891 Print the full absolute name of the library file @var{library} that
4892 would be used when linking---and don't do anything else. With this
4893 option, GCC does not compile or link anything; it just prints the
4896 @item -print-multi-directory
4897 @opindex print-multi-directory
4898 Print the directory name corresponding to the multilib selected by any
4899 other switches present in the command line. This directory is supposed
4900 to exist in @env{GCC_EXEC_PREFIX}.
4902 @item -print-multi-lib
4903 @opindex print-multi-lib
4904 Print the mapping from multilib directory names to compiler switches
4905 that enable them. The directory name is separated from the switches by
4906 @samp{;}, and each switch starts with an @samp{@@} instead of the
4907 @samp{-}, without spaces between multiple switches. This is supposed to
4908 ease shell-processing.
4910 @item -print-prog-name=@var{program}
4911 @opindex print-prog-name
4912 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
4914 @item -print-libgcc-file-name
4915 @opindex print-libgcc-file-name
4916 Same as @option{-print-file-name=libgcc.a}.
4918 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
4919 but you do want to link with @file{libgcc.a}. You can do
4922 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
4925 @item -print-search-dirs
4926 @opindex print-search-dirs
4927 Print the name of the configured installation directory and a list of
4928 program and library directories @command{gcc} will search---and don't do anything else.
4930 This is useful when @command{gcc} prints the error message
4931 @samp{installation problem, cannot exec cpp0: No such file or directory}.
4932 To resolve this you either need to put @file{cpp0} and the other compiler
4933 components where @command{gcc} expects to find them, or you can set the environment
4934 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
4935 Don't forget the trailing @samp{/}.
4936 @xref{Environment Variables}.
4938 @item -print-sysroot-headers-suffix
4939 @opindex print-sysroot-headers-suffix
4940 Print the suffix added to the target sysroot when searching for
4941 headers, or give an error if the compiler is not configured with such
4942 a suffix---and don't do anything else.
4945 @opindex dumpmachine
4946 Print the compiler's target machine (for example,
4947 @samp{i686-pc-linux-gnu})---and don't do anything else.
4950 @opindex dumpversion
4951 Print the compiler version (for example, @samp{3.0})---and don't do
4956 Print the compiler's built-in specs---and don't do anything else. (This
4957 is used when GCC itself is being built.) @xref{Spec Files}.
4959 @item -feliminate-unused-debug-types
4960 @opindex feliminate-unused-debug-types
4961 Normally, when producing DWARF2 output, GCC will emit debugging
4962 information for all types declared in a compilation
4963 unit, regardless of whether or not they are actually used
4964 in that compilation unit. Sometimes this is useful, such as
4965 if, in the debugger, you want to cast a value to a type that is
4966 not actually used in your program (but is declared). More often,
4967 however, this results in a significant amount of wasted space.
4968 With this option, GCC will avoid producing debug symbol output
4969 for types that are nowhere used in the source file being compiled.
4972 @node Optimize Options
4973 @section Options That Control Optimization
4974 @cindex optimize options
4975 @cindex options, optimization
4977 These options control various sorts of optimizations.
4979 Without any optimization option, the compiler's goal is to reduce the
4980 cost of compilation and to make debugging produce the expected
4981 results. Statements are independent: if you stop the program with a
4982 breakpoint between statements, you can then assign a new value to any
4983 variable or change the program counter to any other statement in the
4984 function and get exactly the results you would expect from the source
4987 Turning on optimization flags makes the compiler attempt to improve
4988 the performance and/or code size at the expense of compilation time
4989 and possibly the ability to debug the program.
4991 The compiler performs optimization based on the knowledge it has of
4992 the program. Optimization levels @option{-O} and above, in
4993 particular, enable @emph{unit-at-a-time} mode, which allows the
4994 compiler to consider information gained from later functions in
4995 the file when compiling a function. Compiling multiple files at
4996 once to a single output file in @emph{unit-at-a-time} mode allows
4997 the compiler to use information gained from all of the files when
4998 compiling each of them.
5000 Not all optimizations are controlled directly by a flag. Only
5001 optimizations that have a flag are listed.
5008 Optimize. Optimizing compilation takes somewhat more time, and a lot
5009 more memory for a large function.
5011 With @option{-O}, the compiler tries to reduce code size and execution
5012 time, without performing any optimizations that take a great deal of
5015 @option{-O} turns on the following optimization flags:
5016 @gccoptlist{-fdefer-pop @gol
5017 -fdelayed-branch @gol
5018 -fguess-branch-probability @gol
5019 -fcprop-registers @gol
5020 -fif-conversion @gol
5021 -fif-conversion2 @gol
5022 -fsplit-wide-types @gol
5025 -ftree-dominator-opts @gol
5029 -ftree-copyrename @gol
5032 -funit-at-a-time @gol
5035 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
5036 where doing so does not interfere with debugging.
5040 Optimize even more. GCC performs nearly all supported optimizations
5041 that do not involve a space-speed tradeoff. The compiler does not
5042 perform loop unrolling or function inlining when you specify @option{-O2}.
5043 As compared to @option{-O}, this option increases both compilation time
5044 and the performance of the generated code.
5046 @option{-O2} turns on all optimization flags specified by @option{-O}. It
5047 also turns on the following optimization flags:
5048 @gccoptlist{-fthread-jumps @gol
5050 -foptimize-sibling-calls @gol
5051 -fcse-follow-jumps -fcse-skip-blocks @gol
5052 -fgcse -fgcse-lm @gol
5053 -fexpensive-optimizations @gol
5054 -frerun-cse-after-loop @gol
5057 -fschedule-insns -fschedule-insns2 @gol
5058 -fsched-interblock -fsched-spec @gol
5060 -fstrict-aliasing -fstrict-overflow @gol
5061 -fdelete-null-pointer-checks @gol
5062 -freorder-blocks -freorder-functions @gol
5063 -falign-functions -falign-jumps @gol
5064 -falign-loops -falign-labels @gol
5068 Please note the warning under @option{-fgcse} about
5069 invoking @option{-O2} on programs that use computed gotos.
5073 Optimize yet more. @option{-O3} turns on all optimizations specified by
5074 @option{-O2} and also turns on the @option{-finline-functions},
5075 @option{-funswitch-loops}, @option{-fpredictive-commoning} and
5076 @option{-fgcse-after-reload} options.
5080 Reduce compilation time and make debugging produce the expected
5081 results. This is the default.
5085 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
5086 do not typically increase code size. It also performs further
5087 optimizations designed to reduce code size.
5089 @option{-Os} disables the following optimization flags:
5090 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
5091 -falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
5092 -fprefetch-loop-arrays -ftree-vect-loop-version}
5094 If you use multiple @option{-O} options, with or without level numbers,
5095 the last such option is the one that is effective.
5098 Options of the form @option{-f@var{flag}} specify machine-independent
5099 flags. Most flags have both positive and negative forms; the negative
5100 form of @option{-ffoo} would be @option{-fno-foo}. In the table
5101 below, only one of the forms is listed---the one you typically will
5102 use. You can figure out the other form by either removing @samp{no-}
5105 The following options control specific optimizations. They are either
5106 activated by @option{-O} options or are related to ones that are. You
5107 can use the following flags in the rare cases when ``fine-tuning'' of
5108 optimizations to be performed is desired.
5111 @item -fno-default-inline
5112 @opindex fno-default-inline
5113 Do not make member functions inline by default merely because they are
5114 defined inside the class scope (C++ only). Otherwise, when you specify
5115 @w{@option{-O}}, member functions defined inside class scope are compiled
5116 inline by default; i.e., you don't need to add @samp{inline} in front of
5117 the member function name.
5119 @item -fno-defer-pop
5120 @opindex fno-defer-pop
5121 Always pop the arguments to each function call as soon as that function
5122 returns. For machines which must pop arguments after a function call,
5123 the compiler normally lets arguments accumulate on the stack for several
5124 function calls and pops them all at once.
5126 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5129 @opindex fforce-addr
5130 Force memory address constants to be copied into registers before
5131 doing arithmetic on them.
5133 @item -fforward-propagate
5134 @opindex fforward-propagate
5135 Perform a forward propagation pass on RTL. The pass tries to combine two
5136 instructions and checks if the result can be simplified. If loop unrolling
5137 is active, two passes are performed and the second is scheduled after
5140 This option is enabled by default at optimization levels @option{-O2},
5141 @option{-O3}, @option{-Os}.
5143 @item -fomit-frame-pointer
5144 @opindex fomit-frame-pointer
5145 Don't keep the frame pointer in a register for functions that
5146 don't need one. This avoids the instructions to save, set up and
5147 restore frame pointers; it also makes an extra register available
5148 in many functions. @strong{It also makes debugging impossible on
5151 On some machines, such as the VAX, this flag has no effect, because
5152 the standard calling sequence automatically handles the frame pointer
5153 and nothing is saved by pretending it doesn't exist. The
5154 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
5155 whether a target machine supports this flag. @xref{Registers,,Register
5156 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
5158 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5160 @item -foptimize-sibling-calls
5161 @opindex foptimize-sibling-calls
5162 Optimize sibling and tail recursive calls.
5164 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5168 Don't pay attention to the @code{inline} keyword. Normally this option
5169 is used to keep the compiler from expanding any functions inline.
5170 Note that if you are not optimizing, no functions can be expanded inline.
5172 @item -finline-functions
5173 @opindex finline-functions
5174 Integrate all simple functions into their callers. The compiler
5175 heuristically decides which functions are simple enough to be worth
5176 integrating in this way.
5178 If all calls to a given function are integrated, and the function is
5179 declared @code{static}, then the function is normally not output as
5180 assembler code in its own right.
5182 Enabled at level @option{-O3}.
5184 @item -finline-functions-called-once
5185 @opindex finline-functions-called-once
5186 Consider all @code{static} functions called once for inlining into their
5187 caller even if they are not marked @code{inline}. If a call to a given
5188 function is integrated, then the function is not output as assembler code
5191 Enabled if @option{-funit-at-a-time} is enabled.
5193 @item -fearly-inlining
5194 @opindex fearly-inlining
5195 Inline functions marked by @code{always_inline} and functions whose body seems
5196 smaller than the function call overhead early before doing
5197 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
5198 makes profiling significantly cheaper and usually inlining faster on programs
5199 having large chains of nested wrapper functions.
5203 @item -finline-limit=@var{n}
5204 @opindex finline-limit
5205 By default, GCC limits the size of functions that can be inlined. This flag
5206 allows the control of this limit for functions that are explicitly marked as
5207 inline (i.e., marked with the inline keyword or defined within the class
5208 definition in c++). @var{n} is the size of functions that can be inlined in
5209 number of pseudo instructions (not counting parameter handling). The default
5210 value of @var{n} is 600.
5211 Increasing this value can result in more inlined code at
5212 the cost of compilation time and memory consumption. Decreasing usually makes
5213 the compilation faster and less code will be inlined (which presumably
5214 means slower programs). This option is particularly useful for programs that
5215 use inlining heavily such as those based on recursive templates with C++.
5217 Inlining is actually controlled by a number of parameters, which may be
5218 specified individually by using @option{--param @var{name}=@var{value}}.
5219 The @option{-finline-limit=@var{n}} option sets some of these parameters
5223 @item max-inline-insns-single
5224 is set to @var{n}/2.
5225 @item max-inline-insns-auto
5226 is set to @var{n}/2.
5227 @item min-inline-insns
5228 is set to 130 or @var{n}/4, whichever is smaller.
5229 @item max-inline-insns-rtl
5233 See below for a documentation of the individual
5234 parameters controlling inlining.
5236 @emph{Note:} pseudo instruction represents, in this particular context, an
5237 abstract measurement of function's size. In no way does it represent a count
5238 of assembly instructions and as such its exact meaning might change from one
5239 release to an another.
5241 @item -fkeep-inline-functions
5242 @opindex fkeep-inline-functions
5243 In C, emit @code{static} functions that are declared @code{inline}
5244 into the object file, even if the function has been inlined into all
5245 of its callers. This switch does not affect functions using the
5246 @code{extern inline} extension in GNU C89@. In C++, emit any and all
5247 inline functions into the object file.
5249 @item -fkeep-static-consts
5250 @opindex fkeep-static-consts
5251 Emit variables declared @code{static const} when optimization isn't turned
5252 on, even if the variables aren't referenced.
5254 GCC enables this option by default. If you want to force the compiler to
5255 check if the variable was referenced, regardless of whether or not
5256 optimization is turned on, use the @option{-fno-keep-static-consts} option.
5258 @item -fmerge-constants
5259 Attempt to merge identical constants (string constants and floating point
5260 constants) across compilation units.
5262 This option is the default for optimized compilation if the assembler and
5263 linker support it. Use @option{-fno-merge-constants} to inhibit this
5266 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5268 @item -fmerge-all-constants
5269 Attempt to merge identical constants and identical variables.
5271 This option implies @option{-fmerge-constants}. In addition to
5272 @option{-fmerge-constants} this considers e.g.@: even constant initialized
5273 arrays or initialized constant variables with integral or floating point
5274 types. Languages like C or C++ require each non-automatic variable to
5275 have distinct location, so using this option will result in non-conforming
5278 @item -fmodulo-sched
5279 @opindex fmodulo-sched
5280 Perform swing modulo scheduling immediately before the first scheduling
5281 pass. This pass looks at innermost loops and reorders their
5282 instructions by overlapping different iterations.
5284 @item -fmodulo-sched-allow-regmoves
5285 @opindex fmodulo-sched-allow-regmoves
5286 Perform more aggressive SMS based modulo scheduling with register moves
5287 allowed. By setting this flag certain anti-dependences edges will be
5288 deleted which will trigger the generation of reg-moves based on the
5289 life-range analysis.
5291 @item -fno-branch-count-reg
5292 @opindex fno-branch-count-reg
5293 Do not use ``decrement and branch'' instructions on a count register,
5294 but instead generate a sequence of instructions that decrement a
5295 register, compare it against zero, then branch based upon the result.
5296 This option is only meaningful on architectures that support such
5297 instructions, which include x86, PowerPC, IA-64 and S/390.
5299 The default is @option{-fbranch-count-reg}.
5301 @item -fno-function-cse
5302 @opindex fno-function-cse
5303 Do not put function addresses in registers; make each instruction that
5304 calls a constant function contain the function's address explicitly.
5306 This option results in less efficient code, but some strange hacks
5307 that alter the assembler output may be confused by the optimizations
5308 performed when this option is not used.
5310 The default is @option{-ffunction-cse}
5312 @item -fno-zero-initialized-in-bss
5313 @opindex fno-zero-initialized-in-bss
5314 If the target supports a BSS section, GCC by default puts variables that
5315 are initialized to zero into BSS@. This can save space in the resulting
5318 This option turns off this behavior because some programs explicitly
5319 rely on variables going to the data section. E.g., so that the
5320 resulting executable can find the beginning of that section and/or make
5321 assumptions based on that.
5323 The default is @option{-fzero-initialized-in-bss}.
5325 @item -fbounds-check
5326 @opindex fbounds-check
5327 For front-ends that support it, generate additional code to check that
5328 indices used to access arrays are within the declared range. This is
5329 currently only supported by the Java and Fortran front-ends, where
5330 this option defaults to true and false respectively.
5332 @item -fmudflap -fmudflapth -fmudflapir
5336 @cindex bounds checking
5338 For front-ends that support it (C and C++), instrument all risky
5339 pointer/array dereferencing operations, some standard library
5340 string/heap functions, and some other associated constructs with
5341 range/validity tests. Modules so instrumented should be immune to
5342 buffer overflows, invalid heap use, and some other classes of C/C++
5343 programming errors. The instrumentation relies on a separate runtime
5344 library (@file{libmudflap}), which will be linked into a program if
5345 @option{-fmudflap} is given at link time. Run-time behavior of the
5346 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
5347 environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out}
5350 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
5351 link if your program is multi-threaded. Use @option{-fmudflapir}, in
5352 addition to @option{-fmudflap} or @option{-fmudflapth}, if
5353 instrumentation should ignore pointer reads. This produces less
5354 instrumentation (and therefore faster execution) and still provides
5355 some protection against outright memory corrupting writes, but allows
5356 erroneously read data to propagate within a program.
5358 @item -fthread-jumps
5359 @opindex fthread-jumps
5360 Perform optimizations where we check to see if a jump branches to a
5361 location where another comparison subsumed by the first is found. If
5362 so, the first branch is redirected to either the destination of the
5363 second branch or a point immediately following it, depending on whether
5364 the condition is known to be true or false.
5366 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5368 @item -fsplit-wide-types
5369 @opindex fsplit-wide-types
5370 When using a type that occupies multiple registers, such as @code{long
5371 long} on a 32-bit system, split the registers apart and allocate them
5372 independently. This normally generates better code for those types,
5373 but may make debugging more difficult.
5375 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
5378 @item -fcse-follow-jumps
5379 @opindex fcse-follow-jumps
5380 In common subexpression elimination, scan through jump instructions
5381 when the target of the jump is not reached by any other path. For
5382 example, when CSE encounters an @code{if} statement with an
5383 @code{else} clause, CSE will follow the jump when the condition
5386 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5388 @item -fcse-skip-blocks
5389 @opindex fcse-skip-blocks
5390 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
5391 follow jumps which conditionally skip over blocks. When CSE
5392 encounters a simple @code{if} statement with no else clause,
5393 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
5394 body of the @code{if}.
5396 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5398 @item -frerun-cse-after-loop
5399 @opindex frerun-cse-after-loop
5400 Re-run common subexpression elimination after loop optimizations has been
5403 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5407 Perform a global common subexpression elimination pass.
5408 This pass also performs global constant and copy propagation.
5410 @emph{Note:} When compiling a program using computed gotos, a GCC
5411 extension, you may get better runtime performance if you disable
5412 the global common subexpression elimination pass by adding
5413 @option{-fno-gcse} to the command line.
5415 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5419 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
5420 attempt to move loads which are only killed by stores into themselves. This
5421 allows a loop containing a load/store sequence to be changed to a load outside
5422 the loop, and a copy/store within the loop.
5424 Enabled by default when gcse is enabled.
5428 When @option{-fgcse-sm} is enabled, a store motion pass is run after
5429 global common subexpression elimination. This pass will attempt to move
5430 stores out of loops. When used in conjunction with @option{-fgcse-lm},
5431 loops containing a load/store sequence can be changed to a load before
5432 the loop and a store after the loop.
5434 Not enabled at any optimization level.
5438 When @option{-fgcse-las} is enabled, the global common subexpression
5439 elimination pass eliminates redundant loads that come after stores to the
5440 same memory location (both partial and full redundancies).
5442 Not enabled at any optimization level.
5444 @item -fgcse-after-reload
5445 @opindex fgcse-after-reload
5446 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
5447 pass is performed after reload. The purpose of this pass is to cleanup
5450 @item -funsafe-loop-optimizations
5451 @opindex funsafe-loop-optimizations
5452 If given, the loop optimizer will assume that loop indices do not
5453 overflow, and that the loops with nontrivial exit condition are not
5454 infinite. This enables a wider range of loop optimizations even if
5455 the loop optimizer itself cannot prove that these assumptions are valid.
5456 Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
5457 if it finds this kind of loop.
5459 @item -fcrossjumping
5460 @opindex crossjumping
5461 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
5462 resulting code may or may not perform better than without cross-jumping.
5464 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5466 @item -fif-conversion
5467 @opindex if-conversion
5468 Attempt to transform conditional jumps into branch-less equivalents. This
5469 include use of conditional moves, min, max, set flags and abs instructions, and
5470 some tricks doable by standard arithmetics. The use of conditional execution
5471 on chips where it is available is controlled by @code{if-conversion2}.
5473 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5475 @item -fif-conversion2
5476 @opindex if-conversion2
5477 Use conditional execution (where available) to transform conditional jumps into
5478 branch-less equivalents.
5480 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5482 @item -fdelete-null-pointer-checks
5483 @opindex fdelete-null-pointer-checks
5484 Use global dataflow analysis to identify and eliminate useless checks
5485 for null pointers. The compiler assumes that dereferencing a null
5486 pointer would have halted the program. If a pointer is checked after
5487 it has already been dereferenced, it cannot be null.
5489 In some environments, this assumption is not true, and programs can
5490 safely dereference null pointers. Use
5491 @option{-fno-delete-null-pointer-checks} to disable this optimization
5492 for programs which depend on that behavior.
5494 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5496 @item -fexpensive-optimizations
5497 @opindex fexpensive-optimizations
5498 Perform a number of minor optimizations that are relatively expensive.
5500 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5502 @item -foptimize-register-move
5504 @opindex foptimize-register-move
5506 Attempt to reassign register numbers in move instructions and as
5507 operands of other simple instructions in order to maximize the amount of
5508 register tying. This is especially helpful on machines with two-operand
5511 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
5514 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5516 @item -fdelayed-branch
5517 @opindex fdelayed-branch
5518 If supported for the target machine, attempt to reorder instructions
5519 to exploit instruction slots available after delayed branch
5522 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5524 @item -fschedule-insns
5525 @opindex fschedule-insns
5526 If supported for the target machine, attempt to reorder instructions to
5527 eliminate execution stalls due to required data being unavailable. This
5528 helps machines that have slow floating point or memory load instructions
5529 by allowing other instructions to be issued until the result of the load
5530 or floating point instruction is required.
5532 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5534 @item -fschedule-insns2
5535 @opindex fschedule-insns2
5536 Similar to @option{-fschedule-insns}, but requests an additional pass of
5537 instruction scheduling after register allocation has been done. This is
5538 especially useful on machines with a relatively small number of
5539 registers and where memory load instructions take more than one cycle.
5541 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5543 @item -fno-sched-interblock
5544 @opindex fno-sched-interblock
5545 Don't schedule instructions across basic blocks. This is normally
5546 enabled by default when scheduling before register allocation, i.e.@:
5547 with @option{-fschedule-insns} or at @option{-O2} or higher.
5549 @item -fno-sched-spec
5550 @opindex fno-sched-spec
5551 Don't allow speculative motion of non-load instructions. This is normally
5552 enabled by default when scheduling before register allocation, i.e.@:
5553 with @option{-fschedule-insns} or at @option{-O2} or higher.
5555 @item -fsched-spec-load
5556 @opindex fsched-spec-load
5557 Allow speculative motion of some load instructions. This only makes
5558 sense when scheduling before register allocation, i.e.@: with
5559 @option{-fschedule-insns} or at @option{-O2} or higher.
5561 @item -fsched-spec-load-dangerous
5562 @opindex fsched-spec-load-dangerous
5563 Allow speculative motion of more load instructions. This only makes
5564 sense when scheduling before register allocation, i.e.@: with
5565 @option{-fschedule-insns} or at @option{-O2} or higher.
5567 @item -fsched-stalled-insns=@var{n}
5568 @opindex fsched-stalled-insns
5569 Define how many insns (if any) can be moved prematurely from the queue
5570 of stalled insns into the ready list, during the second scheduling pass.
5572 @item -fsched-stalled-insns-dep=@var{n}
5573 @opindex fsched-stalled-insns-dep
5574 Define how many insn groups (cycles) will be examined for a dependency
5575 on a stalled insn that is candidate for premature removal from the queue
5576 of stalled insns. Has an effect only during the second scheduling pass,
5577 and only if @option{-fsched-stalled-insns} is used and its value is not zero.
5579 @item -fsched2-use-superblocks
5580 @opindex fsched2-use-superblocks
5581 When scheduling after register allocation, do use superblock scheduling
5582 algorithm. Superblock scheduling allows motion across basic block boundaries
5583 resulting on faster schedules. This option is experimental, as not all machine
5584 descriptions used by GCC model the CPU closely enough to avoid unreliable
5585 results from the algorithm.
5587 This only makes sense when scheduling after register allocation, i.e.@: with
5588 @option{-fschedule-insns2} or at @option{-O2} or higher.
5590 @item -fsched2-use-traces
5591 @opindex fsched2-use-traces
5592 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
5593 allocation and additionally perform code duplication in order to increase the
5594 size of superblocks using tracer pass. See @option{-ftracer} for details on
5597 This mode should produce faster but significantly longer programs. Also
5598 without @option{-fbranch-probabilities} the traces constructed may not
5599 match the reality and hurt the performance. This only makes
5600 sense when scheduling after register allocation, i.e.@: with
5601 @option{-fschedule-insns2} or at @option{-O2} or higher.
5605 Eliminates redundant extension instructions and move the non redundant
5606 ones to optimal placement using LCM.
5608 @item -freschedule-modulo-scheduled-loops
5609 @opindex fscheduling-in-modulo-scheduled-loops
5610 The modulo scheduling comes before the traditional scheduling, if a loop
5611 was modulo scheduled we may want to prevent the later scheduling passes
5612 from changing its schedule, we use this option to control that.
5614 @item -fcaller-saves
5615 @opindex fcaller-saves
5616 Enable values to be allocated in registers that will be clobbered by
5617 function calls, by emitting extra instructions to save and restore the
5618 registers around such calls. Such allocation is done only when it
5619 seems to result in better code than would otherwise be produced.
5621 This option is always enabled by default on certain machines, usually
5622 those which have no call-preserved registers to use instead.
5624 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5626 @item -ftree-reassoc
5627 Perform Reassociation on trees This flag is enabled by default
5628 at @option{-O} and higher.
5631 Perform Partial Redundancy Elimination (PRE) on trees. This flag is
5632 enabled by default at @option{-O2} and @option{-O3}.
5635 Perform Full Redundancy Elimination (FRE) on trees. The difference
5636 between FRE and PRE is that FRE only considers expressions
5637 that are computed on all paths leading to the redundant computation.
5638 This analysis is faster than PRE, though it exposes fewer redundancies.
5639 This flag is enabled by default at @option{-O} and higher.
5641 @item -ftree-copy-prop
5642 Perform copy propagation on trees. This pass eliminates unnecessary
5643 copy operations. This flag is enabled by default at @option{-O} and
5646 @item -ftree-store-copy-prop
5647 Perform copy propagation of memory loads and stores. This pass
5648 eliminates unnecessary copy operations in memory references
5649 (structures, global variables, arrays, etc). This flag is enabled by
5650 default at @option{-O2} and higher.
5653 Perform structural alias analysis on trees. This flag
5654 is enabled by default at @option{-O} and higher.
5657 Perform interprocedural pointer analysis.
5660 Perform forward store motion on trees. This flag is
5661 enabled by default at @option{-O} and higher.
5664 Perform sparse conditional constant propagation (CCP) on trees. This
5665 pass only operates on local scalar variables and is enabled by default
5666 at @option{-O} and higher.
5668 @item -ftree-store-ccp
5669 Perform sparse conditional constant propagation (CCP) on trees. This
5670 pass operates on both local scalar variables and memory stores and
5671 loads (global variables, structures, arrays, etc). This flag is
5672 enabled by default at @option{-O2} and higher.
5675 Perform dead code elimination (DCE) on trees. This flag is enabled by
5676 default at @option{-O} and higher.
5678 @item -ftree-dominator-opts
5679 Perform a variety of simple scalar cleanups (constant/copy
5680 propagation, redundancy elimination, range propagation and expression
5681 simplification) based on a dominator tree traversal. This also
5682 performs jump threading (to reduce jumps to jumps). This flag is
5683 enabled by default at @option{-O} and higher.
5686 Perform loop header copying on trees. This is beneficial since it increases
5687 effectiveness of code motion optimizations. It also saves one jump. This flag
5688 is enabled by default at @option{-O} and higher. It is not enabled
5689 for @option{-Os}, since it usually increases code size.
5691 @item -ftree-loop-optimize
5692 Perform loop optimizations on trees. This flag is enabled by default
5693 at @option{-O} and higher.
5695 @item -ftree-loop-linear
5696 Perform linear loop transformations on tree. This flag can improve cache
5697 performance and allow further loop optimizations to take place.
5699 @item -fcheck-data-deps
5700 Compare the results of several data dependence analyzers. This option
5701 is used for debugging the data dependence analyzers.
5703 @item -ftree-loop-im
5704 Perform loop invariant motion on trees. This pass moves only invariants that
5705 would be hard to handle at RTL level (function calls, operations that expand to
5706 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
5707 operands of conditions that are invariant out of the loop, so that we can use
5708 just trivial invariantness analysis in loop unswitching. The pass also includes
5711 @item -ftree-loop-ivcanon
5712 Create a canonical counter for number of iterations in the loop for that
5713 determining number of iterations requires complicated analysis. Later
5714 optimizations then may determine the number easily. Useful especially
5715 in connection with unrolling.
5718 Perform induction variable optimizations (strength reduction, induction
5719 variable merging and induction variable elimination) on trees.
5722 Perform scalar replacement of aggregates. This pass replaces structure
5723 references with scalars to prevent committing structures to memory too
5724 early. This flag is enabled by default at @option{-O} and higher.
5726 @item -ftree-copyrename
5727 Perform copy renaming on trees. This pass attempts to rename compiler
5728 temporaries to other variables at copy locations, usually resulting in
5729 variable names which more closely resemble the original variables. This flag
5730 is enabled by default at @option{-O} and higher.
5733 Perform temporary expression replacement during the SSA->normal phase. Single
5734 use/single def temporaries are replaced at their use location with their
5735 defining expression. This results in non-GIMPLE code, but gives the expanders
5736 much more complex trees to work on resulting in better RTL generation. This is
5737 enabled by default at @option{-O} and higher.
5739 @item -ftree-vectorize
5740 Perform loop vectorization on trees.
5742 @item -ftree-vect-loop-version
5743 @opindex ftree-vect-loop-version
5744 Perform loop versioning when doing loop vectorization on trees. When a loop
5745 appears to be vectorizable except that data alignment or data dependence cannot
5746 be determined at compile time then vectorized and non-vectorized versions of
5747 the loop are generated along with runtime checks for alignment or dependence
5748 to control which version is executed. This option is enabled by default
5749 except at level @option{-Os} where it is disabled.
5751 @item -fvect-cost-model
5752 Enable cost model for vectorization.
5755 Perform Value Range Propagation on trees. This is similar to the
5756 constant propagation pass, but instead of values, ranges of values are
5757 propagated. This allows the optimizers to remove unnecessary range
5758 checks like array bound checks and null pointer checks. This is
5759 enabled by default at @option{-O2} and higher. Null pointer check
5760 elimination is only done if @option{-fdelete-null-pointer-checks} is
5765 Perform tail duplication to enlarge superblock size. This transformation
5766 simplifies the control flow of the function allowing other optimizations to do
5769 @item -funroll-loops
5770 @opindex funroll-loops
5771 Unroll loops whose number of iterations can be determined at compile
5772 time or upon entry to the loop. @option{-funroll-loops} implies
5773 @option{-frerun-cse-after-loop}. This option makes code larger,
5774 and may or may not make it run faster.
5776 @item -funroll-all-loops
5777 @opindex funroll-all-loops
5778 Unroll all loops, even if their number of iterations is uncertain when
5779 the loop is entered. This usually makes programs run more slowly.
5780 @option{-funroll-all-loops} implies the same options as
5781 @option{-funroll-loops},
5783 @item -fsplit-ivs-in-unroller
5784 @opindex fsplit-ivs-in-unroller
5785 Enables expressing of values of induction variables in later iterations
5786 of the unrolled loop using the value in the first iteration. This breaks
5787 long dependency chains, thus improving efficiency of the scheduling passes.
5789 Combination of @option{-fweb} and CSE is often sufficient to obtain the
5790 same effect. However in cases the loop body is more complicated than
5791 a single basic block, this is not reliable. It also does not work at all
5792 on some of the architectures due to restrictions in the CSE pass.
5794 This optimization is enabled by default.
5796 @item -fvariable-expansion-in-unroller
5797 @opindex fvariable-expansion-in-unroller
5798 With this option, the compiler will create multiple copies of some
5799 local variables when unrolling a loop which can result in superior code.
5801 @item -fpredictive-commoning
5802 @opindex fpredictive-commoning
5803 Perform predictive commoning optimization, i.e., reusing computations
5804 (especially memory loads and stores) performed in previous
5805 iterations of loops.
5807 This option is enabled at level @option{-O3}.
5809 @item -fprefetch-loop-arrays
5810 @opindex fprefetch-loop-arrays
5811 If supported by the target machine, generate instructions to prefetch
5812 memory to improve the performance of loops that access large arrays.
5814 This option may generate better or worse code; results are highly
5815 dependent on the structure of loops within the source code.
5817 Disabled at level @option{-Os}.
5820 @itemx -fno-peephole2
5821 @opindex fno-peephole
5822 @opindex fno-peephole2
5823 Disable any machine-specific peephole optimizations. The difference
5824 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
5825 are implemented in the compiler; some targets use one, some use the
5826 other, a few use both.
5828 @option{-fpeephole} is enabled by default.
5829 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5831 @item -fno-guess-branch-probability
5832 @opindex fno-guess-branch-probability
5833 Do not guess branch probabilities using heuristics.
5835 GCC will use heuristics to guess branch probabilities if they are
5836 not provided by profiling feedback (@option{-fprofile-arcs}). These
5837 heuristics are based on the control flow graph. If some branch probabilities
5838 are specified by @samp{__builtin_expect}, then the heuristics will be
5839 used to guess branch probabilities for the rest of the control flow graph,
5840 taking the @samp{__builtin_expect} info into account. The interactions
5841 between the heuristics and @samp{__builtin_expect} can be complex, and in
5842 some cases, it may be useful to disable the heuristics so that the effects
5843 of @samp{__builtin_expect} are easier to understand.
5845 The default is @option{-fguess-branch-probability} at levels
5846 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5848 @item -freorder-blocks
5849 @opindex freorder-blocks
5850 Reorder basic blocks in the compiled function in order to reduce number of
5851 taken branches and improve code locality.
5853 Enabled at levels @option{-O2}, @option{-O3}.
5855 @item -freorder-blocks-and-partition
5856 @opindex freorder-blocks-and-partition
5857 In addition to reordering basic blocks in the compiled function, in order
5858 to reduce number of taken branches, partitions hot and cold basic blocks
5859 into separate sections of the assembly and .o files, to improve
5860 paging and cache locality performance.
5862 This optimization is automatically turned off in the presence of
5863 exception handling, for linkonce sections, for functions with a user-defined
5864 section attribute and on any architecture that does not support named
5867 @item -freorder-functions
5868 @opindex freorder-functions
5869 Reorder functions in the object file in order to
5870 improve code locality. This is implemented by using special
5871 subsections @code{.text.hot} for most frequently executed functions and
5872 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
5873 the linker so object file format must support named sections and linker must
5874 place them in a reasonable way.
5876 Also profile feedback must be available in to make this option effective. See
5877 @option{-fprofile-arcs} for details.
5879 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5881 @item -fstrict-aliasing
5882 @opindex fstrict-aliasing
5883 Allows the compiler to assume the strictest aliasing rules applicable to
5884 the language being compiled. For C (and C++), this activates
5885 optimizations based on the type of expressions. In particular, an
5886 object of one type is assumed never to reside at the same address as an
5887 object of a different type, unless the types are almost the same. For
5888 example, an @code{unsigned int} can alias an @code{int}, but not a
5889 @code{void*} or a @code{double}. A character type may alias any other
5892 Pay special attention to code like this:
5905 The practice of reading from a different union member than the one most
5906 recently written to (called ``type-punning'') is common. Even with
5907 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
5908 is accessed through the union type. So, the code above will work as
5909 expected. However, this code might not:
5920 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5922 @item -fstrict-overflow
5923 @opindex fstrict-overflow
5924 Allow the compiler to assume strict signed overflow rules, depending
5925 on the language being compiled. For C (and C++) this means that
5926 overflow when doing arithmetic with signed numbers is undefined, which
5927 means that the compiler may assume that it will not happen. This
5928 permits various optimizations. For example, the compiler will assume
5929 that an expression like @code{i + 10 > i} will always be true for
5930 signed @code{i}. This assumption is only valid if signed overflow is
5931 undefined, as the expression is false if @code{i + 10} overflows when
5932 using twos complement arithmetic. When this option is in effect any
5933 attempt to determine whether an operation on signed numbers will
5934 overflow must be written carefully to not actually involve overflow.
5936 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
5937 that signed overflow is fully defined: it wraps. When
5938 @option{-fwrapv} is used, there is no difference between
5939 @option{-fstrict-overflow} and @option{-fno-strict-overflow}. With
5940 @option{-fwrapv} certain types of overflow are permitted. For
5941 example, if the compiler gets an overflow when doing arithmetic on
5942 constants, the overflowed value can still be used with
5943 @option{-fwrapv}, but not otherwise.
5945 The @option{-fstrict-overflow} option is enabled at levels
5946 @option{-O2}, @option{-O3}, @option{-Os}.
5948 @item -falign-functions
5949 @itemx -falign-functions=@var{n}
5950 @opindex falign-functions
5951 Align the start of functions to the next power-of-two greater than
5952 @var{n}, skipping up to @var{n} bytes. For instance,
5953 @option{-falign-functions=32} aligns functions to the next 32-byte
5954 boundary, but @option{-falign-functions=24} would align to the next
5955 32-byte boundary only if this can be done by skipping 23 bytes or less.
5957 @option{-fno-align-functions} and @option{-falign-functions=1} are
5958 equivalent and mean that functions will not be aligned.
5960 Some assemblers only support this flag when @var{n} is a power of two;
5961 in that case, it is rounded up.
5963 If @var{n} is not specified or is zero, use a machine-dependent default.
5965 Enabled at levels @option{-O2}, @option{-O3}.
5967 @item -falign-labels
5968 @itemx -falign-labels=@var{n}
5969 @opindex falign-labels
5970 Align all branch targets to a power-of-two boundary, skipping up to
5971 @var{n} bytes like @option{-falign-functions}. This option can easily
5972 make code slower, because it must insert dummy operations for when the
5973 branch target is reached in the usual flow of the code.
5975 @option{-fno-align-labels} and @option{-falign-labels=1} are
5976 equivalent and mean that labels will not be aligned.
5978 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
5979 are greater than this value, then their values are used instead.
5981 If @var{n} is not specified or is zero, use a machine-dependent default
5982 which is very likely to be @samp{1}, meaning no alignment.
5984 Enabled at levels @option{-O2}, @option{-O3}.
5987 @itemx -falign-loops=@var{n}
5988 @opindex falign-loops
5989 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
5990 like @option{-falign-functions}. The hope is that the loop will be
5991 executed many times, which will make up for any execution of the dummy
5994 @option{-fno-align-loops} and @option{-falign-loops=1} are
5995 equivalent and mean that loops will not be aligned.
5997 If @var{n} is not specified or is zero, use a machine-dependent default.
5999 Enabled at levels @option{-O2}, @option{-O3}.
6002 @itemx -falign-jumps=@var{n}
6003 @opindex falign-jumps
6004 Align branch targets to a power-of-two boundary, for branch targets
6005 where the targets can only be reached by jumping, skipping up to @var{n}
6006 bytes like @option{-falign-functions}. In this case, no dummy operations
6009 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
6010 equivalent and mean that loops will not be aligned.
6012 If @var{n} is not specified or is zero, use a machine-dependent default.
6014 Enabled at levels @option{-O2}, @option{-O3}.
6016 @item -funit-at-a-time
6017 @opindex funit-at-a-time
6018 Parse the whole compilation unit before starting to produce code.
6019 This allows some extra optimizations to take place but consumes
6020 more memory (in general). There are some compatibility issues
6021 with @emph{unit-at-a-time} mode:
6024 enabling @emph{unit-at-a-time} mode may change the order
6025 in which functions, variables, and top-level @code{asm} statements
6026 are emitted, and will likely break code relying on some particular
6027 ordering. The majority of such top-level @code{asm} statements,
6028 though, can be replaced by @code{section} attributes. The
6029 @option{fno-toplevel-reorder} option may be used to keep the ordering
6030 used in the input file, at the cost of some optimizations.
6033 @emph{unit-at-a-time} mode removes unreferenced static variables
6034 and functions. This may result in undefined references
6035 when an @code{asm} statement refers directly to variables or functions
6036 that are otherwise unused. In that case either the variable/function
6037 shall be listed as an operand of the @code{asm} statement operand or,
6038 in the case of top-level @code{asm} statements the attribute @code{used}
6039 shall be used on the declaration.
6042 Static functions now can use non-standard passing conventions that
6043 may break @code{asm} statements calling functions directly. Again,
6044 attribute @code{used} will prevent this behavior.
6047 As a temporary workaround, @option{-fno-unit-at-a-time} can be used,
6048 but this scheme may not be supported by future releases of GCC@.
6050 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6052 @item -fno-toplevel-reorder
6053 Do not reorder top-level functions, variables, and @code{asm}
6054 statements. Output them in the same order that they appear in the
6055 input file. When this option is used, unreferenced static variables
6056 will not be removed. This option is intended to support existing code
6057 which relies on a particular ordering. For new code, it is better to
6062 Constructs webs as commonly used for register allocation purposes and assign
6063 each web individual pseudo register. This allows the register allocation pass
6064 to operate on pseudos directly, but also strengthens several other optimization
6065 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
6066 however, make debugging impossible, since variables will no longer stay in a
6069 Enabled by default with @option{-funroll-loops}.
6071 @item -fwhole-program
6072 @opindex fwhole-program
6073 Assume that the current compilation unit represents whole program being
6074 compiled. All public functions and variables with the exception of @code{main}
6075 and those merged by attribute @code{externally_visible} become static functions
6076 and in a affect gets more aggressively optimized by interprocedural optimizers.
6077 While this option is equivalent to proper use of @code{static} keyword for
6078 programs consisting of single file, in combination with option
6079 @option{--combine} this flag can be used to compile most of smaller scale C
6080 programs since the functions and variables become local for the whole combined
6081 compilation unit, not for the single source file itself.
6084 @item -fno-cprop-registers
6085 @opindex fno-cprop-registers
6086 After register allocation and post-register allocation instruction splitting,
6087 we perform a copy-propagation pass to try to reduce scheduling dependencies
6088 and occasionally eliminate the copy.
6090 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6092 @item -fprofile-generate
6093 @opindex fprofile-generate
6095 Enable options usually used for instrumenting application to produce
6096 profile useful for later recompilation with profile feedback based
6097 optimization. You must use @option{-fprofile-generate} both when
6098 compiling and when linking your program.
6100 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
6103 @opindex fprofile-use
6104 Enable profile feedback directed optimizations, and optimizations
6105 generally profitable only with profile feedback available.
6107 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
6108 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
6110 By default, GCC emits an error message if the feedback profiles do not
6111 match the source code. This error can be turned into a warning by using
6112 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
6116 The following options control compiler behavior regarding floating
6117 point arithmetic. These options trade off between speed and
6118 correctness. All must be specifically enabled.
6122 @opindex ffloat-store
6123 Do not store floating point variables in registers, and inhibit other
6124 options that might change whether a floating point value is taken from a
6127 @cindex floating point precision
6128 This option prevents undesirable excess precision on machines such as
6129 the 68000 where the floating registers (of the 68881) keep more
6130 precision than a @code{double} is supposed to have. Similarly for the
6131 x86 architecture. For most programs, the excess precision does only
6132 good, but a few programs rely on the precise definition of IEEE floating
6133 point. Use @option{-ffloat-store} for such programs, after modifying
6134 them to store all pertinent intermediate computations into variables.
6138 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
6139 @option{-fno-trapping-math}, @option{-ffinite-math-only},
6140 @option{-fno-rounding-math}, @option{-fno-signaling-nans},
6141 @option{-fno-signed-zeros} and @option{fcx-limited-range}.
6143 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
6145 This option is not turned on by any @option{-O} option since
6146 it can result in incorrect output for programs which depend on
6147 an exact implementation of IEEE or ISO rules/specifications for
6148 math functions. It may, however, yield faster code for programs
6149 that do not require the guarantees of these specifications.
6151 @item -fno-math-errno
6152 @opindex fno-math-errno
6153 Do not set ERRNO after calling math functions that are executed
6154 with a single instruction, e.g., sqrt. A program that relies on
6155 IEEE exceptions for math error handling may want to use this flag
6156 for speed while maintaining IEEE arithmetic compatibility.
6158 This option is not turned on by any @option{-O} option since
6159 it can result in incorrect output for programs which depend on
6160 an exact implementation of IEEE or ISO rules/specifications for
6161 math functions. It may, however, yield faster code for programs
6162 that do not require the guarantees of these specifications.
6164 The default is @option{-fmath-errno}.
6166 On Darwin systems, the math library never sets @code{errno}. There is
6167 therefore no reason for the compiler to consider the possibility that
6168 it might, and @option{-fno-math-errno} is the default.
6170 @item -funsafe-math-optimizations
6171 @opindex funsafe-math-optimizations
6172 Allow optimizations for floating-point arithmetic that (a) assume
6173 that arguments and results are valid and (b) may violate IEEE or
6174 ANSI standards. When used at link-time, it may include libraries
6175 or startup files that change the default FPU control word or other
6176 similar optimizations.
6178 This option is not turned on by any @option{-O} option since
6179 it can result in incorrect output for programs which depend on
6180 an exact implementation of IEEE or ISO rules/specifications for
6181 math functions. It may, however, yield faster code for programs
6182 that do not require the guarantees of these specifications.
6184 The default is @option{-fno-unsafe-math-optimizations}.
6186 @item -ffinite-math-only
6187 @opindex ffinite-math-only
6188 Allow optimizations for floating-point arithmetic that assume
6189 that arguments and results are not NaNs or +-Infs.
6191 This option is not turned on by any @option{-O} option since
6192 it can result in incorrect output for programs which depend on
6193 an exact implementation of IEEE or ISO rules/specifications for
6194 math functions. It may, however, yield faster code for programs
6195 that do not require the guarantees of these specifications.
6197 The default is @option{-fno-finite-math-only}.
6199 @item -fno-signed-zeros
6200 @opindex fno-signed-zeros
6201 Allow optimizations for floating point arithmetic that ignore the
6202 signedness of zero. IEEE arithmetic specifies the behavior of
6203 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
6204 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
6205 This option implies that the sign of a zero result isn't significant.
6207 The default is @option{-fsigned-zeros}.
6209 @item -fno-trapping-math
6210 @opindex fno-trapping-math
6211 Compile code assuming that floating-point operations cannot generate
6212 user-visible traps. These traps include division by zero, overflow,
6213 underflow, inexact result and invalid operation. This option implies
6214 @option{-fno-signaling-nans}. Setting this option may allow faster
6215 code if one relies on ``non-stop'' IEEE arithmetic, for example.
6217 This option should never be turned on by any @option{-O} option since
6218 it can result in incorrect output for programs which depend on
6219 an exact implementation of IEEE or ISO rules/specifications for
6222 The default is @option{-ftrapping-math}.
6224 @item -frounding-math
6225 @opindex frounding-math
6226 Disable transformations and optimizations that assume default floating
6227 point rounding behavior. This is round-to-zero for all floating point
6228 to integer conversions, and round-to-nearest for all other arithmetic
6229 truncations. This option should be specified for programs that change
6230 the FP rounding mode dynamically, or that may be executed with a
6231 non-default rounding mode. This option disables constant folding of
6232 floating point expressions at compile-time (which may be affected by
6233 rounding mode) and arithmetic transformations that are unsafe in the
6234 presence of sign-dependent rounding modes.
6236 The default is @option{-fno-rounding-math}.
6238 This option is experimental and does not currently guarantee to
6239 disable all GCC optimizations that are affected by rounding mode.
6240 Future versions of GCC may provide finer control of this setting
6241 using C99's @code{FENV_ACCESS} pragma. This command line option
6242 will be used to specify the default state for @code{FENV_ACCESS}.
6244 @item -frtl-abstract-sequences
6245 @opindex frtl-abstract-sequences
6246 It is a size optimization method. This option is to find identical
6247 sequences of code, which can be turned into pseudo-procedures and
6248 then replace all occurrences with calls to the newly created
6249 subroutine. It is kind of an opposite of @option{-finline-functions}.
6250 This optimization runs at RTL level.
6252 @item -fsignaling-nans
6253 @opindex fsignaling-nans
6254 Compile code assuming that IEEE signaling NaNs may generate user-visible
6255 traps during floating-point operations. Setting this option disables
6256 optimizations that may change the number of exceptions visible with
6257 signaling NaNs. This option implies @option{-ftrapping-math}.
6259 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
6262 The default is @option{-fno-signaling-nans}.
6264 This option is experimental and does not currently guarantee to
6265 disable all GCC optimizations that affect signaling NaN behavior.
6267 @item -fsingle-precision-constant
6268 @opindex fsingle-precision-constant
6269 Treat floating point constant as single precision constant instead of
6270 implicitly converting it to double precision constant.
6272 @item -fcx-limited-range
6273 @itemx -fno-cx-limited-range
6274 @opindex fcx-limited-range
6275 @opindex fno-cx-limited-range
6276 When enabled, this option states that a range reduction step is not
6277 needed when performing complex division. The default is
6278 @option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}.
6280 This option controls the default setting of the ISO C99
6281 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
6286 The following options control optimizations that may improve
6287 performance, but are not enabled by any @option{-O} options. This
6288 section includes experimental options that may produce broken code.
6291 @item -fbranch-probabilities
6292 @opindex fbranch-probabilities
6293 After running a program compiled with @option{-fprofile-arcs}
6294 (@pxref{Debugging Options,, Options for Debugging Your Program or
6295 @command{gcc}}), you can compile it a second time using
6296 @option{-fbranch-probabilities}, to improve optimizations based on
6297 the number of times each branch was taken. When the program
6298 compiled with @option{-fprofile-arcs} exits it saves arc execution
6299 counts to a file called @file{@var{sourcename}.gcda} for each source
6300 file. The information in this data file is very dependent on the
6301 structure of the generated code, so you must use the same source code
6302 and the same optimization options for both compilations.
6304 With @option{-fbranch-probabilities}, GCC puts a
6305 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
6306 These can be used to improve optimization. Currently, they are only
6307 used in one place: in @file{reorg.c}, instead of guessing which path a
6308 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
6309 exactly determine which path is taken more often.
6311 @item -fprofile-values
6312 @opindex fprofile-values
6313 If combined with @option{-fprofile-arcs}, it adds code so that some
6314 data about values of expressions in the program is gathered.
6316 With @option{-fbranch-probabilities}, it reads back the data gathered
6317 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
6318 notes to instructions for their later usage in optimizations.
6320 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
6324 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
6325 a code to gather information about values of expressions.
6327 With @option{-fbranch-probabilities}, it reads back the data gathered
6328 and actually performs the optimizations based on them.
6329 Currently the optimizations include specialization of division operation
6330 using the knowledge about the value of the denominator.
6332 @item -frename-registers
6333 @opindex frename-registers
6334 Attempt to avoid false dependencies in scheduled code by making use
6335 of registers left over after register allocation. This optimization
6336 will most benefit processors with lots of registers. Depending on the
6337 debug information format adopted by the target, however, it can
6338 make debugging impossible, since variables will no longer stay in
6339 a ``home register''.
6341 Enabled by default with @option{-funroll-loops}.
6345 Perform tail duplication to enlarge superblock size. This transformation
6346 simplifies the control flow of the function allowing other optimizations to do
6349 Enabled with @option{-fprofile-use}.
6351 @item -funroll-loops
6352 @opindex funroll-loops
6353 Unroll loops whose number of iterations can be determined at compile time or
6354 upon entry to the loop. @option{-funroll-loops} implies
6355 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
6356 It also turns on complete loop peeling (i.e.@: complete removal of loops with
6357 small constant number of iterations). This option makes code larger, and may
6358 or may not make it run faster.
6360 Enabled with @option{-fprofile-use}.
6362 @item -funroll-all-loops
6363 @opindex funroll-all-loops
6364 Unroll all loops, even if their number of iterations is uncertain when
6365 the loop is entered. This usually makes programs run more slowly.
6366 @option{-funroll-all-loops} implies the same options as
6367 @option{-funroll-loops}.
6370 @opindex fpeel-loops
6371 Peels the loops for that there is enough information that they do not
6372 roll much (from profile feedback). It also turns on complete loop peeling
6373 (i.e.@: complete removal of loops with small constant number of iterations).
6375 Enabled with @option{-fprofile-use}.
6377 @item -fmove-loop-invariants
6378 @opindex fmove-loop-invariants
6379 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
6380 at level @option{-O1}
6382 @item -funswitch-loops
6383 @opindex funswitch-loops
6384 Move branches with loop invariant conditions out of the loop, with duplicates
6385 of the loop on both branches (modified according to result of the condition).
6387 @item -ffunction-sections
6388 @itemx -fdata-sections
6389 @opindex ffunction-sections
6390 @opindex fdata-sections
6391 Place each function or data item into its own section in the output
6392 file if the target supports arbitrary sections. The name of the
6393 function or the name of the data item determines the section's name
6396 Use these options on systems where the linker can perform optimizations
6397 to improve locality of reference in the instruction space. Most systems
6398 using the ELF object format and SPARC processors running Solaris 2 have
6399 linkers with such optimizations. AIX may have these optimizations in
6402 Only use these options when there are significant benefits from doing
6403 so. When you specify these options, the assembler and linker will
6404 create larger object and executable files and will also be slower.
6405 You will not be able to use @code{gprof} on all systems if you
6406 specify this option and you may have problems with debugging if
6407 you specify both this option and @option{-g}.
6409 @item -fbranch-target-load-optimize
6410 @opindex fbranch-target-load-optimize
6411 Perform branch target register load optimization before prologue / epilogue
6413 The use of target registers can typically be exposed only during reload,
6414 thus hoisting loads out of loops and doing inter-block scheduling needs
6415 a separate optimization pass.
6417 @item -fbranch-target-load-optimize2
6418 @opindex fbranch-target-load-optimize2
6419 Perform branch target register load optimization after prologue / epilogue
6422 @item -fbtr-bb-exclusive
6423 @opindex fbtr-bb-exclusive
6424 When performing branch target register load optimization, don't reuse
6425 branch target registers in within any basic block.
6427 @item -fstack-protector
6428 Emit extra code to check for buffer overflows, such as stack smashing
6429 attacks. This is done by adding a guard variable to functions with
6430 vulnerable objects. This includes functions that call alloca, and
6431 functions with buffers larger than 8 bytes. The guards are initialized
6432 when a function is entered and then checked when the function exits.
6433 If a guard check fails, an error message is printed and the program exits.
6435 @item -fstack-protector-all
6436 Like @option{-fstack-protector} except that all functions are protected.
6438 @item -fsection-anchors
6439 @opindex fsection-anchors
6440 Try to reduce the number of symbolic address calculations by using
6441 shared ``anchor'' symbols to address nearby objects. This transformation
6442 can help to reduce the number of GOT entries and GOT accesses on some
6445 For example, the implementation of the following function @code{foo}:
6449 int foo (void) @{ return a + b + c; @}
6452 would usually calculate the addresses of all three variables, but if you
6453 compile it with @option{-fsection-anchors}, it will access the variables
6454 from a common anchor point instead. The effect is similar to the
6455 following pseudocode (which isn't valid C):
6460 register int *xr = &x;
6461 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
6465 Not all targets support this option.
6467 @item --param @var{name}=@var{value}
6469 In some places, GCC uses various constants to control the amount of
6470 optimization that is done. For example, GCC will not inline functions
6471 that contain more that a certain number of instructions. You can
6472 control some of these constants on the command-line using the
6473 @option{--param} option.
6475 The names of specific parameters, and the meaning of the values, are
6476 tied to the internals of the compiler, and are subject to change
6477 without notice in future releases.
6479 In each case, the @var{value} is an integer. The allowable choices for
6480 @var{name} are given in the following table:
6483 @item salias-max-implicit-fields
6484 The maximum number of fields in a variable without direct
6485 structure accesses for which structure aliasing will consider trying
6486 to track each field. The default is 5
6488 @item salias-max-array-elements
6489 The maximum number of elements an array can have and its elements
6490 still be tracked individually by structure aliasing. The default is 4
6492 @item sra-max-structure-size
6493 The maximum structure size, in bytes, at which the scalar replacement
6494 of aggregates (SRA) optimization will perform block copies. The
6495 default value, 0, implies that GCC will select the most appropriate
6498 @item sra-field-structure-ratio
6499 The threshold ratio (as a percentage) between instantiated fields and
6500 the complete structure size. We say that if the ratio of the number
6501 of bytes in instantiated fields to the number of bytes in the complete
6502 structure exceeds this parameter, then block copies are not used. The
6505 @item max-crossjump-edges
6506 The maximum number of incoming edges to consider for crossjumping.
6507 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
6508 the number of edges incoming to each block. Increasing values mean
6509 more aggressive optimization, making the compile time increase with
6510 probably small improvement in executable size.
6512 @item min-crossjump-insns
6513 The minimum number of instructions which must be matched at the end
6514 of two blocks before crossjumping will be performed on them. This
6515 value is ignored in the case where all instructions in the block being
6516 crossjumped from are matched. The default value is 5.
6518 @item max-grow-copy-bb-insns
6519 The maximum code size expansion factor when copying basic blocks
6520 instead of jumping. The expansion is relative to a jump instruction.
6521 The default value is 8.
6523 @item max-goto-duplication-insns
6524 The maximum number of instructions to duplicate to a block that jumps
6525 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
6526 passes, GCC factors computed gotos early in the compilation process,
6527 and unfactors them as late as possible. Only computed jumps at the
6528 end of a basic blocks with no more than max-goto-duplication-insns are
6529 unfactored. The default value is 8.
6531 @item max-delay-slot-insn-search
6532 The maximum number of instructions to consider when looking for an
6533 instruction to fill a delay slot. If more than this arbitrary number of
6534 instructions is searched, the time savings from filling the delay slot
6535 will be minimal so stop searching. Increasing values mean more
6536 aggressive optimization, making the compile time increase with probably
6537 small improvement in executable run time.
6539 @item max-delay-slot-live-search
6540 When trying to fill delay slots, the maximum number of instructions to
6541 consider when searching for a block with valid live register
6542 information. Increasing this arbitrarily chosen value means more
6543 aggressive optimization, increasing the compile time. This parameter
6544 should be removed when the delay slot code is rewritten to maintain the
6547 @item max-gcse-memory
6548 The approximate maximum amount of memory that will be allocated in
6549 order to perform the global common subexpression elimination
6550 optimization. If more memory than specified is required, the
6551 optimization will not be done.
6553 @item max-gcse-passes
6554 The maximum number of passes of GCSE to run. The default is 1.
6556 @item max-pending-list-length
6557 The maximum number of pending dependencies scheduling will allow
6558 before flushing the current state and starting over. Large functions
6559 with few branches or calls can create excessively large lists which
6560 needlessly consume memory and resources.
6562 @item max-inline-insns-single
6563 Several parameters control the tree inliner used in gcc.
6564 This number sets the maximum number of instructions (counted in GCC's
6565 internal representation) in a single function that the tree inliner
6566 will consider for inlining. This only affects functions declared
6567 inline and methods implemented in a class declaration (C++).
6568 The default value is 450.
6570 @item max-inline-insns-auto
6571 When you use @option{-finline-functions} (included in @option{-O3}),
6572 a lot of functions that would otherwise not be considered for inlining
6573 by the compiler will be investigated. To those functions, a different
6574 (more restrictive) limit compared to functions declared inline can
6576 The default value is 90.
6578 @item large-function-insns
6579 The limit specifying really large functions. For functions larger than this
6580 limit after inlining inlining is constrained by
6581 @option{--param large-function-growth}. This parameter is useful primarily
6582 to avoid extreme compilation time caused by non-linear algorithms used by the
6584 This parameter is ignored when @option{-funit-at-a-time} is not used.
6585 The default value is 2700.
6587 @item large-function-growth
6588 Specifies maximal growth of large function caused by inlining in percents.
6589 This parameter is ignored when @option{-funit-at-a-time} is not used.
6590 The default value is 100 which limits large function growth to 2.0 times
6593 @item large-unit-insns
6594 The limit specifying large translation unit. Growth caused by inlining of
6595 units larger than this limit is limited by @option{--param inline-unit-growth}.
6596 For small units this might be too tight (consider unit consisting of function A
6597 that is inline and B that just calls A three time. If B is small relative to
6598 A, the growth of unit is 300\% and yet such inlining is very sane. For very
6599 large units consisting of small inlininable functions however the overall unit
6600 growth limit is needed to avoid exponential explosion of code size. Thus for
6601 smaller units, the size is increased to @option{--param large-unit-insns}
6602 before applying @option{--param inline-unit-growth}. The default is 10000
6604 @item inline-unit-growth
6605 Specifies maximal overall growth of the compilation unit caused by inlining.
6606 This parameter is ignored when @option{-funit-at-a-time} is not used.
6607 The default value is 30 which limits unit growth to 1.3 times the original
6610 @item large-stack-frame
6611 The limit specifying large stack frames. While inlining the algorithm is trying
6612 to not grow past this limit too much. Default value is 256 bytes.
6614 @item large-stack-frame-growth
6615 Specifies maximal growth of large stack frames caused by inlining in percents.
6616 The default value is 1000 which limits large stack frame growth to 11 times
6619 @item max-inline-insns-recursive
6620 @itemx max-inline-insns-recursive-auto
6621 Specifies maximum number of instructions out-of-line copy of self recursive inline
6622 function can grow into by performing recursive inlining.
6624 For functions declared inline @option{--param max-inline-insns-recursive} is
6625 taken into account. For function not declared inline, recursive inlining
6626 happens only when @option{-finline-functions} (included in @option{-O3}) is
6627 enabled and @option{--param max-inline-insns-recursive-auto} is used. The
6628 default value is 450.
6630 @item max-inline-recursive-depth
6631 @itemx max-inline-recursive-depth-auto
6632 Specifies maximum recursion depth used by the recursive inlining.
6634 For functions declared inline @option{--param max-inline-recursive-depth} is
6635 taken into account. For function not declared inline, recursive inlining
6636 happens only when @option{-finline-functions} (included in @option{-O3}) is
6637 enabled and @option{--param max-inline-recursive-depth-auto} is used. The
6638 default value is 450.
6640 @item min-inline-recursive-probability
6641 Recursive inlining is profitable only for function having deep recursion
6642 in average and can hurt for function having little recursion depth by
6643 increasing the prologue size or complexity of function body to other
6646 When profile feedback is available (see @option{-fprofile-generate}) the actual
6647 recursion depth can be guessed from probability that function will recurse via
6648 given call expression. This parameter limits inlining only to call expression
6649 whose probability exceeds given threshold (in percents). The default value is
6652 @item inline-call-cost
6653 Specify cost of call instruction relative to simple arithmetics operations
6654 (having cost of 1). Increasing this cost disqualifies inlining of non-leaf
6655 functions and at the same time increases size of leaf function that is believed to
6656 reduce function size by being inlined. In effect it increases amount of
6657 inlining for code having large abstraction penalty (many functions that just
6658 pass the arguments to other functions) and decrease inlining for code with low
6659 abstraction penalty. The default value is 16.
6661 @item min-vect-loop-bound
6662 The minimum number of iterations under which a loop will not get vectorized
6663 when @option{-ftree-vectorize} is used. The number of iterations after
6664 vectorization needs to be greater than the value specified by this option
6665 to allow vectorization. The default value is 0.
6667 @item max-unrolled-insns
6668 The maximum number of instructions that a loop should have if that loop
6669 is unrolled, and if the loop is unrolled, it determines how many times
6670 the loop code is unrolled.
6672 @item max-average-unrolled-insns
6673 The maximum number of instructions biased by probabilities of their execution
6674 that a loop should have if that loop is unrolled, and if the loop is unrolled,
6675 it determines how many times the loop code is unrolled.
6677 @item max-unroll-times
6678 The maximum number of unrollings of a single loop.
6680 @item max-peeled-insns
6681 The maximum number of instructions that a loop should have if that loop
6682 is peeled, and if the loop is peeled, it determines how many times
6683 the loop code is peeled.
6685 @item max-peel-times
6686 The maximum number of peelings of a single loop.
6688 @item max-completely-peeled-insns
6689 The maximum number of insns of a completely peeled loop.
6691 @item max-completely-peel-times
6692 The maximum number of iterations of a loop to be suitable for complete peeling.
6694 @item max-unswitch-insns
6695 The maximum number of insns of an unswitched loop.
6697 @item max-unswitch-level
6698 The maximum number of branches unswitched in a single loop.
6701 The minimum cost of an expensive expression in the loop invariant motion.
6703 @item iv-consider-all-candidates-bound
6704 Bound on number of candidates for induction variables below that
6705 all candidates are considered for each use in induction variable
6706 optimizations. Only the most relevant candidates are considered
6707 if there are more candidates, to avoid quadratic time complexity.
6709 @item iv-max-considered-uses
6710 The induction variable optimizations give up on loops that contain more
6711 induction variable uses.
6713 @item iv-always-prune-cand-set-bound
6714 If number of candidates in the set is smaller than this value,
6715 we always try to remove unnecessary ivs from the set during its
6716 optimization when a new iv is added to the set.
6718 @item scev-max-expr-size
6719 Bound on size of expressions used in the scalar evolutions analyzer.
6720 Large expressions slow the analyzer.
6722 @item omega-max-vars
6723 The maximum number of variables in an Omega constraint system.
6724 The default value is 128.
6726 @item omega-max-geqs
6727 The maximum number of inequalities in an Omega constraint system.
6728 The default value is 256.
6731 The maximum number of equalities in an Omega constraint system.
6732 The default value is 128.
6734 @item omega-max-wild-cards
6735 The maximum number of wildcard variables that the Omega solver will
6736 be able to insert. The default value is 18.
6738 @item omega-hash-table-size
6739 The size of the hash table in the Omega solver. The default value is
6742 @item omega-max-keys
6743 The maximal number of keys used by the Omega solver. The default
6746 @item omega-eliminate-redundant-constraints
6747 When set to 1, use expensive methods to eliminate all redundant
6748 constraints. The default value is 0.
6750 @item vect-max-version-for-alignment-checks
6751 The maximum number of runtime checks that can be performed when
6752 doing loop versioning for alignment in the vectorizer. See option
6753 ftree-vect-loop-version for more information.
6755 @item vect-max-version-for-alias-checks
6756 The maximum number of runtime checks that can be performed when
6757 doing loop versioning for alias in the vectorizer. See option
6758 ftree-vect-loop-version for more information.
6760 @item max-iterations-to-track
6762 The maximum number of iterations of a loop the brute force algorithm
6763 for analysis of # of iterations of the loop tries to evaluate.
6765 @item hot-bb-count-fraction
6766 Select fraction of the maximal count of repetitions of basic block in program
6767 given basic block needs to have to be considered hot.
6769 @item hot-bb-frequency-fraction
6770 Select fraction of the maximal frequency of executions of basic block in
6771 function given basic block needs to have to be considered hot
6773 @item max-predicted-iterations
6774 The maximum number of loop iterations we predict statically. This is useful
6775 in cases where function contain single loop with known bound and other loop
6776 with unknown. We predict the known number of iterations correctly, while
6777 the unknown number of iterations average to roughly 10. This means that the
6778 loop without bounds would appear artificially cold relative to the other one.
6780 @item tracer-dynamic-coverage
6781 @itemx tracer-dynamic-coverage-feedback
6783 This value is used to limit superblock formation once the given percentage of
6784 executed instructions is covered. This limits unnecessary code size
6787 The @option{tracer-dynamic-coverage-feedback} is used only when profile
6788 feedback is available. The real profiles (as opposed to statically estimated
6789 ones) are much less balanced allowing the threshold to be larger value.
6791 @item tracer-max-code-growth
6792 Stop tail duplication once code growth has reached given percentage. This is
6793 rather hokey argument, as most of the duplicates will be eliminated later in
6794 cross jumping, so it may be set to much higher values than is the desired code
6797 @item tracer-min-branch-ratio
6799 Stop reverse growth when the reverse probability of best edge is less than this
6800 threshold (in percent).
6802 @item tracer-min-branch-ratio
6803 @itemx tracer-min-branch-ratio-feedback
6805 Stop forward growth if the best edge do have probability lower than this
6808 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
6809 compilation for profile feedback and one for compilation without. The value
6810 for compilation with profile feedback needs to be more conservative (higher) in
6811 order to make tracer effective.
6813 @item max-cse-path-length
6815 Maximum number of basic blocks on path that cse considers. The default is 10.
6818 The maximum instructions CSE process before flushing. The default is 1000.
6820 @item max-aliased-vops
6822 Maximum number of virtual operands per function allowed to represent
6823 aliases before triggering the alias partitioning heuristic. Alias
6824 partitioning reduces compile times and memory consumption needed for
6825 aliasing at the expense of precision loss in alias information. The
6826 default value for this parameter is 100 for -O1, 500 for -O2 and 1000
6829 Notice that if a function contains more memory statements than the
6830 value of this parameter, it is not really possible to achieve this
6831 reduction. In this case, the compiler will use the number of memory
6832 statements as the value for @option{max-aliased-vops}.
6834 @item avg-aliased-vops
6836 Average number of virtual operands per statement allowed to represent
6837 aliases before triggering the alias partitioning heuristic. This
6838 works in conjunction with @option{max-aliased-vops}. If a function
6839 contains more than @option{max-aliased-vops} virtual operators, then
6840 memory symbols will be grouped into memory partitions until either the
6841 total number of virtual operators is below @option{max-aliased-vops}
6842 or the average number of virtual operators per memory statement is
6843 below @option{avg-aliased-vops}. The default value for this parameter
6844 is 1 for -O1 and -O2, and 3 for -O3.
6846 @item ggc-min-expand
6848 GCC uses a garbage collector to manage its own memory allocation. This
6849 parameter specifies the minimum percentage by which the garbage
6850 collector's heap should be allowed to expand between collections.
6851 Tuning this may improve compilation speed; it has no effect on code
6854 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
6855 RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is
6856 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
6857 GCC is not able to calculate RAM on a particular platform, the lower
6858 bound of 30% is used. Setting this parameter and
6859 @option{ggc-min-heapsize} to zero causes a full collection to occur at
6860 every opportunity. This is extremely slow, but can be useful for
6863 @item ggc-min-heapsize
6865 Minimum size of the garbage collector's heap before it begins bothering
6866 to collect garbage. The first collection occurs after the heap expands
6867 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
6868 tuning this may improve compilation speed, and has no effect on code
6871 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
6872 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
6873 with a lower bound of 4096 (four megabytes) and an upper bound of
6874 131072 (128 megabytes). If GCC is not able to calculate RAM on a
6875 particular platform, the lower bound is used. Setting this parameter
6876 very large effectively disables garbage collection. Setting this
6877 parameter and @option{ggc-min-expand} to zero causes a full collection
6878 to occur at every opportunity.
6880 @item max-reload-search-insns
6881 The maximum number of instruction reload should look backward for equivalent
6882 register. Increasing values mean more aggressive optimization, making the
6883 compile time increase with probably slightly better performance. The default
6886 @item max-cselib-memory-locations
6887 The maximum number of memory locations cselib should take into account.
6888 Increasing values mean more aggressive optimization, making the compile time
6889 increase with probably slightly better performance. The default value is 500.
6891 @item max-flow-memory-locations
6892 Similar as @option{max-cselib-memory-locations} but for dataflow liveness.
6893 The default value is 100.
6895 @item reorder-blocks-duplicate
6896 @itemx reorder-blocks-duplicate-feedback
6898 Used by basic block reordering pass to decide whether to use unconditional
6899 branch or duplicate the code on its destination. Code is duplicated when its
6900 estimated size is smaller than this value multiplied by the estimated size of
6901 unconditional jump in the hot spots of the program.
6903 The @option{reorder-block-duplicate-feedback} is used only when profile
6904 feedback is available and may be set to higher values than
6905 @option{reorder-block-duplicate} since information about the hot spots is more
6908 @item max-sched-ready-insns
6909 The maximum number of instructions ready to be issued the scheduler should
6910 consider at any given time during the first scheduling pass. Increasing
6911 values mean more thorough searches, making the compilation time increase
6912 with probably little benefit. The default value is 100.
6914 @item max-sched-region-blocks
6915 The maximum number of blocks in a region to be considered for
6916 interblock scheduling. The default value is 10.
6918 @item max-sched-region-insns
6919 The maximum number of insns in a region to be considered for
6920 interblock scheduling. The default value is 100.
6923 The minimum probability (in percents) of reaching a source block
6924 for interblock speculative scheduling. The default value is 40.
6926 @item max-sched-extend-regions-iters
6927 The maximum number of iterations through CFG to extend regions.
6928 0 - disable region extension,
6929 N - do at most N iterations.
6930 The default value is 0.
6932 @item max-sched-insn-conflict-delay
6933 The maximum conflict delay for an insn to be considered for speculative motion.
6934 The default value is 3.
6936 @item sched-spec-prob-cutoff
6937 The minimal probability of speculation success (in percents), so that
6938 speculative insn will be scheduled.
6939 The default value is 40.
6941 @item max-last-value-rtl
6943 The maximum size measured as number of RTLs that can be recorded in an expression
6944 in combiner for a pseudo register as last known value of that register. The default
6947 @item integer-share-limit
6948 Small integer constants can use a shared data structure, reducing the
6949 compiler's memory usage and increasing its speed. This sets the maximum
6950 value of a shared integer constant's. The default value is 256.
6952 @item min-virtual-mappings
6953 Specifies the minimum number of virtual mappings in the incremental
6954 SSA updater that should be registered to trigger the virtual mappings
6955 heuristic defined by virtual-mappings-ratio. The default value is
6958 @item virtual-mappings-ratio
6959 If the number of virtual mappings is virtual-mappings-ratio bigger
6960 than the number of virtual symbols to be updated, then the incremental
6961 SSA updater switches to a full update for those symbols. The default
6964 @item ssp-buffer-size
6965 The minimum size of buffers (i.e. arrays) that will receive stack smashing
6966 protection when @option{-fstack-protection} is used.
6968 @item max-jump-thread-duplication-stmts
6969 Maximum number of statements allowed in a block that needs to be
6970 duplicated when threading jumps.
6972 @item max-fields-for-field-sensitive
6973 Maximum number of fields in a structure we will treat in
6974 a field sensitive manner during pointer analysis.
6976 @item prefetch-latency
6977 Estimate on average number of instructions that are executed before
6978 prefetch finishes. The distance we prefetch ahead is proportional
6979 to this constant. Increasing this number may also lead to less
6980 streams being prefetched (see @option{simultaneous-prefetches}).
6982 @item simultaneous-prefetches
6983 Maximum number of prefetches that can run at the same time.
6985 @item l1-cache-line-size
6986 The size of cache line in L1 cache, in bytes.
6989 The size of L1 cache, in kilobytes.
6992 The size of L2 cache, in kilobytes.
6994 @item use-canonical-types
6995 Whether the compiler should use the ``canonical'' type system. By
6996 default, this should always be 1, which uses a more efficient internal
6997 mechanism for comparing types in C++ and Objective-C++. However, if
6998 bugs in the canonical type system are causing compilation failures,
6999 set this value to 0 to disable canonical types.
7004 @node Preprocessor Options
7005 @section Options Controlling the Preprocessor
7006 @cindex preprocessor options
7007 @cindex options, preprocessor
7009 These options control the C preprocessor, which is run on each C source
7010 file before actual compilation.
7012 If you use the @option{-E} option, nothing is done except preprocessing.
7013 Some of these options make sense only together with @option{-E} because
7014 they cause the preprocessor output to be unsuitable for actual
7019 You can use @option{-Wp,@var{option}} to bypass the compiler driver
7020 and pass @var{option} directly through to the preprocessor. If
7021 @var{option} contains commas, it is split into multiple options at the
7022 commas. However, many options are modified, translated or interpreted
7023 by the compiler driver before being passed to the preprocessor, and
7024 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
7025 interface is undocumented and subject to change, so whenever possible
7026 you should avoid using @option{-Wp} and let the driver handle the
7029 @item -Xpreprocessor @var{option}
7030 @opindex preprocessor
7031 Pass @var{option} as an option to the preprocessor. You can use this to
7032 supply system-specific preprocessor options which GCC does not know how to
7035 If you want to pass an option that takes an argument, you must use
7036 @option{-Xpreprocessor} twice, once for the option and once for the argument.
7039 @include cppopts.texi
7041 @node Assembler Options
7042 @section Passing Options to the Assembler
7044 @c prevent bad page break with this line
7045 You can pass options to the assembler.
7048 @item -Wa,@var{option}
7050 Pass @var{option} as an option to the assembler. If @var{option}
7051 contains commas, it is split into multiple options at the commas.
7053 @item -Xassembler @var{option}
7055 Pass @var{option} as an option to the assembler. You can use this to
7056 supply system-specific assembler options which GCC does not know how to
7059 If you want to pass an option that takes an argument, you must use
7060 @option{-Xassembler} twice, once for the option and once for the argument.
7065 @section Options for Linking
7066 @cindex link options
7067 @cindex options, linking
7069 These options come into play when the compiler links object files into
7070 an executable output file. They are meaningless if the compiler is
7071 not doing a link step.
7075 @item @var{object-file-name}
7076 A file name that does not end in a special recognized suffix is
7077 considered to name an object file or library. (Object files are
7078 distinguished from libraries by the linker according to the file
7079 contents.) If linking is done, these object files are used as input
7088 If any of these options is used, then the linker is not run, and
7089 object file names should not be used as arguments. @xref{Overall
7093 @item -l@var{library}
7094 @itemx -l @var{library}
7096 Search the library named @var{library} when linking. (The second
7097 alternative with the library as a separate argument is only for
7098 POSIX compliance and is not recommended.)
7100 It makes a difference where in the command you write this option; the
7101 linker searches and processes libraries and object files in the order they
7102 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
7103 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
7104 to functions in @samp{z}, those functions may not be loaded.
7106 The linker searches a standard list of directories for the library,
7107 which is actually a file named @file{lib@var{library}.a}. The linker
7108 then uses this file as if it had been specified precisely by name.
7110 The directories searched include several standard system directories
7111 plus any that you specify with @option{-L}.
7113 Normally the files found this way are library files---archive files
7114 whose members are object files. The linker handles an archive file by
7115 scanning through it for members which define symbols that have so far
7116 been referenced but not defined. But if the file that is found is an
7117 ordinary object file, it is linked in the usual fashion. The only
7118 difference between using an @option{-l} option and specifying a file name
7119 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
7120 and searches several directories.
7124 You need this special case of the @option{-l} option in order to
7125 link an Objective-C or Objective-C++ program.
7128 @opindex nostartfiles
7129 Do not use the standard system startup files when linking.
7130 The standard system libraries are used normally, unless @option{-nostdlib}
7131 or @option{-nodefaultlibs} is used.
7133 @item -nodefaultlibs
7134 @opindex nodefaultlibs
7135 Do not use the standard system libraries when linking.
7136 Only the libraries you specify will be passed to the linker.
7137 The standard startup files are used normally, unless @option{-nostartfiles}
7138 is used. The compiler may generate calls to @code{memcmp},
7139 @code{memset}, @code{memcpy} and @code{memmove}.
7140 These entries are usually resolved by entries in
7141 libc. These entry points should be supplied through some other
7142 mechanism when this option is specified.
7146 Do not use the standard system startup files or libraries when linking.
7147 No startup files and only the libraries you specify will be passed to
7148 the linker. The compiler may generate calls to @code{memcmp}, @code{memset},
7149 @code{memcpy} and @code{memmove}.
7150 These entries are usually resolved by entries in
7151 libc. These entry points should be supplied through some other
7152 mechanism when this option is specified.
7154 @cindex @option{-lgcc}, use with @option{-nostdlib}
7155 @cindex @option{-nostdlib} and unresolved references
7156 @cindex unresolved references and @option{-nostdlib}
7157 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
7158 @cindex @option{-nodefaultlibs} and unresolved references
7159 @cindex unresolved references and @option{-nodefaultlibs}
7160 One of the standard libraries bypassed by @option{-nostdlib} and
7161 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
7162 that GCC uses to overcome shortcomings of particular machines, or special
7163 needs for some languages.
7164 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
7165 Collection (GCC) Internals},
7166 for more discussion of @file{libgcc.a}.)
7167 In most cases, you need @file{libgcc.a} even when you want to avoid
7168 other standard libraries. In other words, when you specify @option{-nostdlib}
7169 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
7170 This ensures that you have no unresolved references to internal GCC
7171 library subroutines. (For example, @samp{__main}, used to ensure C++
7172 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
7173 GNU Compiler Collection (GCC) Internals}.)
7177 Produce a position independent executable on targets which support it.
7178 For predictable results, you must also specify the same set of options
7179 that were used to generate code (@option{-fpie}, @option{-fPIE},
7180 or model suboptions) when you specify this option.
7184 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
7185 that support it. This instructs the linker to add all symbols, not
7186 only used ones, to the dynamic symbol table. This option is needed
7187 for some uses of @code{dlopen} or to allow obtaining backtraces
7188 from within a program.
7192 Remove all symbol table and relocation information from the executable.
7196 On systems that support dynamic linking, this prevents linking with the shared
7197 libraries. On other systems, this option has no effect.
7201 Produce a shared object which can then be linked with other objects to
7202 form an executable. Not all systems support this option. For predictable
7203 results, you must also specify the same set of options that were used to
7204 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
7205 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
7206 needs to build supplementary stub code for constructors to work. On
7207 multi-libbed systems, @samp{gcc -shared} must select the correct support
7208 libraries to link against. Failing to supply the correct flags may lead
7209 to subtle defects. Supplying them in cases where they are not necessary
7212 @item -shared-libgcc
7213 @itemx -static-libgcc
7214 @opindex shared-libgcc
7215 @opindex static-libgcc
7216 On systems that provide @file{libgcc} as a shared library, these options
7217 force the use of either the shared or static version respectively.
7218 If no shared version of @file{libgcc} was built when the compiler was
7219 configured, these options have no effect.
7221 There are several situations in which an application should use the
7222 shared @file{libgcc} instead of the static version. The most common
7223 of these is when the application wishes to throw and catch exceptions
7224 across different shared libraries. In that case, each of the libraries
7225 as well as the application itself should use the shared @file{libgcc}.
7227 Therefore, the G++ and GCJ drivers automatically add
7228 @option{-shared-libgcc} whenever you build a shared library or a main
7229 executable, because C++ and Java programs typically use exceptions, so
7230 this is the right thing to do.
7232 If, instead, you use the GCC driver to create shared libraries, you may
7233 find that they will not always be linked with the shared @file{libgcc}.
7234 If GCC finds, at its configuration time, that you have a non-GNU linker
7235 or a GNU linker that does not support option @option{--eh-frame-hdr},
7236 it will link the shared version of @file{libgcc} into shared libraries
7237 by default. Otherwise, it will take advantage of the linker and optimize
7238 away the linking with the shared version of @file{libgcc}, linking with
7239 the static version of libgcc by default. This allows exceptions to
7240 propagate through such shared libraries, without incurring relocation
7241 costs at library load time.
7243 However, if a library or main executable is supposed to throw or catch
7244 exceptions, you must link it using the G++ or GCJ driver, as appropriate
7245 for the languages used in the program, or using the option
7246 @option{-shared-libgcc}, such that it is linked with the shared
7251 Bind references to global symbols when building a shared object. Warn
7252 about any unresolved references (unless overridden by the link editor
7253 option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
7256 @item -Xlinker @var{option}
7258 Pass @var{option} as an option to the linker. You can use this to
7259 supply system-specific linker options which GCC does not know how to
7262 If you want to pass an option that takes an argument, you must use
7263 @option{-Xlinker} twice, once for the option and once for the argument.
7264 For example, to pass @option{-assert definitions}, you must write
7265 @samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
7266 @option{-Xlinker "-assert definitions"}, because this passes the entire
7267 string as a single argument, which is not what the linker expects.
7269 @item -Wl,@var{option}
7271 Pass @var{option} as an option to the linker. If @var{option} contains
7272 commas, it is split into multiple options at the commas.
7274 @item -u @var{symbol}
7276 Pretend the symbol @var{symbol} is undefined, to force linking of
7277 library modules to define it. You can use @option{-u} multiple times with
7278 different symbols to force loading of additional library modules.
7281 @node Directory Options
7282 @section Options for Directory Search
7283 @cindex directory options
7284 @cindex options, directory search
7287 These options specify directories to search for header files, for
7288 libraries and for parts of the compiler:
7293 Add the directory @var{dir} to the head of the list of directories to be
7294 searched for header files. This can be used to override a system header
7295 file, substituting your own version, since these directories are
7296 searched before the system header file directories. However, you should
7297 not use this option to add directories that contain vendor-supplied
7298 system header files (use @option{-isystem} for that). If you use more than
7299 one @option{-I} option, the directories are scanned in left-to-right
7300 order; the standard system directories come after.
7302 If a standard system include directory, or a directory specified with
7303 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
7304 option will be ignored. The directory will still be searched but as a
7305 system directory at its normal position in the system include chain.
7306 This is to ensure that GCC's procedure to fix buggy system headers and
7307 the ordering for the include_next directive are not inadvertently changed.
7308 If you really need to change the search order for system directories,
7309 use the @option{-nostdinc} and/or @option{-isystem} options.
7311 @item -iquote@var{dir}
7313 Add the directory @var{dir} to the head of the list of directories to
7314 be searched for header files only for the case of @samp{#include
7315 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
7316 otherwise just like @option{-I}.
7320 Add directory @var{dir} to the list of directories to be searched
7323 @item -B@var{prefix}
7325 This option specifies where to find the executables, libraries,
7326 include files, and data files of the compiler itself.
7328 The compiler driver program runs one or more of the subprograms
7329 @file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
7330 @var{prefix} as a prefix for each program it tries to run, both with and
7331 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
7333 For each subprogram to be run, the compiler driver first tries the
7334 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
7335 was not specified, the driver tries two standard prefixes, which are
7336 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
7337 those results in a file name that is found, the unmodified program
7338 name is searched for using the directories specified in your
7339 @env{PATH} environment variable.
7341 The compiler will check to see if the path provided by the @option{-B}
7342 refers to a directory, and if necessary it will add a directory
7343 separator character at the end of the path.
7345 @option{-B} prefixes that effectively specify directory names also apply
7346 to libraries in the linker, because the compiler translates these
7347 options into @option{-L} options for the linker. They also apply to
7348 includes files in the preprocessor, because the compiler translates these
7349 options into @option{-isystem} options for the preprocessor. In this case,
7350 the compiler appends @samp{include} to the prefix.
7352 The run-time support file @file{libgcc.a} can also be searched for using
7353 the @option{-B} prefix, if needed. If it is not found there, the two
7354 standard prefixes above are tried, and that is all. The file is left
7355 out of the link if it is not found by those means.
7357 Another way to specify a prefix much like the @option{-B} prefix is to use
7358 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
7361 As a special kludge, if the path provided by @option{-B} is
7362 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
7363 9, then it will be replaced by @file{[dir/]include}. This is to help
7364 with boot-strapping the compiler.
7366 @item -specs=@var{file}
7368 Process @var{file} after the compiler reads in the standard @file{specs}
7369 file, in order to override the defaults that the @file{gcc} driver
7370 program uses when determining what switches to pass to @file{cc1},
7371 @file{cc1plus}, @file{as}, @file{ld}, etc. More than one
7372 @option{-specs=@var{file}} can be specified on the command line, and they
7373 are processed in order, from left to right.
7375 @item --sysroot=@var{dir}
7377 Use @var{dir} as the logical root directory for headers and libraries.
7378 For example, if the compiler would normally search for headers in
7379 @file{/usr/include} and libraries in @file{/usr/lib}, it will instead
7380 search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
7382 If you use both this option and the @option{-isysroot} option, then
7383 the @option{--sysroot} option will apply to libraries, but the
7384 @option{-isysroot} option will apply to header files.
7386 The GNU linker (beginning with version 2.16) has the necessary support
7387 for this option. If your linker does not support this option, the
7388 header file aspect of @option{--sysroot} will still work, but the
7389 library aspect will not.
7393 This option has been deprecated. Please use @option{-iquote} instead for
7394 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
7395 Any directories you specify with @option{-I} options before the @option{-I-}
7396 option are searched only for the case of @samp{#include "@var{file}"};
7397 they are not searched for @samp{#include <@var{file}>}.
7399 If additional directories are specified with @option{-I} options after
7400 the @option{-I-}, these directories are searched for all @samp{#include}
7401 directives. (Ordinarily @emph{all} @option{-I} directories are used
7404 In addition, the @option{-I-} option inhibits the use of the current
7405 directory (where the current input file came from) as the first search
7406 directory for @samp{#include "@var{file}"}. There is no way to
7407 override this effect of @option{-I-}. With @option{-I.} you can specify
7408 searching the directory which was current when the compiler was
7409 invoked. That is not exactly the same as what the preprocessor does
7410 by default, but it is often satisfactory.
7412 @option{-I-} does not inhibit the use of the standard system directories
7413 for header files. Thus, @option{-I-} and @option{-nostdinc} are
7420 @section Specifying subprocesses and the switches to pass to them
7423 @command{gcc} is a driver program. It performs its job by invoking a
7424 sequence of other programs to do the work of compiling, assembling and
7425 linking. GCC interprets its command-line parameters and uses these to
7426 deduce which programs it should invoke, and which command-line options
7427 it ought to place on their command lines. This behavior is controlled
7428 by @dfn{spec strings}. In most cases there is one spec string for each
7429 program that GCC can invoke, but a few programs have multiple spec
7430 strings to control their behavior. The spec strings built into GCC can
7431 be overridden by using the @option{-specs=} command-line switch to specify
7434 @dfn{Spec files} are plaintext files that are used to construct spec
7435 strings. They consist of a sequence of directives separated by blank
7436 lines. The type of directive is determined by the first non-whitespace
7437 character on the line and it can be one of the following:
7440 @item %@var{command}
7441 Issues a @var{command} to the spec file processor. The commands that can
7445 @item %include <@var{file}>
7447 Search for @var{file} and insert its text at the current point in the
7450 @item %include_noerr <@var{file}>
7451 @cindex %include_noerr
7452 Just like @samp{%include}, but do not generate an error message if the include
7453 file cannot be found.
7455 @item %rename @var{old_name} @var{new_name}
7457 Rename the spec string @var{old_name} to @var{new_name}.
7461 @item *[@var{spec_name}]:
7462 This tells the compiler to create, override or delete the named spec
7463 string. All lines after this directive up to the next directive or
7464 blank line are considered to be the text for the spec string. If this
7465 results in an empty string then the spec will be deleted. (Or, if the
7466 spec did not exist, then nothing will happened.) Otherwise, if the spec
7467 does not currently exist a new spec will be created. If the spec does
7468 exist then its contents will be overridden by the text of this
7469 directive, unless the first character of that text is the @samp{+}
7470 character, in which case the text will be appended to the spec.
7472 @item [@var{suffix}]:
7473 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
7474 and up to the next directive or blank line are considered to make up the
7475 spec string for the indicated suffix. When the compiler encounters an
7476 input file with the named suffix, it will processes the spec string in
7477 order to work out how to compile that file. For example:
7484 This says that any input file whose name ends in @samp{.ZZ} should be
7485 passed to the program @samp{z-compile}, which should be invoked with the
7486 command-line switch @option{-input} and with the result of performing the
7487 @samp{%i} substitution. (See below.)
7489 As an alternative to providing a spec string, the text that follows a
7490 suffix directive can be one of the following:
7493 @item @@@var{language}
7494 This says that the suffix is an alias for a known @var{language}. This is
7495 similar to using the @option{-x} command-line switch to GCC to specify a
7496 language explicitly. For example:
7503 Says that .ZZ files are, in fact, C++ source files.
7506 This causes an error messages saying:
7509 @var{name} compiler not installed on this system.
7513 GCC already has an extensive list of suffixes built into it.
7514 This directive will add an entry to the end of the list of suffixes, but
7515 since the list is searched from the end backwards, it is effectively
7516 possible to override earlier entries using this technique.
7520 GCC has the following spec strings built into it. Spec files can
7521 override these strings or create their own. Note that individual
7522 targets can also add their own spec strings to this list.
7525 asm Options to pass to the assembler
7526 asm_final Options to pass to the assembler post-processor
7527 cpp Options to pass to the C preprocessor
7528 cc1 Options to pass to the C compiler
7529 cc1plus Options to pass to the C++ compiler
7530 endfile Object files to include at the end of the link
7531 link Options to pass to the linker
7532 lib Libraries to include on the command line to the linker
7533 libgcc Decides which GCC support library to pass to the linker
7534 linker Sets the name of the linker
7535 predefines Defines to be passed to the C preprocessor
7536 signed_char Defines to pass to CPP to say whether @code{char} is signed
7538 startfile Object files to include at the start of the link
7541 Here is a small example of a spec file:
7547 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
7550 This example renames the spec called @samp{lib} to @samp{old_lib} and
7551 then overrides the previous definition of @samp{lib} with a new one.
7552 The new definition adds in some extra command-line options before
7553 including the text of the old definition.
7555 @dfn{Spec strings} are a list of command-line options to be passed to their
7556 corresponding program. In addition, the spec strings can contain
7557 @samp{%}-prefixed sequences to substitute variable text or to
7558 conditionally insert text into the command line. Using these constructs
7559 it is possible to generate quite complex command lines.
7561 Here is a table of all defined @samp{%}-sequences for spec
7562 strings. Note that spaces are not generated automatically around the
7563 results of expanding these sequences. Therefore you can concatenate them
7564 together or combine them with constant text in a single argument.
7568 Substitute one @samp{%} into the program name or argument.
7571 Substitute the name of the input file being processed.
7574 Substitute the basename of the input file being processed.
7575 This is the substring up to (and not including) the last period
7576 and not including the directory.
7579 This is the same as @samp{%b}, but include the file suffix (text after
7583 Marks the argument containing or following the @samp{%d} as a
7584 temporary file name, so that that file will be deleted if GCC exits
7585 successfully. Unlike @samp{%g}, this contributes no text to the
7588 @item %g@var{suffix}
7589 Substitute a file name that has suffix @var{suffix} and is chosen
7590 once per compilation, and mark the argument in the same way as
7591 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
7592 name is now chosen in a way that is hard to predict even when previously
7593 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
7594 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
7595 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
7596 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
7597 was simply substituted with a file name chosen once per compilation,
7598 without regard to any appended suffix (which was therefore treated
7599 just like ordinary text), making such attacks more likely to succeed.
7601 @item %u@var{suffix}
7602 Like @samp{%g}, but generates a new temporary file name even if
7603 @samp{%u@var{suffix}} was already seen.
7605 @item %U@var{suffix}
7606 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
7607 new one if there is no such last file name. In the absence of any
7608 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
7609 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
7610 would involve the generation of two distinct file names, one
7611 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
7612 simply substituted with a file name chosen for the previous @samp{%u},
7613 without regard to any appended suffix.
7615 @item %j@var{suffix}
7616 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
7617 writable, and if save-temps is off; otherwise, substitute the name
7618 of a temporary file, just like @samp{%u}. This temporary file is not
7619 meant for communication between processes, but rather as a junk
7622 @item %|@var{suffix}
7623 @itemx %m@var{suffix}
7624 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
7625 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
7626 all. These are the two most common ways to instruct a program that it
7627 should read from standard input or write to standard output. If you
7628 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
7629 construct: see for example @file{f/lang-specs.h}.
7631 @item %.@var{SUFFIX}
7632 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
7633 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
7634 terminated by the next space or %.
7637 Marks the argument containing or following the @samp{%w} as the
7638 designated output file of this compilation. This puts the argument
7639 into the sequence of arguments that @samp{%o} will substitute later.
7642 Substitutes the names of all the output files, with spaces
7643 automatically placed around them. You should write spaces
7644 around the @samp{%o} as well or the results are undefined.
7645 @samp{%o} is for use in the specs for running the linker.
7646 Input files whose names have no recognized suffix are not compiled
7647 at all, but they are included among the output files, so they will
7651 Substitutes the suffix for object files. Note that this is
7652 handled specially when it immediately follows @samp{%g, %u, or %U},
7653 because of the need for those to form complete file names. The
7654 handling is such that @samp{%O} is treated exactly as if it had already
7655 been substituted, except that @samp{%g, %u, and %U} do not currently
7656 support additional @var{suffix} characters following @samp{%O} as they would
7657 following, for example, @samp{.o}.
7660 Substitutes the standard macro predefinitions for the
7661 current target machine. Use this when running @code{cpp}.
7664 Like @samp{%p}, but puts @samp{__} before and after the name of each
7665 predefined macro, except for macros that start with @samp{__} or with
7666 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
7670 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
7671 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
7672 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
7673 and @option{-imultilib} as necessary.
7676 Current argument is the name of a library or startup file of some sort.
7677 Search for that file in a standard list of directories and substitute
7678 the full name found.
7681 Print @var{str} as an error message. @var{str} is terminated by a newline.
7682 Use this when inconsistent options are detected.
7685 Substitute the contents of spec string @var{name} at this point.
7688 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
7690 @item %x@{@var{option}@}
7691 Accumulate an option for @samp{%X}.
7694 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
7698 Output the accumulated assembler options specified by @option{-Wa}.
7701 Output the accumulated preprocessor options specified by @option{-Wp}.
7704 Process the @code{asm} spec. This is used to compute the
7705 switches to be passed to the assembler.
7708 Process the @code{asm_final} spec. This is a spec string for
7709 passing switches to an assembler post-processor, if such a program is
7713 Process the @code{link} spec. This is the spec for computing the
7714 command line passed to the linker. Typically it will make use of the
7715 @samp{%L %G %S %D and %E} sequences.
7718 Dump out a @option{-L} option for each directory that GCC believes might
7719 contain startup files. If the target supports multilibs then the
7720 current multilib directory will be prepended to each of these paths.
7723 Process the @code{lib} spec. This is a spec string for deciding which
7724 libraries should be included on the command line to the linker.
7727 Process the @code{libgcc} spec. This is a spec string for deciding
7728 which GCC support library should be included on the command line to the linker.
7731 Process the @code{startfile} spec. This is a spec for deciding which
7732 object files should be the first ones passed to the linker. Typically
7733 this might be a file named @file{crt0.o}.
7736 Process the @code{endfile} spec. This is a spec string that specifies
7737 the last object files that will be passed to the linker.
7740 Process the @code{cpp} spec. This is used to construct the arguments
7741 to be passed to the C preprocessor.
7744 Process the @code{cc1} spec. This is used to construct the options to be
7745 passed to the actual C compiler (@samp{cc1}).
7748 Process the @code{cc1plus} spec. This is used to construct the options to be
7749 passed to the actual C++ compiler (@samp{cc1plus}).
7752 Substitute the variable part of a matched option. See below.
7753 Note that each comma in the substituted string is replaced by
7757 Remove all occurrences of @code{-S} from the command line. Note---this
7758 command is position dependent. @samp{%} commands in the spec string
7759 before this one will see @code{-S}, @samp{%} commands in the spec string
7760 after this one will not.
7762 @item %:@var{function}(@var{args})
7763 Call the named function @var{function}, passing it @var{args}.
7764 @var{args} is first processed as a nested spec string, then split
7765 into an argument vector in the usual fashion. The function returns
7766 a string which is processed as if it had appeared literally as part
7767 of the current spec.
7769 The following built-in spec functions are provided:
7773 The @code{getenv} spec function takes two arguments: an environment
7774 variable name and a string. If the environment variable is not
7775 defined, a fatal error is issued. Otherwise, the return value is the
7776 value of the environment variable concatenated with the string. For
7777 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
7780 %:getenv(TOPDIR /include)
7783 expands to @file{/path/to/top/include}.
7785 @item @code{if-exists}
7786 The @code{if-exists} spec function takes one argument, an absolute
7787 pathname to a file. If the file exists, @code{if-exists} returns the
7788 pathname. Here is a small example of its usage:
7792 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
7795 @item @code{if-exists-else}
7796 The @code{if-exists-else} spec function is similar to the @code{if-exists}
7797 spec function, except that it takes two arguments. The first argument is
7798 an absolute pathname to a file. If the file exists, @code{if-exists-else}
7799 returns the pathname. If it does not exist, it returns the second argument.
7800 This way, @code{if-exists-else} can be used to select one file or another,
7801 based on the existence of the first. Here is a small example of its usage:
7805 crt0%O%s %:if-exists(crti%O%s) \
7806 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
7809 @item @code{replace-outfile}
7810 The @code{replace-outfile} spec function takes two arguments. It looks for the
7811 first argument in the outfiles array and replaces it with the second argument. Here
7812 is a small example of its usage:
7815 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
7818 @item @code{print-asm-header}
7819 The @code{print-asm-header} function takes no arguments and simply
7820 prints a banner like:
7826 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
7829 It is used to separate compiler options from assembler options
7830 in the @option{--target-help} output.
7834 Substitutes the @code{-S} switch, if that switch was given to GCC@.
7835 If that switch was not specified, this substitutes nothing. Note that
7836 the leading dash is omitted when specifying this option, and it is
7837 automatically inserted if the substitution is performed. Thus the spec
7838 string @samp{%@{foo@}} would match the command-line option @option{-foo}
7839 and would output the command line option @option{-foo}.
7841 @item %W@{@code{S}@}
7842 Like %@{@code{S}@} but mark last argument supplied within as a file to be
7845 @item %@{@code{S}*@}
7846 Substitutes all the switches specified to GCC whose names start
7847 with @code{-S}, but which also take an argument. This is used for
7848 switches like @option{-o}, @option{-D}, @option{-I}, etc.
7849 GCC considers @option{-o foo} as being
7850 one switch whose names starts with @samp{o}. %@{o*@} would substitute this
7851 text, including the space. Thus two arguments would be generated.
7853 @item %@{@code{S}*&@code{T}*@}
7854 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
7855 (the order of @code{S} and @code{T} in the spec is not significant).
7856 There can be any number of ampersand-separated variables; for each the
7857 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
7859 @item %@{@code{S}:@code{X}@}
7860 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
7862 @item %@{!@code{S}:@code{X}@}
7863 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
7865 @item %@{@code{S}*:@code{X}@}
7866 Substitutes @code{X} if one or more switches whose names start with
7867 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
7868 once, no matter how many such switches appeared. However, if @code{%*}
7869 appears somewhere in @code{X}, then @code{X} will be substituted once
7870 for each matching switch, with the @code{%*} replaced by the part of
7871 that switch that matched the @code{*}.
7873 @item %@{.@code{S}:@code{X}@}
7874 Substitutes @code{X}, if processing a file with suffix @code{S}.
7876 @item %@{!.@code{S}:@code{X}@}
7877 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
7879 @item %@{,@code{S}:@code{X}@}
7880 Substitutes @code{X}, if processing a file for language @code{S}.
7882 @item %@{!,@code{S}:@code{X}@}
7883 Substitutes @code{X}, if not processing a file for language @code{S}.
7885 @item %@{@code{S}|@code{P}:@code{X}@}
7886 Substitutes @code{X} if either @code{-S} or @code{-P} was given to
7887 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
7888 @code{*} sequences as well, although they have a stronger binding than
7889 the @samp{|}. If @code{%*} appears in @code{X}, all of the
7890 alternatives must be starred, and only the first matching alternative
7893 For example, a spec string like this:
7896 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
7899 will output the following command-line options from the following input
7900 command-line options:
7905 -d fred.c -foo -baz -boggle
7906 -d jim.d -bar -baz -boggle
7909 @item %@{S:X; T:Y; :D@}
7911 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
7912 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
7913 be as many clauses as you need. This may be combined with @code{.},
7914 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
7919 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
7920 construct may contain other nested @samp{%} constructs or spaces, or
7921 even newlines. They are processed as usual, as described above.
7922 Trailing white space in @code{X} is ignored. White space may also
7923 appear anywhere on the left side of the colon in these constructs,
7924 except between @code{.} or @code{*} and the corresponding word.
7926 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
7927 handled specifically in these constructs. If another value of
7928 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
7929 @option{-W} switch is found later in the command line, the earlier
7930 switch value is ignored, except with @{@code{S}*@} where @code{S} is
7931 just one letter, which passes all matching options.
7933 The character @samp{|} at the beginning of the predicate text is used to
7934 indicate that a command should be piped to the following command, but
7935 only if @option{-pipe} is specified.
7937 It is built into GCC which switches take arguments and which do not.
7938 (You might think it would be useful to generalize this to allow each
7939 compiler's spec to say which switches take arguments. But this cannot
7940 be done in a consistent fashion. GCC cannot even decide which input
7941 files have been specified without knowing which switches take arguments,
7942 and it must know which input files to compile in order to tell which
7945 GCC also knows implicitly that arguments starting in @option{-l} are to be
7946 treated as compiler output files, and passed to the linker in their
7947 proper position among the other output files.
7949 @c man begin OPTIONS
7951 @node Target Options
7952 @section Specifying Target Machine and Compiler Version
7953 @cindex target options
7954 @cindex cross compiling
7955 @cindex specifying machine version
7956 @cindex specifying compiler version and target machine
7957 @cindex compiler version, specifying
7958 @cindex target machine, specifying
7960 The usual way to run GCC is to run the executable called @file{gcc}, or
7961 @file{<machine>-gcc} when cross-compiling, or
7962 @file{<machine>-gcc-<version>} to run a version other than the one that
7963 was installed last. Sometimes this is inconvenient, so GCC provides
7964 options that will switch to another cross-compiler or version.
7967 @item -b @var{machine}
7969 The argument @var{machine} specifies the target machine for compilation.
7971 The value to use for @var{machine} is the same as was specified as the
7972 machine type when configuring GCC as a cross-compiler. For
7973 example, if a cross-compiler was configured with @samp{configure
7974 arm-elf}, meaning to compile for an arm processor with elf binaries,
7975 then you would specify @option{-b arm-elf} to run that cross compiler.
7976 Because there are other options beginning with @option{-b}, the
7977 configuration must contain a hyphen.
7979 @item -V @var{version}
7981 The argument @var{version} specifies which version of GCC to run.
7982 This is useful when multiple versions are installed. For example,
7983 @var{version} might be @samp{4.0}, meaning to run GCC version 4.0.
7986 The @option{-V} and @option{-b} options work by running the
7987 @file{<machine>-gcc-<version>} executable, so there's no real reason to
7988 use them if you can just run that directly.
7990 @node Submodel Options
7991 @section Hardware Models and Configurations
7992 @cindex submodel options
7993 @cindex specifying hardware config
7994 @cindex hardware models and configurations, specifying
7995 @cindex machine dependent options
7997 Earlier we discussed the standard option @option{-b} which chooses among
7998 different installed compilers for completely different target
7999 machines, such as VAX vs.@: 68000 vs.@: 80386.
8001 In addition, each of these target machine types can have its own
8002 special options, starting with @samp{-m}, to choose among various
8003 hardware models or configurations---for example, 68010 vs 68020,
8004 floating coprocessor or none. A single installed version of the
8005 compiler can compile for any model or configuration, according to the
8008 Some configurations of the compiler also support additional special
8009 options, usually for compatibility with other compilers on the same
8012 @c This list is ordered alphanumerically by subsection name.
8013 @c It should be the same order and spelling as these options are listed
8014 @c in Machine Dependent Options
8020 * Blackfin Options::
8024 * DEC Alpha Options::
8025 * DEC Alpha/VMS Options::
8027 * GNU/Linux Options::
8030 * i386 and x86-64 Options::
8043 * RS/6000 and PowerPC Options::
8044 * S/390 and zSeries Options::
8049 * System V Options::
8050 * TMS320C3x/C4x Options::
8055 * Xstormy16 Options::
8061 @subsection ARC Options
8064 These options are defined for ARC implementations:
8069 Compile code for little endian mode. This is the default.
8073 Compile code for big endian mode.
8076 @opindex mmangle-cpu
8077 Prepend the name of the cpu to all public symbol names.
8078 In multiple-processor systems, there are many ARC variants with different
8079 instruction and register set characteristics. This flag prevents code
8080 compiled for one cpu to be linked with code compiled for another.
8081 No facility exists for handling variants that are ``almost identical''.
8082 This is an all or nothing option.
8084 @item -mcpu=@var{cpu}
8086 Compile code for ARC variant @var{cpu}.
8087 Which variants are supported depend on the configuration.
8088 All variants support @option{-mcpu=base}, this is the default.
8090 @item -mtext=@var{text-section}
8091 @itemx -mdata=@var{data-section}
8092 @itemx -mrodata=@var{readonly-data-section}
8096 Put functions, data, and readonly data in @var{text-section},
8097 @var{data-section}, and @var{readonly-data-section} respectively
8098 by default. This can be overridden with the @code{section} attribute.
8099 @xref{Variable Attributes}.
8104 @subsection ARM Options
8107 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
8111 @item -mabi=@var{name}
8113 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
8114 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
8117 @opindex mapcs-frame
8118 Generate a stack frame that is compliant with the ARM Procedure Call
8119 Standard for all functions, even if this is not strictly necessary for
8120 correct execution of the code. Specifying @option{-fomit-frame-pointer}
8121 with this option will cause the stack frames not to be generated for
8122 leaf functions. The default is @option{-mno-apcs-frame}.
8126 This is a synonym for @option{-mapcs-frame}.
8129 @c not currently implemented
8130 @item -mapcs-stack-check
8131 @opindex mapcs-stack-check
8132 Generate code to check the amount of stack space available upon entry to
8133 every function (that actually uses some stack space). If there is
8134 insufficient space available then either the function
8135 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
8136 called, depending upon the amount of stack space required. The run time
8137 system is required to provide these functions. The default is
8138 @option{-mno-apcs-stack-check}, since this produces smaller code.
8140 @c not currently implemented
8142 @opindex mapcs-float
8143 Pass floating point arguments using the float point registers. This is
8144 one of the variants of the APCS@. This option is recommended if the
8145 target hardware has a floating point unit or if a lot of floating point
8146 arithmetic is going to be performed by the code. The default is
8147 @option{-mno-apcs-float}, since integer only code is slightly increased in
8148 size if @option{-mapcs-float} is used.
8150 @c not currently implemented
8151 @item -mapcs-reentrant
8152 @opindex mapcs-reentrant
8153 Generate reentrant, position independent code. The default is
8154 @option{-mno-apcs-reentrant}.
8157 @item -mthumb-interwork
8158 @opindex mthumb-interwork
8159 Generate code which supports calling between the ARM and Thumb
8160 instruction sets. Without this option the two instruction sets cannot
8161 be reliably used inside one program. The default is
8162 @option{-mno-thumb-interwork}, since slightly larger code is generated
8163 when @option{-mthumb-interwork} is specified.
8165 @item -mno-sched-prolog
8166 @opindex mno-sched-prolog
8167 Prevent the reordering of instructions in the function prolog, or the
8168 merging of those instruction with the instructions in the function's
8169 body. This means that all functions will start with a recognizable set
8170 of instructions (or in fact one of a choice from a small set of
8171 different function prologues), and this information can be used to
8172 locate the start if functions inside an executable piece of code. The
8173 default is @option{-msched-prolog}.
8176 @opindex mhard-float
8177 Generate output containing floating point instructions. This is the
8181 @opindex msoft-float
8182 Generate output containing library calls for floating point.
8183 @strong{Warning:} the requisite libraries are not available for all ARM
8184 targets. Normally the facilities of the machine's usual C compiler are
8185 used, but this cannot be done directly in cross-compilation. You must make
8186 your own arrangements to provide suitable library functions for
8189 @option{-msoft-float} changes the calling convention in the output file;
8190 therefore, it is only useful if you compile @emph{all} of a program with
8191 this option. In particular, you need to compile @file{libgcc.a}, the
8192 library that comes with GCC, with @option{-msoft-float} in order for
8195 @item -mfloat-abi=@var{name}
8197 Specifies which ABI to use for floating point values. Permissible values
8198 are: @samp{soft}, @samp{softfp} and @samp{hard}.
8200 @samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
8201 and @option{-mhard-float} respectively. @samp{softfp} allows the generation
8202 of floating point instructions, but still uses the soft-float calling
8205 @item -mlittle-endian
8206 @opindex mlittle-endian
8207 Generate code for a processor running in little-endian mode. This is
8208 the default for all standard configurations.
8211 @opindex mbig-endian
8212 Generate code for a processor running in big-endian mode; the default is
8213 to compile code for a little-endian processor.
8215 @item -mwords-little-endian
8216 @opindex mwords-little-endian
8217 This option only applies when generating code for big-endian processors.
8218 Generate code for a little-endian word order but a big-endian byte
8219 order. That is, a byte order of the form @samp{32107654}. Note: this
8220 option should only be used if you require compatibility with code for
8221 big-endian ARM processors generated by versions of the compiler prior to
8224 @item -mcpu=@var{name}
8226 This specifies the name of the target ARM processor. GCC uses this name
8227 to determine what kind of instructions it can emit when generating
8228 assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
8229 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
8230 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
8231 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
8232 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
8233 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
8234 @samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
8235 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
8236 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
8237 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
8238 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
8239 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
8240 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
8241 @samp{arm1156t2-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
8242 @samp{cortex-a8}, @samp{cortex-r4}, @samp{cortex-m3},
8243 @samp{xscale}, @samp{iwmmxt}, @samp{ep9312}.
8245 @itemx -mtune=@var{name}
8247 This option is very similar to the @option{-mcpu=} option, except that
8248 instead of specifying the actual target processor type, and hence
8249 restricting which instructions can be used, it specifies that GCC should
8250 tune the performance of the code as if the target were of the type
8251 specified in this option, but still choosing the instructions that it
8252 will generate based on the cpu specified by a @option{-mcpu=} option.
8253 For some ARM implementations better performance can be obtained by using
8256 @item -march=@var{name}
8258 This specifies the name of the target ARM architecture. GCC uses this
8259 name to determine what kind of instructions it can emit when generating
8260 assembly code. This option can be used in conjunction with or instead
8261 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
8262 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
8263 @samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
8264 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv7}, @samp{armv7-a},
8265 @samp{armv7-r}, @samp{armv7-m}, @samp{iwmmxt}, @samp{ep9312}.
8267 @item -mfpu=@var{name}
8268 @itemx -mfpe=@var{number}
8269 @itemx -mfp=@var{number}
8273 This specifies what floating point hardware (or hardware emulation) is
8274 available on the target. Permissible names are: @samp{fpa}, @samp{fpe2},
8275 @samp{fpe3}, @samp{maverick}, @samp{vfp}. @option{-mfp} and @option{-mfpe}
8276 are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
8277 with older versions of GCC@.
8279 If @option{-msoft-float} is specified this specifies the format of
8280 floating point values.
8282 @item -mstructure-size-boundary=@var{n}
8283 @opindex mstructure-size-boundary
8284 The size of all structures and unions will be rounded up to a multiple
8285 of the number of bits set by this option. Permissible values are 8, 32
8286 and 64. The default value varies for different toolchains. For the COFF
8287 targeted toolchain the default value is 8. A value of 64 is only allowed
8288 if the underlying ABI supports it.
8290 Specifying the larger number can produce faster, more efficient code, but
8291 can also increase the size of the program. Different values are potentially
8292 incompatible. Code compiled with one value cannot necessarily expect to
8293 work with code or libraries compiled with another value, if they exchange
8294 information using structures or unions.
8296 @item -mabort-on-noreturn
8297 @opindex mabort-on-noreturn
8298 Generate a call to the function @code{abort} at the end of a
8299 @code{noreturn} function. It will be executed if the function tries to
8303 @itemx -mno-long-calls
8304 @opindex mlong-calls
8305 @opindex mno-long-calls
8306 Tells the compiler to perform function calls by first loading the
8307 address of the function into a register and then performing a subroutine
8308 call on this register. This switch is needed if the target function
8309 will lie outside of the 64 megabyte addressing range of the offset based
8310 version of subroutine call instruction.
8312 Even if this switch is enabled, not all function calls will be turned
8313 into long calls. The heuristic is that static functions, functions
8314 which have the @samp{short-call} attribute, functions that are inside
8315 the scope of a @samp{#pragma no_long_calls} directive and functions whose
8316 definitions have already been compiled within the current compilation
8317 unit, will not be turned into long calls. The exception to this rule is
8318 that weak function definitions, functions with the @samp{long-call}
8319 attribute or the @samp{section} attribute, and functions that are within
8320 the scope of a @samp{#pragma long_calls} directive, will always be
8321 turned into long calls.
8323 This feature is not enabled by default. Specifying
8324 @option{-mno-long-calls} will restore the default behavior, as will
8325 placing the function calls within the scope of a @samp{#pragma
8326 long_calls_off} directive. Note these switches have no effect on how
8327 the compiler generates code to handle function calls via function
8330 @item -mnop-fun-dllimport
8331 @opindex mnop-fun-dllimport
8332 Disable support for the @code{dllimport} attribute.
8334 @item -msingle-pic-base
8335 @opindex msingle-pic-base
8336 Treat the register used for PIC addressing as read-only, rather than
8337 loading it in the prologue for each function. The run-time system is
8338 responsible for initializing this register with an appropriate value
8339 before execution begins.
8341 @item -mpic-register=@var{reg}
8342 @opindex mpic-register
8343 Specify the register to be used for PIC addressing. The default is R10
8344 unless stack-checking is enabled, when R9 is used.
8346 @item -mcirrus-fix-invalid-insns
8347 @opindex mcirrus-fix-invalid-insns
8348 @opindex mno-cirrus-fix-invalid-insns
8349 Insert NOPs into the instruction stream to in order to work around
8350 problems with invalid Maverick instruction combinations. This option
8351 is only valid if the @option{-mcpu=ep9312} option has been used to
8352 enable generation of instructions for the Cirrus Maverick floating
8353 point co-processor. This option is not enabled by default, since the
8354 problem is only present in older Maverick implementations. The default
8355 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
8358 @item -mpoke-function-name
8359 @opindex mpoke-function-name
8360 Write the name of each function into the text section, directly
8361 preceding the function prologue. The generated code is similar to this:
8365 .ascii "arm_poke_function_name", 0
8368 .word 0xff000000 + (t1 - t0)
8369 arm_poke_function_name
8371 stmfd sp!, @{fp, ip, lr, pc@}
8375 When performing a stack backtrace, code can inspect the value of
8376 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
8377 location @code{pc - 12} and the top 8 bits are set, then we know that
8378 there is a function name embedded immediately preceding this location
8379 and has length @code{((pc[-3]) & 0xff000000)}.
8383 Generate code for the Thumb instruction set. The default is to
8384 use the 32-bit ARM instruction set.
8385 This option automatically enables either 16-bit Thumb-1 or
8386 mixed 16/32-bit Thumb-2 instructions based on the @option{-mcpu=@var{name}}
8387 and @option{-march=@var{name}} options.
8390 @opindex mtpcs-frame
8391 Generate a stack frame that is compliant with the Thumb Procedure Call
8392 Standard for all non-leaf functions. (A leaf function is one that does
8393 not call any other functions.) The default is @option{-mno-tpcs-frame}.
8395 @item -mtpcs-leaf-frame
8396 @opindex mtpcs-leaf-frame
8397 Generate a stack frame that is compliant with the Thumb Procedure Call
8398 Standard for all leaf functions. (A leaf function is one that does
8399 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
8401 @item -mcallee-super-interworking
8402 @opindex mcallee-super-interworking
8403 Gives all externally visible functions in the file being compiled an ARM
8404 instruction set header which switches to Thumb mode before executing the
8405 rest of the function. This allows these functions to be called from
8406 non-interworking code.
8408 @item -mcaller-super-interworking
8409 @opindex mcaller-super-interworking
8410 Allows calls via function pointers (including virtual functions) to
8411 execute correctly regardless of whether the target code has been
8412 compiled for interworking or not. There is a small overhead in the cost
8413 of executing a function pointer if this option is enabled.
8415 @item -mtp=@var{name}
8417 Specify the access model for the thread local storage pointer. The valid
8418 models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
8419 @option{cp15}, which fetches the thread pointer from @code{cp15} directly
8420 (supported in the arm6k architecture), and @option{auto}, which uses the
8421 best available method for the selected processor. The default setting is
8427 @subsection AVR Options
8430 These options are defined for AVR implementations:
8433 @item -mmcu=@var{mcu}
8435 Specify ATMEL AVR instruction set or MCU type.
8437 Instruction set avr1 is for the minimal AVR core, not supported by the C
8438 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
8439 attiny11, attiny12, attiny15, attiny28).
8441 Instruction set avr2 (default) is for the classic AVR core with up to
8442 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
8443 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
8444 at90c8534, at90s8535).
8446 Instruction set avr3 is for the classic AVR core with up to 128K program
8447 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
8449 Instruction set avr4 is for the enhanced AVR core with up to 8K program
8450 memory space (MCU types: atmega8, atmega83, atmega85).
8452 Instruction set avr5 is for the enhanced AVR core with up to 128K program
8453 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
8454 atmega64, atmega128, at43usb355, at94k).
8458 Output instruction sizes to the asm file.
8460 @item -minit-stack=@var{N}
8461 @opindex minit-stack
8462 Specify the initial stack address, which may be a symbol or numeric value,
8463 @samp{__stack} is the default.
8465 @item -mno-interrupts
8466 @opindex mno-interrupts
8467 Generated code is not compatible with hardware interrupts.
8468 Code size will be smaller.
8470 @item -mcall-prologues
8471 @opindex mcall-prologues
8472 Functions prologues/epilogues expanded as call to appropriate
8473 subroutines. Code size will be smaller.
8475 @item -mno-tablejump
8476 @opindex mno-tablejump
8477 Do not generate tablejump insns which sometimes increase code size.
8480 @opindex mtiny-stack
8481 Change only the low 8 bits of the stack pointer.
8485 Assume int to be 8 bit integer. This affects the sizes of all types: A
8486 char will be 1 byte, an int will be 1 byte, an long will be 2 bytes
8487 and long long will be 4 bytes. Please note that this option does not
8488 comply to the C standards, but it will provide you with smaller code
8492 @node Blackfin Options
8493 @subsection Blackfin Options
8494 @cindex Blackfin Options
8497 @item -mcpu=@var{cpu}
8499 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
8500 can be one of @samp{bf531}, @samp{bf532}, @samp{bf533},
8501 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf561}.
8502 Without this option, @samp{bf532} is used as the processor by default.
8503 The corresponding predefined processor macros for @var{cpu} is to
8504 be defined. For the @samp{bfin-elf} toolchain, this causes the hardware
8505 BSP provided by libgloss to be linked in if @samp{-msim} is not given.
8506 Support for @samp{bf561} is incomplete; only the processor macro is defined.
8510 Specifies that the program will be run on the simulator. This causes
8511 the simulator BSP provided by libgloss to be linked in. This option
8512 has effect only for @samp{bfin-elf} toolchain.
8514 @item -momit-leaf-frame-pointer
8515 @opindex momit-leaf-frame-pointer
8516 Don't keep the frame pointer in a register for leaf functions. This
8517 avoids the instructions to save, set up and restore frame pointers and
8518 makes an extra register available in leaf functions. The option
8519 @option{-fomit-frame-pointer} removes the frame pointer for all functions
8520 which might make debugging harder.
8522 @item -mspecld-anomaly
8523 @opindex mspecld-anomaly
8524 When enabled, the compiler will ensure that the generated code does not
8525 contain speculative loads after jump instructions. This option is enabled
8528 @item -mno-specld-anomaly
8529 @opindex mno-specld-anomaly
8530 Don't generate extra code to prevent speculative loads from occurring.
8532 @item -mcsync-anomaly
8533 @opindex mcsync-anomaly
8534 When enabled, the compiler will ensure that the generated code does not
8535 contain CSYNC or SSYNC instructions too soon after conditional branches.
8536 This option is enabled by default.
8538 @item -mno-csync-anomaly
8539 @opindex mno-csync-anomaly
8540 Don't generate extra code to prevent CSYNC or SSYNC instructions from
8541 occurring too soon after a conditional branch.
8545 When enabled, the compiler is free to take advantage of the knowledge that
8546 the entire program fits into the low 64k of memory.
8549 @opindex mno-low-64k
8550 Assume that the program is arbitrarily large. This is the default.
8552 @item -mstack-check-l1
8553 @opindex mstack-check-l1
8554 Do stack checking using information placed into L1 scratchpad memory by the
8557 @item -mid-shared-library
8558 @opindex mid-shared-library
8559 Generate code that supports shared libraries via the library ID method.
8560 This allows for execute in place and shared libraries in an environment
8561 without virtual memory management. This option implies @option{-fPIC}.
8563 @item -mno-id-shared-library
8564 @opindex mno-id-shared-library
8565 Generate code that doesn't assume ID based shared libraries are being used.
8566 This is the default.
8568 @item -mleaf-id-shared-library
8569 @opindex mleaf-id-shared-library
8570 Generate code that supports shared libraries via the library ID method,
8571 but assumes that this library or executable won't link against any other
8572 ID shared libraries. That allows the compiler to use faster code for jumps
8575 @item -mno-leaf-id-shared-library
8576 @opindex mno-leaf-id-shared-library
8577 Do not assume that the code being compiled won't link against any ID shared
8578 libraries. Slower code will be generated for jump and call insns.
8580 @item -mshared-library-id=n
8581 @opindex mshared-library-id
8582 Specified the identification number of the ID based shared library being
8583 compiled. Specifying a value of 0 will generate more compact code, specifying
8584 other values will force the allocation of that number to the current
8585 library but is no more space or time efficient than omitting this option.
8589 Generate code that allows the data segment to be located in a different
8590 area of memory from the text segment. This allows for execute in place in
8591 an environment without virtual memory management by eliminating relocations
8592 against the text section.
8595 @opindex mno-sep-data
8596 Generate code that assumes that the data segment follows the text segment.
8597 This is the default.
8600 @itemx -mno-long-calls
8601 @opindex mlong-calls
8602 @opindex mno-long-calls
8603 Tells the compiler to perform function calls by first loading the
8604 address of the function into a register and then performing a subroutine
8605 call on this register. This switch is needed if the target function
8606 will lie outside of the 24 bit addressing range of the offset based
8607 version of subroutine call instruction.
8609 This feature is not enabled by default. Specifying
8610 @option{-mno-long-calls} will restore the default behavior. Note these
8611 switches have no effect on how the compiler generates code to handle
8612 function calls via function pointers.
8616 @subsection CRIS Options
8617 @cindex CRIS Options
8619 These options are defined specifically for the CRIS ports.
8622 @item -march=@var{architecture-type}
8623 @itemx -mcpu=@var{architecture-type}
8626 Generate code for the specified architecture. The choices for
8627 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
8628 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
8629 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
8632 @item -mtune=@var{architecture-type}
8634 Tune to @var{architecture-type} everything applicable about the generated
8635 code, except for the ABI and the set of available instructions. The
8636 choices for @var{architecture-type} are the same as for
8637 @option{-march=@var{architecture-type}}.
8639 @item -mmax-stack-frame=@var{n}
8640 @opindex mmax-stack-frame
8641 Warn when the stack frame of a function exceeds @var{n} bytes.
8643 @item -melinux-stacksize=@var{n}
8644 @opindex melinux-stacksize
8645 Only available with the @samp{cris-axis-aout} target. Arranges for
8646 indications in the program to the kernel loader that the stack of the
8647 program should be set to @var{n} bytes.
8653 The options @option{-metrax4} and @option{-metrax100} are synonyms for
8654 @option{-march=v3} and @option{-march=v8} respectively.
8656 @item -mmul-bug-workaround
8657 @itemx -mno-mul-bug-workaround
8658 @opindex mmul-bug-workaround
8659 @opindex mno-mul-bug-workaround
8660 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
8661 models where it applies. This option is active by default.
8665 Enable CRIS-specific verbose debug-related information in the assembly
8666 code. This option also has the effect to turn off the @samp{#NO_APP}
8667 formatted-code indicator to the assembler at the beginning of the
8672 Do not use condition-code results from previous instruction; always emit
8673 compare and test instructions before use of condition codes.
8675 @item -mno-side-effects
8676 @opindex mno-side-effects
8677 Do not emit instructions with side-effects in addressing modes other than
8681 @itemx -mno-stack-align
8683 @itemx -mno-data-align
8684 @itemx -mconst-align
8685 @itemx -mno-const-align
8686 @opindex mstack-align
8687 @opindex mno-stack-align
8688 @opindex mdata-align
8689 @opindex mno-data-align
8690 @opindex mconst-align
8691 @opindex mno-const-align
8692 These options (no-options) arranges (eliminate arrangements) for the
8693 stack-frame, individual data and constants to be aligned for the maximum
8694 single data access size for the chosen CPU model. The default is to
8695 arrange for 32-bit alignment. ABI details such as structure layout are
8696 not affected by these options.
8704 Similar to the stack- data- and const-align options above, these options
8705 arrange for stack-frame, writable data and constants to all be 32-bit,
8706 16-bit or 8-bit aligned. The default is 32-bit alignment.
8708 @item -mno-prologue-epilogue
8709 @itemx -mprologue-epilogue
8710 @opindex mno-prologue-epilogue
8711 @opindex mprologue-epilogue
8712 With @option{-mno-prologue-epilogue}, the normal function prologue and
8713 epilogue that sets up the stack-frame are omitted and no return
8714 instructions or return sequences are generated in the code. Use this
8715 option only together with visual inspection of the compiled code: no
8716 warnings or errors are generated when call-saved registers must be saved,
8717 or storage for local variable needs to be allocated.
8723 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
8724 instruction sequences that load addresses for functions from the PLT part
8725 of the GOT rather than (traditional on other architectures) calls to the
8726 PLT@. The default is @option{-mgotplt}.
8730 Legacy no-op option only recognized with the cris-axis-aout target.
8734 Legacy no-op option only recognized with the cris-axis-elf and
8735 cris-axis-linux-gnu targets.
8739 Only recognized with the cris-axis-aout target, where it selects a
8740 GNU/linux-like multilib, include files and instruction set for
8745 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
8749 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
8750 to link with input-output functions from a simulator library. Code,
8751 initialized data and zero-initialized data are allocated consecutively.
8755 Like @option{-sim}, but pass linker options to locate initialized data at
8756 0x40000000 and zero-initialized data at 0x80000000.
8760 @subsection CRX Options
8763 These options are defined specifically for the CRX ports.
8769 Enable the use of multiply-accumulate instructions. Disabled by default.
8773 Push instructions will be used to pass outgoing arguments when functions
8774 are called. Enabled by default.
8777 @node Darwin Options
8778 @subsection Darwin Options
8779 @cindex Darwin options
8781 These options are defined for all architectures running the Darwin operating
8784 FSF GCC on Darwin does not create ``fat'' object files; it will create
8785 an object file for the single architecture that it was built to
8786 target. Apple's GCC on Darwin does create ``fat'' files if multiple
8787 @option{-arch} options are used; it does so by running the compiler or
8788 linker multiple times and joining the results together with
8791 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
8792 @samp{i686}) is determined by the flags that specify the ISA
8793 that GCC is targetting, like @option{-mcpu} or @option{-march}. The
8794 @option{-force_cpusubtype_ALL} option can be used to override this.
8796 The Darwin tools vary in their behavior when presented with an ISA
8797 mismatch. The assembler, @file{as}, will only permit instructions to
8798 be used that are valid for the subtype of the file it is generating,
8799 so you cannot put 64-bit instructions in an @samp{ppc750} object file.
8800 The linker for shared libraries, @file{/usr/bin/libtool}, will fail
8801 and print an error if asked to create a shared library with a less
8802 restrictive subtype than its input files (for instance, trying to put
8803 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
8804 for executables, @file{ld}, will quietly give the executable the most
8805 restrictive subtype of any of its input files.
8810 Add the framework directory @var{dir} to the head of the list of
8811 directories to be searched for header files. These directories are
8812 interleaved with those specified by @option{-I} options and are
8813 scanned in a left-to-right order.
8815 A framework directory is a directory with frameworks in it. A
8816 framework is a directory with a @samp{"Headers"} and/or
8817 @samp{"PrivateHeaders"} directory contained directly in it that ends
8818 in @samp{".framework"}. The name of a framework is the name of this
8819 directory excluding the @samp{".framework"}. Headers associated with
8820 the framework are found in one of those two directories, with
8821 @samp{"Headers"} being searched first. A subframework is a framework
8822 directory that is in a framework's @samp{"Frameworks"} directory.
8823 Includes of subframework headers can only appear in a header of a
8824 framework that contains the subframework, or in a sibling subframework
8825 header. Two subframeworks are siblings if they occur in the same
8826 framework. A subframework should not have the same name as a
8827 framework, a warning will be issued if this is violated. Currently a
8828 subframework cannot have subframeworks, in the future, the mechanism
8829 may be extended to support this. The standard frameworks can be found
8830 in @samp{"/System/Library/Frameworks"} and
8831 @samp{"/Library/Frameworks"}. An example include looks like
8832 @code{#include <Framework/header.h>}, where @samp{Framework} denotes
8833 the name of the framework and header.h is found in the
8834 @samp{"PrivateHeaders"} or @samp{"Headers"} directory.
8836 @item -iframework@var{dir}
8838 Like @option{-F} except the directory is a treated as a system
8839 directory. The main difference between this @option{-iframework} and
8840 @option{-F} is that with @option{-iframework} the compiler does not
8841 warn about constructs contained within header files found via
8842 @var{dir}. This option is valid only for the C family of languages.
8846 Emit debugging information for symbols that are used. For STABS
8847 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
8848 This is by default ON@.
8852 Emit debugging information for all symbols and types.
8854 @item -mmacosx-version-min=@var{version}
8855 The earliest version of MacOS X that this executable will run on
8856 is @var{version}. Typical values of @var{version} include @code{10.1},
8857 @code{10.2}, and @code{10.3.9}.
8859 If the compiler was built to use the system's headers by default,
8860 then the default for this option is the system version on which the
8861 compiler is running, otherwise the default is to make choices which
8862 are compatible with as many systems and code bases as possible.
8866 Enable kernel development mode. The @option{-mkernel} option sets
8867 @option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
8868 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
8869 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
8870 applicable. This mode also sets @option{-mno-altivec},
8871 @option{-msoft-float}, @option{-fno-builtin} and
8872 @option{-mlong-branch} for PowerPC targets.
8874 @item -mone-byte-bool
8875 @opindex mone-byte-bool
8876 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
8877 By default @samp{sizeof(bool)} is @samp{4} when compiling for
8878 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
8879 option has no effect on x86.
8881 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
8882 to generate code that is not binary compatible with code generated
8883 without that switch. Using this switch may require recompiling all
8884 other modules in a program, including system libraries. Use this
8885 switch to conform to a non-default data model.
8887 @item -mfix-and-continue
8888 @itemx -ffix-and-continue
8889 @itemx -findirect-data
8890 @opindex mfix-and-continue
8891 @opindex ffix-and-continue
8892 @opindex findirect-data
8893 Generate code suitable for fast turn around development. Needed to
8894 enable gdb to dynamically load @code{.o} files into already running
8895 programs. @option{-findirect-data} and @option{-ffix-and-continue}
8896 are provided for backwards compatibility.
8900 Loads all members of static archive libraries.
8901 See man ld(1) for more information.
8903 @item -arch_errors_fatal
8904 @opindex arch_errors_fatal
8905 Cause the errors having to do with files that have the wrong architecture
8909 @opindex bind_at_load
8910 Causes the output file to be marked such that the dynamic linker will
8911 bind all undefined references when the file is loaded or launched.
8915 Produce a Mach-o bundle format file.
8916 See man ld(1) for more information.
8918 @item -bundle_loader @var{executable}
8919 @opindex bundle_loader
8920 This option specifies the @var{executable} that will be loading the build
8921 output file being linked. See man ld(1) for more information.
8925 When passed this option, GCC will produce a dynamic library instead of
8926 an executable when linking, using the Darwin @file{libtool} command.
8928 @item -force_cpusubtype_ALL
8929 @opindex force_cpusubtype_ALL
8930 This causes GCC's output file to have the @var{ALL} subtype, instead of
8931 one controlled by the @option{-mcpu} or @option{-march} option.
8933 @item -allowable_client @var{client_name}
8935 @itemx -compatibility_version
8936 @itemx -current_version
8938 @itemx -dependency-file
8940 @itemx -dylinker_install_name
8942 @itemx -exported_symbols_list
8944 @itemx -flat_namespace
8945 @itemx -force_flat_namespace
8946 @itemx -headerpad_max_install_names
8949 @itemx -install_name
8950 @itemx -keep_private_externs
8951 @itemx -multi_module
8952 @itemx -multiply_defined
8953 @itemx -multiply_defined_unused
8955 @itemx -no_dead_strip_inits_and_terms
8956 @itemx -nofixprebinding
8959 @itemx -noseglinkedit
8960 @itemx -pagezero_size
8962 @itemx -prebind_all_twolevel_modules
8963 @itemx -private_bundle
8964 @itemx -read_only_relocs
8966 @itemx -sectobjectsymbols
8970 @itemx -sectobjectsymbols
8973 @itemx -segs_read_only_addr
8974 @itemx -segs_read_write_addr
8975 @itemx -seg_addr_table
8976 @itemx -seg_addr_table_filename
8979 @itemx -segs_read_only_addr
8980 @itemx -segs_read_write_addr
8981 @itemx -single_module
8984 @itemx -sub_umbrella
8985 @itemx -twolevel_namespace
8988 @itemx -unexported_symbols_list
8989 @itemx -weak_reference_mismatches
8992 @opindex allowable_client
8993 @opindex client_name
8994 @opindex compatibility_version
8995 @opindex current_version
8997 @opindex dependency-file
8999 @opindex dylinker_install_name
9001 @opindex exported_symbols_list
9003 @opindex flat_namespace
9004 @opindex force_flat_namespace
9005 @opindex headerpad_max_install_names
9008 @opindex install_name
9009 @opindex keep_private_externs
9010 @opindex multi_module
9011 @opindex multiply_defined
9012 @opindex multiply_defined_unused
9014 @opindex no_dead_strip_inits_and_terms
9015 @opindex nofixprebinding
9016 @opindex nomultidefs
9018 @opindex noseglinkedit
9019 @opindex pagezero_size
9021 @opindex prebind_all_twolevel_modules
9022 @opindex private_bundle
9023 @opindex read_only_relocs
9025 @opindex sectobjectsymbols
9029 @opindex sectobjectsymbols
9032 @opindex segs_read_only_addr
9033 @opindex segs_read_write_addr
9034 @opindex seg_addr_table
9035 @opindex seg_addr_table_filename
9036 @opindex seglinkedit
9038 @opindex segs_read_only_addr
9039 @opindex segs_read_write_addr
9040 @opindex single_module
9042 @opindex sub_library
9043 @opindex sub_umbrella
9044 @opindex twolevel_namespace
9047 @opindex unexported_symbols_list
9048 @opindex weak_reference_mismatches
9049 @opindex whatsloaded
9051 These options are passed to the Darwin linker. The Darwin linker man page
9052 describes them in detail.
9055 @node DEC Alpha Options
9056 @subsection DEC Alpha Options
9058 These @samp{-m} options are defined for the DEC Alpha implementations:
9061 @item -mno-soft-float
9063 @opindex mno-soft-float
9064 @opindex msoft-float
9065 Use (do not use) the hardware floating-point instructions for
9066 floating-point operations. When @option{-msoft-float} is specified,
9067 functions in @file{libgcc.a} will be used to perform floating-point
9068 operations. Unless they are replaced by routines that emulate the
9069 floating-point operations, or compiled in such a way as to call such
9070 emulations routines, these routines will issue floating-point
9071 operations. If you are compiling for an Alpha without floating-point
9072 operations, you must ensure that the library is built so as not to call
9075 Note that Alpha implementations without floating-point operations are
9076 required to have floating-point registers.
9081 @opindex mno-fp-regs
9082 Generate code that uses (does not use) the floating-point register set.
9083 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
9084 register set is not used, floating point operands are passed in integer
9085 registers as if they were integers and floating-point results are passed
9086 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
9087 so any function with a floating-point argument or return value called by code
9088 compiled with @option{-mno-fp-regs} must also be compiled with that
9091 A typical use of this option is building a kernel that does not use,
9092 and hence need not save and restore, any floating-point registers.
9096 The Alpha architecture implements floating-point hardware optimized for
9097 maximum performance. It is mostly compliant with the IEEE floating
9098 point standard. However, for full compliance, software assistance is
9099 required. This option generates code fully IEEE compliant code
9100 @emph{except} that the @var{inexact-flag} is not maintained (see below).
9101 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
9102 defined during compilation. The resulting code is less efficient but is
9103 able to correctly support denormalized numbers and exceptional IEEE
9104 values such as not-a-number and plus/minus infinity. Other Alpha
9105 compilers call this option @option{-ieee_with_no_inexact}.
9107 @item -mieee-with-inexact
9108 @opindex mieee-with-inexact
9109 This is like @option{-mieee} except the generated code also maintains
9110 the IEEE @var{inexact-flag}. Turning on this option causes the
9111 generated code to implement fully-compliant IEEE math. In addition to
9112 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
9113 macro. On some Alpha implementations the resulting code may execute
9114 significantly slower than the code generated by default. Since there is
9115 very little code that depends on the @var{inexact-flag}, you should
9116 normally not specify this option. Other Alpha compilers call this
9117 option @option{-ieee_with_inexact}.
9119 @item -mfp-trap-mode=@var{trap-mode}
9120 @opindex mfp-trap-mode
9121 This option controls what floating-point related traps are enabled.
9122 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
9123 The trap mode can be set to one of four values:
9127 This is the default (normal) setting. The only traps that are enabled
9128 are the ones that cannot be disabled in software (e.g., division by zero
9132 In addition to the traps enabled by @samp{n}, underflow traps are enabled
9136 Like @samp{u}, but the instructions are marked to be safe for software
9137 completion (see Alpha architecture manual for details).
9140 Like @samp{su}, but inexact traps are enabled as well.
9143 @item -mfp-rounding-mode=@var{rounding-mode}
9144 @opindex mfp-rounding-mode
9145 Selects the IEEE rounding mode. Other Alpha compilers call this option
9146 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
9151 Normal IEEE rounding mode. Floating point numbers are rounded towards
9152 the nearest machine number or towards the even machine number in case
9156 Round towards minus infinity.
9159 Chopped rounding mode. Floating point numbers are rounded towards zero.
9162 Dynamic rounding mode. A field in the floating point control register
9163 (@var{fpcr}, see Alpha architecture reference manual) controls the
9164 rounding mode in effect. The C library initializes this register for
9165 rounding towards plus infinity. Thus, unless your program modifies the
9166 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
9169 @item -mtrap-precision=@var{trap-precision}
9170 @opindex mtrap-precision
9171 In the Alpha architecture, floating point traps are imprecise. This
9172 means without software assistance it is impossible to recover from a
9173 floating trap and program execution normally needs to be terminated.
9174 GCC can generate code that can assist operating system trap handlers
9175 in determining the exact location that caused a floating point trap.
9176 Depending on the requirements of an application, different levels of
9177 precisions can be selected:
9181 Program precision. This option is the default and means a trap handler
9182 can only identify which program caused a floating point exception.
9185 Function precision. The trap handler can determine the function that
9186 caused a floating point exception.
9189 Instruction precision. The trap handler can determine the exact
9190 instruction that caused a floating point exception.
9193 Other Alpha compilers provide the equivalent options called
9194 @option{-scope_safe} and @option{-resumption_safe}.
9196 @item -mieee-conformant
9197 @opindex mieee-conformant
9198 This option marks the generated code as IEEE conformant. You must not
9199 use this option unless you also specify @option{-mtrap-precision=i} and either
9200 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
9201 is to emit the line @samp{.eflag 48} in the function prologue of the
9202 generated assembly file. Under DEC Unix, this has the effect that
9203 IEEE-conformant math library routines will be linked in.
9205 @item -mbuild-constants
9206 @opindex mbuild-constants
9207 Normally GCC examines a 32- or 64-bit integer constant to
9208 see if it can construct it from smaller constants in two or three
9209 instructions. If it cannot, it will output the constant as a literal and
9210 generate code to load it from the data segment at runtime.
9212 Use this option to require GCC to construct @emph{all} integer constants
9213 using code, even if it takes more instructions (the maximum is six).
9215 You would typically use this option to build a shared library dynamic
9216 loader. Itself a shared library, it must relocate itself in memory
9217 before it can find the variables and constants in its own data segment.
9223 Select whether to generate code to be assembled by the vendor-supplied
9224 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
9242 Indicate whether GCC should generate code to use the optional BWX,
9243 CIX, FIX and MAX instruction sets. The default is to use the instruction
9244 sets supported by the CPU type specified via @option{-mcpu=} option or that
9245 of the CPU on which GCC was built if none was specified.
9250 @opindex mfloat-ieee
9251 Generate code that uses (does not use) VAX F and G floating point
9252 arithmetic instead of IEEE single and double precision.
9254 @item -mexplicit-relocs
9255 @itemx -mno-explicit-relocs
9256 @opindex mexplicit-relocs
9257 @opindex mno-explicit-relocs
9258 Older Alpha assemblers provided no way to generate symbol relocations
9259 except via assembler macros. Use of these macros does not allow
9260 optimal instruction scheduling. GNU binutils as of version 2.12
9261 supports a new syntax that allows the compiler to explicitly mark
9262 which relocations should apply to which instructions. This option
9263 is mostly useful for debugging, as GCC detects the capabilities of
9264 the assembler when it is built and sets the default accordingly.
9268 @opindex msmall-data
9269 @opindex mlarge-data
9270 When @option{-mexplicit-relocs} is in effect, static data is
9271 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
9272 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
9273 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
9274 16-bit relocations off of the @code{$gp} register. This limits the
9275 size of the small data area to 64KB, but allows the variables to be
9276 directly accessed via a single instruction.
9278 The default is @option{-mlarge-data}. With this option the data area
9279 is limited to just below 2GB@. Programs that require more than 2GB of
9280 data must use @code{malloc} or @code{mmap} to allocate the data in the
9281 heap instead of in the program's data segment.
9283 When generating code for shared libraries, @option{-fpic} implies
9284 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
9288 @opindex msmall-text
9289 @opindex mlarge-text
9290 When @option{-msmall-text} is used, the compiler assumes that the
9291 code of the entire program (or shared library) fits in 4MB, and is
9292 thus reachable with a branch instruction. When @option{-msmall-data}
9293 is used, the compiler can assume that all local symbols share the
9294 same @code{$gp} value, and thus reduce the number of instructions
9295 required for a function call from 4 to 1.
9297 The default is @option{-mlarge-text}.
9299 @item -mcpu=@var{cpu_type}
9301 Set the instruction set and instruction scheduling parameters for
9302 machine type @var{cpu_type}. You can specify either the @samp{EV}
9303 style name or the corresponding chip number. GCC supports scheduling
9304 parameters for the EV4, EV5 and EV6 family of processors and will
9305 choose the default values for the instruction set from the processor
9306 you specify. If you do not specify a processor type, GCC will default
9307 to the processor on which the compiler was built.
9309 Supported values for @var{cpu_type} are
9315 Schedules as an EV4 and has no instruction set extensions.
9319 Schedules as an EV5 and has no instruction set extensions.
9323 Schedules as an EV5 and supports the BWX extension.
9328 Schedules as an EV5 and supports the BWX and MAX extensions.
9332 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
9336 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
9339 @item -mtune=@var{cpu_type}
9341 Set only the instruction scheduling parameters for machine type
9342 @var{cpu_type}. The instruction set is not changed.
9344 @item -mmemory-latency=@var{time}
9345 @opindex mmemory-latency
9346 Sets the latency the scheduler should assume for typical memory
9347 references as seen by the application. This number is highly
9348 dependent on the memory access patterns used by the application
9349 and the size of the external cache on the machine.
9351 Valid options for @var{time} are
9355 A decimal number representing clock cycles.
9361 The compiler contains estimates of the number of clock cycles for
9362 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
9363 (also called Dcache, Scache, and Bcache), as well as to main memory.
9364 Note that L3 is only valid for EV5.
9369 @node DEC Alpha/VMS Options
9370 @subsection DEC Alpha/VMS Options
9372 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
9375 @item -mvms-return-codes
9376 @opindex mvms-return-codes
9377 Return VMS condition codes from main. The default is to return POSIX
9378 style condition (e.g.@: error) codes.
9382 @subsection FRV Options
9389 Only use the first 32 general purpose registers.
9394 Use all 64 general purpose registers.
9399 Use only the first 32 floating point registers.
9404 Use all 64 floating point registers
9407 @opindex mhard-float
9409 Use hardware instructions for floating point operations.
9412 @opindex msoft-float
9414 Use library routines for floating point operations.
9419 Dynamically allocate condition code registers.
9424 Do not try to dynamically allocate condition code registers, only
9425 use @code{icc0} and @code{fcc0}.
9430 Change ABI to use double word insns.
9435 Do not use double word instructions.
9440 Use floating point double instructions.
9445 Do not use floating point double instructions.
9450 Use media instructions.
9455 Do not use media instructions.
9460 Use multiply and add/subtract instructions.
9465 Do not use multiply and add/subtract instructions.
9470 Select the FDPIC ABI, that uses function descriptors to represent
9471 pointers to functions. Without any PIC/PIE-related options, it
9472 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
9473 assumes GOT entries and small data are within a 12-bit range from the
9474 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
9475 are computed with 32 bits.
9478 @opindex minline-plt
9480 Enable inlining of PLT entries in function calls to functions that are
9481 not known to bind locally. It has no effect without @option{-mfdpic}.
9482 It's enabled by default if optimizing for speed and compiling for
9483 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
9484 optimization option such as @option{-O3} or above is present in the
9490 Assume a large TLS segment when generating thread-local code.
9495 Do not assume a large TLS segment when generating thread-local code.
9500 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
9501 that is known to be in read-only sections. It's enabled by default,
9502 except for @option{-fpic} or @option{-fpie}: even though it may help
9503 make the global offset table smaller, it trades 1 instruction for 4.
9504 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
9505 one of which may be shared by multiple symbols, and it avoids the need
9506 for a GOT entry for the referenced symbol, so it's more likely to be a
9507 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
9509 @item -multilib-library-pic
9510 @opindex multilib-library-pic
9512 Link with the (library, not FD) pic libraries. It's implied by
9513 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
9514 @option{-fpic} without @option{-mfdpic}. You should never have to use
9520 Follow the EABI requirement of always creating a frame pointer whenever
9521 a stack frame is allocated. This option is enabled by default and can
9522 be disabled with @option{-mno-linked-fp}.
9525 @opindex mlong-calls
9527 Use indirect addressing to call functions outside the current
9528 compilation unit. This allows the functions to be placed anywhere
9529 within the 32-bit address space.
9531 @item -malign-labels
9532 @opindex malign-labels
9534 Try to align labels to an 8-byte boundary by inserting nops into the
9535 previous packet. This option only has an effect when VLIW packing
9536 is enabled. It doesn't create new packets; it merely adds nops to
9540 @opindex mlibrary-pic
9542 Generate position-independent EABI code.
9547 Use only the first four media accumulator registers.
9552 Use all eight media accumulator registers.
9557 Pack VLIW instructions.
9562 Do not pack VLIW instructions.
9567 Do not mark ABI switches in e_flags.
9572 Enable the use of conditional-move instructions (default).
9574 This switch is mainly for debugging the compiler and will likely be removed
9575 in a future version.
9577 @item -mno-cond-move
9578 @opindex mno-cond-move
9580 Disable the use of conditional-move instructions.
9582 This switch is mainly for debugging the compiler and will likely be removed
9583 in a future version.
9588 Enable the use of conditional set instructions (default).
9590 This switch is mainly for debugging the compiler and will likely be removed
9591 in a future version.
9596 Disable the use of conditional set instructions.
9598 This switch is mainly for debugging the compiler and will likely be removed
9599 in a future version.
9604 Enable the use of conditional execution (default).
9606 This switch is mainly for debugging the compiler and will likely be removed
9607 in a future version.
9609 @item -mno-cond-exec
9610 @opindex mno-cond-exec
9612 Disable the use of conditional execution.
9614 This switch is mainly for debugging the compiler and will likely be removed
9615 in a future version.
9618 @opindex mvliw-branch
9620 Run a pass to pack branches into VLIW instructions (default).
9622 This switch is mainly for debugging the compiler and will likely be removed
9623 in a future version.
9625 @item -mno-vliw-branch
9626 @opindex mno-vliw-branch
9628 Do not run a pass to pack branches into VLIW instructions.
9630 This switch is mainly for debugging the compiler and will likely be removed
9631 in a future version.
9633 @item -mmulti-cond-exec
9634 @opindex mmulti-cond-exec
9636 Enable optimization of @code{&&} and @code{||} in conditional execution
9639 This switch is mainly for debugging the compiler and will likely be removed
9640 in a future version.
9642 @item -mno-multi-cond-exec
9643 @opindex mno-multi-cond-exec
9645 Disable optimization of @code{&&} and @code{||} in conditional execution.
9647 This switch is mainly for debugging the compiler and will likely be removed
9648 in a future version.
9650 @item -mnested-cond-exec
9651 @opindex mnested-cond-exec
9653 Enable nested conditional execution optimizations (default).
9655 This switch is mainly for debugging the compiler and will likely be removed
9656 in a future version.
9658 @item -mno-nested-cond-exec
9659 @opindex mno-nested-cond-exec
9661 Disable nested conditional execution optimizations.
9663 This switch is mainly for debugging the compiler and will likely be removed
9664 in a future version.
9666 @item -moptimize-membar
9667 @opindex moptimize-membar
9669 This switch removes redundant @code{membar} instructions from the
9670 compiler generated code. It is enabled by default.
9672 @item -mno-optimize-membar
9673 @opindex mno-optimize-membar
9675 This switch disables the automatic removal of redundant @code{membar}
9676 instructions from the generated code.
9678 @item -mtomcat-stats
9679 @opindex mtomcat-stats
9681 Cause gas to print out tomcat statistics.
9683 @item -mcpu=@var{cpu}
9686 Select the processor type for which to generate code. Possible values are
9687 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
9688 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
9692 @node GNU/Linux Options
9693 @subsection GNU/Linux Options
9695 These @samp{-m} options are defined for GNU/Linux targets:
9700 Use the GNU C library instead of uClibc. This is the default except
9701 on @samp{*-*-linux-*uclibc*} targets.
9705 Use uClibc instead of the GNU C library. This is the default on
9706 @samp{*-*-linux-*uclibc*} targets.
9709 @node H8/300 Options
9710 @subsection H8/300 Options
9712 These @samp{-m} options are defined for the H8/300 implementations:
9717 Shorten some address references at link time, when possible; uses the
9718 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
9719 ld, Using ld}, for a fuller description.
9723 Generate code for the H8/300H@.
9727 Generate code for the H8S@.
9731 Generate code for the H8S and H8/300H in the normal mode. This switch
9732 must be used either with @option{-mh} or @option{-ms}.
9736 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
9740 Make @code{int} data 32 bits by default.
9744 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
9745 The default for the H8/300H and H8S is to align longs and floats on 4
9747 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
9748 This option has no effect on the H8/300.
9752 @subsection HPPA Options
9753 @cindex HPPA Options
9755 These @samp{-m} options are defined for the HPPA family of computers:
9758 @item -march=@var{architecture-type}
9760 Generate code for the specified architecture. The choices for
9761 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
9762 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
9763 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
9764 architecture option for your machine. Code compiled for lower numbered
9765 architectures will run on higher numbered architectures, but not the
9769 @itemx -mpa-risc-1-1
9770 @itemx -mpa-risc-2-0
9771 @opindex mpa-risc-1-0
9772 @opindex mpa-risc-1-1
9773 @opindex mpa-risc-2-0
9774 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
9777 @opindex mbig-switch
9778 Generate code suitable for big switch tables. Use this option only if
9779 the assembler/linker complain about out of range branches within a switch
9782 @item -mjump-in-delay
9783 @opindex mjump-in-delay
9784 Fill delay slots of function calls with unconditional jump instructions
9785 by modifying the return pointer for the function call to be the target
9786 of the conditional jump.
9788 @item -mdisable-fpregs
9789 @opindex mdisable-fpregs
9790 Prevent floating point registers from being used in any manner. This is
9791 necessary for compiling kernels which perform lazy context switching of
9792 floating point registers. If you use this option and attempt to perform
9793 floating point operations, the compiler will abort.
9795 @item -mdisable-indexing
9796 @opindex mdisable-indexing
9797 Prevent the compiler from using indexing address modes. This avoids some
9798 rather obscure problems when compiling MIG generated code under MACH@.
9800 @item -mno-space-regs
9801 @opindex mno-space-regs
9802 Generate code that assumes the target has no space registers. This allows
9803 GCC to generate faster indirect calls and use unscaled index address modes.
9805 Such code is suitable for level 0 PA systems and kernels.
9807 @item -mfast-indirect-calls
9808 @opindex mfast-indirect-calls
9809 Generate code that assumes calls never cross space boundaries. This
9810 allows GCC to emit code which performs faster indirect calls.
9812 This option will not work in the presence of shared libraries or nested
9815 @item -mfixed-range=@var{register-range}
9816 @opindex mfixed-range
9817 Generate code treating the given register range as fixed registers.
9818 A fixed register is one that the register allocator can not use. This is
9819 useful when compiling kernel code. A register range is specified as
9820 two registers separated by a dash. Multiple register ranges can be
9821 specified separated by a comma.
9823 @item -mlong-load-store
9824 @opindex mlong-load-store
9825 Generate 3-instruction load and store sequences as sometimes required by
9826 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
9829 @item -mportable-runtime
9830 @opindex mportable-runtime
9831 Use the portable calling conventions proposed by HP for ELF systems.
9835 Enable the use of assembler directives only GAS understands.
9837 @item -mschedule=@var{cpu-type}
9839 Schedule code according to the constraints for the machine type
9840 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
9841 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
9842 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
9843 proper scheduling option for your machine. The default scheduling is
9847 @opindex mlinker-opt
9848 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
9849 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
9850 linkers in which they give bogus error messages when linking some programs.
9853 @opindex msoft-float
9854 Generate output containing library calls for floating point.
9855 @strong{Warning:} the requisite libraries are not available for all HPPA
9856 targets. Normally the facilities of the machine's usual C compiler are
9857 used, but this cannot be done directly in cross-compilation. You must make
9858 your own arrangements to provide suitable library functions for
9859 cross-compilation. The embedded target @samp{hppa1.1-*-pro}
9860 does provide software floating point support.
9862 @option{-msoft-float} changes the calling convention in the output file;
9863 therefore, it is only useful if you compile @emph{all} of a program with
9864 this option. In particular, you need to compile @file{libgcc.a}, the
9865 library that comes with GCC, with @option{-msoft-float} in order for
9870 Generate the predefine, @code{_SIO}, for server IO@. The default is
9871 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
9872 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
9873 options are available under HP-UX and HI-UX@.
9877 Use GNU ld specific options. This passes @option{-shared} to ld when
9878 building a shared library. It is the default when GCC is configured,
9879 explicitly or implicitly, with the GNU linker. This option does not
9880 have any affect on which ld is called, it only changes what parameters
9881 are passed to that ld. The ld that is called is determined by the
9882 @option{--with-ld} configure option, GCC's program search path, and
9883 finally by the user's @env{PATH}. The linker used by GCC can be printed
9884 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
9885 on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
9889 Use HP ld specific options. This passes @option{-b} to ld when building
9890 a shared library and passes @option{+Accept TypeMismatch} to ld on all
9891 links. It is the default when GCC is configured, explicitly or
9892 implicitly, with the HP linker. This option does not have any affect on
9893 which ld is called, it only changes what parameters are passed to that
9894 ld. The ld that is called is determined by the @option{--with-ld}
9895 configure option, GCC's program search path, and finally by the user's
9896 @env{PATH}. The linker used by GCC can be printed using @samp{which
9897 `gcc -print-prog-name=ld`}. This option is only available on the 64 bit
9898 HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
9901 @opindex mno-long-calls
9902 Generate code that uses long call sequences. This ensures that a call
9903 is always able to reach linker generated stubs. The default is to generate
9904 long calls only when the distance from the call site to the beginning
9905 of the function or translation unit, as the case may be, exceeds a
9906 predefined limit set by the branch type being used. The limits for
9907 normal calls are 7,600,000 and 240,000 bytes, respectively for the
9908 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
9911 Distances are measured from the beginning of functions when using the
9912 @option{-ffunction-sections} option, or when using the @option{-mgas}
9913 and @option{-mno-portable-runtime} options together under HP-UX with
9916 It is normally not desirable to use this option as it will degrade
9917 performance. However, it may be useful in large applications,
9918 particularly when partial linking is used to build the application.
9920 The types of long calls used depends on the capabilities of the
9921 assembler and linker, and the type of code being generated. The
9922 impact on systems that support long absolute calls, and long pic
9923 symbol-difference or pc-relative calls should be relatively small.
9924 However, an indirect call is used on 32-bit ELF systems in pic code
9925 and it is quite long.
9927 @item -munix=@var{unix-std}
9929 Generate compiler predefines and select a startfile for the specified
9930 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
9931 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
9932 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
9933 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
9934 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
9937 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
9938 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
9939 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
9940 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
9941 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
9942 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
9944 It is @emph{important} to note that this option changes the interfaces
9945 for various library routines. It also affects the operational behavior
9946 of the C library. Thus, @emph{extreme} care is needed in using this
9949 Library code that is intended to operate with more than one UNIX
9950 standard must test, set and restore the variable @var{__xpg4_extended_mask}
9951 as appropriate. Most GNU software doesn't provide this capability.
9955 Suppress the generation of link options to search libdld.sl when the
9956 @option{-static} option is specified on HP-UX 10 and later.
9960 The HP-UX implementation of setlocale in libc has a dependency on
9961 libdld.sl. There isn't an archive version of libdld.sl. Thus,
9962 when the @option{-static} option is specified, special link options
9963 are needed to resolve this dependency.
9965 On HP-UX 10 and later, the GCC driver adds the necessary options to
9966 link with libdld.sl when the @option{-static} option is specified.
9967 This causes the resulting binary to be dynamic. On the 64-bit port,
9968 the linkers generate dynamic binaries by default in any case. The
9969 @option{-nolibdld} option can be used to prevent the GCC driver from
9970 adding these link options.
9974 Add support for multithreading with the @dfn{dce thread} library
9975 under HP-UX@. This option sets flags for both the preprocessor and
9979 @node i386 and x86-64 Options
9980 @subsection Intel 386 and AMD x86-64 Options
9981 @cindex i386 Options
9982 @cindex x86-64 Options
9983 @cindex Intel 386 Options
9984 @cindex AMD x86-64 Options
9986 These @samp{-m} options are defined for the i386 and x86-64 family of
9990 @item -mtune=@var{cpu-type}
9992 Tune to @var{cpu-type} everything applicable about the generated code, except
9993 for the ABI and the set of available instructions. The choices for
9997 Produce code optimized for the most common IA32/AMD64/EM64T processors.
9998 If you know the CPU on which your code will run, then you should use
9999 the corresponding @option{-mtune} option instead of
10000 @option{-mtune=generic}. But, if you do not know exactly what CPU users
10001 of your application will have, then you should use this option.
10003 As new processors are deployed in the marketplace, the behavior of this
10004 option will change. Therefore, if you upgrade to a newer version of
10005 GCC, the code generated option will change to reflect the processors
10006 that were most common when that version of GCC was released.
10008 There is no @option{-march=generic} option because @option{-march}
10009 indicates the instruction set the compiler can use, and there is no
10010 generic instruction set applicable to all processors. In contrast,
10011 @option{-mtune} indicates the processor (or, in this case, collection of
10012 processors) for which the code is optimized.
10014 This selects the CPU to tune for at compilation time by determining
10015 the processor type of the compiling machine. Using @option{-mtune=native}
10016 will produce code optimized for the local machine under the constraints
10017 of the selected instruction set. Using @option{-march=native} will
10018 enable all instruction subsets supported by the local machine (hence
10019 the result might not run on different machines).
10021 Original Intel's i386 CPU@.
10023 Intel's i486 CPU@. (No scheduling is implemented for this chip.)
10024 @item i586, pentium
10025 Intel Pentium CPU with no MMX support.
10027 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
10029 Intel PentiumPro CPU@.
10031 Same as @code{generic}, but when used as @code{march} option, PentiumPro
10032 instruction set will be used, so the code will run on all i686 family chips.
10034 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
10035 @item pentium3, pentium3m
10036 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
10039 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
10040 support. Used by Centrino notebooks.
10041 @item pentium4, pentium4m
10042 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
10044 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
10047 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
10048 SSE2 and SSE3 instruction set support.
10050 Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
10051 instruction set support.
10053 AMD K6 CPU with MMX instruction set support.
10055 Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
10056 @item athlon, athlon-tbird
10057 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
10059 @item athlon-4, athlon-xp, athlon-mp
10060 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
10061 instruction set support.
10062 @item k8, opteron, athlon64, athlon-fx
10063 AMD K8 core based CPUs with x86-64 instruction set support. (This supersets
10064 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
10065 @item k8-sse3, opteron-sse3, athlon64-sse3
10066 Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
10067 @item amdfam10, barcelona
10068 AMD Family 10h core based CPUs with x86-64 instruction set support. (This
10069 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit
10070 instruction set extensions.)
10072 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
10075 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
10076 instruction set support.
10078 Via C3 CPU with MMX and 3dNOW! instruction set support. (No scheduling is
10079 implemented for this chip.)
10081 Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is
10082 implemented for this chip.)
10084 Embedded AMD CPU with MMX and 3dNOW! instruction set support.
10087 While picking a specific @var{cpu-type} will schedule things appropriately
10088 for that particular chip, the compiler will not generate any code that
10089 does not run on the i386 without the @option{-march=@var{cpu-type}} option
10092 @item -march=@var{cpu-type}
10094 Generate instructions for the machine type @var{cpu-type}. The choices
10095 for @var{cpu-type} are the same as for @option{-mtune}. Moreover,
10096 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
10098 @item -mcpu=@var{cpu-type}
10100 A deprecated synonym for @option{-mtune}.
10102 @item -mfpmath=@var{unit}
10104 Generate floating point arithmetics for selected unit @var{unit}. The choices
10105 for @var{unit} are:
10109 Use the standard 387 floating point coprocessor present majority of chips and
10110 emulated otherwise. Code compiled with this option will run almost everywhere.
10111 The temporary results are computed in 80bit precision instead of precision
10112 specified by the type resulting in slightly different results compared to most
10113 of other chips. See @option{-ffloat-store} for more detailed description.
10115 This is the default choice for i386 compiler.
10118 Use scalar floating point instructions present in the SSE instruction set.
10119 This instruction set is supported by Pentium3 and newer chips, in the AMD line
10120 by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
10121 instruction set supports only single precision arithmetics, thus the double and
10122 extended precision arithmetics is still done using 387. Later version, present
10123 only in Pentium4 and the future AMD x86-64 chips supports double precision
10126 For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
10127 or @option{-msse2} switches to enable SSE extensions and make this option
10128 effective. For the x86-64 compiler, these extensions are enabled by default.
10130 The resulting code should be considerably faster in the majority of cases and avoid
10131 the numerical instability problems of 387 code, but may break some existing
10132 code that expects temporaries to be 80bit.
10134 This is the default choice for the x86-64 compiler.
10137 Attempt to utilize both instruction sets at once. This effectively double the
10138 amount of available registers and on chips with separate execution units for
10139 387 and SSE the execution resources too. Use this option with care, as it is
10140 still experimental, because the GCC register allocator does not model separate
10141 functional units well resulting in instable performance.
10144 @item -masm=@var{dialect}
10145 @opindex masm=@var{dialect}
10146 Output asm instructions using selected @var{dialect}. Supported
10147 choices are @samp{intel} or @samp{att} (the default one). Darwin does
10148 not support @samp{intel}.
10151 @itemx -mno-ieee-fp
10153 @opindex mno-ieee-fp
10154 Control whether or not the compiler uses IEEE floating point
10155 comparisons. These handle correctly the case where the result of a
10156 comparison is unordered.
10159 @opindex msoft-float
10160 Generate output containing library calls for floating point.
10161 @strong{Warning:} the requisite libraries are not part of GCC@.
10162 Normally the facilities of the machine's usual C compiler are used, but
10163 this can't be done directly in cross-compilation. You must make your
10164 own arrangements to provide suitable library functions for
10167 On machines where a function returns floating point results in the 80387
10168 register stack, some floating point opcodes may be emitted even if
10169 @option{-msoft-float} is used.
10171 @item -mno-fp-ret-in-387
10172 @opindex mno-fp-ret-in-387
10173 Do not use the FPU registers for return values of functions.
10175 The usual calling convention has functions return values of types
10176 @code{float} and @code{double} in an FPU register, even if there
10177 is no FPU@. The idea is that the operating system should emulate
10180 The option @option{-mno-fp-ret-in-387} causes such values to be returned
10181 in ordinary CPU registers instead.
10183 @item -mno-fancy-math-387
10184 @opindex mno-fancy-math-387
10185 Some 387 emulators do not support the @code{sin}, @code{cos} and
10186 @code{sqrt} instructions for the 387. Specify this option to avoid
10187 generating those instructions. This option is the default on FreeBSD,
10188 OpenBSD and NetBSD@. This option is overridden when @option{-march}
10189 indicates that the target cpu will always have an FPU and so the
10190 instruction will not need emulation. As of revision 2.6.1, these
10191 instructions are not generated unless you also use the
10192 @option{-funsafe-math-optimizations} switch.
10194 @item -malign-double
10195 @itemx -mno-align-double
10196 @opindex malign-double
10197 @opindex mno-align-double
10198 Control whether GCC aligns @code{double}, @code{long double}, and
10199 @code{long long} variables on a two word boundary or a one word
10200 boundary. Aligning @code{double} variables on a two word boundary will
10201 produce code that runs somewhat faster on a @samp{Pentium} at the
10202 expense of more memory.
10204 On x86-64, @option{-malign-double} is enabled by default.
10206 @strong{Warning:} if you use the @option{-malign-double} switch,
10207 structures containing the above types will be aligned differently than
10208 the published application binary interface specifications for the 386
10209 and will not be binary compatible with structures in code compiled
10210 without that switch.
10212 @item -m96bit-long-double
10213 @itemx -m128bit-long-double
10214 @opindex m96bit-long-double
10215 @opindex m128bit-long-double
10216 These switches control the size of @code{long double} type. The i386
10217 application binary interface specifies the size to be 96 bits,
10218 so @option{-m96bit-long-double} is the default in 32 bit mode.
10220 Modern architectures (Pentium and newer) would prefer @code{long double}
10221 to be aligned to an 8 or 16 byte boundary. In arrays or structures
10222 conforming to the ABI, this would not be possible. So specifying a
10223 @option{-m128bit-long-double} will align @code{long double}
10224 to a 16 byte boundary by padding the @code{long double} with an additional
10227 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
10228 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
10230 Notice that neither of these options enable any extra precision over the x87
10231 standard of 80 bits for a @code{long double}.
10233 @strong{Warning:} if you override the default value for your target ABI, the
10234 structures and arrays containing @code{long double} variables will change
10235 their size as well as function calling convention for function taking
10236 @code{long double} will be modified. Hence they will not be binary
10237 compatible with arrays or structures in code compiled without that switch.
10239 @item -mmlarge-data-threshold=@var{number}
10240 @opindex mlarge-data-threshold=@var{number}
10241 When @option{-mcmodel=medium} is specified, the data greater than
10242 @var{threshold} are placed in large data section. This value must be the
10243 same across all object linked into the binary and defaults to 65535.
10247 Use a different function-calling convention, in which functions that
10248 take a fixed number of arguments return with the @code{ret} @var{num}
10249 instruction, which pops their arguments while returning. This saves one
10250 instruction in the caller since there is no need to pop the arguments
10253 You can specify that an individual function is called with this calling
10254 sequence with the function attribute @samp{stdcall}. You can also
10255 override the @option{-mrtd} option by using the function attribute
10256 @samp{cdecl}. @xref{Function Attributes}.
10258 @strong{Warning:} this calling convention is incompatible with the one
10259 normally used on Unix, so you cannot use it if you need to call
10260 libraries compiled with the Unix compiler.
10262 Also, you must provide function prototypes for all functions that
10263 take variable numbers of arguments (including @code{printf});
10264 otherwise incorrect code will be generated for calls to those
10267 In addition, seriously incorrect code will result if you call a
10268 function with too many arguments. (Normally, extra arguments are
10269 harmlessly ignored.)
10271 @item -mregparm=@var{num}
10273 Control how many registers are used to pass integer arguments. By
10274 default, no registers are used to pass arguments, and at most 3
10275 registers can be used. You can control this behavior for a specific
10276 function by using the function attribute @samp{regparm}.
10277 @xref{Function Attributes}.
10279 @strong{Warning:} if you use this switch, and
10280 @var{num} is nonzero, then you must build all modules with the same
10281 value, including any libraries. This includes the system libraries and
10285 @opindex msseregparm
10286 Use SSE register passing conventions for float and double arguments
10287 and return values. You can control this behavior for a specific
10288 function by using the function attribute @samp{sseregparm}.
10289 @xref{Function Attributes}.
10291 @strong{Warning:} if you use this switch then you must build all
10292 modules with the same value, including any libraries. This includes
10293 the system libraries and startup modules.
10302 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
10303 is specified, the significands of results of floating-point operations are
10304 rounded to 24 bits (single precision); @option{-mpc64} rounds the the
10305 significands of results of floating-point operations to 53 bits (double
10306 precision) and @option{-mpc80} rounds the significands of results of
10307 floating-point operations to 64 bits (extended double precision), which is
10308 the default. When this option is used, floating-point operations in higher
10309 precisions are not available to the programmer without setting the FPU
10310 control word explicitly.
10312 Setting the rounding of floating-point operations to less than the default
10313 80 bits can speed some programs by 2% or more. Note that some mathematical
10314 libraries assume that extended precision (80 bit) floating-point operations
10315 are enabled by default; routines in such libraries could suffer significant
10316 loss of accuracy, typically through so-called "catastrophic cancellation",
10317 when this option is used to set the precision to less than extended precision.
10319 @item -mstackrealign
10320 @opindex mstackrealign
10321 Realign the stack at entry. On the Intel x86, the
10322 @option{-mstackrealign} option will generate an alternate prologue and
10323 epilogue that realigns the runtime stack. This supports mixing legacy
10324 codes that keep a 4-byte aligned stack with modern codes that keep a
10325 16-byte stack for SSE compatibility. The alternate prologue and
10326 epilogue are slower and bigger than the regular ones, and the
10327 alternate prologue requires an extra scratch register; this lowers the
10328 number of registers available if used in conjunction with the
10329 @code{regparm} attribute. The @option{-mstackrealign} option is
10330 incompatible with the nested function prologue; this is considered a
10331 hard error. See also the attribute @code{force_align_arg_pointer},
10332 applicable to individual functions.
10334 @item -mpreferred-stack-boundary=@var{num}
10335 @opindex mpreferred-stack-boundary
10336 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
10337 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
10338 the default is 4 (16 bytes or 128 bits).
10340 On Pentium and PentiumPro, @code{double} and @code{long double} values
10341 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
10342 suffer significant run time performance penalties. On Pentium III, the
10343 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
10344 properly if it is not 16 byte aligned.
10346 To ensure proper alignment of this values on the stack, the stack boundary
10347 must be as aligned as that required by any value stored on the stack.
10348 Further, every function must be generated such that it keeps the stack
10349 aligned. Thus calling a function compiled with a higher preferred
10350 stack boundary from a function compiled with a lower preferred stack
10351 boundary will most likely misalign the stack. It is recommended that
10352 libraries that use callbacks always use the default setting.
10354 This extra alignment does consume extra stack space, and generally
10355 increases code size. Code that is sensitive to stack space usage, such
10356 as embedded systems and operating system kernels, may want to reduce the
10357 preferred alignment to @option{-mpreferred-stack-boundary=2}.
10389 These switches enable or disable the use of instructions in the MMX,
10390 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4A, ABM or 3DNow! extended
10392 These extensions are also available as built-in functions: see
10393 @ref{X86 Built-in Functions}, for details of the functions enabled and
10394 disabled by these switches.
10396 To have SSE/SSE2 instructions generated automatically from floating-point
10397 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
10399 These options will enable GCC to use these extended instructions in
10400 generated code, even without @option{-mfpmath=sse}. Applications which
10401 perform runtime CPU detection must compile separate files for each
10402 supported architecture, using the appropriate flags. In particular,
10403 the file containing the CPU detection code should be compiled without
10408 This option will enable GCC to use CMPXCHG16B instruction in generated code.
10409 CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword)
10410 data types. This is useful for high resolution counters that could be updated
10411 by multiple processors (or cores). This instruction is generated as part of
10412 atomic built-in functions: see @ref{Atomic Builtins} for details.
10416 This option will enable GCC to use SAHF instruction in generated 64-bit code.
10417 Early Intel CPUs with Intel 64 lacked LAHF and SAHF instructions supported
10418 by AMD64 until introduction of Pentium 4 G1 step in December 2005. LAHF and
10419 SAHF are load and store instructions, respectively, for certain status flags.
10420 In 64-bit mode, SAHF instruction is used to optimize @code{fmod}, @code{drem}
10421 or @code{remainder} built-in functions: see @ref{Other Builtins} for details.
10425 This option will enable GCC to use RCPSS and RSQRTSS instructions (and their
10426 vectorized variants RCPPS and RSQRTPS) instead of DIVSS and SQRTSS (and their
10427 vectorized variants). These instructions will be generated only when
10428 @option{-funsafe-math-optimizations} is enabled.
10431 @itemx -mno-push-args
10432 @opindex mpush-args
10433 @opindex mno-push-args
10434 Use PUSH operations to store outgoing parameters. This method is shorter
10435 and usually equally fast as method using SUB/MOV operations and is enabled
10436 by default. In some cases disabling it may improve performance because of
10437 improved scheduling and reduced dependencies.
10439 @item -maccumulate-outgoing-args
10440 @opindex maccumulate-outgoing-args
10441 If enabled, the maximum amount of space required for outgoing arguments will be
10442 computed in the function prologue. This is faster on most modern CPUs
10443 because of reduced dependencies, improved scheduling and reduced stack usage
10444 when preferred stack boundary is not equal to 2. The drawback is a notable
10445 increase in code size. This switch implies @option{-mno-push-args}.
10449 Support thread-safe exception handling on @samp{Mingw32}. Code that relies
10450 on thread-safe exception handling must compile and link all code with the
10451 @option{-mthreads} option. When compiling, @option{-mthreads} defines
10452 @option{-D_MT}; when linking, it links in a special thread helper library
10453 @option{-lmingwthrd} which cleans up per thread exception handling data.
10455 @item -mno-align-stringops
10456 @opindex mno-align-stringops
10457 Do not align destination of inlined string operations. This switch reduces
10458 code size and improves performance in case the destination is already aligned,
10459 but GCC doesn't know about it.
10461 @item -minline-all-stringops
10462 @opindex minline-all-stringops
10463 By default GCC inlines string operations only when destination is known to be
10464 aligned at least to 4 byte boundary. This enables more inlining, increase code
10465 size, but may improve performance of code that depends on fast memcpy, strlen
10466 and memset for short lengths.
10468 @item -minline-stringops-dynamically
10469 @opindex minline-stringops-dynamically
10470 For string operation of unknown size, inline runtime checks so for small
10471 blocks inline code is used, while for large blocks library call is used.
10473 @item -mstringop-strategy=@var{alg}
10474 @opindex mstringop-strategy=@var{alg}
10475 Overwrite internal decision heuristic about particular algorithm to inline
10476 string operation with. The allowed values are @code{rep_byte},
10477 @code{rep_4byte}, @code{rep_8byte} for expanding using i386 @code{rep} prefix
10478 of specified size, @code{byte_loop}, @code{loop}, @code{unrolled_loop} for
10479 expanding inline loop, @code{libcall} for always expanding library call.
10481 @item -momit-leaf-frame-pointer
10482 @opindex momit-leaf-frame-pointer
10483 Don't keep the frame pointer in a register for leaf functions. This
10484 avoids the instructions to save, set up and restore frame pointers and
10485 makes an extra register available in leaf functions. The option
10486 @option{-fomit-frame-pointer} removes the frame pointer for all functions
10487 which might make debugging harder.
10489 @item -mtls-direct-seg-refs
10490 @itemx -mno-tls-direct-seg-refs
10491 @opindex mtls-direct-seg-refs
10492 Controls whether TLS variables may be accessed with offsets from the
10493 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
10494 or whether the thread base pointer must be added. Whether or not this
10495 is legal depends on the operating system, and whether it maps the
10496 segment to cover the entire TLS area.
10498 For systems that use GNU libc, the default is on.
10501 These @samp{-m} switches are supported in addition to the above
10502 on AMD x86-64 processors in 64-bit environments.
10509 Generate code for a 32-bit or 64-bit environment.
10510 The 32-bit environment sets int, long and pointer to 32 bits and
10511 generates code that runs on any i386 system.
10512 The 64-bit environment sets int to 32 bits and long and pointer
10513 to 64 bits and generates code for AMD's x86-64 architecture. For
10514 darwin only the -m64 option turns off the @option{-fno-pic} and
10515 @option{-mdynamic-no-pic} options.
10517 @item -mno-red-zone
10518 @opindex no-red-zone
10519 Do not use a so called red zone for x86-64 code. The red zone is mandated
10520 by the x86-64 ABI, it is a 128-byte area beyond the location of the
10521 stack pointer that will not be modified by signal or interrupt handlers
10522 and therefore can be used for temporary data without adjusting the stack
10523 pointer. The flag @option{-mno-red-zone} disables this red zone.
10525 @item -mcmodel=small
10526 @opindex mcmodel=small
10527 Generate code for the small code model: the program and its symbols must
10528 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
10529 Programs can be statically or dynamically linked. This is the default
10532 @item -mcmodel=kernel
10533 @opindex mcmodel=kernel
10534 Generate code for the kernel code model. The kernel runs in the
10535 negative 2 GB of the address space.
10536 This model has to be used for Linux kernel code.
10538 @item -mcmodel=medium
10539 @opindex mcmodel=medium
10540 Generate code for the medium model: The program is linked in the lower 2
10541 GB of the address space but symbols can be located anywhere in the
10542 address space. Programs can be statically or dynamically linked, but
10543 building of shared libraries are not supported with the medium model.
10545 @item -mcmodel=large
10546 @opindex mcmodel=large
10547 Generate code for the large model: This model makes no assumptions
10548 about addresses and sizes of sections.
10551 @node IA-64 Options
10552 @subsection IA-64 Options
10553 @cindex IA-64 Options
10555 These are the @samp{-m} options defined for the Intel IA-64 architecture.
10559 @opindex mbig-endian
10560 Generate code for a big endian target. This is the default for HP-UX@.
10562 @item -mlittle-endian
10563 @opindex mlittle-endian
10564 Generate code for a little endian target. This is the default for AIX5
10570 @opindex mno-gnu-as
10571 Generate (or don't) code for the GNU assembler. This is the default.
10572 @c Also, this is the default if the configure option @option{--with-gnu-as}
10578 @opindex mno-gnu-ld
10579 Generate (or don't) code for the GNU linker. This is the default.
10580 @c Also, this is the default if the configure option @option{--with-gnu-ld}
10585 Generate code that does not use a global pointer register. The result
10586 is not position independent code, and violates the IA-64 ABI@.
10588 @item -mvolatile-asm-stop
10589 @itemx -mno-volatile-asm-stop
10590 @opindex mvolatile-asm-stop
10591 @opindex mno-volatile-asm-stop
10592 Generate (or don't) a stop bit immediately before and after volatile asm
10595 @item -mregister-names
10596 @itemx -mno-register-names
10597 @opindex mregister-names
10598 @opindex mno-register-names
10599 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
10600 the stacked registers. This may make assembler output more readable.
10606 Disable (or enable) optimizations that use the small data section. This may
10607 be useful for working around optimizer bugs.
10609 @item -mconstant-gp
10610 @opindex mconstant-gp
10611 Generate code that uses a single constant global pointer value. This is
10612 useful when compiling kernel code.
10616 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
10617 This is useful when compiling firmware code.
10619 @item -minline-float-divide-min-latency
10620 @opindex minline-float-divide-min-latency
10621 Generate code for inline divides of floating point values
10622 using the minimum latency algorithm.
10624 @item -minline-float-divide-max-throughput
10625 @opindex minline-float-divide-max-throughput
10626 Generate code for inline divides of floating point values
10627 using the maximum throughput algorithm.
10629 @item -minline-int-divide-min-latency
10630 @opindex minline-int-divide-min-latency
10631 Generate code for inline divides of integer values
10632 using the minimum latency algorithm.
10634 @item -minline-int-divide-max-throughput
10635 @opindex minline-int-divide-max-throughput
10636 Generate code for inline divides of integer values
10637 using the maximum throughput algorithm.
10639 @item -minline-sqrt-min-latency
10640 @opindex minline-sqrt-min-latency
10641 Generate code for inline square roots
10642 using the minimum latency algorithm.
10644 @item -minline-sqrt-max-throughput
10645 @opindex minline-sqrt-max-throughput
10646 Generate code for inline square roots
10647 using the maximum throughput algorithm.
10649 @item -mno-dwarf2-asm
10650 @itemx -mdwarf2-asm
10651 @opindex mno-dwarf2-asm
10652 @opindex mdwarf2-asm
10653 Don't (or do) generate assembler code for the DWARF2 line number debugging
10654 info. This may be useful when not using the GNU assembler.
10656 @item -mearly-stop-bits
10657 @itemx -mno-early-stop-bits
10658 @opindex mearly-stop-bits
10659 @opindex mno-early-stop-bits
10660 Allow stop bits to be placed earlier than immediately preceding the
10661 instruction that triggered the stop bit. This can improve instruction
10662 scheduling, but does not always do so.
10664 @item -mfixed-range=@var{register-range}
10665 @opindex mfixed-range
10666 Generate code treating the given register range as fixed registers.
10667 A fixed register is one that the register allocator can not use. This is
10668 useful when compiling kernel code. A register range is specified as
10669 two registers separated by a dash. Multiple register ranges can be
10670 specified separated by a comma.
10672 @item -mtls-size=@var{tls-size}
10674 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
10677 @item -mtune=@var{cpu-type}
10679 Tune the instruction scheduling for a particular CPU, Valid values are
10680 itanium, itanium1, merced, itanium2, and mckinley.
10686 Add support for multithreading using the POSIX threads library. This
10687 option sets flags for both the preprocessor and linker. It does
10688 not affect the thread safety of object code produced by the compiler or
10689 that of libraries supplied with it. These are HP-UX specific flags.
10695 Generate code for a 32-bit or 64-bit environment.
10696 The 32-bit environment sets int, long and pointer to 32 bits.
10697 The 64-bit environment sets int to 32 bits and long and pointer
10698 to 64 bits. These are HP-UX specific flags.
10700 @item -mno-sched-br-data-spec
10701 @itemx -msched-br-data-spec
10702 @opindex mno-sched-br-data-spec
10703 @opindex msched-br-data-spec
10704 (Dis/En)able data speculative scheduling before reload.
10705 This will result in generation of the ld.a instructions and
10706 the corresponding check instructions (ld.c / chk.a).
10707 The default is 'disable'.
10709 @item -msched-ar-data-spec
10710 @itemx -mno-sched-ar-data-spec
10711 @opindex msched-ar-data-spec
10712 @opindex mno-sched-ar-data-spec
10713 (En/Dis)able data speculative scheduling after reload.
10714 This will result in generation of the ld.a instructions and
10715 the corresponding check instructions (ld.c / chk.a).
10716 The default is 'enable'.
10718 @item -mno-sched-control-spec
10719 @itemx -msched-control-spec
10720 @opindex mno-sched-control-spec
10721 @opindex msched-control-spec
10722 (Dis/En)able control speculative scheduling. This feature is
10723 available only during region scheduling (i.e. before reload).
10724 This will result in generation of the ld.s instructions and
10725 the corresponding check instructions chk.s .
10726 The default is 'disable'.
10728 @item -msched-br-in-data-spec
10729 @itemx -mno-sched-br-in-data-spec
10730 @opindex msched-br-in-data-spec
10731 @opindex mno-sched-br-in-data-spec
10732 (En/Dis)able speculative scheduling of the instructions that
10733 are dependent on the data speculative loads before reload.
10734 This is effective only with @option{-msched-br-data-spec} enabled.
10735 The default is 'enable'.
10737 @item -msched-ar-in-data-spec
10738 @itemx -mno-sched-ar-in-data-spec
10739 @opindex msched-ar-in-data-spec
10740 @opindex mno-sched-ar-in-data-spec
10741 (En/Dis)able speculative scheduling of the instructions that
10742 are dependent on the data speculative loads after reload.
10743 This is effective only with @option{-msched-ar-data-spec} enabled.
10744 The default is 'enable'.
10746 @item -msched-in-control-spec
10747 @itemx -mno-sched-in-control-spec
10748 @opindex msched-in-control-spec
10749 @opindex mno-sched-in-control-spec
10750 (En/Dis)able speculative scheduling of the instructions that
10751 are dependent on the control speculative loads.
10752 This is effective only with @option{-msched-control-spec} enabled.
10753 The default is 'enable'.
10756 @itemx -mno-sched-ldc
10757 @opindex msched-ldc
10758 @opindex mno-sched-ldc
10759 (En/Dis)able use of simple data speculation checks ld.c .
10760 If disabled, only chk.a instructions will be emitted to check
10761 data speculative loads.
10762 The default is 'enable'.
10764 @item -mno-sched-control-ldc
10765 @itemx -msched-control-ldc
10766 @opindex mno-sched-control-ldc
10767 @opindex msched-control-ldc
10768 (Dis/En)able use of ld.c instructions to check control speculative loads.
10769 If enabled, in case of control speculative load with no speculatively
10770 scheduled dependent instructions this load will be emitted as ld.sa and
10771 ld.c will be used to check it.
10772 The default is 'disable'.
10774 @item -mno-sched-spec-verbose
10775 @itemx -msched-spec-verbose
10776 @opindex mno-sched-spec-verbose
10777 @opindex msched-spec-verbose
10778 (Dis/En)able printing of the information about speculative motions.
10780 @item -mno-sched-prefer-non-data-spec-insns
10781 @itemx -msched-prefer-non-data-spec-insns
10782 @opindex mno-sched-prefer-non-data-spec-insns
10783 @opindex msched-prefer-non-data-spec-insns
10784 If enabled, data speculative instructions will be chosen for schedule
10785 only if there are no other choices at the moment. This will make
10786 the use of the data speculation much more conservative.
10787 The default is 'disable'.
10789 @item -mno-sched-prefer-non-control-spec-insns
10790 @itemx -msched-prefer-non-control-spec-insns
10791 @opindex mno-sched-prefer-non-control-spec-insns
10792 @opindex msched-prefer-non-control-spec-insns
10793 If enabled, control speculative instructions will be chosen for schedule
10794 only if there are no other choices at the moment. This will make
10795 the use of the control speculation much more conservative.
10796 The default is 'disable'.
10798 @item -mno-sched-count-spec-in-critical-path
10799 @itemx -msched-count-spec-in-critical-path
10800 @opindex mno-sched-count-spec-in-critical-path
10801 @opindex msched-count-spec-in-critical-path
10802 If enabled, speculative dependencies will be considered during
10803 computation of the instructions priorities. This will make the use of the
10804 speculation a bit more conservative.
10805 The default is 'disable'.
10810 @subsection M32C Options
10811 @cindex M32C options
10814 @item -mcpu=@var{name}
10816 Select the CPU for which code is generated. @var{name} may be one of
10817 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
10818 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
10819 the M32C/80 series.
10823 Specifies that the program will be run on the simulator. This causes
10824 an alternate runtime library to be linked in which supports, for
10825 example, file I/O. You must not use this option when generating
10826 programs that will run on real hardware; you must provide your own
10827 runtime library for whatever I/O functions are needed.
10829 @item -memregs=@var{number}
10831 Specifies the number of memory-based pseudo-registers GCC will use
10832 during code generation. These pseudo-registers will be used like real
10833 registers, so there is a tradeoff between GCC's ability to fit the
10834 code into available registers, and the performance penalty of using
10835 memory instead of registers. Note that all modules in a program must
10836 be compiled with the same value for this option. Because of that, you
10837 must not use this option with the default runtime libraries gcc
10842 @node M32R/D Options
10843 @subsection M32R/D Options
10844 @cindex M32R/D options
10846 These @option{-m} options are defined for Renesas M32R/D architectures:
10851 Generate code for the M32R/2@.
10855 Generate code for the M32R/X@.
10859 Generate code for the M32R@. This is the default.
10861 @item -mmodel=small
10862 @opindex mmodel=small
10863 Assume all objects live in the lower 16MB of memory (so that their addresses
10864 can be loaded with the @code{ld24} instruction), and assume all subroutines
10865 are reachable with the @code{bl} instruction.
10866 This is the default.
10868 The addressability of a particular object can be set with the
10869 @code{model} attribute.
10871 @item -mmodel=medium
10872 @opindex mmodel=medium
10873 Assume objects may be anywhere in the 32-bit address space (the compiler
10874 will generate @code{seth/add3} instructions to load their addresses), and
10875 assume all subroutines are reachable with the @code{bl} instruction.
10877 @item -mmodel=large
10878 @opindex mmodel=large
10879 Assume objects may be anywhere in the 32-bit address space (the compiler
10880 will generate @code{seth/add3} instructions to load their addresses), and
10881 assume subroutines may not be reachable with the @code{bl} instruction
10882 (the compiler will generate the much slower @code{seth/add3/jl}
10883 instruction sequence).
10886 @opindex msdata=none
10887 Disable use of the small data area. Variables will be put into
10888 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
10889 @code{section} attribute has been specified).
10890 This is the default.
10892 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
10893 Objects may be explicitly put in the small data area with the
10894 @code{section} attribute using one of these sections.
10896 @item -msdata=sdata
10897 @opindex msdata=sdata
10898 Put small global and static data in the small data area, but do not
10899 generate special code to reference them.
10902 @opindex msdata=use
10903 Put small global and static data in the small data area, and generate
10904 special instructions to reference them.
10908 @cindex smaller data references
10909 Put global and static objects less than or equal to @var{num} bytes
10910 into the small data or bss sections instead of the normal data or bss
10911 sections. The default value of @var{num} is 8.
10912 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
10913 for this option to have any effect.
10915 All modules should be compiled with the same @option{-G @var{num}} value.
10916 Compiling with different values of @var{num} may or may not work; if it
10917 doesn't the linker will give an error message---incorrect code will not be
10922 Makes the M32R specific code in the compiler display some statistics
10923 that might help in debugging programs.
10925 @item -malign-loops
10926 @opindex malign-loops
10927 Align all loops to a 32-byte boundary.
10929 @item -mno-align-loops
10930 @opindex mno-align-loops
10931 Do not enforce a 32-byte alignment for loops. This is the default.
10933 @item -missue-rate=@var{number}
10934 @opindex missue-rate=@var{number}
10935 Issue @var{number} instructions per cycle. @var{number} can only be 1
10938 @item -mbranch-cost=@var{number}
10939 @opindex mbranch-cost=@var{number}
10940 @var{number} can only be 1 or 2. If it is 1 then branches will be
10941 preferred over conditional code, if it is 2, then the opposite will
10944 @item -mflush-trap=@var{number}
10945 @opindex mflush-trap=@var{number}
10946 Specifies the trap number to use to flush the cache. The default is
10947 12. Valid numbers are between 0 and 15 inclusive.
10949 @item -mno-flush-trap
10950 @opindex mno-flush-trap
10951 Specifies that the cache cannot be flushed by using a trap.
10953 @item -mflush-func=@var{name}
10954 @opindex mflush-func=@var{name}
10955 Specifies the name of the operating system function to call to flush
10956 the cache. The default is @emph{_flush_cache}, but a function call
10957 will only be used if a trap is not available.
10959 @item -mno-flush-func
10960 @opindex mno-flush-func
10961 Indicates that there is no OS function for flushing the cache.
10965 @node M680x0 Options
10966 @subsection M680x0 Options
10967 @cindex M680x0 options
10969 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
10970 The default settings depend on which architecture was selected when
10971 the compiler was configured; the defaults for the most common choices
10975 @item -march=@var{arch}
10977 Generate code for a specific M680x0 or ColdFire instruction set
10978 architecture. Permissible values of @var{arch} for M680x0
10979 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
10980 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
10981 architectures are selected according to Freescale's ISA classification
10982 and the permissible values are: @samp{isaa}, @samp{isaaplus},
10983 @samp{isab} and @samp{isac}.
10985 gcc defines a macro @samp{__mcf@var{arch}__} whenever it is generating
10986 code for a ColdFire target. The @var{arch} in this macro is one of the
10987 @option{-march} arguments given above.
10989 When used together, @option{-march} and @option{-mtune} select code
10990 that runs on a family of similar processors but that is optimized
10991 for a particular microarchitecture.
10993 @item -mcpu=@var{cpu}
10995 Generate code for a specific M680x0 or ColdFire processor.
10996 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
10997 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
10998 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
10999 below, which also classifies the CPUs into families:
11001 @multitable @columnfractions 0.20 0.80
11002 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
11003 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
11004 @item @samp{5206e} @tab @samp{5206e}
11005 @item @samp{5208} @tab @samp{5207} @samp{5208}
11006 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
11007 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
11008 @item @samp{5216} @tab @samp{5214} @samp{5216}
11009 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
11010 @item @samp{5225} @tab @samp{5224} @samp{5225}
11011 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
11012 @item @samp{5249} @tab @samp{5249}
11013 @item @samp{5250} @tab @samp{5250}
11014 @item @samp{5271} @tab @samp{5270} @samp{5271}
11015 @item @samp{5272} @tab @samp{5272}
11016 @item @samp{5275} @tab @samp{5274} @samp{5275}
11017 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
11018 @item @samp{5307} @tab @samp{5307}
11019 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
11020 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
11021 @item @samp{5407} @tab @samp{5407}
11022 @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}
11025 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
11026 @var{arch} is compatible with @var{cpu}. Other combinations of
11027 @option{-mcpu} and @option{-march} are rejected.
11029 gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
11030 @var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}},
11031 where the value of @var{family} is given by the table above.
11033 @item -mtune=@var{tune}
11035 Tune the code for a particular microarchitecture, within the
11036 constraints set by @option{-march} and @option{-mcpu}.
11037 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
11038 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
11039 and @samp{cpu32}. The ColdFire microarchitectures
11040 are: @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
11042 You can also use @option{-mtune=68020-40} for code that needs
11043 to run relatively well on 68020, 68030 and 68040 targets.
11044 @option{-mtune=68020-60} is similar but includes 68060 targets
11045 as well. These two options select the same tuning decisions as
11046 @option{-m68020-40} and @option{-m68020-60} respectively.
11048 gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
11049 when tuning for 680x0 architecture @var{arch}. It also defines
11050 @samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
11051 option is used. If gcc is tuning for a range of architectures,
11052 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
11053 it defines the macros for every architecture in the range.
11055 gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
11056 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
11057 of the arguments given above.
11063 Generate output for a 68000. This is the default
11064 when the compiler is configured for 68000-based systems.
11065 It is equivalent to @option{-march=68000}.
11067 Use this option for microcontrollers with a 68000 or EC000 core,
11068 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
11072 Generate output for a 68010. This is the default
11073 when the compiler is configured for 68010-based systems.
11074 It is equivalent to @option{-march=68010}.
11080 Generate output for a 68020. This is the default
11081 when the compiler is configured for 68020-based systems.
11082 It is equivalent to @option{-march=68020}.
11086 Generate output for a 68030. This is the default when the compiler is
11087 configured for 68030-based systems. It is equivalent to
11088 @option{-march=68030}.
11092 Generate output for a 68040. This is the default when the compiler is
11093 configured for 68040-based systems. It is equivalent to
11094 @option{-march=68040}.
11096 This option inhibits the use of 68881/68882 instructions that have to be
11097 emulated by software on the 68040. Use this option if your 68040 does not
11098 have code to emulate those instructions.
11102 Generate output for a 68060. This is the default when the compiler is
11103 configured for 68060-based systems. It is equivalent to
11104 @option{-march=68060}.
11106 This option inhibits the use of 68020 and 68881/68882 instructions that
11107 have to be emulated by software on the 68060. Use this option if your 68060
11108 does not have code to emulate those instructions.
11112 Generate output for a CPU32. This is the default
11113 when the compiler is configured for CPU32-based systems.
11114 It is equivalent to @option{-march=cpu32}.
11116 Use this option for microcontrollers with a
11117 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
11118 68336, 68340, 68341, 68349 and 68360.
11122 Generate output for a 520X ColdFire CPU. This is the default
11123 when the compiler is configured for 520X-based systems.
11124 It is equivalent to @option{-mcpu=5206}, and is now deprecated
11125 in favor of that option.
11127 Use this option for microcontroller with a 5200 core, including
11128 the MCF5202, MCF5203, MCF5204 and MCF5206.
11132 Generate output for a 5206e ColdFire CPU. The option is now
11133 deprecated in favor of the equivalent @option{-mcpu=5206e}.
11137 Generate output for a member of the ColdFire 528X family.
11138 The option is now deprecated in favor of the equivalent
11139 @option{-mcpu=528x}.
11143 Generate output for a ColdFire 5307 CPU. The option is now deprecated
11144 in favor of the equivalent @option{-mcpu=5307}.
11148 Generate output for a ColdFire 5407 CPU. The option is now deprecated
11149 in favor of the equivalent @option{-mcpu=5407}.
11153 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
11154 This includes use of hardware floating point instructions.
11155 The option is equivalent to @option{-mcpu=547x}, and is now
11156 deprecated in favor of that option.
11160 Generate output for a 68040, without using any of the new instructions.
11161 This results in code which can run relatively efficiently on either a
11162 68020/68881 or a 68030 or a 68040. The generated code does use the
11163 68881 instructions that are emulated on the 68040.
11165 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
11169 Generate output for a 68060, without using any of the new instructions.
11170 This results in code which can run relatively efficiently on either a
11171 68020/68881 or a 68030 or a 68040. The generated code does use the
11172 68881 instructions that are emulated on the 68060.
11174 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
11178 @opindex mhard-float
11180 Generate floating-point instructions. This is the default for 68020
11181 and above, and for ColdFire devices that have an FPU. It defines the
11182 macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
11183 on ColdFire targets.
11186 @opindex msoft-float
11187 Do not generate floating-point instructions; use library calls instead.
11188 This is the default for 68000, 68010, and 68832 targets. It is also
11189 the default for ColdFire devices that have no FPU.
11195 Generate (do not generate) ColdFire hardware divide and remainder
11196 instructions. If @option{-march} is used without @option{-mcpu},
11197 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
11198 architectures. Otherwise, the default is taken from the target CPU
11199 (either the default CPU, or the one specified by @option{-mcpu}). For
11200 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
11201 @option{-mcpu=5206e}.
11203 gcc defines the macro @samp{__mcfhwdiv__} when this option is enabled.
11207 Consider type @code{int} to be 16 bits wide, like @code{short int}.
11208 Additionally, parameters passed on the stack are also aligned to a
11209 16-bit boundary even on targets whose API mandates promotion to 32-bit.
11213 Do not consider type @code{int} to be 16 bits wide. This is the default.
11216 @itemx -mno-bitfield
11217 @opindex mnobitfield
11218 @opindex mno-bitfield
11219 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
11220 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
11224 Do use the bit-field instructions. The @option{-m68020} option implies
11225 @option{-mbitfield}. This is the default if you use a configuration
11226 designed for a 68020.
11230 Use a different function-calling convention, in which functions
11231 that take a fixed number of arguments return with the @code{rtd}
11232 instruction, which pops their arguments while returning. This
11233 saves one instruction in the caller since there is no need to pop
11234 the arguments there.
11236 This calling convention is incompatible with the one normally
11237 used on Unix, so you cannot use it if you need to call libraries
11238 compiled with the Unix compiler.
11240 Also, you must provide function prototypes for all functions that
11241 take variable numbers of arguments (including @code{printf});
11242 otherwise incorrect code will be generated for calls to those
11245 In addition, seriously incorrect code will result if you call a
11246 function with too many arguments. (Normally, extra arguments are
11247 harmlessly ignored.)
11249 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
11250 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
11254 Do not use the calling conventions selected by @option{-mrtd}.
11255 This is the default.
11258 @itemx -mno-align-int
11259 @opindex malign-int
11260 @opindex mno-align-int
11261 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
11262 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
11263 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
11264 Aligning variables on 32-bit boundaries produces code that runs somewhat
11265 faster on processors with 32-bit busses at the expense of more memory.
11267 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
11268 align structures containing the above types differently than
11269 most published application binary interface specifications for the m68k.
11273 Use the pc-relative addressing mode of the 68000 directly, instead of
11274 using a global offset table. At present, this option implies @option{-fpic},
11275 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
11276 not presently supported with @option{-mpcrel}, though this could be supported for
11277 68020 and higher processors.
11279 @item -mno-strict-align
11280 @itemx -mstrict-align
11281 @opindex mno-strict-align
11282 @opindex mstrict-align
11283 Do not (do) assume that unaligned memory references will be handled by
11287 Generate code that allows the data segment to be located in a different
11288 area of memory from the text segment. This allows for execute in place in
11289 an environment without virtual memory management. This option implies
11292 @item -mno-sep-data
11293 Generate code that assumes that the data segment follows the text segment.
11294 This is the default.
11296 @item -mid-shared-library
11297 Generate code that supports shared libraries via the library ID method.
11298 This allows for execute in place and shared libraries in an environment
11299 without virtual memory management. This option implies @option{-fPIC}.
11301 @item -mno-id-shared-library
11302 Generate code that doesn't assume ID based shared libraries are being used.
11303 This is the default.
11305 @item -mshared-library-id=n
11306 Specified the identification number of the ID based shared library being
11307 compiled. Specifying a value of 0 will generate more compact code, specifying
11308 other values will force the allocation of that number to the current
11309 library but is no more space or time efficient than omitting this option.
11313 @node M68hc1x Options
11314 @subsection M68hc1x Options
11315 @cindex M68hc1x options
11317 These are the @samp{-m} options defined for the 68hc11 and 68hc12
11318 microcontrollers. The default values for these options depends on
11319 which style of microcontroller was selected when the compiler was configured;
11320 the defaults for the most common choices are given below.
11327 Generate output for a 68HC11. This is the default
11328 when the compiler is configured for 68HC11-based systems.
11334 Generate output for a 68HC12. This is the default
11335 when the compiler is configured for 68HC12-based systems.
11341 Generate output for a 68HCS12.
11343 @item -mauto-incdec
11344 @opindex mauto-incdec
11345 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
11352 Enable the use of 68HC12 min and max instructions.
11355 @itemx -mno-long-calls
11356 @opindex mlong-calls
11357 @opindex mno-long-calls
11358 Treat all calls as being far away (near). If calls are assumed to be
11359 far away, the compiler will use the @code{call} instruction to
11360 call a function and the @code{rtc} instruction for returning.
11364 Consider type @code{int} to be 16 bits wide, like @code{short int}.
11366 @item -msoft-reg-count=@var{count}
11367 @opindex msoft-reg-count
11368 Specify the number of pseudo-soft registers which are used for the
11369 code generation. The maximum number is 32. Using more pseudo-soft
11370 register may or may not result in better code depending on the program.
11371 The default is 4 for 68HC11 and 2 for 68HC12.
11375 @node MCore Options
11376 @subsection MCore Options
11377 @cindex MCore options
11379 These are the @samp{-m} options defined for the Motorola M*Core
11385 @itemx -mno-hardlit
11387 @opindex mno-hardlit
11388 Inline constants into the code stream if it can be done in two
11389 instructions or less.
11395 Use the divide instruction. (Enabled by default).
11397 @item -mrelax-immediate
11398 @itemx -mno-relax-immediate
11399 @opindex mrelax-immediate
11400 @opindex mno-relax-immediate
11401 Allow arbitrary sized immediates in bit operations.
11403 @item -mwide-bitfields
11404 @itemx -mno-wide-bitfields
11405 @opindex mwide-bitfields
11406 @opindex mno-wide-bitfields
11407 Always treat bit-fields as int-sized.
11409 @item -m4byte-functions
11410 @itemx -mno-4byte-functions
11411 @opindex m4byte-functions
11412 @opindex mno-4byte-functions
11413 Force all functions to be aligned to a four byte boundary.
11415 @item -mcallgraph-data
11416 @itemx -mno-callgraph-data
11417 @opindex mcallgraph-data
11418 @opindex mno-callgraph-data
11419 Emit callgraph information.
11422 @itemx -mno-slow-bytes
11423 @opindex mslow-bytes
11424 @opindex mno-slow-bytes
11425 Prefer word access when reading byte quantities.
11427 @item -mlittle-endian
11428 @itemx -mbig-endian
11429 @opindex mlittle-endian
11430 @opindex mbig-endian
11431 Generate code for a little endian target.
11437 Generate code for the 210 processor.
11441 @subsection MIPS Options
11442 @cindex MIPS options
11448 Generate big-endian code.
11452 Generate little-endian code. This is the default for @samp{mips*el-*-*}
11455 @item -march=@var{arch}
11457 Generate code that will run on @var{arch}, which can be the name of a
11458 generic MIPS ISA, or the name of a particular processor.
11460 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
11461 @samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
11462 The processor names are:
11463 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
11464 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
11465 @samp{5kc}, @samp{5kf},
11467 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
11468 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
11469 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1},
11470 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
11473 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
11474 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
11475 @samp{rm7000}, @samp{rm9000},
11478 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
11479 @samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
11480 The special value @samp{from-abi} selects the
11481 most compatible architecture for the selected ABI (that is,
11482 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
11484 In processor names, a final @samp{000} can be abbreviated as @samp{k}
11485 (for example, @samp{-march=r2k}). Prefixes are optional, and
11486 @samp{vr} may be written @samp{r}.
11488 Names of the form @samp{@var{n}f2_1} refer to processors with
11489 FPUs clocked at half the rate of the core, names of the form
11490 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
11491 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
11492 processors with FPUs clocked a ratio of 3:2 with respect to the core.
11493 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
11494 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
11495 accepted as synonyms for @samp{@var{n}f1_1}.
11497 GCC defines two macros based on the value of this option. The first
11498 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
11499 a string. The second has the form @samp{_MIPS_ARCH_@var{foo}},
11500 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
11501 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
11502 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
11504 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
11505 above. In other words, it will have the full prefix and will not
11506 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
11507 the macro names the resolved architecture (either @samp{"mips1"} or
11508 @samp{"mips3"}). It names the default architecture when no
11509 @option{-march} option is given.
11511 @item -mtune=@var{arch}
11513 Optimize for @var{arch}. Among other things, this option controls
11514 the way instructions are scheduled, and the perceived cost of arithmetic
11515 operations. The list of @var{arch} values is the same as for
11518 When this option is not used, GCC will optimize for the processor
11519 specified by @option{-march}. By using @option{-march} and
11520 @option{-mtune} together, it is possible to generate code that will
11521 run on a family of processors, but optimize the code for one
11522 particular member of that family.
11524 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
11525 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
11526 @samp{-march} ones described above.
11530 Equivalent to @samp{-march=mips1}.
11534 Equivalent to @samp{-march=mips2}.
11538 Equivalent to @samp{-march=mips3}.
11542 Equivalent to @samp{-march=mips4}.
11546 Equivalent to @samp{-march=mips32}.
11550 Equivalent to @samp{-march=mips32r2}.
11554 Equivalent to @samp{-march=mips64}.
11559 @opindex mno-mips16
11560 Generate (do not generate) MIPS16 code. If GCC is targetting a
11561 MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
11573 Generate code for the given ABI@.
11575 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
11576 generates 64-bit code when you select a 64-bit architecture, but you
11577 can use @option{-mgp32} to get 32-bit code instead.
11579 For information about the O64 ABI, see
11580 @w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
11582 GCC supports a variant of the o32 ABI in which floating-point registers
11583 are 64 rather than 32 bits wide. You can select this combination with
11584 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @samp{mthc1}
11585 and @samp{mfhc1} instructions and is therefore only supported for
11586 MIPS32R2 processors.
11588 The register assignments for arguments and return values remain the
11589 same, but each scalar value is passed in a single 64-bit register
11590 rather than a pair of 32-bit registers. For example, scalar
11591 floating-point values are returned in @samp{$f0} only, not a
11592 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
11593 remains the same, but all 64 bits are saved.
11596 @itemx -mno-abicalls
11598 @opindex mno-abicalls
11599 Generate (do not generate) code that is suitable for SVR4-style
11600 dynamic objects. @option{-mabicalls} is the default for SVR4-based
11605 Generate (do not generate) code that is fully position-independent,
11606 and that can therefore be linked into shared libraries. This option
11607 only affects @option{-mabicalls}.
11609 All @option{-mabicalls} code has traditionally been position-independent,
11610 regardless of options like @option{-fPIC} and @option{-fpic}. However,
11611 as an extension, the GNU toolchain allows executables to use absolute
11612 accesses for locally-binding symbols. It can also use shorter GP
11613 initialization sequences and generate direct calls to locally-defined
11614 functions. This mode is selected by @option{-mno-shared}.
11616 @option{-mno-shared} depends on binutils 2.16 or higher and generates
11617 objects that can only be linked by the GNU linker. However, the option
11618 does not affect the ABI of the final executable; it only affects the ABI
11619 of relocatable objects. Using @option{-mno-shared} will generally make
11620 executables both smaller and quicker.
11622 @option{-mshared} is the default.
11628 Lift (do not lift) the usual restrictions on the size of the global
11631 GCC normally uses a single instruction to load values from the GOT@.
11632 While this is relatively efficient, it will only work if the GOT
11633 is smaller than about 64k. Anything larger will cause the linker
11634 to report an error such as:
11636 @cindex relocation truncated to fit (MIPS)
11638 relocation truncated to fit: R_MIPS_GOT16 foobar
11641 If this happens, you should recompile your code with @option{-mxgot}.
11642 It should then work with very large GOTs, although it will also be
11643 less efficient, since it will take three instructions to fetch the
11644 value of a global symbol.
11646 Note that some linkers can create multiple GOTs. If you have such a
11647 linker, you should only need to use @option{-mxgot} when a single object
11648 file accesses more than 64k's worth of GOT entries. Very few do.
11650 These options have no effect unless GCC is generating position
11655 Assume that general-purpose registers are 32 bits wide.
11659 Assume that general-purpose registers are 64 bits wide.
11663 Assume that floating-point registers are 32 bits wide.
11667 Assume that floating-point registers are 64 bits wide.
11670 @opindex mhard-float
11671 Use floating-point coprocessor instructions.
11674 @opindex msoft-float
11675 Do not use floating-point coprocessor instructions. Implement
11676 floating-point calculations using library calls instead.
11678 @item -msingle-float
11679 @opindex msingle-float
11680 Assume that the floating-point coprocessor only supports single-precision
11683 @item -mdouble-float
11684 @opindex mdouble-float
11685 Assume that the floating-point coprocessor supports double-precision
11686 operations. This is the default.
11692 Use (do not use) revision 1 of the MIPS DSP ASE.
11693 @xref{MIPS DSP Built-in Functions}. This option defines the
11694 preprocessor macro @samp{__mips_dsp}. It also defines
11695 @samp{__mips_dsp_rev} to 1.
11701 Use (do not use) revision 2 of the MIPS DSP ASE.
11702 @xref{MIPS DSP Built-in Functions}. This option defines the
11703 preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
11704 It also defines @samp{__mips_dsp_rev} to 2.
11707 @itemx -mno-smartmips
11708 @opindex msmartmips
11709 @opindex mno-smartmips
11710 Use (do not use) the MIPS SmartMIPS ASE.
11712 @item -mpaired-single
11713 @itemx -mno-paired-single
11714 @opindex mpaired-single
11715 @opindex mno-paired-single
11716 Use (do not use) paired-single floating-point instructions.
11717 @xref{MIPS Paired-Single Support}. This option can only be used
11718 when generating 64-bit code and requires hardware floating-point
11719 support to be enabled.
11725 Use (do not use) MIPS Digital Media Extension instructions.
11726 This option can only be used when generating 64-bit code and requires
11727 hardware floating-point support to be enabled.
11732 @opindex mno-mips3d
11733 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
11734 The option @option{-mips3d} implies @option{-mpaired-single}.
11740 Use (do not use) MT Multithreading instructions.
11744 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
11745 an explanation of the default and the way that the pointer size is
11750 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
11752 The default size of @code{int}s, @code{long}s and pointers depends on
11753 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
11754 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
11755 32-bit @code{long}s. Pointers are the same size as @code{long}s,
11756 or the same size as integer registers, whichever is smaller.
11762 Assume (do not assume) that all symbols have 32-bit values, regardless
11763 of the selected ABI@. This option is useful in combination with
11764 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
11765 to generate shorter and faster references to symbolic addresses.
11769 @cindex smaller data references (MIPS)
11770 @cindex gp-relative references (MIPS)
11771 Put global and static items less than or equal to @var{num} bytes into
11772 the small data or bss section instead of the normal data or bss section.
11773 This allows the data to be accessed using a single instruction.
11775 All modules should be compiled with the same @option{-G @var{num}}
11778 @item -membedded-data
11779 @itemx -mno-embedded-data
11780 @opindex membedded-data
11781 @opindex mno-embedded-data
11782 Allocate variables to the read-only data section first if possible, then
11783 next in the small data section if possible, otherwise in data. This gives
11784 slightly slower code than the default, but reduces the amount of RAM required
11785 when executing, and thus may be preferred for some embedded systems.
11787 @item -muninit-const-in-rodata
11788 @itemx -mno-uninit-const-in-rodata
11789 @opindex muninit-const-in-rodata
11790 @opindex mno-uninit-const-in-rodata
11791 Put uninitialized @code{const} variables in the read-only data section.
11792 This option is only meaningful in conjunction with @option{-membedded-data}.
11794 @item -mcode-readable=@var{setting}
11795 @opindex mcode-readable
11796 Specify whether GCC may generate code that reads from executable sections.
11797 There are three possible settings:
11800 @item -mcode-readable=yes
11801 Instructions may freely access executable sections. This is the
11804 @item -mcode-readable=pcrel
11805 MIPS16 PC-relative load instructions can access executable sections,
11806 but other instructions must not do so. This option is useful on 4KSc
11807 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
11808 It is also useful on processors that can be configured to have a dual
11809 instruction/data SRAM interface and that, like the M4K, automatically
11810 redirect PC-relative loads to the instruction RAM.
11812 @item -mcode-readable=no
11813 Instructions must not access executable sections. This option can be
11814 useful on targets that are configured to have a dual instruction/data
11815 SRAM interface but that (unlike the M4K) do not automatically redirect
11816 PC-relative loads to the instruction RAM.
11819 @item -msplit-addresses
11820 @itemx -mno-split-addresses
11821 @opindex msplit-addresses
11822 @opindex mno-split-addresses
11823 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
11824 relocation operators. This option has been superseded by
11825 @option{-mexplicit-relocs} but is retained for backwards compatibility.
11827 @item -mexplicit-relocs
11828 @itemx -mno-explicit-relocs
11829 @opindex mexplicit-relocs
11830 @opindex mno-explicit-relocs
11831 Use (do not use) assembler relocation operators when dealing with symbolic
11832 addresses. The alternative, selected by @option{-mno-explicit-relocs},
11833 is to use assembler macros instead.
11835 @option{-mexplicit-relocs} is the default if GCC was configured
11836 to use an assembler that supports relocation operators.
11838 @item -mcheck-zero-division
11839 @itemx -mno-check-zero-division
11840 @opindex mcheck-zero-division
11841 @opindex mno-check-zero-division
11842 Trap (do not trap) on integer division by zero.
11844 The default is @option{-mcheck-zero-division}.
11846 @item -mdivide-traps
11847 @itemx -mdivide-breaks
11848 @opindex mdivide-traps
11849 @opindex mdivide-breaks
11850 MIPS systems check for division by zero by generating either a
11851 conditional trap or a break instruction. Using traps results in
11852 smaller code, but is only supported on MIPS II and later. Also, some
11853 versions of the Linux kernel have a bug that prevents trap from
11854 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
11855 allow conditional traps on architectures that support them and
11856 @option{-mdivide-breaks} to force the use of breaks.
11858 The default is usually @option{-mdivide-traps}, but this can be
11859 overridden at configure time using @option{--with-divide=breaks}.
11860 Divide-by-zero checks can be completely disabled using
11861 @option{-mno-check-zero-division}.
11866 @opindex mno-memcpy
11867 Force (do not force) the use of @code{memcpy()} for non-trivial block
11868 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
11869 most constant-sized copies.
11872 @itemx -mno-long-calls
11873 @opindex mlong-calls
11874 @opindex mno-long-calls
11875 Disable (do not disable) use of the @code{jal} instruction. Calling
11876 functions using @code{jal} is more efficient but requires the caller
11877 and callee to be in the same 256 megabyte segment.
11879 This option has no effect on abicalls code. The default is
11880 @option{-mno-long-calls}.
11886 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
11887 instructions, as provided by the R4650 ISA@.
11890 @itemx -mno-fused-madd
11891 @opindex mfused-madd
11892 @opindex mno-fused-madd
11893 Enable (disable) use of the floating point multiply-accumulate
11894 instructions, when they are available. The default is
11895 @option{-mfused-madd}.
11897 When multiply-accumulate instructions are used, the intermediate
11898 product is calculated to infinite precision and is not subject to
11899 the FCSR Flush to Zero bit. This may be undesirable in some
11904 Tell the MIPS assembler to not run its preprocessor over user
11905 assembler files (with a @samp{.s} suffix) when assembling them.
11908 @itemx -mno-fix-r4000
11909 @opindex mfix-r4000
11910 @opindex mno-fix-r4000
11911 Work around certain R4000 CPU errata:
11914 A double-word or a variable shift may give an incorrect result if executed
11915 immediately after starting an integer division.
11917 A double-word or a variable shift may give an incorrect result if executed
11918 while an integer multiplication is in progress.
11920 An integer division may give an incorrect result if started in a delay slot
11921 of a taken branch or a jump.
11925 @itemx -mno-fix-r4400
11926 @opindex mfix-r4400
11927 @opindex mno-fix-r4400
11928 Work around certain R4400 CPU errata:
11931 A double-word or a variable shift may give an incorrect result if executed
11932 immediately after starting an integer division.
11936 @itemx -mno-fix-vr4120
11937 @opindex mfix-vr4120
11938 Work around certain VR4120 errata:
11941 @code{dmultu} does not always produce the correct result.
11943 @code{div} and @code{ddiv} do not always produce the correct result if one
11944 of the operands is negative.
11946 The workarounds for the division errata rely on special functions in
11947 @file{libgcc.a}. At present, these functions are only provided by
11948 the @code{mips64vr*-elf} configurations.
11950 Other VR4120 errata require a nop to be inserted between certain pairs of
11951 instructions. These errata are handled by the assembler, not by GCC itself.
11954 @opindex mfix-vr4130
11955 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
11956 workarounds are implemented by the assembler rather than by GCC,
11957 although GCC will avoid using @code{mflo} and @code{mfhi} if the
11958 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
11959 instructions are available instead.
11962 @itemx -mno-fix-sb1
11964 Work around certain SB-1 CPU core errata.
11965 (This flag currently works around the SB-1 revision 2
11966 ``F1'' and ``F2'' floating point errata.)
11968 @item -mflush-func=@var{func}
11969 @itemx -mno-flush-func
11970 @opindex mflush-func
11971 Specifies the function to call to flush the I and D caches, or to not
11972 call any such function. If called, the function must take the same
11973 arguments as the common @code{_flush_func()}, that is, the address of the
11974 memory range for which the cache is being flushed, the size of the
11975 memory range, and the number 3 (to flush both caches). The default
11976 depends on the target GCC was configured for, but commonly is either
11977 @samp{_flush_func} or @samp{__cpu_flush}.
11979 @item mbranch-cost=@var{num}
11980 @opindex mbranch-cost
11981 Set the cost of branches to roughly @var{num} ``simple'' instructions.
11982 This cost is only a heuristic and is not guaranteed to produce
11983 consistent results across releases. A zero cost redundantly selects
11984 the default, which is based on the @option{-mtune} setting.
11986 @item -mbranch-likely
11987 @itemx -mno-branch-likely
11988 @opindex mbranch-likely
11989 @opindex mno-branch-likely
11990 Enable or disable use of Branch Likely instructions, regardless of the
11991 default for the selected architecture. By default, Branch Likely
11992 instructions may be generated if they are supported by the selected
11993 architecture. An exception is for the MIPS32 and MIPS64 architectures
11994 and processors which implement those architectures; for those, Branch
11995 Likely instructions will not be generated by default because the MIPS32
11996 and MIPS64 architectures specifically deprecate their use.
11998 @item -mfp-exceptions
11999 @itemx -mno-fp-exceptions
12000 @opindex mfp-exceptions
12001 Specifies whether FP exceptions are enabled. This affects how we schedule
12002 FP instructions for some processors. The default is that FP exceptions are
12005 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
12006 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
12009 @item -mvr4130-align
12010 @itemx -mno-vr4130-align
12011 @opindex mvr4130-align
12012 The VR4130 pipeline is two-way superscalar, but can only issue two
12013 instructions together if the first one is 8-byte aligned. When this
12014 option is enabled, GCC will align pairs of instructions that it
12015 thinks should execute in parallel.
12017 This option only has an effect when optimizing for the VR4130.
12018 It normally makes code faster, but at the expense of making it bigger.
12019 It is enabled by default at optimization level @option{-O3}.
12023 @subsection MMIX Options
12024 @cindex MMIX Options
12026 These options are defined for the MMIX:
12030 @itemx -mno-libfuncs
12032 @opindex mno-libfuncs
12033 Specify that intrinsic library functions are being compiled, passing all
12034 values in registers, no matter the size.
12037 @itemx -mno-epsilon
12039 @opindex mno-epsilon
12040 Generate floating-point comparison instructions that compare with respect
12041 to the @code{rE} epsilon register.
12043 @item -mabi=mmixware
12045 @opindex mabi-mmixware
12047 Generate code that passes function parameters and return values that (in
12048 the called function) are seen as registers @code{$0} and up, as opposed to
12049 the GNU ABI which uses global registers @code{$231} and up.
12051 @item -mzero-extend
12052 @itemx -mno-zero-extend
12053 @opindex mzero-extend
12054 @opindex mno-zero-extend
12055 When reading data from memory in sizes shorter than 64 bits, use (do not
12056 use) zero-extending load instructions by default, rather than
12057 sign-extending ones.
12060 @itemx -mno-knuthdiv
12062 @opindex mno-knuthdiv
12063 Make the result of a division yielding a remainder have the same sign as
12064 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
12065 remainder follows the sign of the dividend. Both methods are
12066 arithmetically valid, the latter being almost exclusively used.
12068 @item -mtoplevel-symbols
12069 @itemx -mno-toplevel-symbols
12070 @opindex mtoplevel-symbols
12071 @opindex mno-toplevel-symbols
12072 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
12073 code can be used with the @code{PREFIX} assembly directive.
12077 Generate an executable in the ELF format, rather than the default
12078 @samp{mmo} format used by the @command{mmix} simulator.
12080 @item -mbranch-predict
12081 @itemx -mno-branch-predict
12082 @opindex mbranch-predict
12083 @opindex mno-branch-predict
12084 Use (do not use) the probable-branch instructions, when static branch
12085 prediction indicates a probable branch.
12087 @item -mbase-addresses
12088 @itemx -mno-base-addresses
12089 @opindex mbase-addresses
12090 @opindex mno-base-addresses
12091 Generate (do not generate) code that uses @emph{base addresses}. Using a
12092 base address automatically generates a request (handled by the assembler
12093 and the linker) for a constant to be set up in a global register. The
12094 register is used for one or more base address requests within the range 0
12095 to 255 from the value held in the register. The generally leads to short
12096 and fast code, but the number of different data items that can be
12097 addressed is limited. This means that a program that uses lots of static
12098 data may require @option{-mno-base-addresses}.
12100 @item -msingle-exit
12101 @itemx -mno-single-exit
12102 @opindex msingle-exit
12103 @opindex mno-single-exit
12104 Force (do not force) generated code to have a single exit point in each
12108 @node MN10300 Options
12109 @subsection MN10300 Options
12110 @cindex MN10300 options
12112 These @option{-m} options are defined for Matsushita MN10300 architectures:
12117 Generate code to avoid bugs in the multiply instructions for the MN10300
12118 processors. This is the default.
12120 @item -mno-mult-bug
12121 @opindex mno-mult-bug
12122 Do not generate code to avoid bugs in the multiply instructions for the
12123 MN10300 processors.
12127 Generate code which uses features specific to the AM33 processor.
12131 Do not generate code which uses features specific to the AM33 processor. This
12134 @item -mreturn-pointer-on-d0
12135 @opindex mreturn-pointer-on-d0
12136 When generating a function which returns a pointer, return the pointer
12137 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
12138 only in a0, and attempts to call such functions without a prototype
12139 would result in errors. Note that this option is on by default; use
12140 @option{-mno-return-pointer-on-d0} to disable it.
12144 Do not link in the C run-time initialization object file.
12148 Indicate to the linker that it should perform a relaxation optimization pass
12149 to shorten branches, calls and absolute memory addresses. This option only
12150 has an effect when used on the command line for the final link step.
12152 This option makes symbolic debugging impossible.
12156 @subsection MT Options
12159 These @option{-m} options are defined for Morpho MT architectures:
12163 @item -march=@var{cpu-type}
12165 Generate code that will run on @var{cpu-type}, which is the name of a system
12166 representing a certain processor type. Possible values for
12167 @var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002},
12168 @samp{ms1-16-003} and @samp{ms2}.
12170 When this option is not used, the default is @option{-march=ms1-16-002}.
12174 Use byte loads and stores when generating code.
12178 Do not use byte loads and stores when generating code.
12182 Use simulator runtime
12186 Do not link in the C run-time initialization object file
12187 @file{crti.o}. Other run-time initialization and termination files
12188 such as @file{startup.o} and @file{exit.o} are still included on the
12189 linker command line.
12193 @node PDP-11 Options
12194 @subsection PDP-11 Options
12195 @cindex PDP-11 Options
12197 These options are defined for the PDP-11:
12202 Use hardware FPP floating point. This is the default. (FIS floating
12203 point on the PDP-11/40 is not supported.)
12206 @opindex msoft-float
12207 Do not use hardware floating point.
12211 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
12215 Return floating-point results in memory. This is the default.
12219 Generate code for a PDP-11/40.
12223 Generate code for a PDP-11/45. This is the default.
12227 Generate code for a PDP-11/10.
12229 @item -mbcopy-builtin
12230 @opindex bcopy-builtin
12231 Use inline @code{movmemhi} patterns for copying memory. This is the
12236 Do not use inline @code{movmemhi} patterns for copying memory.
12242 Use 16-bit @code{int}. This is the default.
12248 Use 32-bit @code{int}.
12251 @itemx -mno-float32
12253 @opindex mno-float32
12254 Use 64-bit @code{float}. This is the default.
12257 @itemx -mno-float64
12259 @opindex mno-float64
12260 Use 32-bit @code{float}.
12264 Use @code{abshi2} pattern. This is the default.
12268 Do not use @code{abshi2} pattern.
12270 @item -mbranch-expensive
12271 @opindex mbranch-expensive
12272 Pretend that branches are expensive. This is for experimenting with
12273 code generation only.
12275 @item -mbranch-cheap
12276 @opindex mbranch-cheap
12277 Do not pretend that branches are expensive. This is the default.
12281 Generate code for a system with split I&D@.
12285 Generate code for a system without split I&D@. This is the default.
12289 Use Unix assembler syntax. This is the default when configured for
12290 @samp{pdp11-*-bsd}.
12294 Use DEC assembler syntax. This is the default when configured for any
12295 PDP-11 target other than @samp{pdp11-*-bsd}.
12298 @node PowerPC Options
12299 @subsection PowerPC Options
12300 @cindex PowerPC options
12302 These are listed under @xref{RS/6000 and PowerPC Options}.
12304 @node RS/6000 and PowerPC Options
12305 @subsection IBM RS/6000 and PowerPC Options
12306 @cindex RS/6000 and PowerPC Options
12307 @cindex IBM RS/6000 and PowerPC Options
12309 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
12316 @itemx -mno-powerpc
12317 @itemx -mpowerpc-gpopt
12318 @itemx -mno-powerpc-gpopt
12319 @itemx -mpowerpc-gfxopt
12320 @itemx -mno-powerpc-gfxopt
12322 @itemx -mno-powerpc64
12326 @itemx -mno-popcntb
12338 @opindex mno-power2
12340 @opindex mno-powerpc
12341 @opindex mpowerpc-gpopt
12342 @opindex mno-powerpc-gpopt
12343 @opindex mpowerpc-gfxopt
12344 @opindex mno-powerpc-gfxopt
12345 @opindex mpowerpc64
12346 @opindex mno-powerpc64
12350 @opindex mno-popcntb
12356 @opindex mno-mfpgpr
12359 GCC supports two related instruction set architectures for the
12360 RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
12361 instructions supported by the @samp{rios} chip set used in the original
12362 RS/6000 systems and the @dfn{PowerPC} instruction set is the
12363 architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
12364 the IBM 4xx, 6xx, and follow-on microprocessors.
12366 Neither architecture is a subset of the other. However there is a
12367 large common subset of instructions supported by both. An MQ
12368 register is included in processors supporting the POWER architecture.
12370 You use these options to specify which instructions are available on the
12371 processor you are using. The default value of these options is
12372 determined when configuring GCC@. Specifying the
12373 @option{-mcpu=@var{cpu_type}} overrides the specification of these
12374 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
12375 rather than the options listed above.
12377 The @option{-mpower} option allows GCC to generate instructions that
12378 are found only in the POWER architecture and to use the MQ register.
12379 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
12380 to generate instructions that are present in the POWER2 architecture but
12381 not the original POWER architecture.
12383 The @option{-mpowerpc} option allows GCC to generate instructions that
12384 are found only in the 32-bit subset of the PowerPC architecture.
12385 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
12386 GCC to use the optional PowerPC architecture instructions in the
12387 General Purpose group, including floating-point square root. Specifying
12388 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
12389 use the optional PowerPC architecture instructions in the Graphics
12390 group, including floating-point select.
12392 The @option{-mmfcrf} option allows GCC to generate the move from
12393 condition register field instruction implemented on the POWER4
12394 processor and other processors that support the PowerPC V2.01
12396 The @option{-mpopcntb} option allows GCC to generate the popcount and
12397 double precision FP reciprocal estimate instruction implemented on the
12398 POWER5 processor and other processors that support the PowerPC V2.02
12400 The @option{-mfprnd} option allows GCC to generate the FP round to
12401 integer instructions implemented on the POWER5+ processor and other
12402 processors that support the PowerPC V2.03 architecture.
12403 The @option{-mcmpb} option allows GCC to generate the compare bytes
12404 instruction implemented on the POWER6 processor and other processors
12405 that support the PowerPC V2.05 architecture.
12406 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
12407 general purpose register instructions implemented on the POWER6X
12408 processor and other processors that support the extended PowerPC V2.05
12410 The @option{-mdfp} option allows GCC to generate the decimal floating
12411 point instructions implemented on some POWER processors.
12413 The @option{-mpowerpc64} option allows GCC to generate the additional
12414 64-bit instructions that are found in the full PowerPC64 architecture
12415 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
12416 @option{-mno-powerpc64}.
12418 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
12419 will use only the instructions in the common subset of both
12420 architectures plus some special AIX common-mode calls, and will not use
12421 the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc}
12422 permits GCC to use any instruction from either architecture and to
12423 allow use of the MQ register; specify this for the Motorola MPC601.
12425 @item -mnew-mnemonics
12426 @itemx -mold-mnemonics
12427 @opindex mnew-mnemonics
12428 @opindex mold-mnemonics
12429 Select which mnemonics to use in the generated assembler code. With
12430 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
12431 the PowerPC architecture. With @option{-mold-mnemonics} it uses the
12432 assembler mnemonics defined for the POWER architecture. Instructions
12433 defined in only one architecture have only one mnemonic; GCC uses that
12434 mnemonic irrespective of which of these options is specified.
12436 GCC defaults to the mnemonics appropriate for the architecture in
12437 use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
12438 value of these option. Unless you are building a cross-compiler, you
12439 should normally not specify either @option{-mnew-mnemonics} or
12440 @option{-mold-mnemonics}, but should instead accept the default.
12442 @item -mcpu=@var{cpu_type}
12444 Set architecture type, register usage, choice of mnemonics, and
12445 instruction scheduling parameters for machine type @var{cpu_type}.
12446 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
12447 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
12448 @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
12449 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
12450 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
12451 @samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3},
12452 @samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
12453 @samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6},
12454 @samp{power6x}, @samp{common}, @samp{powerpc}, @samp{powerpc64},
12455 @samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
12457 @option{-mcpu=common} selects a completely generic processor. Code
12458 generated under this option will run on any POWER or PowerPC processor.
12459 GCC will use only the instructions in the common subset of both
12460 architectures, and will not use the MQ register. GCC assumes a generic
12461 processor model for scheduling purposes.
12463 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
12464 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
12465 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
12466 types, with an appropriate, generic processor model assumed for
12467 scheduling purposes.
12469 The other options specify a specific processor. Code generated under
12470 those options will run best on that processor, and may not run at all on
12473 The @option{-mcpu} options automatically enable or disable the
12476 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
12477 -mnew-mnemonics -mpopcntb -mpower -mpower2 -mpowerpc64 @gol
12478 -mpowerpc-gpopt -mpowerpc-gfxopt -mstring -mmulhw -mdlmzb -mmfpgpr}
12480 The particular options set for any particular CPU will vary between
12481 compiler versions, depending on what setting seems to produce optimal
12482 code for that CPU; it doesn't necessarily reflect the actual hardware's
12483 capabilities. If you wish to set an individual option to a particular
12484 value, you may specify it after the @option{-mcpu} option, like
12485 @samp{-mcpu=970 -mno-altivec}.
12487 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
12488 not enabled or disabled by the @option{-mcpu} option at present because
12489 AIX does not have full support for these options. You may still
12490 enable or disable them individually if you're sure it'll work in your
12493 @item -mtune=@var{cpu_type}
12495 Set the instruction scheduling parameters for machine type
12496 @var{cpu_type}, but do not set the architecture type, register usage, or
12497 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same
12498 values for @var{cpu_type} are used for @option{-mtune} as for
12499 @option{-mcpu}. If both are specified, the code generated will use the
12500 architecture, registers, and mnemonics set by @option{-mcpu}, but the
12501 scheduling parameters set by @option{-mtune}.
12507 Generate code to compute division as reciprocal estimate and iterative
12508 refinement, creating opportunities for increased throughput. This
12509 feature requires: optional PowerPC Graphics instruction set for single
12510 precision and FRE instruction for double precision, assuming divides
12511 cannot generate user-visible traps, and the domain values not include
12512 Infinities, denormals or zero denominator.
12515 @itemx -mno-altivec
12517 @opindex mno-altivec
12518 Generate code that uses (does not use) AltiVec instructions, and also
12519 enable the use of built-in functions that allow more direct access to
12520 the AltiVec instruction set. You may also need to set
12521 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
12527 @opindex mno-vrsave
12528 Generate VRSAVE instructions when generating AltiVec code.
12531 @opindex msecure-plt
12532 Generate code that allows ld and ld.so to build executables and shared
12533 libraries with non-exec .plt and .got sections. This is a PowerPC
12534 32-bit SYSV ABI option.
12538 Generate code that uses a BSS .plt section that ld.so fills in, and
12539 requires .plt and .got sections that are both writable and executable.
12540 This is a PowerPC 32-bit SYSV ABI option.
12546 This switch enables or disables the generation of ISEL instructions.
12548 @item -misel=@var{yes/no}
12549 This switch has been deprecated. Use @option{-misel} and
12550 @option{-mno-isel} instead.
12556 This switch enables or disables the generation of SPE simd
12559 @item -mspe=@var{yes/no}
12560 This option has been deprecated. Use @option{-mspe} and
12561 @option{-mno-spe} instead.
12563 @item -mfloat-gprs=@var{yes/single/double/no}
12564 @itemx -mfloat-gprs
12565 @opindex mfloat-gprs
12566 This switch enables or disables the generation of floating point
12567 operations on the general purpose registers for architectures that
12570 The argument @var{yes} or @var{single} enables the use of
12571 single-precision floating point operations.
12573 The argument @var{double} enables the use of single and
12574 double-precision floating point operations.
12576 The argument @var{no} disables floating point operations on the
12577 general purpose registers.
12579 This option is currently only available on the MPC854x.
12585 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
12586 targets (including GNU/Linux). The 32-bit environment sets int, long
12587 and pointer to 32 bits and generates code that runs on any PowerPC
12588 variant. The 64-bit environment sets int to 32 bits and long and
12589 pointer to 64 bits, and generates code for PowerPC64, as for
12590 @option{-mpowerpc64}.
12593 @itemx -mno-fp-in-toc
12594 @itemx -mno-sum-in-toc
12595 @itemx -mminimal-toc
12597 @opindex mno-fp-in-toc
12598 @opindex mno-sum-in-toc
12599 @opindex mminimal-toc
12600 Modify generation of the TOC (Table Of Contents), which is created for
12601 every executable file. The @option{-mfull-toc} option is selected by
12602 default. In that case, GCC will allocate at least one TOC entry for
12603 each unique non-automatic variable reference in your program. GCC
12604 will also place floating-point constants in the TOC@. However, only
12605 16,384 entries are available in the TOC@.
12607 If you receive a linker error message that saying you have overflowed
12608 the available TOC space, you can reduce the amount of TOC space used
12609 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
12610 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
12611 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
12612 generate code to calculate the sum of an address and a constant at
12613 run-time instead of putting that sum into the TOC@. You may specify one
12614 or both of these options. Each causes GCC to produce very slightly
12615 slower and larger code at the expense of conserving TOC space.
12617 If you still run out of space in the TOC even when you specify both of
12618 these options, specify @option{-mminimal-toc} instead. This option causes
12619 GCC to make only one TOC entry for every file. When you specify this
12620 option, GCC will produce code that is slower and larger but which
12621 uses extremely little TOC space. You may wish to use this option
12622 only on files that contain less frequently executed code.
12628 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
12629 @code{long} type, and the infrastructure needed to support them.
12630 Specifying @option{-maix64} implies @option{-mpowerpc64} and
12631 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
12632 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
12635 @itemx -mno-xl-compat
12636 @opindex mxl-compat
12637 @opindex mno-xl-compat
12638 Produce code that conforms more closely to IBM XL compiler semantics
12639 when using AIX-compatible ABI. Pass floating-point arguments to
12640 prototyped functions beyond the register save area (RSA) on the stack
12641 in addition to argument FPRs. Do not assume that most significant
12642 double in 128-bit long double value is properly rounded when comparing
12643 values and converting to double. Use XL symbol names for long double
12646 The AIX calling convention was extended but not initially documented to
12647 handle an obscure K&R C case of calling a function that takes the
12648 address of its arguments with fewer arguments than declared. IBM XL
12649 compilers access floating point arguments which do not fit in the
12650 RSA from the stack when a subroutine is compiled without
12651 optimization. Because always storing floating-point arguments on the
12652 stack is inefficient and rarely needed, this option is not enabled by
12653 default and only is necessary when calling subroutines compiled by IBM
12654 XL compilers without optimization.
12658 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
12659 application written to use message passing with special startup code to
12660 enable the application to run. The system must have PE installed in the
12661 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
12662 must be overridden with the @option{-specs=} option to specify the
12663 appropriate directory location. The Parallel Environment does not
12664 support threads, so the @option{-mpe} option and the @option{-pthread}
12665 option are incompatible.
12667 @item -malign-natural
12668 @itemx -malign-power
12669 @opindex malign-natural
12670 @opindex malign-power
12671 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
12672 @option{-malign-natural} overrides the ABI-defined alignment of larger
12673 types, such as floating-point doubles, on their natural size-based boundary.
12674 The option @option{-malign-power} instructs GCC to follow the ABI-specified
12675 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
12677 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
12681 @itemx -mhard-float
12682 @opindex msoft-float
12683 @opindex mhard-float
12684 Generate code that does not use (uses) the floating-point register set.
12685 Software floating point emulation is provided if you use the
12686 @option{-msoft-float} option, and pass the option to GCC when linking.
12689 @itemx -mno-multiple
12691 @opindex mno-multiple
12692 Generate code that uses (does not use) the load multiple word
12693 instructions and the store multiple word instructions. These
12694 instructions are generated by default on POWER systems, and not
12695 generated on PowerPC systems. Do not use @option{-mmultiple} on little
12696 endian PowerPC systems, since those instructions do not work when the
12697 processor is in little endian mode. The exceptions are PPC740 and
12698 PPC750 which permit the instructions usage in little endian mode.
12703 @opindex mno-string
12704 Generate code that uses (does not use) the load string instructions
12705 and the store string word instructions to save multiple registers and
12706 do small block moves. These instructions are generated by default on
12707 POWER systems, and not generated on PowerPC systems. Do not use
12708 @option{-mstring} on little endian PowerPC systems, since those
12709 instructions do not work when the processor is in little endian mode.
12710 The exceptions are PPC740 and PPC750 which permit the instructions
12711 usage in little endian mode.
12716 @opindex mno-update
12717 Generate code that uses (does not use) the load or store instructions
12718 that update the base register to the address of the calculated memory
12719 location. These instructions are generated by default. If you use
12720 @option{-mno-update}, there is a small window between the time that the
12721 stack pointer is updated and the address of the previous frame is
12722 stored, which means code that walks the stack frame across interrupts or
12723 signals may get corrupted data.
12726 @itemx -mno-fused-madd
12727 @opindex mfused-madd
12728 @opindex mno-fused-madd
12729 Generate code that uses (does not use) the floating point multiply and
12730 accumulate instructions. These instructions are generated by default if
12731 hardware floating is used.
12737 Generate code that uses (does not use) the half-word multiply and
12738 multiply-accumulate instructions on the IBM 405 and 440 processors.
12739 These instructions are generated by default when targetting those
12746 Generate code that uses (does not use) the string-search @samp{dlmzb}
12747 instruction on the IBM 405 and 440 processors. This instruction is
12748 generated by default when targetting those processors.
12750 @item -mno-bit-align
12752 @opindex mno-bit-align
12753 @opindex mbit-align
12754 On System V.4 and embedded PowerPC systems do not (do) force structures
12755 and unions that contain bit-fields to be aligned to the base type of the
12758 For example, by default a structure containing nothing but 8
12759 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
12760 boundary and have a size of 4 bytes. By using @option{-mno-bit-align},
12761 the structure would be aligned to a 1 byte boundary and be one byte in
12764 @item -mno-strict-align
12765 @itemx -mstrict-align
12766 @opindex mno-strict-align
12767 @opindex mstrict-align
12768 On System V.4 and embedded PowerPC systems do not (do) assume that
12769 unaligned memory references will be handled by the system.
12771 @item -mrelocatable
12772 @itemx -mno-relocatable
12773 @opindex mrelocatable
12774 @opindex mno-relocatable
12775 On embedded PowerPC systems generate code that allows (does not allow)
12776 the program to be relocated to a different address at runtime. If you
12777 use @option{-mrelocatable} on any module, all objects linked together must
12778 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
12780 @item -mrelocatable-lib
12781 @itemx -mno-relocatable-lib
12782 @opindex mrelocatable-lib
12783 @opindex mno-relocatable-lib
12784 On embedded PowerPC systems generate code that allows (does not allow)
12785 the program to be relocated to a different address at runtime. Modules
12786 compiled with @option{-mrelocatable-lib} can be linked with either modules
12787 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
12788 with modules compiled with the @option{-mrelocatable} options.
12794 On System V.4 and embedded PowerPC systems do not (do) assume that
12795 register 2 contains a pointer to a global area pointing to the addresses
12796 used in the program.
12799 @itemx -mlittle-endian
12801 @opindex mlittle-endian
12802 On System V.4 and embedded PowerPC systems compile code for the
12803 processor in little endian mode. The @option{-mlittle-endian} option is
12804 the same as @option{-mlittle}.
12807 @itemx -mbig-endian
12809 @opindex mbig-endian
12810 On System V.4 and embedded PowerPC systems compile code for the
12811 processor in big endian mode. The @option{-mbig-endian} option is
12812 the same as @option{-mbig}.
12814 @item -mdynamic-no-pic
12815 @opindex mdynamic-no-pic
12816 On Darwin and Mac OS X systems, compile code so that it is not
12817 relocatable, but that its external references are relocatable. The
12818 resulting code is suitable for applications, but not shared
12821 @item -mprioritize-restricted-insns=@var{priority}
12822 @opindex mprioritize-restricted-insns
12823 This option controls the priority that is assigned to
12824 dispatch-slot restricted instructions during the second scheduling
12825 pass. The argument @var{priority} takes the value @var{0/1/2} to assign
12826 @var{no/highest/second-highest} priority to dispatch slot restricted
12829 @item -msched-costly-dep=@var{dependence_type}
12830 @opindex msched-costly-dep
12831 This option controls which dependences are considered costly
12832 by the target during instruction scheduling. The argument
12833 @var{dependence_type} takes one of the following values:
12834 @var{no}: no dependence is costly,
12835 @var{all}: all dependences are costly,
12836 @var{true_store_to_load}: a true dependence from store to load is costly,
12837 @var{store_to_load}: any dependence from store to load is costly,
12838 @var{number}: any dependence which latency >= @var{number} is costly.
12840 @item -minsert-sched-nops=@var{scheme}
12841 @opindex minsert-sched-nops
12842 This option controls which nop insertion scheme will be used during
12843 the second scheduling pass. The argument @var{scheme} takes one of the
12845 @var{no}: Don't insert nops.
12846 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
12847 according to the scheduler's grouping.
12848 @var{regroup_exact}: Insert nops to force costly dependent insns into
12849 separate groups. Insert exactly as many nops as needed to force an insn
12850 to a new group, according to the estimated processor grouping.
12851 @var{number}: Insert nops to force costly dependent insns into
12852 separate groups. Insert @var{number} nops to force an insn to a new group.
12855 @opindex mcall-sysv
12856 On System V.4 and embedded PowerPC systems compile code using calling
12857 conventions that adheres to the March 1995 draft of the System V
12858 Application Binary Interface, PowerPC processor supplement. This is the
12859 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
12861 @item -mcall-sysv-eabi
12862 @opindex mcall-sysv-eabi
12863 Specify both @option{-mcall-sysv} and @option{-meabi} options.
12865 @item -mcall-sysv-noeabi
12866 @opindex mcall-sysv-noeabi
12867 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
12869 @item -mcall-solaris
12870 @opindex mcall-solaris
12871 On System V.4 and embedded PowerPC systems compile code for the Solaris
12875 @opindex mcall-linux
12876 On System V.4 and embedded PowerPC systems compile code for the
12877 Linux-based GNU system.
12881 On System V.4 and embedded PowerPC systems compile code for the
12882 Hurd-based GNU system.
12884 @item -mcall-netbsd
12885 @opindex mcall-netbsd
12886 On System V.4 and embedded PowerPC systems compile code for the
12887 NetBSD operating system.
12889 @item -maix-struct-return
12890 @opindex maix-struct-return
12891 Return all structures in memory (as specified by the AIX ABI)@.
12893 @item -msvr4-struct-return
12894 @opindex msvr4-struct-return
12895 Return structures smaller than 8 bytes in registers (as specified by the
12898 @item -mabi=@var{abi-type}
12900 Extend the current ABI with a particular extension, or remove such extension.
12901 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
12902 @var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
12906 Extend the current ABI with SPE ABI extensions. This does not change
12907 the default ABI, instead it adds the SPE ABI extensions to the current
12911 @opindex mabi=no-spe
12912 Disable Booke SPE ABI extensions for the current ABI@.
12914 @item -mabi=ibmlongdouble
12915 @opindex mabi=ibmlongdouble
12916 Change the current ABI to use IBM extended precision long double.
12917 This is a PowerPC 32-bit SYSV ABI option.
12919 @item -mabi=ieeelongdouble
12920 @opindex mabi=ieeelongdouble
12921 Change the current ABI to use IEEE extended precision long double.
12922 This is a PowerPC 32-bit Linux ABI option.
12925 @itemx -mno-prototype
12926 @opindex mprototype
12927 @opindex mno-prototype
12928 On System V.4 and embedded PowerPC systems assume that all calls to
12929 variable argument functions are properly prototyped. Otherwise, the
12930 compiler must insert an instruction before every non prototyped call to
12931 set or clear bit 6 of the condition code register (@var{CR}) to
12932 indicate whether floating point values were passed in the floating point
12933 registers in case the function takes a variable arguments. With
12934 @option{-mprototype}, only calls to prototyped variable argument functions
12935 will set or clear the bit.
12939 On embedded PowerPC systems, assume that the startup module is called
12940 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
12941 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}.
12946 On embedded PowerPC systems, assume that the startup module is called
12947 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
12952 On embedded PowerPC systems, assume that the startup module is called
12953 @file{crt0.o} and the standard C libraries are @file{libads.a} and
12956 @item -myellowknife
12957 @opindex myellowknife
12958 On embedded PowerPC systems, assume that the startup module is called
12959 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
12964 On System V.4 and embedded PowerPC systems, specify that you are
12965 compiling for a VxWorks system.
12969 Specify that you are compiling for the WindISS simulation environment.
12973 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
12974 header to indicate that @samp{eabi} extended relocations are used.
12980 On System V.4 and embedded PowerPC systems do (do not) adhere to the
12981 Embedded Applications Binary Interface (eabi) which is a set of
12982 modifications to the System V.4 specifications. Selecting @option{-meabi}
12983 means that the stack is aligned to an 8 byte boundary, a function
12984 @code{__eabi} is called to from @code{main} to set up the eabi
12985 environment, and the @option{-msdata} option can use both @code{r2} and
12986 @code{r13} to point to two separate small data areas. Selecting
12987 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
12988 do not call an initialization function from @code{main}, and the
12989 @option{-msdata} option will only use @code{r13} to point to a single
12990 small data area. The @option{-meabi} option is on by default if you
12991 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
12994 @opindex msdata=eabi
12995 On System V.4 and embedded PowerPC systems, put small initialized
12996 @code{const} global and static data in the @samp{.sdata2} section, which
12997 is pointed to by register @code{r2}. Put small initialized
12998 non-@code{const} global and static data in the @samp{.sdata} section,
12999 which is pointed to by register @code{r13}. Put small uninitialized
13000 global and static data in the @samp{.sbss} section, which is adjacent to
13001 the @samp{.sdata} section. The @option{-msdata=eabi} option is
13002 incompatible with the @option{-mrelocatable} option. The
13003 @option{-msdata=eabi} option also sets the @option{-memb} option.
13006 @opindex msdata=sysv
13007 On System V.4 and embedded PowerPC systems, put small global and static
13008 data in the @samp{.sdata} section, which is pointed to by register
13009 @code{r13}. Put small uninitialized global and static data in the
13010 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
13011 The @option{-msdata=sysv} option is incompatible with the
13012 @option{-mrelocatable} option.
13014 @item -msdata=default
13016 @opindex msdata=default
13018 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
13019 compile code the same as @option{-msdata=eabi}, otherwise compile code the
13020 same as @option{-msdata=sysv}.
13023 @opindex msdata-data
13024 On System V.4 and embedded PowerPC systems, put small global
13025 data in the @samp{.sdata} section. Put small uninitialized global
13026 data in the @samp{.sbss} section. Do not use register @code{r13}
13027 to address small data however. This is the default behavior unless
13028 other @option{-msdata} options are used.
13032 @opindex msdata=none
13034 On embedded PowerPC systems, put all initialized global and static data
13035 in the @samp{.data} section, and all uninitialized data in the
13036 @samp{.bss} section.
13040 @cindex smaller data references (PowerPC)
13041 @cindex .sdata/.sdata2 references (PowerPC)
13042 On embedded PowerPC systems, put global and static items less than or
13043 equal to @var{num} bytes into the small data or bss sections instead of
13044 the normal data or bss section. By default, @var{num} is 8. The
13045 @option{-G @var{num}} switch is also passed to the linker.
13046 All modules should be compiled with the same @option{-G @var{num}} value.
13049 @itemx -mno-regnames
13051 @opindex mno-regnames
13052 On System V.4 and embedded PowerPC systems do (do not) emit register
13053 names in the assembly language output using symbolic forms.
13056 @itemx -mno-longcall
13058 @opindex mno-longcall
13059 By default assume that all calls are far away so that a longer more
13060 expensive calling sequence is required. This is required for calls
13061 further than 32 megabytes (33,554,432 bytes) from the current location.
13062 A short call will be generated if the compiler knows
13063 the call cannot be that far away. This setting can be overridden by
13064 the @code{shortcall} function attribute, or by @code{#pragma
13067 Some linkers are capable of detecting out-of-range calls and generating
13068 glue code on the fly. On these systems, long calls are unnecessary and
13069 generate slower code. As of this writing, the AIX linker can do this,
13070 as can the GNU linker for PowerPC/64. It is planned to add this feature
13071 to the GNU linker for 32-bit PowerPC systems as well.
13073 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
13074 callee, L42'', plus a ``branch island'' (glue code). The two target
13075 addresses represent the callee and the ``branch island''. The
13076 Darwin/PPC linker will prefer the first address and generate a ``bl
13077 callee'' if the PPC ``bl'' instruction will reach the callee directly;
13078 otherwise, the linker will generate ``bl L42'' to call the ``branch
13079 island''. The ``branch island'' is appended to the body of the
13080 calling function; it computes the full 32-bit address of the callee
13083 On Mach-O (Darwin) systems, this option directs the compiler emit to
13084 the glue for every direct call, and the Darwin linker decides whether
13085 to use or discard it.
13087 In the future, we may cause GCC to ignore all longcall specifications
13088 when the linker is known to generate glue.
13092 Adds support for multithreading with the @dfn{pthreads} library.
13093 This option sets flags for both the preprocessor and linker.
13097 @node S/390 and zSeries Options
13098 @subsection S/390 and zSeries Options
13099 @cindex S/390 and zSeries Options
13101 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
13105 @itemx -msoft-float
13106 @opindex mhard-float
13107 @opindex msoft-float
13108 Use (do not use) the hardware floating-point instructions and registers
13109 for floating-point operations. When @option{-msoft-float} is specified,
13110 functions in @file{libgcc.a} will be used to perform floating-point
13111 operations. When @option{-mhard-float} is specified, the compiler
13112 generates IEEE floating-point instructions. This is the default.
13114 @item -mlong-double-64
13115 @itemx -mlong-double-128
13116 @opindex mlong-double-64
13117 @opindex mlong-double-128
13118 These switches control the size of @code{long double} type. A size
13119 of 64bit makes the @code{long double} type equivalent to the @code{double}
13120 type. This is the default.
13123 @itemx -mno-backchain
13124 @opindex mbackchain
13125 @opindex mno-backchain
13126 Store (do not store) the address of the caller's frame as backchain pointer
13127 into the callee's stack frame.
13128 A backchain may be needed to allow debugging using tools that do not understand
13129 DWARF-2 call frame information.
13130 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
13131 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
13132 the backchain is placed into the topmost word of the 96/160 byte register
13135 In general, code compiled with @option{-mbackchain} is call-compatible with
13136 code compiled with @option{-mmo-backchain}; however, use of the backchain
13137 for debugging purposes usually requires that the whole binary is built with
13138 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
13139 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
13140 to build a linux kernel use @option{-msoft-float}.
13142 The default is to not maintain the backchain.
13144 @item -mpacked-stack
13145 @item -mno-packed-stack
13146 @opindex mpacked-stack
13147 @opindex mno-packed-stack
13148 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
13149 specified, the compiler uses the all fields of the 96/160 byte register save
13150 area only for their default purpose; unused fields still take up stack space.
13151 When @option{-mpacked-stack} is specified, register save slots are densely
13152 packed at the top of the register save area; unused space is reused for other
13153 purposes, allowing for more efficient use of the available stack space.
13154 However, when @option{-mbackchain} is also in effect, the topmost word of
13155 the save area is always used to store the backchain, and the return address
13156 register is always saved two words below the backchain.
13158 As long as the stack frame backchain is not used, code generated with
13159 @option{-mpacked-stack} is call-compatible with code generated with
13160 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
13161 S/390 or zSeries generated code that uses the stack frame backchain at run
13162 time, not just for debugging purposes. Such code is not call-compatible
13163 with code compiled with @option{-mpacked-stack}. Also, note that the
13164 combination of @option{-mbackchain},
13165 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
13166 to build a linux kernel use @option{-msoft-float}.
13168 The default is to not use the packed stack layout.
13171 @itemx -mno-small-exec
13172 @opindex msmall-exec
13173 @opindex mno-small-exec
13174 Generate (or do not generate) code using the @code{bras} instruction
13175 to do subroutine calls.
13176 This only works reliably if the total executable size does not
13177 exceed 64k. The default is to use the @code{basr} instruction instead,
13178 which does not have this limitation.
13184 When @option{-m31} is specified, generate code compliant to the
13185 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
13186 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
13187 particular to generate 64-bit instructions. For the @samp{s390}
13188 targets, the default is @option{-m31}, while the @samp{s390x}
13189 targets default to @option{-m64}.
13195 When @option{-mzarch} is specified, generate code using the
13196 instructions available on z/Architecture.
13197 When @option{-mesa} is specified, generate code using the
13198 instructions available on ESA/390. Note that @option{-mesa} is
13199 not possible with @option{-m64}.
13200 When generating code compliant to the GNU/Linux for S/390 ABI,
13201 the default is @option{-mesa}. When generating code compliant
13202 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
13208 Generate (or do not generate) code using the @code{mvcle} instruction
13209 to perform block moves. When @option{-mno-mvcle} is specified,
13210 use a @code{mvc} loop instead. This is the default unless optimizing for
13217 Print (or do not print) additional debug information when compiling.
13218 The default is to not print debug information.
13220 @item -march=@var{cpu-type}
13222 Generate code that will run on @var{cpu-type}, which is the name of a system
13223 representing a certain processor type. Possible values for
13224 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
13225 When generating code using the instructions available on z/Architecture,
13226 the default is @option{-march=z900}. Otherwise, the default is
13227 @option{-march=g5}.
13229 @item -mtune=@var{cpu-type}
13231 Tune to @var{cpu-type} everything applicable about the generated code,
13232 except for the ABI and the set of available instructions.
13233 The list of @var{cpu-type} values is the same as for @option{-march}.
13234 The default is the value used for @option{-march}.
13237 @itemx -mno-tpf-trace
13238 @opindex mtpf-trace
13239 @opindex mno-tpf-trace
13240 Generate code that adds (does not add) in TPF OS specific branches to trace
13241 routines in the operating system. This option is off by default, even
13242 when compiling for the TPF OS@.
13245 @itemx -mno-fused-madd
13246 @opindex mfused-madd
13247 @opindex mno-fused-madd
13248 Generate code that uses (does not use) the floating point multiply and
13249 accumulate instructions. These instructions are generated by default if
13250 hardware floating point is used.
13252 @item -mwarn-framesize=@var{framesize}
13253 @opindex mwarn-framesize
13254 Emit a warning if the current function exceeds the given frame size. Because
13255 this is a compile time check it doesn't need to be a real problem when the program
13256 runs. It is intended to identify functions which most probably cause
13257 a stack overflow. It is useful to be used in an environment with limited stack
13258 size e.g.@: the linux kernel.
13260 @item -mwarn-dynamicstack
13261 @opindex mwarn-dynamicstack
13262 Emit a warning if the function calls alloca or uses dynamically
13263 sized arrays. This is generally a bad idea with a limited stack size.
13265 @item -mstack-guard=@var{stack-guard}
13266 @item -mstack-size=@var{stack-size}
13267 @opindex mstack-guard
13268 @opindex mstack-size
13269 If these options are provided the s390 back end emits additional instructions in
13270 the function prologue which trigger a trap if the stack size is @var{stack-guard}
13271 bytes above the @var{stack-size} (remember that the stack on s390 grows downward).
13272 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
13273 the frame size of the compiled function is chosen.
13274 These options are intended to be used to help debugging stack overflow problems.
13275 The additionally emitted code causes only little overhead and hence can also be
13276 used in production like systems without greater performance degradation. The given
13277 values have to be exact powers of 2 and @var{stack-size} has to be greater than
13278 @var{stack-guard} without exceeding 64k.
13279 In order to be efficient the extra code makes the assumption that the stack starts
13280 at an address aligned to the value given by @var{stack-size}.
13281 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
13284 @node Score Options
13285 @subsection Score Options
13286 @cindex Score Options
13288 These options are defined for Score implementations:
13293 Compile code for big endian mode. This is the default.
13297 Compile code for little endian mode.
13301 Disable generate bcnz instruction.
13305 Enable generate unaligned load and store instruction.
13309 Enable the use of multiply-accumulate instructions. Disabled by default.
13313 Specify the SCORE5 as the target architecture.
13317 Specify the SCORE5U of the target architecture.
13321 Specify the SCORE7 as the target architecture. This is the default.
13325 Specify the SCORE7D as the target architecture.
13329 @subsection SH Options
13331 These @samp{-m} options are defined for the SH implementations:
13336 Generate code for the SH1.
13340 Generate code for the SH2.
13343 Generate code for the SH2e.
13347 Generate code for the SH3.
13351 Generate code for the SH3e.
13355 Generate code for the SH4 without a floating-point unit.
13357 @item -m4-single-only
13358 @opindex m4-single-only
13359 Generate code for the SH4 with a floating-point unit that only
13360 supports single-precision arithmetic.
13364 Generate code for the SH4 assuming the floating-point unit is in
13365 single-precision mode by default.
13369 Generate code for the SH4.
13373 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
13374 floating-point unit is not used.
13376 @item -m4a-single-only
13377 @opindex m4a-single-only
13378 Generate code for the SH4a, in such a way that no double-precision
13379 floating point operations are used.
13382 @opindex m4a-single
13383 Generate code for the SH4a assuming the floating-point unit is in
13384 single-precision mode by default.
13388 Generate code for the SH4a.
13392 Same as @option{-m4a-nofpu}, except that it implicitly passes
13393 @option{-dsp} to the assembler. GCC doesn't generate any DSP
13394 instructions at the moment.
13398 Compile code for the processor in big endian mode.
13402 Compile code for the processor in little endian mode.
13406 Align doubles at 64-bit boundaries. Note that this changes the calling
13407 conventions, and thus some functions from the standard C library will
13408 not work unless you recompile it first with @option{-mdalign}.
13412 Shorten some address references at link time, when possible; uses the
13413 linker option @option{-relax}.
13417 Use 32-bit offsets in @code{switch} tables. The default is to use
13422 Enable the use of the instruction @code{fmovd}.
13426 Comply with the calling conventions defined by Renesas.
13430 Comply with the calling conventions defined by Renesas.
13434 Comply with the calling conventions defined for GCC before the Renesas
13435 conventions were available. This option is the default for all
13436 targets of the SH toolchain except for @samp{sh-symbianelf}.
13439 @opindex mnomacsave
13440 Mark the @code{MAC} register as call-clobbered, even if
13441 @option{-mhitachi} is given.
13445 Increase IEEE-compliance of floating-point code.
13446 At the moment, this is equivalent to @option{-fno-finite-math-only}.
13447 When generating 16 bit SH opcodes, getting IEEE-conforming results for
13448 comparisons of NANs / infinities incurs extra overhead in every
13449 floating point comparison, therefore the default is set to
13450 @option{-ffinite-math-only}.
13452 @item -minline-ic_invalidate
13453 @opindex minline-ic_invalidate
13454 Inline code to invalidate instruction cache entries after setting up
13455 nested function trampolines.
13456 This option has no effect if -musermode is in effect and the selected
13457 code generation option (e.g. -m4) does not allow the use of the icbi
13459 If the selected code generation option does not allow the use of the icbi
13460 instruction, and -musermode is not in effect, the inlined code will
13461 manipulate the instruction cache address array directly with an associative
13462 write. This not only requires privileged mode, but it will also
13463 fail if the cache line had been mapped via the TLB and has become unmapped.
13467 Dump instruction size and location in the assembly code.
13470 @opindex mpadstruct
13471 This option is deprecated. It pads structures to multiple of 4 bytes,
13472 which is incompatible with the SH ABI@.
13476 Optimize for space instead of speed. Implied by @option{-Os}.
13479 @opindex mprefergot
13480 When generating position-independent code, emit function calls using
13481 the Global Offset Table instead of the Procedure Linkage Table.
13485 Don't generate privileged mode only code; implies -mno-inline-ic_invalidate
13486 if the inlined code would not work in user mode.
13487 This is the default when the target is @code{sh-*-linux*}.
13489 @item -multcost=@var{number}
13490 @opindex multcost=@var{number}
13491 Set the cost to assume for a multiply insn.
13493 @item -mdiv=@var{strategy}
13494 @opindex mdiv=@var{strategy}
13495 Set the division strategy to use for SHmedia code. @var{strategy} must be
13496 one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
13497 inv:call2, inv:fp .
13498 "fp" performs the operation in floating point. This has a very high latency,
13499 but needs only a few instructions, so it might be a good choice if
13500 your code has enough easily exploitable ILP to allow the compiler to
13501 schedule the floating point instructions together with other instructions.
13502 Division by zero causes a floating point exception.
13503 "inv" uses integer operations to calculate the inverse of the divisor,
13504 and then multiplies the dividend with the inverse. This strategy allows
13505 cse and hoisting of the inverse calculation. Division by zero calculates
13506 an unspecified result, but does not trap.
13507 "inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
13508 have been found, or if the entire operation has been hoisted to the same
13509 place, the last stages of the inverse calculation are intertwined with the
13510 final multiply to reduce the overall latency, at the expense of using a few
13511 more instructions, and thus offering fewer scheduling opportunities with
13513 "call" calls a library function that usually implements the inv:minlat
13515 This gives high code density for m5-*media-nofpu compilations.
13516 "call2" uses a different entry point of the same library function, where it
13517 assumes that a pointer to a lookup table has already been set up, which
13518 exposes the pointer load to cse / code hoisting optimizations.
13519 "inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
13520 code generation, but if the code stays unoptimized, revert to the "call",
13521 "call2", or "fp" strategies, respectively. Note that the
13522 potentially-trapping side effect of division by zero is carried by a
13523 separate instruction, so it is possible that all the integer instructions
13524 are hoisted out, but the marker for the side effect stays where it is.
13525 A recombination to fp operations or a call is not possible in that case.
13526 "inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case
13527 that the inverse calculation was nor separated from the multiply, they speed
13528 up division where the dividend fits into 20 bits (plus sign where applicable),
13529 by inserting a test to skip a number of operations in this case; this test
13530 slows down the case of larger dividends. inv20u assumes the case of a such
13531 a small dividend to be unlikely, and inv20l assumes it to be likely.
13533 @item -mdivsi3_libfunc=@var{name}
13534 @opindex mdivsi3_libfunc=@var{name}
13535 Set the name of the library function used for 32 bit signed division to
13536 @var{name}. This only affect the name used in the call and inv:call
13537 division strategies, and the compiler will still expect the same
13538 sets of input/output/clobbered registers as if this option was not present.
13540 @item -madjust-unroll
13541 @opindex madjust-unroll
13542 Throttle unrolling to avoid thrashing target registers.
13543 This option only has an effect if the gcc code base supports the
13544 TARGET_ADJUST_UNROLL_MAX target hook.
13546 @item -mindexed-addressing
13547 @opindex mindexed-addressing
13548 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
13549 This is only safe if the hardware and/or OS implement 32 bit wrap-around
13550 semantics for the indexed addressing mode. The architecture allows the
13551 implementation of processors with 64 bit MMU, which the OS could use to
13552 get 32 bit addressing, but since no current hardware implementation supports
13553 this or any other way to make the indexed addressing mode safe to use in
13554 the 32 bit ABI, the default is -mno-indexed-addressing.
13556 @item -mgettrcost=@var{number}
13557 @opindex mgettrcost=@var{number}
13558 Set the cost assumed for the gettr instruction to @var{number}.
13559 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
13563 Assume pt* instructions won't trap. This will generally generate better
13564 scheduled code, but is unsafe on current hardware. The current architecture
13565 definition says that ptabs and ptrel trap when the target anded with 3 is 3.
13566 This has the unintentional effect of making it unsafe to schedule ptabs /
13567 ptrel before a branch, or hoist it out of a loop. For example,
13568 __do_global_ctors, a part of libgcc that runs constructors at program
13569 startup, calls functions in a list which is delimited by @minus{}1. With the
13570 -mpt-fixed option, the ptabs will be done before testing against @minus{}1.
13571 That means that all the constructors will be run a bit quicker, but when
13572 the loop comes to the end of the list, the program crashes because ptabs
13573 loads @minus{}1 into a target register. Since this option is unsafe for any
13574 hardware implementing the current architecture specification, the default
13575 is -mno-pt-fixed. Unless the user specifies a specific cost with
13576 @option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
13577 this deters register allocation using target registers for storing
13580 @item -minvalid-symbols
13581 @opindex minvalid-symbols
13582 Assume symbols might be invalid. Ordinary function symbols generated by
13583 the compiler will always be valid to load with movi/shori/ptabs or
13584 movi/shori/ptrel, but with assembler and/or linker tricks it is possible
13585 to generate symbols that will cause ptabs / ptrel to trap.
13586 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
13587 It will then prevent cross-basic-block cse, hoisting and most scheduling
13588 of symbol loads. The default is @option{-mno-invalid-symbols}.
13591 @node SPARC Options
13592 @subsection SPARC Options
13593 @cindex SPARC options
13595 These @samp{-m} options are supported on the SPARC:
13598 @item -mno-app-regs
13600 @opindex mno-app-regs
13602 Specify @option{-mapp-regs} to generate output using the global registers
13603 2 through 4, which the SPARC SVR4 ABI reserves for applications. This
13606 To be fully SVR4 ABI compliant at the cost of some performance loss,
13607 specify @option{-mno-app-regs}. You should compile libraries and system
13608 software with this option.
13611 @itemx -mhard-float
13613 @opindex mhard-float
13614 Generate output containing floating point instructions. This is the
13618 @itemx -msoft-float
13620 @opindex msoft-float
13621 Generate output containing library calls for floating point.
13622 @strong{Warning:} the requisite libraries are not available for all SPARC
13623 targets. Normally the facilities of the machine's usual C compiler are
13624 used, but this cannot be done directly in cross-compilation. You must make
13625 your own arrangements to provide suitable library functions for
13626 cross-compilation. The embedded targets @samp{sparc-*-aout} and
13627 @samp{sparclite-*-*} do provide software floating point support.
13629 @option{-msoft-float} changes the calling convention in the output file;
13630 therefore, it is only useful if you compile @emph{all} of a program with
13631 this option. In particular, you need to compile @file{libgcc.a}, the
13632 library that comes with GCC, with @option{-msoft-float} in order for
13635 @item -mhard-quad-float
13636 @opindex mhard-quad-float
13637 Generate output containing quad-word (long double) floating point
13640 @item -msoft-quad-float
13641 @opindex msoft-quad-float
13642 Generate output containing library calls for quad-word (long double)
13643 floating point instructions. The functions called are those specified
13644 in the SPARC ABI@. This is the default.
13646 As of this writing, there are no SPARC implementations that have hardware
13647 support for the quad-word floating point instructions. They all invoke
13648 a trap handler for one of these instructions, and then the trap handler
13649 emulates the effect of the instruction. Because of the trap handler overhead,
13650 this is much slower than calling the ABI library routines. Thus the
13651 @option{-msoft-quad-float} option is the default.
13653 @item -mno-unaligned-doubles
13654 @itemx -munaligned-doubles
13655 @opindex mno-unaligned-doubles
13656 @opindex munaligned-doubles
13657 Assume that doubles have 8 byte alignment. This is the default.
13659 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
13660 alignment only if they are contained in another type, or if they have an
13661 absolute address. Otherwise, it assumes they have 4 byte alignment.
13662 Specifying this option avoids some rare compatibility problems with code
13663 generated by other compilers. It is not the default because it results
13664 in a performance loss, especially for floating point code.
13666 @item -mno-faster-structs
13667 @itemx -mfaster-structs
13668 @opindex mno-faster-structs
13669 @opindex mfaster-structs
13670 With @option{-mfaster-structs}, the compiler assumes that structures
13671 should have 8 byte alignment. This enables the use of pairs of
13672 @code{ldd} and @code{std} instructions for copies in structure
13673 assignment, in place of twice as many @code{ld} and @code{st} pairs.
13674 However, the use of this changed alignment directly violates the SPARC
13675 ABI@. Thus, it's intended only for use on targets where the developer
13676 acknowledges that their resulting code will not be directly in line with
13677 the rules of the ABI@.
13679 @item -mimpure-text
13680 @opindex mimpure-text
13681 @option{-mimpure-text}, used in addition to @option{-shared}, tells
13682 the compiler to not pass @option{-z text} to the linker when linking a
13683 shared object. Using this option, you can link position-dependent
13684 code into a shared object.
13686 @option{-mimpure-text} suppresses the ``relocations remain against
13687 allocatable but non-writable sections'' linker error message.
13688 However, the necessary relocations will trigger copy-on-write, and the
13689 shared object is not actually shared across processes. Instead of
13690 using @option{-mimpure-text}, you should compile all source code with
13691 @option{-fpic} or @option{-fPIC}.
13693 This option is only available on SunOS and Solaris.
13695 @item -mcpu=@var{cpu_type}
13697 Set the instruction set, register set, and instruction scheduling parameters
13698 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
13699 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
13700 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
13701 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
13702 @samp{ultrasparc3}, and @samp{niagara}.
13704 Default instruction scheduling parameters are used for values that select
13705 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
13706 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
13708 Here is a list of each supported architecture and their supported
13713 v8: supersparc, hypersparc
13714 sparclite: f930, f934, sparclite86x
13716 v9: ultrasparc, ultrasparc3, niagara
13719 By default (unless configured otherwise), GCC generates code for the V7
13720 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
13721 additionally optimizes it for the Cypress CY7C602 chip, as used in the
13722 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
13723 SPARCStation 1, 2, IPX etc.
13725 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
13726 architecture. The only difference from V7 code is that the compiler emits
13727 the integer multiply and integer divide instructions which exist in SPARC-V8
13728 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
13729 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
13732 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
13733 the SPARC architecture. This adds the integer multiply, integer divide step
13734 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
13735 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
13736 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
13737 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
13738 MB86934 chip, which is the more recent SPARClite with FPU@.
13740 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
13741 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
13742 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
13743 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
13744 optimizes it for the TEMIC SPARClet chip.
13746 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
13747 architecture. This adds 64-bit integer and floating-point move instructions,
13748 3 additional floating-point condition code registers and conditional move
13749 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
13750 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
13751 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
13752 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
13753 @option{-mcpu=niagara}, the compiler additionally optimizes it for
13754 Sun UltraSPARC T1 chips.
13756 @item -mtune=@var{cpu_type}
13758 Set the instruction scheduling parameters for machine type
13759 @var{cpu_type}, but do not set the instruction set or register set that the
13760 option @option{-mcpu=@var{cpu_type}} would.
13762 The same values for @option{-mcpu=@var{cpu_type}} can be used for
13763 @option{-mtune=@var{cpu_type}}, but the only useful values are those
13764 that select a particular cpu implementation. Those are @samp{cypress},
13765 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
13766 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
13767 @samp{ultrasparc3}, and @samp{niagara}.
13772 @opindex mno-v8plus
13773 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
13774 difference from the V8 ABI is that the global and out registers are
13775 considered 64-bit wide. This is enabled by default on Solaris in 32-bit
13776 mode for all SPARC-V9 processors.
13782 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
13783 Visual Instruction Set extensions. The default is @option{-mno-vis}.
13786 These @samp{-m} options are supported in addition to the above
13787 on SPARC-V9 processors in 64-bit environments:
13790 @item -mlittle-endian
13791 @opindex mlittle-endian
13792 Generate code for a processor running in little-endian mode. It is only
13793 available for a few configurations and most notably not on Solaris and Linux.
13799 Generate code for a 32-bit or 64-bit environment.
13800 The 32-bit environment sets int, long and pointer to 32 bits.
13801 The 64-bit environment sets int to 32 bits and long and pointer
13804 @item -mcmodel=medlow
13805 @opindex mcmodel=medlow
13806 Generate code for the Medium/Low code model: 64-bit addresses, programs
13807 must be linked in the low 32 bits of memory. Programs can be statically
13808 or dynamically linked.
13810 @item -mcmodel=medmid
13811 @opindex mcmodel=medmid
13812 Generate code for the Medium/Middle code model: 64-bit addresses, programs
13813 must be linked in the low 44 bits of memory, the text and data segments must
13814 be less than 2GB in size and the data segment must be located within 2GB of
13817 @item -mcmodel=medany
13818 @opindex mcmodel=medany
13819 Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
13820 may be linked anywhere in memory, the text and data segments must be less
13821 than 2GB in size and the data segment must be located within 2GB of the
13824 @item -mcmodel=embmedany
13825 @opindex mcmodel=embmedany
13826 Generate code for the Medium/Anywhere code model for embedded systems:
13827 64-bit addresses, the text and data segments must be less than 2GB in
13828 size, both starting anywhere in memory (determined at link time). The
13829 global register %g4 points to the base of the data segment. Programs
13830 are statically linked and PIC is not supported.
13833 @itemx -mno-stack-bias
13834 @opindex mstack-bias
13835 @opindex mno-stack-bias
13836 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
13837 frame pointer if present, are offset by @minus{}2047 which must be added back
13838 when making stack frame references. This is the default in 64-bit mode.
13839 Otherwise, assume no such offset is present.
13842 These switches are supported in addition to the above on Solaris:
13847 Add support for multithreading using the Solaris threads library. This
13848 option sets flags for both the preprocessor and linker. This option does
13849 not affect the thread safety of object code produced by the compiler or
13850 that of libraries supplied with it.
13854 Add support for multithreading using the POSIX threads library. This
13855 option sets flags for both the preprocessor and linker. This option does
13856 not affect the thread safety of object code produced by the compiler or
13857 that of libraries supplied with it.
13861 This is a synonym for @option{-pthreads}.
13865 @subsection SPU Options
13866 @cindex SPU options
13868 These @samp{-m} options are supported on the SPU:
13872 @itemx -merror-reloc
13873 @opindex mwarn-reloc
13874 @opindex merror-reloc
13876 The loader for SPU does not handle dynamic relocations. By default, GCC
13877 will give an error when it generates code that requires a dynamic
13878 relocation. @option{-mno-error-reloc} disables the error,
13879 @option{-mwarn-reloc} will generate a warning instead.
13882 @itemx -munsafe-dma
13884 @opindex munsafe-dma
13886 Instructions which initiate or test completion of DMA must not be
13887 reordered with respect to loads and stores of the memory which is being
13888 accessed. Users typically address this problem using the volatile
13889 keyword, but that can lead to inefficient code in places where the
13890 memory is known to not change. Rather than mark the memory as volatile
13891 we treat the DMA instructions as potentially effecting all memory. With
13892 @option{-munsafe-dma} users must use the volatile keyword to protect
13895 @item -mbranch-hints
13896 @opindex mbranch-hints
13898 By default, GCC will generate a branch hint instruction to avoid
13899 pipeline stalls for always taken or probably taken branches. A hint
13900 will not be generated closer than 8 instructions away from its branch.
13901 There is little reason to disable them, except for debugging purposes,
13902 or to make an object a little bit smaller.
13906 @opindex msmall-mem
13907 @opindex mlarge-mem
13909 By default, GCC generates code assuming that addresses are never larger
13910 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
13911 a full 32 bit address.
13916 By default, GCC links against startup code that assumes the SPU-style
13917 main function interface (which has an unconventional parameter list).
13918 With @option{-mstdmain}, GCC will link your program against startup
13919 code that assumes a C99-style interface to @code{main}, including a
13920 local copy of @code{argv} strings.
13922 @item -mfixed-range=@var{register-range}
13923 @opindex mfixed-range
13924 Generate code treating the given register range as fixed registers.
13925 A fixed register is one that the register allocator can not use. This is
13926 useful when compiling kernel code. A register range is specified as
13927 two registers separated by a dash. Multiple register ranges can be
13928 specified separated by a comma.
13932 @node System V Options
13933 @subsection Options for System V
13935 These additional options are available on System V Release 4 for
13936 compatibility with other compilers on those systems:
13941 Create a shared object.
13942 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
13946 Identify the versions of each tool used by the compiler, in a
13947 @code{.ident} assembler directive in the output.
13951 Refrain from adding @code{.ident} directives to the output file (this is
13954 @item -YP,@var{dirs}
13956 Search the directories @var{dirs}, and no others, for libraries
13957 specified with @option{-l}.
13959 @item -Ym,@var{dir}
13961 Look in the directory @var{dir} to find the M4 preprocessor.
13962 The assembler uses this option.
13963 @c This is supposed to go with a -Yd for predefined M4 macro files, but
13964 @c the generic assembler that comes with Solaris takes just -Ym.
13967 @node TMS320C3x/C4x Options
13968 @subsection TMS320C3x/C4x Options
13969 @cindex TMS320C3x/C4x Options
13971 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
13975 @item -mcpu=@var{cpu_type}
13977 Set the instruction set, register set, and instruction scheduling
13978 parameters for machine type @var{cpu_type}. Supported values for
13979 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
13980 @samp{c44}. The default is @samp{c40} to generate code for the
13985 @itemx -msmall-memory
13987 @opindex mbig-memory
13989 @opindex msmall-memory
13991 Generates code for the big or small memory model. The small memory
13992 model assumed that all data fits into one 64K word page. At run-time
13993 the data page (DP) register must be set to point to the 64K page
13994 containing the .bss and .data program sections. The big memory model is
13995 the default and requires reloading of the DP register for every direct
14002 Allow (disallow) allocation of general integer operands into the block
14003 count register BK@.
14009 Enable (disable) generation of code using decrement and branch,
14010 DBcond(D), instructions. This is enabled by default for the C4x. To be
14011 on the safe side, this is disabled for the C3x, since the maximum
14012 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
14013 @math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so
14014 that it can utilize the decrement and branch instruction, but will give
14015 up if there is more than one memory reference in the loop. Thus a loop
14016 where the loop counter is decremented can generate slightly more
14017 efficient code, in cases where the RPTB instruction cannot be utilized.
14019 @item -mdp-isr-reload
14021 @opindex mdp-isr-reload
14023 Force the DP register to be saved on entry to an interrupt service
14024 routine (ISR), reloaded to point to the data section, and restored on
14025 exit from the ISR@. This should not be required unless someone has
14026 violated the small memory model by modifying the DP register, say within
14033 For the C3x use the 24-bit MPYI instruction for integer multiplies
14034 instead of a library call to guarantee 32-bit results. Note that if one
14035 of the operands is a constant, then the multiplication will be performed
14036 using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x,
14037 then squaring operations are performed inline instead of a library call.
14040 @itemx -mno-fast-fix
14042 @opindex mno-fast-fix
14043 The C3x/C4x FIX instruction to convert a floating point value to an
14044 integer value chooses the nearest integer less than or equal to the
14045 floating point value rather than to the nearest integer. Thus if the
14046 floating point number is negative, the result will be incorrectly
14047 truncated an additional code is necessary to detect and correct this
14048 case. This option can be used to disable generation of the additional
14049 code required to correct the result.
14055 Enable (disable) generation of repeat block sequences using the RPTB
14056 instruction for zero overhead looping. The RPTB construct is only used
14057 for innermost loops that do not call functions or jump across the loop
14058 boundaries. There is no advantage having nested RPTB loops due to the
14059 overhead required to save and restore the RC, RS, and RE registers.
14060 This is enabled by default with @option{-O2}.
14062 @item -mrpts=@var{count}
14066 Enable (disable) the use of the single instruction repeat instruction
14067 RPTS@. If a repeat block contains a single instruction, and the loop
14068 count can be guaranteed to be less than the value @var{count}, GCC will
14069 emit a RPTS instruction instead of a RPTB@. If no value is specified,
14070 then a RPTS will be emitted even if the loop count cannot be determined
14071 at compile time. Note that the repeated instruction following RPTS does
14072 not have to be reloaded from memory each iteration, thus freeing up the
14073 CPU buses for operands. However, since interrupts are blocked by this
14074 instruction, it is disabled by default.
14076 @item -mloop-unsigned
14077 @itemx -mno-loop-unsigned
14078 @opindex mloop-unsigned
14079 @opindex mno-loop-unsigned
14080 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
14081 is @math{2^{31} + 1} since these instructions test if the iteration count is
14082 negative to terminate the loop. If the iteration count is unsigned
14083 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
14084 exceeded. This switch allows an unsigned iteration count.
14088 Try to emit an assembler syntax that the TI assembler (asm30) is happy
14089 with. This also enforces compatibility with the API employed by the TI
14090 C3x C compiler. For example, long doubles are passed as structures
14091 rather than in floating point registers.
14097 Generate code that uses registers (stack) for passing arguments to functions.
14098 By default, arguments are passed in registers where possible rather
14099 than by pushing arguments on to the stack.
14101 @item -mparallel-insns
14102 @itemx -mno-parallel-insns
14103 @opindex mparallel-insns
14104 @opindex mno-parallel-insns
14105 Allow the generation of parallel instructions. This is enabled by
14106 default with @option{-O2}.
14108 @item -mparallel-mpy
14109 @itemx -mno-parallel-mpy
14110 @opindex mparallel-mpy
14111 @opindex mno-parallel-mpy
14112 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
14113 provided @option{-mparallel-insns} is also specified. These instructions have
14114 tight register constraints which can pessimize the code generation
14115 of large functions.
14120 @subsection V850 Options
14121 @cindex V850 Options
14123 These @samp{-m} options are defined for V850 implementations:
14127 @itemx -mno-long-calls
14128 @opindex mlong-calls
14129 @opindex mno-long-calls
14130 Treat all calls as being far away (near). If calls are assumed to be
14131 far away, the compiler will always load the functions address up into a
14132 register, and call indirect through the pointer.
14138 Do not optimize (do optimize) basic blocks that use the same index
14139 pointer 4 or more times to copy pointer into the @code{ep} register, and
14140 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
14141 option is on by default if you optimize.
14143 @item -mno-prolog-function
14144 @itemx -mprolog-function
14145 @opindex mno-prolog-function
14146 @opindex mprolog-function
14147 Do not use (do use) external functions to save and restore registers
14148 at the prologue and epilogue of a function. The external functions
14149 are slower, but use less code space if more than one function saves
14150 the same number of registers. The @option{-mprolog-function} option
14151 is on by default if you optimize.
14155 Try to make the code as small as possible. At present, this just turns
14156 on the @option{-mep} and @option{-mprolog-function} options.
14158 @item -mtda=@var{n}
14160 Put static or global variables whose size is @var{n} bytes or less into
14161 the tiny data area that register @code{ep} points to. The tiny data
14162 area can hold up to 256 bytes in total (128 bytes for byte references).
14164 @item -msda=@var{n}
14166 Put static or global variables whose size is @var{n} bytes or less into
14167 the small data area that register @code{gp} points to. The small data
14168 area can hold up to 64 kilobytes.
14170 @item -mzda=@var{n}
14172 Put static or global variables whose size is @var{n} bytes or less into
14173 the first 32 kilobytes of memory.
14177 Specify that the target processor is the V850.
14180 @opindex mbig-switch
14181 Generate code suitable for big switch tables. Use this option only if
14182 the assembler/linker complain about out of range branches within a switch
14187 This option will cause r2 and r5 to be used in the code generated by
14188 the compiler. This setting is the default.
14190 @item -mno-app-regs
14191 @opindex mno-app-regs
14192 This option will cause r2 and r5 to be treated as fixed registers.
14196 Specify that the target processor is the V850E1. The preprocessor
14197 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
14198 this option is used.
14202 Specify that the target processor is the V850E@. The preprocessor
14203 constant @samp{__v850e__} will be defined if this option is used.
14205 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
14206 are defined then a default target processor will be chosen and the
14207 relevant @samp{__v850*__} preprocessor constant will be defined.
14209 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
14210 defined, regardless of which processor variant is the target.
14212 @item -mdisable-callt
14213 @opindex mdisable-callt
14214 This option will suppress generation of the CALLT instruction for the
14215 v850e and v850e1 flavors of the v850 architecture. The default is
14216 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
14221 @subsection VAX Options
14222 @cindex VAX options
14224 These @samp{-m} options are defined for the VAX:
14229 Do not output certain jump instructions (@code{aobleq} and so on)
14230 that the Unix assembler for the VAX cannot handle across long
14235 Do output those jump instructions, on the assumption that you
14236 will assemble with the GNU assembler.
14240 Output code for g-format floating point numbers instead of d-format.
14243 @node VxWorks Options
14244 @subsection VxWorks Options
14245 @cindex VxWorks Options
14247 The options in this section are defined for all VxWorks targets.
14248 Options specific to the target hardware are listed with the other
14249 options for that target.
14254 GCC can generate code for both VxWorks kernels and real time processes
14255 (RTPs). This option switches from the former to the latter. It also
14256 defines the preprocessor macro @code{__RTP__}.
14259 @opindex non-static
14260 Link an RTP executable against shared libraries rather than static
14261 libraries. The options @option{-static} and @option{-shared} can
14262 also be used for RTPs (@pxref{Link Options}); @option{-static}
14269 These options are passed down to the linker. They are defined for
14270 compatibility with Diab.
14273 @opindex Xbind-lazy
14274 Enable lazy binding of function calls. This option is equivalent to
14275 @option{-Wl,-z,now} and is defined for compatibility with Diab.
14279 Disable lazy binding of function calls. This option is the default and
14280 is defined for compatibility with Diab.
14283 @node x86-64 Options
14284 @subsection x86-64 Options
14285 @cindex x86-64 options
14287 These are listed under @xref{i386 and x86-64 Options}.
14289 @node Xstormy16 Options
14290 @subsection Xstormy16 Options
14291 @cindex Xstormy16 Options
14293 These options are defined for Xstormy16:
14298 Choose startup files and linker script suitable for the simulator.
14301 @node Xtensa Options
14302 @subsection Xtensa Options
14303 @cindex Xtensa Options
14305 These options are supported for Xtensa targets:
14309 @itemx -mno-const16
14311 @opindex mno-const16
14312 Enable or disable use of @code{CONST16} instructions for loading
14313 constant values. The @code{CONST16} instruction is currently not a
14314 standard option from Tensilica. When enabled, @code{CONST16}
14315 instructions are always used in place of the standard @code{L32R}
14316 instructions. The use of @code{CONST16} is enabled by default only if
14317 the @code{L32R} instruction is not available.
14320 @itemx -mno-fused-madd
14321 @opindex mfused-madd
14322 @opindex mno-fused-madd
14323 Enable or disable use of fused multiply/add and multiply/subtract
14324 instructions in the floating-point option. This has no effect if the
14325 floating-point option is not also enabled. Disabling fused multiply/add
14326 and multiply/subtract instructions forces the compiler to use separate
14327 instructions for the multiply and add/subtract operations. This may be
14328 desirable in some cases where strict IEEE 754-compliant results are
14329 required: the fused multiply add/subtract instructions do not round the
14330 intermediate result, thereby producing results with @emph{more} bits of
14331 precision than specified by the IEEE standard. Disabling fused multiply
14332 add/subtract instructions also ensures that the program output is not
14333 sensitive to the compiler's ability to combine multiply and add/subtract
14336 @item -mtext-section-literals
14337 @itemx -mno-text-section-literals
14338 @opindex mtext-section-literals
14339 @opindex mno-text-section-literals
14340 Control the treatment of literal pools. The default is
14341 @option{-mno-text-section-literals}, which places literals in a separate
14342 section in the output file. This allows the literal pool to be placed
14343 in a data RAM/ROM, and it also allows the linker to combine literal
14344 pools from separate object files to remove redundant literals and
14345 improve code size. With @option{-mtext-section-literals}, the literals
14346 are interspersed in the text section in order to keep them as close as
14347 possible to their references. This may be necessary for large assembly
14350 @item -mtarget-align
14351 @itemx -mno-target-align
14352 @opindex mtarget-align
14353 @opindex mno-target-align
14354 When this option is enabled, GCC instructs the assembler to
14355 automatically align instructions to reduce branch penalties at the
14356 expense of some code density. The assembler attempts to widen density
14357 instructions to align branch targets and the instructions following call
14358 instructions. If there are not enough preceding safe density
14359 instructions to align a target, no widening will be performed. The
14360 default is @option{-mtarget-align}. These options do not affect the
14361 treatment of auto-aligned instructions like @code{LOOP}, which the
14362 assembler will always align, either by widening density instructions or
14363 by inserting no-op instructions.
14366 @itemx -mno-longcalls
14367 @opindex mlongcalls
14368 @opindex mno-longcalls
14369 When this option is enabled, GCC instructs the assembler to translate
14370 direct calls to indirect calls unless it can determine that the target
14371 of a direct call is in the range allowed by the call instruction. This
14372 translation typically occurs for calls to functions in other source
14373 files. Specifically, the assembler translates a direct @code{CALL}
14374 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
14375 The default is @option{-mno-longcalls}. This option should be used in
14376 programs where the call target can potentially be out of range. This
14377 option is implemented in the assembler, not the compiler, so the
14378 assembly code generated by GCC will still show direct call
14379 instructions---look at the disassembled object code to see the actual
14380 instructions. Note that the assembler will use an indirect call for
14381 every cross-file call, not just those that really will be out of range.
14384 @node zSeries Options
14385 @subsection zSeries Options
14386 @cindex zSeries options
14388 These are listed under @xref{S/390 and zSeries Options}.
14390 @node Code Gen Options
14391 @section Options for Code Generation Conventions
14392 @cindex code generation conventions
14393 @cindex options, code generation
14394 @cindex run-time options
14396 These machine-independent options control the interface conventions
14397 used in code generation.
14399 Most of them have both positive and negative forms; the negative form
14400 of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
14401 one of the forms is listed---the one which is not the default. You
14402 can figure out the other form by either removing @samp{no-} or adding
14406 @item -fbounds-check
14407 @opindex fbounds-check
14408 For front-ends that support it, generate additional code to check that
14409 indices used to access arrays are within the declared range. This is
14410 currently only supported by the Java and Fortran front-ends, where
14411 this option defaults to true and false respectively.
14415 This option generates traps for signed overflow on addition, subtraction,
14416 multiplication operations.
14420 This option instructs the compiler to assume that signed arithmetic
14421 overflow of addition, subtraction and multiplication wraps around
14422 using twos-complement representation. This flag enables some optimizations
14423 and disables others. This option is enabled by default for the Java
14424 front-end, as required by the Java language specification.
14427 @opindex fexceptions
14428 Enable exception handling. Generates extra code needed to propagate
14429 exceptions. For some targets, this implies GCC will generate frame
14430 unwind information for all functions, which can produce significant data
14431 size overhead, although it does not affect execution. If you do not
14432 specify this option, GCC will enable it by default for languages like
14433 C++ which normally require exception handling, and disable it for
14434 languages like C that do not normally require it. However, you may need
14435 to enable this option when compiling C code that needs to interoperate
14436 properly with exception handlers written in C++. You may also wish to
14437 disable this option if you are compiling older C++ programs that don't
14438 use exception handling.
14440 @item -fnon-call-exceptions
14441 @opindex fnon-call-exceptions
14442 Generate code that allows trapping instructions to throw exceptions.
14443 Note that this requires platform-specific runtime support that does
14444 not exist everywhere. Moreover, it only allows @emph{trapping}
14445 instructions to throw exceptions, i.e.@: memory references or floating
14446 point instructions. It does not allow exceptions to be thrown from
14447 arbitrary signal handlers such as @code{SIGALRM}.
14449 @item -funwind-tables
14450 @opindex funwind-tables
14451 Similar to @option{-fexceptions}, except that it will just generate any needed
14452 static data, but will not affect the generated code in any other way.
14453 You will normally not enable this option; instead, a language processor
14454 that needs this handling would enable it on your behalf.
14456 @item -fasynchronous-unwind-tables
14457 @opindex fasynchronous-unwind-tables
14458 Generate unwind table in dwarf2 format, if supported by target machine. The
14459 table is exact at each instruction boundary, so it can be used for stack
14460 unwinding from asynchronous events (such as debugger or garbage collector).
14462 @item -fpcc-struct-return
14463 @opindex fpcc-struct-return
14464 Return ``short'' @code{struct} and @code{union} values in memory like
14465 longer ones, rather than in registers. This convention is less
14466 efficient, but it has the advantage of allowing intercallability between
14467 GCC-compiled files and files compiled with other compilers, particularly
14468 the Portable C Compiler (pcc).
14470 The precise convention for returning structures in memory depends
14471 on the target configuration macros.
14473 Short structures and unions are those whose size and alignment match
14474 that of some integer type.
14476 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14477 switch is not binary compatible with code compiled with the
14478 @option{-freg-struct-return} switch.
14479 Use it to conform to a non-default application binary interface.
14481 @item -freg-struct-return
14482 @opindex freg-struct-return
14483 Return @code{struct} and @code{union} values in registers when possible.
14484 This is more efficient for small structures than
14485 @option{-fpcc-struct-return}.
14487 If you specify neither @option{-fpcc-struct-return} nor
14488 @option{-freg-struct-return}, GCC defaults to whichever convention is
14489 standard for the target. If there is no standard convention, GCC
14490 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14491 the principal compiler. In those cases, we can choose the standard, and
14492 we chose the more efficient register return alternative.
14494 @strong{Warning:} code compiled with the @option{-freg-struct-return}
14495 switch is not binary compatible with code compiled with the
14496 @option{-fpcc-struct-return} switch.
14497 Use it to conform to a non-default application binary interface.
14499 @item -fshort-enums
14500 @opindex fshort-enums
14501 Allocate to an @code{enum} type only as many bytes as it needs for the
14502 declared range of possible values. Specifically, the @code{enum} type
14503 will be equivalent to the smallest integer type which has enough room.
14505 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
14506 code that is not binary compatible with code generated without that switch.
14507 Use it to conform to a non-default application binary interface.
14509 @item -fshort-double
14510 @opindex fshort-double
14511 Use the same size for @code{double} as for @code{float}.
14513 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
14514 code that is not binary compatible with code generated without that switch.
14515 Use it to conform to a non-default application binary interface.
14517 @item -fshort-wchar
14518 @opindex fshort-wchar
14519 Override the underlying type for @samp{wchar_t} to be @samp{short
14520 unsigned int} instead of the default for the target. This option is
14521 useful for building programs to run under WINE@.
14523 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
14524 code that is not binary compatible with code generated without that switch.
14525 Use it to conform to a non-default application binary interface.
14528 @opindex fno-common
14529 In C, allocate even uninitialized global variables in the data section of the
14530 object file, rather than generating them as common blocks. This has the
14531 effect that if the same variable is declared (without @code{extern}) in
14532 two different compilations, you will get an error when you link them.
14533 The only reason this might be useful is if you wish to verify that the
14534 program will work on other systems which always work this way.
14538 Ignore the @samp{#ident} directive.
14540 @item -finhibit-size-directive
14541 @opindex finhibit-size-directive
14542 Don't output a @code{.size} assembler directive, or anything else that
14543 would cause trouble if the function is split in the middle, and the
14544 two halves are placed at locations far apart in memory. This option is
14545 used when compiling @file{crtstuff.c}; you should not need to use it
14548 @item -fverbose-asm
14549 @opindex fverbose-asm
14550 Put extra commentary information in the generated assembly code to
14551 make it more readable. This option is generally only of use to those
14552 who actually need to read the generated assembly code (perhaps while
14553 debugging the compiler itself).
14555 @option{-fno-verbose-asm}, the default, causes the
14556 extra information to be omitted and is useful when comparing two assembler
14559 @item -frecord-gcc-switches
14560 @opindex frecord-gcc-switches
14561 This switch causes the command line that was used to invoke the
14562 compiler to be recorded into the object file that is being created.
14563 This switch is only implemented on some targets and the exact format
14564 of the recording is target and binary file format dependent, but it
14565 usually takes the form of a section containing ASCII text. This
14566 switch is related to the @option{-fverbose-asm} switch, but that
14567 switch only records information in the assembler output file as
14568 comments, so it never reaches the object file.
14572 @cindex global offset table
14574 Generate position-independent code (PIC) suitable for use in a shared
14575 library, if supported for the target machine. Such code accesses all
14576 constant addresses through a global offset table (GOT)@. The dynamic
14577 loader resolves the GOT entries when the program starts (the dynamic
14578 loader is not part of GCC; it is part of the operating system). If
14579 the GOT size for the linked executable exceeds a machine-specific
14580 maximum size, you get an error message from the linker indicating that
14581 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14582 instead. (These maximums are 8k on the SPARC and 32k
14583 on the m68k and RS/6000. The 386 has no such limit.)
14585 Position-independent code requires special support, and therefore works
14586 only on certain machines. For the 386, GCC supports PIC for System V
14587 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14588 position-independent.
14590 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14595 If supported for the target machine, emit position-independent code,
14596 suitable for dynamic linking and avoiding any limit on the size of the
14597 global offset table. This option makes a difference on the m68k,
14598 PowerPC and SPARC@.
14600 Position-independent code requires special support, and therefore works
14601 only on certain machines.
14603 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14610 These options are similar to @option{-fpic} and @option{-fPIC}, but
14611 generated position independent code can be only linked into executables.
14612 Usually these options are used when @option{-pie} GCC option will be
14613 used during linking.
14615 @option{-fpie} and @option{-fPIE} both define the macros
14616 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14617 for @option{-fpie} and 2 for @option{-fPIE}.
14619 @item -fno-jump-tables
14620 @opindex fno-jump-tables
14621 Do not use jump tables for switch statements even where it would be
14622 more efficient than other code generation strategies. This option is
14623 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14624 building code which forms part of a dynamic linker and cannot
14625 reference the address of a jump table. On some targets, jump tables
14626 do not require a GOT and this option is not needed.
14628 @item -ffixed-@var{reg}
14630 Treat the register named @var{reg} as a fixed register; generated code
14631 should never refer to it (except perhaps as a stack pointer, frame
14632 pointer or in some other fixed role).
14634 @var{reg} must be the name of a register. The register names accepted
14635 are machine-specific and are defined in the @code{REGISTER_NAMES}
14636 macro in the machine description macro file.
14638 This flag does not have a negative form, because it specifies a
14641 @item -fcall-used-@var{reg}
14642 @opindex fcall-used
14643 Treat the register named @var{reg} as an allocable register that is
14644 clobbered by function calls. It may be allocated for temporaries or
14645 variables that do not live across a call. Functions compiled this way
14646 will not save and restore the register @var{reg}.
14648 It is an error to used this flag with the frame pointer or stack pointer.
14649 Use of this flag for other registers that have fixed pervasive roles in
14650 the machine's execution model will produce disastrous results.
14652 This flag does not have a negative form, because it specifies a
14655 @item -fcall-saved-@var{reg}
14656 @opindex fcall-saved
14657 Treat the register named @var{reg} as an allocable register saved by
14658 functions. It may be allocated even for temporaries or variables that
14659 live across a call. Functions compiled this way will save and restore
14660 the register @var{reg} if they use it.
14662 It is an error to used this flag with the frame pointer or stack pointer.
14663 Use of this flag for other registers that have fixed pervasive roles in
14664 the machine's execution model will produce disastrous results.
14666 A different sort of disaster will result from the use of this flag for
14667 a register in which function values may be returned.
14669 This flag does not have a negative form, because it specifies a
14672 @item -fpack-struct[=@var{n}]
14673 @opindex fpack-struct
14674 Without a value specified, pack all structure members together without
14675 holes. When a value is specified (which must be a small power of two), pack
14676 structure members according to this value, representing the maximum
14677 alignment (that is, objects with default alignment requirements larger than
14678 this will be output potentially unaligned at the next fitting location.
14680 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14681 code that is not binary compatible with code generated without that switch.
14682 Additionally, it makes the code suboptimal.
14683 Use it to conform to a non-default application binary interface.
14685 @item -finstrument-functions
14686 @opindex finstrument-functions
14687 Generate instrumentation calls for entry and exit to functions. Just
14688 after function entry and just before function exit, the following
14689 profiling functions will be called with the address of the current
14690 function and its call site. (On some platforms,
14691 @code{__builtin_return_address} does not work beyond the current
14692 function, so the call site information may not be available to the
14693 profiling functions otherwise.)
14696 void __cyg_profile_func_enter (void *this_fn,
14698 void __cyg_profile_func_exit (void *this_fn,
14702 The first argument is the address of the start of the current function,
14703 which may be looked up exactly in the symbol table.
14705 This instrumentation is also done for functions expanded inline in other
14706 functions. The profiling calls will indicate where, conceptually, the
14707 inline function is entered and exited. This means that addressable
14708 versions of such functions must be available. If all your uses of a
14709 function are expanded inline, this may mean an additional expansion of
14710 code size. If you use @samp{extern inline} in your C code, an
14711 addressable version of such functions must be provided. (This is
14712 normally the case anyways, but if you get lucky and the optimizer always
14713 expands the functions inline, you might have gotten away without
14714 providing static copies.)
14716 A function may be given the attribute @code{no_instrument_function}, in
14717 which case this instrumentation will not be done. This can be used, for
14718 example, for the profiling functions listed above, high-priority
14719 interrupt routines, and any functions from which the profiling functions
14720 cannot safely be called (perhaps signal handlers, if the profiling
14721 routines generate output or allocate memory).
14723 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
14724 @opindex finstrument-functions-exclude-file-list
14726 Set the list of functions that are excluded from instrumentation (see
14727 the description of @code{-finstrument-functions}). If the file that
14728 contains a function definition matches with one of @var{file}, then
14729 that function is not instrumented. The match is done on substrings:
14730 if the @var{file} parameter is a substring of the file name, it is
14731 considered to be a match.
14734 @code{-finstrument-functions-exclude-file-list=/bits/stl,include/sys}
14735 will exclude any inline function defined in files whose pathnames
14736 contain @code{/bits/stl} or @code{include/sys}.
14738 If, for some reason, you want to include letter @code{','} in one of
14739 @var{sym}, write @code{'\,'}. For example,
14740 @code{-finstrument-functions-exclude-file-list='\,\,tmp'}
14741 (note the single quote surrounding the option).
14743 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
14744 @opindex finstrument-functions-exclude-function-list
14746 This is similar to @code{-finstrument-functions-exclude-file-list},
14747 but this option sets the list of function names to be excluded from
14748 instrumentation. The function name to be matched is its user-visible
14749 name, such as @code{vector<int> blah(const vector<int> &)}, not the
14750 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
14751 match is done on substrings: if the @var{sym} parameter is a substring
14752 of the function name, it is considered to be a match.
14754 @item -fstack-check
14755 @opindex fstack-check
14756 Generate code to verify that you do not go beyond the boundary of the
14757 stack. You should specify this flag if you are running in an
14758 environment with multiple threads, but only rarely need to specify it in
14759 a single-threaded environment since stack overflow is automatically
14760 detected on nearly all systems if there is only one stack.
14762 Note that this switch does not actually cause checking to be done; the
14763 operating system must do that. The switch causes generation of code
14764 to ensure that the operating system sees the stack being extended.
14766 @item -fstack-limit-register=@var{reg}
14767 @itemx -fstack-limit-symbol=@var{sym}
14768 @itemx -fno-stack-limit
14769 @opindex fstack-limit-register
14770 @opindex fstack-limit-symbol
14771 @opindex fno-stack-limit
14772 Generate code to ensure that the stack does not grow beyond a certain value,
14773 either the value of a register or the address of a symbol. If the stack
14774 would grow beyond the value, a signal is raised. For most targets,
14775 the signal is raised before the stack overruns the boundary, so
14776 it is possible to catch the signal without taking special precautions.
14778 For instance, if the stack starts at absolute address @samp{0x80000000}
14779 and grows downwards, you can use the flags
14780 @option{-fstack-limit-symbol=__stack_limit} and
14781 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
14782 of 128KB@. Note that this may only work with the GNU linker.
14784 @cindex aliasing of parameters
14785 @cindex parameters, aliased
14786 @item -fargument-alias
14787 @itemx -fargument-noalias
14788 @itemx -fargument-noalias-global
14789 @itemx -fargument-noalias-anything
14790 @opindex fargument-alias
14791 @opindex fargument-noalias
14792 @opindex fargument-noalias-global
14793 @opindex fargument-noalias-anything
14794 Specify the possible relationships among parameters and between
14795 parameters and global data.
14797 @option{-fargument-alias} specifies that arguments (parameters) may
14798 alias each other and may alias global storage.@*
14799 @option{-fargument-noalias} specifies that arguments do not alias
14800 each other, but may alias global storage.@*
14801 @option{-fargument-noalias-global} specifies that arguments do not
14802 alias each other and do not alias global storage.
14803 @option{-fargument-noalias-anything} specifies that arguments do not
14804 alias any other storage.
14806 Each language will automatically use whatever option is required by
14807 the language standard. You should not need to use these options yourself.
14809 @item -fleading-underscore
14810 @opindex fleading-underscore
14811 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14812 change the way C symbols are represented in the object file. One use
14813 is to help link with legacy assembly code.
14815 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14816 generate code that is not binary compatible with code generated without that
14817 switch. Use it to conform to a non-default application binary interface.
14818 Not all targets provide complete support for this switch.
14820 @item -ftls-model=@var{model}
14821 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14822 The @var{model} argument should be one of @code{global-dynamic},
14823 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
14825 The default without @option{-fpic} is @code{initial-exec}; with
14826 @option{-fpic} the default is @code{global-dynamic}.
14828 @item -fvisibility=@var{default|internal|hidden|protected}
14829 @opindex fvisibility
14830 Set the default ELF image symbol visibility to the specified option---all
14831 symbols will be marked with this unless overridden within the code.
14832 Using this feature can very substantially improve linking and
14833 load times of shared object libraries, produce more optimized
14834 code, provide near-perfect API export and prevent symbol clashes.
14835 It is @strong{strongly} recommended that you use this in any shared objects
14838 Despite the nomenclature, @code{default} always means public ie;
14839 available to be linked against from outside the shared object.
14840 @code{protected} and @code{internal} are pretty useless in real-world
14841 usage so the only other commonly used option will be @code{hidden}.
14842 The default if @option{-fvisibility} isn't specified is
14843 @code{default}, i.e., make every
14844 symbol public---this causes the same behavior as previous versions of
14847 A good explanation of the benefits offered by ensuring ELF
14848 symbols have the correct visibility is given by ``How To Write
14849 Shared Libraries'' by Ulrich Drepper (which can be found at
14850 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
14851 solution made possible by this option to marking things hidden when
14852 the default is public is to make the default hidden and mark things
14853 public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
14854 and @code{__attribute__ ((visibility("default")))} instead of
14855 @code{__declspec(dllexport)} you get almost identical semantics with
14856 identical syntax. This is a great boon to those working with
14857 cross-platform projects.
14859 For those adding visibility support to existing code, you may find
14860 @samp{#pragma GCC visibility} of use. This works by you enclosing
14861 the declarations you wish to set visibility for with (for example)
14862 @samp{#pragma GCC visibility push(hidden)} and
14863 @samp{#pragma GCC visibility pop}.
14864 Bear in mind that symbol visibility should be viewed @strong{as
14865 part of the API interface contract} and thus all new code should
14866 always specify visibility when it is not the default ie; declarations
14867 only for use within the local DSO should @strong{always} be marked explicitly
14868 as hidden as so to avoid PLT indirection overheads---making this
14869 abundantly clear also aids readability and self-documentation of the code.
14870 Note that due to ISO C++ specification requirements, operator new and
14871 operator delete must always be of default visibility.
14873 Be aware that headers from outside your project, in particular system
14874 headers and headers from any other library you use, may not be
14875 expecting to be compiled with visibility other than the default. You
14876 may need to explicitly say @samp{#pragma GCC visibility push(default)}
14877 before including any such headers.
14879 @samp{extern} declarations are not affected by @samp{-fvisibility}, so
14880 a lot of code can be recompiled with @samp{-fvisibility=hidden} with
14881 no modifications. However, this means that calls to @samp{extern}
14882 functions with no explicit visibility will use the PLT, so it is more
14883 effective to use @samp{__attribute ((visibility))} and/or
14884 @samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
14885 declarations should be treated as hidden.
14887 Note that @samp{-fvisibility} does affect C++ vague linkage
14888 entities. This means that, for instance, an exception class that will
14889 be thrown between DSOs must be explicitly marked with default
14890 visibility so that the @samp{type_info} nodes will be unified between
14893 An overview of these techniques, their benefits and how to use them
14894 is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
14900 @node Environment Variables
14901 @section Environment Variables Affecting GCC
14902 @cindex environment variables
14904 @c man begin ENVIRONMENT
14905 This section describes several environment variables that affect how GCC
14906 operates. Some of them work by specifying directories or prefixes to use
14907 when searching for various kinds of files. Some are used to specify other
14908 aspects of the compilation environment.
14910 Note that you can also specify places to search using options such as
14911 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
14912 take precedence over places specified using environment variables, which
14913 in turn take precedence over those specified by the configuration of GCC@.
14914 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
14915 GNU Compiler Collection (GCC) Internals}.
14920 @c @itemx LC_COLLATE
14922 @c @itemx LC_MONETARY
14923 @c @itemx LC_NUMERIC
14928 @c @findex LC_COLLATE
14929 @findex LC_MESSAGES
14930 @c @findex LC_MONETARY
14931 @c @findex LC_NUMERIC
14935 These environment variables control the way that GCC uses
14936 localization information that allow GCC to work with different
14937 national conventions. GCC inspects the locale categories
14938 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
14939 so. These locale categories can be set to any value supported by your
14940 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
14941 Kingdom encoded in UTF-8.
14943 The @env{LC_CTYPE} environment variable specifies character
14944 classification. GCC uses it to determine the character boundaries in
14945 a string; this is needed for some multibyte encodings that contain quote
14946 and escape characters that would otherwise be interpreted as a string
14949 The @env{LC_MESSAGES} environment variable specifies the language to
14950 use in diagnostic messages.
14952 If the @env{LC_ALL} environment variable is set, it overrides the value
14953 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
14954 and @env{LC_MESSAGES} default to the value of the @env{LANG}
14955 environment variable. If none of these variables are set, GCC
14956 defaults to traditional C English behavior.
14960 If @env{TMPDIR} is set, it specifies the directory to use for temporary
14961 files. GCC uses temporary files to hold the output of one stage of
14962 compilation which is to be used as input to the next stage: for example,
14963 the output of the preprocessor, which is the input to the compiler
14966 @item GCC_EXEC_PREFIX
14967 @findex GCC_EXEC_PREFIX
14968 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
14969 names of the subprograms executed by the compiler. No slash is added
14970 when this prefix is combined with the name of a subprogram, but you can
14971 specify a prefix that ends with a slash if you wish.
14973 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
14974 an appropriate prefix to use based on the pathname it was invoked with.
14976 If GCC cannot find the subprogram using the specified prefix, it
14977 tries looking in the usual places for the subprogram.
14979 The default value of @env{GCC_EXEC_PREFIX} is
14980 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
14981 the installed compiler. In many cases @var{prefix} is the value
14982 of @code{prefix} when you ran the @file{configure} script.
14984 Other prefixes specified with @option{-B} take precedence over this prefix.
14986 This prefix is also used for finding files such as @file{crt0.o} that are
14989 In addition, the prefix is used in an unusual way in finding the
14990 directories to search for header files. For each of the standard
14991 directories whose name normally begins with @samp{/usr/local/lib/gcc}
14992 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
14993 replacing that beginning with the specified prefix to produce an
14994 alternate directory name. Thus, with @option{-Bfoo/}, GCC will search
14995 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
14996 These alternate directories are searched first; the standard directories
14997 come next. If a standard directory begins with the configured
14998 @var{prefix} then the value of @var{prefix} is replaced by
14999 @env{GCC_EXEC_PREFIX} when looking for header files.
15001 @item COMPILER_PATH
15002 @findex COMPILER_PATH
15003 The value of @env{COMPILER_PATH} is a colon-separated list of
15004 directories, much like @env{PATH}. GCC tries the directories thus
15005 specified when searching for subprograms, if it can't find the
15006 subprograms using @env{GCC_EXEC_PREFIX}.
15009 @findex LIBRARY_PATH
15010 The value of @env{LIBRARY_PATH} is a colon-separated list of
15011 directories, much like @env{PATH}. When configured as a native compiler,
15012 GCC tries the directories thus specified when searching for special
15013 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
15014 using GCC also uses these directories when searching for ordinary
15015 libraries for the @option{-l} option (but directories specified with
15016 @option{-L} come first).
15020 @cindex locale definition
15021 This variable is used to pass locale information to the compiler. One way in
15022 which this information is used is to determine the character set to be used
15023 when character literals, string literals and comments are parsed in C and C++.
15024 When the compiler is configured to allow multibyte characters,
15025 the following values for @env{LANG} are recognized:
15029 Recognize JIS characters.
15031 Recognize SJIS characters.
15033 Recognize EUCJP characters.
15036 If @env{LANG} is not defined, or if it has some other value, then the
15037 compiler will use mblen and mbtowc as defined by the default locale to
15038 recognize and translate multibyte characters.
15042 Some additional environments variables affect the behavior of the
15045 @include cppenv.texi
15049 @node Precompiled Headers
15050 @section Using Precompiled Headers
15051 @cindex precompiled headers
15052 @cindex speed of compilation
15054 Often large projects have many header files that are included in every
15055 source file. The time the compiler takes to process these header files
15056 over and over again can account for nearly all of the time required to
15057 build the project. To make builds faster, GCC allows users to
15058 `precompile' a header file; then, if builds can use the precompiled
15059 header file they will be much faster.
15061 To create a precompiled header file, simply compile it as you would any
15062 other file, if necessary using the @option{-x} option to make the driver
15063 treat it as a C or C++ header file. You will probably want to use a
15064 tool like @command{make} to keep the precompiled header up-to-date when
15065 the headers it contains change.
15067 A precompiled header file will be searched for when @code{#include} is
15068 seen in the compilation. As it searches for the included file
15069 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
15070 compiler looks for a precompiled header in each directory just before it
15071 looks for the include file in that directory. The name searched for is
15072 the name specified in the @code{#include} with @samp{.gch} appended. If
15073 the precompiled header file can't be used, it is ignored.
15075 For instance, if you have @code{#include "all.h"}, and you have
15076 @file{all.h.gch} in the same directory as @file{all.h}, then the
15077 precompiled header file will be used if possible, and the original
15078 header will be used otherwise.
15080 Alternatively, you might decide to put the precompiled header file in a
15081 directory and use @option{-I} to ensure that directory is searched
15082 before (or instead of) the directory containing the original header.
15083 Then, if you want to check that the precompiled header file is always
15084 used, you can put a file of the same name as the original header in this
15085 directory containing an @code{#error} command.
15087 This also works with @option{-include}. So yet another way to use
15088 precompiled headers, good for projects not designed with precompiled
15089 header files in mind, is to simply take most of the header files used by
15090 a project, include them from another header file, precompile that header
15091 file, and @option{-include} the precompiled header. If the header files
15092 have guards against multiple inclusion, they will be skipped because
15093 they've already been included (in the precompiled header).
15095 If you need to precompile the same header file for different
15096 languages, targets, or compiler options, you can instead make a
15097 @emph{directory} named like @file{all.h.gch}, and put each precompiled
15098 header in the directory, perhaps using @option{-o}. It doesn't matter
15099 what you call the files in the directory, every precompiled header in
15100 the directory will be considered. The first precompiled header
15101 encountered in the directory that is valid for this compilation will
15102 be used; they're searched in no particular order.
15104 There are many other possibilities, limited only by your imagination,
15105 good sense, and the constraints of your build system.
15107 A precompiled header file can be used only when these conditions apply:
15111 Only one precompiled header can be used in a particular compilation.
15114 A precompiled header can't be used once the first C token is seen. You
15115 can have preprocessor directives before a precompiled header; you can
15116 even include a precompiled header from inside another header, so long as
15117 there are no C tokens before the @code{#include}.
15120 The precompiled header file must be produced for the same language as
15121 the current compilation. You can't use a C precompiled header for a C++
15125 The precompiled header file must have been produced by the same compiler
15126 binary as the current compilation is using.
15129 Any macros defined before the precompiled header is included must
15130 either be defined in the same way as when the precompiled header was
15131 generated, or must not affect the precompiled header, which usually
15132 means that they don't appear in the precompiled header at all.
15134 The @option{-D} option is one way to define a macro before a
15135 precompiled header is included; using a @code{#define} can also do it.
15136 There are also some options that define macros implicitly, like
15137 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
15140 @item If debugging information is output when using the precompiled
15141 header, using @option{-g} or similar, the same kind of debugging information
15142 must have been output when building the precompiled header. However,
15143 a precompiled header built using @option{-g} can be used in a compilation
15144 when no debugging information is being output.
15146 @item The same @option{-m} options must generally be used when building
15147 and using the precompiled header. @xref{Submodel Options},
15148 for any cases where this rule is relaxed.
15150 @item Each of the following options must be the same when building and using
15151 the precompiled header:
15153 @gccoptlist{-fexceptions -funit-at-a-time}
15156 Some other command-line options starting with @option{-f},
15157 @option{-p}, or @option{-O} must be defined in the same way as when
15158 the precompiled header was generated. At present, it's not clear
15159 which options are safe to change and which are not; the safest choice
15160 is to use exactly the same options when generating and using the
15161 precompiled header. The following are known to be safe:
15163 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
15164 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
15165 -fsched-verbose=<number> -fschedule-insns -fvisibility= @gol
15170 For all of these except the last, the compiler will automatically
15171 ignore the precompiled header if the conditions aren't met. If you
15172 find an option combination that doesn't work and doesn't cause the
15173 precompiled header to be ignored, please consider filing a bug report,
15176 If you do use differing options when generating and using the
15177 precompiled header, the actual behavior will be a mixture of the
15178 behavior for the options. For instance, if you use @option{-g} to
15179 generate the precompiled header but not when using it, you may or may
15180 not get debugging information for routines in the precompiled header.
15182 @node Running Protoize
15183 @section Running Protoize
15185 The program @code{protoize} is an optional part of GCC@. You can use
15186 it to add prototypes to a program, thus converting the program to ISO
15187 C in one respect. The companion program @code{unprotoize} does the
15188 reverse: it removes argument types from any prototypes that are found.
15190 When you run these programs, you must specify a set of source files as
15191 command line arguments. The conversion programs start out by compiling
15192 these files to see what functions they define. The information gathered
15193 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
15195 After scanning comes actual conversion. The specified files are all
15196 eligible to be converted; any files they include (whether sources or
15197 just headers) are eligible as well.
15199 But not all the eligible files are converted. By default,
15200 @code{protoize} and @code{unprotoize} convert only source and header
15201 files in the current directory. You can specify additional directories
15202 whose files should be converted with the @option{-d @var{directory}}
15203 option. You can also specify particular files to exclude with the
15204 @option{-x @var{file}} option. A file is converted if it is eligible, its
15205 directory name matches one of the specified directory names, and its
15206 name within the directory has not been excluded.
15208 Basic conversion with @code{protoize} consists of rewriting most
15209 function definitions and function declarations to specify the types of
15210 the arguments. The only ones not rewritten are those for varargs
15213 @code{protoize} optionally inserts prototype declarations at the
15214 beginning of the source file, to make them available for any calls that
15215 precede the function's definition. Or it can insert prototype
15216 declarations with block scope in the blocks where undeclared functions
15219 Basic conversion with @code{unprotoize} consists of rewriting most
15220 function declarations to remove any argument types, and rewriting
15221 function definitions to the old-style pre-ISO form.
15223 Both conversion programs print a warning for any function declaration or
15224 definition that they can't convert. You can suppress these warnings
15227 The output from @code{protoize} or @code{unprotoize} replaces the
15228 original source file. The original file is renamed to a name ending
15229 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
15230 without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav}
15231 for DOS) file already exists, then the source file is simply discarded.
15233 @code{protoize} and @code{unprotoize} both depend on GCC itself to
15234 scan the program and collect information about the functions it uses.
15235 So neither of these programs will work until GCC is installed.
15237 Here is a table of the options you can use with @code{protoize} and
15238 @code{unprotoize}. Each option works with both programs unless
15242 @item -B @var{directory}
15243 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
15244 usual directory (normally @file{/usr/local/lib}). This file contains
15245 prototype information about standard system functions. This option
15246 applies only to @code{protoize}.
15248 @item -c @var{compilation-options}
15249 Use @var{compilation-options} as the options when running @command{gcc} to
15250 produce the @samp{.X} files. The special option @option{-aux-info} is
15251 always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
15253 Note that the compilation options must be given as a single argument to
15254 @code{protoize} or @code{unprotoize}. If you want to specify several
15255 @command{gcc} options, you must quote the entire set of compilation options
15256 to make them a single word in the shell.
15258 There are certain @command{gcc} arguments that you cannot use, because they
15259 would produce the wrong kind of output. These include @option{-g},
15260 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
15261 the @var{compilation-options}, they are ignored.
15264 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
15265 systems) instead of @samp{.c}. This is convenient if you are converting
15266 a C program to C++. This option applies only to @code{protoize}.
15269 Add explicit global declarations. This means inserting explicit
15270 declarations at the beginning of each source file for each function
15271 that is called in the file and was not declared. These declarations
15272 precede the first function definition that contains a call to an
15273 undeclared function. This option applies only to @code{protoize}.
15275 @item -i @var{string}
15276 Indent old-style parameter declarations with the string @var{string}.
15277 This option applies only to @code{protoize}.
15279 @code{unprotoize} converts prototyped function definitions to old-style
15280 function definitions, where the arguments are declared between the
15281 argument list and the initial @samp{@{}. By default, @code{unprotoize}
15282 uses five spaces as the indentation. If you want to indent with just
15283 one space instead, use @option{-i " "}.
15286 Keep the @samp{.X} files. Normally, they are deleted after conversion
15290 Add explicit local declarations. @code{protoize} with @option{-l} inserts
15291 a prototype declaration for each function in each block which calls the
15292 function without any declaration. This option applies only to
15296 Make no real changes. This mode just prints information about the conversions
15297 that would have been done without @option{-n}.
15300 Make no @samp{.save} files. The original files are simply deleted.
15301 Use this option with caution.
15303 @item -p @var{program}
15304 Use the program @var{program} as the compiler. Normally, the name
15305 @file{gcc} is used.
15308 Work quietly. Most warnings are suppressed.
15311 Print the version number, just like @option{-v} for @command{gcc}.
15314 If you need special compiler options to compile one of your program's
15315 source files, then you should generate that file's @samp{.X} file
15316 specially, by running @command{gcc} on that source file with the
15317 appropriate options and the option @option{-aux-info}. Then run
15318 @code{protoize} on the entire set of files. @code{protoize} will use
15319 the existing @samp{.X} file because it is newer than the source file.
15323 gcc -Dfoo=bar file1.c -aux-info file1.X
15328 You need to include the special files along with the rest in the
15329 @code{protoize} command, even though their @samp{.X} files already
15330 exist, because otherwise they won't get converted.
15332 @xref{Protoize Caveats}, for more information on how to use
15333 @code{protoize} successfully.