cea120c1dc0194455900bf3d8f8a585f7dfde514
[gcc.git] / gcc / doc / invoke.texi
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.
6
7 @ignore
8 @c man begin INCLUDE
9 @include gcc-vers.texi
10 @c man end
11
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.
15
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.
23
24 (a) The FSF's Front-Cover Text is:
25
26 A GNU Manual
27
28 (b) The FSF's Back-Cover Text is:
29
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.
33 @c man end
34 @c Set file name and title for the man page.
35 @setfilename gcc
36 @settitle GNU project C and C++ compiler
37 @c man begin SYNOPSIS
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{}
45
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}.
48 @c man end
49 @c man begin SEEALSO
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}.
54 @c man end
55 @c man begin BUGS
56 For instructions on reporting bugs, see
57 @w{@uref{http://gcc.gnu.org/bugs.html}}.
58 @c man end
59 @c man begin AUTHOR
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@.
63 @c man end
64 @end ignore
65
66 @node Invoking GCC
67 @chapter GCC Command Options
68 @cindex GCC command options
69 @cindex command options
70 @cindex options, GCC command
71
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.
78
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.
83
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.
90
91 @cindex C++ compilation options
92 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
93 options for compiling C++ programs.
94
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
100 -r}}.
101
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 options
106 of the same kind; for example, if you specify @option{-L} more than once,
107 the directories are searched in the order specified.
108
109 Many options have long names starting with @samp{-f} or with
110 @samp{-W}---for example,
111 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
112 these have both positive and negative forms; the negative form of
113 @option{-ffoo} would be @option{-fno-foo}. This manual documents
114 only one of these two forms, whichever one is not the default.
115
116 @c man end
117
118 @xref{Option Index}, for an index to GCC's options.
119
120 @menu
121 * Option Summary:: Brief list of all options, without explanations.
122 * Overall Options:: Controlling the kind of output:
123 an executable, object files, assembler files,
124 or preprocessed source.
125 * Invoking G++:: Compiling C++ programs.
126 * C Dialect Options:: Controlling the variant of C language compiled.
127 * C++ Dialect Options:: Variations on C++.
128 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
129 and Objective-C++.
130 * Language Independent Options:: Controlling how diagnostics should be
131 formatted.
132 * Warning Options:: How picky should the compiler be?
133 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
134 * Optimize Options:: How much optimization?
135 * Preprocessor Options:: Controlling header files and macro definitions.
136 Also, getting dependency information for Make.
137 * Assembler Options:: Passing options to the assembler.
138 * Link Options:: Specifying libraries and so on.
139 * Directory Options:: Where to find header files and libraries.
140 Where to find the compiler executable files.
141 * Spec Files:: How to pass switches to sub-processes.
142 * Target Options:: Running a cross-compiler, or an old version of GCC.
143 * Submodel Options:: Specifying minor hardware or convention variations,
144 such as 68010 vs 68020.
145 * Code Gen Options:: Specifying conventions for function calls, data layout
146 and register usage.
147 * Environment Variables:: Env vars that affect GCC.
148 * Precompiled Headers:: Compiling a header once, and using it many times.
149 * Running Protoize:: Automatically adding or removing function prototypes.
150 @end menu
151
152 @c man begin OPTIONS
153
154 @node Option Summary
155 @section Option Summary
156
157 Here is a summary of all the options, grouped by type. Explanations are
158 in the following sections.
159
160 @table @emph
161 @item Overall Options
162 @xref{Overall Options,,Options Controlling the Kind of Output}.
163 @gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol
164 -x @var{language} -v -### --help@r{[}=@var{class}@r{]} --target-help @gol
165 --version @@@var{file}}
166
167 @item C Language Options
168 @xref{C Dialect Options,,Options Controlling C Dialect}.
169 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
170 -aux-info @var{filename} @gol
171 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
172 -fhosted -ffreestanding -fopenmp -fms-extensions @gol
173 -trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
174 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
175 -fsigned-bitfields -fsigned-char @gol
176 -funsigned-bitfields -funsigned-char}
177
178 @item C++ Language Options
179 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
180 @gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
181 -fconserve-space -ffriend-injection @gol
182 -fno-elide-constructors @gol
183 -fno-enforce-eh-specs @gol
184 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
185 -fno-implicit-templates @gol
186 -fno-implicit-inline-templates @gol
187 -fno-implement-inlines -fms-extensions @gol
188 -fno-nonansi-builtins -fno-operator-names @gol
189 -fno-optional-diags -fpermissive @gol
190 -frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
191 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
192 -fno-default-inline -fvisibility-inlines-hidden @gol
193 -Wabi -Wctor-dtor-privacy @gol
194 -Wnon-virtual-dtor -Wreorder @gol
195 -Weffc++ -Wno-deprecated -Wstrict-null-sentinel @gol
196 -Wno-non-template-friend -Wold-style-cast @gol
197 -Woverloaded-virtual -Wno-pmf-conversions @gol
198 -Wsign-promo}
199
200 @item Objective-C and Objective-C++ Language Options
201 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
202 Objective-C and Objective-C++ Dialects}.
203 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
204 -fgnu-runtime -fnext-runtime @gol
205 -fno-nil-receivers @gol
206 -fobjc-call-cxx-cdtors @gol
207 -fobjc-direct-dispatch @gol
208 -fobjc-exceptions @gol
209 -fobjc-gc @gol
210 -freplace-objc-classes @gol
211 -fzero-link @gol
212 -gen-decls @gol
213 -Wassign-intercept @gol
214 -Wno-protocol -Wselector @gol
215 -Wstrict-selector-match @gol
216 -Wundeclared-selector}
217
218 @item Language Independent Options
219 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
220 @gccoptlist{-fmessage-length=@var{n} @gol
221 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
222 -fdiagnostics-show-option}
223
224 @item Warning Options
225 @xref{Warning Options,,Options to Request or Suppress Warnings}.
226 @gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol
227 -w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
228 -Wno-attributes -Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual @gol
229 -Wchar-subscripts -Wclobbered -Wcomment @gol
230 -Wconversion -Wcoverage-mismatch -Wno-deprecated-declarations @gol
231 -Wdisabled-optimization -Wno-div-by-zero @gol
232 -Wempty-body -Wno-endif-labels @gol
233 -Werror -Werror=* @gol
234 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
235 -Wno-format-extra-args -Wformat-nonliteral @gol
236 -Wformat-security -Wformat-y2k @gol
237 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
238 -Wimport -Wno-import -Winit-self -Winline @gol
239 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
240 -Winvalid-pch -Wlarger-than-@var{len} -Wunsafe-loop-optimizations @gol
241 -Wlogical-op -Wlong-long @gol
242 -Wmain -Wmissing-braces -Wmissing-field-initializers @gol
243 -Wmissing-format-attribute -Wmissing-include-dirs @gol
244 -Wmissing-noreturn @gol
245 -Wno-multichar -Wnonnull -Wno-overflow @gol
246 -Woverlength-strings -Wpacked -Wpadded @gol
247 -Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol
248 -Wredundant-decls @gol
249 -Wreturn-type -Wsequence-point -Wshadow @gol
250 -Wsign-compare -Wstack-protector @gol
251 -Wstrict-aliasing -Wstrict-aliasing=2 @gol
252 -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
253 -Wswitch -Wswitch-default -Wswitch-enum @gol
254 -Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol
255 -Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol
256 -Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol
257 -Wunused-value -Wunused-variable @gol
258 -Wvariadic-macros -Wvla @gol
259 -Wvolatile-register-var -Wwrite-strings}
260
261 @item C-only Warning Options
262 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
263 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
264 -Wold-style-declaration -Wold-style-definition @gol
265 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
266 -Wdeclaration-after-statement -Wpointer-sign}
267
268 @item Debugging Options
269 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
270 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
271 -fdump-noaddr -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
272 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
273 -fdump-ipa-all -fdump-ipa-cgraph @gol
274 -fdump-tree-all @gol
275 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
276 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
277 -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
278 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
279 -fdump-tree-ch @gol
280 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
281 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
282 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
283 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
284 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
285 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
286 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
287 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
288 -fdump-tree-nrv -fdump-tree-vect @gol
289 -fdump-tree-sink @gol
290 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
291 -fdump-tree-salias @gol
292 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
293 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
294 -ftree-vectorizer-verbose=@var{n} @gol
295 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
296 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
297 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
298 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
299 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
300 -ftest-coverage -ftime-report -fvar-tracking @gol
301 -g -g@var{level} -gcoff -gdwarf-2 @gol
302 -ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol
303 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
304 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
305 -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
306 -print-multi-directory -print-multi-lib @gol
307 -print-prog-name=@var{program} -print-search-dirs -Q @gol
308 -print-sysroot-headers-suffix @gol
309 -save-temps -time}
310
311 @item Optimization Options
312 @xref{Optimize Options,,Options that Control Optimization}.
313 @gccoptlist{-falign-functions=@var{n} -falign-jumps=@var{n} @gol
314 -falign-labels=@var{n} -falign-loops=@var{n} @gol
315 -fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
316 -fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
317 -fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
318 -fcaller-saves -fcprop-registers -fcse-follow-jumps @gol
319 -fcse-skip-blocks -fcx-limited-range -fdata-sections @gol
320 -fdelayed-branch -fdelete-null-pointer-checks -fearly-inlining @gol
321 -fexpensive-optimizations -ffast-math -ffloat-store @gol
322 -fforce-addr -fforward-propagate -ffunction-sections @gol
323 -fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol
324 -fcrossjumping -fif-conversion -fif-conversion2 @gol
325 -finline-functions -finline-functions-called-once @gol
326 -finline-limit=@var{n} -fkeep-inline-functions @gol
327 -fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol
328 -fmodulo-sched -fno-branch-count-reg @gol
329 -fno-default-inline -fno-defer-pop -fmove-loop-invariants @gol
330 -fno-function-cse -fno-guess-branch-probability @gol
331 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
332 -funsafe-math-optimizations -funsafe-loop-optimizations @gol
333 -ffinite-math-only -fno-signed-zeros @gol
334 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
335 -fomit-frame-pointer -foptimize-register-move @gol
336 -foptimize-sibling-calls -fprefetch-loop-arrays @gol
337 -fprofile-generate -fprofile-use @gol
338 -fregmove -frename-registers @gol
339 -freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol
340 -frerun-cse-after-loop @gol
341 -frounding-math -frtl-abstract-sequences @gol
342 -fschedule-insns -fschedule-insns2 @gol
343 -fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol
344 -fsched-spec-load-dangerous @gol
345 -fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol
346 -fsched2-use-superblocks @gol
347 -fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol
348 -fsection-anchors -fsignaling-nans -fsingle-precision-constant @gol
349 -fno-split-wide-types -fstack-protector -fstack-protector-all @gol
350 -fstrict-aliasing -fstrict-overflow -ftracer -fthread-jumps @gol
351 -funroll-all-loops -funroll-loops -fpeel-loops @gol
352 -fsplit-ivs-in-unroller -funswitch-loops @gol
353 -fvariable-expansion-in-unroller @gol
354 -ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol
355 -ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol
356 -fcheck-data-deps @gol
357 -ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol
358 -ftree-ch -ftree-sra -ftree-ter -ftree-fre -ftree-vectorize @gol
359 -ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol
360 -ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol
361 --param @var{name}=@var{value}
362 -O -O0 -O1 -O2 -O3 -Os}
363
364 @item Preprocessor Options
365 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
366 @gccoptlist{-A@var{question}=@var{answer} @gol
367 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
368 -C -dD -dI -dM -dN @gol
369 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
370 -idirafter @var{dir} @gol
371 -include @var{file} -imacros @var{file} @gol
372 -iprefix @var{file} -iwithprefix @var{dir} @gol
373 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
374 -imultilib @var{dir} -isysroot @var{dir} @gol
375 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
376 -P -fworking-directory -remap @gol
377 -trigraphs -undef -U@var{macro} -Wp,@var{option} @gol
378 -Xpreprocessor @var{option}}
379
380 @item Assembler Option
381 @xref{Assembler Options,,Passing Options to the Assembler}.
382 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
383
384 @item Linker Options
385 @xref{Link Options,,Options for Linking}.
386 @gccoptlist{@var{object-file-name} -l@var{library} @gol
387 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
388 -s -static -static-libgcc -shared -shared-libgcc -symbolic @gol
389 -Wl,@var{option} -Xlinker @var{option} @gol
390 -u @var{symbol}}
391
392 @item Directory Options
393 @xref{Directory Options,,Options for Directory Search}.
394 @gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir}
395 -specs=@var{file} -I- --sysroot=@var{dir}}
396
397 @item Target Options
398 @c I wrote this xref this way to avoid overfull hbox. -- rms
399 @xref{Target Options}.
400 @gccoptlist{-V @var{version} -b @var{machine}}
401
402 @item Machine Dependent Options
403 @xref{Submodel Options,,Hardware Models and Configurations}.
404 @c This list is ordered alphanumerically by subsection name.
405 @c Try and put the significant identifier (CPU or system) first,
406 @c so users have a clue at guessing where the ones they want will be.
407
408 @emph{ARC Options}
409 @gccoptlist{-EB -EL @gol
410 -mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol
411 -mdata=@var{data-section} -mrodata=@var{readonly-data-section}}
412
413 @emph{ARM Options}
414 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
415 -mabi=@var{name} @gol
416 -mapcs-stack-check -mno-apcs-stack-check @gol
417 -mapcs-float -mno-apcs-float @gol
418 -mapcs-reentrant -mno-apcs-reentrant @gol
419 -msched-prolog -mno-sched-prolog @gol
420 -mlittle-endian -mbig-endian -mwords-little-endian @gol
421 -mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol
422 -mthumb-interwork -mno-thumb-interwork @gol
423 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
424 -mstructure-size-boundary=@var{n} @gol
425 -mabort-on-noreturn @gol
426 -mlong-calls -mno-long-calls @gol
427 -msingle-pic-base -mno-single-pic-base @gol
428 -mpic-register=@var{reg} @gol
429 -mnop-fun-dllimport @gol
430 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
431 -mpoke-function-name @gol
432 -mthumb -marm @gol
433 -mtpcs-frame -mtpcs-leaf-frame @gol
434 -mcaller-super-interworking -mcallee-super-interworking @gol
435 -mtp=@var{name}}
436
437 @emph{AVR Options}
438 @gccoptlist{-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol
439 -mcall-prologues -mno-tablejump -mtiny-stack -mint8}
440
441 @emph{Blackfin Options}
442 @gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
443 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
444 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
445 -mno-id-shared-library -mshared-library-id=@var{n} @gol
446 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
447 -msep-data -mno-sep-data -mlong-calls -mno-long-calls}
448
449 @emph{CRIS Options}
450 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
451 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
452 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
453 -mstack-align -mdata-align -mconst-align @gol
454 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
455 -melf -maout -melinux -mlinux -sim -sim2 @gol
456 -mmul-bug-workaround -mno-mul-bug-workaround}
457
458 @emph{CRX Options}
459 @gccoptlist{-mmac -mpush-args}
460
461 @emph{Darwin Options}
462 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
463 -arch_only -bind_at_load -bundle -bundle_loader @gol
464 -client_name -compatibility_version -current_version @gol
465 -dead_strip @gol
466 -dependency-file -dylib_file -dylinker_install_name @gol
467 -dynamic -dynamiclib -exported_symbols_list @gol
468 -filelist -flat_namespace -force_cpusubtype_ALL @gol
469 -force_flat_namespace -headerpad_max_install_names @gol
470 -iframework @gol
471 -image_base -init -install_name -keep_private_externs @gol
472 -multi_module -multiply_defined -multiply_defined_unused @gol
473 -noall_load -no_dead_strip_inits_and_terms @gol
474 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
475 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
476 -private_bundle -read_only_relocs -sectalign @gol
477 -sectobjectsymbols -whyload -seg1addr @gol
478 -sectcreate -sectobjectsymbols -sectorder @gol
479 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
480 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
481 -segprot -segs_read_only_addr -segs_read_write_addr @gol
482 -single_module -static -sub_library -sub_umbrella @gol
483 -twolevel_namespace -umbrella -undefined @gol
484 -unexported_symbols_list -weak_reference_mismatches @gol
485 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
486 -mkernel -mone-byte-bool}
487
488 @emph{DEC Alpha Options}
489 @gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol
490 -mieee -mieee-with-inexact -mieee-conformant @gol
491 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
492 -mtrap-precision=@var{mode} -mbuild-constants @gol
493 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
494 -mbwx -mmax -mfix -mcix @gol
495 -mfloat-vax -mfloat-ieee @gol
496 -mexplicit-relocs -msmall-data -mlarge-data @gol
497 -msmall-text -mlarge-text @gol
498 -mmemory-latency=@var{time}}
499
500 @emph{DEC Alpha/VMS Options}
501 @gccoptlist{-mvms-return-codes}
502
503 @emph{FRV Options}
504 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
505 -mhard-float -msoft-float @gol
506 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
507 -mdouble -mno-double @gol
508 -mmedia -mno-media -mmuladd -mno-muladd @gol
509 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
510 -mlinked-fp -mlong-calls -malign-labels @gol
511 -mlibrary-pic -macc-4 -macc-8 @gol
512 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
513 -moptimize-membar -mno-optimize-membar @gol
514 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
515 -mvliw-branch -mno-vliw-branch @gol
516 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
517 -mno-nested-cond-exec -mtomcat-stats @gol
518 -mTLS -mtls @gol
519 -mcpu=@var{cpu}}
520
521 @emph{GNU/Linux Options}
522 @gccoptlist{-muclibc}
523
524 @emph{H8/300 Options}
525 @gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300}
526
527 @emph{HPPA Options}
528 @gccoptlist{-march=@var{architecture-type} @gol
529 -mbig-switch -mdisable-fpregs -mdisable-indexing @gol
530 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
531 -mfixed-range=@var{register-range} @gol
532 -mjump-in-delay -mlinker-opt -mlong-calls @gol
533 -mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
534 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
535 -mno-jump-in-delay -mno-long-load-store @gol
536 -mno-portable-runtime -mno-soft-float @gol
537 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
538 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
539 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
540 -munix=@var{unix-std} -nolibdld -static -threads}
541
542 @emph{i386 and x86-64 Options}
543 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
544 -mfpmath=@var{unit} @gol
545 -masm=@var{dialect} -mno-fancy-math-387 @gol
546 -mno-fp-ret-in-387 -msoft-float @gol
547 -mno-wide-multiply -mrtd -malign-double @gol
548 -mpreferred-stack-boundary=@var{num} -mcx16 -msahf @gol
549 -mmmx -msse -msse2 -msse3 -mssse3 -msse4a -m3dnow -mpopcnt -mabm @gol
550 -mthreads -mno-align-stringops -minline-all-stringops @gol
551 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
552 -m96bit-long-double -mregparm=@var{num} -msseregparm @gol
553 -mpc32 -mpc64 -mpc80 mstackrealign @gol
554 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
555 -mcmodel=@var{code-model} @gol
556 -m32 -m64 -mlarge-data-threshold=@var{num}}
557
558 @emph{IA-64 Options}
559 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
560 -mvolatile-asm-stop -mregister-names -mno-sdata @gol
561 -mconstant-gp -mauto-pic -minline-float-divide-min-latency @gol
562 -minline-float-divide-max-throughput @gol
563 -minline-int-divide-min-latency @gol
564 -minline-int-divide-max-throughput @gol
565 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
566 -mno-dwarf2-asm -mearly-stop-bits @gol
567 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
568 -mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol
569 -mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol
570 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
571 -msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol
572 -mno-sched-prefer-non-data-spec-insns @gol
573 -mno-sched-prefer-non-control-spec-insns @gol
574 -mno-sched-count-spec-in-critical-path}
575
576 @emph{M32R/D Options}
577 @gccoptlist{-m32r2 -m32rx -m32r @gol
578 -mdebug @gol
579 -malign-loops -mno-align-loops @gol
580 -missue-rate=@var{number} @gol
581 -mbranch-cost=@var{number} @gol
582 -mmodel=@var{code-size-model-type} @gol
583 -msdata=@var{sdata-type} @gol
584 -mno-flush-func -mflush-func=@var{name} @gol
585 -mno-flush-trap -mflush-trap=@var{number} @gol
586 -G @var{num}}
587
588 @emph{M32C Options}
589 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
590
591 @emph{M680x0 Options}
592 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
593 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
594 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
595 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
596 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
597 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
598 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
599 -mshared-library-id=n -mid-shared-library -mno-id-shared-library}
600
601 @emph{M68hc1x Options}
602 @gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol
603 -mauto-incdec -minmax -mlong-calls -mshort @gol
604 -msoft-reg-count=@var{count}}
605
606 @emph{MCore Options}
607 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
608 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
609 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
610 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
611 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
612
613 @emph{MIPS Options}
614 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
615 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol
616 -mips16 -mno-mips16 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
617 -mshared -mno-shared -mxgot -mno-xgot -mgp32 -mgp64 @gol
618 -mfp32 -mfp64 -mhard-float -msoft-float @gol
619 -msingle-float -mdouble-float -mdsp -mdspr2 -mpaired-single -mips3d @gol
620 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
621 -G@var{num} -membedded-data -mno-embedded-data @gol
622 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
623 -msplit-addresses -mno-split-addresses @gol
624 -mexplicit-relocs -mno-explicit-relocs @gol
625 -mcheck-zero-division -mno-check-zero-division @gol
626 -mdivide-traps -mdivide-breaks @gol
627 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
628 -mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol
629 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
630 -mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130 @gol
631 -mfix-sb1 -mno-fix-sb1 @gol
632 -mflush-func=@var{func} -mno-flush-func @gol
633 -mbranch-likely -mno-branch-likely @gol
634 -mfp-exceptions -mno-fp-exceptions @gol
635 -mvr4130-align -mno-vr4130-align}
636
637 @emph{MMIX Options}
638 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
639 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
640 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
641 -mno-base-addresses -msingle-exit -mno-single-exit}
642
643 @emph{MN10300 Options}
644 @gccoptlist{-mmult-bug -mno-mult-bug @gol
645 -mam33 -mno-am33 @gol
646 -mam33-2 -mno-am33-2 @gol
647 -mreturn-pointer-on-d0 @gol
648 -mno-crt0 -mrelax}
649
650 @emph{MT Options}
651 @gccoptlist{-mno-crt0 -mbacc -msim @gol
652 -march=@var{cpu-type} }
653
654 @emph{PDP-11 Options}
655 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
656 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
657 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
658 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
659 -mbranch-expensive -mbranch-cheap @gol
660 -msplit -mno-split -munix-asm -mdec-asm}
661
662 @emph{PowerPC Options}
663 See RS/6000 and PowerPC Options.
664
665 @emph{RS/6000 and PowerPC Options}
666 @gccoptlist{-mcpu=@var{cpu-type} @gol
667 -mtune=@var{cpu-type} @gol
668 -mpower -mno-power -mpower2 -mno-power2 @gol
669 -mpowerpc -mpowerpc64 -mno-powerpc @gol
670 -maltivec -mno-altivec @gol
671 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
672 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
673 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mfprnd -mno-fprnd @gol
674 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mdfp -mno-dfp @gol
675 -mnew-mnemonics -mold-mnemonics @gol
676 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
677 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
678 -malign-power -malign-natural @gol
679 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
680 -mstring -mno-string -mupdate -mno-update @gol
681 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
682 -mstrict-align -mno-strict-align -mrelocatable @gol
683 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
684 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
685 -mdynamic-no-pic -maltivec -mswdiv @gol
686 -mprioritize-restricted-insns=@var{priority} @gol
687 -msched-costly-dep=@var{dependence_type} @gol
688 -minsert-sched-nops=@var{scheme} @gol
689 -mcall-sysv -mcall-netbsd @gol
690 -maix-struct-return -msvr4-struct-return @gol
691 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
692 -misel -mno-isel @gol
693 -misel=yes -misel=no @gol
694 -mspe -mno-spe @gol
695 -mspe=yes -mspe=no @gol
696 -mvrsave -mno-vrsave @gol
697 -mmulhw -mno-mulhw @gol
698 -mdlmzb -mno-dlmzb @gol
699 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
700 -mprototype -mno-prototype @gol
701 -msim -mmvme -mads -myellowknife -memb -msdata @gol
702 -msdata=@var{opt} -mvxworks -mwindiss -G @var{num} -pthread}
703
704 @emph{S/390 and zSeries Options}
705 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
706 -mhard-float -msoft-float -mlong-double-64 -mlong-double-128 @gol
707 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
708 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
709 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
710 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
711 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard}
712
713 @emph{Score Options}
714 @gccoptlist{-meb -mel @gol
715 -mnhwloop @gol
716 -muls @gol
717 -mmac @gol
718 -mscore5 -mscore5u -mscore7 -mscore7d}
719
720 @emph{SH Options}
721 @gccoptlist{-m1 -m2 -m2e -m3 -m3e @gol
722 -m4-nofpu -m4-single-only -m4-single -m4 @gol
723 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
724 -m5-64media -m5-64media-nofpu @gol
725 -m5-32media -m5-32media-nofpu @gol
726 -m5-compact -m5-compact-nofpu @gol
727 -mb -ml -mdalign -mrelax @gol
728 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
729 -mieee -misize -minline-ic_invalidate -mpadstruct -mspace @gol
730 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
731 -mdivsi3_libfunc=@var{name} @gol
732 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
733 -minvalid-symbols}
734
735 @emph{SPARC Options}
736 @gccoptlist{-mcpu=@var{cpu-type} @gol
737 -mtune=@var{cpu-type} @gol
738 -mcmodel=@var{code-model} @gol
739 -m32 -m64 -mapp-regs -mno-app-regs @gol
740 -mfaster-structs -mno-faster-structs @gol
741 -mfpu -mno-fpu -mhard-float -msoft-float @gol
742 -mhard-quad-float -msoft-quad-float @gol
743 -mimpure-text -mno-impure-text -mlittle-endian @gol
744 -mstack-bias -mno-stack-bias @gol
745 -munaligned-doubles -mno-unaligned-doubles @gol
746 -mv8plus -mno-v8plus -mvis -mno-vis
747 -threads -pthreads -pthread}
748
749 @emph{SPU Options}
750 @gccoptlist{-mwarn-reloc -merror-reloc @gol
751 -msafe-dma -munsafe-dma @gol
752 -mbranch-hints @gol
753 -msmall-mem -mlarge-mem -mstdmain @gol
754 -mfixed-range=@var{register-range}}
755
756 @emph{System V Options}
757 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
758
759 @emph{TMS320C3x/C4x Options}
760 @gccoptlist{-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol
761 -mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol
762 -mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol
763 -mparallel-insns -mparallel-mpy -mpreserve-float}
764
765 @emph{V850 Options}
766 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
767 -mprolog-function -mno-prolog-function -mspace @gol
768 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
769 -mapp-regs -mno-app-regs @gol
770 -mdisable-callt -mno-disable-callt @gol
771 -mv850e1 @gol
772 -mv850e @gol
773 -mv850 -mbig-switch}
774
775 @emph{VAX Options}
776 @gccoptlist{-mg -mgnu -munix}
777
778 @emph{VxWorks Options}
779 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
780 -Xbind-lazy -Xbind-now}
781
782 @emph{x86-64 Options}
783 See i386 and x86-64 Options.
784
785 @emph{Xstormy16 Options}
786 @gccoptlist{-msim}
787
788 @emph{Xtensa Options}
789 @gccoptlist{-mconst16 -mno-const16 @gol
790 -mfused-madd -mno-fused-madd @gol
791 -mtext-section-literals -mno-text-section-literals @gol
792 -mtarget-align -mno-target-align @gol
793 -mlongcalls -mno-longcalls}
794
795 @emph{zSeries Options}
796 See S/390 and zSeries Options.
797
798 @item Code Generation Options
799 @xref{Code Gen Options,,Options for Code Generation Conventions}.
800 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
801 -ffixed-@var{reg} -fexceptions @gol
802 -fnon-call-exceptions -funwind-tables @gol
803 -fasynchronous-unwind-tables @gol
804 -finhibit-size-directive -finstrument-functions @gol
805 -fno-common -fno-ident @gol
806 -fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
807 -fno-jump-tables @gol
808 -frecord-gcc-switches @gol
809 -freg-struct-return -fshort-enums @gol
810 -fshort-double -fshort-wchar @gol
811 -fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
812 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
813 -fargument-alias -fargument-noalias @gol
814 -fargument-noalias-global -fargument-noalias-anything
815 -fleading-underscore -ftls-model=@var{model} @gol
816 -ftrapv -fwrapv -fbounds-check @gol
817 -fvisibility}
818 @end table
819
820 @menu
821 * Overall Options:: Controlling the kind of output:
822 an executable, object files, assembler files,
823 or preprocessed source.
824 * C Dialect Options:: Controlling the variant of C language compiled.
825 * C++ Dialect Options:: Variations on C++.
826 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
827 and Objective-C++.
828 * Language Independent Options:: Controlling how diagnostics should be
829 formatted.
830 * Warning Options:: How picky should the compiler be?
831 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
832 * Optimize Options:: How much optimization?
833 * Preprocessor Options:: Controlling header files and macro definitions.
834 Also, getting dependency information for Make.
835 * Assembler Options:: Passing options to the assembler.
836 * Link Options:: Specifying libraries and so on.
837 * Directory Options:: Where to find header files and libraries.
838 Where to find the compiler executable files.
839 * Spec Files:: How to pass switches to sub-processes.
840 * Target Options:: Running a cross-compiler, or an old version of GCC.
841 @end menu
842
843 @node Overall Options
844 @section Options Controlling the Kind of Output
845
846 Compilation can involve up to four stages: preprocessing, compilation
847 proper, assembly and linking, always in that order. GCC is capable of
848 preprocessing and compiling several files either into several
849 assembler input files, or into one assembler input file; then each
850 assembler input file produces an object file, and linking combines all
851 the object files (those newly compiled, and those specified as input)
852 into an executable file.
853
854 @cindex file name suffix
855 For any given input file, the file name suffix determines what kind of
856 compilation is done:
857
858 @table @gcctabopt
859 @item @var{file}.c
860 C source code which must be preprocessed.
861
862 @item @var{file}.i
863 C source code which should not be preprocessed.
864
865 @item @var{file}.ii
866 C++ source code which should not be preprocessed.
867
868 @item @var{file}.m
869 Objective-C source code. Note that you must link with the @file{libobjc}
870 library to make an Objective-C program work.
871
872 @item @var{file}.mi
873 Objective-C source code which should not be preprocessed.
874
875 @item @var{file}.mm
876 @itemx @var{file}.M
877 Objective-C++ source code. Note that you must link with the @file{libobjc}
878 library to make an Objective-C++ program work. Note that @samp{.M} refers
879 to a literal capital M@.
880
881 @item @var{file}.mii
882 Objective-C++ source code which should not be preprocessed.
883
884 @item @var{file}.h
885 C, C++, Objective-C or Objective-C++ header file to be turned into a
886 precompiled header.
887
888 @item @var{file}.cc
889 @itemx @var{file}.cp
890 @itemx @var{file}.cxx
891 @itemx @var{file}.cpp
892 @itemx @var{file}.CPP
893 @itemx @var{file}.c++
894 @itemx @var{file}.C
895 C++ source code which must be preprocessed. Note that in @samp{.cxx},
896 the last two letters must both be literally @samp{x}. Likewise,
897 @samp{.C} refers to a literal capital C@.
898
899 @item @var{file}.mm
900 @itemx @var{file}.M
901 Objective-C++ source code which must be preprocessed.
902
903 @item @var{file}.mii
904 Objective-C++ source code which should not be preprocessed.
905
906 @item @var{file}.hh
907 @itemx @var{file}.H
908 C++ header file to be turned into a precompiled header.
909
910 @item @var{file}.f
911 @itemx @var{file}.for
912 @itemx @var{file}.FOR
913 Fixed form Fortran source code which should not be preprocessed.
914
915 @item @var{file}.F
916 @itemx @var{file}.fpp
917 @itemx @var{file}.FPP
918 Fixed form Fortran source code which must be preprocessed (with the traditional
919 preprocessor).
920
921 @item @var{file}.f90
922 @itemx @var{file}.f95
923 Free form Fortran source code which should not be preprocessed.
924
925 @item @var{file}.F90
926 @itemx @var{file}.F95
927 Free form Fortran source code which must be preprocessed (with the
928 traditional preprocessor).
929
930 @c FIXME: Descriptions of Java file types.
931 @c @var{file}.java
932 @c @var{file}.class
933 @c @var{file}.zip
934 @c @var{file}.jar
935
936 @item @var{file}.ads
937 Ada source code file which contains a library unit declaration (a
938 declaration of a package, subprogram, or generic, or a generic
939 instantiation), or a library unit renaming declaration (a package,
940 generic, or subprogram renaming declaration). Such files are also
941 called @dfn{specs}.
942
943 @itemx @var{file}.adb
944 Ada source code file containing a library unit body (a subprogram or
945 package body). Such files are also called @dfn{bodies}.
946
947 @c GCC also knows about some suffixes for languages not yet included:
948 @c Pascal:
949 @c @var{file}.p
950 @c @var{file}.pas
951 @c Ratfor:
952 @c @var{file}.r
953
954 @item @var{file}.s
955 Assembler code.
956
957 @item @var{file}.S
958 Assembler code which must be preprocessed.
959
960 @item @var{other}
961 An object file to be fed straight into linking.
962 Any file name with no recognized suffix is treated this way.
963 @end table
964
965 @opindex x
966 You can specify the input language explicitly with the @option{-x} option:
967
968 @table @gcctabopt
969 @item -x @var{language}
970 Specify explicitly the @var{language} for the following input files
971 (rather than letting the compiler choose a default based on the file
972 name suffix). This option applies to all following input files until
973 the next @option{-x} option. Possible values for @var{language} are:
974 @smallexample
975 c c-header c-cpp-output
976 c++ c++-header c++-cpp-output
977 objective-c objective-c-header objective-c-cpp-output
978 objective-c++ objective-c++-header objective-c++-cpp-output
979 assembler assembler-with-cpp
980 ada
981 f95 f95-cpp-input
982 java
983 treelang
984 @end smallexample
985
986 @item -x none
987 Turn off any specification of a language, so that subsequent files are
988 handled according to their file name suffixes (as they are if @option{-x}
989 has not been used at all).
990
991 @item -pass-exit-codes
992 @opindex pass-exit-codes
993 Normally the @command{gcc} program will exit with the code of 1 if any
994 phase of the compiler returns a non-success return code. If you specify
995 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
996 numerically highest error produced by any phase that returned an error
997 indication. The C, C++, and Fortran frontends return 4, if an internal
998 compiler error is encountered.
999 @end table
1000
1001 If you only want some of the stages of compilation, you can use
1002 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1003 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1004 @command{gcc} is to stop. Note that some combinations (for example,
1005 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1006
1007 @table @gcctabopt
1008 @item -c
1009 @opindex c
1010 Compile or assemble the source files, but do not link. The linking
1011 stage simply is not done. The ultimate output is in the form of an
1012 object file for each source file.
1013
1014 By default, the object file name for a source file is made by replacing
1015 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1016
1017 Unrecognized input files, not requiring compilation or assembly, are
1018 ignored.
1019
1020 @item -S
1021 @opindex S
1022 Stop after the stage of compilation proper; do not assemble. The output
1023 is in the form of an assembler code file for each non-assembler input
1024 file specified.
1025
1026 By default, the assembler file name for a source file is made by
1027 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1028
1029 Input files that don't require compilation are ignored.
1030
1031 @item -E
1032 @opindex E
1033 Stop after the preprocessing stage; do not run the compiler proper. The
1034 output is in the form of preprocessed source code, which is sent to the
1035 standard output.
1036
1037 Input files which don't require preprocessing are ignored.
1038
1039 @cindex output file option
1040 @item -o @var{file}
1041 @opindex o
1042 Place output in file @var{file}. This applies regardless to whatever
1043 sort of output is being produced, whether it be an executable file,
1044 an object file, an assembler file or preprocessed C code.
1045
1046 If @option{-o} is not specified, the default is to put an executable
1047 file in @file{a.out}, the object file for
1048 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1049 assembler file in @file{@var{source}.s}, a precompiled header file in
1050 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1051 standard output.
1052
1053 @item -v
1054 @opindex v
1055 Print (on standard error output) the commands executed to run the stages
1056 of compilation. Also print the version number of the compiler driver
1057 program and of the preprocessor and the compiler proper.
1058
1059 @item -###
1060 @opindex ###
1061 Like @option{-v} except the commands are not executed and all command
1062 arguments are quoted. This is useful for shell scripts to capture the
1063 driver-generated command lines.
1064
1065 @item -pipe
1066 @opindex pipe
1067 Use pipes rather than temporary files for communication between the
1068 various stages of compilation. This fails to work on some systems where
1069 the assembler is unable to read from a pipe; but the GNU assembler has
1070 no trouble.
1071
1072 @item -combine
1073 @opindex combine
1074 If you are compiling multiple source files, this option tells the driver
1075 to pass all the source files to the compiler at once (for those
1076 languages for which the compiler can handle this). This will allow
1077 intermodule analysis (IMA) to be performed by the compiler. Currently the only
1078 language for which this is supported is C@. If you pass source files for
1079 multiple languages to the driver, using this option, the driver will invoke
1080 the compiler(s) that support IMA once each, passing each compiler all the
1081 source files appropriate for it. For those languages that do not support
1082 IMA this option will be ignored, and the compiler will be invoked once for
1083 each source file in that language. If you use this option in conjunction
1084 with @option{-save-temps}, the compiler will generate multiple
1085 pre-processed files
1086 (one for each source file), but only one (combined) @file{.o} or
1087 @file{.s} file.
1088
1089 @item --help
1090 @opindex help
1091 Print (on the standard output) a description of the command line options
1092 understood by @command{gcc}. If the @option{-v} option is also specified
1093 then @option{--help} will also be passed on to the various processes
1094 invoked by @command{gcc}, so that they can display the command line options
1095 they accept. If the @option{-Wextra} option has also been specified
1096 (prior to the @option{--help} option), then command line options which
1097 have no documentation associated with them will also be displayed.
1098
1099 @item --target-help
1100 @opindex target-help
1101 Print (on the standard output) a description of target-specific command
1102 line options for each tool.
1103
1104 @item --help=@var{class}@r{[},@var{qualifier}@r{]}
1105 Print (on the standard output) a description of the command line
1106 options understood by the compiler that fit into a specific class.
1107 The class can be one of @samp{optimizers}, @samp{warnings}, @samp{target},
1108 @samp{params}, or @var{language}:
1109
1110 @table @asis
1111 @item @samp{optimizers}
1112 This will display all of the optimization options supported by the
1113 compiler.
1114
1115 @item @samp{warnings}
1116 This will display all of the options controlling warning messages
1117 produced by the compiler.
1118
1119 @item @samp{target}
1120 This will display target-specific options. Unlike the
1121 @option{--target-help} option however, target-specific options of the
1122 linker and assembler will not be displayed. This is because those
1123 tools do not currently support the extended @option{--help=} syntax.
1124
1125 @item @samp{params}
1126 This will display the values recognized by the @option{--param}
1127 option.
1128
1129 @item @var{language}
1130 This will display the options supported for @var{language}, where
1131 @var{language} is the name of one of the languages supported in this
1132 version of GCC.
1133
1134 @item @samp{common}
1135 This will display the options that are common to all languages.
1136 @end table
1137
1138 It is possible to further refine the output of the @option{--help=}
1139 option by adding a comma separated list of qualifiers after the
1140 class. These can be any from the following list:
1141
1142 @table @asis
1143 @item @samp{undocumented}
1144 Display only those options which are undocumented.
1145
1146 @item @samp{joined}
1147 Display options which take an argument that appears after an equal
1148 sign in the same continuous piece of text, such as:
1149 @samp{--help=target}.
1150
1151 @item @samp{separate}
1152 Display options which take an argument that appears as a separate word
1153 following the original option, such as: @samp{-o output-file}.
1154 @end table
1155
1156 Thus for example to display all the undocumented target-specific
1157 switches supported by the compiler the following can be used:
1158
1159 @smallexample
1160 --help=target,undocumented
1161 @end smallexample
1162
1163 The sense of a qualifier can be inverted by prefixing it with the
1164 @var{^} character, so for example to display all binary warning
1165 options (i.e. ones that are either on or off and that do not take an
1166 argument), which have a description the following can be used:
1167
1168 @smallexample
1169 --help=warnings,^joined,^undocumented
1170 @end smallexample
1171
1172 A class can also be used as a qualifier, although this usually
1173 restricts the output by so much that there is nothing to display. One
1174 case where it does work however is when one of the classes is
1175 @var{target}. So for example to display all the target-specific
1176 optimization options the following can be used:
1177
1178 @smallexample
1179 --help=target,optimizers
1180 @end smallexample
1181
1182 The @option{--help=} option can be repeated on the command line. Each
1183 successive use will display its requested class of options, skipping
1184 those that have already been displayed.
1185
1186 If the @option{-Q} option appears on the command line before the
1187 @option{--help=} option, then the descriptive text displayed by
1188 @option{--help=} is changed. Instead of describing the displayed
1189 options, an indication is given as to whether the option is enabled,
1190 disabled or set to a specific value (assuming that the compiler
1191 knows this at the point where the @option{--help=} option is used).
1192
1193 Here is a truncated example from the ARM port of @command{gcc}:
1194
1195 @smallexample
1196 % gcc -Q -mabi=2 --help=target -c
1197 The following options are target specific:
1198 -mabi= 2
1199 -mabort-on-noreturn [disabled]
1200 -mapcs [disabled]
1201 @end smallexample
1202
1203 The output is sensitive to the effects of previous command line
1204 options, so for example it is possible to find out which optimizations
1205 are enabled at @option{-O2} by using:
1206
1207 @smallexample
1208 -O2 --help=optimizers
1209 @end smallexample
1210
1211 Alternatively you can discover which binary optimizations are enabled
1212 by @option{-O3} by using:
1213
1214 @smallexample
1215 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1216 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1217 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1218 @end smallexample
1219
1220 @item --version
1221 @opindex version
1222 Display the version number and copyrights of the invoked GCC@.
1223
1224 @include @value{srcdir}/../libiberty/at-file.texi
1225 @end table
1226
1227 @node Invoking G++
1228 @section Compiling C++ Programs
1229
1230 @cindex suffixes for C++ source
1231 @cindex C++ source file suffixes
1232 C++ source files conventionally use one of the suffixes @samp{.C},
1233 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1234 @samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
1235 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1236 files with these names and compiles them as C++ programs even if you
1237 call the compiler the same way as for compiling C programs (usually
1238 with the name @command{gcc}).
1239
1240 @findex g++
1241 @findex c++
1242 However, the use of @command{gcc} does not add the C++ library.
1243 @command{g++} is a program that calls GCC and treats @samp{.c},
1244 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1245 files unless @option{-x} is used, and automatically specifies linking
1246 against the C++ library. This program is also useful when
1247 precompiling a C header file with a @samp{.h} extension for use in C++
1248 compilations. On many systems, @command{g++} is also installed with
1249 the name @command{c++}.
1250
1251 @cindex invoking @command{g++}
1252 When you compile C++ programs, you may specify many of the same
1253 command-line options that you use for compiling programs in any
1254 language; or command-line options meaningful for C and related
1255 languages; or options that are meaningful only for C++ programs.
1256 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1257 explanations of options for languages related to C@.
1258 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1259 explanations of options that are meaningful only for C++ programs.
1260
1261 @node C Dialect Options
1262 @section Options Controlling C Dialect
1263 @cindex dialect options
1264 @cindex language dialect options
1265 @cindex options, dialect
1266
1267 The following options control the dialect of C (or languages derived
1268 from C, such as C++, Objective-C and Objective-C++) that the compiler
1269 accepts:
1270
1271 @table @gcctabopt
1272 @cindex ANSI support
1273 @cindex ISO support
1274 @item -ansi
1275 @opindex ansi
1276 In C mode, support all ISO C90 programs. In C++ mode,
1277 remove GNU extensions that conflict with ISO C++.
1278
1279 This turns off certain features of GCC that are incompatible with ISO
1280 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1281 such as the @code{asm} and @code{typeof} keywords, and
1282 predefined macros such as @code{unix} and @code{vax} that identify the
1283 type of system you are using. It also enables the undesirable and
1284 rarely used ISO trigraph feature. For the C compiler,
1285 it disables recognition of C++ style @samp{//} comments as well as
1286 the @code{inline} keyword.
1287
1288 The alternate keywords @code{__asm__}, @code{__extension__},
1289 @code{__inline__} and @code{__typeof__} continue to work despite
1290 @option{-ansi}. You would not want to use them in an ISO C program, of
1291 course, but it is useful to put them in header files that might be included
1292 in compilations done with @option{-ansi}. Alternate predefined macros
1293 such as @code{__unix__} and @code{__vax__} are also available, with or
1294 without @option{-ansi}.
1295
1296 The @option{-ansi} option does not cause non-ISO programs to be
1297 rejected gratuitously. For that, @option{-pedantic} is required in
1298 addition to @option{-ansi}. @xref{Warning Options}.
1299
1300 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1301 option is used. Some header files may notice this macro and refrain
1302 from declaring certain functions or defining certain macros that the
1303 ISO standard doesn't call for; this is to avoid interfering with any
1304 programs that might use these names for other things.
1305
1306 Functions which would normally be built in but do not have semantics
1307 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1308 functions with @option{-ansi} is used. @xref{Other Builtins,,Other
1309 built-in functions provided by GCC}, for details of the functions
1310 affected.
1311
1312 @item -std=
1313 @opindex std
1314 Determine the language standard. This option is currently only
1315 supported when compiling C or C++. A value for this option must be
1316 provided; possible values are
1317
1318 @table @samp
1319 @item c89
1320 @itemx iso9899:1990
1321 ISO C90 (same as @option{-ansi}).
1322
1323 @item iso9899:199409
1324 ISO C90 as modified in amendment 1.
1325
1326 @item c99
1327 @itemx c9x
1328 @itemx iso9899:1999
1329 @itemx iso9899:199x
1330 ISO C99. Note that this standard is not yet fully supported; see
1331 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1332 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1333
1334 @item gnu89
1335 Default, ISO C90 plus GNU extensions (including some C99 features).
1336
1337 @item gnu99
1338 @itemx gnu9x
1339 ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC,
1340 this will become the default. The name @samp{gnu9x} is deprecated.
1341
1342 @item c++98
1343 The 1998 ISO C++ standard plus amendments.
1344
1345 @item gnu++98
1346 The same as @option{-std=c++98} plus GNU extensions. This is the
1347 default for C++ code.
1348
1349 @item c++0x
1350 The working draft of the upcoming ISO C++0x standard. This option
1351 enables experimental features that are likely to be included in
1352 C++0x. The working draft is constantly changing, and any feature that is
1353 enabled by this flag may be removed from future versions of GCC if it is
1354 not part of the C++0x standard.
1355
1356 @item gnu++0x
1357 The same as @option{-std=c++0x} plus GNU extensions. As with
1358 @option{-std=c++0x}, this option enables experimental features that may
1359 be removed in future versions of GCC.
1360 @end table
1361
1362 Even when this option is not specified, you can still use some of the
1363 features of newer standards in so far as they do not conflict with
1364 previous C standards. For example, you may use @code{__restrict__} even
1365 when @option{-std=c99} is not specified.
1366
1367 The @option{-std} options specifying some version of ISO C have the same
1368 effects as @option{-ansi}, except that features that were not in ISO C90
1369 but are in the specified version (for example, @samp{//} comments and
1370 the @code{inline} keyword in ISO C99) are not disabled.
1371
1372 @xref{Standards,,Language Standards Supported by GCC}, for details of
1373 these standard versions.
1374
1375 @item -fgnu89-inline
1376 @opindex fgnu89-inline
1377 The option @option{-fgnu89-inline} tells GCC to use the traditional
1378 GNU semantics for @code{inline} functions when in C99 mode.
1379 @xref{Inline,,An Inline Function is As Fast As a Macro}. This option
1380 is accepted and ignored by GCC versions 4.1.3 up to but not including
1381 4.3. In GCC versions 4.3 and later it changes the behavior of GCC in
1382 C99 mode. Using this option is roughly equivalent to adding the
1383 @code{gnu_inline} function attribute to all inline functions
1384 (@pxref{Function Attributes}).
1385
1386 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1387 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1388 specifies the default behavior). This option was first supported in
1389 GCC 4.3. This option is not supported in C89 or gnu89 mode.
1390
1391 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1392 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1393 in effect for @code{inline} functions. @xref{Common Predefined
1394 Macros,,,cpp,The C Preprocessor}.
1395
1396 @item -aux-info @var{filename}
1397 @opindex aux-info
1398 Output to the given filename prototyped declarations for all functions
1399 declared and/or defined in a translation unit, including those in header
1400 files. This option is silently ignored in any language other than C@.
1401
1402 Besides declarations, the file indicates, in comments, the origin of
1403 each declaration (source file and line), whether the declaration was
1404 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1405 @samp{O} for old, respectively, in the first character after the line
1406 number and the colon), and whether it came from a declaration or a
1407 definition (@samp{C} or @samp{F}, respectively, in the following
1408 character). In the case of function definitions, a K&R-style list of
1409 arguments followed by their declarations is also provided, inside
1410 comments, after the declaration.
1411
1412 @item -fno-asm
1413 @opindex fno-asm
1414 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1415 keyword, so that code can use these words as identifiers. You can use
1416 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1417 instead. @option{-ansi} implies @option{-fno-asm}.
1418
1419 In C++, this switch only affects the @code{typeof} keyword, since
1420 @code{asm} and @code{inline} are standard keywords. You may want to
1421 use the @option{-fno-gnu-keywords} flag instead, which has the same
1422 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1423 switch only affects the @code{asm} and @code{typeof} keywords, since
1424 @code{inline} is a standard keyword in ISO C99.
1425
1426 @item -fno-builtin
1427 @itemx -fno-builtin-@var{function}
1428 @opindex fno-builtin
1429 @cindex built-in functions
1430 Don't recognize built-in functions that do not begin with
1431 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1432 functions provided by GCC}, for details of the functions affected,
1433 including those which are not built-in functions when @option{-ansi} or
1434 @option{-std} options for strict ISO C conformance are used because they
1435 do not have an ISO standard meaning.
1436
1437 GCC normally generates special code to handle certain built-in functions
1438 more efficiently; for instance, calls to @code{alloca} may become single
1439 instructions that adjust the stack directly, and calls to @code{memcpy}
1440 may become inline copy loops. The resulting code is often both smaller
1441 and faster, but since the function calls no longer appear as such, you
1442 cannot set a breakpoint on those calls, nor can you change the behavior
1443 of the functions by linking with a different library. In addition,
1444 when a function is recognized as a built-in function, GCC may use
1445 information about that function to warn about problems with calls to
1446 that function, or to generate more efficient code, even if the
1447 resulting code still contains calls to that function. For example,
1448 warnings are given with @option{-Wformat} for bad calls to
1449 @code{printf}, when @code{printf} is built in, and @code{strlen} is
1450 known not to modify global memory.
1451
1452 With the @option{-fno-builtin-@var{function}} option
1453 only the built-in function @var{function} is
1454 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1455 function is named this is not built-in in this version of GCC, this
1456 option is ignored. There is no corresponding
1457 @option{-fbuiltin-@var{function}} option; if you wish to enable
1458 built-in functions selectively when using @option{-fno-builtin} or
1459 @option{-ffreestanding}, you may define macros such as:
1460
1461 @smallexample
1462 #define abs(n) __builtin_abs ((n))
1463 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1464 @end smallexample
1465
1466 @item -fhosted
1467 @opindex fhosted
1468 @cindex hosted environment
1469
1470 Assert that compilation takes place in a hosted environment. This implies
1471 @option{-fbuiltin}. A hosted environment is one in which the
1472 entire standard library is available, and in which @code{main} has a return
1473 type of @code{int}. Examples are nearly everything except a kernel.
1474 This is equivalent to @option{-fno-freestanding}.
1475
1476 @item -ffreestanding
1477 @opindex ffreestanding
1478 @cindex hosted environment
1479
1480 Assert that compilation takes place in a freestanding environment. This
1481 implies @option{-fno-builtin}. A freestanding environment
1482 is one in which the standard library may not exist, and program startup may
1483 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1484 This is equivalent to @option{-fno-hosted}.
1485
1486 @xref{Standards,,Language Standards Supported by GCC}, for details of
1487 freestanding and hosted environments.
1488
1489 @item -fopenmp
1490 @opindex fopenmp
1491 @cindex openmp parallel
1492 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1493 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1494 compiler generates parallel code according to the OpenMP Application
1495 Program Interface v2.5 @w{@uref{http://www.openmp.org/}}.
1496
1497 @item -fms-extensions
1498 @opindex fms-extensions
1499 Accept some non-standard constructs used in Microsoft header files.
1500
1501 Some cases of unnamed fields in structures and unions are only
1502 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1503 fields within structs/unions}, for details.
1504
1505 @item -trigraphs
1506 @opindex trigraphs
1507 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1508 options for strict ISO C conformance) implies @option{-trigraphs}.
1509
1510 @item -no-integrated-cpp
1511 @opindex no-integrated-cpp
1512 Performs a compilation in two passes: preprocessing and compiling. This
1513 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1514 @option{-B} option. The user supplied compilation step can then add in
1515 an additional preprocessing step after normal preprocessing but before
1516 compiling. The default is to use the integrated cpp (internal cpp)
1517
1518 The semantics of this option will change if "cc1", "cc1plus", and
1519 "cc1obj" are merged.
1520
1521 @cindex traditional C language
1522 @cindex C language, traditional
1523 @item -traditional
1524 @itemx -traditional-cpp
1525 @opindex traditional-cpp
1526 @opindex traditional
1527 Formerly, these options caused GCC to attempt to emulate a pre-standard
1528 C compiler. They are now only supported with the @option{-E} switch.
1529 The preprocessor continues to support a pre-standard mode. See the GNU
1530 CPP manual for details.
1531
1532 @item -fcond-mismatch
1533 @opindex fcond-mismatch
1534 Allow conditional expressions with mismatched types in the second and
1535 third arguments. The value of such an expression is void. This option
1536 is not supported for C++.
1537
1538 @item -flax-vector-conversions
1539 @opindex flax-vector-conversions
1540 Allow implicit conversions between vectors with differing numbers of
1541 elements and/or incompatible element types. This option should not be
1542 used for new code.
1543
1544 @item -funsigned-char
1545 @opindex funsigned-char
1546 Let the type @code{char} be unsigned, like @code{unsigned char}.
1547
1548 Each kind of machine has a default for what @code{char} should
1549 be. It is either like @code{unsigned char} by default or like
1550 @code{signed char} by default.
1551
1552 Ideally, a portable program should always use @code{signed char} or
1553 @code{unsigned char} when it depends on the signedness of an object.
1554 But many programs have been written to use plain @code{char} and
1555 expect it to be signed, or expect it to be unsigned, depending on the
1556 machines they were written for. This option, and its inverse, let you
1557 make such a program work with the opposite default.
1558
1559 The type @code{char} is always a distinct type from each of
1560 @code{signed char} or @code{unsigned char}, even though its behavior
1561 is always just like one of those two.
1562
1563 @item -fsigned-char
1564 @opindex fsigned-char
1565 Let the type @code{char} be signed, like @code{signed char}.
1566
1567 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1568 the negative form of @option{-funsigned-char}. Likewise, the option
1569 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1570
1571 @item -fsigned-bitfields
1572 @itemx -funsigned-bitfields
1573 @itemx -fno-signed-bitfields
1574 @itemx -fno-unsigned-bitfields
1575 @opindex fsigned-bitfields
1576 @opindex funsigned-bitfields
1577 @opindex fno-signed-bitfields
1578 @opindex fno-unsigned-bitfields
1579 These options control whether a bit-field is signed or unsigned, when the
1580 declaration does not use either @code{signed} or @code{unsigned}. By
1581 default, such a bit-field is signed, because this is consistent: the
1582 basic integer types such as @code{int} are signed types.
1583 @end table
1584
1585 @node C++ Dialect Options
1586 @section Options Controlling C++ Dialect
1587
1588 @cindex compiler options, C++
1589 @cindex C++ options, command line
1590 @cindex options, C++
1591 This section describes the command-line options that are only meaningful
1592 for C++ programs; but you can also use most of the GNU compiler options
1593 regardless of what language your program is in. For example, you
1594 might compile a file @code{firstClass.C} like this:
1595
1596 @smallexample
1597 g++ -g -frepo -O -c firstClass.C
1598 @end smallexample
1599
1600 @noindent
1601 In this example, only @option{-frepo} is an option meant
1602 only for C++ programs; you can use the other options with any
1603 language supported by GCC@.
1604
1605 Here is a list of options that are @emph{only} for compiling C++ programs:
1606
1607 @table @gcctabopt
1608
1609 @item -fabi-version=@var{n}
1610 @opindex fabi-version
1611 Use version @var{n} of the C++ ABI@. Version 2 is the version of the
1612 C++ ABI that first appeared in G++ 3.4. Version 1 is the version of
1613 the C++ ABI that first appeared in G++ 3.2. Version 0 will always be
1614 the version that conforms most closely to the C++ ABI specification.
1615 Therefore, the ABI obtained using version 0 will change as ABI bugs
1616 are fixed.
1617
1618 The default is version 2.
1619
1620 @item -fno-access-control
1621 @opindex fno-access-control
1622 Turn off all access checking. This switch is mainly useful for working
1623 around bugs in the access control code.
1624
1625 @item -fcheck-new
1626 @opindex fcheck-new
1627 Check that the pointer returned by @code{operator new} is non-null
1628 before attempting to modify the storage allocated. This check is
1629 normally unnecessary because the C++ standard specifies that
1630 @code{operator new} will only return @code{0} if it is declared
1631 @samp{throw()}, in which case the compiler will always check the
1632 return value even without this option. In all other cases, when
1633 @code{operator new} has a non-empty exception specification, memory
1634 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
1635 @samp{new (nothrow)}.
1636
1637 @item -fconserve-space
1638 @opindex fconserve-space
1639 Put uninitialized or runtime-initialized global variables into the
1640 common segment, as C does. This saves space in the executable at the
1641 cost of not diagnosing duplicate definitions. If you compile with this
1642 flag and your program mysteriously crashes after @code{main()} has
1643 completed, you may have an object that is being destroyed twice because
1644 two definitions were merged.
1645
1646 This option is no longer useful on most targets, now that support has
1647 been added for putting variables into BSS without making them common.
1648
1649 @item -ffriend-injection
1650 @opindex ffriend-injection
1651 Inject friend functions into the enclosing namespace, so that they are
1652 visible outside the scope of the class in which they are declared.
1653 Friend functions were documented to work this way in the old Annotated
1654 C++ Reference Manual, and versions of G++ before 4.1 always worked
1655 that way. However, in ISO C++ a friend function which is not declared
1656 in an enclosing scope can only be found using argument dependent
1657 lookup. This option causes friends to be injected as they were in
1658 earlier releases.
1659
1660 This option is for compatibility, and may be removed in a future
1661 release of G++.
1662
1663 @item -fno-elide-constructors
1664 @opindex fno-elide-constructors
1665 The C++ standard allows an implementation to omit creating a temporary
1666 which is only used to initialize another object of the same type.
1667 Specifying this option disables that optimization, and forces G++ to
1668 call the copy constructor in all cases.
1669
1670 @item -fno-enforce-eh-specs
1671 @opindex fno-enforce-eh-specs
1672 Don't generate code to check for violation of exception specifications
1673 at runtime. This option violates the C++ standard, but may be useful
1674 for reducing code size in production builds, much like defining
1675 @samp{NDEBUG}. This does not give user code permission to throw
1676 exceptions in violation of the exception specifications; the compiler
1677 will still optimize based on the specifications, so throwing an
1678 unexpected exception will result in undefined behavior.
1679
1680 @item -ffor-scope
1681 @itemx -fno-for-scope
1682 @opindex ffor-scope
1683 @opindex fno-for-scope
1684 If @option{-ffor-scope} is specified, the scope of variables declared in
1685 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1686 as specified by the C++ standard.
1687 If @option{-fno-for-scope} is specified, the scope of variables declared in
1688 a @i{for-init-statement} extends to the end of the enclosing scope,
1689 as was the case in old versions of G++, and other (traditional)
1690 implementations of C++.
1691
1692 The default if neither flag is given to follow the standard,
1693 but to allow and give a warning for old-style code that would
1694 otherwise be invalid, or have different behavior.
1695
1696 @item -fno-gnu-keywords
1697 @opindex fno-gnu-keywords
1698 Do not recognize @code{typeof} as a keyword, so that code can use this
1699 word as an identifier. You can use the keyword @code{__typeof__} instead.
1700 @option{-ansi} implies @option{-fno-gnu-keywords}.
1701
1702 @item -fno-implicit-templates
1703 @opindex fno-implicit-templates
1704 Never emit code for non-inline templates which are instantiated
1705 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1706 @xref{Template Instantiation}, for more information.
1707
1708 @item -fno-implicit-inline-templates
1709 @opindex fno-implicit-inline-templates
1710 Don't emit code for implicit instantiations of inline templates, either.
1711 The default is to handle inlines differently so that compiles with and
1712 without optimization will need the same set of explicit instantiations.
1713
1714 @item -fno-implement-inlines
1715 @opindex fno-implement-inlines
1716 To save space, do not emit out-of-line copies of inline functions
1717 controlled by @samp{#pragma implementation}. This will cause linker
1718 errors if these functions are not inlined everywhere they are called.
1719
1720 @item -fms-extensions
1721 @opindex fms-extensions
1722 Disable pedantic warnings about constructs used in MFC, such as implicit
1723 int and getting a pointer to member function via non-standard syntax.
1724
1725 @item -fno-nonansi-builtins
1726 @opindex fno-nonansi-builtins
1727 Disable built-in declarations of functions that are not mandated by
1728 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
1729 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1730
1731 @item -fno-operator-names
1732 @opindex fno-operator-names
1733 Do not treat the operator name keywords @code{and}, @code{bitand},
1734 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1735 synonyms as keywords.
1736
1737 @item -fno-optional-diags
1738 @opindex fno-optional-diags
1739 Disable diagnostics that the standard says a compiler does not need to
1740 issue. Currently, the only such diagnostic issued by G++ is the one for
1741 a name having multiple meanings within a class.
1742
1743 @item -fpermissive
1744 @opindex fpermissive
1745 Downgrade some diagnostics about nonconformant code from errors to
1746 warnings. Thus, using @option{-fpermissive} will allow some
1747 nonconforming code to compile.
1748
1749 @item -frepo
1750 @opindex frepo
1751 Enable automatic template instantiation at link time. This option also
1752 implies @option{-fno-implicit-templates}. @xref{Template
1753 Instantiation}, for more information.
1754
1755 @item -fno-rtti
1756 @opindex fno-rtti
1757 Disable generation of information about every class with virtual
1758 functions for use by the C++ runtime type identification features
1759 (@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
1760 of the language, you can save some space by using this flag. Note that
1761 exception handling uses the same information, but it will generate it as
1762 needed. The @samp{dynamic_cast} operator can still be used for casts that
1763 do not require runtime type information, i.e. casts to @code{void *} or to
1764 unambiguous base classes.
1765
1766 @item -fstats
1767 @opindex fstats
1768 Emit statistics about front-end processing at the end of the compilation.
1769 This information is generally only useful to the G++ development team.
1770
1771 @item -ftemplate-depth-@var{n}
1772 @opindex ftemplate-depth
1773 Set the maximum instantiation depth for template classes to @var{n}.
1774 A limit on the template instantiation depth is needed to detect
1775 endless recursions during template class instantiation. ANSI/ISO C++
1776 conforming programs must not rely on a maximum depth greater than 17.
1777
1778 @item -fno-threadsafe-statics
1779 @opindex fno-threadsafe-statics
1780 Do not emit the extra code to use the routines specified in the C++
1781 ABI for thread-safe initialization of local statics. You can use this
1782 option to reduce code size slightly in code that doesn't need to be
1783 thread-safe.
1784
1785 @item -fuse-cxa-atexit
1786 @opindex fuse-cxa-atexit
1787 Register destructors for objects with static storage duration with the
1788 @code{__cxa_atexit} function rather than the @code{atexit} function.
1789 This option is required for fully standards-compliant handling of static
1790 destructors, but will only work if your C library supports
1791 @code{__cxa_atexit}.
1792
1793 @item -fno-use-cxa-get-exception-ptr
1794 @opindex fno-use-cxa-get-exception-ptr
1795 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
1796 will cause @code{std::uncaught_exception} to be incorrect, but is necessary
1797 if the runtime routine is not available.
1798
1799 @item -fvisibility-inlines-hidden
1800 @opindex fvisibility-inlines-hidden
1801 This switch declares that the user does not attempt to compare
1802 pointers to inline methods where the addresses of the two functions
1803 were taken in different shared objects.
1804
1805 The effect of this is that GCC may, effectively, mark inline methods with
1806 @code{__attribute__ ((visibility ("hidden")))} so that they do not
1807 appear in the export table of a DSO and do not require a PLT indirection
1808 when used within the DSO@. Enabling this option can have a dramatic effect
1809 on load and link times of a DSO as it massively reduces the size of the
1810 dynamic export table when the library makes heavy use of templates.
1811
1812 The behavior of this switch is not quite the same as marking the
1813 methods as hidden directly, because it does not affect static variables
1814 local to the function or cause the compiler to deduce that
1815 the function is defined in only one shared object.
1816
1817 You may mark a method as having a visibility explicitly to negate the
1818 effect of the switch for that method. For example, if you do want to
1819 compare pointers to a particular inline method, you might mark it as
1820 having default visibility. Marking the enclosing class with explicit
1821 visibility will have no effect.
1822
1823 Explicitly instantiated inline methods are unaffected by this option
1824 as their linkage might otherwise cross a shared library boundary.
1825 @xref{Template Instantiation}.
1826
1827 @item -fno-weak
1828 @opindex fno-weak
1829 Do not use weak symbol support, even if it is provided by the linker.
1830 By default, G++ will use weak symbols if they are available. This
1831 option exists only for testing, and should not be used by end-users;
1832 it will result in inferior code and has no benefits. This option may
1833 be removed in a future release of G++.
1834
1835 @item -nostdinc++
1836 @opindex nostdinc++
1837 Do not search for header files in the standard directories specific to
1838 C++, but do still search the other standard directories. (This option
1839 is used when building the C++ library.)
1840 @end table
1841
1842 In addition, these optimization, warning, and code generation options
1843 have meanings only for C++ programs:
1844
1845 @table @gcctabopt
1846 @item -fno-default-inline
1847 @opindex fno-default-inline
1848 Do not assume @samp{inline} for functions defined inside a class scope.
1849 @xref{Optimize Options,,Options That Control Optimization}. Note that these
1850 functions will have linkage like inline functions; they just won't be
1851 inlined by default.
1852
1853 @item -Wabi @r{(C++ only)}
1854 @opindex Wabi
1855 Warn when G++ generates code that is probably not compatible with the
1856 vendor-neutral C++ ABI@. Although an effort has been made to warn about
1857 all such cases, there are probably some cases that are not warned about,
1858 even though G++ is generating incompatible code. There may also be
1859 cases where warnings are emitted even though the code that is generated
1860 will be compatible.
1861
1862 You should rewrite your code to avoid these warnings if you are
1863 concerned about the fact that code generated by G++ may not be binary
1864 compatible with code generated by other compilers.
1865
1866 The known incompatibilities at this point include:
1867
1868 @itemize @bullet
1869
1870 @item
1871 Incorrect handling of tail-padding for bit-fields. G++ may attempt to
1872 pack data into the same byte as a base class. For example:
1873
1874 @smallexample
1875 struct A @{ virtual void f(); int f1 : 1; @};
1876 struct B : public A @{ int f2 : 1; @};
1877 @end smallexample
1878
1879 @noindent
1880 In this case, G++ will place @code{B::f2} into the same byte
1881 as@code{A::f1}; other compilers will not. You can avoid this problem
1882 by explicitly padding @code{A} so that its size is a multiple of the
1883 byte size on your platform; that will cause G++ and other compilers to
1884 layout @code{B} identically.
1885
1886 @item
1887 Incorrect handling of tail-padding for virtual bases. G++ does not use
1888 tail padding when laying out virtual bases. For example:
1889
1890 @smallexample
1891 struct A @{ virtual void f(); char c1; @};
1892 struct B @{ B(); char c2; @};
1893 struct C : public A, public virtual B @{@};
1894 @end smallexample
1895
1896 @noindent
1897 In this case, G++ will not place @code{B} into the tail-padding for
1898 @code{A}; other compilers will. You can avoid this problem by
1899 explicitly padding @code{A} so that its size is a multiple of its
1900 alignment (ignoring virtual base classes); that will cause G++ and other
1901 compilers to layout @code{C} identically.
1902
1903 @item
1904 Incorrect handling of bit-fields with declared widths greater than that
1905 of their underlying types, when the bit-fields appear in a union. For
1906 example:
1907
1908 @smallexample
1909 union U @{ int i : 4096; @};
1910 @end smallexample
1911
1912 @noindent
1913 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1914 union too small by the number of bits in an @code{int}.
1915
1916 @item
1917 Empty classes can be placed at incorrect offsets. For example:
1918
1919 @smallexample
1920 struct A @{@};
1921
1922 struct B @{
1923 A a;
1924 virtual void f ();
1925 @};
1926
1927 struct C : public B, public A @{@};
1928 @end smallexample
1929
1930 @noindent
1931 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1932 it should be placed at offset zero. G++ mistakenly believes that the
1933 @code{A} data member of @code{B} is already at offset zero.
1934
1935 @item
1936 Names of template functions whose types involve @code{typename} or
1937 template template parameters can be mangled incorrectly.
1938
1939 @smallexample
1940 template <typename Q>
1941 void f(typename Q::X) @{@}
1942
1943 template <template <typename> class Q>
1944 void f(typename Q<int>::X) @{@}
1945 @end smallexample
1946
1947 @noindent
1948 Instantiations of these templates may be mangled incorrectly.
1949
1950 @end itemize
1951
1952 @item -Wctor-dtor-privacy @r{(C++ only)}
1953 @opindex Wctor-dtor-privacy
1954 Warn when a class seems unusable because all the constructors or
1955 destructors in that class are private, and it has neither friends nor
1956 public static member functions.
1957
1958 @item -Wnon-virtual-dtor @r{(C++ only)}
1959 @opindex Wnon-virtual-dtor
1960 Warn when a class appears to be polymorphic, thereby requiring a virtual
1961 destructor, yet it declares a non-virtual one. This warning is also
1962 enabled if -Weffc++ is specified.
1963
1964 @item -Wreorder @r{(C++ only)}
1965 @opindex Wreorder
1966 @cindex reordering, warning
1967 @cindex warning for reordering of member initializers
1968 Warn when the order of member initializers given in the code does not
1969 match the order in which they must be executed. For instance:
1970
1971 @smallexample
1972 struct A @{
1973 int i;
1974 int j;
1975 A(): j (0), i (1) @{ @}
1976 @};
1977 @end smallexample
1978
1979 The compiler will rearrange the member initializers for @samp{i}
1980 and @samp{j} to match the declaration order of the members, emitting
1981 a warning to that effect. This warning is enabled by @option{-Wall}.
1982 @end table
1983
1984 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1985
1986 @table @gcctabopt
1987 @item -Weffc++ @r{(C++ only)}
1988 @opindex Weffc++
1989 Warn about violations of the following style guidelines from Scott Meyers'
1990 @cite{Effective C++} book:
1991
1992 @itemize @bullet
1993 @item
1994 Item 11: Define a copy constructor and an assignment operator for classes
1995 with dynamically allocated memory.
1996
1997 @item
1998 Item 12: Prefer initialization to assignment in constructors.
1999
2000 @item
2001 Item 14: Make destructors virtual in base classes.
2002
2003 @item
2004 Item 15: Have @code{operator=} return a reference to @code{*this}.
2005
2006 @item
2007 Item 23: Don't try to return a reference when you must return an object.
2008
2009 @end itemize
2010
2011 Also warn about violations of the following style guidelines from
2012 Scott Meyers' @cite{More Effective C++} book:
2013
2014 @itemize @bullet
2015 @item
2016 Item 6: Distinguish between prefix and postfix forms of increment and
2017 decrement operators.
2018
2019 @item
2020 Item 7: Never overload @code{&&}, @code{||}, or @code{,}.
2021
2022 @end itemize
2023
2024 When selecting this option, be aware that the standard library
2025 headers do not obey all of these guidelines; use @samp{grep -v}
2026 to filter out those warnings.
2027
2028 @item -Wno-deprecated @r{(C++ only)}
2029 @opindex Wno-deprecated
2030 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
2031
2032 @item -Wstrict-null-sentinel @r{(C++ only)}
2033 @opindex Wstrict-null-sentinel
2034 Warn also about the use of an uncasted @code{NULL} as sentinel. When
2035 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2036 to @code{__null}. Although it is a null pointer constant not a null pointer,
2037 it is guaranteed to of the same size as a pointer. But this use is
2038 not portable across different compilers.
2039
2040 @item -Wno-non-template-friend @r{(C++ only)}
2041 @opindex Wno-non-template-friend
2042 Disable warnings when non-templatized friend functions are declared
2043 within a template. Since the advent of explicit template specification
2044 support in G++, if the name of the friend is an unqualified-id (i.e.,
2045 @samp{friend foo(int)}), the C++ language specification demands that the
2046 friend declare or define an ordinary, nontemplate function. (Section
2047 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2048 could be interpreted as a particular specialization of a templatized
2049 function. Because this non-conforming behavior is no longer the default
2050 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2051 check existing code for potential trouble spots and is on by default.
2052 This new compiler behavior can be turned off with
2053 @option{-Wno-non-template-friend} which keeps the conformant compiler code
2054 but disables the helpful warning.
2055
2056 @item -Wold-style-cast @r{(C++ only)}
2057 @opindex Wold-style-cast
2058 Warn if an old-style (C-style) cast to a non-void type is used within
2059 a C++ program. The new-style casts (@samp{dynamic_cast},
2060 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2061 less vulnerable to unintended effects and much easier to search for.
2062
2063 @item -Woverloaded-virtual @r{(C++ only)}
2064 @opindex Woverloaded-virtual
2065 @cindex overloaded virtual fn, warning
2066 @cindex warning for overloaded virtual fn
2067 Warn when a function declaration hides virtual functions from a
2068 base class. For example, in:
2069
2070 @smallexample
2071 struct A @{
2072 virtual void f();
2073 @};
2074
2075 struct B: public A @{
2076 void f(int);
2077 @};
2078 @end smallexample
2079
2080 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2081 like:
2082
2083 @smallexample
2084 B* b;
2085 b->f();
2086 @end smallexample
2087
2088 will fail to compile.
2089
2090 @item -Wno-pmf-conversions @r{(C++ only)}
2091 @opindex Wno-pmf-conversions
2092 Disable the diagnostic for converting a bound pointer to member function
2093 to a plain pointer.
2094
2095 @item -Wsign-promo @r{(C++ only)}
2096 @opindex Wsign-promo
2097 Warn when overload resolution chooses a promotion from unsigned or
2098 enumerated type to a signed type, over a conversion to an unsigned type of
2099 the same size. Previous versions of G++ would try to preserve
2100 unsignedness, but the standard mandates the current behavior.
2101
2102 @smallexample
2103 struct A @{
2104 operator int ();
2105 A& operator = (int);
2106 @};
2107
2108 main ()
2109 @{
2110 A a,b;
2111 a = b;
2112 @}
2113 @end smallexample
2114
2115 In this example, G++ will synthesize a default @samp{A& operator =
2116 (const A&);}, while cfront will use the user-defined @samp{operator =}.
2117 @end table
2118
2119 @node Objective-C and Objective-C++ Dialect Options
2120 @section Options Controlling Objective-C and Objective-C++ Dialects
2121
2122 @cindex compiler options, Objective-C and Objective-C++
2123 @cindex Objective-C and Objective-C++ options, command line
2124 @cindex options, Objective-C and Objective-C++
2125 (NOTE: This manual does not describe the Objective-C and Objective-C++
2126 languages themselves. See @xref{Standards,,Language Standards
2127 Supported by GCC}, for references.)
2128
2129 This section describes the command-line options that are only meaningful
2130 for Objective-C and Objective-C++ programs, but you can also use most of
2131 the language-independent GNU compiler options.
2132 For example, you might compile a file @code{some_class.m} like this:
2133
2134 @smallexample
2135 gcc -g -fgnu-runtime -O -c some_class.m
2136 @end smallexample
2137
2138 @noindent
2139 In this example, @option{-fgnu-runtime} is an option meant only for
2140 Objective-C and Objective-C++ programs; you can use the other options with
2141 any language supported by GCC@.
2142
2143 Note that since Objective-C is an extension of the C language, Objective-C
2144 compilations may also use options specific to the C front-end (e.g.,
2145 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2146 C++-specific options (e.g., @option{-Wabi}).
2147
2148 Here is a list of options that are @emph{only} for compiling Objective-C
2149 and Objective-C++ programs:
2150
2151 @table @gcctabopt
2152 @item -fconstant-string-class=@var{class-name}
2153 @opindex fconstant-string-class
2154 Use @var{class-name} as the name of the class to instantiate for each
2155 literal string specified with the syntax @code{@@"@dots{}"}. The default
2156 class name is @code{NXConstantString} if the GNU runtime is being used, and
2157 @code{NSConstantString} if the NeXT runtime is being used (see below). The
2158 @option{-fconstant-cfstrings} option, if also present, will override the
2159 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2160 to be laid out as constant CoreFoundation strings.
2161
2162 @item -fgnu-runtime
2163 @opindex fgnu-runtime
2164 Generate object code compatible with the standard GNU Objective-C
2165 runtime. This is the default for most types of systems.
2166
2167 @item -fnext-runtime
2168 @opindex fnext-runtime
2169 Generate output compatible with the NeXT runtime. This is the default
2170 for NeXT-based systems, including Darwin and Mac OS X@. The macro
2171 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2172 used.
2173
2174 @item -fno-nil-receivers
2175 @opindex fno-nil-receivers
2176 Assume that all Objective-C message dispatches (e.g.,
2177 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
2178 is not @code{nil}. This allows for more efficient entry points in the runtime
2179 to be used. Currently, this option is only available in conjunction with
2180 the NeXT runtime on Mac OS X 10.3 and later.
2181
2182 @item -fobjc-call-cxx-cdtors
2183 @opindex fobjc-call-cxx-cdtors
2184 For each Objective-C class, check if any of its instance variables is a
2185 C++ object with a non-trivial default constructor. If so, synthesize a
2186 special @code{- (id) .cxx_construct} instance method that will run
2187 non-trivial default constructors on any such instance variables, in order,
2188 and then return @code{self}. Similarly, check if any instance variable
2189 is a C++ object with a non-trivial destructor, and if so, synthesize a
2190 special @code{- (void) .cxx_destruct} method that will run
2191 all such default destructors, in reverse order.
2192
2193 The @code{- (id) .cxx_construct} and/or @code{- (void) .cxx_destruct} methods
2194 thusly generated will only operate on instance variables declared in the
2195 current Objective-C class, and not those inherited from superclasses. It
2196 is the responsibility of the Objective-C runtime to invoke all such methods
2197 in an object's inheritance hierarchy. The @code{- (id) .cxx_construct} methods
2198 will be invoked by the runtime immediately after a new object
2199 instance is allocated; the @code{- (void) .cxx_destruct} methods will
2200 be invoked immediately before the runtime deallocates an object instance.
2201
2202 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2203 support for invoking the @code{- (id) .cxx_construct} and
2204 @code{- (void) .cxx_destruct} methods.
2205
2206 @item -fobjc-direct-dispatch
2207 @opindex fobjc-direct-dispatch
2208 Allow fast jumps to the message dispatcher. On Darwin this is
2209 accomplished via the comm page.
2210
2211 @item -fobjc-exceptions
2212 @opindex fobjc-exceptions
2213 Enable syntactic support for structured exception handling in Objective-C,
2214 similar to what is offered by C++ and Java. This option is
2215 unavailable in conjunction with the NeXT runtime on Mac OS X 10.2 and
2216 earlier.
2217
2218 @smallexample
2219 @@try @{
2220 @dots{}
2221 @@throw expr;
2222 @dots{}
2223 @}
2224 @@catch (AnObjCClass *exc) @{
2225 @dots{}
2226 @@throw expr;
2227 @dots{}
2228 @@throw;
2229 @dots{}
2230 @}
2231 @@catch (AnotherClass *exc) @{
2232 @dots{}
2233 @}
2234 @@catch (id allOthers) @{
2235 @dots{}
2236 @}
2237 @@finally @{
2238 @dots{}
2239 @@throw expr;
2240 @dots{}
2241 @}
2242 @end smallexample
2243
2244 The @code{@@throw} statement may appear anywhere in an Objective-C or
2245 Objective-C++ program; when used inside of a @code{@@catch} block, the
2246 @code{@@throw} may appear without an argument (as shown above), in which case
2247 the object caught by the @code{@@catch} will be rethrown.
2248
2249 Note that only (pointers to) Objective-C objects may be thrown and
2250 caught using this scheme. When an object is thrown, it will be caught
2251 by the nearest @code{@@catch} clause capable of handling objects of that type,
2252 analogously to how @code{catch} blocks work in C++ and Java. A
2253 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
2254 any and all Objective-C exceptions not caught by previous @code{@@catch}
2255 clauses (if any).
2256
2257 The @code{@@finally} clause, if present, will be executed upon exit from the
2258 immediately preceding @code{@@try @dots{} @@catch} section. This will happen
2259 regardless of whether any exceptions are thrown, caught or rethrown
2260 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
2261 of the @code{finally} clause in Java.
2262
2263 There are several caveats to using the new exception mechanism:
2264
2265 @itemize @bullet
2266 @item
2267 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
2268 idioms provided by the @code{NSException} class, the new
2269 exceptions can only be used on Mac OS X 10.3 (Panther) and later
2270 systems, due to additional functionality needed in the (NeXT) Objective-C
2271 runtime.
2272
2273 @item
2274 As mentioned above, the new exceptions do not support handling
2275 types other than Objective-C objects. Furthermore, when used from
2276 Objective-C++, the Objective-C exception model does not interoperate with C++
2277 exceptions at this time. This means you cannot @code{@@throw} an exception
2278 from Objective-C and @code{catch} it in C++, or vice versa
2279 (i.e., @code{throw @dots{} @@catch}).
2280 @end itemize
2281
2282 The @option{-fobjc-exceptions} switch also enables the use of synchronization
2283 blocks for thread-safe execution:
2284
2285 @smallexample
2286 @@synchronized (ObjCClass *guard) @{
2287 @dots{}
2288 @}
2289 @end smallexample
2290
2291 Upon entering the @code{@@synchronized} block, a thread of execution shall
2292 first check whether a lock has been placed on the corresponding @code{guard}
2293 object by another thread. If it has, the current thread shall wait until
2294 the other thread relinquishes its lock. Once @code{guard} becomes available,
2295 the current thread will place its own lock on it, execute the code contained in
2296 the @code{@@synchronized} block, and finally relinquish the lock (thereby
2297 making @code{guard} available to other threads).
2298
2299 Unlike Java, Objective-C does not allow for entire methods to be marked
2300 @code{@@synchronized}. Note that throwing exceptions out of
2301 @code{@@synchronized} blocks is allowed, and will cause the guarding object
2302 to be unlocked properly.
2303
2304 @item -fobjc-gc
2305 @opindex fobjc-gc
2306 Enable garbage collection (GC) in Objective-C and Objective-C++ programs.
2307
2308 @item -freplace-objc-classes
2309 @opindex freplace-objc-classes
2310 Emit a special marker instructing @command{ld(1)} not to statically link in
2311 the resulting object file, and allow @command{dyld(1)} to load it in at
2312 run time instead. This is used in conjunction with the Fix-and-Continue
2313 debugging mode, where the object file in question may be recompiled and
2314 dynamically reloaded in the course of program execution, without the need
2315 to restart the program itself. Currently, Fix-and-Continue functionality
2316 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2317 and later.
2318
2319 @item -fzero-link
2320 @opindex fzero-link
2321 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2322 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2323 compile time) with static class references that get initialized at load time,
2324 which improves run-time performance. Specifying the @option{-fzero-link} flag
2325 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2326 to be retained. This is useful in Zero-Link debugging mode, since it allows
2327 for individual class implementations to be modified during program execution.
2328
2329 @item -gen-decls
2330 @opindex gen-decls
2331 Dump interface declarations for all classes seen in the source file to a
2332 file named @file{@var{sourcename}.decl}.
2333
2334 @item -Wassign-intercept
2335 @opindex Wassign-intercept
2336 Warn whenever an Objective-C assignment is being intercepted by the
2337 garbage collector.
2338
2339 @item -Wno-protocol
2340 @opindex Wno-protocol
2341 If a class is declared to implement a protocol, a warning is issued for
2342 every method in the protocol that is not implemented by the class. The
2343 default behavior is to issue a warning for every method not explicitly
2344 implemented in the class, even if a method implementation is inherited
2345 from the superclass. If you use the @option{-Wno-protocol} option, then
2346 methods inherited from the superclass are considered to be implemented,
2347 and no warning is issued for them.
2348
2349 @item -Wselector
2350 @opindex Wselector
2351 Warn if multiple methods of different types for the same selector are
2352 found during compilation. The check is performed on the list of methods
2353 in the final stage of compilation. Additionally, a check is performed
2354 for each selector appearing in a @code{@@selector(@dots{})}
2355 expression, and a corresponding method for that selector has been found
2356 during compilation. Because these checks scan the method table only at
2357 the end of compilation, these warnings are not produced if the final
2358 stage of compilation is not reached, for example because an error is
2359 found during compilation, or because the @option{-fsyntax-only} option is
2360 being used.
2361
2362 @item -Wstrict-selector-match
2363 @opindex Wstrict-selector-match
2364 Warn if multiple methods with differing argument and/or return types are
2365 found for a given selector when attempting to send a message using this
2366 selector to a receiver of type @code{id} or @code{Class}. When this flag
2367 is off (which is the default behavior), the compiler will omit such warnings
2368 if any differences found are confined to types which share the same size
2369 and alignment.
2370
2371 @item -Wundeclared-selector
2372 @opindex Wundeclared-selector
2373 Warn if a @code{@@selector(@dots{})} expression referring to an
2374 undeclared selector is found. A selector is considered undeclared if no
2375 method with that name has been declared before the
2376 @code{@@selector(@dots{})} expression, either explicitly in an
2377 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2378 an @code{@@implementation} section. This option always performs its
2379 checks as soon as a @code{@@selector(@dots{})} expression is found,
2380 while @option{-Wselector} only performs its checks in the final stage of
2381 compilation. This also enforces the coding style convention
2382 that methods and selectors must be declared before being used.
2383
2384 @item -print-objc-runtime-info
2385 @opindex print-objc-runtime-info
2386 Generate C header describing the largest structure that is passed by
2387 value, if any.
2388
2389 @end table
2390
2391 @node Language Independent Options
2392 @section Options to Control Diagnostic Messages Formatting
2393 @cindex options to control diagnostics formatting
2394 @cindex diagnostic messages
2395 @cindex message formatting
2396
2397 Traditionally, diagnostic messages have been formatted irrespective of
2398 the output device's aspect (e.g.@: its width, @dots{}). The options described
2399 below can be used to control the diagnostic messages formatting
2400 algorithm, e.g.@: how many characters per line, how often source location
2401 information should be reported. Right now, only the C++ front end can
2402 honor these options. However it is expected, in the near future, that
2403 the remaining front ends would be able to digest them correctly.
2404
2405 @table @gcctabopt
2406 @item -fmessage-length=@var{n}
2407 @opindex fmessage-length
2408 Try to format error messages so that they fit on lines of about @var{n}
2409 characters. The default is 72 characters for @command{g++} and 0 for the rest of
2410 the front ends supported by GCC@. If @var{n} is zero, then no
2411 line-wrapping will be done; each error message will appear on a single
2412 line.
2413
2414 @opindex fdiagnostics-show-location
2415 @item -fdiagnostics-show-location=once
2416 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
2417 reporter to emit @emph{once} source location information; that is, in
2418 case the message is too long to fit on a single physical line and has to
2419 be wrapped, the source location won't be emitted (as prefix) again,
2420 over and over, in subsequent continuation lines. This is the default
2421 behavior.
2422
2423 @item -fdiagnostics-show-location=every-line
2424 Only meaningful in line-wrapping mode. Instructs the diagnostic
2425 messages reporter to emit the same source location information (as
2426 prefix) for physical lines that result from the process of breaking
2427 a message which is too long to fit on a single line.
2428
2429 @item -fdiagnostics-show-option
2430 @opindex fdiagnostics-show-option
2431 This option instructs the diagnostic machinery to add text to each
2432 diagnostic emitted, which indicates which command line option directly
2433 controls that diagnostic, when such an option is known to the
2434 diagnostic machinery.
2435
2436 @item -Wcoverage-mismatch
2437 @opindex Wcoverage-mismatch
2438 Warn if feedback profiles do not match when using the
2439 @option{-fprofile-use} option.
2440 If a source file was changed between @option{-fprofile-gen} and
2441 @option{-fprofile-use}, the files with the profile feedback can fail
2442 to match the source file and GCC can not use the profile feedback
2443 information. By default, GCC emits an error message in this case.
2444 The option @option{-Wcoverage-mismatch} emits a warning instead of an
2445 error. GCC does not use appropriate feedback profiles, so using this
2446 option can result in poorly optimized code. This option is useful
2447 only in the case of very minor changes such as bug fixes to an
2448 existing code-base.
2449
2450 @end table
2451
2452 @node Warning Options
2453 @section Options to Request or Suppress Warnings
2454 @cindex options to control warnings
2455 @cindex warning messages
2456 @cindex messages, warning
2457 @cindex suppressing warnings
2458
2459 Warnings are diagnostic messages that report constructions which
2460 are not inherently erroneous but which are risky or suggest there
2461 may have been an error.
2462
2463 You can request many specific warnings with options beginning @samp{-W},
2464 for example @option{-Wimplicit} to request warnings on implicit
2465 declarations. Each of these specific warning options also has a
2466 negative form beginning @samp{-Wno-} to turn off warnings;
2467 for example, @option{-Wno-implicit}. This manual lists only one of the
2468 two forms, whichever is not the default.
2469
2470 The following options control the amount and kinds of warnings produced
2471 by GCC; for further, language-specific options also refer to
2472 @ref{C++ Dialect Options} and @ref{Objective-C and Objective-C++ Dialect
2473 Options}.
2474
2475 @table @gcctabopt
2476 @cindex syntax checking
2477 @item -fsyntax-only
2478 @opindex fsyntax-only
2479 Check the code for syntax errors, but don't do anything beyond that.
2480
2481 @item -pedantic
2482 @opindex pedantic
2483 Issue all the warnings demanded by strict ISO C and ISO C++;
2484 reject all programs that use forbidden extensions, and some other
2485 programs that do not follow ISO C and ISO C++. For ISO C, follows the
2486 version of the ISO C standard specified by any @option{-std} option used.
2487
2488 Valid ISO C and ISO C++ programs should compile properly with or without
2489 this option (though a rare few will require @option{-ansi} or a
2490 @option{-std} option specifying the required version of ISO C)@. However,
2491 without this option, certain GNU extensions and traditional C and C++
2492 features are supported as well. With this option, they are rejected.
2493
2494 @option{-pedantic} does not cause warning messages for use of the
2495 alternate keywords whose names begin and end with @samp{__}. Pedantic
2496 warnings are also disabled in the expression that follows
2497 @code{__extension__}. However, only system header files should use
2498 these escape routes; application programs should avoid them.
2499 @xref{Alternate Keywords}.
2500
2501 Some users try to use @option{-pedantic} to check programs for strict ISO
2502 C conformance. They soon find that it does not do quite what they want:
2503 it finds some non-ISO practices, but not all---only those for which
2504 ISO C @emph{requires} a diagnostic, and some others for which
2505 diagnostics have been added.
2506
2507 A feature to report any failure to conform to ISO C might be useful in
2508 some instances, but would require considerable additional work and would
2509 be quite different from @option{-pedantic}. We don't have plans to
2510 support such a feature in the near future.
2511
2512 Where the standard specified with @option{-std} represents a GNU
2513 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2514 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2515 extended dialect is based. Warnings from @option{-pedantic} are given
2516 where they are required by the base standard. (It would not make sense
2517 for such warnings to be given only for features not in the specified GNU
2518 C dialect, since by definition the GNU dialects of C include all
2519 features the compiler supports with the given option, and there would be
2520 nothing to warn about.)
2521
2522 @item -pedantic-errors
2523 @opindex pedantic-errors
2524 Like @option{-pedantic}, except that errors are produced rather than
2525 warnings.
2526
2527 @item -w
2528 @opindex w
2529 Inhibit all warning messages.
2530
2531 @item -Wno-import
2532 @opindex Wno-import
2533 Inhibit warning messages about the use of @samp{#import}.
2534
2535 @item -Wchar-subscripts
2536 @opindex Wchar-subscripts
2537 Warn if an array subscript has type @code{char}. This is a common cause
2538 of error, as programmers often forget that this type is signed on some
2539 machines.
2540 This warning is enabled by @option{-Wall}.
2541
2542 @item -Wcomment
2543 @opindex Wcomment
2544 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2545 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2546 This warning is enabled by @option{-Wall}.
2547
2548 @item -Wfatal-errors
2549 @opindex Wfatal-errors
2550 This option causes the compiler to abort compilation on the first error
2551 occurred rather than trying to keep going and printing further error
2552 messages.
2553
2554 @item -Wformat
2555 @opindex Wformat
2556 @opindex ffreestanding
2557 @opindex fno-builtin
2558 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2559 the arguments supplied have types appropriate to the format string
2560 specified, and that the conversions specified in the format string make
2561 sense. This includes standard functions, and others specified by format
2562 attributes (@pxref{Function Attributes}), in the @code{printf},
2563 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2564 not in the C standard) families (or other target-specific families).
2565 Which functions are checked without format attributes having been
2566 specified depends on the standard version selected, and such checks of
2567 functions without the attribute specified are disabled by
2568 @option{-ffreestanding} or @option{-fno-builtin}.
2569
2570 The formats are checked against the format features supported by GNU
2571 libc version 2.2. These include all ISO C90 and C99 features, as well
2572 as features from the Single Unix Specification and some BSD and GNU
2573 extensions. Other library implementations may not support all these
2574 features; GCC does not support warning about features that go beyond a
2575 particular library's limitations. However, if @option{-pedantic} is used
2576 with @option{-Wformat}, warnings will be given about format features not
2577 in the selected standard version (but not for @code{strfmon} formats,
2578 since those are not in any version of the C standard). @xref{C Dialect
2579 Options,,Options Controlling C Dialect}.
2580
2581 Since @option{-Wformat} also checks for null format arguments for
2582 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2583
2584 @option{-Wformat} is included in @option{-Wall}. For more control over some
2585 aspects of format checking, the options @option{-Wformat-y2k},
2586 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2587 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2588 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2589
2590 @item -Wformat-y2k
2591 @opindex Wformat-y2k
2592 If @option{-Wformat} is specified, also warn about @code{strftime}
2593 formats which may yield only a two-digit year.
2594
2595 @item -Wno-format-extra-args
2596 @opindex Wno-format-extra-args
2597 If @option{-Wformat} is specified, do not warn about excess arguments to a
2598 @code{printf} or @code{scanf} format function. The C standard specifies
2599 that such arguments are ignored.
2600
2601 Where the unused arguments lie between used arguments that are
2602 specified with @samp{$} operand number specifications, normally
2603 warnings are still given, since the implementation could not know what
2604 type to pass to @code{va_arg} to skip the unused arguments. However,
2605 in the case of @code{scanf} formats, this option will suppress the
2606 warning if the unused arguments are all pointers, since the Single
2607 Unix Specification says that such unused arguments are allowed.
2608
2609 @item -Wno-format-zero-length
2610 @opindex Wno-format-zero-length
2611 If @option{-Wformat} is specified, do not warn about zero-length formats.
2612 The C standard specifies that zero-length formats are allowed.
2613
2614 @item -Wformat-nonliteral
2615 @opindex Wformat-nonliteral
2616 If @option{-Wformat} is specified, also warn if the format string is not a
2617 string literal and so cannot be checked, unless the format function
2618 takes its format arguments as a @code{va_list}.
2619
2620 @item -Wformat-security
2621 @opindex Wformat-security
2622 If @option{-Wformat} is specified, also warn about uses of format
2623 functions that represent possible security problems. At present, this
2624 warns about calls to @code{printf} and @code{scanf} functions where the
2625 format string is not a string literal and there are no format arguments,
2626 as in @code{printf (foo);}. This may be a security hole if the format
2627 string came from untrusted input and contains @samp{%n}. (This is
2628 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2629 in future warnings may be added to @option{-Wformat-security} that are not
2630 included in @option{-Wformat-nonliteral}.)
2631
2632 @item -Wformat=2
2633 @opindex Wformat=2
2634 Enable @option{-Wformat} plus format checks not included in
2635 @option{-Wformat}. Currently equivalent to @samp{-Wformat
2636 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2637
2638 @item -Wnonnull
2639 @opindex Wnonnull
2640 Warn about passing a null pointer for arguments marked as
2641 requiring a non-null value by the @code{nonnull} function attribute.
2642
2643 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
2644 can be disabled with the @option{-Wno-nonnull} option.
2645
2646 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
2647 @opindex Winit-self
2648 Warn about uninitialized variables which are initialized with themselves.
2649 Note this option can only be used with the @option{-Wuninitialized} option,
2650 which in turn only works with @option{-O1} and above.
2651
2652 For example, GCC will warn about @code{i} being uninitialized in the
2653 following snippet only when @option{-Winit-self} has been specified:
2654 @smallexample
2655 @group
2656 int f()
2657 @{
2658 int i = i;
2659 return i;
2660 @}
2661 @end group
2662 @end smallexample
2663
2664 @item -Wimplicit-int
2665 @opindex Wimplicit-int
2666 Warn when a declaration does not specify a type.
2667 This warning is enabled by @option{-Wall}.
2668
2669 @item -Wimplicit-function-declaration
2670 @opindex Wimplicit-function-declaration
2671 @opindex Wno-implicit-function-declaration
2672 Give a warning whenever a function is used before being declared. In
2673 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
2674 enabled by default and it is made into an error by
2675 @option{-pedantic-errors}. This warning is also enabled by
2676 @option{-Wall}.
2677
2678 @item -Wimplicit
2679 @opindex Wimplicit
2680 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2681 This warning is enabled by @option{-Wall}.
2682
2683 @item -Wmain
2684 @opindex Wmain
2685 Warn if the type of @samp{main} is suspicious. @samp{main} should be a
2686 function with external linkage, returning int, taking either zero
2687 arguments, two, or three arguments of appropriate types.
2688 This warning is enabled by @option{-Wall}.
2689
2690 @item -Wmissing-braces
2691 @opindex Wmissing-braces
2692 Warn if an aggregate or union initializer is not fully bracketed. In
2693 the following example, the initializer for @samp{a} is not fully
2694 bracketed, but that for @samp{b} is fully bracketed.
2695
2696 @smallexample
2697 int a[2][2] = @{ 0, 1, 2, 3 @};
2698 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2699 @end smallexample
2700
2701 This warning is enabled by @option{-Wall}.
2702
2703 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
2704 @opindex Wmissing-include-dirs
2705 Warn if a user-supplied include directory does not exist.
2706
2707 @item -Wparentheses
2708 @opindex Wparentheses
2709 Warn if parentheses are omitted in certain contexts, such
2710 as when there is an assignment in a context where a truth value
2711 is expected, or when operators are nested whose precedence people
2712 often get confused about.
2713
2714 Also warn if a comparison like @samp{x<=y<=z} appears; this is
2715 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
2716 interpretation from that of ordinary mathematical notation.
2717
2718 Also warn about constructions where there may be confusion to which
2719 @code{if} statement an @code{else} branch belongs. Here is an example of
2720 such a case:
2721
2722 @smallexample
2723 @group
2724 @{
2725 if (a)
2726 if (b)
2727 foo ();
2728 else
2729 bar ();
2730 @}
2731 @end group
2732 @end smallexample
2733
2734 In C/C++, every @code{else} branch belongs to the innermost possible
2735 @code{if} statement, which in this example is @code{if (b)}. This is
2736 often not what the programmer expected, as illustrated in the above
2737 example by indentation the programmer chose. When there is the
2738 potential for this confusion, GCC will issue a warning when this flag
2739 is specified. To eliminate the warning, add explicit braces around
2740 the innermost @code{if} statement so there is no way the @code{else}
2741 could belong to the enclosing @code{if}. The resulting code would
2742 look like this:
2743
2744 @smallexample
2745 @group
2746 @{
2747 if (a)
2748 @{
2749 if (b)
2750 foo ();
2751 else
2752 bar ();
2753 @}
2754 @}
2755 @end group
2756 @end smallexample
2757
2758 This warning is enabled by @option{-Wall}.
2759
2760 @item -Wsequence-point
2761 @opindex Wsequence-point
2762 Warn about code that may have undefined semantics because of violations
2763 of sequence point rules in the C and C++ standards.
2764
2765 The C and C++ standards defines the order in which expressions in a C/C++
2766 program are evaluated in terms of @dfn{sequence points}, which represent
2767 a partial ordering between the execution of parts of the program: those
2768 executed before the sequence point, and those executed after it. These
2769 occur after the evaluation of a full expression (one which is not part
2770 of a larger expression), after the evaluation of the first operand of a
2771 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2772 function is called (but after the evaluation of its arguments and the
2773 expression denoting the called function), and in certain other places.
2774 Other than as expressed by the sequence point rules, the order of
2775 evaluation of subexpressions of an expression is not specified. All
2776 these rules describe only a partial order rather than a total order,
2777 since, for example, if two functions are called within one expression
2778 with no sequence point between them, the order in which the functions
2779 are called is not specified. However, the standards committee have
2780 ruled that function calls do not overlap.
2781
2782 It is not specified when between sequence points modifications to the
2783 values of objects take effect. Programs whose behavior depends on this
2784 have undefined behavior; the C and C++ standards specify that ``Between
2785 the previous and next sequence point an object shall have its stored
2786 value modified at most once by the evaluation of an expression.
2787 Furthermore, the prior value shall be read only to determine the value
2788 to be stored.''. If a program breaks these rules, the results on any
2789 particular implementation are entirely unpredictable.
2790
2791 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2792 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
2793 diagnosed by this option, and it may give an occasional false positive
2794 result, but in general it has been found fairly effective at detecting
2795 this sort of problem in programs.
2796
2797 The standard is worded confusingly, therefore there is some debate
2798 over the precise meaning of the sequence point rules in subtle cases.
2799 Links to discussions of the problem, including proposed formal
2800 definitions, may be found on the GCC readings page, at
2801 @w{@uref{http://gcc.gnu.org/readings.html}}.
2802
2803 This warning is enabled by @option{-Wall} for C and C++.
2804
2805 @item -Wreturn-type
2806 @opindex Wreturn-type
2807 Warn whenever a function is defined with a return-type that defaults to
2808 @code{int}. Also warn about any @code{return} statement with no
2809 return-value in a function whose return-type is not @code{void}.
2810
2811 Also warn if the return type of a function has a type qualifier
2812 such as @code{const}. For ISO C such a type qualifier has no effect,
2813 since the value returned by a function is not an lvalue.
2814 For C++, the warning is only emitted for scalar types or @code{void}.
2815 ISO C prohibits qualified @code{void} return types on function
2816 definitions, so such return types always receive a warning
2817 even without this option.
2818
2819 For C++, a function without return type always produces a diagnostic
2820 message, even when @option{-Wno-return-type} is specified. The only
2821 exceptions are @samp{main} and functions defined in system headers.
2822
2823 This warning is enabled by @option{-Wall}.
2824
2825 @item -Wswitch
2826 @opindex Wswitch
2827 Warn whenever a @code{switch} statement has an index of enumerated type
2828 and lacks a @code{case} for one or more of the named codes of that
2829 enumeration. (The presence of a @code{default} label prevents this
2830 warning.) @code{case} labels outside the enumeration range also
2831 provoke warnings when this option is used.
2832 This warning is enabled by @option{-Wall}.
2833
2834 @item -Wswitch-default
2835 @opindex Wswitch-switch
2836 Warn whenever a @code{switch} statement does not have a @code{default}
2837 case.
2838
2839 @item -Wswitch-enum
2840 @opindex Wswitch-enum
2841 Warn whenever a @code{switch} statement has an index of enumerated type
2842 and lacks a @code{case} for one or more of the named codes of that
2843 enumeration. @code{case} labels outside the enumeration range also
2844 provoke warnings when this option is used.
2845
2846 @item -Wtrigraphs
2847 @opindex Wtrigraphs
2848 Warn if any trigraphs are encountered that might change the meaning of
2849 the program (trigraphs within comments are not warned about).
2850 This warning is enabled by @option{-Wall}.
2851
2852 @item -Wunused-function
2853 @opindex Wunused-function
2854 Warn whenever a static function is declared but not defined or a
2855 non-inline static function is unused.
2856 This warning is enabled by @option{-Wall}.
2857
2858 @item -Wunused-label
2859 @opindex Wunused-label
2860 Warn whenever a label is declared but not used.
2861 This warning is enabled by @option{-Wall}.
2862
2863 To suppress this warning use the @samp{unused} attribute
2864 (@pxref{Variable Attributes}).
2865
2866 @item -Wunused-parameter
2867 @opindex Wunused-parameter
2868 Warn whenever a function parameter is unused aside from its declaration.
2869
2870 To suppress this warning use the @samp{unused} attribute
2871 (@pxref{Variable Attributes}).
2872
2873 @item -Wunused-variable
2874 @opindex Wunused-variable
2875 Warn whenever a local variable or non-constant static variable is unused
2876 aside from its declaration.
2877 This warning is enabled by @option{-Wall}.
2878
2879 To suppress this warning use the @samp{unused} attribute
2880 (@pxref{Variable Attributes}).
2881
2882 @item -Wunused-value
2883 @opindex Wunused-value
2884 Warn whenever a statement computes a result that is explicitly not
2885 used. To suppress this warning cast the unused expression to
2886 @samp{void}. This includes an expression-statement or the left-hand
2887 side of a comma expression that contains no side effects. For example,
2888 an expression such as @samp{x[i,j]} will cause a warning, while
2889 @samp{x[(void)i,j]} will not.
2890
2891 This warning is enabled by @option{-Wall}.
2892
2893 @item -Wunused
2894 @opindex Wunused
2895 All the above @option{-Wunused} options combined.
2896
2897 In order to get a warning about an unused function parameter, you must
2898 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2899 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2900
2901 @item -Wuninitialized
2902 @opindex Wuninitialized
2903 Warn if an automatic variable is used without first being initialized or
2904 if a variable may be clobbered by a @code{setjmp} call.
2905
2906 These warnings are possible only in optimizing compilation,
2907 because they require data flow information that is computed only
2908 when optimizing. If you do not specify @option{-O}, you will not get
2909 these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized}
2910 requiring @option{-O}.
2911
2912 If you want to warn about code which uses the uninitialized value of the
2913 variable in its own initializer, use the @option{-Winit-self} option.
2914
2915 These warnings occur for individual uninitialized or clobbered
2916 elements of structure, union or array variables as well as for
2917 variables which are uninitialized or clobbered as a whole. They do
2918 not occur for variables or elements declared @code{volatile}. Because
2919 these warnings depend on optimization, the exact variables or elements
2920 for which there are warnings will depend on the precise optimization
2921 options and version of GCC used.
2922
2923 Note that there may be no warning about a variable that is used only
2924 to compute a value that itself is never used, because such
2925 computations may be deleted by data flow analysis before the warnings
2926 are printed.
2927
2928 These warnings are made optional because GCC is not smart
2929 enough to see all the reasons why the code might be correct
2930 despite appearing to have an error. Here is one example of how
2931 this can happen:
2932
2933 @smallexample
2934 @group
2935 @{
2936 int x;
2937 switch (y)
2938 @{
2939 case 1: x = 1;
2940 break;
2941 case 2: x = 4;
2942 break;
2943 case 3: x = 5;
2944 @}
2945 foo (x);
2946 @}
2947 @end group
2948 @end smallexample
2949
2950 @noindent
2951 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2952 always initialized, but GCC doesn't know this. Here is
2953 another common case:
2954
2955 @smallexample
2956 @{
2957 int save_y;
2958 if (change_y) save_y = y, y = new_y;
2959 @dots{}
2960 if (change_y) y = save_y;
2961 @}
2962 @end smallexample
2963
2964 @noindent
2965 This has no bug because @code{save_y} is used only if it is set.
2966
2967 @cindex @code{longjmp} warnings
2968 This option also warns when a non-volatile automatic variable might be
2969 changed by a call to @code{longjmp}. These warnings as well are possible
2970 only in optimizing compilation.
2971
2972 The compiler sees only the calls to @code{setjmp}. It cannot know
2973 where @code{longjmp} will be called; in fact, a signal handler could
2974 call it at any point in the code. As a result, you may get a warning
2975 even when there is in fact no problem because @code{longjmp} cannot
2976 in fact be called at the place which would cause a problem.
2977
2978 Some spurious warnings can be avoided if you declare all the functions
2979 you use that never return as @code{noreturn}. @xref{Function
2980 Attributes}.
2981
2982 This warning is enabled by @option{-Wall}.
2983
2984 @item -Wunknown-pragmas
2985 @opindex Wunknown-pragmas
2986 @cindex warning for unknown pragmas
2987 @cindex unknown pragmas, warning
2988 @cindex pragmas, warning of unknown
2989 Warn when a #pragma directive is encountered which is not understood by
2990 GCC@. If this command line option is used, warnings will even be issued
2991 for unknown pragmas in system header files. This is not the case if
2992 the warnings were only enabled by the @option{-Wall} command line option.
2993
2994 @item -Wno-pragmas
2995 @opindex Wno-pragmas
2996 @opindex Wpragmas
2997 Do not warn about misuses of pragmas, such as incorrect parameters,
2998 invalid syntax, or conflicts between pragmas. See also
2999 @samp{-Wunknown-pragmas}.
3000
3001 @item -Wstrict-aliasing
3002 @opindex Wstrict-aliasing
3003 This option is only active when @option{-fstrict-aliasing} is active.
3004 It warns about code which might break the strict aliasing rules that the
3005 compiler is using for optimization. The warning does not catch all
3006 cases, but does attempt to catch the more common pitfalls. It is
3007 included in @option{-Wall}.
3008
3009 @item -Wstrict-aliasing=2
3010 @opindex Wstrict-aliasing=2
3011 This option is only active when @option{-fstrict-aliasing} is active.
3012 It warns about code which might break the strict aliasing rules that the
3013 compiler is using for optimization. This warning catches more cases than
3014 @option{-Wstrict-aliasing}, but it will also give a warning for some ambiguous
3015 cases that are safe.
3016
3017 @item -Wstrict-overflow
3018 @item -Wstrict-overflow=@var{n}
3019 @opindex Wstrict-overflow
3020 This option is only active when @option{-fstrict-overflow} is active.
3021 It warns about cases where the compiler optimizes based on the
3022 assumption that signed overflow does not occur. Note that it does not
3023 warn about all cases where the code might overflow: it only warns
3024 about cases where the compiler implements some optimization. Thus
3025 this warning depends on the optimization level.
3026
3027 An optimization which assumes that signed overflow does not occur is
3028 perfectly safe if the values of the variables involved are such that
3029 overflow never does, in fact, occur. Therefore this warning can
3030 easily give a false positive: a warning about code which is not
3031 actually a problem. To help focus on important issues, several
3032 warning levels are defined. No warnings are issued for the use of
3033 undefined signed overflow when estimating how many iterations a loop
3034 will require, in particular when determining whether a loop will be
3035 executed at all.
3036
3037 @table @option
3038 @item -Wstrict-overflow=1
3039 Warn about cases which are both questionable and easy to avoid. For
3040 example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
3041 compiler will simplify this to @code{1}. This level of
3042 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3043 are not, and must be explicitly requested.
3044
3045 @item -Wstrict-overflow=2
3046 Also warn about other cases where a comparison is simplified to a
3047 constant. For example: @code{abs (x) >= 0}. This can only be
3048 simplified when @option{-fstrict-overflow} is in effect, because
3049 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
3050 zero. @option{-Wstrict-overflow} (with no level) is the same as
3051 @option{-Wstrict-overflow=2}.
3052
3053 @item -Wstrict-overflow=3
3054 Also warn about other cases where a comparison is simplified. For
3055 example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
3056
3057 @item -Wstrict-overflow=4
3058 Also warn about other simplifications not covered by the above cases.
3059 For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
3060
3061 @item -Wstrict-overflow=5
3062 Also warn about cases where the compiler reduces the magnitude of a
3063 constant involved in a comparison. For example: @code{x + 2 > y} will
3064 be simplified to @code{x + 1 >= y}. This is reported only at the
3065 highest warning level because this simplification applies to many
3066 comparisons, so this warning level will give a very large number of
3067 false positives.
3068 @end table
3069
3070 @item -Warray-bounds
3071 @opindex Wno-array-bounds
3072 @opindex Warray-bounds
3073 This option is only active when @option{-ftree-vrp} is active
3074 (default for -O2 and above). It warns about subscripts to arrays
3075 that are always out of bounds. This warning is enabled by @option{-Wall}.
3076
3077 @item -Wall
3078 @opindex Wall
3079 All of the above @samp{-W} options combined. This enables all the
3080 warnings about constructions that some users consider questionable, and
3081 that are easy to avoid (or modify to prevent the warning), even in
3082 conjunction with macros. This also enables some language-specific
3083 warnings described in @ref{C++ Dialect Options} and
3084 @ref{Objective-C and Objective-C++ Dialect Options}.
3085 @end table
3086
3087 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
3088 Some of them warn about constructions that users generally do not
3089 consider questionable, but which occasionally you might wish to check
3090 for; others warn about constructions that are necessary or hard to avoid
3091 in some cases, and there is no simple way to modify the code to suppress
3092 the warning.
3093
3094 @table @gcctabopt
3095 @item -Wextra
3096 @opindex W
3097 @opindex Wextra
3098 (This option used to be called @option{-W}. The older name is still
3099 supported, but the newer name is more descriptive.) Print extra warning
3100 messages for these events:
3101
3102 @itemize @bullet
3103 @item
3104 A function can return either with or without a value. (Falling
3105 off the end of the function body is considered returning without
3106 a value.) For example, this function would evoke such a
3107 warning:
3108
3109 @smallexample
3110 @group
3111 foo (a)
3112 @{
3113 if (a > 0)
3114 return a;
3115 @}
3116 @end group
3117 @end smallexample
3118
3119 @item
3120 An unsigned value is compared against zero with @samp{<} or @samp{>=}.
3121
3122 @item @r{(C only)}
3123 Storage-class specifiers like @code{static} are not the first things
3124 in a declaration. According to the C Standard, this usage is
3125 obsolescent. This warning can be independently controlled by
3126 @option{-Wold-style-declaration}.
3127
3128 @item
3129 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
3130 arguments.
3131
3132 @item
3133 A comparison between signed and unsigned values could produce an
3134 incorrect result when the signed value is converted to unsigned.
3135 (But don't warn if @option{-Wno-sign-compare} is also specified.)
3136
3137 @item
3138 An aggregate has an initializer which does not initialize all members.
3139 This warning can be independently controlled by
3140 @option{-Wmissing-field-initializers}.
3141
3142 @item
3143 An initialized field without side effects is overridden when using
3144 designated initializers (@pxref{Designated Inits, , Designated
3145 Initializers}). This warning can be independently controlled by
3146 @option{-Woverride-init}.
3147
3148 @item @r{(C only)}
3149 A function parameter is declared without a type specifier in K&R-style
3150 functions. This warning can be independently controlled by
3151 @option{-Wmissing-parameter-type}.
3152
3153 @item
3154 An empty body occurs in an @samp{if}, @samp{else} or
3155 @samp{do while} statement. This warning can be independently
3156 controlled by @option{-Wempty-body}.
3157
3158 @item
3159 A pointer is compared against integer zero with @samp{<}, @samp{<=},
3160 @samp{>}, or @samp{>=}.
3161
3162 @item
3163 A variable might be changed by @samp{longjmp} or @samp{vfork}.
3164 This warning can be independently controlled by @option{-Wclobbered}.
3165
3166 @item @r{(C++ only)}
3167 An enumerator and a non-enumerator both appear in a conditional expression.
3168
3169 @item @r{(C++ only)}
3170 A non-static reference or non-static @samp{const} member appears in a
3171 class without constructors.
3172
3173 @item @r{(C++ only)}
3174 Ambiguous virtual bases.
3175
3176 @item @r{(C++ only)}
3177 Subscripting an array which has been declared @samp{register}.
3178
3179 @item @r{(C++ only)}
3180 Taking the address of a variable which has been declared @samp{register}.
3181
3182 @item @r{(C++ only)}
3183 A base class is not initialized in a derived class' copy constructor.
3184 @end itemize
3185
3186 @item -Wno-div-by-zero
3187 @opindex Wno-div-by-zero
3188 @opindex Wdiv-by-zero
3189 Do not warn about compile-time integer division by zero. Floating point
3190 division by zero is not warned about, as it can be a legitimate way of
3191 obtaining infinities and NaNs.
3192
3193 @item -Wsystem-headers
3194 @opindex Wsystem-headers
3195 @cindex warnings from system headers
3196 @cindex system headers, warnings from
3197 Print warning messages for constructs found in system header files.
3198 Warnings from system headers are normally suppressed, on the assumption
3199 that they usually do not indicate real problems and would only make the
3200 compiler output harder to read. Using this command line option tells
3201 GCC to emit warnings from system headers as if they occurred in user
3202 code. However, note that using @option{-Wall} in conjunction with this
3203 option will @emph{not} warn about unknown pragmas in system
3204 headers---for that, @option{-Wunknown-pragmas} must also be used.
3205
3206 @item -Wfloat-equal
3207 @opindex Wfloat-equal
3208 Warn if floating point values are used in equality comparisons.
3209
3210 The idea behind this is that sometimes it is convenient (for the
3211 programmer) to consider floating-point values as approximations to
3212 infinitely precise real numbers. If you are doing this, then you need
3213 to compute (by analyzing the code, or in some other way) the maximum or
3214 likely maximum error that the computation introduces, and allow for it
3215 when performing comparisons (and when producing output, but that's a
3216 different problem). In particular, instead of testing for equality, you
3217 would check to see whether the two values have ranges that overlap; and
3218 this is done with the relational operators, so equality comparisons are
3219 probably mistaken.
3220
3221 @item -Wtraditional @r{(C only)}
3222 @opindex Wtraditional
3223 Warn about certain constructs that behave differently in traditional and
3224 ISO C@. Also warn about ISO C constructs that have no traditional C
3225 equivalent, and/or problematic constructs which should be avoided.
3226
3227 @itemize @bullet
3228 @item
3229 Macro parameters that appear within string literals in the macro body.
3230 In traditional C macro replacement takes place within string literals,
3231 but does not in ISO C@.
3232
3233 @item
3234 In traditional C, some preprocessor directives did not exist.
3235 Traditional preprocessors would only consider a line to be a directive
3236 if the @samp{#} appeared in column 1 on the line. Therefore
3237 @option{-Wtraditional} warns about directives that traditional C
3238 understands but would ignore because the @samp{#} does not appear as the
3239 first character on the line. It also suggests you hide directives like
3240 @samp{#pragma} not understood by traditional C by indenting them. Some
3241 traditional implementations would not recognize @samp{#elif}, so it
3242 suggests avoiding it altogether.
3243
3244 @item
3245 A function-like macro that appears without arguments.
3246
3247 @item
3248 The unary plus operator.
3249
3250 @item
3251 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
3252 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
3253 constants.) Note, these suffixes appear in macros defined in the system
3254 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
3255 Use of these macros in user code might normally lead to spurious
3256 warnings, however GCC's integrated preprocessor has enough context to
3257 avoid warning in these cases.
3258
3259 @item
3260 A function declared external in one block and then used after the end of
3261 the block.
3262
3263 @item
3264 A @code{switch} statement has an operand of type @code{long}.
3265
3266 @item
3267 A non-@code{static} function declaration follows a @code{static} one.
3268 This construct is not accepted by some traditional C compilers.
3269
3270 @item
3271 The ISO type of an integer constant has a different width or
3272 signedness from its traditional type. This warning is only issued if
3273 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
3274 typically represent bit patterns, are not warned about.
3275
3276 @item
3277 Usage of ISO string concatenation is detected.
3278
3279 @item
3280 Initialization of automatic aggregates.
3281
3282 @item
3283 Identifier conflicts with labels. Traditional C lacks a separate
3284 namespace for labels.
3285
3286 @item
3287 Initialization of unions. If the initializer is zero, the warning is
3288 omitted. This is done under the assumption that the zero initializer in
3289 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
3290 initializer warnings and relies on default initialization to zero in the
3291 traditional C case.
3292
3293 @item
3294 Conversions by prototypes between fixed/floating point values and vice
3295 versa. The absence of these prototypes when compiling with traditional
3296 C would cause serious problems. This is a subset of the possible
3297 conversion warnings, for the full set use @option{-Wtraditional-conversion}.
3298
3299 @item
3300 Use of ISO C style function definitions. This warning intentionally is
3301 @emph{not} issued for prototype declarations or variadic functions
3302 because these ISO C features will appear in your code when using
3303 libiberty's traditional C compatibility macros, @code{PARAMS} and
3304 @code{VPARAMS}. This warning is also bypassed for nested functions
3305 because that feature is already a GCC extension and thus not relevant to
3306 traditional C compatibility.
3307 @end itemize
3308
3309 @item -Wtraditional-conversion @r{(C only)}
3310 @opindex Wtraditional-conversion
3311 Warn if a prototype causes a type conversion that is different from what
3312 would happen to the same argument in the absence of a prototype. This
3313 includes conversions of fixed point to floating and vice versa, and
3314 conversions changing the width or signedness of a fixed point argument
3315 except when the same as the default promotion.
3316
3317 @item -Wdeclaration-after-statement @r{(C only)}
3318 @opindex Wdeclaration-after-statement
3319 Warn when a declaration is found after a statement in a block. This
3320 construct, known from C++, was introduced with ISO C99 and is by default
3321 allowed in GCC@. It is not supported by ISO C90 and was not supported by
3322 GCC versions before GCC 3.0. @xref{Mixed Declarations}.
3323
3324 @item -Wundef
3325 @opindex Wundef
3326 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3327
3328 @item -Wno-endif-labels
3329 @opindex Wno-endif-labels
3330 @opindex Wendif-labels
3331 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
3332
3333 @item -Wshadow
3334 @opindex Wshadow
3335 Warn whenever a local variable shadows another local variable, parameter or
3336 global variable or whenever a built-in function is shadowed.
3337
3338 @item -Wlarger-than-@var{len}
3339 @opindex Wlarger-than
3340 Warn whenever an object of larger than @var{len} bytes is defined.
3341
3342 @item -Wunsafe-loop-optimizations
3343 @opindex Wunsafe-loop-optimizations
3344 Warn if the loop cannot be optimized because the compiler could not
3345 assume anything on the bounds of the loop indices. With
3346 @option{-funsafe-loop-optimizations} warn if the compiler made
3347 such assumptions.
3348
3349 @item -Wpointer-arith
3350 @opindex Wpointer-arith
3351 Warn about anything that depends on the ``size of'' a function type or
3352 of @code{void}. GNU C assigns these types a size of 1, for
3353 convenience in calculations with @code{void *} pointers and pointers
3354 to functions. In C++, warn also when an arithmetic operation involves
3355 @code{NULL}. This warning is also enabled by @option{-pedantic}.
3356
3357 @item -Wbad-function-cast @r{(C only)}
3358 @opindex Wbad-function-cast
3359 Warn whenever a function call is cast to a non-matching type.
3360 For example, warn if @code{int malloc()} is cast to @code{anything *}.
3361
3362 @item -Wc++-compat
3363 Warn about ISO C constructs that are outside of the common subset of
3364 ISO C and ISO C++, e.g.@: request for implicit conversion from
3365 @code{void *} to a pointer to non-@code{void} type.
3366
3367 @item -Wc++0x-compat @r{(C++ and Objective-C++ only)}
3368 Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
3369 ISO C++ 200x, e.g., identifiers in ISO C++ 1998 that will become keywords
3370 in ISO C++ 200x. This warning is enabled by @option{-Wall}.
3371
3372 @item -Wcast-qual
3373 @opindex Wcast-qual
3374 Warn whenever a pointer is cast so as to remove a type qualifier from
3375 the target type. For example, warn if a @code{const char *} is cast
3376 to an ordinary @code{char *}.
3377
3378 @item -Wcast-align
3379 @opindex Wcast-align
3380 Warn whenever a pointer is cast such that the required alignment of the
3381 target is increased. For example, warn if a @code{char *} is cast to
3382 an @code{int *} on machines where integers can only be accessed at
3383 two- or four-byte boundaries.
3384
3385 @item -Wwrite-strings
3386 @opindex Wwrite-strings
3387 When compiling C, give string constants the type @code{const
3388 char[@var{length}]} so that
3389 copying the address of one into a non-@code{const} @code{char *}
3390 pointer will get a warning; when compiling C++, warn about the
3391 deprecated conversion from string literals to @code{char *}. This
3392 warning, by default, is enabled for C++ programs.
3393 These warnings will help you find at
3394 compile time code that can try to write into a string constant, but
3395 only if you have been very careful about using @code{const} in
3396 declarations and prototypes. Otherwise, it will just be a nuisance;
3397 this is why we did not make @option{-Wall} request these warnings.
3398
3399 @item -Wclobbered
3400 @opindex Wclobbered
3401 Warn for variables that might be changed by @samp{longjmp} or
3402 @samp{vfork}. This warning is also enabled by @option{-Wextra}.
3403
3404 @item -Wconversion
3405 @opindex Wconversion
3406 Warn for implicit conversions that may alter a value. This includes
3407 conversions between real and integer, like @code{abs (x)} when
3408 @code{x} is @code{double}; conversions between signed and unsigned,
3409 like @code{unsigned ui = -1}; and conversions to smaller types, like
3410 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
3411 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
3412 changed by the conversion like in @code{abs (2.0)}.
3413
3414 For C++, also warn for conversions between @code{NULL} and non-pointer
3415 types; confusing overload resolution for user-defined conversions; and
3416 conversions that will never use a type conversion operator:
3417 conversions to @code{void}, the same type, a base class or a reference
3418 to them.
3419
3420 @item -Wempty-body
3421 @opindex Wempty-body
3422 An empty body occurs in an @samp{if}, @samp{else} or @samp{do while}
3423 statement. This warning is also enabled by @option{-Wextra}.
3424
3425 @item -Wsign-compare
3426 @opindex Wsign-compare
3427 @cindex warning for comparison of signed and unsigned values
3428 @cindex comparison of signed and unsigned values, warning
3429 @cindex signed and unsigned values, comparison warning
3430 Warn when a comparison between signed and unsigned values could produce
3431 an incorrect result when the signed value is converted to unsigned.
3432 This warning is also enabled by @option{-Wextra}; to get the other warnings
3433 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
3434
3435 @item -Waddress
3436 @opindex Waddress
3437 @opindex Wno-address
3438 Warn about suspicious uses of memory addresses. These include using
3439 the address of a function in a conditional expression, such as
3440 @code{void func(void); if (func)}, and comparisons against the memory
3441 address of a string literal, such as @code{if (x == "abc")}. Such
3442 uses typically indicate a programmer error: the address of a function
3443 always evaluates to true, so their use in a conditional usually
3444 indicate that the programmer forgot the parentheses in a function
3445 call; and comparisons against string literals result in unspecified
3446 behavior and are not portable in C, so they usually indicate that the
3447 programmer intended to use @code{strcmp}. This warning is enabled by
3448 @option{-Wall}.
3449
3450 @item -Wlogical-op
3451 @opindex Wlogical-op
3452 @opindex Wno-logical-op
3453 Warn about suspicious uses of logical operators in expressions.
3454 This includes using logical operators in contexts where a
3455 bit-wise operator is likely to be expected.
3456
3457 @item -Waggregate-return
3458 @opindex Waggregate-return
3459 Warn if any functions that return structures or unions are defined or
3460 called. (In languages where you can return an array, this also elicits
3461 a warning.)
3462
3463 @item -Wno-attributes
3464 @opindex Wno-attributes
3465 @opindex Wattributes
3466 Do not warn if an unexpected @code{__attribute__} is used, such as
3467 unrecognized attributes, function attributes applied to variables,
3468 etc. This will not stop errors for incorrect use of supported
3469 attributes.
3470
3471 @item -Wstrict-prototypes @r{(C only)}
3472 @opindex Wstrict-prototypes
3473 Warn if a function is declared or defined without specifying the
3474 argument types. (An old-style function definition is permitted without
3475 a warning if preceded by a declaration which specifies the argument
3476 types.)
3477
3478 @item -Wold-style-declaration @r{(C only)}
3479 @opindex Wold-style-declaration
3480 Warn for obsolescent usages, according to the C Standard, in a
3481 declaration. For example, warn if storage-class specifiers like
3482 @code{static} are not the first things in a declaration. This warning
3483 is also enabled by @option{-Wextra}.
3484
3485 @item -Wold-style-definition @r{(C only)}
3486 @opindex Wold-style-definition
3487 Warn if an old-style function definition is used. A warning is given
3488 even if there is a previous prototype.
3489
3490 @item -Wmissing-parameter-type @r{(C only)}
3491 @opindex Wmissing-parameter-type
3492 A function parameter is declared without a type specifier in K&R-style
3493 functions:
3494
3495 @smallexample
3496 void foo(bar) @{ @}
3497 @end smallexample
3498
3499 This warning is also enabled by @option{-Wextra}.
3500
3501 @item -Wmissing-prototypes @r{(C only)}
3502 @opindex Wmissing-prototypes
3503 Warn if a global function is defined without a previous prototype
3504 declaration. This warning is issued even if the definition itself
3505 provides a prototype. The aim is to detect global functions that fail
3506 to be declared in header files.
3507
3508 @item -Wmissing-declarations @r{(C and C++ only)}
3509 @opindex Wmissing-declarations
3510 Warn if a global function is defined without a previous declaration.
3511 Do so even if the definition itself provides a prototype.
3512 Use this option to detect global functions that are not declared in
3513 header files. In C++, no warnings are issued for function templates,
3514 or for inline functions, or for functions in anonymous namespaces.
3515
3516 @item -Wmissing-field-initializers
3517 @opindex Wmissing-field-initializers
3518 @opindex W
3519 @opindex Wextra
3520 Warn if a structure's initializer has some fields missing. For
3521 example, the following code would cause such a warning, because
3522 @code{x.h} is implicitly zero:
3523
3524 @smallexample
3525 struct s @{ int f, g, h; @};
3526 struct s x = @{ 3, 4 @};
3527 @end smallexample
3528
3529 This option does not warn about designated initializers, so the following
3530 modification would not trigger a warning:
3531
3532 @smallexample
3533 struct s @{ int f, g, h; @};
3534 struct s x = @{ .f = 3, .g = 4 @};
3535 @end smallexample
3536
3537 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
3538 warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
3539
3540 @item -Wmissing-noreturn
3541 @opindex Wmissing-noreturn
3542 Warn about functions which might be candidates for attribute @code{noreturn}.
3543 Note these are only possible candidates, not absolute ones. Care should
3544 be taken to manually verify functions actually do not ever return before
3545 adding the @code{noreturn} attribute, otherwise subtle code generation
3546 bugs could be introduced. You will not get a warning for @code{main} in
3547 hosted C environments.
3548
3549 @item -Wmissing-format-attribute
3550 @opindex Wmissing-format-attribute
3551 @opindex Wformat
3552 Warn about function pointers which might be candidates for @code{format}
3553 attributes. Note these are only possible candidates, not absolute ones.
3554 GCC will guess that function pointers with @code{format} attributes that
3555 are used in assignment, initialization, parameter passing or return
3556 statements should have a corresponding @code{format} attribute in the
3557 resulting type. I.e.@: the left-hand side of the assignment or
3558 initialization, the type of the parameter variable, or the return type
3559 of the containing function respectively should also have a @code{format}
3560 attribute to avoid the warning.
3561
3562 GCC will also warn about function definitions which might be
3563 candidates for @code{format} attributes. Again, these are only
3564 possible candidates. GCC will guess that @code{format} attributes
3565 might be appropriate for any function that calls a function like
3566 @code{vprintf} or @code{vscanf}, but this might not always be the
3567 case, and some functions for which @code{format} attributes are
3568 appropriate may not be detected.
3569
3570 @item -Wno-multichar
3571 @opindex Wno-multichar
3572 @opindex Wmultichar
3573 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
3574 Usually they indicate a typo in the user's code, as they have
3575 implementation-defined values, and should not be used in portable code.
3576
3577 @item -Wnormalized=<none|id|nfc|nfkc>
3578 @opindex Wnormalized
3579 @cindex NFC
3580 @cindex NFKC
3581 @cindex character set, input normalization
3582 In ISO C and ISO C++, two identifiers are different if they are
3583 different sequences of characters. However, sometimes when characters
3584 outside the basic ASCII character set are used, you can have two
3585 different character sequences that look the same. To avoid confusion,
3586 the ISO 10646 standard sets out some @dfn{normalization rules} which
3587 when applied ensure that two sequences that look the same are turned into
3588 the same sequence. GCC can warn you if you are using identifiers which
3589 have not been normalized; this option controls that warning.
3590
3591 There are four levels of warning that GCC supports. The default is
3592 @option{-Wnormalized=nfc}, which warns about any identifier which is
3593 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
3594 recommended form for most uses.
3595
3596 Unfortunately, there are some characters which ISO C and ISO C++ allow
3597 in identifiers that when turned into NFC aren't allowable as
3598 identifiers. That is, there's no way to use these symbols in portable
3599 ISO C or C++ and have all your identifiers in NFC.
3600 @option{-Wnormalized=id} suppresses the warning for these characters.
3601 It is hoped that future versions of the standards involved will correct
3602 this, which is why this option is not the default.
3603
3604 You can switch the warning off for all characters by writing
3605 @option{-Wnormalized=none}. You would only want to do this if you
3606 were using some other normalization scheme (like ``D''), because
3607 otherwise you can easily create bugs that are literally impossible to see.
3608
3609 Some characters in ISO 10646 have distinct meanings but look identical
3610 in some fonts or display methodologies, especially once formatting has
3611 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
3612 LETTER N'', will display just like a regular @code{n} which has been
3613 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
3614 normalization scheme to convert all these into a standard form as
3615 well, and GCC will warn if your code is not in NFKC if you use
3616 @option{-Wnormalized=nfkc}. This warning is comparable to warning
3617 about every identifier that contains the letter O because it might be
3618 confused with the digit 0, and so is not the default, but may be
3619 useful as a local coding convention if the programming environment is
3620 unable to be fixed to display these characters distinctly.
3621
3622 @item -Wno-deprecated-declarations
3623 @opindex Wno-deprecated-declarations
3624 Do not warn about uses of functions (@pxref{Function Attributes}),
3625 variables (@pxref{Variable Attributes}), and types (@pxref{Type
3626 Attributes}) marked as deprecated by using the @code{deprecated}
3627 attribute.
3628
3629 @item -Wno-overflow
3630 @opindex Wno-overflow
3631 Do not warn about compile-time overflow in constant expressions.
3632
3633 @item -Woverride-init
3634 @opindex Woverride-init
3635 @opindex W
3636 @opindex Wextra
3637 Warn if an initialized field without side effects is overridden when
3638 using designated initializers (@pxref{Designated Inits, , Designated
3639 Initializers}).
3640
3641 This warning is included in @option{-Wextra}. To get other
3642 @option{-Wextra} warnings without this one, use @samp{-Wextra
3643 -Wno-override-init}.
3644
3645 @item -Wpacked
3646 @opindex Wpacked
3647 Warn if a structure is given the packed attribute, but the packed
3648 attribute has no effect on the layout or size of the structure.
3649 Such structures may be mis-aligned for little benefit. For
3650 instance, in this code, the variable @code{f.x} in @code{struct bar}
3651 will be misaligned even though @code{struct bar} does not itself
3652 have the packed attribute:
3653
3654 @smallexample
3655 @group
3656 struct foo @{
3657 int x;
3658 char a, b, c, d;
3659 @} __attribute__((packed));
3660 struct bar @{
3661 char z;
3662 struct foo f;
3663 @};
3664 @end group
3665 @end smallexample
3666
3667 @item -Wpadded
3668 @opindex Wpadded
3669 Warn if padding is included in a structure, either to align an element
3670 of the structure or to align the whole structure. Sometimes when this
3671 happens it is possible to rearrange the fields of the structure to
3672 reduce the padding and so make the structure smaller.
3673
3674 @item -Wredundant-decls
3675 @opindex Wredundant-decls
3676 Warn if anything is declared more than once in the same scope, even in
3677 cases where multiple declaration is valid and changes nothing.
3678
3679 @item -Wnested-externs @r{(C only)}
3680 @opindex Wnested-externs
3681 Warn if an @code{extern} declaration is encountered within a function.
3682
3683 @item -Wunreachable-code
3684 @opindex Wunreachable-code
3685 Warn if the compiler detects that code will never be executed.
3686
3687 This option is intended to warn when the compiler detects that at
3688 least a whole line of source code will never be executed, because
3689 some condition is never satisfied or because it is after a
3690 procedure that never returns.
3691
3692 It is possible for this option to produce a warning even though there
3693 are circumstances under which part of the affected line can be executed,
3694 so care should be taken when removing apparently-unreachable code.
3695
3696 For instance, when a function is inlined, a warning may mean that the
3697 line is unreachable in only one inlined copy of the function.
3698
3699 This option is not made part of @option{-Wall} because in a debugging
3700 version of a program there is often substantial code which checks
3701 correct functioning of the program and is, hopefully, unreachable
3702 because the program does work. Another common use of unreachable
3703 code is to provide behavior which is selectable at compile-time.
3704
3705 @item -Winline
3706 @opindex Winline
3707 Warn if a function can not be inlined and it was declared as inline.
3708 Even with this option, the compiler will not warn about failures to
3709 inline functions declared in system headers.
3710
3711 The compiler uses a variety of heuristics to determine whether or not
3712 to inline a function. For example, the compiler takes into account
3713 the size of the function being inlined and the amount of inlining
3714 that has already been done in the current function. Therefore,
3715 seemingly insignificant changes in the source program can cause the
3716 warnings produced by @option{-Winline} to appear or disappear.
3717
3718 @item -Wno-invalid-offsetof @r{(C++ only)}
3719 @opindex Wno-invalid-offsetof
3720 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
3721 type. According to the 1998 ISO C++ standard, applying @samp{offsetof}
3722 to a non-POD type is undefined. In existing C++ implementations,
3723 however, @samp{offsetof} typically gives meaningful results even when
3724 applied to certain kinds of non-POD types. (Such as a simple
3725 @samp{struct} that fails to be a POD type only by virtue of having a
3726 constructor.) This flag is for users who are aware that they are
3727 writing nonportable code and who have deliberately chosen to ignore the
3728 warning about it.
3729
3730 The restrictions on @samp{offsetof} may be relaxed in a future version
3731 of the C++ standard.
3732
3733 @item -Wno-int-to-pointer-cast @r{(C only)}
3734 @opindex Wno-int-to-pointer-cast
3735 Suppress warnings from casts to pointer type of an integer of a
3736 different size.
3737
3738 @item -Wno-pointer-to-int-cast @r{(C only)}
3739 @opindex Wno-pointer-to-int-cast
3740 Suppress warnings from casts from a pointer to an integer type of a
3741 different size.
3742
3743 @item -Winvalid-pch
3744 @opindex Winvalid-pch
3745 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
3746 the search path but can't be used.
3747
3748 @item -Wlong-long
3749 @opindex Wlong-long
3750 @opindex Wno-long-long
3751 Warn if @samp{long long} type is used. This is default. To inhibit
3752 the warning messages, use @option{-Wno-long-long}. Flags
3753 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
3754 only when @option{-pedantic} flag is used.
3755
3756 @item -Wvariadic-macros
3757 @opindex Wvariadic-macros
3758 @opindex Wno-variadic-macros
3759 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
3760 alternate syntax when in pedantic ISO C99 mode. This is default.
3761 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
3762
3763 @item -Wvla
3764 @opindex Wvla
3765 @opindex Wno-vla
3766 Warn if variable length array is used in the code.
3767 @option{-Wno-vla} will prevent the @option{-pedantic} warning of
3768 the variable length array.
3769
3770 @item -Wvolatile-register-var
3771 @opindex Wvolatile-register-var
3772 @opindex Wno-volatile-register-var
3773 Warn if a register variable is declared volatile. The volatile
3774 modifier does not inhibit all optimizations that may eliminate reads
3775 and/or writes to register variables.
3776
3777 @item -Wdisabled-optimization
3778 @opindex Wdisabled-optimization
3779 Warn if a requested optimization pass is disabled. This warning does
3780 not generally indicate that there is anything wrong with your code; it
3781 merely indicates that GCC's optimizers were unable to handle the code
3782 effectively. Often, the problem is that your code is too big or too
3783 complex; GCC will refuse to optimize programs when the optimization
3784 itself is likely to take inordinate amounts of time.
3785
3786 @item -Wpointer-sign
3787 @opindex Wpointer-sign
3788 @opindex Wno-pointer-sign
3789 Warn for pointer argument passing or assignment with different signedness.
3790 This option is only supported for C and Objective-C@. It is implied by
3791 @option{-Wall} and by @option{-pedantic}, which can be disabled with
3792 @option{-Wno-pointer-sign}.
3793
3794 @item -Werror
3795 @opindex Werror
3796 Make all warnings into errors.
3797
3798 @item -Werror=
3799 @opindex Werror=
3800 Make the specified warning into an errors. The specifier for a
3801 warning is appended, for example @option{-Werror=switch} turns the
3802 warnings controlled by @option{-Wswitch} into errors. This switch
3803 takes a negative form, to be used to negate @option{-Werror} for
3804 specific warnings, for example @option{-Wno-error=switch} makes
3805 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3806 is in effect. You can use the @option{-fdiagnostics-show-option}
3807 option to have each controllable warning amended with the option which
3808 controls it, to determine what to use with this option.
3809
3810 Note that specifying @option{-Werror=}@var{foo} automatically implies
3811 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3812 imply anything.
3813
3814 @item -Wstack-protector
3815 @opindex Wstack-protector
3816 This option is only active when @option{-fstack-protector} is active. It
3817 warns about functions that will not be protected against stack smashing.
3818
3819 @item -Woverlength-strings
3820 @opindex Woverlength-strings
3821 Warn about string constants which are longer than the ``minimum
3822 maximum'' length specified in the C standard. Modern compilers
3823 generally allow string constants which are much longer than the
3824 standard's minimum limit, but very portable programs should avoid
3825 using longer strings.
3826
3827 The limit applies @emph{after} string constant concatenation, and does
3828 not count the trailing NUL@. In C89, the limit was 509 characters; in
3829 C99, it was raised to 4095. C++98 does not specify a normative
3830 minimum maximum, so we do not diagnose overlength strings in C++@.
3831
3832 This option is implied by @option{-pedantic}, and can be disabled with
3833 @option{-Wno-overlength-strings}.
3834 @end table
3835
3836 @node Debugging Options
3837 @section Options for Debugging Your Program or GCC
3838 @cindex options, debugging
3839 @cindex debugging information options
3840
3841 GCC has various special options that are used for debugging
3842 either your program or GCC:
3843
3844 @table @gcctabopt
3845 @item -g
3846 @opindex g
3847 Produce debugging information in the operating system's native format
3848 (stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
3849 information.
3850
3851 On most systems that use stabs format, @option{-g} enables use of extra
3852 debugging information that only GDB can use; this extra information
3853 makes debugging work better in GDB but will probably make other debuggers
3854 crash or
3855 refuse to read the program. If you want to control for certain whether
3856 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3857 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
3858
3859 GCC allows you to use @option{-g} with
3860 @option{-O}. The shortcuts taken by optimized code may occasionally
3861 produce surprising results: some variables you declared may not exist
3862 at all; flow of control may briefly move where you did not expect it;
3863 some statements may not be executed because they compute constant
3864 results or their values were already at hand; some statements may
3865 execute in different places because they were moved out of loops.
3866
3867 Nevertheless it proves possible to debug optimized output. This makes
3868 it reasonable to use the optimizer for programs that might have bugs.
3869
3870 The following options are useful when GCC is generated with the
3871 capability for more than one debugging format.
3872
3873 @item -ggdb
3874 @opindex ggdb
3875 Produce debugging information for use by GDB@. This means to use the
3876 most expressive format available (DWARF 2, stabs, or the native format
3877 if neither of those are supported), including GDB extensions if at all
3878 possible.
3879
3880 @item -gstabs
3881 @opindex gstabs
3882 Produce debugging information in stabs format (if that is supported),
3883 without GDB extensions. This is the format used by DBX on most BSD
3884 systems. On MIPS, Alpha and System V Release 4 systems this option
3885 produces stabs debugging output which is not understood by DBX or SDB@.
3886 On System V Release 4 systems this option requires the GNU assembler.
3887
3888 @item -feliminate-unused-debug-symbols
3889 @opindex feliminate-unused-debug-symbols
3890 Produce debugging information in stabs format (if that is supported),
3891 for only symbols that are actually used.
3892
3893 @item -femit-class-debug-always
3894 Instead of emitting debugging information for a C++ class in only one
3895 object file, emit it in all object files using the class. This option
3896 should be used only with debuggers that are unable to handle the way GCC
3897 normally emits debugging information for classes because using this
3898 option will increase the size of debugging information by as much as a
3899 factor of two.
3900
3901 @item -gstabs+
3902 @opindex gstabs+
3903 Produce debugging information in stabs format (if that is supported),
3904 using GNU extensions understood only by the GNU debugger (GDB)@. The
3905 use of these extensions is likely to make other debuggers crash or
3906 refuse to read the program.
3907
3908 @item -gcoff
3909 @opindex gcoff
3910 Produce debugging information in COFF format (if that is supported).
3911 This is the format used by SDB on most System V systems prior to
3912 System V Release 4.
3913
3914 @item -gxcoff
3915 @opindex gxcoff
3916 Produce debugging information in XCOFF format (if that is supported).
3917 This is the format used by the DBX debugger on IBM RS/6000 systems.
3918
3919 @item -gxcoff+
3920 @opindex gxcoff+
3921 Produce debugging information in XCOFF format (if that is supported),
3922 using GNU extensions understood only by the GNU debugger (GDB)@. The
3923 use of these extensions is likely to make other debuggers crash or
3924 refuse to read the program, and may cause assemblers other than the GNU
3925 assembler (GAS) to fail with an error.
3926
3927 @item -gdwarf-2
3928 @opindex gdwarf-2
3929 Produce debugging information in DWARF version 2 format (if that is
3930 supported). This is the format used by DBX on IRIX 6. With this
3931 option, GCC uses features of DWARF version 3 when they are useful;
3932 version 3 is upward compatible with version 2, but may still cause
3933 problems for older debuggers.
3934
3935 @item -gvms
3936 @opindex gvms
3937 Produce debugging information in VMS debug format (if that is
3938 supported). This is the format used by DEBUG on VMS systems.
3939
3940 @item -g@var{level}
3941 @itemx -ggdb@var{level}
3942 @itemx -gstabs@var{level}
3943 @itemx -gcoff@var{level}
3944 @itemx -gxcoff@var{level}
3945 @itemx -gvms@var{level}
3946 Request debugging information and also use @var{level} to specify how
3947 much information. The default level is 2.
3948
3949 Level 0 produces no debug information at all. Thus, @option{-g0} negates
3950 @option{-g}.
3951
3952 Level 1 produces minimal information, enough for making backtraces in
3953 parts of the program that you don't plan to debug. This includes
3954 descriptions of functions and external variables, but no information
3955 about local variables and no line numbers.
3956
3957 Level 3 includes extra information, such as all the macro definitions
3958 present in the program. Some debuggers support macro expansion when
3959 you use @option{-g3}.
3960
3961 @option{-gdwarf-2} does not accept a concatenated debug level, because
3962 GCC used to support an option @option{-gdwarf} that meant to generate
3963 debug information in version 1 of the DWARF format (which is very
3964 different from version 2), and it would have been too confusing. That
3965 debug format is long obsolete, but the option cannot be changed now.
3966 Instead use an additional @option{-g@var{level}} option to change the
3967 debug level for DWARF2.
3968
3969 @item -feliminate-dwarf2-dups
3970 @opindex feliminate-dwarf2-dups
3971 Compress DWARF2 debugging information by eliminating duplicated
3972 information about each symbol. This option only makes sense when
3973 generating DWARF2 debugging information with @option{-gdwarf-2}.
3974
3975 @item -femit-struct-debug-baseonly
3976 Emit debug information for struct-like types
3977 only when the base name of the compilation source file
3978 matches the base name of file in which the struct was defined.
3979
3980 This option substantially reduces the size of debugging information,
3981 but at significant potential loss in type information to the debugger.
3982 See @option{-femit-struct-debug-reduced} for a less aggressive option.
3983 See @option{-femit-struct-debug-detailed} for more detailed control.
3984
3985 This option works only with DWARF 2.
3986
3987 @item -femit-struct-debug-reduced
3988 Emit debug information for struct-like types
3989 only when the base name of the compilation source file
3990 matches the base name of file in which the type was defined,
3991 unless the struct is a template or defined in a system header.
3992
3993 This option significantly reduces the size of debugging information,
3994 with some potential loss in type information to the debugger.
3995 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
3996 See @option{-femit-struct-debug-detailed} for more detailed control.
3997
3998 This option works only with DWARF 2.
3999
4000 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
4001 Specify the struct-like types
4002 for which the compiler will generate debug information.
4003 The intent is to reduce duplicate struct debug information
4004 between different object files within the same program.
4005
4006 This option is a detailed version of
4007 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
4008 which will serve for most needs.
4009
4010 A specification has the syntax
4011 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
4012
4013 The optional first word limits the specification to
4014 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
4015 A struct type is used directly when it is the type of a variable, member.
4016 Indirect uses arise through pointers to structs.
4017 That is, when use of an incomplete struct would be legal, the use is indirect.
4018 An example is
4019 @samp{struct one direct; struct two * indirect;}.
4020
4021 The optional second word limits the specification to
4022 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
4023 Generic structs are a bit complicated to explain.
4024 For C++, these are non-explicit specializations of template classes,
4025 or non-template classes within the above.
4026 Other programming languages have generics,
4027 but @samp{-femit-struct-debug-detailed} does not yet implement them.
4028
4029 The third word specifies the source files for those
4030 structs for which the compiler will emit debug information.
4031 The values @samp{none} and @samp{any} have the normal meaning.
4032 The value @samp{base} means that
4033 the base of name of the file in which the type declaration appears
4034 must match the base of the name of the main compilation file.
4035 In practice, this means that
4036 types declared in @file{foo.c} and @file{foo.h} will have debug information,
4037 but types declared in other header will not.
4038 The value @samp{sys} means those types satisfying @samp{base}
4039 or declared in system or compiler headers.
4040
4041 You may need to experiment to determine the best settings for your application.
4042
4043 The default is @samp{-femit-struct-debug-detailed=all}.
4044
4045 This option works only with DWARF 2.
4046
4047 @cindex @command{prof}
4048 @item -p
4049 @opindex p
4050 Generate extra code to write profile information suitable for the
4051 analysis program @command{prof}. You must use this option when compiling
4052 the source files you want data about, and you must also use it when
4053 linking.
4054
4055 @cindex @command{gprof}
4056 @item -pg
4057 @opindex pg
4058 Generate extra code to write profile information suitable for the
4059 analysis program @command{gprof}. You must use this option when compiling
4060 the source files you want data about, and you must also use it when
4061 linking.
4062
4063 @item -Q
4064 @opindex Q
4065 Makes the compiler print out each function name as it is compiled, and
4066 print some statistics about each pass when it finishes.
4067
4068 @item -ftime-report
4069 @opindex ftime-report
4070 Makes the compiler print some statistics about the time consumed by each
4071 pass when it finishes.
4072
4073 @item -fmem-report
4074 @opindex fmem-report
4075 Makes the compiler print some statistics about permanent memory
4076 allocation when it finishes.
4077
4078 @item -fpre-ipa-mem-report
4079 @opindex fpre-ipa-mem-report
4080 @item -fpost-ipa-mem-report
4081 @opindex fpost-ipa-mem-report
4082 Makes the compiler print some statistics about permanent memory
4083 allocation before or after interprocedural optimization.
4084
4085 @item -fprofile-arcs
4086 @opindex fprofile-arcs
4087 Add code so that program flow @dfn{arcs} are instrumented. During
4088 execution the program records how many times each branch and call is
4089 executed and how many times it is taken or returns. When the compiled
4090 program exits it saves this data to a file called
4091 @file{@var{auxname}.gcda} for each source file. The data may be used for
4092 profile-directed optimizations (@option{-fbranch-probabilities}), or for
4093 test coverage analysis (@option{-ftest-coverage}). Each object file's
4094 @var{auxname} is generated from the name of the output file, if
4095 explicitly specified and it is not the final executable, otherwise it is
4096 the basename of the source file. In both cases any suffix is removed
4097 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
4098 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
4099 @xref{Cross-profiling}.
4100
4101 @cindex @command{gcov}
4102 @item --coverage
4103 @opindex coverage
4104
4105 This option is used to compile and link code instrumented for coverage
4106 analysis. The option is a synonym for @option{-fprofile-arcs}
4107 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
4108 linking). See the documentation for those options for more details.
4109
4110 @itemize
4111
4112 @item
4113 Compile the source files with @option{-fprofile-arcs} plus optimization
4114 and code generation options. For test coverage analysis, use the
4115 additional @option{-ftest-coverage} option. You do not need to profile
4116 every source file in a program.
4117
4118 @item
4119 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
4120 (the latter implies the former).
4121
4122 @item
4123 Run the program on a representative workload to generate the arc profile
4124 information. This may be repeated any number of times. You can run
4125 concurrent instances of your program, and provided that the file system
4126 supports locking, the data files will be correctly updated. Also
4127 @code{fork} calls are detected and correctly handled (double counting
4128 will not happen).
4129
4130 @item
4131 For profile-directed optimizations, compile the source files again with
4132 the same optimization and code generation options plus
4133 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
4134 Control Optimization}).
4135
4136 @item
4137 For test coverage analysis, use @command{gcov} to produce human readable
4138 information from the @file{.gcno} and @file{.gcda} files. Refer to the
4139 @command{gcov} documentation for further information.
4140
4141 @end itemize
4142
4143 With @option{-fprofile-arcs}, for each function of your program GCC
4144 creates a program flow graph, then finds a spanning tree for the graph.
4145 Only arcs that are not on the spanning tree have to be instrumented: the
4146 compiler adds code to count the number of times that these arcs are
4147 executed. When an arc is the only exit or only entrance to a block, the
4148 instrumentation code can be added to the block; otherwise, a new basic
4149 block must be created to hold the instrumentation code.
4150
4151 @need 2000
4152 @item -ftest-coverage
4153 @opindex ftest-coverage
4154 Produce a notes file that the @command{gcov} code-coverage utility
4155 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
4156 show program coverage. Each source file's note file is called
4157 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
4158 above for a description of @var{auxname} and instructions on how to
4159 generate test coverage data. Coverage data will match the source files
4160 more closely, if you do not optimize.
4161
4162 @item -d@var{letters}
4163 @item -fdump-rtl-@var{pass}
4164 @opindex d
4165 Says to make debugging dumps during compilation at times specified by
4166 @var{letters}. This is used for debugging the RTL-based passes of the
4167 compiler. The file names for most of the dumps are made by appending a
4168 pass number and a word to the @var{dumpname}. @var{dumpname} is generated
4169 from the name of the output file, if explicitly specified and it is not
4170 an executable, otherwise it is the basename of the source file.
4171
4172 Most debug dumps can be enabled either passing a letter to the @option{-d}
4173 option, or with a long @option{-fdump-rtl} switch; here are the possible
4174 letters for use in @var{letters} and @var{pass}, and their meanings:
4175
4176 @table @gcctabopt
4177 @item -dA
4178 @opindex dA
4179 Annotate the assembler output with miscellaneous debugging information.
4180
4181 @item -dB
4182 @itemx -fdump-rtl-bbro
4183 @opindex dB
4184 @opindex fdump-rtl-bbro
4185 Dump after block reordering, to @file{@var{file}.148r.bbro}.
4186
4187 @item -dc
4188 @itemx -fdump-rtl-combine
4189 @opindex dc
4190 @opindex fdump-rtl-combine
4191 Dump after the RTL instruction combination pass, to the file
4192 @file{@var{file}.129r.combine}.
4193
4194 @item -dC
4195 @itemx -fdump-rtl-ce1
4196 @itemx -fdump-rtl-ce2
4197 @opindex dC
4198 @opindex fdump-rtl-ce1
4199 @opindex fdump-rtl-ce2
4200 @option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the
4201 first if conversion, to the file @file{@var{file}.117r.ce1}. @option{-dC}
4202 and @option{-fdump-rtl-ce2} enable dumping after the second if
4203 conversion, to the file @file{@var{file}.130r.ce2}.
4204
4205 @item -dd
4206 @itemx -fdump-rtl-btl
4207 @itemx -fdump-rtl-dbr
4208 @opindex dd
4209 @opindex fdump-rtl-btl
4210 @opindex fdump-rtl-dbr
4211 @option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch
4212 target load optimization, to @file{@var{file}.31.btl}. @option{-dd}
4213 and @option{-fdump-rtl-dbr} enable dumping after delayed branch
4214 scheduling, to @file{@var{file}.36.dbr}.
4215
4216 @item -dD
4217 @opindex dD
4218 Dump all macro definitions, at the end of preprocessing, in addition to
4219 normal output.
4220
4221 @item -dE
4222 @itemx -fdump-rtl-ce3
4223 @opindex dE
4224 @opindex fdump-rtl-ce3
4225 Dump after the third if conversion, to @file{@var{file}.146r.ce3}.
4226
4227 @item -df
4228 @itemx -fdump-rtl-cfg
4229 @itemx -fdump-rtl-life
4230 @opindex df
4231 @opindex fdump-rtl-cfg
4232 @opindex fdump-rtl-life
4233 @option{-df} and @option{-fdump-rtl-cfg} enable dumping after control
4234 and data flow analysis, to @file{@var{file}.116r.cfg}. @option{-df}
4235 and @option{-fdump-rtl-cfg} enable dumping dump after life analysis,
4236 to @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}.
4237
4238 @item -dg
4239 @itemx -fdump-rtl-greg
4240 @opindex dg
4241 @opindex fdump-rtl-greg
4242 Dump after global register allocation, to @file{@var{file}.139r.greg}.
4243
4244 @item -dG
4245 @itemx -fdump-rtl-gcse
4246 @itemx -fdump-rtl-bypass
4247 @opindex dG
4248 @opindex fdump-rtl-gcse
4249 @opindex fdump-rtl-bypass
4250 @option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to
4251 @file{@var{file}.114r.gcse}. @option{-dG} and @option{-fdump-rtl-bypass}
4252 enable dumping after jump bypassing and control flow optimizations, to
4253 @file{@var{file}.115r.bypass}.
4254
4255 @item -dh
4256 @itemx -fdump-rtl-eh
4257 @opindex dh
4258 @opindex fdump-rtl-eh
4259 Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
4260
4261 @item -di
4262 @itemx -fdump-rtl-sibling
4263 @opindex di
4264 @opindex fdump-rtl-sibling
4265 Dump after sibling call optimizations, to @file{@var{file}.106r.sibling}.
4266
4267 @item -dj
4268 @itemx -fdump-rtl-jump
4269 @opindex dj
4270 @opindex fdump-rtl-jump
4271 Dump after the first jump optimization, to @file{@var{file}.112r.jump}.
4272
4273 @item -dk
4274 @itemx -fdump-rtl-stack
4275 @opindex dk
4276 @opindex fdump-rtl-stack
4277 Dump after conversion from GCC's "flat register file" registers to the
4278 x87's stack-like registers, to @file{@var{file}.152r.stack}.
4279
4280 @item -dl
4281 @itemx -fdump-rtl-lreg
4282 @opindex dl
4283 @opindex fdump-rtl-lreg
4284 Dump after local register allocation, to @file{@var{file}.138r.lreg}.
4285
4286 @item -dL
4287 @itemx -fdump-rtl-loop2
4288 @opindex dL
4289 @opindex fdump-rtl-loop2
4290 @option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the
4291 loop optimization pass, to @file{@var{file}.119r.loop2},
4292 @file{@var{file}.120r.loop2_init},
4293 @file{@var{file}.121r.loop2_invariant}, and
4294 @file{@var{file}.125r.loop2_done}.
4295
4296 @item -dm
4297 @itemx -fdump-rtl-sms
4298 @opindex dm
4299 @opindex fdump-rtl-sms
4300 Dump after modulo scheduling, to @file{@var{file}.136r.sms}.
4301
4302 @item -dM
4303 @itemx -fdump-rtl-mach
4304 @opindex dM
4305 @opindex fdump-rtl-mach
4306 Dump after performing the machine dependent reorganization pass, to
4307 @file{@var{file}.155r.mach}.
4308
4309 @item -dn
4310 @itemx -fdump-rtl-rnreg
4311 @opindex dn
4312 @opindex fdump-rtl-rnreg
4313 Dump after register renumbering, to @file{@var{file}.147r.rnreg}.
4314
4315 @item -dN
4316 @itemx -fdump-rtl-regmove
4317 @opindex dN
4318 @opindex fdump-rtl-regmove
4319 Dump after the register move pass, to @file{@var{file}.132r.regmove}.
4320
4321 @item -do
4322 @itemx -fdump-rtl-postreload
4323 @opindex do
4324 @opindex fdump-rtl-postreload
4325 Dump after post-reload optimizations, to @file{@var{file}.24.postreload}.
4326
4327 @item -dr
4328 @itemx -fdump-rtl-expand
4329 @opindex dr
4330 @opindex fdump-rtl-expand
4331 Dump after RTL generation, to @file{@var{file}.104r.expand}.
4332
4333 @item -dR
4334 @itemx -fdump-rtl-sched2
4335 @opindex dR
4336 @opindex fdump-rtl-sched2
4337 Dump after the second scheduling pass, to @file{@var{file}.149r.sched2}.
4338
4339 @item -ds
4340 @itemx -fdump-rtl-cse
4341 @opindex ds
4342 @opindex fdump-rtl-cse
4343 Dump after CSE (including the jump optimization that sometimes follows
4344 CSE), to @file{@var{file}.113r.cse}.
4345
4346 @item -dS
4347 @itemx -fdump-rtl-sched1
4348 @opindex dS
4349 @opindex fdump-rtl-sched1
4350 Dump after the first scheduling pass, to @file{@var{file}.136r.sched1}.
4351
4352 @item -dt
4353 @itemx -fdump-rtl-cse2
4354 @opindex dt
4355 @opindex fdump-rtl-cse2
4356 Dump after the second CSE pass (including the jump optimization that
4357 sometimes follows CSE), to @file{@var{file}.127r.cse2}.
4358
4359 @item -dT
4360 @itemx -fdump-rtl-tracer
4361 @opindex dT
4362 @opindex fdump-rtl-tracer
4363 Dump after running tracer, to @file{@var{file}.118r.tracer}.
4364
4365 @item -dV
4366 @itemx -fdump-rtl-vpt
4367 @itemx -fdump-rtl-vartrack
4368 @opindex dV
4369 @opindex fdump-rtl-vpt
4370 @opindex fdump-rtl-vartrack
4371 @option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value
4372 profile transformations, to @file{@var{file}.10.vpt}. @option{-dV}
4373 and @option{-fdump-rtl-vartrack} enable dumping after variable tracking,
4374 to @file{@var{file}.154r.vartrack}.
4375
4376 @item -dw
4377 @itemx -fdump-rtl-flow2
4378 @opindex dw
4379 @opindex fdump-rtl-flow2
4380 Dump after the second flow pass, to @file{@var{file}.142r.flow2}.
4381
4382 @item -dz
4383 @itemx -fdump-rtl-peephole2
4384 @opindex dz
4385 @opindex fdump-rtl-peephole2
4386 Dump after the peephole pass, to @file{@var{file}.145r.peephole2}.
4387
4388 @item -dZ
4389 @itemx -fdump-rtl-web
4390 @opindex dZ
4391 @opindex fdump-rtl-web
4392 Dump after live range splitting, to @file{@var{file}.126r.web}.
4393
4394 @item -da
4395 @itemx -fdump-rtl-all
4396 @opindex da
4397 @opindex fdump-rtl-all
4398 Produce all the dumps listed above.
4399
4400 @item -dH
4401 @opindex dH
4402 Produce a core dump whenever an error occurs.
4403
4404 @item -dm
4405 @opindex dm
4406 Print statistics on memory usage, at the end of the run, to
4407 standard error.
4408
4409 @item -dp
4410 @opindex dp
4411 Annotate the assembler output with a comment indicating which
4412 pattern and alternative was used. The length of each instruction is
4413 also printed.
4414
4415 @item -dP
4416 @opindex dP
4417 Dump the RTL in the assembler output as a comment before each instruction.
4418 Also turns on @option{-dp} annotation.
4419
4420 @item -dv
4421 @opindex dv
4422 For each of the other indicated dump files (either with @option{-d} or
4423 @option{-fdump-rtl-@var{pass}}), dump a representation of the control flow
4424 graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
4425
4426 @item -dx
4427 @opindex dx
4428 Just generate RTL for a function instead of compiling it. Usually used
4429 with @samp{r} (@option{-fdump-rtl-expand}).
4430
4431 @item -dy
4432 @opindex dy
4433 Dump debugging information during parsing, to standard error.
4434 @end table
4435
4436 @item -fdump-noaddr
4437 @opindex fdump-noaddr
4438 When doing debugging dumps (see @option{-d} option above), suppress
4439 address output. This makes it more feasible to use diff on debugging
4440 dumps for compiler invocations with different compiler binaries and/or
4441 different text / bss / data / heap / stack / dso start locations.
4442
4443 @item -fdump-unnumbered
4444 @opindex fdump-unnumbered
4445 When doing debugging dumps (see @option{-d} option above), suppress instruction
4446 numbers, line number note and address output. This makes it more feasible to
4447 use diff on debugging dumps for compiler invocations with different
4448 options, in particular with and without @option{-g}.
4449
4450 @item -fdump-translation-unit @r{(C++ only)}
4451 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
4452 @opindex fdump-translation-unit
4453 Dump a representation of the tree structure for the entire translation
4454 unit to a file. The file name is made by appending @file{.tu} to the
4455 source file name. If the @samp{-@var{options}} form is used, @var{options}
4456 controls the details of the dump as described for the
4457 @option{-fdump-tree} options.
4458
4459 @item -fdump-class-hierarchy @r{(C++ only)}
4460 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
4461 @opindex fdump-class-hierarchy
4462 Dump a representation of each class's hierarchy and virtual function
4463 table layout to a file. The file name is made by appending @file{.class}
4464 to the source file name. If the @samp{-@var{options}} form is used,
4465 @var{options} controls the details of the dump as described for the
4466 @option{-fdump-tree} options.
4467
4468 @item -fdump-ipa-@var{switch}
4469 @opindex fdump-ipa
4470 Control the dumping at various stages of inter-procedural analysis
4471 language tree to a file. The file name is generated by appending a switch
4472 specific suffix to the source file name. The following dumps are possible:
4473
4474 @table @samp
4475 @item all
4476 Enables all inter-procedural analysis dumps; currently the only produced
4477 dump is the @samp{cgraph} dump.
4478
4479 @item cgraph
4480 Dumps information about call-graph optimization, unused function removal,
4481 and inlining decisions.
4482 @end table
4483
4484 @item -fdump-tree-@var{switch}
4485 @itemx -fdump-tree-@var{switch}-@var{options}
4486 @opindex fdump-tree
4487 Control the dumping at various stages of processing the intermediate
4488 language tree to a file. The file name is generated by appending a switch
4489 specific suffix to the source file name. If the @samp{-@var{options}}
4490 form is used, @var{options} is a list of @samp{-} separated options that
4491 control the details of the dump. Not all options are applicable to all
4492 dumps, those which are not meaningful will be ignored. The following
4493 options are available
4494
4495 @table @samp
4496 @item address
4497 Print the address of each node. Usually this is not meaningful as it
4498 changes according to the environment and source file. Its primary use
4499 is for tying up a dump file with a debug environment.
4500 @item slim
4501 Inhibit dumping of members of a scope or body of a function merely
4502 because that scope has been reached. Only dump such items when they
4503 are directly reachable by some other path. When dumping pretty-printed
4504 trees, this option inhibits dumping the bodies of control structures.
4505 @item raw
4506 Print a raw representation of the tree. By default, trees are
4507 pretty-printed into a C-like representation.
4508 @item details
4509 Enable more detailed dumps (not honored by every dump option).
4510 @item stats
4511 Enable dumping various statistics about the pass (not honored by every dump
4512 option).
4513 @item blocks
4514 Enable showing basic block boundaries (disabled in raw dumps).
4515 @item vops
4516 Enable showing virtual operands for every statement.
4517 @item lineno
4518 Enable showing line numbers for statements.
4519 @item uid
4520 Enable showing the unique ID (@code{DECL_UID}) for each variable.
4521 @item all
4522 Turn on all options, except @option{raw}, @option{slim} and @option{lineno}.
4523 @end table
4524
4525 The following tree dumps are possible:
4526 @table @samp
4527
4528 @item original
4529 Dump before any tree based optimization, to @file{@var{file}.original}.
4530
4531 @item optimized
4532 Dump after all tree based optimization, to @file{@var{file}.optimized}.
4533
4534 @item inlined
4535 Dump after function inlining, to @file{@var{file}.inlined}.
4536
4537 @item gimple
4538 @opindex fdump-tree-gimple
4539 Dump each function before and after the gimplification pass to a file. The
4540 file name is made by appending @file{.gimple} to the source file name.
4541
4542 @item cfg
4543 @opindex fdump-tree-cfg
4544 Dump the control flow graph of each function to a file. The file name is
4545 made by appending @file{.cfg} to the source file name.
4546
4547 @item vcg
4548 @opindex fdump-tree-vcg
4549 Dump the control flow graph of each function to a file in VCG format. The
4550 file name is made by appending @file{.vcg} to the source file name. Note
4551 that if the file contains more than one function, the generated file cannot
4552 be used directly by VCG@. You will need to cut and paste each function's
4553 graph into its own separate file first.
4554
4555 @item ch
4556 @opindex fdump-tree-ch
4557 Dump each function after copying loop headers. The file name is made by
4558 appending @file{.ch} to the source file name.
4559
4560 @item ssa
4561 @opindex fdump-tree-ssa
4562 Dump SSA related information to a file. The file name is made by appending
4563 @file{.ssa} to the source file name.
4564
4565 @item salias
4566 @opindex fdump-tree-salias
4567 Dump structure aliasing variable information to a file. This file name
4568 is made by appending @file{.salias} to the source file name.
4569
4570 @item alias
4571 @opindex fdump-tree-alias
4572 Dump aliasing information for each function. The file name is made by
4573 appending @file{.alias} to the source file name.
4574
4575 @item ccp
4576 @opindex fdump-tree-ccp
4577 Dump each function after CCP@. The file name is made by appending
4578 @file{.ccp} to the source file name.
4579
4580 @item storeccp
4581 @opindex fdump-tree-storeccp
4582 Dump each function after STORE-CCP. The file name is made by appending
4583 @file{.storeccp} to the source file name.
4584
4585 @item pre
4586 @opindex fdump-tree-pre
4587 Dump trees after partial redundancy elimination. The file name is made
4588 by appending @file{.pre} to the source file name.
4589
4590 @item fre
4591 @opindex fdump-tree-fre
4592 Dump trees after full redundancy elimination. The file name is made
4593 by appending @file{.fre} to the source file name.
4594
4595 @item copyprop
4596 @opindex fdump-tree-copyprop
4597 Dump trees after copy propagation. The file name is made
4598 by appending @file{.copyprop} to the source file name.
4599
4600 @item store_copyprop
4601 @opindex fdump-tree-store_copyprop
4602 Dump trees after store copy-propagation. The file name is made
4603 by appending @file{.store_copyprop} to the source file name.
4604
4605 @item dce
4606 @opindex fdump-tree-dce
4607 Dump each function after dead code elimination. The file name is made by
4608 appending @file{.dce} to the source file name.
4609
4610 @item mudflap
4611 @opindex fdump-tree-mudflap
4612 Dump each function after adding mudflap instrumentation. The file name is
4613 made by appending @file{.mudflap} to the source file name.
4614
4615 @item sra
4616 @opindex fdump-tree-sra
4617 Dump each function after performing scalar replacement of aggregates. The
4618 file name is made by appending @file{.sra} to the source file name.
4619
4620 @item sink
4621 @opindex fdump-tree-sink
4622 Dump each function after performing code sinking. The file name is made
4623 by appending @file{.sink} to the source file name.
4624
4625 @item dom
4626 @opindex fdump-tree-dom
4627 Dump each function after applying dominator tree optimizations. The file
4628 name is made by appending @file{.dom} to the source file name.
4629
4630 @item dse
4631 @opindex fdump-tree-dse
4632 Dump each function after applying dead store elimination. The file
4633 name is made by appending @file{.dse} to the source file name.
4634
4635 @item phiopt
4636 @opindex fdump-tree-phiopt
4637 Dump each function after optimizing PHI nodes into straightline code. The file
4638 name is made by appending @file{.phiopt} to the source file name.
4639
4640 @item forwprop
4641 @opindex fdump-tree-forwprop
4642 Dump each function after forward propagating single use variables. The file
4643 name is made by appending @file{.forwprop} to the source file name.
4644
4645 @item copyrename
4646 @opindex fdump-tree-copyrename
4647 Dump each function after applying the copy rename optimization. The file
4648 name is made by appending @file{.copyrename} to the source file name.
4649
4650 @item nrv
4651 @opindex fdump-tree-nrv
4652 Dump each function after applying the named return value optimization on
4653 generic trees. The file name is made by appending @file{.nrv} to the source
4654 file name.
4655
4656 @item vect
4657 @opindex fdump-tree-vect
4658 Dump each function after applying vectorization of loops. The file name is
4659 made by appending @file{.vect} to the source file name.
4660
4661 @item vrp
4662 @opindex fdump-tree-vrp
4663 Dump each function after Value Range Propagation (VRP). The file name
4664 is made by appending @file{.vrp} to the source file name.
4665
4666 @item all
4667 @opindex fdump-tree-all
4668 Enable all the available tree dumps with the flags provided in this option.
4669 @end table
4670
4671 @item -ftree-vectorizer-verbose=@var{n}
4672 @opindex ftree-vectorizer-verbose
4673 This option controls the amount of debugging output the vectorizer prints.
4674 This information is written to standard error, unless
4675 @option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified,
4676 in which case it is output to the usual dump listing file, @file{.vect}.
4677 For @var{n}=0 no diagnostic information is reported.
4678 If @var{n}=1 the vectorizer reports each loop that got vectorized,
4679 and the total number of loops that got vectorized.
4680 If @var{n}=2 the vectorizer also reports non-vectorized loops that passed
4681 the first analysis phase (vect_analyze_loop_form) - i.e. countable,
4682 inner-most, single-bb, single-entry/exit loops. This is the same verbosity
4683 level that @option{-fdump-tree-vect-stats} uses.
4684 Higher verbosity levels mean either more information dumped for each
4685 reported loop, or same amount of information reported for more loops:
4686 If @var{n}=3, alignment related information is added to the reports.
4687 If @var{n}=4, data-references related information (e.g. memory dependences,
4688 memory access-patterns) is added to the reports.
4689 If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops
4690 that did not pass the first analysis phase (i.e. may not be countable, or
4691 may have complicated control-flow).
4692 If @var{n}=6, the vectorizer reports also non-vectorized nested loops.
4693 For @var{n}=7, all the information the vectorizer generates during its
4694 analysis and transformation is reported. This is the same verbosity level
4695 that @option{-fdump-tree-vect-details} uses.
4696
4697 @item -frandom-seed=@var{string}
4698 @opindex frandom-string
4699 This option provides a seed that GCC uses when it would otherwise use
4700 random numbers. It is used to generate certain symbol names
4701 that have to be different in every compiled file. It is also used to
4702 place unique stamps in coverage data files and the object files that
4703 produce them. You can use the @option{-frandom-seed} option to produce
4704 reproducibly identical object files.
4705
4706 The @var{string} should be different for every file you compile.
4707
4708 @item -fsched-verbose=@var{n}
4709 @opindex fsched-verbose
4710 On targets that use instruction scheduling, this option controls the
4711 amount of debugging output the scheduler prints. This information is
4712 written to standard error, unless @option{-dS} or @option{-dR} is
4713 specified, in which case it is output to the usual dump
4714 listing file, @file{.sched} or @file{.sched2} respectively. However
4715 for @var{n} greater than nine, the output is always printed to standard
4716 error.
4717
4718 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
4719 same information as @option{-dRS}. For @var{n} greater than one, it
4720 also output basic block probabilities, detailed ready list information
4721 and unit/insn info. For @var{n} greater than two, it includes RTL
4722 at abort point, control-flow and regions info. And for @var{n} over
4723 four, @option{-fsched-verbose} also includes dependence info.
4724
4725 @item -save-temps
4726 @opindex save-temps
4727 Store the usual ``temporary'' intermediate files permanently; place them
4728 in the current directory and name them based on the source file. Thus,
4729 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
4730 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
4731 preprocessed @file{foo.i} output file even though the compiler now
4732 normally uses an integrated preprocessor.
4733
4734 When used in combination with the @option{-x} command line option,
4735 @option{-save-temps} is sensible enough to avoid over writing an
4736 input source file with the same extension as an intermediate file.
4737 The corresponding intermediate file may be obtained by renaming the
4738 source file before using @option{-save-temps}.
4739
4740 @item -time
4741 @opindex time
4742 Report the CPU time taken by each subprocess in the compilation
4743 sequence. For C source files, this is the compiler proper and assembler
4744 (plus the linker if linking is done). The output looks like this:
4745
4746 @smallexample
4747 # cc1 0.12 0.01
4748 # as 0.00 0.01
4749 @end smallexample
4750
4751 The first number on each line is the ``user time'', that is time spent
4752 executing the program itself. The second number is ``system time'',
4753 time spent executing operating system routines on behalf of the program.
4754 Both numbers are in seconds.
4755
4756 @item -fvar-tracking
4757 @opindex fvar-tracking
4758 Run variable tracking pass. It computes where variables are stored at each
4759 position in code. Better debugging information is then generated
4760 (if the debugging information format supports this information).
4761
4762 It is enabled by default when compiling with optimization (@option{-Os},
4763 @option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
4764 the debug info format supports it.
4765
4766 @item -print-file-name=@var{library}
4767 @opindex print-file-name
4768 Print the full absolute name of the library file @var{library} that
4769 would be used when linking---and don't do anything else. With this
4770 option, GCC does not compile or link anything; it just prints the
4771 file name.
4772
4773 @item -print-multi-directory
4774 @opindex print-multi-directory
4775 Print the directory name corresponding to the multilib selected by any
4776 other switches present in the command line. This directory is supposed
4777 to exist in @env{GCC_EXEC_PREFIX}.
4778
4779 @item -print-multi-lib
4780 @opindex print-multi-lib
4781 Print the mapping from multilib directory names to compiler switches
4782 that enable them. The directory name is separated from the switches by
4783 @samp{;}, and each switch starts with an @samp{@@} instead of the
4784 @samp{-}, without spaces between multiple switches. This is supposed to
4785 ease shell-processing.
4786
4787 @item -print-prog-name=@var{program}
4788 @opindex print-prog-name
4789 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
4790
4791 @item -print-libgcc-file-name
4792 @opindex print-libgcc-file-name
4793 Same as @option{-print-file-name=libgcc.a}.
4794
4795 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
4796 but you do want to link with @file{libgcc.a}. You can do
4797
4798 @smallexample
4799 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
4800 @end smallexample
4801
4802 @item -print-search-dirs
4803 @opindex print-search-dirs
4804 Print the name of the configured installation directory and a list of
4805 program and library directories @command{gcc} will search---and don't do anything else.
4806
4807 This is useful when @command{gcc} prints the error message
4808 @samp{installation problem, cannot exec cpp0: No such file or directory}.
4809 To resolve this you either need to put @file{cpp0} and the other compiler
4810 components where @command{gcc} expects to find them, or you can set the environment
4811 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
4812 Don't forget the trailing @samp{/}.
4813 @xref{Environment Variables}.
4814
4815 @item -print-sysroot-headers-suffix
4816 @opindex print-sysroot-headers-suffix
4817 Print the suffix added to the target sysroot when searching for
4818 headers, or give an error if the compiler is not configured with such
4819 a suffix---and don't do anything else.
4820
4821 @item -dumpmachine
4822 @opindex dumpmachine
4823 Print the compiler's target machine (for example,
4824 @samp{i686-pc-linux-gnu})---and don't do anything else.
4825
4826 @item -dumpversion
4827 @opindex dumpversion
4828 Print the compiler version (for example, @samp{3.0})---and don't do
4829 anything else.
4830
4831 @item -dumpspecs
4832 @opindex dumpspecs
4833 Print the compiler's built-in specs---and don't do anything else. (This
4834 is used when GCC itself is being built.) @xref{Spec Files}.
4835
4836 @item -feliminate-unused-debug-types
4837 @opindex feliminate-unused-debug-types
4838 Normally, when producing DWARF2 output, GCC will emit debugging
4839 information for all types declared in a compilation
4840 unit, regardless of whether or not they are actually used
4841 in that compilation unit. Sometimes this is useful, such as
4842 if, in the debugger, you want to cast a value to a type that is
4843 not actually used in your program (but is declared). More often,
4844 however, this results in a significant amount of wasted space.
4845 With this option, GCC will avoid producing debug symbol output
4846 for types that are nowhere used in the source file being compiled.
4847 @end table
4848
4849 @node Optimize Options
4850 @section Options That Control Optimization
4851 @cindex optimize options
4852 @cindex options, optimization
4853
4854 These options control various sorts of optimizations.
4855
4856 Without any optimization option, the compiler's goal is to reduce the
4857 cost of compilation and to make debugging produce the expected
4858 results. Statements are independent: if you stop the program with a
4859 breakpoint between statements, you can then assign a new value to any
4860 variable or change the program counter to any other statement in the
4861 function and get exactly the results you would expect from the source
4862 code.
4863
4864 Turning on optimization flags makes the compiler attempt to improve
4865 the performance and/or code size at the expense of compilation time
4866 and possibly the ability to debug the program.
4867
4868 The compiler performs optimization based on the knowledge it has of
4869 the program. Optimization levels @option{-O} and above, in
4870 particular, enable @emph{unit-at-a-time} mode, which allows the
4871 compiler to consider information gained from later functions in
4872 the file when compiling a function. Compiling multiple files at
4873 once to a single output file in @emph{unit-at-a-time} mode allows
4874 the compiler to use information gained from all of the files when
4875 compiling each of them.
4876
4877 Not all optimizations are controlled directly by a flag. Only
4878 optimizations that have a flag are listed.
4879
4880 @table @gcctabopt
4881 @item -O
4882 @itemx -O1
4883 @opindex O
4884 @opindex O1
4885 Optimize. Optimizing compilation takes somewhat more time, and a lot
4886 more memory for a large function.
4887
4888 With @option{-O}, the compiler tries to reduce code size and execution
4889 time, without performing any optimizations that take a great deal of
4890 compilation time.
4891
4892 @option{-O} turns on the following optimization flags:
4893 @gccoptlist{-fdefer-pop @gol
4894 -fdelayed-branch @gol
4895 -fguess-branch-probability @gol
4896 -fcprop-registers @gol
4897 -fif-conversion @gol
4898 -fif-conversion2 @gol
4899 -fsplit-wide-types @gol
4900 -ftree-ccp @gol
4901 -ftree-dce @gol
4902 -ftree-dominator-opts @gol
4903 -ftree-dse @gol
4904 -ftree-ter @gol
4905 -ftree-sra @gol
4906 -ftree-copyrename @gol
4907 -ftree-fre @gol
4908 -ftree-ch @gol
4909 -funit-at-a-time @gol
4910 -fmerge-constants}
4911
4912 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
4913 where doing so does not interfere with debugging.
4914
4915 @item -O2
4916 @opindex O2
4917 Optimize even more. GCC performs nearly all supported optimizations
4918 that do not involve a space-speed tradeoff. The compiler does not
4919 perform loop unrolling or function inlining when you specify @option{-O2}.
4920 As compared to @option{-O}, this option increases both compilation time
4921 and the performance of the generated code.
4922
4923 @option{-O2} turns on all optimization flags specified by @option{-O}. It
4924 also turns on the following optimization flags:
4925 @gccoptlist{-fthread-jumps @gol
4926 -fcrossjumping @gol
4927 -foptimize-sibling-calls @gol
4928 -fcse-follow-jumps -fcse-skip-blocks @gol
4929 -fgcse -fgcse-lm @gol
4930 -fexpensive-optimizations @gol
4931 -frerun-cse-after-loop @gol
4932 -fcaller-saves @gol
4933 -fpeephole2 @gol
4934 -fschedule-insns -fschedule-insns2 @gol
4935 -fsched-interblock -fsched-spec @gol
4936 -fregmove @gol
4937 -fstrict-aliasing -fstrict-overflow @gol
4938 -fdelete-null-pointer-checks @gol
4939 -freorder-blocks -freorder-functions @gol
4940 -falign-functions -falign-jumps @gol
4941 -falign-loops -falign-labels @gol
4942 -ftree-vrp @gol
4943 -ftree-pre}
4944
4945 Please note the warning under @option{-fgcse} about
4946 invoking @option{-O2} on programs that use computed gotos.
4947
4948 @item -O3
4949 @opindex O3
4950 Optimize yet more. @option{-O3} turns on all optimizations specified by
4951 @option{-O2} and also turns on the @option{-finline-functions},
4952 @option{-funswitch-loops} and @option{-fgcse-after-reload} options.
4953
4954 @item -O0
4955 @opindex O0
4956 Reduce compilation time and make debugging produce the expected
4957 results. This is the default.
4958
4959 @item -Os
4960 @opindex Os
4961 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
4962 do not typically increase code size. It also performs further
4963 optimizations designed to reduce code size.
4964
4965 @option{-Os} disables the following optimization flags:
4966 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
4967 -falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
4968 -fprefetch-loop-arrays -ftree-vect-loop-version}
4969
4970 If you use multiple @option{-O} options, with or without level numbers,
4971 the last such option is the one that is effective.
4972 @end table
4973
4974 Options of the form @option{-f@var{flag}} specify machine-independent
4975 flags. Most flags have both positive and negative forms; the negative
4976 form of @option{-ffoo} would be @option{-fno-foo}. In the table
4977 below, only one of the forms is listed---the one you typically will
4978 use. You can figure out the other form by either removing @samp{no-}
4979 or adding it.
4980
4981 The following options control specific optimizations. They are either
4982 activated by @option{-O} options or are related to ones that are. You
4983 can use the following flags in the rare cases when ``fine-tuning'' of
4984 optimizations to be performed is desired.
4985
4986 @table @gcctabopt
4987 @item -fno-default-inline
4988 @opindex fno-default-inline
4989 Do not make member functions inline by default merely because they are
4990 defined inside the class scope (C++ only). Otherwise, when you specify
4991 @w{@option{-O}}, member functions defined inside class scope are compiled
4992 inline by default; i.e., you don't need to add @samp{inline} in front of
4993 the member function name.
4994
4995 @item -fno-defer-pop
4996 @opindex fno-defer-pop
4997 Always pop the arguments to each function call as soon as that function
4998 returns. For machines which must pop arguments after a function call,
4999 the compiler normally lets arguments accumulate on the stack for several
5000 function calls and pops them all at once.
5001
5002 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5003
5004 @item -fforce-addr
5005 @opindex fforce-addr
5006 Force memory address constants to be copied into registers before
5007 doing arithmetic on them.
5008
5009 @item -fforward-propagate
5010 @opindex fforward-propagate
5011 Perform a forward propagation pass on RTL. The pass tries to combine two
5012 instructions and checks if the result can be simplified. If loop unrolling
5013 is active, two passes are performed and the second is scheduled after
5014 loop unrolling.
5015
5016 This option is enabled by default at optimization levels @option{-O2},
5017 @option{-O3}, @option{-Os}.
5018
5019 @item -fomit-frame-pointer
5020 @opindex fomit-frame-pointer
5021 Don't keep the frame pointer in a register for functions that
5022 don't need one. This avoids the instructions to save, set up and
5023 restore frame pointers; it also makes an extra register available
5024 in many functions. @strong{It also makes debugging impossible on
5025 some machines.}
5026
5027 On some machines, such as the VAX, this flag has no effect, because
5028 the standard calling sequence automatically handles the frame pointer
5029 and nothing is saved by pretending it doesn't exist. The
5030 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
5031 whether a target machine supports this flag. @xref{Registers,,Register
5032 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
5033
5034 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5035
5036 @item -foptimize-sibling-calls
5037 @opindex foptimize-sibling-calls
5038 Optimize sibling and tail recursive calls.
5039
5040 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5041
5042 @item -fno-inline
5043 @opindex fno-inline
5044 Don't pay attention to the @code{inline} keyword. Normally this option
5045 is used to keep the compiler from expanding any functions inline.
5046 Note that if you are not optimizing, no functions can be expanded inline.
5047
5048 @item -finline-functions
5049 @opindex finline-functions
5050 Integrate all simple functions into their callers. The compiler
5051 heuristically decides which functions are simple enough to be worth
5052 integrating in this way.
5053
5054 If all calls to a given function are integrated, and the function is
5055 declared @code{static}, then the function is normally not output as
5056 assembler code in its own right.
5057
5058 Enabled at level @option{-O3}.
5059
5060 @item -finline-functions-called-once
5061 @opindex finline-functions-called-once
5062 Consider all @code{static} functions called once for inlining into their
5063 caller even if they are not marked @code{inline}. If a call to a given
5064 function is integrated, then the function is not output as assembler code
5065 in its own right.
5066
5067 Enabled if @option{-funit-at-a-time} is enabled.
5068
5069 @item -fearly-inlining
5070 @opindex fearly-inlining
5071 Inline functions marked by @code{always_inline} and functions whose body seems
5072 smaller than the function call overhead early before doing
5073 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
5074 makes profiling significantly cheaper and usually inlining faster on programs
5075 having large chains of nested wrapper functions.
5076
5077 Enabled by default.
5078
5079 @item -finline-limit=@var{n}
5080 @opindex finline-limit
5081 By default, GCC limits the size of functions that can be inlined. This flag
5082 allows the control of this limit for functions that are explicitly marked as
5083 inline (i.e., marked with the inline keyword or defined within the class
5084 definition in c++). @var{n} is the size of functions that can be inlined in
5085 number of pseudo instructions (not counting parameter handling). The default
5086 value of @var{n} is 600.
5087 Increasing this value can result in more inlined code at
5088 the cost of compilation time and memory consumption. Decreasing usually makes
5089 the compilation faster and less code will be inlined (which presumably
5090 means slower programs). This option is particularly useful for programs that
5091 use inlining heavily such as those based on recursive templates with C++.
5092
5093 Inlining is actually controlled by a number of parameters, which may be
5094 specified individually by using @option{--param @var{name}=@var{value}}.
5095 The @option{-finline-limit=@var{n}} option sets some of these parameters
5096 as follows:
5097
5098 @table @gcctabopt
5099 @item max-inline-insns-single
5100 is set to @var{n}/2.
5101 @item max-inline-insns-auto
5102 is set to @var{n}/2.
5103 @item min-inline-insns
5104 is set to 130 or @var{n}/4, whichever is smaller.
5105 @item max-inline-insns-rtl
5106 is set to @var{n}.
5107 @end table
5108
5109 See below for a documentation of the individual
5110 parameters controlling inlining.
5111
5112 @emph{Note:} pseudo instruction represents, in this particular context, an
5113 abstract measurement of function's size. In no way does it represent a count
5114 of assembly instructions and as such its exact meaning might change from one
5115 release to an another.
5116
5117 @item -fkeep-inline-functions
5118 @opindex fkeep-inline-functions
5119 In C, emit @code{static} functions that are declared @code{inline}
5120 into the object file, even if the function has been inlined into all
5121 of its callers. This switch does not affect functions using the
5122 @code{extern inline} extension in GNU C89@. In C++, emit any and all
5123 inline functions into the object file.
5124
5125 @item -fkeep-static-consts
5126 @opindex fkeep-static-consts
5127 Emit variables declared @code{static const} when optimization isn't turned
5128 on, even if the variables aren't referenced.
5129
5130 GCC enables this option by default. If you want to force the compiler to
5131 check if the variable was referenced, regardless of whether or not
5132 optimization is turned on, use the @option{-fno-keep-static-consts} option.
5133
5134 @item -fmerge-constants
5135 Attempt to merge identical constants (string constants and floating point
5136 constants) across compilation units.
5137
5138 This option is the default for optimized compilation if the assembler and
5139 linker support it. Use @option{-fno-merge-constants} to inhibit this
5140 behavior.
5141
5142 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5143
5144 @item -fmerge-all-constants
5145 Attempt to merge identical constants and identical variables.
5146
5147 This option implies @option{-fmerge-constants}. In addition to
5148 @option{-fmerge-constants} this considers e.g.@: even constant initialized
5149 arrays or initialized constant variables with integral or floating point
5150 types. Languages like C or C++ require each non-automatic variable to
5151 have distinct location, so using this option will result in non-conforming
5152 behavior.
5153
5154 @item -fmodulo-sched
5155 @opindex fmodulo-sched
5156 Perform swing modulo scheduling immediately before the first scheduling
5157 pass. This pass looks at innermost loops and reorders their
5158 instructions by overlapping different iterations.
5159
5160 @item -fno-branch-count-reg
5161 @opindex fno-branch-count-reg
5162 Do not use ``decrement and branch'' instructions on a count register,
5163 but instead generate a sequence of instructions that decrement a
5164 register, compare it against zero, then branch based upon the result.
5165 This option is only meaningful on architectures that support such
5166 instructions, which include x86, PowerPC, IA-64 and S/390.
5167
5168 The default is @option{-fbranch-count-reg}.
5169
5170 @item -fno-function-cse
5171 @opindex fno-function-cse
5172 Do not put function addresses in registers; make each instruction that
5173 calls a constant function contain the function's address explicitly.
5174
5175 This option results in less efficient code, but some strange hacks
5176 that alter the assembler output may be confused by the optimizations
5177 performed when this option is not used.
5178
5179 The default is @option{-ffunction-cse}
5180
5181 @item -fno-zero-initialized-in-bss
5182 @opindex fno-zero-initialized-in-bss
5183 If the target supports a BSS section, GCC by default puts variables that
5184 are initialized to zero into BSS@. This can save space in the resulting
5185 code.
5186
5187 This option turns off this behavior because some programs explicitly
5188 rely on variables going to the data section. E.g., so that the
5189 resulting executable can find the beginning of that section and/or make
5190 assumptions based on that.
5191
5192 The default is @option{-fzero-initialized-in-bss}.
5193
5194 @item -fbounds-check
5195 @opindex fbounds-check
5196 For front-ends that support it, generate additional code to check that
5197 indices used to access arrays are within the declared range. This is
5198 currently only supported by the Java and Fortran front-ends, where
5199 this option defaults to true and false respectively.
5200
5201 @item -fmudflap -fmudflapth -fmudflapir
5202 @opindex fmudflap
5203 @opindex fmudflapth
5204 @opindex fmudflapir
5205 @cindex bounds checking
5206 @cindex mudflap
5207 For front-ends that support it (C and C++), instrument all risky
5208 pointer/array dereferencing operations, some standard library
5209 string/heap functions, and some other associated constructs with
5210 range/validity tests. Modules so instrumented should be immune to
5211 buffer overflows, invalid heap use, and some other classes of C/C++
5212 programming errors. The instrumentation relies on a separate runtime
5213 library (@file{libmudflap}), which will be linked into a program if
5214 @option{-fmudflap} is given at link time. Run-time behavior of the
5215 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
5216 environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out}
5217 for its options.
5218
5219 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
5220 link if your program is multi-threaded. Use @option{-fmudflapir}, in
5221 addition to @option{-fmudflap} or @option{-fmudflapth}, if
5222 instrumentation should ignore pointer reads. This produces less
5223 instrumentation (and therefore faster execution) and still provides
5224 some protection against outright memory corrupting writes, but allows
5225 erroneously read data to propagate within a program.
5226
5227 @item -fthread-jumps
5228 @opindex fthread-jumps
5229 Perform optimizations where we check to see if a jump branches to a
5230 location where another comparison subsumed by the first is found. If
5231 so, the first branch is redirected to either the destination of the
5232 second branch or a point immediately following it, depending on whether
5233 the condition is known to be true or false.
5234
5235 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5236
5237 @item -fsplit-wide-types
5238 @opindex fsplit-wide-types
5239 When using a type that occupies multiple registers, such as @code{long
5240 long} on a 32-bit system, split the registers apart and allocate them
5241 independently. This normally generates better code for those types,
5242 but may make debugging more difficult.
5243
5244 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
5245 @option{-Os}.
5246
5247 @item -fcse-follow-jumps
5248 @opindex fcse-follow-jumps
5249 In common subexpression elimination, scan through jump instructions
5250 when the target of the jump is not reached by any other path. For
5251 example, when CSE encounters an @code{if} statement with an
5252 @code{else} clause, CSE will follow the jump when the condition
5253 tested is false.
5254
5255 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5256
5257 @item -fcse-skip-blocks
5258 @opindex fcse-skip-blocks
5259 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
5260 follow jumps which conditionally skip over blocks. When CSE
5261 encounters a simple @code{if} statement with no else clause,
5262 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
5263 body of the @code{if}.
5264
5265 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5266
5267 @item -frerun-cse-after-loop
5268 @opindex frerun-cse-after-loop
5269 Re-run common subexpression elimination after loop optimizations has been
5270 performed.
5271
5272 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5273
5274 @item -fgcse
5275 @opindex fgcse
5276 Perform a global common subexpression elimination pass.
5277 This pass also performs global constant and copy propagation.
5278
5279 @emph{Note:} When compiling a program using computed gotos, a GCC
5280 extension, you may get better runtime performance if you disable
5281 the global common subexpression elimination pass by adding
5282 @option{-fno-gcse} to the command line.
5283
5284 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5285
5286 @item -fgcse-lm
5287 @opindex fgcse-lm
5288 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
5289 attempt to move loads which are only killed by stores into themselves. This
5290 allows a loop containing a load/store sequence to be changed to a load outside
5291 the loop, and a copy/store within the loop.
5292
5293 Enabled by default when gcse is enabled.
5294
5295 @item -fgcse-sm
5296 @opindex fgcse-sm
5297 When @option{-fgcse-sm} is enabled, a store motion pass is run after
5298 global common subexpression elimination. This pass will attempt to move
5299 stores out of loops. When used in conjunction with @option{-fgcse-lm},
5300 loops containing a load/store sequence can be changed to a load before
5301 the loop and a store after the loop.
5302
5303 Not enabled at any optimization level.
5304
5305 @item -fgcse-las
5306 @opindex fgcse-las
5307 When @option{-fgcse-las} is enabled, the global common subexpression
5308 elimination pass eliminates redundant loads that come after stores to the
5309 same memory location (both partial and full redundancies).
5310
5311 Not enabled at any optimization level.
5312
5313 @item -fgcse-after-reload
5314 @opindex fgcse-after-reload
5315 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
5316 pass is performed after reload. The purpose of this pass is to cleanup
5317 redundant spilling.
5318
5319 @item -funsafe-loop-optimizations
5320 @opindex funsafe-loop-optimizations
5321 If given, the loop optimizer will assume that loop indices do not
5322 overflow, and that the loops with nontrivial exit condition are not
5323 infinite. This enables a wider range of loop optimizations even if
5324 the loop optimizer itself cannot prove that these assumptions are valid.
5325 Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
5326 if it finds this kind of loop.
5327
5328 @item -fcrossjumping
5329 @opindex crossjumping
5330 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
5331 resulting code may or may not perform better than without cross-jumping.
5332
5333 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5334
5335 @item -fif-conversion
5336 @opindex if-conversion
5337 Attempt to transform conditional jumps into branch-less equivalents. This
5338 include use of conditional moves, min, max, set flags and abs instructions, and
5339 some tricks doable by standard arithmetics. The use of conditional execution
5340 on chips where it is available is controlled by @code{if-conversion2}.
5341
5342 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5343
5344 @item -fif-conversion2
5345 @opindex if-conversion2
5346 Use conditional execution (where available) to transform conditional jumps into
5347 branch-less equivalents.
5348
5349 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5350
5351 @item -fdelete-null-pointer-checks
5352 @opindex fdelete-null-pointer-checks
5353 Use global dataflow analysis to identify and eliminate useless checks
5354 for null pointers. The compiler assumes that dereferencing a null
5355 pointer would have halted the program. If a pointer is checked after
5356 it has already been dereferenced, it cannot be null.
5357
5358 In some environments, this assumption is not true, and programs can
5359 safely dereference null pointers. Use
5360 @option{-fno-delete-null-pointer-checks} to disable this optimization
5361 for programs which depend on that behavior.
5362
5363 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5364
5365 @item -fexpensive-optimizations
5366 @opindex fexpensive-optimizations
5367 Perform a number of minor optimizations that are relatively expensive.
5368
5369 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5370
5371 @item -foptimize-register-move
5372 @itemx -fregmove
5373 @opindex foptimize-register-move
5374 @opindex fregmove
5375 Attempt to reassign register numbers in move instructions and as
5376 operands of other simple instructions in order to maximize the amount of
5377 register tying. This is especially helpful on machines with two-operand
5378 instructions.
5379
5380 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
5381 optimization.
5382
5383 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5384
5385 @item -fdelayed-branch
5386 @opindex fdelayed-branch
5387 If supported for the target machine, attempt to reorder instructions
5388 to exploit instruction slots available after delayed branch
5389 instructions.
5390
5391 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5392
5393 @item -fschedule-insns
5394 @opindex fschedule-insns
5395 If supported for the target machine, attempt to reorder instructions to
5396 eliminate execution stalls due to required data being unavailable. This
5397 helps machines that have slow floating point or memory load instructions
5398 by allowing other instructions to be issued until the result of the load
5399 or floating point instruction is required.
5400
5401 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5402
5403 @item -fschedule-insns2
5404 @opindex fschedule-insns2
5405 Similar to @option{-fschedule-insns}, but requests an additional pass of
5406 instruction scheduling after register allocation has been done. This is
5407 especially useful on machines with a relatively small number of
5408 registers and where memory load instructions take more than one cycle.
5409
5410 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5411
5412 @item -fno-sched-interblock
5413 @opindex fno-sched-interblock
5414 Don't schedule instructions across basic blocks. This is normally
5415 enabled by default when scheduling before register allocation, i.e.@:
5416 with @option{-fschedule-insns} or at @option{-O2} or higher.
5417
5418 @item -fno-sched-spec
5419 @opindex fno-sched-spec
5420 Don't allow speculative motion of non-load instructions. This is normally
5421 enabled by default when scheduling before register allocation, i.e.@:
5422 with @option{-fschedule-insns} or at @option{-O2} or higher.
5423
5424 @item -fsched-spec-load
5425 @opindex fsched-spec-load
5426 Allow speculative motion of some load instructions. This only makes
5427 sense when scheduling before register allocation, i.e.@: with
5428 @option{-fschedule-insns} or at @option{-O2} or higher.
5429
5430 @item -fsched-spec-load-dangerous
5431 @opindex fsched-spec-load-dangerous
5432 Allow speculative motion of more load instructions. This only makes
5433 sense when scheduling before register allocation, i.e.@: with
5434 @option{-fschedule-insns} or at @option{-O2} or higher.
5435
5436 @item -fsched-stalled-insns=@var{n}
5437 @opindex fsched-stalled-insns
5438 Define how many insns (if any) can be moved prematurely from the queue
5439 of stalled insns into the ready list, during the second scheduling pass.
5440
5441 @item -fsched-stalled-insns-dep=@var{n}
5442 @opindex fsched-stalled-insns-dep
5443 Define how many insn groups (cycles) will be examined for a dependency
5444 on a stalled insn that is candidate for premature removal from the queue
5445 of stalled insns. Has an effect only during the second scheduling pass,
5446 and only if @option{-fsched-stalled-insns} is used and its value is not zero.
5447
5448 @item -fsched2-use-superblocks
5449 @opindex fsched2-use-superblocks
5450 When scheduling after register allocation, do use superblock scheduling
5451 algorithm. Superblock scheduling allows motion across basic block boundaries
5452 resulting on faster schedules. This option is experimental, as not all machine
5453 descriptions used by GCC model the CPU closely enough to avoid unreliable
5454 results from the algorithm.
5455
5456 This only makes sense when scheduling after register allocation, i.e.@: with
5457 @option{-fschedule-insns2} or at @option{-O2} or higher.
5458
5459 @item -fsched2-use-traces
5460 @opindex fsched2-use-traces
5461 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
5462 allocation and additionally perform code duplication in order to increase the
5463 size of superblocks using tracer pass. See @option{-ftracer} for details on
5464 trace formation.
5465
5466 This mode should produce faster but significantly longer programs. Also
5467 without @option{-fbranch-probabilities} the traces constructed may not
5468 match the reality and hurt the performance. This only makes
5469 sense when scheduling after register allocation, i.e.@: with
5470 @option{-fschedule-insns2} or at @option{-O2} or higher.
5471
5472 @item -fsee
5473 @opindex fsee
5474 Eliminates redundant extension instructions and move the non redundant
5475 ones to optimal placement using LCM.
5476
5477 @item -freschedule-modulo-scheduled-loops
5478 @opindex fscheduling-in-modulo-scheduled-loops
5479 The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled
5480 we may want to prevent the later scheduling passes from changing its schedule, we use this
5481 option to control that.
5482
5483 @item -fcaller-saves
5484 @opindex fcaller-saves
5485 Enable values to be allocated in registers that will be clobbered by
5486 function calls, by emitting extra instructions to save and restore the
5487 registers around such calls. Such allocation is done only when it
5488 seems to result in better code than would otherwise be produced.
5489
5490 This option is always enabled by default on certain machines, usually
5491 those which have no call-preserved registers to use instead.
5492
5493 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5494
5495 @item -ftree-pre
5496 Perform Partial Redundancy Elimination (PRE) on trees. This flag is
5497 enabled by default at @option{-O2} and @option{-O3}.
5498
5499 @item -ftree-fre
5500 Perform Full Redundancy Elimination (FRE) on trees. The difference
5501 between FRE and PRE is that FRE only considers expressions
5502 that are computed on all paths leading to the redundant computation.
5503 This analysis is faster than PRE, though it exposes fewer redundancies.
5504 This flag is enabled by default at @option{-O} and higher.
5505
5506 @item -ftree-copy-prop
5507 Perform copy propagation on trees. This pass eliminates unnecessary
5508 copy operations. This flag is enabled by default at @option{-O} and
5509 higher.
5510
5511 @item -ftree-store-copy-prop
5512 Perform copy propagation of memory loads and stores. This pass
5513 eliminates unnecessary copy operations in memory references
5514 (structures, global variables, arrays, etc). This flag is enabled by
5515 default at @option{-O2} and higher.
5516
5517 @item -ftree-salias
5518 Perform structural alias analysis on trees. This flag
5519 is enabled by default at @option{-O} and higher.
5520
5521 @item -fipa-pta
5522 Perform interprocedural pointer analysis.
5523
5524 @item -ftree-sink
5525 Perform forward store motion on trees. This flag is
5526 enabled by default at @option{-O} and higher.
5527
5528 @item -ftree-ccp
5529 Perform sparse conditional constant propagation (CCP) on trees. This
5530 pass only operates on local scalar variables and is enabled by default
5531 at @option{-O} and higher.
5532
5533 @item -ftree-store-ccp
5534 Perform sparse conditional constant propagation (CCP) on trees. This
5535 pass operates on both local scalar variables and memory stores and
5536 loads (global variables, structures, arrays, etc). This flag is
5537 enabled by default at @option{-O2} and higher.
5538
5539 @item -ftree-dce
5540 Perform dead code elimination (DCE) on trees. This flag is enabled by
5541 default at @option{-O} and higher.
5542
5543 @item -ftree-dominator-opts
5544 Perform a variety of simple scalar cleanups (constant/copy
5545 propagation, redundancy elimination, range propagation and expression
5546 simplification) based on a dominator tree traversal. This also
5547 performs jump threading (to reduce jumps to jumps). This flag is
5548 enabled by default at @option{-O} and higher.
5549
5550 @item -ftree-ch
5551 Perform loop header copying on trees. This is beneficial since it increases
5552 effectiveness of code motion optimizations. It also saves one jump. This flag
5553 is enabled by default at @option{-O} and higher. It is not enabled
5554 for @option{-Os}, since it usually increases code size.
5555
5556 @item -ftree-loop-optimize
5557 Perform loop optimizations on trees. This flag is enabled by default
5558 at @option{-O} and higher.
5559
5560 @item -ftree-loop-linear
5561 Perform linear loop transformations on tree. This flag can improve cache
5562 performance and allow further loop optimizations to take place.
5563
5564 @item -fcheck-data-deps
5565 Compare the results of several data dependence analyzers. This option
5566 is used for debugging the data dependence analyzers.
5567
5568 @item -ftree-loop-im
5569 Perform loop invariant motion on trees. This pass moves only invariants that
5570 would be hard to handle at RTL level (function calls, operations that expand to
5571 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
5572 operands of conditions that are invariant out of the loop, so that we can use
5573 just trivial invariantness analysis in loop unswitching. The pass also includes
5574 store motion.
5575
5576 @item -ftree-loop-ivcanon
5577 Create a canonical counter for number of iterations in the loop for that
5578 determining number of iterations requires complicated analysis. Later
5579 optimizations then may determine the number easily. Useful especially
5580 in connection with unrolling.
5581
5582 @item -fivopts
5583 Perform induction variable optimizations (strength reduction, induction
5584 variable merging and induction variable elimination) on trees.
5585
5586 @item -ftree-sra
5587 Perform scalar replacement of aggregates. This pass replaces structure
5588 references with scalars to prevent committing structures to memory too
5589 early. This flag is enabled by default at @option{-O} and higher.
5590
5591 @item -ftree-copyrename
5592 Perform copy renaming on trees. This pass attempts to rename compiler
5593 temporaries to other variables at copy locations, usually resulting in
5594 variable names which more closely resemble the original variables. This flag
5595 is enabled by default at @option{-O} and higher.
5596
5597 @item -ftree-ter
5598 Perform temporary expression replacement during the SSA->normal phase. Single
5599 use/single def temporaries are replaced at their use location with their
5600 defining expression. This results in non-GIMPLE code, but gives the expanders
5601 much more complex trees to work on resulting in better RTL generation. This is
5602 enabled by default at @option{-O} and higher.
5603
5604 @item -ftree-vectorize
5605 Perform loop vectorization on trees.
5606
5607 @item -ftree-vect-loop-version
5608 @opindex ftree-vect-loop-version
5609 Perform loop versioning when doing loop vectorization on trees. When a loop
5610 appears to be vectorizable except that data alignment or data dependence cannot
5611 be determined at compile time then vectorized and non-vectorized versions of
5612 the loop are generated along with runtime checks for alignment or dependence
5613 to control which version is executed. This option is enabled by default
5614 except at level @option{-Os} where it is disabled.
5615
5616 @item -ftree-vrp
5617 Perform Value Range Propagation on trees. This is similar to the
5618 constant propagation pass, but instead of values, ranges of values are
5619 propagated. This allows the optimizers to remove unnecessary range
5620 checks like array bound checks and null pointer checks. This is
5621 enabled by default at @option{-O2} and higher. Null pointer check
5622 elimination is only done if @option{-fdelete-null-pointer-checks} is
5623 enabled.
5624
5625 @item -ftracer
5626 @opindex ftracer
5627 Perform tail duplication to enlarge superblock size. This transformation
5628 simplifies the control flow of the function allowing other optimizations to do
5629 better job.
5630
5631 @item -funroll-loops
5632 @opindex funroll-loops
5633 Unroll loops whose number of iterations can be determined at compile
5634 time or upon entry to the loop. @option{-funroll-loops} implies
5635 @option{-frerun-cse-after-loop}. This option makes code larger,
5636 and may or may not make it run faster.
5637
5638 @item -funroll-all-loops
5639 @opindex funroll-all-loops
5640 Unroll all loops, even if their number of iterations is uncertain when
5641 the loop is entered. This usually makes programs run more slowly.
5642 @option{-funroll-all-loops} implies the same options as
5643 @option{-funroll-loops},
5644
5645 @item -fsplit-ivs-in-unroller
5646 @opindex fsplit-ivs-in-unroller
5647 Enables expressing of values of induction variables in later iterations
5648 of the unrolled loop using the value in the first iteration. This breaks
5649 long dependency chains, thus improving efficiency of the scheduling passes.
5650
5651 Combination of @option{-fweb} and CSE is often sufficient to obtain the
5652 same effect. However in cases the loop body is more complicated than
5653 a single basic block, this is not reliable. It also does not work at all
5654 on some of the architectures due to restrictions in the CSE pass.
5655
5656 This optimization is enabled by default.
5657
5658 @item -fvariable-expansion-in-unroller
5659 @opindex fvariable-expansion-in-unroller
5660 With this option, the compiler will create multiple copies of some
5661 local variables when unrolling a loop which can result in superior code.
5662
5663 @item -fprefetch-loop-arrays
5664 @opindex fprefetch-loop-arrays
5665 If supported by the target machine, generate instructions to prefetch
5666 memory to improve the performance of loops that access large arrays.
5667
5668 This option may generate better or worse code; results are highly
5669 dependent on the structure of loops within the source code.
5670
5671 Disabled at level @option{-Os}.
5672
5673 @item -fno-peephole
5674 @itemx -fno-peephole2
5675 @opindex fno-peephole
5676 @opindex fno-peephole2
5677 Disable any machine-specific peephole optimizations. The difference
5678 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
5679 are implemented in the compiler; some targets use one, some use the
5680 other, a few use both.
5681
5682 @option{-fpeephole} is enabled by default.
5683 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5684
5685 @item -fno-guess-branch-probability
5686 @opindex fno-guess-branch-probability
5687 Do not guess branch probabilities using heuristics.
5688
5689 GCC will use heuristics to guess branch probabilities if they are
5690 not provided by profiling feedback (@option{-fprofile-arcs}). These
5691 heuristics are based on the control flow graph. If some branch probabilities
5692 are specified by @samp{__builtin_expect}, then the heuristics will be
5693 used to guess branch probabilities for the rest of the control flow graph,
5694 taking the @samp{__builtin_expect} info into account. The interactions
5695 between the heuristics and @samp{__builtin_expect} can be complex, and in
5696 some cases, it may be useful to disable the heuristics so that the effects
5697 of @samp{__builtin_expect} are easier to understand.
5698
5699 The default is @option{-fguess-branch-probability} at levels
5700 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5701
5702 @item -freorder-blocks
5703 @opindex freorder-blocks
5704 Reorder basic blocks in the compiled function in order to reduce number of
5705 taken branches and improve code locality.
5706
5707 Enabled at levels @option{-O2}, @option{-O3}.
5708
5709 @item -freorder-blocks-and-partition
5710 @opindex freorder-blocks-and-partition
5711 In addition to reordering basic blocks in the compiled function, in order
5712 to reduce number of taken branches, partitions hot and cold basic blocks
5713 into separate sections of the assembly and .o files, to improve
5714 paging and cache locality performance.
5715
5716 This optimization is automatically turned off in the presence of
5717 exception handling, for linkonce sections, for functions with a user-defined
5718 section attribute and on any architecture that does not support named
5719 sections.
5720
5721 @item -freorder-functions
5722 @opindex freorder-functions
5723 Reorder functions in the object file in order to
5724 improve code locality. This is implemented by using special
5725 subsections @code{.text.hot} for most frequently executed functions and
5726 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
5727 the linker so object file format must support named sections and linker must
5728 place them in a reasonable way.
5729
5730 Also profile feedback must be available in to make this option effective. See
5731 @option{-fprofile-arcs} for details.
5732
5733 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5734
5735 @item -fstrict-aliasing
5736 @opindex fstrict-aliasing
5737 Allows the compiler to assume the strictest aliasing rules applicable to
5738 the language being compiled. For C (and C++), this activates
5739 optimizations based on the type of expressions. In particular, an
5740 object of one type is assumed never to reside at the same address as an
5741 object of a different type, unless the types are almost the same. For
5742 example, an @code{unsigned int} can alias an @code{int}, but not a
5743 @code{void*} or a @code{double}. A character type may alias any other
5744 type.
5745
5746 Pay special attention to code like this:
5747 @smallexample
5748 union a_union @{
5749 int i;
5750 double d;
5751 @};
5752
5753 int f() @{
5754 a_union t;
5755 t.d = 3.0;
5756 return t.i;
5757 @}
5758 @end smallexample
5759 The practice of reading from a different union member than the one most
5760 recently written to (called ``type-punning'') is common. Even with
5761 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
5762 is accessed through the union type. So, the code above will work as
5763 expected. However, this code might not:
5764 @smallexample
5765 int f() @{
5766 a_union t;
5767 int* ip;
5768 t.d = 3.0;
5769 ip = &t.i;
5770 return *ip;
5771 @}
5772 @end smallexample
5773
5774 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5775
5776 @item -fstrict-overflow
5777 @opindex fstrict-overflow
5778 Allow the compiler to assume strict signed overflow rules, depending
5779 on the language being compiled. For C (and C++) this means that
5780 overflow when doing arithmetic with signed numbers is undefined, which
5781 means that the compiler may assume that it will not happen. This
5782 permits various optimizations. For example, the compiler will assume
5783 that an expression like @code{i + 10 > i} will always be true for
5784 signed @code{i}. This assumption is only valid if signed overflow is
5785 undefined, as the expression is false if @code{i + 10} overflows when
5786 using twos complement arithmetic. When this option is in effect any
5787 attempt to determine whether an operation on signed numbers will
5788 overflow must be written carefully to not actually involve overflow.
5789
5790 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
5791 that signed overflow is fully defined: it wraps. When
5792 @option{-fwrapv} is used, there is no difference between
5793 @option{-fstrict-overflow} and @option{-fno-strict-overflow}. With
5794 @option{-fwrapv} certain types of overflow are permitted. For
5795 example, if the compiler gets an overflow when doing arithmetic on
5796 constants, the overflowed value can still be used with
5797 @option{-fwrapv}, but not otherwise.
5798
5799 The @option{-fstrict-overflow} option is enabled at levels
5800 @option{-O2}, @option{-O3}, @option{-Os}.
5801
5802 @item -falign-functions
5803 @itemx -falign-functions=@var{n}
5804 @opindex falign-functions
5805 Align the start of functions to the next power-of-two greater than
5806 @var{n}, skipping up to @var{n} bytes. For instance,
5807 @option{-falign-functions=32} aligns functions to the next 32-byte
5808 boundary, but @option{-falign-functions=24} would align to the next
5809 32-byte boundary only if this can be done by skipping 23 bytes or less.
5810
5811 @option{-fno-align-functions} and @option{-falign-functions=1} are
5812 equivalent and mean that functions will not be aligned.
5813
5814 Some assemblers only support this flag when @var{n} is a power of two;
5815 in that case, it is rounded up.
5816
5817 If @var{n} is not specified or is zero, use a machine-dependent default.
5818
5819 Enabled at levels @option{-O2}, @option{-O3}.
5820
5821 @item -falign-labels
5822 @itemx -falign-labels=@var{n}
5823 @opindex falign-labels
5824 Align all branch targets to a power-of-two boundary, skipping up to
5825 @var{n} bytes like @option{-falign-functions}. This option can easily
5826 make code slower, because it must insert dummy operations for when the
5827 branch target is reached in the usual flow of the code.
5828
5829 @option{-fno-align-labels} and @option{-falign-labels=1} are
5830 equivalent and mean that labels will not be aligned.
5831
5832 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
5833 are greater than this value, then their values are used instead.
5834
5835 If @var{n} is not specified or is zero, use a machine-dependent default
5836 which is very likely to be @samp{1}, meaning no alignment.
5837
5838 Enabled at levels @option{-O2}, @option{-O3}.
5839
5840 @item -falign-loops
5841 @itemx -falign-loops=@var{n}
5842 @opindex falign-loops
5843 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
5844 like @option{-falign-functions}. The hope is that the loop will be
5845 executed many times, which will make up for any execution of the dummy
5846 operations.
5847
5848 @option{-fno-align-loops} and @option{-falign-loops=1} are
5849 equivalent and mean that loops will not be aligned.
5850
5851 If @var{n} is not specified or is zero, use a machine-dependent default.
5852
5853 Enabled at levels @option{-O2}, @option{-O3}.
5854
5855 @item -falign-jumps
5856 @itemx -falign-jumps=@var{n}
5857 @opindex falign-jumps
5858 Align branch targets to a power-of-two boundary, for branch targets
5859 where the targets can only be reached by jumping, skipping up to @var{n}
5860 bytes like @option{-falign-functions}. In this case, no dummy operations
5861 need be executed.
5862
5863 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
5864 equivalent and mean that loops will not be aligned.
5865
5866 If @var{n} is not specified or is zero, use a machine-dependent default.
5867
5868 Enabled at levels @option{-O2}, @option{-O3}.
5869
5870 @item -funit-at-a-time
5871 @opindex funit-at-a-time
5872 Parse the whole compilation unit before starting to produce code.
5873 This allows some extra optimizations to take place but consumes
5874 more memory (in general). There are some compatibility issues
5875 with @emph{unit-at-a-time} mode:
5876 @itemize @bullet
5877 @item
5878 enabling @emph{unit-at-a-time} mode may change the order
5879 in which functions, variables, and top-level @code{asm} statements
5880 are emitted, and will likely break code relying on some particular
5881 ordering. The majority of such top-level @code{asm} statements,
5882 though, can be replaced by @code{section} attributes. The
5883 @option{fno-toplevel-reorder} option may be used to keep the ordering
5884 used in the input file, at the cost of some optimizations.
5885
5886 @item
5887 @emph{unit-at-a-time} mode removes unreferenced static variables
5888 and functions. This may result in undefined references
5889 when an @code{asm} statement refers directly to variables or functions
5890 that are otherwise unused. In that case either the variable/function
5891 shall be listed as an operand of the @code{asm} statement operand or,
5892 in the case of top-level @code{asm} statements the attribute @code{used}
5893 shall be used on the declaration.
5894
5895 @item
5896 Static functions now can use non-standard passing conventions that
5897 may break @code{asm} statements calling functions directly. Again,
5898 attribute @code{used} will prevent this behavior.
5899 @end itemize
5900
5901 As a temporary workaround, @option{-fno-unit-at-a-time} can be used,
5902 but this scheme may not be supported by future releases of GCC@.
5903
5904 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5905
5906 @item -fno-toplevel-reorder
5907 Do not reorder top-level functions, variables, and @code{asm}
5908 statements. Output them in the same order that they appear in the
5909 input file. When this option is used, unreferenced static variables
5910 will not be removed. This option is intended to support existing code
5911 which relies on a particular ordering. For new code, it is better to
5912 use attributes.
5913
5914 @item -fweb
5915 @opindex fweb
5916 Constructs webs as commonly used for register allocation purposes and assign
5917 each web individual pseudo register. This allows the register allocation pass
5918 to operate on pseudos directly, but also strengthens several other optimization
5919 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
5920 however, make debugging impossible, since variables will no longer stay in a
5921 ``home register''.
5922
5923 Enabled by default with @option{-funroll-loops}.
5924
5925 @item -fwhole-program
5926 @opindex fwhole-program
5927 Assume that the current compilation unit represents whole program being
5928 compiled. All public functions and variables with the exception of @code{main}
5929 and those merged by attribute @code{externally_visible} become static functions
5930 and in a affect gets more aggressively optimized by interprocedural optimizers.
5931 While this option is equivalent to proper use of @code{static} keyword for
5932 programs consisting of single file, in combination with option
5933 @option{--combine} this flag can be used to compile most of smaller scale C
5934 programs since the functions and variables become local for the whole combined
5935 compilation unit, not for the single source file itself.
5936
5937
5938 @item -fno-cprop-registers
5939 @opindex fno-cprop-registers
5940 After register allocation and post-register allocation instruction splitting,
5941 we perform a copy-propagation pass to try to reduce scheduling dependencies
5942 and occasionally eliminate the copy.
5943
5944 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5945
5946 @item -fprofile-generate
5947 @opindex fprofile-generate
5948
5949 Enable options usually used for instrumenting application to produce
5950 profile useful for later recompilation with profile feedback based
5951 optimization. You must use @option{-fprofile-generate} both when
5952 compiling and when linking your program.
5953
5954 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
5955
5956 @item -fprofile-use
5957 @opindex fprofile-use
5958 Enable profile feedback directed optimizations, and optimizations
5959 generally profitable only with profile feedback available.
5960
5961 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
5962 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
5963
5964 By default, GCC emits an error message if the feedback profiles do not
5965 match the source code. This error can be turned into a warning by using
5966 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
5967 code.
5968 @end table
5969
5970 The following options control compiler behavior regarding floating
5971 point arithmetic. These options trade off between speed and
5972 correctness. All must be specifically enabled.
5973
5974 @table @gcctabopt
5975 @item -ffloat-store
5976 @opindex ffloat-store
5977 Do not store floating point variables in registers, and inhibit other
5978 options that might change whether a floating point value is taken from a
5979 register or memory.
5980
5981 @cindex floating point precision
5982 This option prevents undesirable excess precision on machines such as
5983 the 68000 where the floating registers (of the 68881) keep more
5984 precision than a @code{double} is supposed to have. Similarly for the
5985 x86 architecture. For most programs, the excess precision does only
5986 good, but a few programs rely on the precise definition of IEEE floating
5987 point. Use @option{-ffloat-store} for such programs, after modifying
5988 them to store all pertinent intermediate computations into variables.
5989
5990 @item -ffast-math
5991 @opindex ffast-math
5992 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
5993 @option{-fno-trapping-math}, @option{-ffinite-math-only},
5994 @option{-fno-rounding-math}, @option{-fno-signaling-nans},
5995 @option{-fno-signed-zeros} and @option{fcx-limited-range}.
5996
5997 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
5998
5999 This option is not turned on by any @option{-O} option since
6000 it can result in incorrect output for programs which depend on
6001 an exact implementation of IEEE or ISO rules/specifications for
6002 math functions. It may, however, yield faster code for programs
6003 that do not require the guarantees of these specifications.
6004
6005 @item -fno-math-errno
6006 @opindex fno-math-errno
6007 Do not set ERRNO after calling math functions that are executed
6008 with a single instruction, e.g., sqrt. A program that relies on
6009 IEEE exceptions for math error handling may want to use this flag
6010 for speed while maintaining IEEE arithmetic compatibility.
6011
6012 This option is not turned on by any @option{-O} option since
6013 it can result in incorrect output for programs which depend on
6014 an exact implementation of IEEE or ISO rules/specifications for
6015 math functions. It may, however, yield faster code for programs
6016 that do not require the guarantees of these specifications.
6017
6018 The default is @option{-fmath-errno}.
6019
6020 On Darwin systems, the math library never sets @code{errno}. There is
6021 therefore no reason for the compiler to consider the possibility that
6022 it might, and @option{-fno-math-errno} is the default.
6023
6024 @item -funsafe-math-optimizations
6025 @opindex funsafe-math-optimizations
6026 Allow optimizations for floating-point arithmetic that (a) assume
6027 that arguments and results are valid and (b) may violate IEEE or
6028 ANSI standards. When used at link-time, it may include libraries
6029 or startup files that change the default FPU control word or other
6030 similar optimizations.
6031
6032 This option is not turned on by any @option{-O} option since
6033 it can result in incorrect output for programs which depend on
6034 an exact implementation of IEEE or ISO rules/specifications for
6035 math functions. It may, however, yield faster code for programs
6036 that do not require the guarantees of these specifications.
6037
6038 The default is @option{-fno-unsafe-math-optimizations}.
6039
6040 @item -ffinite-math-only
6041 @opindex ffinite-math-only
6042 Allow optimizations for floating-point arithmetic that assume
6043 that arguments and results are not NaNs or +-Infs.
6044
6045 This option is not turned on by any @option{-O} option since
6046 it can result in incorrect output for programs which depend on
6047 an exact implementation of IEEE or ISO rules/specifications for
6048 math functions. It may, however, yield faster code for programs
6049 that do not require the guarantees of these specifications.
6050
6051 The default is @option{-fno-finite-math-only}.
6052
6053 @item -fno-signed-zeros
6054 @opindex fno-signed-zeros
6055 Allow optimizations for floating point arithmetic that ignore the
6056 signedness of zero. IEEE arithmetic specifies the behavior of
6057 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
6058 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
6059 This option implies that the sign of a zero result isn't significant.
6060
6061 The default is @option{-fsigned-zeros}.
6062
6063 @item -fno-trapping-math
6064 @opindex fno-trapping-math
6065 Compile code assuming that floating-point operations cannot generate
6066 user-visible traps. These traps include division by zero, overflow,
6067 underflow, inexact result and invalid operation. This option implies
6068 @option{-fno-signaling-nans}. Setting this option may allow faster
6069 code if one relies on ``non-stop'' IEEE arithmetic, for example.
6070
6071 This option should never be turned on by any @option{-O} option since
6072 it can result in incorrect output for programs which depend on
6073 an exact implementation of IEEE or ISO rules/specifications for
6074 math functions.
6075
6076 The default is @option{-ftrapping-math}.
6077
6078 @item -frounding-math
6079 @opindex frounding-math
6080 Disable transformations and optimizations that assume default floating
6081 point rounding behavior. This is round-to-zero for all floating point
6082 to integer conversions, and round-to-nearest for all other arithmetic
6083 truncations. This option should be specified for programs that change
6084 the FP rounding mode dynamically, or that may be executed with a
6085 non-default rounding mode. This option disables constant folding of
6086 floating point expressions at compile-time (which may be affected by
6087 rounding mode) and arithmetic transformations that are unsafe in the
6088 presence of sign-dependent rounding modes.
6089
6090 The default is @option{-fno-rounding-math}.
6091
6092 This option is experimental and does not currently guarantee to
6093 disable all GCC optimizations that are affected by rounding mode.
6094 Future versions of GCC may provide finer control of this setting
6095 using C99's @code{FENV_ACCESS} pragma. This command line option
6096 will be used to specify the default state for @code{FENV_ACCESS}.
6097
6098 @item -frtl-abstract-sequences
6099 @opindex frtl-abstract-sequences
6100 It is a size optimization method. This option is to find identical
6101 sequences of code, which can be turned into pseudo-procedures and
6102 then replace all occurrences with calls to the newly created
6103 subroutine. It is kind of an opposite of @option{-finline-functions}.
6104 This optimization runs at RTL level.
6105
6106 @item -fsignaling-nans
6107 @opindex fsignaling-nans
6108 Compile code assuming that IEEE signaling NaNs may generate user-visible
6109 traps during floating-point operations. Setting this option disables
6110 optimizations that may change the number of exceptions visible with
6111 signaling NaNs. This option implies @option{-ftrapping-math}.
6112
6113 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
6114 be defined.
6115
6116 The default is @option{-fno-signaling-nans}.
6117
6118 This option is experimental and does not currently guarantee to
6119 disable all GCC optimizations that affect signaling NaN behavior.
6120
6121 @item -fsingle-precision-constant
6122 @opindex fsingle-precision-constant
6123 Treat floating point constant as single precision constant instead of
6124 implicitly converting it to double precision constant.
6125
6126 @item -fcx-limited-range
6127 @itemx -fno-cx-limited-range
6128 @opindex fcx-limited-range
6129 @opindex fno-cx-limited-range
6130 When enabled, this option states that a range reduction step is not
6131 needed when performing complex division. The default is
6132 @option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}.
6133
6134 This option controls the default setting of the ISO C99
6135 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
6136 all languages.
6137
6138 @end table
6139
6140 The following options control optimizations that may improve
6141 performance, but are not enabled by any @option{-O} options. This
6142 section includes experimental options that may produce broken code.
6143
6144 @table @gcctabopt
6145 @item -fbranch-probabilities
6146 @opindex fbranch-probabilities
6147 After running a program compiled with @option{-fprofile-arcs}
6148 (@pxref{Debugging Options,, Options for Debugging Your Program or
6149 @command{gcc}}), you can compile it a second time using
6150 @option{-fbranch-probabilities}, to improve optimizations based on
6151 the number of times each branch was taken. When the program
6152 compiled with @option{-fprofile-arcs} exits it saves arc execution
6153 counts to a file called @file{@var{sourcename}.gcda} for each source
6154 file. The information in this data file is very dependent on the
6155 structure of the generated code, so you must use the same source code
6156 and the same optimization options for both compilations.
6157
6158 With @option{-fbranch-probabilities}, GCC puts a
6159 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
6160 These can be used to improve optimization. Currently, they are only
6161 used in one place: in @file{reorg.c}, instead of guessing which path a
6162 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
6163 exactly determine which path is taken more often.
6164
6165 @item -fprofile-values
6166 @opindex fprofile-values
6167 If combined with @option{-fprofile-arcs}, it adds code so that some
6168 data about values of expressions in the program is gathered.
6169
6170 With @option{-fbranch-probabilities}, it reads back the data gathered
6171 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
6172 notes to instructions for their later usage in optimizations.
6173
6174 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
6175
6176 @item -fvpt
6177 @opindex fvpt
6178 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
6179 a code to gather information about values of expressions.
6180
6181 With @option{-fbranch-probabilities}, it reads back the data gathered
6182 and actually performs the optimizations based on them.
6183 Currently the optimizations include specialization of division operation
6184 using the knowledge about the value of the denominator.
6185
6186 @item -frename-registers
6187 @opindex frename-registers
6188 Attempt to avoid false dependencies in scheduled code by making use
6189 of registers left over after register allocation. This optimization
6190 will most benefit processors with lots of registers. Depending on the
6191 debug information format adopted by the target, however, it can
6192 make debugging impossible, since variables will no longer stay in
6193 a ``home register''.
6194
6195 Enabled by default with @option{-funroll-loops}.
6196
6197 @item -ftracer
6198 @opindex ftracer
6199 Perform tail duplication to enlarge superblock size. This transformation
6200 simplifies the control flow of the function allowing other optimizations to do
6201 better job.
6202
6203 Enabled with @option{-fprofile-use}.
6204
6205 @item -funroll-loops
6206 @opindex funroll-loops
6207 Unroll loops whose number of iterations can be determined at compile time or
6208 upon entry to the loop. @option{-funroll-loops} implies
6209 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
6210 It also turns on complete loop peeling (i.e.@: complete removal of loops with
6211 small constant number of iterations). This option makes code larger, and may
6212 or may not make it run faster.
6213
6214 Enabled with @option{-fprofile-use}.
6215
6216 @item -funroll-all-loops
6217 @opindex funroll-all-loops
6218 Unroll all loops, even if their number of iterations is uncertain when
6219 the loop is entered. This usually makes programs run more slowly.
6220 @option{-funroll-all-loops} implies the same options as
6221 @option{-funroll-loops}.
6222
6223 @item -fpeel-loops
6224 @opindex fpeel-loops
6225 Peels the loops for that there is enough information that they do not
6226 roll much (from profile feedback). It also turns on complete loop peeling
6227 (i.e.@: complete removal of loops with small constant number of iterations).
6228
6229 Enabled with @option{-fprofile-use}.
6230
6231 @item -fmove-loop-invariants
6232 @opindex fmove-loop-invariants
6233 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
6234 at level @option{-O1}
6235
6236 @item -funswitch-loops
6237 @opindex funswitch-loops
6238 Move branches with loop invariant conditions out of the loop, with duplicates
6239 of the loop on both branches (modified according to result of the condition).
6240
6241 @item -ffunction-sections
6242 @itemx -fdata-sections
6243 @opindex ffunction-sections
6244 @opindex fdata-sections
6245 Place each function or data item into its own section in the output
6246 file if the target supports arbitrary sections. The name of the
6247 function or the name of the data item determines the section's name
6248 in the output file.
6249
6250 Use these options on systems where the linker can perform optimizations
6251 to improve locality of reference in the instruction space. Most systems
6252 using the ELF object format and SPARC processors running Solaris 2 have
6253 linkers with such optimizations. AIX may have these optimizations in
6254 the future.
6255
6256 Only use these options when there are significant benefits from doing
6257 so. When you specify these options, the assembler and linker will
6258 create larger object and executable files and will also be slower.
6259 You will not be able to use @code{gprof} on all systems if you
6260 specify this option and you may have problems with debugging if
6261 you specify both this option and @option{-g}.
6262
6263 @item -fbranch-target-load-optimize
6264 @opindex fbranch-target-load-optimize
6265 Perform branch target register load optimization before prologue / epilogue
6266 threading.
6267 The use of target registers can typically be exposed only during reload,
6268 thus hoisting loads out of loops and doing inter-block scheduling needs
6269 a separate optimization pass.
6270
6271 @item -fbranch-target-load-optimize2
6272 @opindex fbranch-target-load-optimize2
6273 Perform branch target register load optimization after prologue / epilogue
6274 threading.
6275
6276 @item -fbtr-bb-exclusive
6277 @opindex fbtr-bb-exclusive
6278 When performing branch target register load optimization, don't reuse
6279 branch target registers in within any basic block.
6280
6281 @item -fstack-protector
6282 Emit extra code to check for buffer overflows, such as stack smashing
6283 attacks. This is done by adding a guard variable to functions with
6284 vulnerable objects. This includes functions that call alloca, and
6285 functions with buffers larger than 8 bytes. The guards are initialized
6286 when a function is entered and then checked when the function exits.
6287 If a guard check fails, an error message is printed and the program exits.
6288
6289 @item -fstack-protector-all
6290 Like @option{-fstack-protector} except that all functions are protected.
6291
6292 @item -fsection-anchors
6293 @opindex fsection-anchors
6294 Try to reduce the number of symbolic address calculations by using
6295 shared ``anchor'' symbols to address nearby objects. This transformation
6296 can help to reduce the number of GOT entries and GOT accesses on some
6297 targets.
6298
6299 For example, the implementation of the following function @code{foo}:
6300
6301 @smallexample
6302 static int a, b, c;
6303 int foo (void) @{ return a + b + c; @}
6304 @end smallexample
6305
6306 would usually calculate the addresses of all three variables, but if you
6307 compile it with @option{-fsection-anchors}, it will access the variables
6308 from a common anchor point instead. The effect is similar to the
6309 following pseudocode (which isn't valid C):
6310
6311 @smallexample
6312 int foo (void)
6313 @{
6314 register int *xr = &x;
6315 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
6316 @}
6317 @end smallexample
6318
6319 Not all targets support this option.
6320
6321 @item --param @var{name}=@var{value}
6322 @opindex param
6323 In some places, GCC uses various constants to control the amount of
6324 optimization that is done. For example, GCC will not inline functions
6325 that contain more that a certain number of instructions. You can
6326 control some of these constants on the command-line using the
6327 @option{--param} option.
6328
6329 The names of specific parameters, and the meaning of the values, are
6330 tied to the internals of the compiler, and are subject to change
6331 without notice in future releases.
6332
6333 In each case, the @var{value} is an integer. The allowable choices for
6334 @var{name} are given in the following table:
6335
6336 @table @gcctabopt
6337 @item salias-max-implicit-fields
6338 The maximum number of fields in a variable without direct
6339 structure accesses for which structure aliasing will consider trying
6340 to track each field. The default is 5
6341
6342 @item salias-max-array-elements
6343 The maximum number of elements an array can have and its elements
6344 still be tracked individually by structure aliasing. The default is 4
6345
6346 @item sra-max-structure-size
6347 The maximum structure size, in bytes, at which the scalar replacement
6348 of aggregates (SRA) optimization will perform block copies. The
6349 default value, 0, implies that GCC will select the most appropriate
6350 size itself.
6351
6352 @item sra-field-structure-ratio
6353 The threshold ratio (as a percentage) between instantiated fields and
6354 the complete structure size. We say that if the ratio of the number
6355 of bytes in instantiated fields to the number of bytes in the complete
6356 structure exceeds this parameter, then block copies are not used. The
6357 default is 75.
6358
6359 @item max-crossjump-edges
6360 The maximum number of incoming edges to consider for crossjumping.
6361 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
6362 the number of edges incoming to each block. Increasing values mean
6363 more aggressive optimization, making the compile time increase with
6364 probably small improvement in executable size.
6365
6366 @item min-crossjump-insns
6367 The minimum number of instructions which must be matched at the end
6368 of two blocks before crossjumping will be performed on them. This
6369 value is ignored in the case where all instructions in the block being
6370 crossjumped from are matched. The default value is 5.
6371
6372 @item max-grow-copy-bb-insns
6373 The maximum code size expansion factor when copying basic blocks
6374 instead of jumping. The expansion is relative to a jump instruction.
6375 The default value is 8.
6376
6377 @item max-goto-duplication-insns
6378 The maximum number of instructions to duplicate to a block that jumps
6379 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
6380 passes, GCC factors computed gotos early in the compilation process,
6381 and unfactors them as late as possible. Only computed jumps at the
6382 end of a basic blocks with no more than max-goto-duplication-insns are
6383 unfactored. The default value is 8.
6384
6385 @item max-delay-slot-insn-search
6386 The maximum number of instructions to consider when looking for an
6387 instruction to fill a delay slot. If more than this arbitrary number of
6388 instructions is searched, the time savings from filling the delay slot
6389 will be minimal so stop searching. Increasing values mean more
6390 aggressive optimization, making the compile time increase with probably
6391 small improvement in executable run time.
6392
6393 @item max-delay-slot-live-search
6394 When trying to fill delay slots, the maximum number of instructions to
6395 consider when searching for a block with valid live register
6396 information. Increasing this arbitrarily chosen value means more
6397 aggressive optimization, increasing the compile time. This parameter
6398 should be removed when the delay slot code is rewritten to maintain the
6399 control-flow graph.
6400
6401 @item max-gcse-memory
6402 The approximate maximum amount of memory that will be allocated in
6403 order to perform the global common subexpression elimination
6404 optimization. If more memory than specified is required, the
6405 optimization will not be done.
6406
6407 @item max-gcse-passes
6408 The maximum number of passes of GCSE to run. The default is 1.
6409
6410 @item max-pending-list-length
6411 The maximum number of pending dependencies scheduling will allow
6412 before flushing the current state and starting over. Large functions
6413 with few branches or calls can create excessively large lists which
6414 needlessly consume memory and resources.
6415
6416 @item max-inline-insns-single
6417 Several parameters control the tree inliner used in gcc.
6418 This number sets the maximum number of instructions (counted in GCC's
6419 internal representation) in a single function that the tree inliner
6420 will consider for inlining. This only affects functions declared
6421 inline and methods implemented in a class declaration (C++).
6422 The default value is 450.
6423
6424 @item max-inline-insns-auto
6425 When you use @option{-finline-functions} (included in @option{-O3}),
6426 a lot of functions that would otherwise not be considered for inlining
6427 by the compiler will be investigated. To those functions, a different
6428 (more restrictive) limit compared to functions declared inline can
6429 be applied.
6430 The default value is 90.
6431
6432 @item large-function-insns
6433 The limit specifying really large functions. For functions larger than this
6434 limit after inlining inlining is constrained by
6435 @option{--param large-function-growth}. This parameter is useful primarily
6436 to avoid extreme compilation time caused by non-linear algorithms used by the
6437 backend.
6438 This parameter is ignored when @option{-funit-at-a-time} is not used.
6439 The default value is 2700.
6440
6441 @item large-function-growth
6442 Specifies maximal growth of large function caused by inlining in percents.
6443 This parameter is ignored when @option{-funit-at-a-time} is not used.
6444 The default value is 100 which limits large function growth to 2.0 times
6445 the original size.
6446
6447 @item large-unit-insns
6448 The limit specifying large translation unit. Growth caused by inlining of
6449 units larger than this limit is limited by @option{--param inline-unit-growth}.
6450 For small units this might be too tight (consider unit consisting of function A
6451 that is inline and B that just calls A three time. If B is small relative to
6452 A, the growth of unit is 300\% and yet such inlining is very sane. For very
6453 large units consisting of small inlininable functions however the overall unit
6454 growth limit is needed to avoid exponential explosion of code size. Thus for
6455 smaller units, the size is increased to @option{--param large-unit-insns}
6456 before applying @option{--param inline-unit-growth}. The default is 10000
6457
6458 @item inline-unit-growth
6459 Specifies maximal overall growth of the compilation unit caused by inlining.
6460 This parameter is ignored when @option{-funit-at-a-time} is not used.
6461 The default value is 30 which limits unit growth to 1.3 times the original
6462 size.
6463
6464 @item large-stack-frame
6465 The limit specifying large stack frames. While inlining the algorithm is trying
6466 to not grow past this limit too much. Default value is 256 bytes.
6467
6468 @item large-stack-frame-growth
6469 Specifies maximal growth of large stack frames caused by inlining in percents.
6470 The default value is 1000 which limits large stack frame growth to 11 times
6471 the original size.
6472
6473 @item max-inline-insns-recursive
6474 @itemx max-inline-insns-recursive-auto
6475 Specifies maximum number of instructions out-of-line copy of self recursive inline
6476 function can grow into by performing recursive inlining.
6477
6478 For functions declared inline @option{--param max-inline-insns-recursive} is
6479 taken into account. For function not declared inline, recursive inlining
6480 happens only when @option{-finline-functions} (included in @option{-O3}) is
6481 enabled and @option{--param max-inline-insns-recursive-auto} is used. The
6482 default value is 450.
6483
6484 @item max-inline-recursive-depth
6485 @itemx max-inline-recursive-depth-auto
6486 Specifies maximum recursion depth used by the recursive inlining.
6487
6488 For functions declared inline @option{--param max-inline-recursive-depth} is
6489 taken into account. For function not declared inline, recursive inlining
6490 happens only when @option{-finline-functions} (included in @option{-O3}) is
6491 enabled and @option{--param max-inline-recursive-depth-auto} is used. The
6492 default value is 450.
6493
6494 @item min-inline-recursive-probability
6495 Recursive inlining is profitable only for function having deep recursion
6496 in average and can hurt for function having little recursion depth by
6497 increasing the prologue size or complexity of function body to other
6498 optimizers.
6499
6500 When profile feedback is available (see @option{-fprofile-generate}) the actual
6501 recursion depth can be guessed from probability that function will recurse via
6502 given call expression. This parameter limits inlining only to call expression
6503 whose probability exceeds given threshold (in percents). The default value is
6504 10.
6505
6506 @item inline-call-cost
6507 Specify cost of call instruction relative to simple arithmetics operations
6508 (having cost of 1). Increasing this cost disqualifies inlining of non-leaf
6509 functions and at the same time increases size of leaf function that is believed to
6510 reduce function size by being inlined. In effect it increases amount of
6511 inlining for code having large abstraction penalty (many functions that just
6512 pass the arguments to other functions) and decrease inlining for code with low
6513 abstraction penalty. The default value is 16.
6514
6515 @item min-vect-loop-bound
6516 The minimum number of iterations under which a loop will not get vectorized
6517 when @option{-ftree-vectorize} is used. The number of iterations after
6518 vectorization needs to be greater than the value specified by this option
6519 to allow vectorization. The default value is 0.
6520
6521 @item max-unrolled-insns
6522 The maximum number of instructions that a loop should have if that loop
6523 is unrolled, and if the loop is unrolled, it determines how many times
6524 the loop code is unrolled.
6525
6526 @item max-average-unrolled-insns
6527 The maximum number of instructions biased by probabilities of their execution
6528 that a loop should have if that loop is unrolled, and if the loop is unrolled,
6529 it determines how many times the loop code is unrolled.
6530
6531 @item max-unroll-times
6532 The maximum number of unrollings of a single loop.
6533
6534 @item max-peeled-insns
6535 The maximum number of instructions that a loop should have if that loop
6536 is peeled, and if the loop is peeled, it determines how many times
6537 the loop code is peeled.
6538
6539 @item max-peel-times
6540 The maximum number of peelings of a single loop.
6541
6542 @item max-completely-peeled-insns
6543 The maximum number of insns of a completely peeled loop.
6544
6545 @item max-completely-peel-times
6546 The maximum number of iterations of a loop to be suitable for complete peeling.
6547
6548 @item max-unswitch-insns
6549 The maximum number of insns of an unswitched loop.
6550
6551 @item max-unswitch-level
6552 The maximum number of branches unswitched in a single loop.
6553
6554 @item lim-expensive
6555 The minimum cost of an expensive expression in the loop invariant motion.
6556
6557 @item iv-consider-all-candidates-bound
6558 Bound on number of candidates for induction variables below that
6559 all candidates are considered for each use in induction variable
6560 optimizations. Only the most relevant candidates are considered
6561 if there are more candidates, to avoid quadratic time complexity.
6562
6563 @item iv-max-considered-uses
6564 The induction variable optimizations give up on loops that contain more
6565 induction variable uses.
6566
6567 @item iv-always-prune-cand-set-bound
6568 If number of candidates in the set is smaller than this value,
6569 we always try to remove unnecessary ivs from the set during its
6570 optimization when a new iv is added to the set.
6571
6572 @item scev-max-expr-size
6573 Bound on size of expressions used in the scalar evolutions analyzer.
6574 Large expressions slow the analyzer.
6575
6576 @item omega-max-vars
6577 The maximum number of variables in an Omega constraint system.
6578 The default value is 128.
6579
6580 @item omega-max-geqs
6581 The maximum number of inequalities in an Omega constraint system.
6582 The default value is 256.
6583
6584 @item omega-max-eqs
6585 The maximum number of equalities in an Omega constraint system.
6586 The default value is 128.
6587
6588 @item omega-max-wild-cards
6589 The maximum number of wildcard variables that the Omega solver will
6590 be able to insert. The default value is 18.
6591
6592 @item omega-hash-table-size
6593 The size of the hash table in the Omega solver. The default value is
6594 550.
6595
6596 @item omega-max-keys
6597 The maximal number of keys used by the Omega solver. The default
6598 value is 500.
6599
6600 @item omega-eliminate-redundant-constraints
6601 When set to 1, use expensive methods to eliminate all redundant
6602 constraints. The default value is 0.
6603
6604 @item vect-max-version-checks
6605 The maximum number of runtime checks that can be performed when doing
6606 loop versioning in the vectorizer. See option ftree-vect-loop-version
6607 for more information.
6608
6609 @item max-iterations-to-track
6610
6611 The maximum number of iterations of a loop the brute force algorithm
6612 for analysis of # of iterations of the loop tries to evaluate.
6613
6614 @item hot-bb-count-fraction
6615 Select fraction of the maximal count of repetitions of basic block in program
6616 given basic block needs to have to be considered hot.
6617
6618 @item hot-bb-frequency-fraction
6619 Select fraction of the maximal frequency of executions of basic block in
6620 function given basic block needs to have to be considered hot
6621
6622 @item max-predicted-iterations
6623 The maximum number of loop iterations we predict statically. This is useful
6624 in cases where function contain single loop with known bound and other loop
6625 with unknown. We predict the known number of iterations correctly, while
6626 the unknown number of iterations average to roughly 10. This means that the
6627 loop without bounds would appear artificially cold relative to the other one.
6628
6629 @item tracer-dynamic-coverage
6630 @itemx tracer-dynamic-coverage-feedback
6631
6632 This value is used to limit superblock formation once the given percentage of
6633 executed instructions is covered. This limits unnecessary code size
6634 expansion.
6635
6636 The @option{tracer-dynamic-coverage-feedback} is used only when profile
6637 feedback is available. The real profiles (as opposed to statically estimated
6638 ones) are much less balanced allowing the threshold to be larger value.
6639
6640 @item tracer-max-code-growth
6641 Stop tail duplication once code growth has reached given percentage. This is
6642 rather hokey argument, as most of the duplicates will be eliminated later in
6643 cross jumping, so it may be set to much higher values than is the desired code
6644 growth.
6645
6646 @item tracer-min-branch-ratio
6647
6648 Stop reverse growth when the reverse probability of best edge is less than this
6649 threshold (in percent).
6650
6651 @item tracer-min-branch-ratio
6652 @itemx tracer-min-branch-ratio-feedback
6653
6654 Stop forward growth if the best edge do have probability lower than this
6655 threshold.
6656
6657 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
6658 compilation for profile feedback and one for compilation without. The value
6659 for compilation with profile feedback needs to be more conservative (higher) in
6660 order to make tracer effective.
6661
6662 @item max-cse-path-length
6663
6664 Maximum number of basic blocks on path that cse considers. The default is 10.
6665
6666 @item max-cse-insns
6667 The maximum instructions CSE process before flushing. The default is 1000.
6668
6669 @item max-aliased-vops
6670
6671 Maximum number of virtual operands per function allowed to represent
6672 aliases before triggering the alias partitioning heuristic. Alias
6673 partitioning reduces compile times and memory consumption needed for
6674 aliasing at the expense of precision loss in alias information. The
6675 default value for this parameter is 100 for -O1, 500 for -O2 and 1000
6676 for -O3.
6677
6678 Notice that if a function contains more memory statements than the
6679 value of this parameter, it is not really possible to achieve this
6680 reduction. In this case, the compiler will use the number of memory
6681 statements as the value for @option{max-aliased-vops}.
6682
6683 @item avg-aliased-vops
6684
6685 Average number of virtual operands per statement allowed to represent
6686 aliases before triggering the alias partitioning heuristic. This
6687 works in conjunction with @option{max-aliased-vops}. If a function
6688 contains more than @option{max-aliased-vops} virtual operators, then
6689 memory symbols will be grouped into memory partitions until either the
6690 total number of virtual operators is below @option{max-aliased-vops}
6691 or the average number of virtual operators per memory statement is
6692 below @option{avg-aliased-vops}. The default value for this parameter
6693 is 1 for -O1 and -O2, and 3 for -O3.
6694
6695 @item ggc-min-expand
6696
6697 GCC uses a garbage collector to manage its own memory allocation. This
6698 parameter specifies the minimum percentage by which the garbage
6699 collector's heap should be allowed to expand between collections.
6700 Tuning this may improve compilation speed; it has no effect on code
6701 generation.
6702
6703 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
6704 RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is
6705 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
6706 GCC is not able to calculate RAM on a particular platform, the lower
6707 bound of 30% is used. Setting this parameter and
6708 @option{ggc-min-heapsize} to zero causes a full collection to occur at
6709 every opportunity. This is extremely slow, but can be useful for
6710 debugging.
6711
6712 @item ggc-min-heapsize
6713
6714 Minimum size of the garbage collector's heap before it begins bothering
6715 to collect garbage. The first collection occurs after the heap expands
6716 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
6717 tuning this may improve compilation speed, and has no effect on code
6718 generation.
6719
6720 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
6721 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
6722 with a lower bound of 4096 (four megabytes) and an upper bound of
6723 131072 (128 megabytes). If GCC is not able to calculate RAM on a
6724 particular platform, the lower bound is used. Setting this parameter
6725 very large effectively disables garbage collection. Setting this
6726 parameter and @option{ggc-min-expand} to zero causes a full collection
6727 to occur at every opportunity.
6728
6729 @item max-reload-search-insns
6730 The maximum number of instruction reload should look backward for equivalent
6731 register. Increasing values mean more aggressive optimization, making the
6732 compile time increase with probably slightly better performance. The default
6733 value is 100.
6734
6735 @item max-cselib-memory-locations
6736 The maximum number of memory locations cselib should take into account.
6737 Increasing values mean more aggressive optimization, making the compile time
6738 increase with probably slightly better performance. The default value is 500.
6739
6740 @item max-flow-memory-locations
6741 Similar as @option{max-cselib-memory-locations} but for dataflow liveness.
6742 The default value is 100.
6743
6744 @item reorder-blocks-duplicate
6745 @itemx reorder-blocks-duplicate-feedback
6746
6747 Used by basic block reordering pass to decide whether to use unconditional
6748 branch or duplicate the code on its destination. Code is duplicated when its
6749 estimated size is smaller than this value multiplied by the estimated size of
6750 unconditional jump in the hot spots of the program.
6751
6752 The @option{reorder-block-duplicate-feedback} is used only when profile
6753 feedback is available and may be set to higher values than
6754 @option{reorder-block-duplicate} since information about the hot spots is more
6755 accurate.
6756
6757 @item max-sched-ready-insns
6758 The maximum number of instructions ready to be issued the scheduler should
6759 consider at any given time during the first scheduling pass. Increasing
6760 values mean more thorough searches, making the compilation time increase
6761 with probably little benefit. The default value is 100.
6762
6763 @item max-sched-region-blocks
6764 The maximum number of blocks in a region to be considered for
6765 interblock scheduling. The default value is 10.
6766
6767 @item max-sched-region-insns
6768 The maximum number of insns in a region to be considered for
6769 interblock scheduling. The default value is 100.
6770
6771 @item min-spec-prob
6772 The minimum probability (in percents) of reaching a source block
6773 for interblock speculative scheduling. The default value is 40.
6774
6775 @item max-sched-extend-regions-iters
6776 The maximum number of iterations through CFG to extend regions.
6777 0 - disable region extension,
6778 N - do at most N iterations.
6779 The default value is 0.
6780
6781 @item max-sched-insn-conflict-delay
6782 The maximum conflict delay for an insn to be considered for speculative motion.
6783 The default value is 3.
6784
6785 @item sched-spec-prob-cutoff
6786 The minimal probability of speculation success (in percents), so that
6787 speculative insn will be scheduled.
6788 The default value is 40.
6789
6790 @item max-last-value-rtl
6791
6792 The maximum size measured as number of RTLs that can be recorded in an expression
6793 in combiner for a pseudo register as last known value of that register. The default
6794 is 10000.
6795
6796 @item integer-share-limit
6797 Small integer constants can use a shared data structure, reducing the
6798 compiler's memory usage and increasing its speed. This sets the maximum
6799 value of a shared integer constant's. The default value is 256.
6800
6801 @item min-virtual-mappings
6802 Specifies the minimum number of virtual mappings in the incremental
6803 SSA updater that should be registered to trigger the virtual mappings
6804 heuristic defined by virtual-mappings-ratio. The default value is
6805 100.
6806
6807 @item virtual-mappings-ratio
6808 If the number of virtual mappings is virtual-mappings-ratio bigger
6809 than the number of virtual symbols to be updated, then the incremental
6810 SSA updater switches to a full update for those symbols. The default
6811 ratio is 3.
6812
6813 @item ssp-buffer-size
6814 The minimum size of buffers (i.e. arrays) that will receive stack smashing
6815 protection when @option{-fstack-protection} is used.
6816
6817 @item max-jump-thread-duplication-stmts
6818 Maximum number of statements allowed in a block that needs to be
6819 duplicated when threading jumps.
6820
6821 @item max-fields-for-field-sensitive
6822 Maximum number of fields in a structure we will treat in
6823 a field sensitive manner during pointer analysis.
6824
6825 @item prefetch-latency
6826 Estimate on average number of instructions that are executed before
6827 prefetch finishes. The distance we prefetch ahead is proportional
6828 to this constant. Increasing this number may also lead to less
6829 streams being prefetched (see @option{simultaneous-prefetches}).
6830
6831 @item simultaneous-prefetches
6832 Maximum number of prefetches that can run at the same time.
6833
6834 @item l1-cache-line-size
6835 The size of cache line in L1 cache, in bytes.
6836
6837 @item l1-cache-size
6838 The number of cache lines in L1 cache.
6839
6840 @item verify-canonical-types
6841 Whether the compiler should verify the ``canonical'' types used for
6842 type equality comparisons within the C++ and Objective-C++ front
6843 ends. Set to 1 (the default when GCC is configured with
6844 --enable-checking) to enable verification, 0 to disable verification
6845 (the default when GCC is configured with --disable-checking).
6846
6847 @end table
6848 @end table
6849
6850 @node Preprocessor Options
6851 @section Options Controlling the Preprocessor
6852 @cindex preprocessor options
6853 @cindex options, preprocessor
6854
6855 These options control the C preprocessor, which is run on each C source
6856 file before actual compilation.
6857
6858 If you use the @option{-E} option, nothing is done except preprocessing.
6859 Some of these options make sense only together with @option{-E} because
6860 they cause the preprocessor output to be unsuitable for actual
6861 compilation.
6862
6863 @table @gcctabopt
6864 @opindex Wp
6865 You can use @option{-Wp,@var{option}} to bypass the compiler driver
6866 and pass @var{option} directly through to the preprocessor. If
6867 @var{option} contains commas, it is split into multiple options at the
6868 commas. However, many options are modified, translated or interpreted
6869 by the compiler driver before being passed to the preprocessor, and
6870 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
6871 interface is undocumented and subject to change, so whenever possible
6872 you should avoid using @option{-Wp} and let the driver handle the
6873 options instead.
6874
6875 @item -Xpreprocessor @var{option}
6876 @opindex preprocessor
6877 Pass @var{option} as an option to the preprocessor. You can use this to
6878 supply system-specific preprocessor options which GCC does not know how to
6879 recognize.
6880
6881 If you want to pass an option that takes an argument, you must use
6882 @option{-Xpreprocessor} twice, once for the option and once for the argument.
6883 @end table
6884
6885 @include cppopts.texi
6886
6887 @node Assembler Options
6888 @section Passing Options to the Assembler
6889
6890 @c prevent bad page break with this line
6891 You can pass options to the assembler.
6892
6893 @table @gcctabopt
6894 @item -Wa,@var{option}
6895 @opindex Wa
6896 Pass @var{option} as an option to the assembler. If @var{option}
6897 contains commas, it is split into multiple options at the commas.
6898
6899 @item -Xassembler @var{option}
6900 @opindex Xassembler
6901 Pass @var{option} as an option to the assembler. You can use this to
6902 supply system-specific assembler options which GCC does not know how to
6903 recognize.
6904
6905 If you want to pass an option that takes an argument, you must use
6906 @option{-Xassembler} twice, once for the option and once for the argument.
6907
6908 @end table
6909
6910 @node Link Options
6911 @section Options for Linking
6912 @cindex link options
6913 @cindex options, linking
6914
6915 These options come into play when the compiler links object files into
6916 an executable output file. They are meaningless if the compiler is
6917 not doing a link step.
6918
6919 @table @gcctabopt
6920 @cindex file names
6921 @item @var{object-file-name}
6922 A file name that does not end in a special recognized suffix is
6923 considered to name an object file or library. (Object files are
6924 distinguished from libraries by the linker according to the file
6925 contents.) If linking is done, these object files are used as input
6926 to the linker.
6927
6928 @item -c
6929 @itemx -S
6930 @itemx -E
6931 @opindex c
6932 @opindex S
6933 @opindex E
6934 If any of these options is used, then the linker is not run, and
6935 object file names should not be used as arguments. @xref{Overall
6936 Options}.
6937
6938 @cindex Libraries
6939 @item -l@var{library}
6940 @itemx -l @var{library}
6941 @opindex l
6942 Search the library named @var{library} when linking. (The second
6943 alternative with the library as a separate argument is only for
6944 POSIX compliance and is not recommended.)
6945
6946 It makes a difference where in the command you write this option; the
6947 linker searches and processes libraries and object files in the order they
6948 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
6949 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
6950 to functions in @samp{z}, those functions may not be loaded.
6951
6952 The linker searches a standard list of directories for the library,
6953 which is actually a file named @file{lib@var{library}.a}. The linker
6954 then uses this file as if it had been specified precisely by name.
6955
6956 The directories searched include several standard system directories
6957 plus any that you specify with @option{-L}.
6958
6959 Normally the files found this way are library files---archive files
6960 whose members are object files. The linker handles an archive file by
6961 scanning through it for members which define symbols that have so far
6962 been referenced but not defined. But if the file that is found is an
6963 ordinary object file, it is linked in the usual fashion. The only
6964 difference between using an @option{-l} option and specifying a file name
6965 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
6966 and searches several directories.
6967
6968 @item -lobjc
6969 @opindex lobjc
6970 You need this special case of the @option{-l} option in order to
6971 link an Objective-C or Objective-C++ program.
6972
6973 @item -nostartfiles
6974 @opindex nostartfiles
6975 Do not use the standard system startup files when linking.
6976 The standard system libraries are used normally, unless @option{-nostdlib}
6977 or @option{-nodefaultlibs} is used.
6978
6979 @item -nodefaultlibs
6980 @opindex nodefaultlibs
6981 Do not use the standard system libraries when linking.
6982 Only the libraries you specify will be passed to the linker.
6983 The standard startup files are used normally, unless @option{-nostartfiles}
6984 is used. The compiler may generate calls to @code{memcmp},
6985 @code{memset}, @code{memcpy} and @code{memmove}.
6986 These entries are usually resolved by entries in
6987 libc. These entry points should be supplied through some other
6988 mechanism when this option is specified.
6989
6990 @item -nostdlib
6991 @opindex nostdlib
6992 Do not use the standard system startup files or libraries when linking.
6993 No startup files and only the libraries you specify will be passed to
6994 the linker. The compiler may generate calls to @code{memcmp}, @code{memset},
6995 @code{memcpy} and @code{memmove}.
6996 These entries are usually resolved by entries in
6997 libc. These entry points should be supplied through some other
6998 mechanism when this option is specified.
6999
7000 @cindex @option{-lgcc}, use with @option{-nostdlib}
7001 @cindex @option{-nostdlib} and unresolved references
7002 @cindex unresolved references and @option{-nostdlib}
7003 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
7004 @cindex @option{-nodefaultlibs} and unresolved references
7005 @cindex unresolved references and @option{-nodefaultlibs}
7006 One of the standard libraries bypassed by @option{-nostdlib} and
7007 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
7008 that GCC uses to overcome shortcomings of particular machines, or special
7009 needs for some languages.
7010 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
7011 Collection (GCC) Internals},
7012 for more discussion of @file{libgcc.a}.)
7013 In most cases, you need @file{libgcc.a} even when you want to avoid
7014 other standard libraries. In other words, when you specify @option{-nostdlib}
7015 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
7016 This ensures that you have no unresolved references to internal GCC
7017 library subroutines. (For example, @samp{__main}, used to ensure C++
7018 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
7019 GNU Compiler Collection (GCC) Internals}.)
7020
7021 @item -pie
7022 @opindex pie
7023 Produce a position independent executable on targets which support it.
7024 For predictable results, you must also specify the same set of options
7025 that were used to generate code (@option{-fpie}, @option{-fPIE},
7026 or model suboptions) when you specify this option.
7027
7028 @item -rdynamic
7029 @opindex rdynamic
7030 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
7031 that support it. This instructs the linker to add all symbols, not
7032 only used ones, to the dynamic symbol table. This option is needed
7033 for some uses of @code{dlopen} or to allow obtaining backtraces
7034 from within a program.
7035
7036 @item -s
7037 @opindex s
7038 Remove all symbol table and relocation information from the executable.
7039
7040 @item -static
7041 @opindex static
7042 On systems that support dynamic linking, this prevents linking with the shared
7043 libraries. On other systems, this option has no effect.
7044
7045 @item -shared
7046 @opindex shared
7047 Produce a shared object which can then be linked with other objects to
7048 form an executable. Not all systems support this option. For predictable
7049 results, you must also specify the same set of options that were used to
7050 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
7051 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
7052 needs to build supplementary stub code for constructors to work. On
7053 multi-libbed systems, @samp{gcc -shared} must select the correct support
7054 libraries to link against. Failing to supply the correct flags may lead
7055 to subtle defects. Supplying them in cases where they are not necessary
7056 is innocuous.}
7057
7058 @item -shared-libgcc
7059 @itemx -static-libgcc
7060 @opindex shared-libgcc
7061 @opindex static-libgcc
7062 On systems that provide @file{libgcc} as a shared library, these options
7063 force the use of either the shared or static version respectively.
7064 If no shared version of @file{libgcc} was built when the compiler was
7065 configured, these options have no effect.
7066
7067 There are several situations in which an application should use the
7068 shared @file{libgcc} instead of the static version. The most common
7069 of these is when the application wishes to throw and catch exceptions
7070 across different shared libraries. In that case, each of the libraries
7071 as well as the application itself should use the shared @file{libgcc}.
7072
7073 Therefore, the G++ and GCJ drivers automatically add
7074 @option{-shared-libgcc} whenever you build a shared library or a main
7075 executable, because C++ and Java programs typically use exceptions, so
7076 this is the right thing to do.
7077
7078 If, instead, you use the GCC driver to create shared libraries, you may
7079 find that they will not always be linked with the shared @file{libgcc}.
7080 If GCC finds, at its configuration time, that you have a non-GNU linker
7081 or a GNU linker that does not support option @option{--eh-frame-hdr},
7082 it will link the shared version of @file{libgcc} into shared libraries
7083 by default. Otherwise, it will take advantage of the linker and optimize
7084 away the linking with the shared version of @file{libgcc}, linking with
7085 the static version of libgcc by default. This allows exceptions to
7086 propagate through such shared libraries, without incurring relocation
7087 costs at library load time.
7088
7089 However, if a library or main executable is supposed to throw or catch
7090 exceptions, you must link it using the G++ or GCJ driver, as appropriate
7091 for the languages used in the program, or using the option
7092 @option{-shared-libgcc}, such that it is linked with the shared
7093 @file{libgcc}.
7094
7095 @item -symbolic
7096 @opindex symbolic
7097 Bind references to global symbols when building a shared object. Warn
7098 about any unresolved references (unless overridden by the link editor
7099 option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
7100 this option.
7101
7102 @item -Xlinker @var{option}
7103 @opindex Xlinker
7104 Pass @var{option} as an option to the linker. You can use this to
7105 supply system-specific linker options which GCC does not know how to
7106 recognize.
7107
7108 If you want to pass an option that takes an argument, you must use
7109 @option{-Xlinker} twice, once for the option and once for the argument.
7110 For example, to pass @option{-assert definitions}, you must write
7111 @samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
7112 @option{-Xlinker "-assert definitions"}, because this passes the entire
7113 string as a single argument, which is not what the linker expects.
7114
7115 @item -Wl,@var{option}
7116 @opindex Wl
7117 Pass @var{option} as an option to the linker. If @var{option} contains
7118 commas, it is split into multiple options at the commas.
7119
7120 @item -u @var{symbol}
7121 @opindex u
7122 Pretend the symbol @var{symbol} is undefined, to force linking of
7123 library modules to define it. You can use @option{-u} multiple times with
7124 different symbols to force loading of additional library modules.
7125 @end table
7126
7127 @node Directory Options
7128 @section Options for Directory Search
7129 @cindex directory options
7130 @cindex options, directory search
7131 @cindex search path
7132
7133 These options specify directories to search for header files, for
7134 libraries and for parts of the compiler:
7135
7136 @table @gcctabopt
7137 @item -I@var{dir}
7138 @opindex I
7139 Add the directory @var{dir} to the head of the list of directories to be
7140 searched for header files. This can be used to override a system header
7141 file, substituting your own version, since these directories are
7142 searched before the system header file directories. However, you should
7143 not use this option to add directories that contain vendor-supplied
7144 system header files (use @option{-isystem} for that). If you use more than
7145 one @option{-I} option, the directories are scanned in left-to-right
7146 order; the standard system directories come after.
7147
7148 If a standard system include directory, or a directory specified with
7149 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
7150 option will be ignored. The directory will still be searched but as a
7151 system directory at its normal position in the system include chain.
7152 This is to ensure that GCC's procedure to fix buggy system headers and
7153 the ordering for the include_next directive are not inadvertently changed.
7154 If you really need to change the search order for system directories,
7155 use the @option{-nostdinc} and/or @option{-isystem} options.
7156
7157 @item -iquote@var{dir}
7158 @opindex iquote
7159 Add the directory @var{dir} to the head of the list of directories to
7160 be searched for header files only for the case of @samp{#include
7161 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
7162 otherwise just like @option{-I}.
7163
7164 @item -L@var{dir}
7165 @opindex L
7166 Add directory @var{dir} to the list of directories to be searched
7167 for @option{-l}.
7168
7169 @item -B@var{prefix}
7170 @opindex B
7171 This option specifies where to find the executables, libraries,
7172 include files, and data files of the compiler itself.
7173
7174 The compiler driver program runs one or more of the subprograms
7175 @file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
7176 @var{prefix} as a prefix for each program it tries to run, both with and
7177 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
7178
7179 For each subprogram to be run, the compiler driver first tries the
7180 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
7181 was not specified, the driver tries two standard prefixes, which are
7182 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
7183 those results in a file name that is found, the unmodified program
7184 name is searched for using the directories specified in your
7185 @env{PATH} environment variable.
7186
7187 The compiler will check to see if the path provided by the @option{-B}
7188 refers to a directory, and if necessary it will add a directory
7189 separator character at the end of the path.
7190
7191 @option{-B} prefixes that effectively specify directory names also apply
7192 to libraries in the linker, because the compiler translates these
7193 options into @option{-L} options for the linker. They also apply to
7194 includes files in the preprocessor, because the compiler translates these
7195 options into @option{-isystem} options for the preprocessor. In this case,
7196 the compiler appends @samp{include} to the prefix.
7197
7198 The run-time support file @file{libgcc.a} can also be searched for using
7199 the @option{-B} prefix, if needed. If it is not found there, the two
7200 standard prefixes above are tried, and that is all. The file is left
7201 out of the link if it is not found by those means.
7202
7203 Another way to specify a prefix much like the @option{-B} prefix is to use
7204 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
7205 Variables}.
7206
7207 As a special kludge, if the path provided by @option{-B} is
7208 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
7209 9, then it will be replaced by @file{[dir/]include}. This is to help
7210 with boot-strapping the compiler.
7211
7212 @item -specs=@var{file}
7213 @opindex specs
7214 Process @var{file} after the compiler reads in the standard @file{specs}
7215 file, in order to override the defaults that the @file{gcc} driver
7216 program uses when determining what switches to pass to @file{cc1},
7217 @file{cc1plus}, @file{as}, @file{ld}, etc. More than one
7218 @option{-specs=@var{file}} can be specified on the command line, and they
7219 are processed in order, from left to right.
7220
7221 @item --sysroot=@var{dir}
7222 @opindex sysroot
7223 Use @var{dir} as the logical root directory for headers and libraries.
7224 For example, if the compiler would normally search for headers in
7225 @file{/usr/include} and libraries in @file{/usr/lib}, it will instead
7226 search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
7227
7228 If you use both this option and the @option{-isysroot} option, then
7229 the @option{--sysroot} option will apply to libraries, but the
7230 @option{-isysroot} option will apply to header files.
7231
7232 The GNU linker (beginning with version 2.16) has the necessary support
7233 for this option. If your linker does not support this option, the
7234 header file aspect of @option{--sysroot} will still work, but the
7235 library aspect will not.
7236
7237 @item -I-
7238 @opindex I-
7239 This option has been deprecated. Please use @option{-iquote} instead for
7240 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
7241 Any directories you specify with @option{-I} options before the @option{-I-}
7242 option are searched only for the case of @samp{#include "@var{file}"};
7243 they are not searched for @samp{#include <@var{file}>}.
7244
7245 If additional directories are specified with @option{-I} options after
7246 the @option{-I-}, these directories are searched for all @samp{#include}
7247 directives. (Ordinarily @emph{all} @option{-I} directories are used
7248 this way.)
7249
7250 In addition, the @option{-I-} option inhibits the use of the current
7251 directory (where the current input file came from) as the first search
7252 directory for @samp{#include "@var{file}"}. There is no way to
7253 override this effect of @option{-I-}. With @option{-I.} you can specify
7254 searching the directory which was current when the compiler was
7255 invoked. That is not exactly the same as what the preprocessor does
7256 by default, but it is often satisfactory.
7257
7258 @option{-I-} does not inhibit the use of the standard system directories
7259 for header files. Thus, @option{-I-} and @option{-nostdinc} are
7260 independent.
7261 @end table
7262
7263 @c man end
7264
7265 @node Spec Files
7266 @section Specifying subprocesses and the switches to pass to them
7267 @cindex Spec Files
7268
7269 @command{gcc} is a driver program. It performs its job by invoking a
7270 sequence of other programs to do the work of compiling, assembling and
7271 linking. GCC interprets its command-line parameters and uses these to
7272 deduce which programs it should invoke, and which command-line options
7273 it ought to place on their command lines. This behavior is controlled
7274 by @dfn{spec strings}. In most cases there is one spec string for each
7275 program that GCC can invoke, but a few programs have multiple spec
7276 strings to control their behavior. The spec strings built into GCC can
7277 be overridden by using the @option{-specs=} command-line switch to specify
7278 a spec file.
7279
7280 @dfn{Spec files} are plaintext files that are used to construct spec
7281 strings. They consist of a sequence of directives separated by blank
7282 lines. The type of directive is determined by the first non-whitespace
7283 character on the line and it can be one of the following:
7284
7285 @table @code
7286 @item %@var{command}
7287 Issues a @var{command} to the spec file processor. The commands that can
7288 appear here are:
7289
7290 @table @code
7291 @item %include <@var{file}>
7292 @cindex %include
7293 Search for @var{file} and insert its text at the current point in the
7294 specs file.
7295
7296 @item %include_noerr <@var{file}>
7297 @cindex %include_noerr
7298 Just like @samp{%include}, but do not generate an error message if the include
7299 file cannot be found.
7300
7301 @item %rename @var{old_name} @var{new_name}
7302 @cindex %rename
7303 Rename the spec string @var{old_name} to @var{new_name}.
7304
7305 @end table
7306
7307 @item *[@var{spec_name}]:
7308 This tells the compiler to create, override or delete the named spec
7309 string. All lines after this directive up to the next directive or
7310 blank line are considered to be the text for the spec string. If this
7311 results in an empty string then the spec will be deleted. (Or, if the
7312 spec did not exist, then nothing will happened.) Otherwise, if the spec
7313 does not currently exist a new spec will be created. If the spec does
7314 exist then its contents will be overridden by the text of this
7315 directive, unless the first character of that text is the @samp{+}
7316 character, in which case the text will be appended to the spec.
7317
7318 @item [@var{suffix}]:
7319 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
7320 and up to the next directive or blank line are considered to make up the
7321 spec string for the indicated suffix. When the compiler encounters an
7322 input file with the named suffix, it will processes the spec string in
7323 order to work out how to compile that file. For example:
7324
7325 @smallexample
7326 .ZZ:
7327 z-compile -input %i
7328 @end smallexample
7329
7330 This says that any input file whose name ends in @samp{.ZZ} should be
7331 passed to the program @samp{z-compile}, which should be invoked with the
7332 command-line switch @option{-input} and with the result of performing the
7333 @samp{%i} substitution. (See below.)
7334
7335 As an alternative to providing a spec string, the text that follows a
7336 suffix directive can be one of the following:
7337
7338 @table @code
7339 @item @@@var{language}
7340 This says that the suffix is an alias for a known @var{language}. This is
7341 similar to using the @option{-x} command-line switch to GCC to specify a
7342 language explicitly. For example:
7343
7344 @smallexample
7345 .ZZ:
7346 @@c++
7347 @end smallexample
7348
7349 Says that .ZZ files are, in fact, C++ source files.
7350
7351 @item #@var{name}
7352 This causes an error messages saying:
7353
7354 @smallexample
7355 @var{name} compiler not installed on this system.
7356 @end smallexample
7357 @end table
7358
7359 GCC already has an extensive list of suffixes built into it.
7360 This directive will add an entry to the end of the list of suffixes, but
7361 since the list is searched from the end backwards, it is effectively
7362 possible to override earlier entries using this technique.
7363
7364 @end table
7365
7366 GCC has the following spec strings built into it. Spec files can
7367 override these strings or create their own. Note that individual
7368 targets can also add their own spec strings to this list.
7369
7370 @smallexample
7371 asm Options to pass to the assembler
7372 asm_final Options to pass to the assembler post-processor
7373 cpp Options to pass to the C preprocessor
7374 cc1 Options to pass to the C compiler
7375 cc1plus Options to pass to the C++ compiler
7376 endfile Object files to include at the end of the link
7377 link Options to pass to the linker
7378 lib Libraries to include on the command line to the linker
7379 libgcc Decides which GCC support library to pass to the linker
7380 linker Sets the name of the linker
7381 predefines Defines to be passed to the C preprocessor
7382 signed_char Defines to pass to CPP to say whether @code{char} is signed
7383 by default
7384 startfile Object files to include at the start of the link
7385 @end smallexample
7386
7387 Here is a small example of a spec file:
7388
7389 @smallexample
7390 %rename lib old_lib
7391
7392 *lib:
7393 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
7394 @end smallexample
7395
7396 This example renames the spec called @samp{lib} to @samp{old_lib} and
7397 then overrides the previous definition of @samp{lib} with a new one.
7398 The new definition adds in some extra command-line options before
7399 including the text of the old definition.
7400
7401 @dfn{Spec strings} are a list of command-line options to be passed to their
7402 corresponding program. In addition, the spec strings can contain
7403 @samp{%}-prefixed sequences to substitute variable text or to
7404 conditionally insert text into the command line. Using these constructs
7405 it is possible to generate quite complex command lines.
7406
7407 Here is a table of all defined @samp{%}-sequences for spec
7408 strings. Note that spaces are not generated automatically around the
7409 results of expanding these sequences. Therefore you can concatenate them
7410 together or combine them with constant text in a single argument.
7411
7412 @table @code
7413 @item %%
7414 Substitute one @samp{%} into the program name or argument.
7415
7416 @item %i
7417 Substitute the name of the input file being processed.
7418
7419 @item %b
7420 Substitute the basename of the input file being processed.
7421 This is the substring up to (and not including) the last period
7422 and not including the directory.
7423
7424 @item %B
7425 This is the same as @samp{%b}, but include the file suffix (text after
7426 the last period).
7427
7428 @item %d
7429 Marks the argument containing or following the @samp{%d} as a
7430 temporary file name, so that that file will be deleted if GCC exits
7431 successfully. Unlike @samp{%g}, this contributes no text to the
7432 argument.
7433
7434 @item %g@var{suffix}
7435 Substitute a file name that has suffix @var{suffix} and is chosen
7436 once per compilation, and mark the argument in the same way as
7437 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
7438 name is now chosen in a way that is hard to predict even when previously
7439 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
7440 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
7441 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
7442 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
7443 was simply substituted with a file name chosen once per compilation,
7444 without regard to any appended suffix (which was therefore treated
7445 just like ordinary text), making such attacks more likely to succeed.
7446
7447 @item %u@var{suffix}
7448 Like @samp{%g}, but generates a new temporary file name even if
7449 @samp{%u@var{suffix}} was already seen.
7450
7451 @item %U@var{suffix}
7452 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
7453 new one if there is no such last file name. In the absence of any
7454 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
7455 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
7456 would involve the generation of two distinct file names, one
7457 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
7458 simply substituted with a file name chosen for the previous @samp{%u},
7459 without regard to any appended suffix.
7460
7461 @item %j@var{suffix}
7462 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
7463 writable, and if save-temps is off; otherwise, substitute the name
7464 of a temporary file, just like @samp{%u}. This temporary file is not
7465 meant for communication between processes, but rather as a junk
7466 disposal mechanism.
7467
7468 @item %|@var{suffix}
7469 @itemx %m@var{suffix}
7470 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
7471 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
7472 all. These are the two most common ways to instruct a program that it
7473 should read from standard input or write to standard output. If you
7474 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
7475 construct: see for example @file{f/lang-specs.h}.
7476
7477 @item %.@var{SUFFIX}
7478 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
7479 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
7480 terminated by the next space or %.
7481
7482 @item %w
7483 Marks the argument containing or following the @samp{%w} as the
7484 designated output file of this compilation. This puts the argument
7485 into the sequence of arguments that @samp{%o} will substitute later.
7486
7487 @item %o
7488 Substitutes the names of all the output files, with spaces
7489 automatically placed around them. You should write spaces
7490 around the @samp{%o} as well or the results are undefined.
7491 @samp{%o} is for use in the specs for running the linker.
7492 Input files whose names have no recognized suffix are not compiled
7493 at all, but they are included among the output files, so they will
7494 be linked.
7495
7496 @item %O
7497 Substitutes the suffix for object files. Note that this is
7498 handled specially when it immediately follows @samp{%g, %u, or %U},
7499 because of the need for those to form complete file names. The
7500 handling is such that @samp{%O} is treated exactly as if it had already
7501 been substituted, except that @samp{%g, %u, and %U} do not currently
7502 support additional @var{suffix} characters following @samp{%O} as they would
7503 following, for example, @samp{.o}.
7504
7505 @item %p
7506 Substitutes the standard macro predefinitions for the
7507 current target machine. Use this when running @code{cpp}.
7508
7509 @item %P
7510 Like @samp{%p}, but puts @samp{__} before and after the name of each
7511 predefined macro, except for macros that start with @samp{__} or with
7512 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
7513 C@.
7514
7515 @item %I
7516 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
7517 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
7518 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
7519 and @option{-imultilib} as necessary.
7520
7521 @item %s
7522 Current argument is the name of a library or startup file of some sort.
7523 Search for that file in a standard list of directories and substitute
7524 the full name found.
7525
7526 @item %e@var{str}
7527 Print @var{str} as an error message. @var{str} is terminated by a newline.
7528 Use this when inconsistent options are detected.
7529
7530 @item %(@var{name})
7531 Substitute the contents of spec string @var{name} at this point.
7532
7533 @item %[@var{name}]
7534 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
7535
7536 @item %x@{@var{option}@}
7537 Accumulate an option for @samp{%X}.
7538
7539 @item %X
7540 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
7541 spec string.
7542
7543 @item %Y
7544 Output the accumulated assembler options specified by @option{-Wa}.
7545
7546 @item %Z
7547 Output the accumulated preprocessor options specified by @option{-Wp}.
7548
7549 @item %a
7550 Process the @code{asm} spec. This is used to compute the
7551 switches to be passed to the assembler.
7552
7553 @item %A
7554 Process the @code{asm_final} spec. This is a spec string for
7555 passing switches to an assembler post-processor, if such a program is
7556 needed.
7557
7558 @item %l
7559 Process the @code{link} spec. This is the spec for computing the
7560 command line passed to the linker. Typically it will make use of the
7561 @samp{%L %G %S %D and %E} sequences.
7562
7563 @item %D
7564 Dump out a @option{-L} option for each directory that GCC believes might
7565 contain startup files. If the target supports multilibs then the
7566 current multilib directory will be prepended to each of these paths.
7567
7568 @item %L
7569 Process the @code{lib} spec. This is a spec string for deciding which
7570 libraries should be included on the command line to the linker.
7571
7572 @item %G
7573 Process the @code{libgcc} spec. This is a spec string for deciding
7574 which GCC support library should be included on the command line to the linker.
7575
7576 @item %S
7577 Process the @code{startfile} spec. This is a spec for deciding which
7578 object files should be the first ones passed to the linker. Typically
7579 this might be a file named @file{crt0.o}.
7580
7581 @item %E
7582 Process the @code{endfile} spec. This is a spec string that specifies
7583 the last object files that will be passed to the linker.
7584
7585 @item %C
7586 Process the @code{cpp} spec. This is used to construct the arguments
7587 to be passed to the C preprocessor.
7588
7589 @item %1
7590 Process the @code{cc1} spec. This is used to construct the options to be
7591 passed to the actual C compiler (@samp{cc1}).
7592
7593 @item %2
7594 Process the @code{cc1plus} spec. This is used to construct the options to be
7595 passed to the actual C++ compiler (@samp{cc1plus}).
7596
7597 @item %*
7598 Substitute the variable part of a matched option. See below.
7599 Note that each comma in the substituted string is replaced by
7600 a single space.
7601
7602 @item %<@code{S}
7603 Remove all occurrences of @code{-S} from the command line. Note---this
7604 command is position dependent. @samp{%} commands in the spec string
7605 before this one will see @code{-S}, @samp{%} commands in the spec string
7606 after this one will not.
7607
7608 @item %:@var{function}(@var{args})
7609 Call the named function @var{function}, passing it @var{args}.
7610 @var{args} is first processed as a nested spec string, then split
7611 into an argument vector in the usual fashion. The function returns
7612 a string which is processed as if it had appeared literally as part
7613 of the current spec.
7614
7615 The following built-in spec functions are provided:
7616
7617 @table @code
7618 @item @code{getenv}
7619 The @code{getenv} spec function takes two arguments: an environment
7620 variable name and a string. If the environment variable is not
7621 defined, a fatal error is issued. Otherwise, the return value is the
7622 value of the environment variable concatenated with the string. For
7623 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
7624
7625 @smallexample
7626 %:getenv(TOPDIR /include)
7627 @end smallexample
7628
7629 expands to @file{/path/to/top/include}.
7630
7631 @item @code{if-exists}
7632 The @code{if-exists} spec function takes one argument, an absolute
7633 pathname to a file. If the file exists, @code{if-exists} returns the
7634 pathname. Here is a small example of its usage:
7635
7636 @smallexample
7637 *startfile:
7638 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
7639 @end smallexample
7640
7641 @item @code{if-exists-else}
7642 The @code{if-exists-else} spec function is similar to the @code{if-exists}
7643 spec function, except that it takes two arguments. The first argument is
7644 an absolute pathname to a file. If the file exists, @code{if-exists-else}
7645 returns the pathname. If it does not exist, it returns the second argument.
7646 This way, @code{if-exists-else} can be used to select one file or another,
7647 based on the existence of the first. Here is a small example of its usage:
7648
7649 @smallexample
7650 *startfile:
7651 crt0%O%s %:if-exists(crti%O%s) \
7652 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
7653 @end smallexample
7654
7655 @item @code{replace-outfile}
7656 The @code{replace-outfile} spec function takes two arguments. It looks for the
7657 first argument in the outfiles array and replaces it with the second argument. Here
7658 is a small example of its usage:
7659
7660 @smallexample
7661 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
7662 @end smallexample
7663
7664 @end table
7665
7666 @item %@{@code{S}@}
7667 Substitutes the @code{-S} switch, if that switch was given to GCC@.
7668 If that switch was not specified, this substitutes nothing. Note that
7669 the leading dash is omitted when specifying this option, and it is
7670 automatically inserted if the substitution is performed. Thus the spec
7671 string @samp{%@{foo@}} would match the command-line option @option{-foo}
7672 and would output the command line option @option{-foo}.
7673
7674 @item %W@{@code{S}@}
7675 Like %@{@code{S}@} but mark last argument supplied within as a file to be
7676 deleted on failure.
7677
7678 @item %@{@code{S}*@}
7679 Substitutes all the switches specified to GCC whose names start
7680 with @code{-S}, but which also take an argument. This is used for
7681 switches like @option{-o}, @option{-D}, @option{-I}, etc.
7682 GCC considers @option{-o foo} as being
7683 one switch whose names starts with @samp{o}. %@{o*@} would substitute this
7684 text, including the space. Thus two arguments would be generated.
7685
7686 @item %@{@code{S}*&@code{T}*@}
7687 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
7688 (the order of @code{S} and @code{T} in the spec is not significant).
7689 There can be any number of ampersand-separated variables; for each the
7690 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
7691
7692 @item %@{@code{S}:@code{X}@}
7693 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
7694
7695 @item %@{!@code{S}:@code{X}@}
7696 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
7697
7698 @item %@{@code{S}*:@code{X}@}
7699 Substitutes @code{X} if one or more switches whose names start with
7700 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
7701 once, no matter how many such switches appeared. However, if @code{%*}
7702 appears somewhere in @code{X}, then @code{X} will be substituted once
7703 for each matching switch, with the @code{%*} replaced by the part of
7704 that switch that matched the @code{*}.
7705
7706 @item %@{.@code{S}:@code{X}@}
7707 Substitutes @code{X}, if processing a file with suffix @code{S}.
7708
7709 @item %@{!.@code{S}:@code{X}@}
7710 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
7711
7712 @item %@{,@code{S}:@code{X}@}
7713 Substitutes @code{X}, if processing a file for language @code{S}.
7714
7715 @item %@{!,@code{S}:@code{X}@}
7716 Substitutes @code{X}, if not processing a file for language @code{S}.
7717
7718 @item %@{@code{S}|@code{P}:@code{X}@}
7719 Substitutes @code{X} if either @code{-S} or @code{-P} was given to
7720 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
7721 @code{*} sequences as well, although they have a stronger binding than
7722 the @samp{|}. If @code{%*} appears in @code{X}, all of the
7723 alternatives must be starred, and only the first matching alternative
7724 is substituted.
7725
7726 For example, a spec string like this:
7727
7728 @smallexample
7729 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
7730 @end smallexample
7731
7732 will output the following command-line options from the following input
7733 command-line options:
7734
7735 @smallexample
7736 fred.c -foo -baz
7737 jim.d -bar -boggle
7738 -d fred.c -foo -baz -boggle
7739 -d jim.d -bar -baz -boggle
7740 @end smallexample
7741
7742 @item %@{S:X; T:Y; :D@}
7743
7744 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
7745 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
7746 be as many clauses as you need. This may be combined with @code{.},
7747 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
7748
7749
7750 @end table
7751
7752 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
7753 construct may contain other nested @samp{%} constructs or spaces, or
7754 even newlines. They are processed as usual, as described above.
7755 Trailing white space in @code{X} is ignored. White space may also
7756 appear anywhere on the left side of the colon in these constructs,
7757 except between @code{.} or @code{*} and the corresponding word.
7758
7759 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
7760 handled specifically in these constructs. If another value of
7761 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
7762 @option{-W} switch is found later in the command line, the earlier
7763 switch value is ignored, except with @{@code{S}*@} where @code{S} is
7764 just one letter, which passes all matching options.
7765
7766 The character @samp{|} at the beginning of the predicate text is used to
7767 indicate that a command should be piped to the following command, but
7768 only if @option{-pipe} is specified.
7769
7770 It is built into GCC which switches take arguments and which do not.
7771 (You might think it would be useful to generalize this to allow each
7772 compiler's spec to say which switches take arguments. But this cannot
7773 be done in a consistent fashion. GCC cannot even decide which input
7774 files have been specified without knowing which switches take arguments,
7775 and it must know which input files to compile in order to tell which
7776 compilers to run).
7777
7778 GCC also knows implicitly that arguments starting in @option{-l} are to be
7779 treated as compiler output files, and passed to the linker in their
7780 proper position among the other output files.
7781
7782 @c man begin OPTIONS
7783
7784 @node Target Options
7785 @section Specifying Target Machine and Compiler Version
7786 @cindex target options
7787 @cindex cross compiling
7788 @cindex specifying machine version
7789 @cindex specifying compiler version and target machine
7790 @cindex compiler version, specifying
7791 @cindex target machine, specifying
7792
7793 The usual way to run GCC is to run the executable called @file{gcc}, or
7794 @file{<machine>-gcc} when cross-compiling, or
7795 @file{<machine>-gcc-<version>} to run a version other than the one that
7796 was installed last. Sometimes this is inconvenient, so GCC provides
7797 options that will switch to another cross-compiler or version.
7798
7799 @table @gcctabopt
7800 @item -b @var{machine}
7801 @opindex b
7802 The argument @var{machine} specifies the target machine for compilation.
7803
7804 The value to use for @var{machine} is the same as was specified as the
7805 machine type when configuring GCC as a cross-compiler. For
7806 example, if a cross-compiler was configured with @samp{configure
7807 arm-elf}, meaning to compile for an arm processor with elf binaries,
7808 then you would specify @option{-b arm-elf} to run that cross compiler.
7809 Because there are other options beginning with @option{-b}, the
7810 configuration must contain a hyphen.
7811
7812 @item -V @var{version}
7813 @opindex V
7814 The argument @var{version} specifies which version of GCC to run.
7815 This is useful when multiple versions are installed. For example,
7816 @var{version} might be @samp{4.0}, meaning to run GCC version 4.0.
7817 @end table
7818
7819 The @option{-V} and @option{-b} options work by running the
7820 @file{<machine>-gcc-<version>} executable, so there's no real reason to
7821 use them if you can just run that directly.
7822
7823 @node Submodel Options
7824 @section Hardware Models and Configurations
7825 @cindex submodel options
7826 @cindex specifying hardware config
7827 @cindex hardware models and configurations, specifying
7828 @cindex machine dependent options
7829
7830 Earlier we discussed the standard option @option{-b} which chooses among
7831 different installed compilers for completely different target
7832 machines, such as VAX vs.@: 68000 vs.@: 80386.
7833
7834 In addition, each of these target machine types can have its own
7835 special options, starting with @samp{-m}, to choose among various
7836 hardware models or configurations---for example, 68010 vs 68020,
7837 floating coprocessor or none. A single installed version of the
7838 compiler can compile for any model or configuration, according to the
7839 options specified.
7840
7841 Some configurations of the compiler also support additional special
7842 options, usually for compatibility with other compilers on the same
7843 platform.
7844
7845 @c This list is ordered alphanumerically by subsection name.
7846 @c It should be the same order and spelling as these options are listed
7847 @c in Machine Dependent Options
7848
7849 @menu
7850 * ARC Options::
7851 * ARM Options::
7852 * AVR Options::
7853 * Blackfin Options::
7854 * CRIS Options::
7855 * CRX Options::
7856 * Darwin Options::
7857 * DEC Alpha Options::
7858 * DEC Alpha/VMS Options::
7859 * FRV Options::
7860 * GNU/Linux Options::
7861 * H8/300 Options::
7862 * HPPA Options::
7863 * i386 and x86-64 Options::
7864 * IA-64 Options::
7865 * M32C Options::
7866 * M32R/D Options::
7867 * M680x0 Options::
7868 * M68hc1x Options::
7869 * MCore Options::
7870 * MIPS Options::
7871 * MMIX Options::
7872 * MN10300 Options::
7873 * MT Options::
7874 * PDP-11 Options::
7875 * PowerPC Options::
7876 * RS/6000 and PowerPC Options::
7877 * S/390 and zSeries Options::
7878 * Score Options::
7879 * SH Options::
7880 * SPARC Options::
7881 * SPU Options::
7882 * System V Options::
7883 * TMS320C3x/C4x Options::
7884 * V850 Options::
7885 * VAX Options::
7886 * VxWorks Options::
7887 * x86-64 Options::
7888 * Xstormy16 Options::
7889 * Xtensa Options::
7890 * zSeries Options::
7891 @end menu
7892
7893 @node ARC Options
7894 @subsection ARC Options
7895 @cindex ARC Options
7896
7897 These options are defined for ARC implementations:
7898
7899 @table @gcctabopt
7900 @item -EL
7901 @opindex EL
7902 Compile code for little endian mode. This is the default.
7903
7904 @item -EB
7905 @opindex EB
7906 Compile code for big endian mode.
7907
7908 @item -mmangle-cpu
7909 @opindex mmangle-cpu
7910 Prepend the name of the cpu to all public symbol names.
7911 In multiple-processor systems, there are many ARC variants with different
7912 instruction and register set characteristics. This flag prevents code
7913 compiled for one cpu to be linked with code compiled for another.
7914 No facility exists for handling variants that are ``almost identical''.
7915 This is an all or nothing option.
7916
7917 @item -mcpu=@var{cpu}
7918 @opindex mcpu
7919 Compile code for ARC variant @var{cpu}.
7920 Which variants are supported depend on the configuration.
7921 All variants support @option{-mcpu=base}, this is the default.
7922
7923 @item -mtext=@var{text-section}
7924 @itemx -mdata=@var{data-section}
7925 @itemx -mrodata=@var{readonly-data-section}
7926 @opindex mtext
7927 @opindex mdata
7928 @opindex mrodata
7929 Put functions, data, and readonly data in @var{text-section},
7930 @var{data-section}, and @var{readonly-data-section} respectively
7931 by default. This can be overridden with the @code{section} attribute.
7932 @xref{Variable Attributes}.
7933
7934 @end table
7935
7936 @node ARM Options
7937 @subsection ARM Options
7938 @cindex ARM options
7939
7940 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
7941 architectures:
7942
7943 @table @gcctabopt
7944 @item -mabi=@var{name}
7945 @opindex mabi
7946 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
7947 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
7948
7949 @item -mapcs-frame
7950 @opindex mapcs-frame
7951 Generate a stack frame that is compliant with the ARM Procedure Call
7952 Standard for all functions, even if this is not strictly necessary for
7953 correct execution of the code. Specifying @option{-fomit-frame-pointer}
7954 with this option will cause the stack frames not to be generated for
7955 leaf functions. The default is @option{-mno-apcs-frame}.
7956
7957 @item -mapcs
7958 @opindex mapcs
7959 This is a synonym for @option{-mapcs-frame}.
7960
7961 @ignore
7962 @c not currently implemented
7963 @item -mapcs-stack-check
7964 @opindex mapcs-stack-check
7965 Generate code to check the amount of stack space available upon entry to
7966 every function (that actually uses some stack space). If there is
7967 insufficient space available then either the function
7968 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
7969 called, depending upon the amount of stack space required. The run time
7970 system is required to provide these functions. The default is
7971 @option{-mno-apcs-stack-check}, since this produces smaller code.
7972
7973 @c not currently implemented
7974 @item -mapcs-float
7975 @opindex mapcs-float
7976 Pass floating point arguments using the float point registers. This is
7977 one of the variants of the APCS@. This option is recommended if the
7978 target hardware has a floating point unit or if a lot of floating point
7979 arithmetic is going to be performed by the code. The default is
7980 @option{-mno-apcs-float}, since integer only code is slightly increased in
7981 size if @option{-mapcs-float} is used.
7982
7983 @c not currently implemented
7984 @item -mapcs-reentrant
7985 @opindex mapcs-reentrant
7986 Generate reentrant, position independent code. The default is
7987 @option{-mno-apcs-reentrant}.
7988 @end ignore
7989
7990 @item -mthumb-interwork
7991 @opindex mthumb-interwork
7992 Generate code which supports calling between the ARM and Thumb
7993 instruction sets. Without this option the two instruction sets cannot
7994 be reliably used inside one program. The default is
7995 @option{-mno-thumb-interwork}, since slightly larger code is generated
7996 when @option{-mthumb-interwork} is specified.
7997
7998 @item -mno-sched-prolog
7999 @opindex mno-sched-prolog
8000 Prevent the reordering of instructions in the function prolog, or the
8001 merging of those instruction with the instructions in the function's
8002 body. This means that all functions will start with a recognizable set
8003 of instructions (or in fact one of a choice from a small set of
8004 different function prologues), and this information can be used to
8005 locate the start if functions inside an executable piece of code. The
8006 default is @option{-msched-prolog}.
8007
8008 @item -mhard-float
8009 @opindex mhard-float
8010 Generate output containing floating point instructions. This is the
8011 default.
8012
8013 @item -msoft-float
8014 @opindex msoft-float
8015 Generate output containing library calls for floating point.
8016 @strong{Warning:} the requisite libraries are not available for all ARM
8017 targets. Normally the facilities of the machine's usual C compiler are
8018 used, but this cannot be done directly in cross-compilation. You must make
8019 your own arrangements to provide suitable library functions for
8020 cross-compilation.
8021
8022 @option{-msoft-float} changes the calling convention in the output file;
8023 therefore, it is only useful if you compile @emph{all} of a program with
8024 this option. In particular, you need to compile @file{libgcc.a}, the
8025 library that comes with GCC, with @option{-msoft-float} in order for
8026 this to work.
8027
8028 @item -mfloat-abi=@var{name}
8029 @opindex mfloat-abi
8030 Specifies which ABI to use for floating point values. Permissible values
8031 are: @samp{soft}, @samp{softfp} and @samp{hard}.
8032
8033 @samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
8034 and @option{-mhard-float} respectively. @samp{softfp} allows the generation
8035 of floating point instructions, but still uses the soft-float calling
8036 conventions.
8037
8038 @item -mlittle-endian
8039 @opindex mlittle-endian
8040 Generate code for a processor running in little-endian mode. This is
8041 the default for all standard configurations.
8042
8043 @item -mbig-endian
8044 @opindex mbig-endian
8045 Generate code for a processor running in big-endian mode; the default is
8046 to compile code for a little-endian processor.
8047
8048 @item -mwords-little-endian
8049 @opindex mwords-little-endian
8050 This option only applies when generating code for big-endian processors.
8051 Generate code for a little-endian word order but a big-endian byte
8052 order. That is, a byte order of the form @samp{32107654}. Note: this
8053 option should only be used if you require compatibility with code for
8054 big-endian ARM processors generated by versions of the compiler prior to
8055 2.8.
8056
8057 @item -mcpu=@var{name}
8058 @opindex mcpu
8059 This specifies the name of the target ARM processor. GCC uses this name
8060 to determine what kind of instructions it can emit when generating
8061 assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
8062 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
8063 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
8064 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
8065 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
8066 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
8067 @samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
8068 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
8069 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
8070 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
8071 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
8072 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
8073 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
8074 @samp{arm1156t2-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
8075 @samp{cortex-a8}, @samp{cortex-r4}, @samp{cortex-m3},
8076 @samp{xscale}, @samp{iwmmxt}, @samp{ep9312}.
8077
8078 @itemx -mtune=@var{name}
8079 @opindex mtune
8080 This option is very similar to the @option{-mcpu=} option, except that
8081 instead of specifying the actual target processor type, and hence
8082 restricting which instructions can be used, it specifies that GCC should
8083 tune the performance of the code as if the target were of the type
8084 specified in this option, but still choosing the instructions that it
8085 will generate based on the cpu specified by a @option{-mcpu=} option.
8086 For some ARM implementations better performance can be obtained by using
8087 this option.
8088
8089 @item -march=@var{name}
8090 @opindex march
8091 This specifies the name of the target ARM architecture. GCC uses this
8092 name to determine what kind of instructions it can emit when generating
8093 assembly code. This option can be used in conjunction with or instead
8094 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
8095 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
8096 @samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
8097 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv7}, @samp{armv7-a},
8098 @samp{armv7-r}, @samp{armv7-m}, @samp{iwmmxt}, @samp{ep9312}.
8099
8100 @item -mfpu=@var{name}
8101 @itemx -mfpe=@var{number}
8102 @itemx -mfp=@var{number}
8103 @opindex mfpu
8104 @opindex mfpe
8105 @opindex mfp
8106 This specifies what floating point hardware (or hardware emulation) is
8107 available on the target. Permissible names are: @samp{fpa}, @samp{fpe2},
8108 @samp{fpe3}, @samp{maverick}, @samp{vfp}. @option{-mfp} and @option{-mfpe}
8109 are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
8110 with older versions of GCC@.
8111
8112 If @option{-msoft-float} is specified this specifies the format of
8113 floating point values.
8114
8115 @item -mstructure-size-boundary=@var{n}
8116 @opindex mstructure-size-boundary
8117 The size of all structures and unions will be rounded up to a multiple
8118 of the number of bits set by this option. Permissible values are 8, 32
8119 and 64. The default value varies for different toolchains. For the COFF
8120 targeted toolchain the default value is 8. A value of 64 is only allowed
8121 if the underlying ABI supports it.
8122
8123 Specifying the larger number can produce faster, more efficient code, but
8124 can also increase the size of the program. Different values are potentially
8125 incompatible. Code compiled with one value cannot necessarily expect to
8126 work with code or libraries compiled with another value, if they exchange
8127 information using structures or unions.
8128
8129 @item -mabort-on-noreturn
8130 @opindex mabort-on-noreturn
8131 Generate a call to the function @code{abort} at the end of a
8132 @code{noreturn} function. It will be executed if the function tries to
8133 return.
8134
8135 @item -mlong-calls
8136 @itemx -mno-long-calls
8137 @opindex mlong-calls
8138 @opindex mno-long-calls
8139 Tells the compiler to perform function calls by first loading the
8140 address of the function into a register and then performing a subroutine
8141 call on this register. This switch is needed if the target function
8142 will lie outside of the 64 megabyte addressing range of the offset based
8143 version of subroutine call instruction.
8144
8145 Even if this switch is enabled, not all function calls will be turned
8146 into long calls. The heuristic is that static functions, functions
8147 which have the @samp{short-call} attribute, functions that are inside
8148 the scope of a @samp{#pragma no_long_calls} directive and functions whose
8149 definitions have already been compiled within the current compilation
8150 unit, will not be turned into long calls. The exception to this rule is
8151 that weak function definitions, functions with the @samp{long-call}
8152 attribute or the @samp{section} attribute, and functions that are within
8153 the scope of a @samp{#pragma long_calls} directive, will always be
8154 turned into long calls.
8155
8156 This feature is not enabled by default. Specifying
8157 @option{-mno-long-calls} will restore the default behavior, as will
8158 placing the function calls within the scope of a @samp{#pragma
8159 long_calls_off} directive. Note these switches have no effect on how
8160 the compiler generates code to handle function calls via function
8161 pointers.
8162
8163 @item -mnop-fun-dllimport
8164 @opindex mnop-fun-dllimport
8165 Disable support for the @code{dllimport} attribute.
8166
8167 @item -msingle-pic-base
8168 @opindex msingle-pic-base
8169 Treat the register used for PIC addressing as read-only, rather than
8170 loading it in the prologue for each function. The run-time system is
8171 responsible for initializing this register with an appropriate value
8172 before execution begins.
8173
8174 @item -mpic-register=@var{reg}
8175 @opindex mpic-register
8176 Specify the register to be used for PIC addressing. The default is R10
8177 unless stack-checking is enabled, when R9 is used.
8178
8179 @item -mcirrus-fix-invalid-insns
8180 @opindex mcirrus-fix-invalid-insns
8181 @opindex mno-cirrus-fix-invalid-insns
8182 Insert NOPs into the instruction stream to in order to work around
8183 problems with invalid Maverick instruction combinations. This option
8184 is only valid if the @option{-mcpu=ep9312} option has been used to
8185 enable generation of instructions for the Cirrus Maverick floating
8186 point co-processor. This option is not enabled by default, since the
8187 problem is only present in older Maverick implementations. The default
8188 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
8189 switch.
8190
8191 @item -mpoke-function-name
8192 @opindex mpoke-function-name
8193 Write the name of each function into the text section, directly
8194 preceding the function prologue. The generated code is similar to this:
8195
8196 @smallexample
8197 t0
8198 .ascii "arm_poke_function_name", 0
8199 .align
8200 t1
8201 .word 0xff000000 + (t1 - t0)
8202 arm_poke_function_name
8203 mov ip, sp
8204 stmfd sp!, @{fp, ip, lr, pc@}
8205 sub fp, ip, #4
8206 @end smallexample
8207
8208 When performing a stack backtrace, code can inspect the value of
8209 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
8210 location @code{pc - 12} and the top 8 bits are set, then we know that
8211 there is a function name embedded immediately preceding this location
8212 and has length @code{((pc[-3]) & 0xff000000)}.
8213
8214 @item -mthumb
8215 @opindex mthumb
8216 Generate code for the Thumb instruction set. The default is to
8217 use the 32-bit ARM instruction set.
8218 This option automatically enables either 16-bit Thumb-1 or
8219 mixed 16/32-bit Thumb-2 instructions based on the @option{-mcpu=@var{name}}
8220 and @option{-march=@var{name}} options.
8221
8222 @item -mtpcs-frame
8223 @opindex mtpcs-frame
8224 Generate a stack frame that is compliant with the Thumb Procedure Call
8225 Standard for all non-leaf functions. (A leaf function is one that does
8226 not call any other functions.) The default is @option{-mno-tpcs-frame}.
8227
8228 @item -mtpcs-leaf-frame
8229 @opindex mtpcs-leaf-frame
8230 Generate a stack frame that is compliant with the Thumb Procedure Call
8231 Standard for all leaf functions. (A leaf function is one that does
8232 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
8233
8234 @item -mcallee-super-interworking
8235 @opindex mcallee-super-interworking
8236 Gives all externally visible functions in the file being compiled an ARM
8237 instruction set header which switches to Thumb mode before executing the
8238 rest of the function. This allows these functions to be called from
8239 non-interworking code.
8240
8241 @item -mcaller-super-interworking
8242 @opindex mcaller-super-interworking
8243 Allows calls via function pointers (including virtual functions) to
8244 execute correctly regardless of whether the target code has been
8245 compiled for interworking or not. There is a small overhead in the cost
8246 of executing a function pointer if this option is enabled.
8247
8248 @item -mtp=@var{name}
8249 @opindex mtp
8250 Specify the access model for the thread local storage pointer. The valid
8251 models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
8252 @option{cp15}, which fetches the thread pointer from @code{cp15} directly
8253 (supported in the arm6k architecture), and @option{auto}, which uses the
8254 best available method for the selected processor. The default setting is
8255 @option{auto}.
8256
8257 @end table
8258
8259 @node AVR Options
8260 @subsection AVR Options
8261 @cindex AVR Options
8262
8263 These options are defined for AVR implementations:
8264
8265 @table @gcctabopt
8266 @item -mmcu=@var{mcu}
8267 @opindex mmcu
8268 Specify ATMEL AVR instruction set or MCU type.
8269
8270 Instruction set avr1 is for the minimal AVR core, not supported by the C
8271 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
8272 attiny11, attiny12, attiny15, attiny28).
8273
8274 Instruction set avr2 (default) is for the classic AVR core with up to
8275 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
8276 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
8277 at90c8534, at90s8535).
8278
8279 Instruction set avr3 is for the classic AVR core with up to 128K program
8280 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
8281
8282 Instruction set avr4 is for the enhanced AVR core with up to 8K program
8283 memory space (MCU types: atmega8, atmega83, atmega85).
8284
8285 Instruction set avr5 is for the enhanced AVR core with up to 128K program
8286 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
8287 atmega64, atmega128, at43usb355, at94k).
8288
8289 @item -msize
8290 @opindex msize
8291 Output instruction sizes to the asm file.
8292
8293 @item -minit-stack=@var{N}
8294 @opindex minit-stack
8295 Specify the initial stack address, which may be a symbol or numeric value,
8296 @samp{__stack} is the default.
8297
8298 @item -mno-interrupts
8299 @opindex mno-interrupts
8300 Generated code is not compatible with hardware interrupts.
8301 Code size will be smaller.
8302
8303 @item -mcall-prologues
8304 @opindex mcall-prologues
8305 Functions prologues/epilogues expanded as call to appropriate
8306 subroutines. Code size will be smaller.
8307
8308 @item -mno-tablejump
8309 @opindex mno-tablejump
8310 Do not generate tablejump insns which sometimes increase code size.
8311
8312 @item -mtiny-stack
8313 @opindex mtiny-stack
8314 Change only the low 8 bits of the stack pointer.
8315
8316 @item -mint8
8317 @opindex mint8
8318 Assume int to be 8 bit integer. This affects the sizes of all types: A
8319 char will be 1 byte, an int will be 1 byte, an long will be 2 bytes
8320 and long long will be 4 bytes. Please note that this option does not
8321 comply to the C standards, but it will provide you with smaller code
8322 size.
8323 @end table
8324
8325 @node Blackfin Options
8326 @subsection Blackfin Options
8327 @cindex Blackfin Options
8328
8329 @table @gcctabopt
8330 @item -momit-leaf-frame-pointer
8331 @opindex momit-leaf-frame-pointer
8332 Don't keep the frame pointer in a register for leaf functions. This
8333 avoids the instructions to save, set up and restore frame pointers and
8334 makes an extra register available in leaf functions. The option
8335 @option{-fomit-frame-pointer} removes the frame pointer for all functions
8336 which might make debugging harder.
8337
8338 @item -mspecld-anomaly
8339 @opindex mspecld-anomaly
8340 When enabled, the compiler will ensure that the generated code does not
8341 contain speculative loads after jump instructions. This option is enabled
8342 by default.
8343
8344 @item -mno-specld-anomaly
8345 @opindex mno-specld-anomaly
8346 Don't generate extra code to prevent speculative loads from occurring.
8347
8348 @item -mcsync-anomaly
8349 @opindex mcsync-anomaly
8350 When enabled, the compiler will ensure that the generated code does not
8351 contain CSYNC or SSYNC instructions too soon after conditional branches.
8352 This option is enabled by default.
8353
8354 @item -mno-csync-anomaly
8355 @opindex mno-csync-anomaly
8356 Don't generate extra code to prevent CSYNC or SSYNC instructions from
8357 occurring too soon after a conditional branch.
8358
8359 @item -mlow-64k
8360 @opindex mlow-64k
8361 When enabled, the compiler is free to take advantage of the knowledge that
8362 the entire program fits into the low 64k of memory.
8363
8364 @item -mno-low-64k
8365 @opindex mno-low-64k
8366 Assume that the program is arbitrarily large. This is the default.
8367
8368 @item -mstack-check-l1
8369 @opindex mstack-check-l1
8370 Do stack checking using information placed into L1 scratchpad memory by the
8371 uClinux kernel.
8372
8373 @item -mid-shared-library
8374 @opindex mid-shared-library
8375 Generate code that supports shared libraries via the library ID method.
8376 This allows for execute in place and shared libraries in an environment
8377 without virtual memory management. This option implies @option{-fPIC}.
8378
8379 @item -mno-id-shared-library
8380 @opindex mno-id-shared-library
8381 Generate code that doesn't assume ID based shared libraries are being used.
8382 This is the default.
8383
8384 @item -mleaf-id-shared-library
8385 @opindex mleaf-id-shared-library
8386 Generate code that supports shared libraries via the library ID method,
8387 but assumes that this library or executable won't link against any other
8388 ID shared libraries. That allows the compiler to use faster code for jumps
8389 and calls.
8390
8391 @item -mno-leaf-id-shared-library
8392 @opindex mno-leaf-id-shared-library
8393 Do not assume that the code being compiled won't link against any ID shared
8394 libraries. Slower code will be generated for jump and call insns.
8395
8396 @item -mshared-library-id=n
8397 @opindex mshared-library-id
8398 Specified the identification number of the ID based shared library being
8399 compiled. Specifying a value of 0 will generate more compact code, specifying
8400 other values will force the allocation of that number to the current
8401 library but is no more space or time efficient than omitting this option.
8402
8403 @item -msep-data
8404 @opindex msep-data
8405 Generate code that allows the data segment to be located in a different
8406 area of memory from the text segment. This allows for execute in place in
8407 an environment without virtual memory management by eliminating relocations
8408 against the text section.
8409
8410 @item -mno-sep-data
8411 @opindex mno-sep-data
8412 Generate code that assumes that the data segment follows the text segment.
8413 This is the default.
8414
8415 @item -mlong-calls
8416 @itemx -mno-long-calls
8417 @opindex mlong-calls
8418 @opindex mno-long-calls
8419 Tells the compiler to perform function calls by first loading the
8420 address of the function into a register and then performing a subroutine
8421 call on this register. This switch is needed if the target function
8422 will lie outside of the 24 bit addressing range of the offset based
8423 version of subroutine call instruction.
8424
8425 This feature is not enabled by default. Specifying
8426 @option{-mno-long-calls} will restore the default behavior. Note these
8427 switches have no effect on how the compiler generates code to handle
8428 function calls via function pointers.
8429 @end table
8430
8431 @node CRIS Options
8432 @subsection CRIS Options
8433 @cindex CRIS Options
8434
8435 These options are defined specifically for the CRIS ports.
8436
8437 @table @gcctabopt
8438 @item -march=@var{architecture-type}
8439 @itemx -mcpu=@var{architecture-type}
8440 @opindex march
8441 @opindex mcpu
8442 Generate code for the specified architecture. The choices for
8443 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
8444 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
8445 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
8446 @samp{v10}.
8447
8448 @item -mtune=@var{architecture-type}
8449 @opindex mtune
8450 Tune to @var{architecture-type} everything applicable about the generated
8451 code, except for the ABI and the set of available instructions. The
8452 choices for @var{architecture-type} are the same as for
8453 @option{-march=@var{architecture-type}}.
8454
8455 @item -mmax-stack-frame=@var{n}
8456 @opindex mmax-stack-frame
8457 Warn when the stack frame of a function exceeds @var{n} bytes.
8458
8459 @item -melinux-stacksize=@var{n}
8460 @opindex melinux-stacksize
8461 Only available with the @samp{cris-axis-aout} target. Arranges for
8462 indications in the program to the kernel loader that the stack of the
8463 program should be set to @var{n} bytes.
8464
8465 @item -metrax4
8466 @itemx -metrax100
8467 @opindex metrax4
8468 @opindex metrax100
8469 The options @option{-metrax4} and @option{-metrax100} are synonyms for
8470 @option{-march=v3} and @option{-march=v8} respectively.
8471
8472 @item -mmul-bug-workaround
8473 @itemx -mno-mul-bug-workaround
8474 @opindex mmul-bug-workaround
8475 @opindex mno-mul-bug-workaround
8476 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
8477 models where it applies. This option is active by default.
8478
8479 @item -mpdebug
8480 @opindex mpdebug
8481 Enable CRIS-specific verbose debug-related information in the assembly
8482 code. This option also has the effect to turn off the @samp{#NO_APP}
8483 formatted-code indicator to the assembler at the beginning of the
8484 assembly file.
8485
8486 @item -mcc-init
8487 @opindex mcc-init
8488 Do not use condition-code results from previous instruction; always emit
8489 compare and test instructions before use of condition codes.
8490
8491 @item -mno-side-effects
8492 @opindex mno-side-effects
8493 Do not emit instructions with side-effects in addressing modes other than
8494 post-increment.
8495
8496 @item -mstack-align
8497 @itemx -mno-stack-align
8498 @itemx -mdata-align
8499 @itemx -mno-data-align
8500 @itemx -mconst-align
8501 @itemx -mno-const-align
8502 @opindex mstack-align
8503 @opindex mno-stack-align
8504 @opindex mdata-align
8505 @opindex mno-data-align
8506 @opindex mconst-align
8507 @opindex mno-const-align
8508 These options (no-options) arranges (eliminate arrangements) for the
8509 stack-frame, individual data and constants to be aligned for the maximum
8510 single data access size for the chosen CPU model. The default is to
8511 arrange for 32-bit alignment. ABI details such as structure layout are
8512 not affected by these options.
8513
8514 @item -m32-bit
8515 @itemx -m16-bit
8516 @itemx -m8-bit
8517 @opindex m32-bit
8518 @opindex m16-bit
8519 @opindex m8-bit
8520 Similar to the stack- data- and const-align options above, these options
8521 arrange for stack-frame, writable data and constants to all be 32-bit,
8522 16-bit or 8-bit aligned. The default is 32-bit alignment.
8523
8524 @item -mno-prologue-epilogue
8525 @itemx -mprologue-epilogue
8526 @opindex mno-prologue-epilogue
8527 @opindex mprologue-epilogue
8528 With @option{-mno-prologue-epilogue}, the normal function prologue and
8529 epilogue that sets up the stack-frame are omitted and no return
8530 instructions or return sequences are generated in the code. Use this
8531 option only together with visual inspection of the compiled code: no
8532 warnings or errors are generated when call-saved registers must be saved,
8533 or storage for local variable needs to be allocated.
8534
8535 @item -mno-gotplt
8536 @itemx -mgotplt
8537 @opindex mno-gotplt
8538 @opindex mgotplt
8539 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
8540 instruction sequences that load addresses for functions from the PLT part
8541 of the GOT rather than (traditional on other architectures) calls to the
8542 PLT@. The default is @option{-mgotplt}.
8543
8544 @item -maout
8545 @opindex maout
8546 Legacy no-op option only recognized with the cris-axis-aout target.
8547
8548 @item -melf
8549 @opindex melf
8550 Legacy no-op option only recognized with the cris-axis-elf and
8551 cris-axis-linux-gnu targets.
8552
8553 @item -melinux
8554 @opindex melinux
8555 Only recognized with the cris-axis-aout target, where it selects a
8556 GNU/linux-like multilib, include files and instruction set for
8557 @option{-march=v8}.
8558
8559 @item -mlinux
8560 @opindex mlinux
8561 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
8562
8563 @item -sim
8564 @opindex sim
8565 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
8566 to link with input-output functions from a simulator library. Code,
8567 initialized data and zero-initialized data are allocated consecutively.
8568
8569 @item -sim2
8570 @opindex sim2
8571 Like @option{-sim}, but pass linker options to locate initialized data at
8572 0x40000000 and zero-initialized data at 0x80000000.
8573 @end table
8574
8575 @node CRX Options
8576 @subsection CRX Options
8577 @cindex CRX Options
8578
8579 These options are defined specifically for the CRX ports.
8580
8581 @table @gcctabopt
8582
8583 @item -mmac
8584 @opindex mmac
8585 Enable the use of multiply-accumulate instructions. Disabled by default.
8586
8587 @item -mpush-args
8588 @opindex mpush-args
8589 Push instructions will be used to pass outgoing arguments when functions
8590 are called. Enabled by default.
8591 @end table
8592
8593 @node Darwin Options
8594 @subsection Darwin Options
8595 @cindex Darwin options
8596
8597 These options are defined for all architectures running the Darwin operating
8598 system.
8599
8600 FSF GCC on Darwin does not create ``fat'' object files; it will create
8601 an object file for the single architecture that it was built to
8602 target. Apple's GCC on Darwin does create ``fat'' files if multiple
8603 @option{-arch} options are used; it does so by running the compiler or
8604 linker multiple times and joining the results together with
8605 @file{lipo}.
8606
8607 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
8608 @samp{i686}) is determined by the flags that specify the ISA
8609 that GCC is targetting, like @option{-mcpu} or @option{-march}. The
8610 @option{-force_cpusubtype_ALL} option can be used to override this.
8611
8612 The Darwin tools vary in their behavior when presented with an ISA
8613 mismatch. The assembler, @file{as}, will only permit instructions to
8614 be used that are valid for the subtype of the file it is generating,
8615 so you cannot put 64-bit instructions in an @samp{ppc750} object file.
8616 The linker for shared libraries, @file{/usr/bin/libtool}, will fail
8617 and print an error if asked to create a shared library with a less
8618 restrictive subtype than its input files (for instance, trying to put
8619 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
8620 for executables, @file{ld}, will quietly give the executable the most
8621 restrictive subtype of any of its input files.
8622
8623 @table @gcctabopt
8624 @item -F@var{dir}
8625 @opindex F
8626 Add the framework directory @var{dir} to the head of the list of
8627 directories to be searched for header files. These directories are
8628 interleaved with those specified by @option{-I} options and are
8629 scanned in a left-to-right order.
8630
8631 A framework directory is a directory with frameworks in it. A
8632 framework is a directory with a @samp{"Headers"} and/or
8633 @samp{"PrivateHeaders"} directory contained directly in it that ends
8634 in @samp{".framework"}. The name of a framework is the name of this
8635 directory excluding the @samp{".framework"}. Headers associated with
8636 the framework are found in one of those two directories, with
8637 @samp{"Headers"} being searched first. A subframework is a framework
8638 directory that is in a framework's @samp{"Frameworks"} directory.
8639 Includes of subframework headers can only appear in a header of a
8640 framework that contains the subframework, or in a sibling subframework
8641 header. Two subframeworks are siblings if they occur in the same
8642 framework. A subframework should not have the same name as a
8643 framework, a warning will be issued if this is violated. Currently a
8644 subframework cannot have subframeworks, in the future, the mechanism
8645 may be extended to support this. The standard frameworks can be found
8646 in @samp{"/System/Library/Frameworks"} and
8647 @samp{"/Library/Frameworks"}. An example include looks like
8648 @code{#include <Framework/header.h>}, where @samp{Framework} denotes
8649 the name of the framework and header.h is found in the
8650 @samp{"PrivateHeaders"} or @samp{"Headers"} directory.
8651
8652 @item -iframework@var{dir}
8653 @opindex iframework
8654 Like @option{-F} except the directory is a treated as a system
8655 directory. The main difference between this @option{-iframework} and
8656 @option{-F} is that with @option{-iframework} the compiler does not
8657 warn about constructs contained within header files found via
8658 @var{dir}. This option is valid only for the C family of languages.
8659
8660 @item -gused
8661 @opindex gused
8662 Emit debugging information for symbols that are used. For STABS
8663 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
8664 This is by default ON@.
8665
8666 @item -gfull
8667 @opindex gfull
8668 Emit debugging information for all symbols and types.
8669
8670 @item -mmacosx-version-min=@var{version}
8671 The earliest version of MacOS X that this executable will run on
8672 is @var{version}. Typical values of @var{version} include @code{10.1},
8673 @code{10.2}, and @code{10.3.9}.
8674
8675 The default for this option is to make choices that seem to be most
8676 useful.
8677
8678 @item -mkernel
8679 @opindex mkernel
8680 Enable kernel development mode. The @option{-mkernel} option sets
8681 @option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
8682 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
8683 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
8684 applicable. This mode also sets @option{-mno-altivec},
8685 @option{-msoft-float}, @option{-fno-builtin} and
8686 @option{-mlong-branch} for PowerPC targets.
8687
8688 @item -mone-byte-bool
8689 @opindex mone-byte-bool
8690 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
8691 By default @samp{sizeof(bool)} is @samp{4} when compiling for
8692 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
8693 option has no effect on x86.
8694
8695 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
8696 to generate code that is not binary compatible with code generated
8697 without that switch. Using this switch may require recompiling all
8698 other modules in a program, including system libraries. Use this
8699 switch to conform to a non-default data model.
8700
8701 @item -mfix-and-continue
8702 @itemx -ffix-and-continue
8703 @itemx -findirect-data
8704 @opindex mfix-and-continue
8705 @opindex ffix-and-continue
8706 @opindex findirect-data
8707 Generate code suitable for fast turn around development. Needed to
8708 enable gdb to dynamically load @code{.o} files into already running
8709 programs. @option{-findirect-data} and @option{-ffix-and-continue}
8710 are provided for backwards compatibility.
8711
8712 @item -all_load
8713 @opindex all_load
8714 Loads all members of static archive libraries.
8715 See man ld(1) for more information.
8716
8717 @item -arch_errors_fatal
8718 @opindex arch_errors_fatal
8719 Cause the errors having to do with files that have the wrong architecture
8720 to be fatal.
8721
8722 @item -bind_at_load
8723 @opindex bind_at_load
8724 Causes the output file to be marked such that the dynamic linker will
8725 bind all undefined references when the file is loaded or launched.
8726
8727 @item -bundle
8728 @opindex bundle
8729 Produce a Mach-o bundle format file.
8730 See man ld(1) for more information.
8731
8732 @item -bundle_loader @var{executable}
8733 @opindex bundle_loader
8734 This option specifies the @var{executable} that will be loading the build
8735 output file being linked. See man ld(1) for more information.
8736
8737 @item -dynamiclib
8738 @opindex dynamiclib
8739 When passed this option, GCC will produce a dynamic library instead of
8740 an executable when linking, using the Darwin @file{libtool} command.
8741
8742 @item -force_cpusubtype_ALL
8743 @opindex force_cpusubtype_ALL
8744 This causes GCC's output file to have the @var{ALL} subtype, instead of
8745 one controlled by the @option{-mcpu} or @option{-march} option.
8746
8747 @item -allowable_client @var{client_name}
8748 @itemx -client_name
8749 @itemx -compatibility_version
8750 @itemx -current_version
8751 @itemx -dead_strip
8752 @itemx -dependency-file
8753 @itemx -dylib_file
8754 @itemx -dylinker_install_name
8755 @itemx -dynamic
8756 @itemx -exported_symbols_list
8757 @itemx -filelist
8758 @itemx -flat_namespace
8759 @itemx -force_flat_namespace
8760 @itemx -headerpad_max_install_names
8761 @itemx -image_base
8762 @itemx -init
8763 @itemx -install_name
8764 @itemx -keep_private_externs
8765 @itemx -multi_module
8766 @itemx -multiply_defined
8767 @itemx -multiply_defined_unused
8768 @itemx -noall_load
8769 @itemx -no_dead_strip_inits_and_terms
8770 @itemx -nofixprebinding
8771 @itemx -nomultidefs
8772 @itemx -noprebind
8773 @itemx -noseglinkedit
8774 @itemx -pagezero_size
8775 @itemx -prebind
8776 @itemx -prebind_all_twolevel_modules
8777 @itemx -private_bundle
8778 @itemx -read_only_relocs
8779 @itemx -sectalign
8780 @itemx -sectobjectsymbols
8781 @itemx -whyload
8782 @itemx -seg1addr
8783 @itemx -sectcreate
8784 @itemx -sectobjectsymbols
8785 @itemx -sectorder
8786 @itemx -segaddr
8787 @itemx -segs_read_only_addr
8788 @itemx -segs_read_write_addr
8789 @itemx -seg_addr_table
8790 @itemx -seg_addr_table_filename
8791 @itemx -seglinkedit
8792 @itemx -segprot
8793 @itemx -segs_read_only_addr
8794 @itemx -segs_read_write_addr
8795 @itemx -single_module
8796 @itemx -static
8797 @itemx -sub_library
8798 @itemx -sub_umbrella
8799 @itemx -twolevel_namespace
8800 @itemx -umbrella
8801 @itemx -undefined
8802 @itemx -unexported_symbols_list
8803 @itemx -weak_reference_mismatches
8804 @itemx -whatsloaded
8805
8806 @opindex allowable_client
8807 @opindex client_name
8808 @opindex compatibility_version
8809 @opindex current_version
8810 @opindex dead_strip
8811 @opindex dependency-file
8812 @opindex dylib_file
8813 @opindex dylinker_install_name
8814 @opindex dynamic
8815 @opindex exported_symbols_list
8816 @opindex filelist
8817 @opindex flat_namespace
8818 @opindex force_flat_namespace
8819 @opindex headerpad_max_install_names
8820 @opindex image_base
8821 @opindex init
8822 @opindex install_name
8823 @opindex keep_private_externs
8824 @opindex multi_module
8825 @opindex multiply_defined
8826 @opindex multiply_defined_unused
8827 @opindex noall_load
8828 @opindex no_dead_strip_inits_and_terms
8829 @opindex nofixprebinding
8830 @opindex nomultidefs
8831 @opindex noprebind
8832 @opindex noseglinkedit
8833 @opindex pagezero_size
8834 @opindex prebind
8835 @opindex prebind_all_twolevel_modules
8836 @opindex private_bundle
8837 @opindex read_only_relocs
8838 @opindex sectalign
8839 @opindex sectobjectsymbols
8840 @opindex whyload
8841 @opindex seg1addr
8842 @opindex sectcreate
8843 @opindex sectobjectsymbols
8844 @opindex sectorder
8845 @opindex segaddr
8846 @opindex segs_read_only_addr
8847 @opindex segs_read_write_addr
8848 @opindex seg_addr_table
8849 @opindex seg_addr_table_filename
8850 @opindex seglinkedit
8851 @opindex segprot
8852 @opindex segs_read_only_addr
8853 @opindex segs_read_write_addr
8854 @opindex single_module
8855 @opindex static
8856 @opindex sub_library
8857 @opindex sub_umbrella
8858 @opindex twolevel_namespace
8859 @opindex umbrella
8860 @opindex undefined
8861 @opindex unexported_symbols_list
8862 @opindex weak_reference_mismatches
8863 @opindex whatsloaded
8864
8865 These options are passed to the Darwin linker. The Darwin linker man page
8866 describes them in detail.
8867 @end table
8868
8869 @node DEC Alpha Options
8870 @subsection DEC Alpha Options
8871
8872 These @samp{-m} options are defined for the DEC Alpha implementations:
8873
8874 @table @gcctabopt
8875 @item -mno-soft-float
8876 @itemx -msoft-float
8877 @opindex mno-soft-float
8878 @opindex msoft-float
8879 Use (do not use) the hardware floating-point instructions for
8880 floating-point operations. When @option{-msoft-float} is specified,
8881 functions in @file{libgcc.a} will be used to perform floating-point
8882 operations. Unless they are replaced by routines that emulate the
8883 floating-point operations, or compiled in such a way as to call such
8884 emulations routines, these routines will issue floating-point
8885 operations. If you are compiling for an Alpha without floating-point
8886 operations, you must ensure that the library is built so as not to call
8887 them.
8888
8889 Note that Alpha implementations without floating-point operations are
8890 required to have floating-point registers.
8891
8892 @item -mfp-reg
8893 @itemx -mno-fp-regs
8894 @opindex mfp-reg
8895 @opindex mno-fp-regs
8896 Generate code that uses (does not use) the floating-point register set.
8897 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
8898 register set is not used, floating point operands are passed in integer
8899 registers as if they were integers and floating-point results are passed
8900 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
8901 so any function with a floating-point argument or return value called by code
8902 compiled with @option{-mno-fp-regs} must also be compiled with that
8903 option.
8904
8905 A typical use of this option is building a kernel that does not use,
8906 and hence need not save and restore, any floating-point registers.
8907
8908 @item -mieee
8909 @opindex mieee
8910 The Alpha architecture implements floating-point hardware optimized for
8911 maximum performance. It is mostly compliant with the IEEE floating
8912 point standard. However, for full compliance, software assistance is
8913 required. This option generates code fully IEEE compliant code
8914 @emph{except} that the @var{inexact-flag} is not maintained (see below).
8915 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8916 defined during compilation. The resulting code is less efficient but is
8917 able to correctly support denormalized numbers and exceptional IEEE
8918 values such as not-a-number and plus/minus infinity. Other Alpha
8919 compilers call this option @option{-ieee_with_no_inexact}.
8920
8921 @item -mieee-with-inexact
8922 @opindex mieee-with-inexact
8923 This is like @option{-mieee} except the generated code also maintains
8924 the IEEE @var{inexact-flag}. Turning on this option causes the
8925 generated code to implement fully-compliant IEEE math. In addition to
8926 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8927 macro. On some Alpha implementations the resulting code may execute
8928 significantly slower than the code generated by default. Since there is
8929 very little code that depends on the @var{inexact-flag}, you should
8930 normally not specify this option. Other Alpha compilers call this
8931 option @option{-ieee_with_inexact}.
8932
8933 @item -mfp-trap-mode=@var{trap-mode}
8934 @opindex mfp-trap-mode
8935 This option controls what floating-point related traps are enabled.
8936 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8937 The trap mode can be set to one of four values:
8938
8939 @table @samp
8940 @item n
8941 This is the default (normal) setting. The only traps that are enabled
8942 are the ones that cannot be disabled in software (e.g., division by zero
8943 trap).
8944
8945 @item u
8946 In addition to the traps enabled by @samp{n}, underflow traps are enabled
8947 as well.
8948
8949 @item su
8950 Like @samp{u}, but the instructions are marked to be safe for software
8951 completion (see Alpha architecture manual for details).
8952
8953 @item sui
8954 Like @samp{su}, but inexact traps are enabled as well.
8955 @end table
8956
8957 @item -mfp-rounding-mode=@var{rounding-mode}
8958 @opindex mfp-rounding-mode
8959 Selects the IEEE rounding mode. Other Alpha compilers call this option
8960 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
8961 of:
8962
8963 @table @samp
8964 @item n
8965 Normal IEEE rounding mode. Floating point numbers are rounded towards
8966 the nearest machine number or towards the even machine number in case
8967 of a tie.
8968
8969 @item m
8970 Round towards minus infinity.
8971
8972 @item c
8973 Chopped rounding mode. Floating point numbers are rounded towards zero.
8974
8975 @item d
8976 Dynamic rounding mode. A field in the floating point control register
8977 (@var{fpcr}, see Alpha architecture reference manual) controls the
8978 rounding mode in effect. The C library initializes this register for
8979 rounding towards plus infinity. Thus, unless your program modifies the
8980 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8981 @end table
8982
8983 @item -mtrap-precision=@var{trap-precision}
8984 @opindex mtrap-precision
8985 In the Alpha architecture, floating point traps are imprecise. This
8986 means without software assistance it is impossible to recover from a
8987 floating trap and program execution normally needs to be terminated.
8988 GCC can generate code that can assist operating system trap handlers
8989 in determining the exact location that caused a floating point trap.
8990 Depending on the requirements of an application, different levels of
8991 precisions can be selected:
8992
8993 @table @samp
8994 @item p
8995 Program precision. This option is the default and means a trap handler
8996 can only identify which program caused a floating point exception.
8997
8998 @item f
8999 Function precision. The trap handler can determine the function that
9000 caused a floating point exception.
9001
9002 @item i
9003 Instruction precision. The trap handler can determine the exact
9004 instruction that caused a floating point exception.
9005 @end table
9006
9007 Other Alpha compilers provide the equivalent options called
9008 @option{-scope_safe} and @option{-resumption_safe}.
9009
9010 @item -mieee-conformant
9011 @opindex mieee-conformant
9012 This option marks the generated code as IEEE conformant. You must not
9013 use this option unless you also specify @option{-mtrap-precision=i} and either
9014 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
9015 is to emit the line @samp{.eflag 48} in the function prologue of the
9016 generated assembly file. Under DEC Unix, this has the effect that
9017 IEEE-conformant math library routines will be linked in.
9018
9019 @item -mbuild-constants
9020 @opindex mbuild-constants
9021 Normally GCC examines a 32- or 64-bit integer constant to
9022 see if it can construct it from smaller constants in two or three
9023 instructions. If it cannot, it will output the constant as a literal and
9024 generate code to load it from the data segment at runtime.
9025
9026 Use this option to require GCC to construct @emph{all} integer constants
9027 using code, even if it takes more instructions (the maximum is six).
9028
9029 You would typically use this option to build a shared library dynamic
9030 loader. Itself a shared library, it must relocate itself in memory
9031 before it can find the variables and constants in its own data segment.
9032
9033 @item -malpha-as
9034 @itemx -mgas
9035 @opindex malpha-as
9036 @opindex mgas
9037 Select whether to generate code to be assembled by the vendor-supplied
9038 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
9039
9040 @item -mbwx
9041 @itemx -mno-bwx
9042 @itemx -mcix
9043 @itemx -mno-cix
9044 @itemx -mfix
9045 @itemx -mno-fix
9046 @itemx -mmax
9047 @itemx -mno-max
9048 @opindex mbwx
9049 @opindex mno-bwx
9050 @opindex mcix
9051 @opindex mno-cix
9052 @opindex mfix
9053 @opindex mno-fix
9054 @opindex mmax
9055 @opindex mno-max
9056 Indicate whether GCC should generate code to use the optional BWX,
9057 CIX, FIX and MAX instruction sets. The default is to use the instruction
9058 sets supported by the CPU type specified via @option{-mcpu=} option or that
9059 of the CPU on which GCC was built if none was specified.
9060
9061 @item -mfloat-vax
9062 @itemx -mfloat-ieee
9063 @opindex mfloat-vax
9064 @opindex mfloat-ieee
9065 Generate code that uses (does not use) VAX F and G floating point
9066 arithmetic instead of IEEE single and double precision.
9067
9068 @item -mexplicit-relocs
9069 @itemx -mno-explicit-relocs
9070 @opindex mexplicit-relocs
9071 @opindex mno-explicit-relocs
9072 Older Alpha assemblers provided no way to generate symbol relocations
9073 except via assembler macros. Use of these macros does not allow
9074 optimal instruction scheduling. GNU binutils as of version 2.12
9075 supports a new syntax that allows the compiler to explicitly mark
9076 which relocations should apply to which instructions. This option
9077 is mostly useful for debugging, as GCC detects the capabilities of
9078 the assembler when it is built and sets the default accordingly.
9079
9080 @item -msmall-data
9081 @itemx -mlarge-data
9082 @opindex msmall-data
9083 @opindex mlarge-data
9084 When @option{-mexplicit-relocs} is in effect, static data is
9085 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
9086 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
9087 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
9088 16-bit relocations off of the @code{$gp} register. This limits the
9089 size of the small data area to 64KB, but allows the variables to be
9090 directly accessed via a single instruction.
9091
9092 The default is @option{-mlarge-data}. With this option the data area
9093 is limited to just below 2GB@. Programs that require more than 2GB of
9094 data must use @code{malloc} or @code{mmap} to allocate the data in the
9095 heap instead of in the program's data segment.
9096
9097 When generating code for shared libraries, @option{-fpic} implies
9098 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
9099
9100 @item -msmall-text
9101 @itemx -mlarge-text
9102 @opindex msmall-text
9103 @opindex mlarge-text
9104 When @option{-msmall-text} is used, the compiler assumes that the
9105 code of the entire program (or shared library) fits in 4MB, and is
9106 thus reachable with a branch instruction. When @option{-msmall-data}
9107 is used, the compiler can assume that all local symbols share the
9108 same @code{$gp} value, and thus reduce the number of instructions
9109 required for a function call from 4 to 1.
9110
9111 The default is @option{-mlarge-text}.
9112
9113 @item -mcpu=@var{cpu_type}
9114 @opindex mcpu
9115 Set the instruction set and instruction scheduling parameters for
9116 machine type @var{cpu_type}. You can specify either the @samp{EV}
9117 style name or the corresponding chip number. GCC supports scheduling
9118 parameters for the EV4, EV5 and EV6 family of processors and will
9119 choose the default values for the instruction set from the processor
9120 you specify. If you do not specify a processor type, GCC will default
9121 to the processor on which the compiler was built.
9122
9123 Supported values for @var{cpu_type} are
9124
9125 @table @samp
9126 @item ev4
9127 @itemx ev45
9128 @itemx 21064
9129 Schedules as an EV4 and has no instruction set extensions.
9130
9131 @item ev5
9132 @itemx 21164
9133 Schedules as an EV5 and has no instruction set extensions.
9134
9135 @item ev56
9136 @itemx 21164a
9137 Schedules as an EV5 and supports the BWX extension.
9138
9139 @item pca56
9140 @itemx 21164pc
9141 @itemx 21164PC
9142 Schedules as an EV5 and supports the BWX and MAX extensions.
9143
9144 @item ev6
9145 @itemx 21264
9146 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
9147
9148 @item ev67
9149 @itemx 21264a
9150 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
9151 @end table
9152
9153 @item -mtune=@var{cpu_type}
9154 @opindex mtune
9155 Set only the instruction scheduling parameters for machine type
9156 @var{cpu_type}. The instruction set is not changed.
9157
9158 @item -mmemory-latency=@var{time}
9159 @opindex mmemory-latency
9160 Sets the latency the scheduler should assume for typical memory
9161 references as seen by the application. This number is highly
9162 dependent on the memory access patterns used by the application
9163 and the size of the external cache on the machine.
9164
9165 Valid options for @var{time} are
9166
9167 @table @samp
9168 @item @var{number}
9169 A decimal number representing clock cycles.
9170
9171 @item L1
9172 @itemx L2
9173 @itemx L3
9174 @itemx main
9175 The compiler contains estimates of the number of clock cycles for
9176 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
9177 (also called Dcache, Scache, and Bcache), as well as to main memory.
9178 Note that L3 is only valid for EV5.
9179
9180 @end table
9181 @end table
9182
9183 @node DEC Alpha/VMS Options
9184 @subsection DEC Alpha/VMS Options
9185
9186 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
9187
9188 @table @gcctabopt
9189 @item -mvms-return-codes
9190 @opindex mvms-return-codes
9191 Return VMS condition codes from main. The default is to return POSIX
9192 style condition (e.g.@ error) codes.
9193 @end table
9194
9195 @node FRV Options
9196 @subsection FRV Options
9197 @cindex FRV Options
9198
9199 @table @gcctabopt
9200 @item -mgpr-32
9201 @opindex mgpr-32
9202
9203 Only use the first 32 general purpose registers.
9204
9205 @item -mgpr-64
9206 @opindex mgpr-64
9207
9208 Use all 64 general purpose registers.
9209
9210 @item -mfpr-32
9211 @opindex mfpr-32
9212
9213 Use only the first 32 floating point registers.
9214
9215 @item -mfpr-64
9216 @opindex mfpr-64
9217
9218 Use all 64 floating point registers
9219
9220 @item -mhard-float
9221 @opindex mhard-float
9222
9223 Use hardware instructions for floating point operations.
9224
9225 @item -msoft-float
9226 @opindex msoft-float
9227
9228 Use library routines for floating point operations.
9229
9230 @item -malloc-cc
9231 @opindex malloc-cc
9232
9233 Dynamically allocate condition code registers.
9234
9235 @item -mfixed-cc
9236 @opindex mfixed-cc
9237
9238 Do not try to dynamically allocate condition code registers, only
9239 use @code{icc0} and @code{fcc0}.
9240
9241 @item -mdword
9242 @opindex mdword
9243
9244 Change ABI to use double word insns.
9245
9246 @item -mno-dword
9247 @opindex mno-dword
9248
9249 Do not use double word instructions.
9250
9251 @item -mdouble
9252 @opindex mdouble
9253
9254 Use floating point double instructions.
9255
9256 @item -mno-double
9257 @opindex mno-double
9258
9259 Do not use floating point double instructions.
9260
9261 @item -mmedia
9262 @opindex mmedia
9263
9264 Use media instructions.
9265
9266 @item -mno-media
9267 @opindex mno-media
9268
9269 Do not use media instructions.
9270
9271 @item -mmuladd
9272 @opindex mmuladd
9273
9274 Use multiply and add/subtract instructions.
9275
9276 @item -mno-muladd
9277 @opindex mno-muladd
9278
9279 Do not use multiply and add/subtract instructions.
9280
9281 @item -mfdpic
9282 @opindex mfdpic
9283
9284 Select the FDPIC ABI, that uses function descriptors to represent
9285 pointers to functions. Without any PIC/PIE-related options, it
9286 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
9287 assumes GOT entries and small data are within a 12-bit range from the
9288 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
9289 are computed with 32 bits.
9290
9291 @item -minline-plt
9292 @opindex minline-plt
9293
9294 Enable inlining of PLT entries in function calls to functions that are
9295 not known to bind locally. It has no effect without @option{-mfdpic}.
9296 It's enabled by default if optimizing for speed and compiling for
9297 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
9298 optimization option such as @option{-O3} or above is present in the
9299 command line.
9300
9301 @item -mTLS
9302 @opindex TLS
9303
9304 Assume a large TLS segment when generating thread-local code.
9305
9306 @item -mtls
9307 @opindex tls
9308
9309 Do not assume a large TLS segment when generating thread-local code.
9310
9311 @item -mgprel-ro
9312 @opindex mgprel-ro
9313
9314 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
9315 that is known to be in read-only sections. It's enabled by default,
9316 except for @option{-fpic} or @option{-fpie}: even though it may help
9317 make the global offset table smaller, it trades 1 instruction for 4.
9318 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
9319 one of which may be shared by multiple symbols, and it avoids the need
9320 for a GOT entry for the referenced symbol, so it's more likely to be a
9321 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
9322
9323 @item -multilib-library-pic
9324 @opindex multilib-library-pic
9325
9326 Link with the (library, not FD) pic libraries. It's implied by
9327 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
9328 @option{-fpic} without @option{-mfdpic}. You should never have to use
9329 it explicitly.
9330
9331 @item -mlinked-fp
9332 @opindex mlinked-fp
9333
9334 Follow the EABI requirement of always creating a frame pointer whenever
9335 a stack frame is allocated. This option is enabled by default and can
9336 be disabled with @option{-mno-linked-fp}.
9337
9338 @item -mlong-calls
9339 @opindex mlong-calls
9340
9341 Use indirect addressing to call functions outside the current
9342 compilation unit. This allows the functions to be placed anywhere
9343 within the 32-bit address space.
9344
9345 @item -malign-labels
9346 @opindex malign-labels
9347
9348 Try to align labels to an 8-byte boundary by inserting nops into the
9349 previous packet. This option only has an effect when VLIW packing
9350 is enabled. It doesn't create new packets; it merely adds nops to
9351 existing ones.
9352
9353 @item -mlibrary-pic
9354 @opindex mlibrary-pic
9355
9356 Generate position-independent EABI code.
9357
9358 @item -macc-4
9359 @opindex macc-4
9360
9361 Use only the first four media accumulator registers.
9362
9363 @item -macc-8
9364 @opindex macc-8
9365
9366 Use all eight media accumulator registers.
9367
9368 @item -mpack
9369 @opindex mpack
9370
9371 Pack VLIW instructions.
9372
9373 @item -mno-pack
9374 @opindex mno-pack
9375
9376 Do not pack VLIW instructions.
9377
9378 @item -mno-eflags
9379 @opindex mno-eflags
9380
9381 Do not mark ABI switches in e_flags.
9382
9383 @item -mcond-move
9384 @opindex mcond-move
9385
9386 Enable the use of conditional-move instructions (default).
9387
9388 This switch is mainly for debugging the compiler and will likely be removed
9389 in a future version.
9390
9391 @item -mno-cond-move
9392 @opindex mno-cond-move
9393
9394 Disable the use of conditional-move instructions.
9395
9396 This switch is mainly for debugging the compiler and will likely be removed
9397 in a future version.
9398
9399 @item -mscc
9400 @opindex mscc
9401
9402 Enable the use of conditional set instructions (default).
9403
9404 This switch is mainly for debugging the compiler and will likely be removed
9405 in a future version.
9406
9407 @item -mno-scc
9408 @opindex mno-scc
9409
9410 Disable the use of conditional set instructions.
9411
9412 This switch is mainly for debugging the compiler and will likely be removed
9413 in a future version.
9414
9415 @item -mcond-exec
9416 @opindex mcond-exec
9417
9418 Enable the use of conditional execution (default).
9419
9420 This switch is mainly for debugging the compiler and will likely be removed
9421 in a future version.
9422
9423 @item -mno-cond-exec
9424 @opindex mno-cond-exec
9425
9426 Disable the use of conditional execution.
9427
9428 This switch is mainly for debugging the compiler and will likely be removed
9429 in a future version.
9430
9431 @item -mvliw-branch
9432 @opindex mvliw-branch
9433
9434 Run a pass to pack branches into VLIW instructions (default).
9435
9436 This switch is mainly for debugging the compiler and will likely be removed
9437 in a future version.
9438
9439 @item -mno-vliw-branch
9440 @opindex mno-vliw-branch
9441
9442 Do not run a pass to pack branches into VLIW instructions.
9443
9444 This switch is mainly for debugging the compiler and will likely be removed
9445 in a future version.
9446
9447 @item -mmulti-cond-exec
9448 @opindex mmulti-cond-exec
9449
9450 Enable optimization of @code{&&} and @code{||} in conditional execution
9451 (default).
9452
9453 This switch is mainly for debugging the compiler and will likely be removed
9454 in a future version.
9455
9456 @item -mno-multi-cond-exec
9457 @opindex mno-multi-cond-exec
9458
9459 Disable optimization of @code{&&} and @code{||} in conditional execution.
9460
9461 This switch is mainly for debugging the compiler and will likely be removed
9462 in a future version.
9463
9464 @item -mnested-cond-exec
9465 @opindex mnested-cond-exec
9466
9467 Enable nested conditional execution optimizations (default).
9468
9469 This switch is mainly for debugging the compiler and will likely be removed
9470 in a future version.
9471
9472 @item -mno-nested-cond-exec
9473 @opindex mno-nested-cond-exec
9474
9475 Disable nested conditional execution optimizations.
9476
9477 This switch is mainly for debugging the compiler and will likely be removed
9478 in a future version.
9479
9480 @item -moptimize-membar
9481 @opindex moptimize-membar
9482
9483 This switch removes redundant @code{membar} instructions from the
9484 compiler generated code. It is enabled by default.
9485
9486 @item -mno-optimize-membar
9487 @opindex mno-optimize-membar
9488
9489 This switch disables the automatic removal of redundant @code{membar}
9490 instructions from the generated code.
9491
9492 @item -mtomcat-stats
9493 @opindex mtomcat-stats
9494
9495 Cause gas to print out tomcat statistics.
9496
9497 @item -mcpu=@var{cpu}
9498 @opindex mcpu
9499
9500 Select the processor type for which to generate code. Possible values are
9501 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
9502 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
9503
9504 @end table
9505
9506 @node GNU/Linux Options
9507 @subsection GNU/Linux Options
9508
9509 These @samp{-m} options are defined for GNU/Linux targets:
9510
9511 @table @gcctabopt
9512 @item -mglibc
9513 @opindex mglibc
9514 Use the GNU C library instead of uClibc. This is the default except
9515 on @samp{*-*-linux-*uclibc*} targets.
9516
9517 @item -muclibc
9518 @opindex muclibc
9519 Use uClibc instead of the GNU C library. This is the default on
9520 @samp{*-*-linux-*uclibc*} targets.
9521 @end table
9522
9523 @node H8/300 Options
9524 @subsection H8/300 Options
9525
9526 These @samp{-m} options are defined for the H8/300 implementations:
9527
9528 @table @gcctabopt
9529 @item -mrelax
9530 @opindex mrelax
9531 Shorten some address references at link time, when possible; uses the
9532 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
9533 ld, Using ld}, for a fuller description.
9534
9535 @item -mh
9536 @opindex mh
9537 Generate code for the H8/300H@.
9538
9539 @item -ms
9540 @opindex ms
9541 Generate code for the H8S@.
9542
9543 @item -mn
9544 @opindex mn
9545 Generate code for the H8S and H8/300H in the normal mode. This switch
9546 must be used either with @option{-mh} or @option{-ms}.
9547
9548 @item -ms2600
9549 @opindex ms2600
9550 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
9551
9552 @item -mint32
9553 @opindex mint32
9554 Make @code{int} data 32 bits by default.
9555
9556 @item -malign-300
9557 @opindex malign-300
9558 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
9559 The default for the H8/300H and H8S is to align longs and floats on 4
9560 byte boundaries.
9561 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
9562 This option has no effect on the H8/300.
9563 @end table
9564
9565 @node HPPA Options
9566 @subsection HPPA Options
9567 @cindex HPPA Options
9568
9569 These @samp{-m} options are defined for the HPPA family of computers:
9570
9571 @table @gcctabopt
9572 @item -march=@var{architecture-type}
9573 @opindex march
9574 Generate code for the specified architecture. The choices for
9575 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
9576 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
9577 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
9578 architecture option for your machine. Code compiled for lower numbered
9579 architectures will run on higher numbered architectures, but not the
9580 other way around.
9581
9582 @item -mpa-risc-1-0
9583 @itemx -mpa-risc-1-1
9584 @itemx -mpa-risc-2-0
9585 @opindex mpa-risc-1-0
9586 @opindex mpa-risc-1-1
9587 @opindex mpa-risc-2-0
9588 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
9589
9590 @item -mbig-switch
9591 @opindex mbig-switch
9592 Generate code suitable for big switch tables. Use this option only if
9593 the assembler/linker complain about out of range branches within a switch
9594 table.
9595
9596 @item -mjump-in-delay
9597 @opindex mjump-in-delay
9598 Fill delay slots of function calls with unconditional jump instructions
9599 by modifying the return pointer for the function call to be the target
9600 of the conditional jump.
9601
9602 @item -mdisable-fpregs
9603 @opindex mdisable-fpregs
9604 Prevent floating point registers from being used in any manner. This is
9605 necessary for compiling kernels which perform lazy context switching of
9606 floating point registers. If you use this option and attempt to perform
9607 floating point operations, the compiler will abort.
9608
9609 @item -mdisable-indexing
9610 @opindex mdisable-indexing
9611 Prevent the compiler from using indexing address modes. This avoids some
9612 rather obscure problems when compiling MIG generated code under MACH@.
9613
9614 @item -mno-space-regs
9615 @opindex mno-space-regs
9616 Generate code that assumes the target has no space registers. This allows
9617 GCC to generate faster indirect calls and use unscaled index address modes.
9618
9619 Such code is suitable for level 0 PA systems and kernels.
9620
9621 @item -mfast-indirect-calls
9622 @opindex mfast-indirect-calls
9623 Generate code that assumes calls never cross space boundaries. This
9624 allows GCC to emit code which performs faster indirect calls.
9625
9626 This option will not work in the presence of shared libraries or nested
9627 functions.
9628
9629 @item -mfixed-range=@var{register-range}
9630 @opindex mfixed-range
9631 Generate code treating the given register range as fixed registers.
9632 A fixed register is one that the register allocator can not use. This is
9633 useful when compiling kernel code. A register range is specified as
9634 two registers separated by a dash. Multiple register ranges can be
9635 specified separated by a comma.
9636
9637 @item -mlong-load-store
9638 @opindex mlong-load-store
9639 Generate 3-instruction load and store sequences as sometimes required by
9640 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
9641 the HP compilers.
9642
9643 @item -mportable-runtime
9644 @opindex mportable-runtime
9645 Use the portable calling conventions proposed by HP for ELF systems.
9646
9647 @item -mgas
9648 @opindex mgas
9649 Enable the use of assembler directives only GAS understands.
9650
9651 @item -mschedule=@var{cpu-type}
9652 @opindex mschedule
9653 Schedule code according to the constraints for the machine type
9654 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
9655 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
9656 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
9657 proper scheduling option for your machine. The default scheduling is
9658 @samp{8000}.
9659
9660 @item -mlinker-opt
9661 @opindex mlinker-opt
9662 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
9663 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
9664 linkers in which they give bogus error messages when linking some programs.
9665
9666 @item -msoft-float
9667 @opindex msoft-float
9668 Generate output containing library calls for floating point.
9669 @strong{Warning:} the requisite libraries are not available for all HPPA
9670 targets. Normally the facilities of the machine's usual C compiler are
9671 used, but this cannot be done directly in cross-compilation. You must make
9672 your own arrangements to provide suitable library functions for
9673 cross-compilation. The embedded target @samp{hppa1.1-*-pro}
9674 does provide software floating point support.
9675
9676 @option{-msoft-float} changes the calling convention in the output file;
9677 therefore, it is only useful if you compile @emph{all} of a program with
9678 this option. In particular, you need to compile @file{libgcc.a}, the
9679 library that comes with GCC, with @option{-msoft-float} in order for
9680 this to work.
9681
9682 @item -msio
9683 @opindex msio
9684 Generate the predefine, @code{_SIO}, for server IO@. The default is
9685 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
9686 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
9687 options are available under HP-UX and HI-UX@.
9688
9689 @item -mgnu-ld
9690 @opindex gnu-ld
9691 Use GNU ld specific options. This passes @option{-shared} to ld when
9692 building a shared library. It is the default when GCC is configured,
9693 explicitly or implicitly, with the GNU linker. This option does not
9694 have any affect on which ld is called, it only changes what parameters
9695 are passed to that ld. The ld that is called is determined by the
9696 @option{--with-ld} configure option, GCC's program search path, and
9697 finally by the user's @env{PATH}. The linker used by GCC can be printed
9698 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
9699 on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
9700
9701 @item -mhp-ld
9702 @opindex hp-ld
9703 Use HP ld specific options. This passes @option{-b} to ld when building
9704 a shared library and passes @option{+Accept TypeMismatch} to ld on all
9705 links. It is the default when GCC is configured, explicitly or
9706 implicitly, with the HP linker. This option does not have any affect on
9707 which ld is called, it only changes what parameters are passed to that
9708 ld. The ld that is called is determined by the @option{--with-ld}
9709 configure option, GCC's program search path, and finally by the user's
9710 @env{PATH}. The linker used by GCC can be printed using @samp{which
9711 `gcc -print-prog-name=ld`}. This option is only available on the 64 bit
9712 HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
9713
9714 @item -mlong-calls
9715 @opindex mno-long-calls
9716 Generate code that uses long call sequences. This ensures that a call
9717 is always able to reach linker generated stubs. The default is to generate
9718 long calls only when the distance from the call site to the beginning
9719 of the function or translation unit, as the case may be, exceeds a
9720 predefined limit set by the branch type being used. The limits for
9721 normal calls are 7,600,000 and 240,000 bytes, respectively for the
9722 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
9723 240,000 bytes.
9724
9725 Distances are measured from the beginning of functions when using the
9726 @option{-ffunction-sections} option, or when using the @option{-mgas}
9727 and @option{-mno-portable-runtime} options together under HP-UX with
9728 the SOM linker.
9729
9730 It is normally not desirable to use this option as it will degrade
9731 performance. However, it may be useful in large applications,
9732 particularly when partial linking is used to build the application.
9733
9734 The types of long calls used depends on the capabilities of the
9735 assembler and linker, and the type of code being generated. The
9736 impact on systems that support long absolute calls, and long pic
9737 symbol-difference or pc-relative calls should be relatively small.
9738 However, an indirect call is used on 32-bit ELF systems in pic code
9739 and it is quite long.
9740
9741 @item -munix=@var{unix-std}
9742 @opindex march
9743 Generate compiler predefines and select a startfile for the specified
9744 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
9745 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
9746 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
9747 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
9748 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
9749 and later.
9750
9751 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
9752 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
9753 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
9754 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
9755 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
9756 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
9757
9758 It is @emph{important} to note that this option changes the interfaces
9759 for various library routines. It also affects the operational behavior
9760 of the C library. Thus, @emph{extreme} care is needed in using this
9761 option.
9762
9763 Library code that is intended to operate with more than one UNIX
9764 standard must test, set and restore the variable @var{__xpg4_extended_mask}
9765 as appropriate. Most GNU software doesn't provide this capability.
9766
9767 @item -nolibdld
9768 @opindex nolibdld
9769 Suppress the generation of link options to search libdld.sl when the
9770 @option{-static} option is specified on HP-UX 10 and later.
9771
9772 @item -static
9773 @opindex static
9774 The HP-UX implementation of setlocale in libc has a dependency on
9775 libdld.sl. There isn't an archive version of libdld.sl. Thus,
9776 when the @option{-static} option is specified, special link options
9777 are needed to resolve this dependency.
9778
9779 On HP-UX 10 and later, the GCC driver adds the necessary options to
9780 link with libdld.sl when the @option{-static} option is specified.
9781 This causes the resulting binary to be dynamic. On the 64-bit port,
9782 the linkers generate dynamic binaries by default in any case. The
9783 @option{-nolibdld} option can be used to prevent the GCC driver from
9784 adding these link options.
9785
9786 @item -threads
9787 @opindex threads
9788 Add support for multithreading with the @dfn{dce thread} library
9789 under HP-UX@. This option sets flags for both the preprocessor and
9790 linker.
9791 @end table
9792
9793 @node i386 and x86-64 Options
9794 @subsection Intel 386 and AMD x86-64 Options
9795 @cindex i386 Options
9796 @cindex x86-64 Options
9797 @cindex Intel 386 Options
9798 @cindex AMD x86-64 Options
9799
9800 These @samp{-m} options are defined for the i386 and x86-64 family of
9801 computers:
9802
9803 @table @gcctabopt
9804 @item -mtune=@var{cpu-type}
9805 @opindex mtune
9806 Tune to @var{cpu-type} everything applicable about the generated code, except
9807 for the ABI and the set of available instructions. The choices for
9808 @var{cpu-type} are:
9809 @table @emph
9810 @item generic
9811 Produce code optimized for the most common IA32/AMD64/EM64T processors.
9812 If you know the CPU on which your code will run, then you should use
9813 the corresponding @option{-mtune} option instead of
9814 @option{-mtune=generic}. But, if you do not know exactly what CPU users
9815 of your application will have, then you should use this option.
9816
9817 As new processors are deployed in the marketplace, the behavior of this
9818 option will change. Therefore, if you upgrade to a newer version of
9819 GCC, the code generated option will change to reflect the processors
9820 that were most common when that version of GCC was released.
9821
9822 There is no @option{-march=generic} option because @option{-march}
9823 indicates the instruction set the compiler can use, and there is no
9824 generic instruction set applicable to all processors. In contrast,
9825 @option{-mtune} indicates the processor (or, in this case, collection of
9826 processors) for which the code is optimized.
9827 @item native
9828 This selects the CPU to tune for at compilation time by determining
9829 the processor type of the compiling machine. Using @option{-mtune=native}
9830 will produce code optimized for the local machine under the constraints
9831 of the selected instruction set. Using @option{-march=native} will
9832 enable all instruction subsets supported by the local machine (hence
9833 the result might not run on different machines).
9834 @item i386
9835 Original Intel's i386 CPU@.
9836 @item i486
9837 Intel's i486 CPU@. (No scheduling is implemented for this chip.)
9838 @item i586, pentium
9839 Intel Pentium CPU with no MMX support.
9840 @item pentium-mmx
9841 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
9842 @item pentiumpro
9843 Intel PentiumPro CPU@.
9844 @item i686
9845 Same as @code{generic}, but when used as @code{march} option, PentiumPro
9846 instruction set will be used, so the code will run on all i686 family chips.
9847 @item pentium2
9848 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
9849 @item pentium3, pentium3m
9850 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
9851 support.
9852 @item pentium-m
9853 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
9854 support. Used by Centrino notebooks.
9855 @item pentium4, pentium4m
9856 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
9857 @item prescott
9858 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
9859 set support.
9860 @item nocona
9861 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
9862 SSE2 and SSE3 instruction set support.
9863 @item core2
9864 Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
9865 instruction set support.
9866 @item k6
9867 AMD K6 CPU with MMX instruction set support.
9868 @item k6-2, k6-3
9869 Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
9870 @item athlon, athlon-tbird
9871 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
9872 support.
9873 @item athlon-4, athlon-xp, athlon-mp
9874 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
9875 instruction set support.
9876 @item k8, opteron, athlon64, athlon-fx
9877 AMD K8 core based CPUs with x86-64 instruction set support. (This supersets
9878 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
9879 @item amdfam10, barcelona
9880 AMD Family 10 core based CPUs with x86-64 instruction set support. (This
9881 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit
9882 instruction set extensions.)
9883 @item winchip-c6
9884 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
9885 set support.
9886 @item winchip2
9887 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
9888 instruction set support.
9889 @item c3
9890 Via C3 CPU with MMX and 3dNOW! instruction set support. (No scheduling is
9891 implemented for this chip.)
9892 @item c3-2
9893 Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is
9894 implemented for this chip.)
9895 @item geode
9896 Embedded AMD CPU with MMX and 3dNOW! instruction set support.
9897 @end table
9898
9899 While picking a specific @var{cpu-type} will schedule things appropriately
9900 for that particular chip, the compiler will not generate any code that
9901 does not run on the i386 without the @option{-march=@var{cpu-type}} option
9902 being used.
9903
9904 @item -march=@var{cpu-type}
9905 @opindex march
9906 Generate instructions for the machine type @var{cpu-type}. The choices
9907 for @var{cpu-type} are the same as for @option{-mtune}. Moreover,
9908 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
9909
9910 @item -mcpu=@var{cpu-type}
9911 @opindex mcpu
9912 A deprecated synonym for @option{-mtune}.
9913
9914 @item -m386
9915 @itemx -m486
9916 @itemx -mpentium
9917 @itemx -mpentiumpro
9918 @opindex m386
9919 @opindex m486
9920 @opindex mpentium
9921 @opindex mpentiumpro
9922 These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
9923 @option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
9924 These synonyms are deprecated.
9925
9926 @item -mfpmath=@var{unit}
9927 @opindex march
9928 Generate floating point arithmetics for selected unit @var{unit}. The choices
9929 for @var{unit} are:
9930
9931 @table @samp
9932 @item 387
9933 Use the standard 387 floating point coprocessor present majority of chips and
9934 emulated otherwise. Code compiled with this option will run almost everywhere.
9935 The temporary results are computed in 80bit precision instead of precision
9936 specified by the type resulting in slightly different results compared to most
9937 of other chips. See @option{-ffloat-store} for more detailed description.
9938
9939 This is the default choice for i386 compiler.
9940
9941 @item sse
9942 Use scalar floating point instructions present in the SSE instruction set.
9943 This instruction set is supported by Pentium3 and newer chips, in the AMD line
9944 by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
9945 instruction set supports only single precision arithmetics, thus the double and
9946 extended precision arithmetics is still done using 387. Later version, present
9947 only in Pentium4 and the future AMD x86-64 chips supports double precision
9948 arithmetics too.
9949
9950 For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
9951 or @option{-msse2} switches to enable SSE extensions and make this option
9952 effective. For the x86-64 compiler, these extensions are enabled by default.
9953
9954 The resulting code should be considerably faster in the majority of cases and avoid
9955 the numerical instability problems of 387 code, but may break some existing
9956 code that expects temporaries to be 80bit.
9957
9958 This is the default choice for the x86-64 compiler.
9959
9960 @item sse,387
9961 Attempt to utilize both instruction sets at once. This effectively double the
9962 amount of available registers and on chips with separate execution units for
9963 387 and SSE the execution resources too. Use this option with care, as it is
9964 still experimental, because the GCC register allocator does not model separate
9965 functional units well resulting in instable performance.
9966 @end table
9967
9968 @item -masm=@var{dialect}
9969 @opindex masm=@var{dialect}
9970 Output asm instructions using selected @var{dialect}. Supported
9971 choices are @samp{intel} or @samp{att} (the default one). Darwin does
9972 not support @samp{intel}.
9973
9974 @item -mieee-fp
9975 @itemx -mno-ieee-fp
9976 @opindex mieee-fp
9977 @opindex mno-ieee-fp
9978 Control whether or not the compiler uses IEEE floating point
9979 comparisons. These handle correctly the case where the result of a
9980 comparison is unordered.
9981
9982 @item -msoft-float
9983 @opindex msoft-float
9984 Generate output containing library calls for floating point.
9985 @strong{Warning:} the requisite libraries are not part of GCC@.
9986 Normally the facilities of the machine's usual C compiler are used, but
9987 this can't be done directly in cross-compilation. You must make your
9988 own arrangements to provide suitable library functions for
9989 cross-compilation.
9990
9991 On machines where a function returns floating point results in the 80387
9992 register stack, some floating point opcodes may be emitted even if
9993 @option{-msoft-float} is used.
9994
9995 @item -mno-fp-ret-in-387
9996 @opindex mno-fp-ret-in-387
9997 Do not use the FPU registers for return values of functions.
9998
9999 The usual calling convention has functions return values of types
10000 @code{float} and @code{double} in an FPU register, even if there
10001 is no FPU@. The idea is that the operating system should emulate
10002 an FPU@.
10003
10004 The option @option{-mno-fp-ret-in-387} causes such values to be returned
10005 in ordinary CPU registers instead.
10006
10007 @item -mno-fancy-math-387
10008 @opindex mno-fancy-math-387
10009 Some 387 emulators do not support the @code{sin}, @code{cos} and
10010 @code{sqrt} instructions for the 387. Specify this option to avoid
10011 generating those instructions. This option is the default on FreeBSD,
10012 OpenBSD and NetBSD@. This option is overridden when @option{-march}
10013 indicates that the target cpu will always have an FPU and so the
10014 instruction will not need emulation. As of revision 2.6.1, these
10015 instructions are not generated unless you also use the
10016 @option{-funsafe-math-optimizations} switch.
10017
10018 @item -malign-double
10019 @itemx -mno-align-double
10020 @opindex malign-double
10021 @opindex mno-align-double
10022 Control whether GCC aligns @code{double}, @code{long double}, and
10023 @code{long long} variables on a two word boundary or a one word
10024 boundary. Aligning @code{double} variables on a two word boundary will
10025 produce code that runs somewhat faster on a @samp{Pentium} at the
10026 expense of more memory.
10027
10028 On x86-64, @option{-malign-double} is enabled by default.
10029
10030 @strong{Warning:} if you use the @option{-malign-double} switch,
10031 structures containing the above types will be aligned differently than
10032 the published application binary interface specifications for the 386
10033 and will not be binary compatible with structures in code compiled
10034 without that switch.
10035
10036 @item -m96bit-long-double
10037 @itemx -m128bit-long-double
10038 @opindex m96bit-long-double
10039 @opindex m128bit-long-double
10040 These switches control the size of @code{long double} type. The i386
10041 application binary interface specifies the size to be 96 bits,
10042 so @option{-m96bit-long-double} is the default in 32 bit mode.
10043
10044 Modern architectures (Pentium and newer) would prefer @code{long double}
10045 to be aligned to an 8 or 16 byte boundary. In arrays or structures
10046 conforming to the ABI, this would not be possible. So specifying a
10047 @option{-m128bit-long-double} will align @code{long double}
10048 to a 16 byte boundary by padding the @code{long double} with an additional
10049 32 bit zero.
10050
10051 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
10052 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
10053
10054 Notice that neither of these options enable any extra precision over the x87
10055 standard of 80 bits for a @code{long double}.
10056
10057 @strong{Warning:} if you override the default value for your target ABI, the
10058 structures and arrays containing @code{long double} variables will change
10059 their size as well as function calling convention for function taking
10060 @code{long double} will be modified. Hence they will not be binary
10061 compatible with arrays or structures in code compiled without that switch.
10062
10063 @item -mmlarge-data-threshold=@var{number}
10064 @opindex mlarge-data-threshold=@var{number}
10065 When @option{-mcmodel=medium} is specified, the data greater than
10066 @var{threshold} are placed in large data section. This value must be the
10067 same across all object linked into the binary and defaults to 65535.
10068
10069 @item -mrtd
10070 @opindex mrtd
10071 Use a different function-calling convention, in which functions that
10072 take a fixed number of arguments return with the @code{ret} @var{num}
10073 instruction, which pops their arguments while returning. This saves one
10074 instruction in the caller since there is no need to pop the arguments
10075 there.
10076
10077 You can specify that an individual function is called with this calling
10078 sequence with the function attribute @samp{stdcall}. You can also
10079 override the @option{-mrtd} option by using the function attribute
10080 @samp{cdecl}. @xref{Function Attributes}.
10081
10082 @strong{Warning:} this calling convention is incompatible with the one
10083 normally used on Unix, so you cannot use it if you need to call
10084 libraries compiled with the Unix compiler.
10085
10086 Also, you must provide function prototypes for all functions that
10087 take variable numbers of arguments (including @code{printf});
10088 otherwise incorrect code will be generated for calls to those
10089 functions.
10090
10091 In addition, seriously incorrect code will result if you call a
10092 function with too many arguments. (Normally, extra arguments are
10093 harmlessly ignored.)
10094
10095 @item -mregparm=@var{num}
10096 @opindex mregparm
10097 Control how many registers are used to pass integer arguments. By
10098 default, no registers are used to pass arguments, and at most 3
10099 registers can be used. You can control this behavior for a specific
10100 function by using the function attribute @samp{regparm}.
10101 @xref{Function Attributes}.
10102
10103 @strong{Warning:} if you use this switch, and
10104 @var{num} is nonzero, then you must build all modules with the same
10105 value, including any libraries. This includes the system libraries and
10106 startup modules.
10107
10108 @item -msseregparm
10109 @opindex msseregparm
10110 Use SSE register passing conventions for float and double arguments
10111 and return values. You can control this behavior for a specific
10112 function by using the function attribute @samp{sseregparm}.
10113 @xref{Function Attributes}.
10114
10115 @strong{Warning:} if you use this switch then you must build all
10116 modules with the same value, including any libraries. This includes
10117 the system libraries and startup modules.
10118
10119 @item -mpc32
10120 @itemx -mpc64
10121 @itemx -mpc80
10122 @opindex mpc32
10123 @opindex mpc64
10124 @opindex mpc80
10125
10126 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
10127 is specified, the significand of floating-point operations is rounded to 24
10128 bits (single precision), @option{-mpc64} rounds the significand of
10129 floating-point operations to 53 bits (double precision) and @option{-mpc80}
10130 rounds the significand of floating-point operations to 64 bits (extended
10131 double precision). Note that a change of default precision control may
10132 affect the results returned by some of the mathematical functions.
10133
10134 @item -mstackrealign
10135 @opindex mstackrealign
10136 Realign the stack at entry. On the Intel x86, the
10137 @option{-mstackrealign} option will generate an alternate prologue and
10138 epilogue that realigns the runtime stack. This supports mixing legacy
10139 codes that keep a 4-byte aligned stack with modern codes that keep a
10140 16-byte stack for SSE compatibility. The alternate prologue and
10141 epilogue are slower and bigger than the regular ones, and the
10142 alternate prologue requires an extra scratch register; this lowers the
10143 number of registers available if used in conjunction with the
10144 @code{regparm} attribute. The @option{-mstackrealign} option is
10145 incompatible with the nested function prologue; this is considered a
10146 hard error. See also the attribute @code{force_align_arg_pointer},
10147 applicable to individual functions.
10148
10149 @item -mpreferred-stack-boundary=@var{num}
10150 @opindex mpreferred-stack-boundary
10151 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
10152 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
10153 the default is 4 (16 bytes or 128 bits).
10154
10155 On Pentium and PentiumPro, @code{double} and @code{long double} values
10156 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
10157 suffer significant run time performance penalties. On Pentium III, the
10158 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
10159 properly if it is not 16 byte aligned.
10160
10161 To ensure proper alignment of this values on the stack, the stack boundary
10162 must be as aligned as that required by any value stored on the stack.
10163 Further, every function must be generated such that it keeps the stack
10164 aligned. Thus calling a function compiled with a higher preferred
10165 stack boundary from a function compiled with a lower preferred stack
10166 boundary will most likely misalign the stack. It is recommended that
10167 libraries that use callbacks always use the default setting.
10168
10169 This extra alignment does consume extra stack space, and generally
10170 increases code size. Code that is sensitive to stack space usage, such
10171 as embedded systems and operating system kernels, may want to reduce the
10172 preferred alignment to @option{-mpreferred-stack-boundary=2}.
10173
10174 @item -mmmx
10175 @itemx -mno-mmx
10176 @item -msse
10177 @itemx -mno-sse
10178 @item -msse2
10179 @itemx -mno-sse2
10180 @item -msse3
10181 @itemx -mno-sse3
10182 @item -mssse3
10183 @itemx -mno-ssse3
10184 @item -msse4a
10185 @item -mno-sse4a
10186 @item -m3dnow
10187 @itemx -mno-3dnow
10188 @item -mpopcnt
10189 @itemx -mno-popcnt
10190 @item -mabm
10191 @itemx -mno-abm
10192 @opindex mmmx
10193 @opindex mno-mmx
10194 @opindex msse
10195 @opindex mno-sse
10196 @opindex m3dnow
10197 @opindex mno-3dnow
10198 These switches enable or disable the use of instructions in the MMX,
10199 SSE, SSE2, SSE3, SSSE3, SSE4A, ABM or 3DNow! extended instruction sets.
10200 These extensions are also available as built-in functions: see
10201 @ref{X86 Built-in Functions}, for details of the functions enabled and
10202 disabled by these switches.
10203
10204 To have SSE/SSE2 instructions generated automatically from floating-point
10205 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
10206
10207 These options will enable GCC to use these extended instructions in
10208 generated code, even without @option{-mfpmath=sse}. Applications which
10209 perform runtime CPU detection must compile separate files for each
10210 supported architecture, using the appropriate flags. In particular,
10211 the file containing the CPU detection code should be compiled without
10212 these options.
10213
10214 @item -mcx16
10215 @opindex mcx16
10216 This option will enable GCC to use CMPXCHG16B instruction in generated code.
10217 CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword)
10218 data types. This is useful for high resolution counters that could be updated
10219 by multiple processors (or cores). This instruction is generated as part of
10220 atomic built-in functions: see @ref{Atomic Builtins} for details.
10221
10222 @item -msahf
10223 @opindex msahf
10224 This option will enable GCC to use SAHF instruction in generated 64-bit code.
10225 Early Intel CPUs with Intel 64 lacked LAHF and SAHF instructions supported
10226 by AMD64 until introduction of Pentium 4 G1 step in December 2005. LAHF and
10227 SAHF are load and store instructions, respectively, for certain status flags.
10228 In 64-bit mode, SAHF instruction is used to optimize @code{fmod}, @code{drem}
10229 or @code{remainder} built-in functions: see @ref{Other Builtins} for details.
10230
10231 @item -mpush-args
10232 @itemx -mno-push-args
10233 @opindex mpush-args
10234 @opindex mno-push-args
10235 Use PUSH operations to store outgoing parameters. This method is shorter
10236 and usually equally fast as method using SUB/MOV operations and is enabled
10237 by default. In some cases disabling it may improve performance because of
10238 improved scheduling and reduced dependencies.
10239
10240 @item -maccumulate-outgoing-args
10241 @opindex maccumulate-outgoing-args
10242 If enabled, the maximum amount of space required for outgoing arguments will be
10243 computed in the function prologue. This is faster on most modern CPUs
10244 because of reduced dependencies, improved scheduling and reduced stack usage
10245 when preferred stack boundary is not equal to 2. The drawback is a notable
10246 increase in code size. This switch implies @option{-mno-push-args}.
10247
10248 @item -mthreads
10249 @opindex mthreads
10250 Support thread-safe exception handling on @samp{Mingw32}. Code that relies
10251 on thread-safe exception handling must compile and link all code with the
10252 @option{-mthreads} option. When compiling, @option{-mthreads} defines
10253 @option{-D_MT}; when linking, it links in a special thread helper library
10254 @option{-lmingwthrd} which cleans up per thread exception handling data.
10255
10256 @item -mno-align-stringops
10257 @opindex mno-align-stringops
10258 Do not align destination of inlined string operations. This switch reduces
10259 code size and improves performance in case the destination is already aligned,
10260 but GCC doesn't know about it.
10261
10262 @item -minline-all-stringops
10263 @opindex minline-all-stringops
10264 By default GCC inlines string operations only when destination is known to be
10265 aligned at least to 4 byte boundary. This enables more inlining, increase code
10266 size, but may improve performance of code that depends on fast memcpy, strlen
10267 and memset for short lengths.
10268
10269 @item -minline-stringops-dynamically
10270 @opindex minline-stringops-dynamically
10271 For string operation of unknown size, inline runtime checks so for small
10272 blocks inline code is used, while for large blocks library call is used.
10273
10274 @item -mstringop-strategy=@var{alg}
10275 @opindex mstringop-strategy=@var{alg}
10276 Overwrite internal decision heuristic about particular algorithm to inline
10277 string operation with. The allowed values are @code{rep_byte},
10278 @code{rep_4byte}, @code{rep_8byte} for expanding using i386 @code{rep} prefix
10279 of specified size, @code{byte_loop}, @code{loop}, @code{unrolled_loop} for
10280 expanding inline loop, @code{libcall} for always expanding library call.
10281
10282 @item -momit-leaf-frame-pointer
10283 @opindex momit-leaf-frame-pointer
10284 Don't keep the frame pointer in a register for leaf functions. This
10285 avoids the instructions to save, set up and restore frame pointers and
10286 makes an extra register available in leaf functions. The option
10287 @option{-fomit-frame-pointer} removes the frame pointer for all functions
10288 which might make debugging harder.
10289
10290 @item -mtls-direct-seg-refs
10291 @itemx -mno-tls-direct-seg-refs
10292 @opindex mtls-direct-seg-refs
10293 Controls whether TLS variables may be accessed with offsets from the
10294 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
10295 or whether the thread base pointer must be added. Whether or not this
10296 is legal depends on the operating system, and whether it maps the
10297 segment to cover the entire TLS area.
10298
10299 For systems that use GNU libc, the default is on.
10300 @end table
10301
10302 These @samp{-m} switches are supported in addition to the above
10303 on AMD x86-64 processors in 64-bit environments.
10304
10305 @table @gcctabopt
10306 @item -m32
10307 @itemx -m64
10308 @opindex m32
10309 @opindex m64
10310 Generate code for a 32-bit or 64-bit environment.
10311 The 32-bit environment sets int, long and pointer to 32 bits and
10312 generates code that runs on any i386 system.
10313 The 64-bit environment sets int to 32 bits and long and pointer
10314 to 64 bits and generates code for AMD's x86-64 architecture. For
10315 darwin only the -m64 option turns off the @option{-fno-pic} and
10316 @option{-mdynamic-no-pic} options.
10317
10318 @item -mno-red-zone
10319 @opindex no-red-zone
10320 Do not use a so called red zone for x86-64 code. The red zone is mandated
10321 by the x86-64 ABI, it is a 128-byte area beyond the location of the
10322 stack pointer that will not be modified by signal or interrupt handlers
10323 and therefore can be used for temporary data without adjusting the stack
10324 pointer. The flag @option{-mno-red-zone} disables this red zone.
10325
10326 @item -mcmodel=small
10327 @opindex mcmodel=small
10328 Generate code for the small code model: the program and its symbols must
10329 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
10330 Programs can be statically or dynamically linked. This is the default
10331 code model.
10332
10333 @item -mcmodel=kernel
10334 @opindex mcmodel=kernel
10335 Generate code for the kernel code model. The kernel runs in the
10336 negative 2 GB of the address space.
10337 This model has to be used for Linux kernel code.
10338
10339 @item -mcmodel=medium
10340 @opindex mcmodel=medium
10341 Generate code for the medium model: The program is linked in the lower 2
10342 GB of the address space but symbols can be located anywhere in the
10343 address space. Programs can be statically or dynamically linked, but
10344 building of shared libraries are not supported with the medium model.
10345
10346 @item -mcmodel=large
10347 @opindex mcmodel=large
10348 Generate code for the large model: This model makes no assumptions
10349 about addresses and sizes of sections.
10350 @end table
10351
10352 @node IA-64 Options
10353 @subsection IA-64 Options
10354 @cindex IA-64 Options
10355
10356 These are the @samp{-m} options defined for the Intel IA-64 architecture.
10357
10358 @table @gcctabopt
10359 @item -mbig-endian
10360 @opindex mbig-endian
10361 Generate code for a big endian target. This is the default for HP-UX@.
10362
10363 @item -mlittle-endian
10364 @opindex mlittle-endian
10365 Generate code for a little endian target. This is the default for AIX5
10366 and GNU/Linux.
10367
10368 @item -mgnu-as
10369 @itemx -mno-gnu-as
10370 @opindex mgnu-as
10371 @opindex mno-gnu-as
10372 Generate (or don't) code for the GNU assembler. This is the default.
10373 @c Also, this is the default if the configure option @option{--with-gnu-as}
10374 @c is used.
10375
10376 @item -mgnu-ld
10377 @itemx -mno-gnu-ld
10378 @opindex mgnu-ld
10379 @opindex mno-gnu-ld
10380 Generate (or don't) code for the GNU linker. This is the default.
10381 @c Also, this is the default if the configure option @option{--with-gnu-ld}
10382 @c is used.
10383
10384 @item -mno-pic
10385 @opindex mno-pic
10386 Generate code that does not use a global pointer register. The result
10387 is not position independent code, and violates the IA-64 ABI@.
10388
10389 @item -mvolatile-asm-stop
10390 @itemx -mno-volatile-asm-stop
10391 @opindex mvolatile-asm-stop
10392 @opindex mno-volatile-asm-stop
10393 Generate (or don't) a stop bit immediately before and after volatile asm
10394 statements.
10395
10396 @item -mregister-names
10397 @itemx -mno-register-names
10398 @opindex mregister-names
10399 @opindex mno-register-names
10400 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
10401 the stacked registers. This may make assembler output more readable.
10402
10403 @item -mno-sdata
10404 @itemx -msdata
10405 @opindex mno-sdata
10406 @opindex msdata
10407 Disable (or enable) optimizations that use the small data section. This may
10408 be useful for working around optimizer bugs.
10409
10410 @item -mconstant-gp
10411 @opindex mconstant-gp
10412 Generate code that uses a single constant global pointer value. This is
10413 useful when compiling kernel code.
10414
10415 @item -mauto-pic
10416 @opindex mauto-pic
10417 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
10418 This is useful when compiling firmware code.
10419
10420 @item -minline-float-divide-min-latency
10421 @opindex minline-float-divide-min-latency
10422 Generate code for inline divides of floating point values
10423 using the minimum latency algorithm.
10424
10425 @item -minline-float-divide-max-throughput
10426 @opindex minline-float-divide-max-throughput
10427 Generate code for inline divides of floating point values
10428 using the maximum throughput algorithm.
10429
10430 @item -minline-int-divide-min-latency
10431 @opindex minline-int-divide-min-latency
10432 Generate code for inline divides of integer values
10433 using the minimum latency algorithm.
10434
10435 @item -minline-int-divide-max-throughput
10436 @opindex minline-int-divide-max-throughput
10437 Generate code for inline divides of integer values
10438 using the maximum throughput algorithm.
10439
10440 @item -minline-sqrt-min-latency
10441 @opindex minline-sqrt-min-latency
10442 Generate code for inline square roots
10443 using the minimum latency algorithm.
10444
10445 @item -minline-sqrt-max-throughput
10446 @opindex minline-sqrt-max-throughput
10447 Generate code for inline square roots
10448 using the maximum throughput algorithm.
10449
10450 @item -mno-dwarf2-asm
10451 @itemx -mdwarf2-asm
10452 @opindex mno-dwarf2-asm
10453 @opindex mdwarf2-asm
10454 Don't (or do) generate assembler code for the DWARF2 line number debugging
10455 info. This may be useful when not using the GNU assembler.
10456
10457 @item -mearly-stop-bits
10458 @itemx -mno-early-stop-bits
10459 @opindex mearly-stop-bits
10460 @opindex mno-early-stop-bits
10461 Allow stop bits to be placed earlier than immediately preceding the
10462 instruction that triggered the stop bit. This can improve instruction
10463 scheduling, but does not always do so.
10464
10465 @item -mfixed-range=@var{register-range}
10466 @opindex mfixed-range
10467 Generate code treating the given register range as fixed registers.
10468 A fixed register is one that the register allocator can not use. This is
10469 useful when compiling kernel code. A register range is specified as
10470 two registers separated by a dash. Multiple register ranges can be
10471 specified separated by a comma.
10472
10473 @item -mtls-size=@var{tls-size}
10474 @opindex mtls-size
10475 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
10476 64.
10477
10478 @item -mtune=@var{cpu-type}
10479 @opindex mtune
10480 Tune the instruction scheduling for a particular CPU, Valid values are
10481 itanium, itanium1, merced, itanium2, and mckinley.
10482
10483 @item -mt
10484 @itemx -pthread
10485 @opindex mt
10486 @opindex pthread
10487 Add support for multithreading using the POSIX threads library. This
10488 option sets flags for both the preprocessor and linker. It does
10489 not affect the thread safety of object code produced by the compiler or
10490 that of libraries supplied with it. These are HP-UX specific flags.
10491
10492 @item -milp32
10493 @itemx -mlp64
10494 @opindex milp32
10495 @opindex mlp64
10496 Generate code for a 32-bit or 64-bit environment.
10497 The 32-bit environment sets int, long and pointer to 32 bits.
10498 The 64-bit environment sets int to 32 bits and long and pointer
10499 to 64 bits. These are HP-UX specific flags.
10500
10501 @item -mno-sched-br-data-spec
10502 @itemx -msched-br-data-spec
10503 @opindex mno-sched-br-data-spec
10504 @opindex msched-br-data-spec
10505 (Dis/En)able data speculative scheduling before reload.
10506 This will result in generation of the ld.a instructions and
10507 the corresponding check instructions (ld.c / chk.a).
10508 The default is 'disable'.
10509
10510 @item -msched-ar-data-spec
10511 @itemx -mno-sched-ar-data-spec
10512 @opindex msched-ar-data-spec
10513 @opindex mno-sched-ar-data-spec
10514 (En/Dis)able data speculative scheduling after reload.
10515 This will result in generation of the ld.a instructions and
10516 the corresponding check instructions (ld.c / chk.a).
10517 The default is 'enable'.
10518
10519 @item -mno-sched-control-spec
10520 @itemx -msched-control-spec
10521 @opindex mno-sched-control-spec
10522 @opindex msched-control-spec
10523 (Dis/En)able control speculative scheduling. This feature is
10524 available only during region scheduling (i.e. before reload).
10525 This will result in generation of the ld.s instructions and
10526 the corresponding check instructions chk.s .
10527 The default is 'disable'.
10528
10529 @item -msched-br-in-data-spec
10530 @itemx -mno-sched-br-in-data-spec
10531 @opindex msched-br-in-data-spec
10532 @opindex mno-sched-br-in-data-spec
10533 (En/Dis)able speculative scheduling of the instructions that
10534 are dependent on the data speculative loads before reload.
10535 This is effective only with @option{-msched-br-data-spec} enabled.
10536 The default is 'enable'.
10537
10538 @item -msched-ar-in-data-spec
10539 @itemx -mno-sched-ar-in-data-spec
10540 @opindex msched-ar-in-data-spec
10541 @opindex mno-sched-ar-in-data-spec
10542 (En/Dis)able speculative scheduling of the instructions that
10543 are dependent on the data speculative loads after reload.
10544 This is effective only with @option{-msched-ar-data-spec} enabled.
10545 The default is 'enable'.
10546
10547 @item -msched-in-control-spec
10548 @itemx -mno-sched-in-control-spec
10549 @opindex msched-in-control-spec
10550 @opindex mno-sched-in-control-spec
10551 (En/Dis)able speculative scheduling of the instructions that
10552 are dependent on the control speculative loads.
10553 This is effective only with @option{-msched-control-spec} enabled.
10554 The default is 'enable'.
10555
10556 @item -msched-ldc
10557 @itemx -mno-sched-ldc
10558 @opindex msched-ldc
10559 @opindex mno-sched-ldc
10560 (En/Dis)able use of simple data speculation checks ld.c .
10561 If disabled, only chk.a instructions will be emitted to check
10562 data speculative loads.
10563 The default is 'enable'.
10564
10565 @item -mno-sched-control-ldc
10566 @itemx -msched-control-ldc
10567 @opindex mno-sched-control-ldc
10568 @opindex msched-control-ldc
10569 (Dis/En)able use of ld.c instructions to check control speculative loads.
10570 If enabled, in case of control speculative load with no speculatively
10571 scheduled dependent instructions this load will be emitted as ld.sa and
10572 ld.c will be used to check it.
10573 The default is 'disable'.
10574
10575 @item -mno-sched-spec-verbose
10576 @itemx -msched-spec-verbose
10577 @opindex mno-sched-spec-verbose
10578 @opindex msched-spec-verbose
10579 (Dis/En)able printing of the information about speculative motions.
10580
10581 @item -mno-sched-prefer-non-data-spec-insns
10582 @itemx -msched-prefer-non-data-spec-insns
10583 @opindex mno-sched-prefer-non-data-spec-insns
10584 @opindex msched-prefer-non-data-spec-insns
10585 If enabled, data speculative instructions will be chosen for schedule
10586 only if there are no other choices at the moment. This will make
10587 the use of the data speculation much more conservative.
10588 The default is 'disable'.
10589
10590 @item -mno-sched-prefer-non-control-spec-insns
10591 @itemx -msched-prefer-non-control-spec-insns
10592 @opindex mno-sched-prefer-non-control-spec-insns
10593 @opindex msched-prefer-non-control-spec-insns
10594 If enabled, control speculative instructions will be chosen for schedule
10595 only if there are no other choices at the moment. This will make
10596 the use of the control speculation much more conservative.
10597 The default is 'disable'.
10598
10599 @item -mno-sched-count-spec-in-critical-path
10600 @itemx -msched-count-spec-in-critical-path
10601 @opindex mno-sched-count-spec-in-critical-path
10602 @opindex msched-count-spec-in-critical-path
10603 If enabled, speculative dependencies will be considered during
10604 computation of the instructions priorities. This will make the use of the
10605 speculation a bit more conservative.
10606 The default is 'disable'.
10607
10608 @end table
10609
10610 @node M32C Options
10611 @subsection M32C Options
10612 @cindex M32C options
10613
10614 @table @gcctabopt
10615 @item -mcpu=@var{name}
10616 @opindex mcpu=
10617 Select the CPU for which code is generated. @var{name} may be one of
10618 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
10619 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
10620 the M32C/80 series.
10621
10622 @item -msim
10623 @opindex msim
10624 Specifies that the program will be run on the simulator. This causes
10625 an alternate runtime library to be linked in which supports, for
10626 example, file I/O. You must not use this option when generating
10627 programs that will run on real hardware; you must provide your own
10628 runtime library for whatever I/O functions are needed.
10629
10630 @item -memregs=@var{number}
10631 @opindex memregs=
10632 Specifies the number of memory-based pseudo-registers GCC will use
10633 during code generation. These pseudo-registers will be used like real
10634 registers, so there is a tradeoff between GCC's ability to fit the
10635 code into available registers, and the performance penalty of using
10636 memory instead of registers. Note that all modules in a program must
10637 be compiled with the same value for this option. Because of that, you
10638 must not use this option with the default runtime libraries gcc
10639 builds.
10640
10641 @end table
10642
10643 @node M32R/D Options
10644 @subsection M32R/D Options
10645 @cindex M32R/D options
10646
10647 These @option{-m} options are defined for Renesas M32R/D architectures:
10648
10649 @table @gcctabopt
10650 @item -m32r2
10651 @opindex m32r2
10652 Generate code for the M32R/2@.
10653
10654 @item -m32rx
10655 @opindex m32rx
10656 Generate code for the M32R/X@.
10657
10658 @item -m32r
10659 @opindex m32r
10660 Generate code for the M32R@. This is the default.
10661
10662 @item -mmodel=small
10663 @opindex mmodel=small
10664 Assume all objects live in the lower 16MB of memory (so that their addresses
10665 can be loaded with the @code{ld24} instruction), and assume all subroutines
10666 are reachable with the @code{bl} instruction.
10667 This is the default.
10668
10669 The addressability of a particular object can be set with the
10670 @code{model} attribute.
10671
10672 @item -mmodel=medium
10673 @opindex mmodel=medium
10674 Assume objects may be anywhere in the 32-bit address space (the compiler
10675 will generate @code{seth/add3} instructions to load their addresses), and
10676 assume all subroutines are reachable with the @code{bl} instruction.
10677
10678 @item -mmodel=large
10679 @opindex mmodel=large
10680 Assume objects may be anywhere in the 32-bit address space (the compiler
10681 will generate @code{seth/add3} instructions to load their addresses), and
10682 assume subroutines may not be reachable with the @code{bl} instruction
10683 (the compiler will generate the much slower @code{seth/add3/jl}
10684 instruction sequence).
10685
10686 @item -msdata=none
10687 @opindex msdata=none
10688 Disable use of the small data area. Variables will be put into
10689 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
10690 @code{section} attribute has been specified).
10691 This is the default.
10692
10693 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
10694 Objects may be explicitly put in the small data area with the
10695 @code{section} attribute using one of these sections.
10696
10697 @item -msdata=sdata
10698 @opindex msdata=sdata
10699 Put small global and static data in the small data area, but do not
10700 generate special code to reference them.
10701
10702 @item -msdata=use
10703 @opindex msdata=use
10704 Put small global and static data in the small data area, and generate
10705 special instructions to reference them.
10706
10707 @item -G @var{num}
10708 @opindex G
10709 @cindex smaller data references
10710 Put global and static objects less than or equal to @var{num} bytes
10711 into the small data or bss sections instead of the normal data or bss
10712 sections. The default value of @var{num} is 8.
10713 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
10714 for this option to have any effect.
10715
10716 All modules should be compiled with the same @option{-G @var{num}} value.
10717 Compiling with different values of @var{num} may or may not work; if it
10718 doesn't the linker will give an error message---incorrect code will not be
10719 generated.
10720
10721 @item -mdebug
10722 @opindex mdebug
10723 Makes the M32R specific code in the compiler display some statistics
10724 that might help in debugging programs.
10725
10726 @item -malign-loops
10727 @opindex malign-loops
10728 Align all loops to a 32-byte boundary.
10729
10730 @item -mno-align-loops
10731 @opindex mno-align-loops
10732 Do not enforce a 32-byte alignment for loops. This is the default.
10733
10734 @item -missue-rate=@var{number}
10735 @opindex missue-rate=@var{number}
10736 Issue @var{number} instructions per cycle. @var{number} can only be 1
10737 or 2.
10738
10739 @item -mbranch-cost=@var{number}
10740 @opindex mbranch-cost=@var{number}
10741 @var{number} can only be 1 or 2. If it is 1 then branches will be
10742 preferred over conditional code, if it is 2, then the opposite will
10743 apply.
10744
10745 @item -mflush-trap=@var{number}
10746 @opindex mflush-trap=@var{number}
10747 Specifies the trap number to use to flush the cache. The default is
10748 12. Valid numbers are between 0 and 15 inclusive.
10749
10750 @item -mno-flush-trap
10751 @opindex mno-flush-trap
10752 Specifies that the cache cannot be flushed by using a trap.
10753
10754 @item -mflush-func=@var{name}
10755 @opindex mflush-func=@var{name}
10756 Specifies the name of the operating system function to call to flush
10757 the cache. The default is @emph{_flush_cache}, but a function call
10758 will only be used if a trap is not available.
10759
10760 @item -mno-flush-func
10761 @opindex mno-flush-func
10762 Indicates that there is no OS function for flushing the cache.
10763
10764 @end table
10765
10766 @node M680x0 Options
10767 @subsection M680x0 Options
10768 @cindex M680x0 options
10769
10770 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
10771 The default settings depend on which architecture was selected when
10772 the compiler was configured; the defaults for the most common choices
10773 are given below.
10774
10775 @table @gcctabopt
10776 @item -march=@var{arch}
10777 @opindex march
10778 Generate code for a specific M680x0 or ColdFire instruction set
10779 architecture. Permissible values of @var{arch} for M680x0
10780 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
10781 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
10782 architectures are selected according to Freescale's ISA classification
10783 and the permissible values are: @samp{isaa}, @samp{isaaplus},
10784 @samp{isab} and @samp{isac}.
10785
10786 gcc defines a macro @samp{__mcf@var{arch}__} whenever it is generating
10787 code for a ColdFire target. The @var{arch} in this macro is one of the
10788 @option{-march} arguments given above.
10789
10790 When used together, @option{-march} and @option{-mtune} select code
10791 that runs on a family of similar processors but that is optimized
10792 for a particular microarchitecture.
10793
10794 @item -mcpu=@var{cpu}
10795 @opindex mcpu
10796 Generate code for a specific M680x0 or ColdFire processor.
10797 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
10798 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
10799 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
10800 below, which also classifies the CPUs into families:
10801
10802 @multitable @columnfractions 0.20 0.80
10803 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
10804 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
10805 @item @samp{5206e} @tab @samp{5206e}
10806 @item @samp{5208} @tab @samp{5207} @samp{5208}
10807 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
10808 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
10809 @item @samp{5216} @tab @samp{5214} @samp{5216}
10810 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
10811 @item @samp{5225} @tab @samp{5224} @samp{5225}
10812 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
10813 @item @samp{5249} @tab @samp{5249}
10814 @item @samp{5250} @tab @samp{5250}
10815 @item @samp{5271} @tab @samp{5270} @samp{5271}
10816 @item @samp{5272} @tab @samp{5272}
10817 @item @samp{5275} @tab @samp{5274} @samp{5275}
10818 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
10819 @item @samp{5307} @tab @samp{5307}
10820 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
10821 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
10822 @item @samp{5407} @tab @samp{5407}
10823 @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}
10824 @end multitable
10825
10826 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
10827 @var{arch} is compatible with @var{cpu}. Other combinations of
10828 @option{-mcpu} and @option{-march} are rejected.
10829
10830 gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
10831 @var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}},
10832 where the value of @var{family} is given by the table above.
10833
10834 @item -mtune=@var{tune}
10835 @opindex mtune
10836 Tune the code for a particular microarchitecture, within the
10837 constraints set by @option{-march} and @option{-mcpu}.
10838 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
10839 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
10840 and @samp{cpu32}. The ColdFire microarchitectures
10841 are: @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
10842
10843 You can also use @option{-mtune=68020-40} for code that needs
10844 to run relatively well on 68020, 68030 and 68040 targets.
10845 @option{-mtune=68020-60} is similar but includes 68060 targets
10846 as well. These two options select the same tuning decisions as
10847 @option{-m68020-40} and @option{-m68020-60} respectively.
10848
10849 gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
10850 when tuning for 680x0 architecture @var{arch}. It also defines
10851 @samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
10852 option is used. If gcc is tuning for a range of architectures,
10853 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
10854 it defines the macros for every architecture in the range.
10855
10856 gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
10857 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
10858 of the arguments given above.
10859
10860 @item -m68000
10861 @itemx -mc68000
10862 @opindex m68000
10863 @opindex mc68000
10864 Generate output for a 68000. This is the default
10865 when the compiler is configured for 68000-based systems.
10866 It is equivalent to @option{-march=68000}.
10867
10868 Use this option for microcontrollers with a 68000 or EC000 core,
10869 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
10870
10871 @item -m68010
10872 @opindex m68010
10873 Generate output for a 68010. This is the default
10874 when the compiler is configured for 68010-based systems.
10875 It is equivalent to @option{-march=68010}.
10876
10877 @item -m68020
10878 @itemx -mc68020
10879 @opindex m68020
10880 @opindex mc68020
10881 Generate output for a 68020. This is the default
10882 when the compiler is configured for 68020-based systems.
10883 It is equivalent to @option{-march=68020}.
10884
10885 @item -m68030
10886 @opindex m68030
10887 Generate output for a 68030. This is the default when the compiler is
10888 configured for 68030-based systems. It is equivalent to
10889 @option{-march=68030}.
10890
10891 @item -m68040
10892 @opindex m68040
10893 Generate output for a 68040. This is the default when the compiler is
10894 configured for 68040-based systems. It is equivalent to
10895 @option{-march=68040}.
10896
10897 This option inhibits the use of 68881/68882 instructions that have to be
10898 emulated by software on the 68040. Use this option if your 68040 does not
10899 have code to emulate those instructions.
10900
10901 @item -m68060
10902 @opindex m68060
10903 Generate output for a 68060. This is the default when the compiler is
10904 configured for 68060-based systems. It is equivalent to
10905 @option{-march=68060}.
10906
10907 This option inhibits the use of 68020 and 68881/68882 instructions that
10908 have to be emulated by software on the 68060. Use this option if your 68060
10909 does not have code to emulate those instructions.
10910
10911 @item -mcpu32
10912 @opindex mcpu32
10913 Generate output for a CPU32. This is the default
10914 when the compiler is configured for CPU32-based systems.
10915 It is equivalent to @option{-march=cpu32}.
10916
10917 Use this option for microcontrollers with a
10918 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
10919 68336, 68340, 68341, 68349 and 68360.
10920
10921 @item -m5200
10922 @opindex m5200
10923 Generate output for a 520X ColdFire CPU. This is the default
10924 when the compiler is configured for 520X-based systems.
10925 It is equivalent to @option{-mcpu=5206}, and is now deprecated
10926 in favor of that option.
10927
10928 Use this option for microcontroller with a 5200 core, including
10929 the MCF5202, MCF5203, MCF5204 and MCF5206.
10930
10931 @item -m5206e
10932 @opindex m5206e
10933 Generate output for a 5206e ColdFire CPU. The option is now
10934 deprecated in favor of the equivalent @option{-mcpu=5206e}.
10935
10936 @item -m528x
10937 @opindex m528x
10938 Generate output for a member of the ColdFire 528X family.
10939 The option is now deprecated in favor of the equivalent
10940 @option{-mcpu=528x}.
10941
10942 @item -m5307
10943 @opindex m5307
10944 Generate output for a ColdFire 5307 CPU. The option is now deprecated
10945 in favor of the equivalent @option{-mcpu=5307}.
10946
10947 @item -m5407
10948 @opindex m5407
10949 Generate output for a ColdFire 5407 CPU. The option is now deprecated
10950 in favor of the equivalent @option{-mcpu=5407}.
10951
10952 @item -mcfv4e
10953 @opindex mcfv4e
10954 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
10955 This includes use of hardware floating point instructions.
10956 The option is equivalent to @option{-mcpu=547x}, and is now
10957 deprecated in favor of that option.
10958
10959 @item -m68020-40
10960 @opindex m68020-40
10961 Generate output for a 68040, without using any of the new instructions.
10962 This results in code which can run relatively efficiently on either a
10963 68020/68881 or a 68030 or a 68040. The generated code does use the
10964 68881 instructions that are emulated on the 68040.
10965
10966 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
10967
10968 @item -m68020-60
10969 @opindex m68020-60
10970 Generate output for a 68060, without using any of the new instructions.
10971 This results in code which can run relatively efficiently on either a
10972 68020/68881 or a 68030 or a 68040. The generated code does use the
10973 68881 instructions that are emulated on the 68060.
10974
10975 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
10976
10977 @item -mhard-float
10978 @itemx -m68881
10979 @opindex mhard-float
10980 @opindex m68881
10981 Generate floating-point instructions. This is the default for 68020
10982 and above, and for ColdFire devices that have an FPU. It defines the
10983 macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
10984 on ColdFire targets.
10985
10986 @item -msoft-float
10987 @opindex msoft-float
10988 Do not generate floating-point instructions; use library calls instead.
10989 This is the default for 68000, 68010, and 68832 targets. It is also
10990 the default for ColdFire devices that have no FPU.
10991
10992 @item -mdiv
10993 @itemx -mno-div
10994 @opindex mdiv
10995 @opindex mno-div
10996 Generate (do not generate) ColdFire hardware divide and remainder
10997 instructions. If @option{-march} is used without @option{-mcpu},
10998 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
10999 architectures. Otherwise, the default is taken from the target CPU
11000 (either the default CPU, or the one specified by @option{-mcpu}). For
11001 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
11002 @option{-mcpu=5206e}.
11003
11004 gcc defines the macro @samp{__mcfhwdiv__} when this option is enabled.
11005
11006 @item -mshort
11007 @opindex mshort
11008 Consider type @code{int} to be 16 bits wide, like @code{short int}.
11009 Additionally, parameters passed on the stack are also aligned to a
11010 16-bit boundary even on targets whose API mandates promotion to 32-bit.
11011
11012 @item -mno-short
11013 @opindex mno-short
11014 Do not consider type @code{int} to be 16 bits wide. This is the default.
11015
11016 @item -mnobitfield
11017 @itemx -mno-bitfield
11018 @opindex mnobitfield
11019 @opindex mno-bitfield
11020 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
11021 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
11022
11023 @item -mbitfield
11024 @opindex mbitfield
11025 Do use the bit-field instructions. The @option{-m68020} option implies
11026 @option{-mbitfield}. This is the default if you use a configuration
11027 designed for a 68020.
11028
11029 @item -mrtd
11030 @opindex mrtd
11031 Use a different function-calling convention, in which functions
11032 that take a fixed number of arguments return with the @code{rtd}
11033 instruction, which pops their arguments while returning. This
11034 saves one instruction in the caller since there is no need to pop
11035 the arguments there.
11036
11037 This calling convention is incompatible with the one normally
11038 used on Unix, so you cannot use it if you need to call libraries
11039 compiled with the Unix compiler.
11040
11041 Also, you must provide function prototypes for all functions that
11042 take variable numbers of arguments (including @code{printf});
11043 otherwise incorrect code will be generated for calls to those
11044 functions.
11045
11046 In addition, seriously incorrect code will result if you call a
11047 function with too many arguments. (Normally, extra arguments are
11048 harmlessly ignored.)
11049
11050 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
11051 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
11052
11053 @item -mno-rtd
11054 @opindex mno-rtd
11055 Do not use the calling conventions selected by @option{-mrtd}.
11056 This is the default.
11057
11058 @item -malign-int
11059 @itemx -mno-align-int
11060 @opindex malign-int
11061 @opindex mno-align-int
11062 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
11063 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
11064 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
11065 Aligning variables on 32-bit boundaries produces code that runs somewhat
11066 faster on processors with 32-bit busses at the expense of more memory.
11067
11068 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
11069 align structures containing the above types differently than
11070 most published application binary interface specifications for the m68k.
11071
11072 @item -mpcrel
11073 @opindex mpcrel
11074 Use the pc-relative addressing mode of the 68000 directly, instead of
11075 using a global offset table. At present, this option implies @option{-fpic},
11076 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
11077 not presently supported with @option{-mpcrel}, though this could be supported for
11078 68020 and higher processors.
11079
11080 @item -mno-strict-align
11081 @itemx -mstrict-align
11082 @opindex mno-strict-align
11083 @opindex mstrict-align
11084 Do not (do) assume that unaligned memory references will be handled by
11085 the system.
11086
11087 @item -msep-data
11088 Generate code that allows the data segment to be located in a different
11089 area of memory from the text segment. This allows for execute in place in
11090 an environment without virtual memory management. This option implies
11091 @option{-fPIC}.
11092
11093 @item -mno-sep-data
11094 Generate code that assumes that the data segment follows the text segment.
11095 This is the default.
11096
11097 @item -mid-shared-library
11098 Generate code that supports shared libraries via the library ID method.
11099 This allows for execute in place and shared libraries in an environment
11100 without virtual memory management. This option implies @option{-fPIC}.
11101
11102 @item -mno-id-shared-library
11103 Generate code that doesn't assume ID based shared libraries are being used.
11104 This is the default.
11105
11106 @item -mshared-library-id=n
11107 Specified the identification number of the ID based shared library being
11108 compiled. Specifying a value of 0 will generate more compact code, specifying
11109 other values will force the allocation of that number to the current
11110 library but is no more space or time efficient than omitting this option.
11111
11112 @end table
11113
11114 @node M68hc1x Options
11115 @subsection M68hc1x Options
11116 @cindex M68hc1x options
11117
11118 These are the @samp{-m} options defined for the 68hc11 and 68hc12
11119 microcontrollers. The default values for these options depends on
11120 which style of microcontroller was selected when the compiler was configured;
11121 the defaults for the most common choices are given below.
11122
11123 @table @gcctabopt
11124 @item -m6811
11125 @itemx -m68hc11
11126 @opindex m6811
11127 @opindex m68hc11
11128 Generate output for a 68HC11. This is the default
11129 when the compiler is configured for 68HC11-based systems.
11130
11131 @item -m6812
11132 @itemx -m68hc12
11133 @opindex m6812
11134 @opindex m68hc12
11135 Generate output for a 68HC12. This is the default
11136 when the compiler is configured for 68HC12-based systems.
11137
11138 @item -m68S12
11139 @itemx -m68hcs12
11140 @opindex m68S12
11141 @opindex m68hcs12
11142 Generate output for a 68HCS12.
11143
11144 @item -mauto-incdec
11145 @opindex mauto-incdec
11146 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
11147 addressing modes.
11148
11149 @item -minmax
11150 @itemx -nominmax
11151 @opindex minmax
11152 @opindex mnominmax
11153 Enable the use of 68HC12 min and max instructions.
11154
11155 @item -mlong-calls
11156 @itemx -mno-long-calls
11157 @opindex mlong-calls
11158 @opindex mno-long-calls
11159 Treat all calls as being far away (near). If calls are assumed to be
11160 far away, the compiler will use the @code{call} instruction to
11161 call a function and the @code{rtc} instruction for returning.
11162
11163 @item -mshort
11164 @opindex mshort
11165 Consider type @code{int} to be 16 bits wide, like @code{short int}.
11166
11167 @item -msoft-reg-count=@var{count}
11168 @opindex msoft-reg-count
11169 Specify the number of pseudo-soft registers which are used for the
11170 code generation. The maximum number is 32. Using more pseudo-soft
11171 register may or may not result in better code depending on the program.
11172 The default is 4 for 68HC11 and 2 for 68HC12.
11173
11174 @end table
11175
11176 @node MCore Options
11177 @subsection MCore Options
11178 @cindex MCore options
11179
11180 These are the @samp{-m} options defined for the Motorola M*Core
11181 processors.
11182
11183 @table @gcctabopt
11184
11185 @item -mhardlit
11186 @itemx -mno-hardlit
11187 @opindex mhardlit
11188 @opindex mno-hardlit
11189 Inline constants into the code stream if it can be done in two
11190 instructions or less.
11191
11192 @item -mdiv
11193 @itemx -mno-div
11194 @opindex mdiv
11195 @opindex mno-div
11196 Use the divide instruction. (Enabled by default).
11197
11198 @item -mrelax-immediate
11199 @itemx -mno-relax-immediate
11200 @opindex mrelax-immediate
11201 @opindex mno-relax-immediate
11202 Allow arbitrary sized immediates in bit operations.
11203
11204 @item -mwide-bitfields
11205 @itemx -mno-wide-bitfields
11206 @opindex mwide-bitfields
11207 @opindex mno-wide-bitfields
11208 Always treat bit-fields as int-sized.
11209
11210 @item -m4byte-functions
11211 @itemx -mno-4byte-functions
11212 @opindex m4byte-functions
11213 @opindex mno-4byte-functions
11214 Force all functions to be aligned to a four byte boundary.
11215
11216 @item -mcallgraph-data
11217 @itemx -mno-callgraph-data
11218 @opindex mcallgraph-data
11219 @opindex mno-callgraph-data
11220 Emit callgraph information.
11221
11222 @item -mslow-bytes
11223 @itemx -mno-slow-bytes
11224 @opindex mslow-bytes
11225 @opindex mno-slow-bytes
11226 Prefer word access when reading byte quantities.
11227
11228 @item -mlittle-endian
11229 @itemx -mbig-endian
11230 @opindex mlittle-endian
11231 @opindex mbig-endian
11232 Generate code for a little endian target.
11233
11234 @item -m210
11235 @itemx -m340
11236 @opindex m210
11237 @opindex m340
11238 Generate code for the 210 processor.
11239 @end table
11240
11241 @node MIPS Options
11242 @subsection MIPS Options
11243 @cindex MIPS options
11244
11245 @table @gcctabopt
11246
11247 @item -EB
11248 @opindex EB
11249 Generate big-endian code.
11250
11251 @item -EL
11252 @opindex EL
11253 Generate little-endian code. This is the default for @samp{mips*el-*-*}
11254 configurations.
11255
11256 @item -march=@var{arch}
11257 @opindex march
11258 Generate code that will run on @var{arch}, which can be the name of a
11259 generic MIPS ISA, or the name of a particular processor.
11260 The ISA names are:
11261 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
11262 @samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
11263 The processor names are:
11264 @samp{4kc}, @samp{4km}, @samp{4kp},
11265 @samp{4kec}, @samp{4kem}, @samp{4kep},
11266 @samp{5kc}, @samp{5kf},
11267 @samp{20kc},
11268 @samp{24kc}, @samp{24kf}, @samp{24kx},
11269 @samp{24kec}, @samp{24kef}, @samp{24kex},
11270 @samp{34kc}, @samp{34kf}, @samp{34kx},
11271 @samp{74kc}, @samp{74kf}, @samp{74kx},
11272 @samp{m4k},
11273 @samp{orion},
11274 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
11275 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
11276 @samp{rm7000}, @samp{rm9000},
11277 @samp{sb1},
11278 @samp{sr71000},
11279 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
11280 @samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
11281 The special value @samp{from-abi} selects the
11282 most compatible architecture for the selected ABI (that is,
11283 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
11284
11285 In processor names, a final @samp{000} can be abbreviated as @samp{k}
11286 (for example, @samp{-march=r2k}). Prefixes are optional, and
11287 @samp{vr} may be written @samp{r}.
11288
11289 GCC defines two macros based on the value of this option. The first
11290 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
11291 a string. The second has the form @samp{_MIPS_ARCH_@var{foo}},
11292 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
11293 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
11294 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
11295
11296 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
11297 above. In other words, it will have the full prefix and will not
11298 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
11299 the macro names the resolved architecture (either @samp{"mips1"} or
11300 @samp{"mips3"}). It names the default architecture when no
11301 @option{-march} option is given.
11302
11303 @item -mtune=@var{arch}
11304 @opindex mtune
11305 Optimize for @var{arch}. Among other things, this option controls
11306 the way instructions are scheduled, and the perceived cost of arithmetic
11307 operations. The list of @var{arch} values is the same as for
11308 @option{-march}.
11309
11310 When this option is not used, GCC will optimize for the processor
11311 specified by @option{-march}. By using @option{-march} and
11312 @option{-mtune} together, it is possible to generate code that will
11313 run on a family of processors, but optimize the code for one
11314 particular member of that family.
11315
11316 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
11317 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
11318 @samp{-march} ones described above.
11319
11320 @item -mips1
11321 @opindex mips1
11322 Equivalent to @samp{-march=mips1}.
11323
11324 @item -mips2
11325 @opindex mips2
11326 Equivalent to @samp{-march=mips2}.
11327
11328 @item -mips3
11329 @opindex mips3
11330 Equivalent to @samp{-march=mips3}.
11331
11332 @item -mips4
11333 @opindex mips4
11334 Equivalent to @samp{-march=mips4}.
11335
11336 @item -mips32
11337 @opindex mips32
11338 Equivalent to @samp{-march=mips32}.
11339
11340 @item -mips32r2
11341 @opindex mips32r2
11342 Equivalent to @samp{-march=mips32r2}.
11343
11344 @item -mips64
11345 @opindex mips64
11346 Equivalent to @samp{-march=mips64}.
11347
11348 @item -mips16
11349 @itemx -mno-mips16
11350 @opindex mips16
11351 @opindex mno-mips16
11352 Generate (do not generate) MIPS16 code. If GCC is targetting a
11353 MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
11354
11355 @item -mabi=32
11356 @itemx -mabi=o64
11357 @itemx -mabi=n32
11358 @itemx -mabi=64
11359 @itemx -mabi=eabi
11360 @opindex mabi=32
11361 @opindex mabi=o64
11362 @opindex mabi=n32
11363 @opindex mabi=64
11364 @opindex mabi=eabi
11365 Generate code for the given ABI@.
11366
11367 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
11368 generates 64-bit code when you select a 64-bit architecture, but you
11369 can use @option{-mgp32} to get 32-bit code instead.
11370
11371 For information about the O64 ABI, see
11372 @w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
11373
11374 GCC supports a variant of the o32 ABI in which floating-point registers
11375 are 64 rather than 32 bits wide. You can select this combination with
11376 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @samp{mthc1}
11377 and @samp{mfhc1} instructions and is therefore only supported for
11378 MIPS32R2 processors.
11379
11380 The register assignments for arguments and return values remain the
11381 same, but each scalar value is passed in a single 64-bit register
11382 rather than a pair of 32-bit registers. For example, scalar
11383 floating-point values are returned in @samp{$f0} only, not a
11384 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
11385 remains the same, but all 64 bits are saved.
11386
11387 @item -mabicalls
11388 @itemx -mno-abicalls
11389 @opindex mabicalls
11390 @opindex mno-abicalls
11391 Generate (do not generate) code that is suitable for SVR4-style
11392 dynamic objects. @option{-mabicalls} is the default for SVR4-based
11393 systems.
11394
11395 @item -mshared
11396 @itemx -mno-shared
11397 Generate (do not generate) code that is fully position-independent,
11398 and that can therefore be linked into shared libraries. This option
11399 only affects @option{-mabicalls}.
11400
11401 All @option{-mabicalls} code has traditionally been position-independent,
11402 regardless of options like @option{-fPIC} and @option{-fpic}. However,
11403 as an extension, the GNU toolchain allows executables to use absolute
11404 accesses for locally-binding symbols. It can also use shorter GP
11405 initialization sequences and generate direct calls to locally-defined
11406 functions. This mode is selected by @option{-mno-shared}.
11407
11408 @option{-mno-shared} depends on binutils 2.16 or higher and generates
11409 objects that can only be linked by the GNU linker. However, the option
11410 does not affect the ABI of the final executable; it only affects the ABI
11411 of relocatable objects. Using @option{-mno-shared} will generally make
11412 executables both smaller and quicker.
11413
11414 @option{-mshared} is the default.
11415
11416 @item -mxgot
11417 @itemx -mno-xgot
11418 @opindex mxgot
11419 @opindex mno-xgot
11420 Lift (do not lift) the usual restrictions on the size of the global
11421 offset table.
11422
11423 GCC normally uses a single instruction to load values from the GOT@.
11424 While this is relatively efficient, it will only work if the GOT
11425 is smaller than about 64k. Anything larger will cause the linker
11426 to report an error such as:
11427
11428 @cindex relocation truncated to fit (MIPS)
11429 @smallexample
11430 relocation truncated to fit: R_MIPS_GOT16 foobar
11431 @end smallexample
11432
11433 If this happens, you should recompile your code with @option{-mxgot}.
11434 It should then work with very large GOTs, although it will also be
11435 less efficient, since it will take three instructions to fetch the
11436 value of a global symbol.
11437
11438 Note that some linkers can create multiple GOTs. If you have such a
11439 linker, you should only need to use @option{-mxgot} when a single object
11440 file accesses more than 64k's worth of GOT entries. Very few do.
11441
11442 These options have no effect unless GCC is generating position
11443 independent code.
11444
11445 @item -mgp32
11446 @opindex mgp32
11447 Assume that general-purpose registers are 32 bits wide.
11448
11449 @item -mgp64
11450 @opindex mgp64
11451 Assume that general-purpose registers are 64 bits wide.
11452
11453 @item -mfp32
11454 @opindex mfp32
11455 Assume that floating-point registers are 32 bits wide.
11456
11457 @item -mfp64
11458 @opindex mfp64
11459 Assume that floating-point registers are 64 bits wide.
11460
11461 @item -mhard-float
11462 @opindex mhard-float
11463 Use floating-point coprocessor instructions.
11464
11465 @item -msoft-float
11466 @opindex msoft-float
11467 Do not use floating-point coprocessor instructions. Implement
11468 floating-point calculations using library calls instead.
11469
11470 @item -msingle-float
11471 @opindex msingle-float
11472 Assume that the floating-point coprocessor only supports single-precision
11473 operations.
11474
11475 @itemx -mdouble-float
11476 @opindex mdouble-float
11477 Assume that the floating-point coprocessor supports double-precision
11478 operations. This is the default.
11479
11480 @itemx -mdsp
11481 @itemx -mno-dsp
11482 @opindex mdsp
11483 @opindex mno-dsp
11484 Use (do not use) the MIPS DSP ASE. @xref{MIPS DSP Built-in Functions}.
11485
11486 @itemx -mdspr2
11487 @itemx -mno-dspr2
11488 @opindex mdspr2
11489 @opindex mno-dspr2
11490 Use (do not use) the MIPS DSP ASE REV 2. @xref{MIPS DSP Built-in Functions}.
11491 The option @option{-mdspr2} implies @option{-mdsp}.
11492
11493 @itemx -mpaired-single
11494 @itemx -mno-paired-single
11495 @opindex mpaired-single
11496 @opindex mno-paired-single
11497 Use (do not use) paired-single floating-point instructions.
11498 @xref{MIPS Paired-Single Support}. This option can only be used
11499 when generating 64-bit code and requires hardware floating-point
11500 support to be enabled.
11501
11502 @itemx -mips3d
11503 @itemx -mno-mips3d
11504 @opindex mips3d
11505 @opindex mno-mips3d
11506 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
11507 The option @option{-mips3d} implies @option{-mpaired-single}.
11508
11509 @item -mlong64
11510 @opindex mlong64
11511 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
11512 an explanation of the default and the way that the pointer size is
11513 determined.
11514
11515 @item -mlong32
11516 @opindex mlong32
11517 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
11518
11519 The default size of @code{int}s, @code{long}s and pointers depends on
11520 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
11521 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
11522 32-bit @code{long}s. Pointers are the same size as @code{long}s,
11523 or the same size as integer registers, whichever is smaller.
11524
11525 @item -msym32
11526 @itemx -mno-sym32
11527 @opindex msym32
11528 @opindex mno-sym32
11529 Assume (do not assume) that all symbols have 32-bit values, regardless
11530 of the selected ABI@. This option is useful in combination with
11531 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
11532 to generate shorter and faster references to symbolic addresses.
11533
11534 @item -G @var{num}
11535 @opindex G
11536 @cindex smaller data references (MIPS)
11537 @cindex gp-relative references (MIPS)
11538 Put global and static items less than or equal to @var{num} bytes into
11539 the small data or bss section instead of the normal data or bss section.
11540 This allows the data to be accessed using a single instruction.
11541
11542 All modules should be compiled with the same @option{-G @var{num}}
11543 value.
11544
11545 @item -membedded-data
11546 @itemx -mno-embedded-data
11547 @opindex membedded-data
11548 @opindex mno-embedded-data
11549 Allocate variables to the read-only data section first if possible, then
11550 next in the small data section if possible, otherwise in data. This gives
11551 slightly slower code than the default, but reduces the amount of RAM required
11552 when executing, and thus may be preferred for some embedded systems.
11553
11554 @item -muninit-const-in-rodata
11555 @itemx -mno-uninit-const-in-rodata
11556 @opindex muninit-const-in-rodata
11557 @opindex mno-uninit-const-in-rodata
11558 Put uninitialized @code{const} variables in the read-only data section.
11559 This option is only meaningful in conjunction with @option{-membedded-data}.
11560
11561 @item -msplit-addresses
11562 @itemx -mno-split-addresses
11563 @opindex msplit-addresses
11564 @opindex mno-split-addresses
11565 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
11566 relocation operators. This option has been superseded by
11567 @option{-mexplicit-relocs} but is retained for backwards compatibility.
11568
11569 @item -mexplicit-relocs
11570 @itemx -mno-explicit-relocs
11571 @opindex mexplicit-relocs
11572 @opindex mno-explicit-relocs
11573 Use (do not use) assembler relocation operators when dealing with symbolic
11574 addresses. The alternative, selected by @option{-mno-explicit-relocs},
11575 is to use assembler macros instead.
11576
11577 @option{-mexplicit-relocs} is the default if GCC was configured
11578 to use an assembler that supports relocation operators.
11579
11580 @item -mcheck-zero-division
11581 @itemx -mno-check-zero-division
11582 @opindex mcheck-zero-division
11583 @opindex mno-check-zero-division
11584 Trap (do not trap) on integer division by zero.
11585
11586 The default is @option{-mcheck-zero-division}.
11587
11588 @item -mdivide-traps
11589 @itemx -mdivide-breaks
11590 @opindex mdivide-traps
11591 @opindex mdivide-breaks
11592 MIPS systems check for division by zero by generating either a
11593 conditional trap or a break instruction. Using traps results in
11594 smaller code, but is only supported on MIPS II and later. Also, some
11595 versions of the Linux kernel have a bug that prevents trap from
11596 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
11597 allow conditional traps on architectures that support them and
11598 @option{-mdivide-breaks} to force the use of breaks.
11599
11600 The default is usually @option{-mdivide-traps}, but this can be
11601 overridden at configure time using @option{--with-divide=breaks}.
11602 Divide-by-zero checks can be completely disabled using
11603 @option{-mno-check-zero-division}.
11604
11605 @item -mmemcpy
11606 @itemx -mno-memcpy
11607 @opindex mmemcpy
11608 @opindex mno-memcpy
11609 Force (do not force) the use of @code{memcpy()} for non-trivial block
11610 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
11611 most constant-sized copies.
11612
11613 @item -mlong-calls
11614 @itemx -mno-long-calls
11615 @opindex mlong-calls
11616 @opindex mno-long-calls
11617 Disable (do not disable) use of the @code{jal} instruction. Calling
11618 functions using @code{jal} is more efficient but requires the caller
11619 and callee to be in the same 256 megabyte segment.
11620
11621 This option has no effect on abicalls code. The default is
11622 @option{-mno-long-calls}.
11623
11624 @item -mmad
11625 @itemx -mno-mad
11626 @opindex mmad
11627 @opindex mno-mad
11628 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
11629 instructions, as provided by the R4650 ISA@.
11630
11631 @item -mfused-madd
11632 @itemx -mno-fused-madd
11633 @opindex mfused-madd
11634 @opindex mno-fused-madd
11635 Enable (disable) use of the floating point multiply-accumulate
11636 instructions, when they are available. The default is
11637 @option{-mfused-madd}.
11638
11639 When multiply-accumulate instructions are used, the intermediate
11640 product is calculated to infinite precision and is not subject to
11641 the FCSR Flush to Zero bit. This may be undesirable in some
11642 circumstances.
11643
11644 @item -nocpp
11645 @opindex nocpp
11646 Tell the MIPS assembler to not run its preprocessor over user
11647 assembler files (with a @samp{.s} suffix) when assembling them.
11648
11649 @item -mfix-r4000
11650 @itemx -mno-fix-r4000
11651 @opindex mfix-r4000
11652 @opindex mno-fix-r4000
11653 Work around certain R4000 CPU errata:
11654 @itemize @minus
11655 @item
11656 A double-word or a variable shift may give an incorrect result if executed
11657 immediately after starting an integer division.
11658 @item
11659 A double-word or a variable shift may give an incorrect result if executed
11660 while an integer multiplication is in progress.
11661 @item
11662 An integer division may give an incorrect result if started in a delay slot
11663 of a taken branch or a jump.
11664 @end itemize
11665
11666 @item -mfix-r4400
11667 @itemx -mno-fix-r4400
11668 @opindex mfix-r4400
11669 @opindex mno-fix-r4400
11670 Work around certain R4400 CPU errata:
11671 @itemize @minus
11672 @item
11673 A double-word or a variable shift may give an incorrect result if executed
11674 immediately after starting an integer division.
11675 @end itemize
11676
11677 @item -mfix-vr4120
11678 @itemx -mno-fix-vr4120
11679 @opindex mfix-vr4120
11680 Work around certain VR4120 errata:
11681 @itemize @minus
11682 @item
11683 @code{dmultu} does not always produce the correct result.
11684 @item
11685 @code{div} and @code{ddiv} do not always produce the correct result if one
11686 of the operands is negative.
11687 @end itemize
11688 The workarounds for the division errata rely on special functions in
11689 @file{libgcc.a}. At present, these functions are only provided by
11690 the @code{mips64vr*-elf} configurations.
11691
11692 Other VR4120 errata require a nop to be inserted between certain pairs of
11693 instructions. These errata are handled by the assembler, not by GCC itself.
11694
11695 @item -mfix-vr4130
11696 @opindex mfix-vr4130
11697 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
11698 workarounds are implemented by the assembler rather than by GCC,
11699 although GCC will avoid using @code{mflo} and @code{mfhi} if the
11700 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
11701 instructions are available instead.
11702
11703 @item -mfix-sb1
11704 @itemx -mno-fix-sb1
11705 @opindex mfix-sb1
11706 Work around certain SB-1 CPU core errata.
11707 (This flag currently works around the SB-1 revision 2
11708 ``F1'' and ``F2'' floating point errata.)
11709
11710 @item -mflush-func=@var{func}
11711 @itemx -mno-flush-func
11712 @opindex mflush-func
11713 Specifies the function to call to flush the I and D caches, or to not
11714 call any such function. If called, the function must take the same
11715 arguments as the common @code{_flush_func()}, that is, the address of the
11716 memory range for which the cache is being flushed, the size of the
11717 memory range, and the number 3 (to flush both caches). The default
11718 depends on the target GCC was configured for, but commonly is either
11719 @samp{_flush_func} or @samp{__cpu_flush}.
11720
11721 @item -mbranch-likely
11722 @itemx -mno-branch-likely
11723 @opindex mbranch-likely
11724 @opindex mno-branch-likely
11725 Enable or disable use of Branch Likely instructions, regardless of the
11726 default for the selected architecture. By default, Branch Likely
11727 instructions may be generated if they are supported by the selected
11728 architecture. An exception is for the MIPS32 and MIPS64 architectures
11729 and processors which implement those architectures; for those, Branch
11730 Likely instructions will not be generated by default because the MIPS32
11731 and MIPS64 architectures specifically deprecate their use.
11732
11733 @item -mfp-exceptions
11734 @itemx -mno-fp-exceptions
11735 @opindex mfp-exceptions
11736 Specifies whether FP exceptions are enabled. This affects how we schedule
11737 FP instructions for some processors. The default is that FP exceptions are
11738 enabled.
11739
11740 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
11741 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
11742 FP pipe.
11743
11744 @item -mvr4130-align
11745 @itemx -mno-vr4130-align
11746 @opindex mvr4130-align
11747 The VR4130 pipeline is two-way superscalar, but can only issue two
11748 instructions together if the first one is 8-byte aligned. When this
11749 option is enabled, GCC will align pairs of instructions that it
11750 thinks should execute in parallel.
11751
11752 This option only has an effect when optimizing for the VR4130.
11753 It normally makes code faster, but at the expense of making it bigger.
11754 It is enabled by default at optimization level @option{-O3}.
11755 @end table
11756
11757 @node MMIX Options
11758 @subsection MMIX Options
11759 @cindex MMIX Options
11760
11761 These options are defined for the MMIX:
11762
11763 @table @gcctabopt
11764 @item -mlibfuncs
11765 @itemx -mno-libfuncs
11766 @opindex mlibfuncs
11767 @opindex mno-libfuncs
11768 Specify that intrinsic library functions are being compiled, passing all
11769 values in registers, no matter the size.
11770
11771 @item -mepsilon
11772 @itemx -mno-epsilon
11773 @opindex mepsilon
11774 @opindex mno-epsilon
11775 Generate floating-point comparison instructions that compare with respect
11776 to the @code{rE} epsilon register.
11777
11778 @item -mabi=mmixware
11779 @itemx -mabi=gnu
11780 @opindex mabi-mmixware
11781 @opindex mabi=gnu
11782 Generate code that passes function parameters and return values that (in
11783 the called function) are seen as registers @code{$0} and up, as opposed to
11784 the GNU ABI which uses global registers @code{$231} and up.
11785
11786 @item -mzero-extend
11787 @itemx -mno-zero-extend
11788 @opindex mzero-extend
11789 @opindex mno-zero-extend
11790 When reading data from memory in sizes shorter than 64 bits, use (do not
11791 use) zero-extending load instructions by default, rather than
11792 sign-extending ones.
11793
11794 @item -mknuthdiv
11795 @itemx -mno-knuthdiv
11796 @opindex mknuthdiv
11797 @opindex mno-knuthdiv
11798 Make the result of a division yielding a remainder have the same sign as
11799 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
11800 remainder follows the sign of the dividend. Both methods are
11801 arithmetically valid, the latter being almost exclusively used.
11802
11803 @item -mtoplevel-symbols
11804 @itemx -mno-toplevel-symbols
11805 @opindex mtoplevel-symbols
11806 @opindex mno-toplevel-symbols
11807 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
11808 code can be used with the @code{PREFIX} assembly directive.
11809
11810 @item -melf
11811 @opindex melf
11812 Generate an executable in the ELF format, rather than the default
11813 @samp{mmo} format used by the @command{mmix} simulator.
11814
11815 @item -mbranch-predict
11816 @itemx -mno-branch-predict
11817 @opindex mbranch-predict
11818 @opindex mno-branch-predict
11819 Use (do not use) the probable-branch instructions, when static branch
11820 prediction indicates a probable branch.
11821
11822 @item -mbase-addresses
11823 @itemx -mno-base-addresses
11824 @opindex mbase-addresses
11825 @opindex mno-base-addresses
11826 Generate (do not generate) code that uses @emph{base addresses}. Using a
11827 base address automatically generates a request (handled by the assembler
11828 and the linker) for a constant to be set up in a global register. The
11829 register is used for one or more base address requests within the range 0
11830 to 255 from the value held in the register. The generally leads to short
11831 and fast code, but the number of different data items that can be
11832 addressed is limited. This means that a program that uses lots of static
11833 data may require @option{-mno-base-addresses}.
11834
11835 @item -msingle-exit
11836 @itemx -mno-single-exit
11837 @opindex msingle-exit
11838 @opindex mno-single-exit
11839 Force (do not force) generated code to have a single exit point in each
11840 function.
11841 @end table
11842
11843 @node MN10300 Options
11844 @subsection MN10300 Options
11845 @cindex MN10300 options
11846
11847 These @option{-m} options are defined for Matsushita MN10300 architectures:
11848
11849 @table @gcctabopt
11850 @item -mmult-bug
11851 @opindex mmult-bug
11852 Generate code to avoid bugs in the multiply instructions for the MN10300
11853 processors. This is the default.
11854
11855 @item -mno-mult-bug
11856 @opindex mno-mult-bug
11857 Do not generate code to avoid bugs in the multiply instructions for the
11858 MN10300 processors.
11859
11860 @item -mam33
11861 @opindex mam33
11862 Generate code which uses features specific to the AM33 processor.
11863
11864 @item -mno-am33
11865 @opindex mno-am33
11866 Do not generate code which uses features specific to the AM33 processor. This
11867 is the default.
11868
11869 @item -mreturn-pointer-on-d0
11870 @opindex mreturn-pointer-on-d0
11871 When generating a function which returns a pointer, return the pointer
11872 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
11873 only in a0, and attempts to call such functions without a prototype
11874 would result in errors. Note that this option is on by default; use
11875 @option{-mno-return-pointer-on-d0} to disable it.
11876
11877 @item -mno-crt0
11878 @opindex mno-crt0
11879 Do not link in the C run-time initialization object file.
11880
11881 @item -mrelax
11882 @opindex mrelax
11883 Indicate to the linker that it should perform a relaxation optimization pass
11884 to shorten branches, calls and absolute memory addresses. This option only
11885 has an effect when used on the command line for the final link step.
11886
11887 This option makes symbolic debugging impossible.
11888 @end table
11889
11890 @node MT Options
11891 @subsection MT Options
11892 @cindex MT options
11893
11894 These @option{-m} options are defined for Morpho MT architectures:
11895
11896 @table @gcctabopt
11897
11898 @item -march=@var{cpu-type}
11899 @opindex march
11900 Generate code that will run on @var{cpu-type}, which is the name of a system
11901 representing a certain processor type. Possible values for
11902 @var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002},
11903 @samp{ms1-16-003} and @samp{ms2}.
11904
11905 When this option is not used, the default is @option{-march=ms1-16-002}.
11906
11907 @item -mbacc
11908 @opindex mbacc
11909 Use byte loads and stores when generating code.
11910
11911 @item -mno-bacc
11912 @opindex mno-bacc
11913 Do not use byte loads and stores when generating code.
11914
11915 @item -msim
11916 @opindex msim
11917 Use simulator runtime
11918
11919 @item -mno-crt0
11920 @opindex mno-crt0
11921 Do not link in the C run-time initialization object file
11922 @file{crti.o}. Other run-time initialization and termination files
11923 such as @file{startup.o} and @file{exit.o} are still included on the
11924 linker command line.
11925
11926 @end table
11927
11928 @node PDP-11 Options
11929 @subsection PDP-11 Options
11930 @cindex PDP-11 Options
11931
11932 These options are defined for the PDP-11:
11933
11934 @table @gcctabopt
11935 @item -mfpu
11936 @opindex mfpu
11937 Use hardware FPP floating point. This is the default. (FIS floating
11938 point on the PDP-11/40 is not supported.)
11939
11940 @item -msoft-float
11941 @opindex msoft-float
11942 Do not use hardware floating point.
11943
11944 @item -mac0
11945 @opindex mac0
11946 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
11947
11948 @item -mno-ac0
11949 @opindex mno-ac0
11950 Return floating-point results in memory. This is the default.
11951
11952 @item -m40
11953 @opindex m40
11954 Generate code for a PDP-11/40.
11955
11956 @item -m45
11957 @opindex m45
11958 Generate code for a PDP-11/45. This is the default.
11959
11960 @item -m10
11961 @opindex m10
11962 Generate code for a PDP-11/10.
11963
11964 @item -mbcopy-builtin
11965 @opindex bcopy-builtin
11966 Use inline @code{movmemhi} patterns for copying memory. This is the
11967 default.
11968
11969 @item -mbcopy
11970 @opindex mbcopy
11971 Do not use inline @code{movmemhi} patterns for copying memory.
11972
11973 @item -mint16
11974 @itemx -mno-int32
11975 @opindex mint16
11976 @opindex mno-int32
11977 Use 16-bit @code{int}. This is the default.
11978
11979 @item -mint32
11980 @itemx -mno-int16
11981 @opindex mint32
11982 @opindex mno-int16
11983 Use 32-bit @code{int}.
11984
11985 @item -mfloat64
11986 @itemx -mno-float32
11987 @opindex mfloat64
11988 @opindex mno-float32
11989 Use 64-bit @code{float}. This is the default.
11990
11991 @item -mfloat32
11992 @itemx -mno-float64
11993 @opindex mfloat32
11994 @opindex mno-float64
11995 Use 32-bit @code{float}.
11996
11997 @item -mabshi
11998 @opindex mabshi
11999 Use @code{abshi2} pattern. This is the default.
12000
12001 @item -mno-abshi
12002 @opindex mno-abshi
12003 Do not use @code{abshi2} pattern.
12004
12005 @item -mbranch-expensive
12006 @opindex mbranch-expensive
12007 Pretend that branches are expensive. This is for experimenting with
12008 code generation only.
12009
12010 @item -mbranch-cheap
12011 @opindex mbranch-cheap
12012 Do not pretend that branches are expensive. This is the default.
12013
12014 @item -msplit
12015 @opindex msplit
12016 Generate code for a system with split I&D@.
12017
12018 @item -mno-split
12019 @opindex mno-split
12020 Generate code for a system without split I&D@. This is the default.
12021
12022 @item -munix-asm
12023 @opindex munix-asm
12024 Use Unix assembler syntax. This is the default when configured for
12025 @samp{pdp11-*-bsd}.
12026
12027 @item -mdec-asm
12028 @opindex mdec-asm
12029 Use DEC assembler syntax. This is the default when configured for any
12030 PDP-11 target other than @samp{pdp11-*-bsd}.
12031 @end table
12032
12033 @node PowerPC Options
12034 @subsection PowerPC Options
12035 @cindex PowerPC options
12036
12037 These are listed under @xref{RS/6000 and PowerPC Options}.
12038
12039 @node RS/6000 and PowerPC Options
12040 @subsection IBM RS/6000 and PowerPC Options
12041 @cindex RS/6000 and PowerPC Options
12042 @cindex IBM RS/6000 and PowerPC Options
12043
12044 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
12045 @table @gcctabopt
12046 @item -mpower
12047 @itemx -mno-power
12048 @itemx -mpower2
12049 @itemx -mno-power2
12050 @itemx -mpowerpc
12051 @itemx -mno-powerpc
12052 @itemx -mpowerpc-gpopt
12053 @itemx -mno-powerpc-gpopt
12054 @itemx -mpowerpc-gfxopt
12055 @itemx -mno-powerpc-gfxopt
12056 @itemx -mpowerpc64
12057 @itemx -mno-powerpc64
12058 @itemx -mmfcrf
12059 @itemx -mno-mfcrf
12060 @itemx -mpopcntb
12061 @itemx -mno-popcntb
12062 @itemx -mfprnd
12063 @itemx -mno-fprnd
12064 @itemx -mcmpb
12065 @itemx -mno-cmpb
12066 @itemx -mmfpgpr
12067 @itemx -mno-mfpgpr
12068 @itemx -mdfp
12069 @itemx -mno-dfp
12070 @opindex mpower
12071 @opindex mno-power
12072 @opindex mpower2
12073 @opindex mno-power2
12074 @opindex mpowerpc
12075 @opindex mno-powerpc
12076 @opindex mpowerpc-gpopt
12077 @opindex mno-powerpc-gpopt
12078 @opindex mpowerpc-gfxopt
12079 @opindex mno-powerpc-gfxopt
12080 @opindex mpowerpc64
12081 @opindex mno-powerpc64
12082 @opindex mmfcrf
12083 @opindex mno-mfcrf
12084 @opindex mpopcntb
12085 @opindex mno-popcntb
12086 @opindex mfprnd
12087 @opindex mno-fprnd
12088 @opindex mcmpb
12089 @opindex mno-cmpb
12090 @opindex mmfpgpr
12091 @opindex mno-mfpgpr
12092 @opindex mdfp
12093 @opindex mno-dfp
12094 GCC supports two related instruction set architectures for the
12095 RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
12096 instructions supported by the @samp{rios} chip set used in the original
12097 RS/6000 systems and the @dfn{PowerPC} instruction set is the
12098 architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
12099 the IBM 4xx, 6xx, and follow-on microprocessors.
12100
12101 Neither architecture is a subset of the other. However there is a
12102 large common subset of instructions supported by both. An MQ
12103 register is included in processors supporting the POWER architecture.
12104
12105 You use these options to specify which instructions are available on the
12106 processor you are using. The default value of these options is
12107 determined when configuring GCC@. Specifying the
12108 @option{-mcpu=@var{cpu_type}} overrides the specification of these
12109 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
12110 rather than the options listed above.
12111
12112 The @option{-mpower} option allows GCC to generate instructions that
12113 are found only in the POWER architecture and to use the MQ register.
12114 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
12115 to generate instructions that are present in the POWER2 architecture but
12116 not the original POWER architecture.
12117
12118 The @option{-mpowerpc} option allows GCC to generate instructions that
12119 are found only in the 32-bit subset of the PowerPC architecture.
12120 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
12121 GCC to use the optional PowerPC architecture instructions in the
12122 General Purpose group, including floating-point square root. Specifying
12123 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
12124 use the optional PowerPC architecture instructions in the Graphics
12125 group, including floating-point select.
12126
12127 The @option{-mmfcrf} option allows GCC to generate the move from
12128 condition register field instruction implemented on the POWER4
12129 processor and other processors that support the PowerPC V2.01
12130 architecture.
12131 The @option{-mpopcntb} option allows GCC to generate the popcount and
12132 double precision FP reciprocal estimate instruction implemented on the
12133 POWER5 processor and other processors that support the PowerPC V2.02
12134 architecture.
12135 The @option{-mfprnd} option allows GCC to generate the FP round to
12136 integer instructions implemented on the POWER5+ processor and other
12137 processors that support the PowerPC V2.03 architecture.
12138 The @option{-mcmpb} option allows GCC to generate the compare bytes
12139 instruction implemented on the POWER6 processor and other processors
12140 that support the PowerPC V2.05 architecture.
12141 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
12142 general purpose register instructions implemented on the POWER6X
12143 processor and other processors that support the extended PowerPC V2.05
12144 architecture.
12145 The @option{-mdfp} option allows GCC to generate the decimal floating
12146 point instructions implemented on some POWER processors.
12147
12148 The @option{-mpowerpc64} option allows GCC to generate the additional
12149 64-bit instructions that are found in the full PowerPC64 architecture
12150 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
12151 @option{-mno-powerpc64}.
12152
12153 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
12154 will use only the instructions in the common subset of both
12155 architectures plus some special AIX common-mode calls, and will not use
12156 the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc}
12157 permits GCC to use any instruction from either architecture and to
12158 allow use of the MQ register; specify this for the Motorola MPC601.
12159
12160 @item -mnew-mnemonics
12161 @itemx -mold-mnemonics
12162 @opindex mnew-mnemonics
12163 @opindex mold-mnemonics
12164 Select which mnemonics to use in the generated assembler code. With
12165 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
12166 the PowerPC architecture. With @option{-mold-mnemonics} it uses the
12167 assembler mnemonics defined for the POWER architecture. Instructions
12168 defined in only one architecture have only one mnemonic; GCC uses that
12169 mnemonic irrespective of which of these options is specified.
12170
12171 GCC defaults to the mnemonics appropriate for the architecture in
12172 use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
12173 value of these option. Unless you are building a cross-compiler, you
12174 should normally not specify either @option{-mnew-mnemonics} or
12175 @option{-mold-mnemonics}, but should instead accept the default.
12176
12177 @item -mcpu=@var{cpu_type}
12178 @opindex mcpu
12179 Set architecture type, register usage, choice of mnemonics, and
12180 instruction scheduling parameters for machine type @var{cpu_type}.
12181 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
12182 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
12183 @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
12184 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
12185 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
12186 @samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3},
12187 @samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
12188 @samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6},
12189 @samp{power6x}, @samp{common}, @samp{powerpc}, @samp{powerpc64},
12190 @samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
12191
12192 @option{-mcpu=common} selects a completely generic processor. Code
12193 generated under this option will run on any POWER or PowerPC processor.
12194 GCC will use only the instructions in the common subset of both
12195 architectures, and will not use the MQ register. GCC assumes a generic
12196 processor model for scheduling purposes.
12197
12198 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
12199 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
12200 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
12201 types, with an appropriate, generic processor model assumed for
12202 scheduling purposes.
12203
12204 The other options specify a specific processor. Code generated under
12205 those options will run best on that processor, and may not run at all on
12206 others.
12207
12208 The @option{-mcpu} options automatically enable or disable the
12209 following options:
12210
12211 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
12212 -mnew-mnemonics -mpopcntb -mpower -mpower2 -mpowerpc64 @gol
12213 -mpowerpc-gpopt -mpowerpc-gfxopt -mstring -mmulhw -mdlmzb -mmfpgpr}
12214
12215 The particular options set for any particular CPU will vary between
12216 compiler versions, depending on what setting seems to produce optimal
12217 code for that CPU; it doesn't necessarily reflect the actual hardware's
12218 capabilities. If you wish to set an individual option to a particular
12219 value, you may specify it after the @option{-mcpu} option, like
12220 @samp{-mcpu=970 -mno-altivec}.
12221
12222 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
12223 not enabled or disabled by the @option{-mcpu} option at present because
12224 AIX does not have full support for these options. You may still
12225 enable or disable them individually if you're sure it'll work in your
12226 environment.
12227
12228 @item -mtune=@var{cpu_type}
12229 @opindex mtune
12230 Set the instruction scheduling parameters for machine type
12231 @var{cpu_type}, but do not set the architecture type, register usage, or
12232 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same
12233 values for @var{cpu_type} are used for @option{-mtune} as for
12234 @option{-mcpu}. If both are specified, the code generated will use the
12235 architecture, registers, and mnemonics set by @option{-mcpu}, but the
12236 scheduling parameters set by @option{-mtune}.
12237
12238 @item -mswdiv
12239 @itemx -mno-swdiv
12240 @opindex mswdiv
12241 @opindex mno-swdiv
12242 Generate code to compute division as reciprocal estimate and iterative
12243 refinement, creating opportunities for increased throughput. This
12244 feature requires: optional PowerPC Graphics instruction set for single
12245 precision and FRE instruction for double precision, assuming divides
12246 cannot generate user-visible traps, and the domain values not include
12247 Infinities, denormals or zero denominator.
12248
12249 @item -maltivec
12250 @itemx -mno-altivec
12251 @opindex maltivec
12252 @opindex mno-altivec
12253 Generate code that uses (does not use) AltiVec instructions, and also
12254 enable the use of built-in functions that allow more direct access to
12255 the AltiVec instruction set. You may also need to set
12256 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
12257 enhancements.
12258
12259 @item -mvrsave
12260 @item -mno-vrsave
12261 @opindex mvrsave
12262 @opindex mno-vrsave
12263 Generate VRSAVE instructions when generating AltiVec code.
12264
12265 @item -msecure-plt
12266 @opindex msecure-plt
12267 Generate code that allows ld and ld.so to build executables and shared
12268 libraries with non-exec .plt and .got sections. This is a PowerPC
12269 32-bit SYSV ABI option.
12270
12271 @item -mbss-plt
12272 @opindex mbss-plt
12273 Generate code that uses a BSS .plt section that ld.so fills in, and
12274 requires .plt and .got sections that are both writable and executable.
12275 This is a PowerPC 32-bit SYSV ABI option.
12276
12277 @item -misel
12278 @itemx -mno-isel
12279 @opindex misel
12280 @opindex mno-isel
12281 This switch enables or disables the generation of ISEL instructions.
12282
12283 @item -misel=@var{yes/no}
12284 This switch has been deprecated. Use @option{-misel} and
12285 @option{-mno-isel} instead.
12286
12287 @item -mspe
12288 @itemx -mno-spe
12289 @opindex mspe
12290 @opindex mno-spe
12291 This switch enables or disables the generation of SPE simd
12292 instructions.
12293
12294 @item -mspe=@var{yes/no}
12295 This option has been deprecated. Use @option{-mspe} and
12296 @option{-mno-spe} instead.
12297
12298 @item -mfloat-gprs=@var{yes/single/double/no}
12299 @itemx -mfloat-gprs
12300 @opindex mfloat-gprs
12301 This switch enables or disables the generation of floating point
12302 operations on the general purpose registers for architectures that
12303 support it.
12304
12305 The argument @var{yes} or @var{single} enables the use of
12306 single-precision floating point operations.
12307
12308 The argument @var{double} enables the use of single and
12309 double-precision floating point operations.
12310
12311 The argument @var{no} disables floating point operations on the
12312 general purpose registers.
12313
12314 This option is currently only available on the MPC854x.
12315
12316 @item -m32
12317 @itemx -m64
12318 @opindex m32
12319 @opindex m64
12320 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
12321 targets (including GNU/Linux). The 32-bit environment sets int, long
12322 and pointer to 32 bits and generates code that runs on any PowerPC
12323 variant. The 64-bit environment sets int to 32 bits and long and
12324 pointer to 64 bits, and generates code for PowerPC64, as for
12325 @option{-mpowerpc64}.
12326
12327 @item -mfull-toc
12328 @itemx -mno-fp-in-toc
12329 @itemx -mno-sum-in-toc
12330 @itemx -mminimal-toc
12331 @opindex mfull-toc
12332 @opindex mno-fp-in-toc
12333 @opindex mno-sum-in-toc
12334 @opindex mminimal-toc
12335 Modify generation of the TOC (Table Of Contents), which is created for
12336 every executable file. The @option{-mfull-toc} option is selected by
12337 default. In that case, GCC will allocate at least one TOC entry for
12338 each unique non-automatic variable reference in your program. GCC
12339 will also place floating-point constants in the TOC@. However, only
12340 16,384 entries are available in the TOC@.
12341
12342 If you receive a linker error message that saying you have overflowed
12343 the available TOC space, you can reduce the amount of TOC space used
12344 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
12345 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
12346 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
12347 generate code to calculate the sum of an address and a constant at
12348 run-time instead of putting that sum into the TOC@. You may specify one
12349 or both of these options. Each causes GCC to produce very slightly
12350 slower and larger code at the expense of conserving TOC space.
12351
12352 If you still run out of space in the TOC even when you specify both of
12353 these options, specify @option{-mminimal-toc} instead. This option causes
12354 GCC to make only one TOC entry for every file. When you specify this
12355 option, GCC will produce code that is slower and larger but which
12356 uses extremely little TOC space. You may wish to use this option
12357 only on files that contain less frequently executed code.
12358
12359 @item -maix64
12360 @itemx -maix32
12361 @opindex maix64
12362 @opindex maix32
12363 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
12364 @code{long} type, and the infrastructure needed to support them.
12365 Specifying @option{-maix64} implies @option{-mpowerpc64} and
12366 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
12367 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
12368
12369 @item -mxl-compat
12370 @itemx -mno-xl-compat
12371 @opindex mxl-compat
12372 @opindex mno-xl-compat
12373 Produce code that conforms more closely to IBM XL compiler semantics
12374 when using AIX-compatible ABI. Pass floating-point arguments to
12375 prototyped functions beyond the register save area (RSA) on the stack
12376 in addition to argument FPRs. Do not assume that most significant
12377 double in 128-bit long double value is properly rounded when comparing
12378 values and converting to double. Use XL symbol names for long double
12379 support routines.
12380
12381 The AIX calling convention was extended but not initially documented to
12382 handle an obscure K&R C case of calling a function that takes the
12383 address of its arguments with fewer arguments than declared. IBM XL
12384 compilers access floating point arguments which do not fit in the
12385 RSA from the stack when a subroutine is compiled without
12386 optimization. Because always storing floating-point arguments on the
12387 stack is inefficient and rarely needed, this option is not enabled by
12388 default and only is necessary when calling subroutines compiled by IBM
12389 XL compilers without optimization.
12390
12391 @item -mpe
12392 @opindex mpe
12393 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
12394 application written to use message passing with special startup code to
12395 enable the application to run. The system must have PE installed in the
12396 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
12397 must be overridden with the @option{-specs=} option to specify the
12398 appropriate directory location. The Parallel Environment does not
12399 support threads, so the @option{-mpe} option and the @option{-pthread}
12400 option are incompatible.
12401
12402 @item -malign-natural
12403 @itemx -malign-power
12404 @opindex malign-natural
12405 @opindex malign-power
12406 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
12407 @option{-malign-natural} overrides the ABI-defined alignment of larger
12408 types, such as floating-point doubles, on their natural size-based boundary.
12409 The option @option{-malign-power} instructs GCC to follow the ABI-specified
12410 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
12411
12412 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
12413 is not supported.
12414
12415 @item -msoft-float
12416 @itemx -mhard-float
12417 @opindex msoft-float
12418 @opindex mhard-float
12419 Generate code that does not use (uses) the floating-point register set.
12420 Software floating point emulation is provided if you use the
12421 @option{-msoft-float} option, and pass the option to GCC when linking.
12422
12423 @item -mmultiple
12424 @itemx -mno-multiple
12425 @opindex mmultiple
12426 @opindex mno-multiple
12427 Generate code that uses (does not use) the load multiple word
12428 instructions and the store multiple word instructions. These
12429 instructions are generated by default on POWER systems, and not
12430 generated on PowerPC systems. Do not use @option{-mmultiple} on little
12431 endian PowerPC systems, since those instructions do not work when the
12432 processor is in little endian mode. The exceptions are PPC740 and
12433 PPC750 which permit the instructions usage in little endian mode.
12434
12435 @item -mstring
12436 @itemx -mno-string
12437 @opindex mstring
12438 @opindex mno-string
12439 Generate code that uses (does not use) the load string instructions
12440 and the store string word instructions to save multiple registers and
12441 do small block moves. These instructions are generated by default on
12442 POWER systems, and not generated on PowerPC systems. Do not use
12443 @option{-mstring} on little endian PowerPC systems, since those
12444 instructions do not work when the processor is in little endian mode.
12445 The exceptions are PPC740 and PPC750 which permit the instructions
12446 usage in little endian mode.
12447
12448 @item -mupdate
12449 @itemx -mno-update
12450 @opindex mupdate
12451 @opindex mno-update
12452 Generate code that uses (does not use) the load or store instructions
12453 that update the base register to the address of the calculated memory
12454 location. These instructions are generated by default. If you use
12455 @option{-mno-update}, there is a small window between the time that the
12456 stack pointer is updated and the address of the previous frame is
12457 stored, which means code that walks the stack frame across interrupts or
12458 signals may get corrupted data.
12459
12460 @item -mfused-madd
12461 @itemx -mno-fused-madd
12462 @opindex mfused-madd
12463 @opindex mno-fused-madd
12464 Generate code that uses (does not use) the floating point multiply and
12465 accumulate instructions. These instructions are generated by default if
12466 hardware floating is used.
12467
12468 @item -mmulhw
12469 @itemx -mno-mulhw
12470 @opindex mmulhw
12471 @opindex mno-mulhw
12472 Generate code that uses (does not use) the half-word multiply and
12473 multiply-accumulate instructions on the IBM 405 and 440 processors.
12474 These instructions are generated by default when targetting those
12475 processors.
12476
12477 @item -mdlmzb
12478 @itemx -mno-dlmzb
12479 @opindex mdlmzb
12480 @opindex mno-dlmzb
12481 Generate code that uses (does not use) the string-search @samp{dlmzb}
12482 instruction on the IBM 405 and 440 processors. This instruction is
12483 generated by default when targetting those processors.
12484
12485 @item -mno-bit-align
12486 @itemx -mbit-align
12487 @opindex mno-bit-align
12488 @opindex mbit-align
12489 On System V.4 and embedded PowerPC systems do not (do) force structures
12490 and unions that contain bit-fields to be aligned to the base type of the
12491 bit-field.
12492
12493 For example, by default a structure containing nothing but 8
12494 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
12495 boundary and have a size of 4 bytes. By using @option{-mno-bit-align},
12496 the structure would be aligned to a 1 byte boundary and be one byte in
12497 size.
12498
12499 @item -mno-strict-align
12500 @itemx -mstrict-align
12501 @opindex mno-strict-align
12502 @opindex mstrict-align
12503 On System V.4 and embedded PowerPC systems do not (do) assume that
12504 unaligned memory references will be handled by the system.
12505
12506 @item -mrelocatable
12507 @itemx -mno-relocatable
12508 @opindex mrelocatable
12509 @opindex mno-relocatable
12510 On embedded PowerPC systems generate code that allows (does not allow)
12511 the program to be relocated to a different address at runtime. If you
12512 use @option{-mrelocatable} on any module, all objects linked together must
12513 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
12514
12515 @item -mrelocatable-lib
12516 @itemx -mno-relocatable-lib
12517 @opindex mrelocatable-lib
12518 @opindex mno-relocatable-lib
12519 On embedded PowerPC systems generate code that allows (does not allow)
12520 the program to be relocated to a different address at runtime. Modules
12521 compiled with @option{-mrelocatable-lib} can be linked with either modules
12522 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
12523 with modules compiled with the @option{-mrelocatable} options.
12524
12525 @item -mno-toc
12526 @itemx -mtoc
12527 @opindex mno-toc
12528 @opindex mtoc
12529 On System V.4 and embedded PowerPC systems do not (do) assume that
12530 register 2 contains a pointer to a global area pointing to the addresses
12531 used in the program.
12532
12533 @item -mlittle
12534 @itemx -mlittle-endian
12535 @opindex mlittle
12536 @opindex mlittle-endian
12537 On System V.4 and embedded PowerPC systems compile code for the
12538 processor in little endian mode. The @option{-mlittle-endian} option is
12539 the same as @option{-mlittle}.
12540
12541 @item -mbig
12542 @itemx -mbig-endian
12543 @opindex mbig
12544 @opindex mbig-endian
12545 On System V.4 and embedded PowerPC systems compile code for the
12546 processor in big endian mode. The @option{-mbig-endian} option is
12547 the same as @option{-mbig}.
12548
12549 @item -mdynamic-no-pic
12550 @opindex mdynamic-no-pic
12551 On Darwin and Mac OS X systems, compile code so that it is not
12552 relocatable, but that its external references are relocatable. The
12553 resulting code is suitable for applications, but not shared
12554 libraries.
12555
12556 @item -mprioritize-restricted-insns=@var{priority}
12557 @opindex mprioritize-restricted-insns
12558 This option controls the priority that is assigned to
12559 dispatch-slot restricted instructions during the second scheduling
12560 pass. The argument @var{priority} takes the value @var{0/1/2} to assign
12561 @var{no/highest/second-highest} priority to dispatch slot restricted
12562 instructions.
12563
12564 @item -msched-costly-dep=@var{dependence_type}
12565 @opindex msched-costly-dep
12566 This option controls which dependences are considered costly
12567 by the target during instruction scheduling. The argument
12568 @var{dependence_type} takes one of the following values:
12569 @var{no}: no dependence is costly,
12570 @var{all}: all dependences are costly,
12571 @var{true_store_to_load}: a true dependence from store to load is costly,
12572 @var{store_to_load}: any dependence from store to load is costly,
12573 @var{number}: any dependence which latency >= @var{number} is costly.
12574
12575 @item -minsert-sched-nops=@var{scheme}
12576 @opindex minsert-sched-nops
12577 This option controls which nop insertion scheme will be used during
12578 the second scheduling pass. The argument @var{scheme} takes one of the
12579 following values:
12580 @var{no}: Don't insert nops.
12581 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
12582 according to the scheduler's grouping.
12583 @var{regroup_exact}: Insert nops to force costly dependent insns into
12584 separate groups. Insert exactly as many nops as needed to force an insn
12585 to a new group, according to the estimated processor grouping.
12586 @var{number}: Insert nops to force costly dependent insns into
12587 separate groups. Insert @var{number} nops to force an insn to a new group.
12588
12589 @item -mcall-sysv
12590 @opindex mcall-sysv
12591 On System V.4 and embedded PowerPC systems compile code using calling
12592 conventions that adheres to the March 1995 draft of the System V
12593 Application Binary Interface, PowerPC processor supplement. This is the
12594 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
12595
12596 @item -mcall-sysv-eabi
12597 @opindex mcall-sysv-eabi
12598 Specify both @option{-mcall-sysv} and @option{-meabi} options.
12599
12600 @item -mcall-sysv-noeabi
12601 @opindex mcall-sysv-noeabi
12602 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
12603
12604 @item -mcall-solaris
12605 @opindex mcall-solaris
12606 On System V.4 and embedded PowerPC systems compile code for the Solaris
12607 operating system.
12608
12609 @item -mcall-linux
12610 @opindex mcall-linux
12611 On System V.4 and embedded PowerPC systems compile code for the
12612 Linux-based GNU system.
12613
12614 @item -mcall-gnu
12615 @opindex mcall-gnu
12616 On System V.4 and embedded PowerPC systems compile code for the
12617 Hurd-based GNU system.
12618
12619 @item -mcall-netbsd
12620 @opindex mcall-netbsd
12621 On System V.4 and embedded PowerPC systems compile code for the
12622 NetBSD operating system.
12623
12624 @item -maix-struct-return
12625 @opindex maix-struct-return
12626 Return all structures in memory (as specified by the AIX ABI)@.
12627
12628 @item -msvr4-struct-return
12629 @opindex msvr4-struct-return
12630 Return structures smaller than 8 bytes in registers (as specified by the
12631 SVR4 ABI)@.
12632
12633 @item -mabi=@var{abi-type}
12634 @opindex mabi
12635 Extend the current ABI with a particular extension, or remove such extension.
12636 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
12637 @var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
12638
12639 @item -mabi=spe
12640 @opindex mabi=spe
12641 Extend the current ABI with SPE ABI extensions. This does not change
12642 the default ABI, instead it adds the SPE ABI extensions to the current
12643 ABI@.
12644
12645 @item -mabi=no-spe
12646 @opindex mabi=no-spe
12647 Disable Booke SPE ABI extensions for the current ABI@.
12648
12649 @item -mabi=ibmlongdouble
12650 @opindex mabi=ibmlongdouble
12651 Change the current ABI to use IBM extended precision long double.
12652 This is a PowerPC 32-bit SYSV ABI option.
12653
12654 @item -mabi=ieeelongdouble
12655 @opindex mabi=ieeelongdouble
12656 Change the current ABI to use IEEE extended precision long double.
12657 This is a PowerPC 32-bit Linux ABI option.
12658
12659 @item -mprototype
12660 @itemx -mno-prototype
12661 @opindex mprototype
12662 @opindex mno-prototype
12663 On System V.4 and embedded PowerPC systems assume that all calls to
12664 variable argument functions are properly prototyped. Otherwise, the
12665 compiler must insert an instruction before every non prototyped call to
12666 set or clear bit 6 of the condition code register (@var{CR}) to
12667 indicate whether floating point values were passed in the floating point
12668 registers in case the function takes a variable arguments. With
12669 @option{-mprototype}, only calls to prototyped variable argument functions
12670 will set or clear the bit.
12671
12672 @item -msim
12673 @opindex msim
12674 On embedded PowerPC systems, assume that the startup module is called
12675 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
12676 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}.
12677 configurations.
12678
12679 @item -mmvme
12680 @opindex mmvme
12681 On embedded PowerPC systems, assume that the startup module is called
12682 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
12683 @file{libc.a}.
12684
12685 @item -mads
12686 @opindex mads
12687 On embedded PowerPC systems, assume that the startup module is called
12688 @file{crt0.o} and the standard C libraries are @file{libads.a} and
12689 @file{libc.a}.
12690
12691 @item -myellowknife
12692 @opindex myellowknife
12693 On embedded PowerPC systems, assume that the startup module is called
12694 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
12695 @file{libc.a}.
12696
12697 @item -mvxworks
12698 @opindex mvxworks
12699 On System V.4 and embedded PowerPC systems, specify that you are
12700 compiling for a VxWorks system.
12701
12702 @item -mwindiss
12703 @opindex mwindiss
12704 Specify that you are compiling for the WindISS simulation environment.
12705
12706 @item -memb
12707 @opindex memb
12708 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
12709 header to indicate that @samp{eabi} extended relocations are used.
12710
12711 @item -meabi
12712 @itemx -mno-eabi
12713 @opindex meabi
12714 @opindex mno-eabi
12715 On System V.4 and embedded PowerPC systems do (do not) adhere to the
12716 Embedded Applications Binary Interface (eabi) which is a set of
12717 modifications to the System V.4 specifications. Selecting @option{-meabi}
12718 means that the stack is aligned to an 8 byte boundary, a function
12719 @code{__eabi} is called to from @code{main} to set up the eabi
12720 environment, and the @option{-msdata} option can use both @code{r2} and
12721 @code{r13} to point to two separate small data areas. Selecting
12722 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
12723 do not call an initialization function from @code{main}, and the
12724 @option{-msdata} option will only use @code{r13} to point to a single
12725 small data area. The @option{-meabi} option is on by default if you
12726 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
12727
12728 @item -msdata=eabi
12729 @opindex msdata=eabi
12730 On System V.4 and embedded PowerPC systems, put small initialized
12731 @code{const} global and static data in the @samp{.sdata2} section, which
12732 is pointed to by register @code{r2}. Put small initialized
12733 non-@code{const} global and static data in the @samp{.sdata} section,
12734 which is pointed to by register @code{r13}. Put small uninitialized
12735 global and static data in the @samp{.sbss} section, which is adjacent to
12736 the @samp{.sdata} section. The @option{-msdata=eabi} option is
12737 incompatible with the @option{-mrelocatable} option. The
12738 @option{-msdata=eabi} option also sets the @option{-memb} option.
12739
12740 @item -msdata=sysv
12741 @opindex msdata=sysv
12742 On System V.4 and embedded PowerPC systems, put small global and static
12743 data in the @samp{.sdata} section, which is pointed to by register
12744 @code{r13}. Put small uninitialized global and static data in the
12745 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
12746 The @option{-msdata=sysv} option is incompatible with the
12747 @option{-mrelocatable} option.
12748
12749 @item -msdata=default
12750 @itemx -msdata
12751 @opindex msdata=default
12752 @opindex msdata
12753 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
12754 compile code the same as @option{-msdata=eabi}, otherwise compile code the
12755 same as @option{-msdata=sysv}.
12756
12757 @item -msdata-data
12758 @opindex msdata-data
12759 On System V.4 and embedded PowerPC systems, put small global
12760 data in the @samp{.sdata} section. Put small uninitialized global
12761 data in the @samp{.sbss} section. Do not use register @code{r13}
12762 to address small data however. This is the default behavior unless
12763 other @option{-msdata} options are used.
12764
12765 @item -msdata=none
12766 @itemx -mno-sdata
12767 @opindex msdata=none
12768 @opindex mno-sdata
12769 On embedded PowerPC systems, put all initialized global and static data
12770 in the @samp{.data} section, and all uninitialized data in the
12771 @samp{.bss} section.
12772
12773 @item -G @var{num}
12774 @opindex G
12775 @cindex smaller data references (PowerPC)
12776 @cindex .sdata/.sdata2 references (PowerPC)
12777 On embedded PowerPC systems, put global and static items less than or
12778 equal to @var{num} bytes into the small data or bss sections instead of
12779 the normal data or bss section. By default, @var{num} is 8. The
12780 @option{-G @var{num}} switch is also passed to the linker.
12781 All modules should be compiled with the same @option{-G @var{num}} value.
12782
12783 @item -mregnames
12784 @itemx -mno-regnames
12785 @opindex mregnames
12786 @opindex mno-regnames
12787 On System V.4 and embedded PowerPC systems do (do not) emit register
12788 names in the assembly language output using symbolic forms.
12789
12790 @item -mlongcall
12791 @itemx -mno-longcall
12792 @opindex mlongcall
12793 @opindex mno-longcall
12794 By default assume that all calls are far away so that a longer more
12795 expensive calling sequence is required. This is required for calls
12796 further than 32 megabytes (33,554,432 bytes) from the current location.
12797 A short call will be generated if the compiler knows
12798 the call cannot be that far away. This setting can be overridden by
12799 the @code{shortcall} function attribute, or by @code{#pragma
12800 longcall(0)}.
12801
12802 Some linkers are capable of detecting out-of-range calls and generating
12803 glue code on the fly. On these systems, long calls are unnecessary and
12804 generate slower code. As of this writing, the AIX linker can do this,
12805 as can the GNU linker for PowerPC/64. It is planned to add this feature
12806 to the GNU linker for 32-bit PowerPC systems as well.
12807
12808 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
12809 callee, L42'', plus a ``branch island'' (glue code). The two target
12810 addresses represent the callee and the ``branch island''. The
12811 Darwin/PPC linker will prefer the first address and generate a ``bl
12812 callee'' if the PPC ``bl'' instruction will reach the callee directly;
12813 otherwise, the linker will generate ``bl L42'' to call the ``branch
12814 island''. The ``branch island'' is appended to the body of the
12815 calling function; it computes the full 32-bit address of the callee
12816 and jumps to it.
12817
12818 On Mach-O (Darwin) systems, this option directs the compiler emit to
12819 the glue for every direct call, and the Darwin linker decides whether
12820 to use or discard it.
12821
12822 In the future, we may cause GCC to ignore all longcall specifications
12823 when the linker is known to generate glue.
12824
12825 @item -pthread
12826 @opindex pthread
12827 Adds support for multithreading with the @dfn{pthreads} library.
12828 This option sets flags for both the preprocessor and linker.
12829
12830 @end table
12831
12832 @node S/390 and zSeries Options
12833 @subsection S/390 and zSeries Options
12834 @cindex S/390 and zSeries Options
12835
12836 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
12837
12838 @table @gcctabopt
12839 @item -mhard-float
12840 @itemx -msoft-float
12841 @opindex mhard-float
12842 @opindex msoft-float
12843 Use (do not use) the hardware floating-point instructions and registers
12844 for floating-point operations. When @option{-msoft-float} is specified,
12845 functions in @file{libgcc.a} will be used to perform floating-point
12846 operations. When @option{-mhard-float} is specified, the compiler
12847 generates IEEE floating-point instructions. This is the default.
12848
12849 @item -mlong-double-64
12850 @itemx -mlong-double-128
12851 @opindex mlong-double-64
12852 @opindex mlong-double-128
12853 These switches control the size of @code{long double} type. A size
12854 of 64bit makes the @code{long double} type equivalent to the @code{double}
12855 type. This is the default.
12856
12857 @item -mbackchain
12858 @itemx -mno-backchain
12859 @opindex mbackchain
12860 @opindex mno-backchain
12861 Store (do not store) the address of the caller's frame as backchain pointer
12862 into the callee's stack frame.
12863 A backchain may be needed to allow debugging using tools that do not understand
12864 DWARF-2 call frame information.
12865 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
12866 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
12867 the backchain is placed into the topmost word of the 96/160 byte register
12868 save area.
12869
12870 In general, code compiled with @option{-mbackchain} is call-compatible with
12871 code compiled with @option{-mmo-backchain}; however, use of the backchain
12872 for debugging purposes usually requires that the whole binary is built with
12873 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
12874 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
12875 to build a linux kernel use @option{-msoft-float}.
12876
12877 The default is to not maintain the backchain.
12878
12879 @item -mpacked-stack
12880 @item -mno-packed-stack
12881 @opindex mpacked-stack
12882 @opindex mno-packed-stack
12883 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
12884 specified, the compiler uses the all fields of the 96/160 byte register save
12885 area only for their default purpose; unused fields still take up stack space.
12886 When @option{-mpacked-stack} is specified, register save slots are densely
12887 packed at the top of the register save area; unused space is reused for other
12888 purposes, allowing for more efficient use of the available stack space.
12889 However, when @option{-mbackchain} is also in effect, the topmost word of
12890 the save area is always used to store the backchain, and the return address
12891 register is always saved two words below the backchain.
12892
12893 As long as the stack frame backchain is not used, code generated with
12894 @option{-mpacked-stack} is call-compatible with code generated with
12895 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
12896 S/390 or zSeries generated code that uses the stack frame backchain at run
12897 time, not just for debugging purposes. Such code is not call-compatible
12898 with code compiled with @option{-mpacked-stack}. Also, note that the
12899 combination of @option{-mbackchain},
12900 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
12901 to build a linux kernel use @option{-msoft-float}.
12902
12903 The default is to not use the packed stack layout.
12904
12905 @item -msmall-exec
12906 @itemx -mno-small-exec
12907 @opindex msmall-exec
12908 @opindex mno-small-exec
12909 Generate (or do not generate) code using the @code{bras} instruction
12910 to do subroutine calls.
12911 This only works reliably if the total executable size does not
12912 exceed 64k. The default is to use the @code{basr} instruction instead,
12913 which does not have this limitation.
12914
12915 @item -m64
12916 @itemx -m31
12917 @opindex m64
12918 @opindex m31
12919 When @option{-m31} is specified, generate code compliant to the
12920 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
12921 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
12922 particular to generate 64-bit instructions. For the @samp{s390}
12923 targets, the default is @option{-m31}, while the @samp{s390x}
12924 targets default to @option{-m64}.
12925
12926 @item -mzarch
12927 @itemx -mesa
12928 @opindex mzarch
12929 @opindex mesa
12930 When @option{-mzarch} is specified, generate code using the
12931 instructions available on z/Architecture.
12932 When @option{-mesa} is specified, generate code using the
12933 instructions available on ESA/390. Note that @option{-mesa} is
12934 not possible with @option{-m64}.
12935 When generating code compliant to the GNU/Linux for S/390 ABI,
12936 the default is @option{-mesa}. When generating code compliant
12937 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
12938
12939 @item -mmvcle
12940 @itemx -mno-mvcle
12941 @opindex mmvcle
12942 @opindex mno-mvcle
12943 Generate (or do not generate) code using the @code{mvcle} instruction
12944 to perform block moves. When @option{-mno-mvcle} is specified,
12945 use a @code{mvc} loop instead. This is the default unless optimizing for
12946 size.
12947
12948 @item -mdebug
12949 @itemx -mno-debug
12950 @opindex mdebug
12951 @opindex mno-debug
12952 Print (or do not print) additional debug information when compiling.
12953 The default is to not print debug information.
12954
12955 @item -march=@var{cpu-type}
12956 @opindex march
12957 Generate code that will run on @var{cpu-type}, which is the name of a system
12958 representing a certain processor type. Possible values for
12959 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
12960 When generating code using the instructions available on z/Architecture,
12961 the default is @option{-march=z900}. Otherwise, the default is
12962 @option{-march=g5}.
12963
12964 @item -mtune=@var{cpu-type}
12965 @opindex mtune
12966 Tune to @var{cpu-type} everything applicable about the generated code,
12967 except for the ABI and the set of available instructions.
12968 The list of @var{cpu-type} values is the same as for @option{-march}.
12969 The default is the value used for @option{-march}.
12970
12971 @item -mtpf-trace
12972 @itemx -mno-tpf-trace
12973 @opindex mtpf-trace
12974 @opindex mno-tpf-trace
12975 Generate code that adds (does not add) in TPF OS specific branches to trace
12976 routines in the operating system. This option is off by default, even
12977 when compiling for the TPF OS@.
12978
12979 @item -mfused-madd
12980 @itemx -mno-fused-madd
12981 @opindex mfused-madd
12982 @opindex mno-fused-madd
12983 Generate code that uses (does not use) the floating point multiply and
12984 accumulate instructions. These instructions are generated by default if
12985 hardware floating point is used.
12986
12987 @item -mwarn-framesize=@var{framesize}
12988 @opindex mwarn-framesize
12989 Emit a warning if the current function exceeds the given frame size. Because
12990 this is a compile time check it doesn't need to be a real problem when the program
12991 runs. It is intended to identify functions which most probably cause
12992 a stack overflow. It is useful to be used in an environment with limited stack
12993 size e.g.@: the linux kernel.
12994
12995 @item -mwarn-dynamicstack
12996 @opindex mwarn-dynamicstack
12997 Emit a warning if the function calls alloca or uses dynamically
12998 sized arrays. This is generally a bad idea with a limited stack size.
12999
13000 @item -mstack-guard=@var{stack-guard}
13001 @item -mstack-size=@var{stack-size}
13002 @opindex mstack-guard
13003 @opindex mstack-size
13004 If these options are provided the s390 back end emits additional instructions in
13005 the function prologue which trigger a trap if the stack size is @var{stack-guard}
13006 bytes above the @var{stack-size} (remember that the stack on s390 grows downward).
13007 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
13008 the frame size of the compiled function is chosen.
13009 These options are intended to be used to help debugging stack overflow problems.
13010 The additionally emitted code causes only little overhead and hence can also be
13011 used in production like systems without greater performance degradation. The given
13012 values have to be exact powers of 2 and @var{stack-size} has to be greater than
13013 @var{stack-guard} without exceeding 64k.
13014 In order to be efficient the extra code makes the assumption that the stack starts
13015 at an address aligned to the value given by @var{stack-size}.
13016 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
13017 @end table
13018
13019 @node Score Options
13020 @subsection Score Options
13021 @cindex Score Options
13022
13023 These options are defined for Score implementations:
13024
13025 @table @gcctabopt
13026 @item -meb
13027 @opindex meb
13028 Compile code for big endian mode. This is the default.
13029
13030 @item -mel
13031 @opindex mel
13032 Compile code for little endian mode.
13033
13034 @item -mnhwloop
13035 @opindex mnhwloop
13036 Disable generate bcnz instruction.
13037
13038 @item -muls
13039 @opindex muls
13040 Enable generate unaligned load and store instruction.
13041
13042 @item -mmac
13043 @opindex mmac
13044 Enable the use of multiply-accumulate instructions. Disabled by default.
13045
13046 @item -mscore5
13047 @opindex mscore5
13048 Specify the SCORE5 as the target architecture.
13049
13050 @item -mscore5u
13051 @opindex mscore5u
13052 Specify the SCORE5U of the target architecture.
13053
13054 @item -mscore7
13055 @opindex mscore7
13056 Specify the SCORE7 as the target architecture. This is the default.
13057
13058 @item -mscore7d
13059 @opindex mscore7d
13060 Specify the SCORE7D as the target architecture.
13061 @end table
13062
13063 @node SH Options
13064 @subsection SH Options
13065
13066 These @samp{-m} options are defined for the SH implementations:
13067
13068 @table @gcctabopt
13069 @item -m1
13070 @opindex m1
13071 Generate code for the SH1.
13072
13073 @item -m2
13074 @opindex m2
13075 Generate code for the SH2.
13076
13077 @item -m2e
13078 Generate code for the SH2e.
13079
13080 @item -m3
13081 @opindex m3
13082 Generate code for the SH3.
13083
13084 @item -m3e
13085 @opindex m3e
13086 Generate code for the SH3e.
13087
13088 @item -m4-nofpu
13089 @opindex m4-nofpu
13090 Generate code for the SH4 without a floating-point unit.
13091
13092 @item -m4-single-only
13093 @opindex m4-single-only
13094 Generate code for the SH4 with a floating-point unit that only
13095 supports single-precision arithmetic.
13096
13097 @item -m4-single
13098 @opindex m4-single
13099 Generate code for the SH4 assuming the floating-point unit is in
13100 single-precision mode by default.
13101
13102 @item -m4
13103 @opindex m4
13104 Generate code for the SH4.
13105
13106 @item -m4a-nofpu
13107 @opindex m4a-nofpu
13108 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
13109 floating-point unit is not used.
13110
13111 @item -m4a-single-only
13112 @opindex m4a-single-only
13113 Generate code for the SH4a, in such a way that no double-precision
13114 floating point operations are used.
13115
13116 @item -m4a-single
13117 @opindex m4a-single
13118 Generate code for the SH4a assuming the floating-point unit is in
13119 single-precision mode by default.
13120
13121 @item -m4a
13122 @opindex m4a
13123 Generate code for the SH4a.
13124
13125 @item -m4al
13126 @opindex m4al
13127 Same as @option{-m4a-nofpu}, except that it implicitly passes
13128 @option{-dsp} to the assembler. GCC doesn't generate any DSP
13129 instructions at the moment.
13130
13131 @item -mb
13132 @opindex mb
13133 Compile code for the processor in big endian mode.
13134
13135 @item -ml
13136 @opindex ml
13137 Compile code for the processor in little endian mode.
13138
13139 @item -mdalign
13140 @opindex mdalign
13141 Align doubles at 64-bit boundaries. Note that this changes the calling
13142 conventions, and thus some functions from the standard C library will
13143 not work unless you recompile it first with @option{-mdalign}.
13144
13145 @item -mrelax
13146 @opindex mrelax
13147 Shorten some address references at link time, when possible; uses the
13148 linker option @option{-relax}.
13149
13150 @item -mbigtable
13151 @opindex mbigtable
13152 Use 32-bit offsets in @code{switch} tables. The default is to use
13153 16-bit offsets.
13154
13155 @item -mfmovd
13156 @opindex mfmovd
13157 Enable the use of the instruction @code{fmovd}.
13158
13159 @item -mhitachi
13160 @opindex mhitachi
13161 Comply with the calling conventions defined by Renesas.
13162
13163 @item -mrenesas
13164 @opindex mhitachi
13165 Comply with the calling conventions defined by Renesas.
13166
13167 @item -mno-renesas
13168 @opindex mhitachi
13169 Comply with the calling conventions defined for GCC before the Renesas
13170 conventions were available. This option is the default for all
13171 targets of the SH toolchain except for @samp{sh-symbianelf}.
13172
13173 @item -mnomacsave
13174 @opindex mnomacsave
13175 Mark the @code{MAC} register as call-clobbered, even if
13176 @option{-mhitachi} is given.
13177
13178 @item -mieee
13179 @opindex mieee
13180 Increase IEEE-compliance of floating-point code.
13181 At the moment, this is equivalent to @option{-fno-finite-math-only}.
13182 When generating 16 bit SH opcodes, getting IEEE-conforming results for
13183 comparisons of NANs / infinities incurs extra overhead in every
13184 floating point comparison, therefore the default is set to
13185 @option{-ffinite-math-only}.
13186
13187 @item -minline-ic_invalidate
13188 @opindex minline-ic_invalidate
13189 Inline code to invalidate instruction cache entries after setting up
13190 nested function trampolines.
13191 This option has no effect if -musermode is in effect and the selected
13192 code generation option (e.g. -m4) does not allow the use of the icbi
13193 instruction.
13194 If the selected code generation option does not allow the use of the icbi
13195 instruction, and -musermode is not in effect, the inlined code will
13196 manipulate the instruction cache address array directly with an associative
13197 write. This not only requires privileged mode, but it will also
13198 fail if the cache line had been mapped via the TLB and has become unmapped.
13199
13200 @item -misize
13201 @opindex misize
13202 Dump instruction size and location in the assembly code.
13203
13204 @item -mpadstruct
13205 @opindex mpadstruct
13206 This option is deprecated. It pads structures to multiple of 4 bytes,
13207 which is incompatible with the SH ABI@.
13208
13209 @item -mspace
13210 @opindex mspace
13211 Optimize for space instead of speed. Implied by @option{-Os}.
13212
13213 @item -mprefergot
13214 @opindex mprefergot
13215 When generating position-independent code, emit function calls using
13216 the Global Offset Table instead of the Procedure Linkage Table.
13217
13218 @item -musermode
13219 @opindex musermode
13220 Don't generate privileged mode only code; implies -mno-inline-ic_invalidate
13221 if the inlined code would not work in user mode.
13222 This is the default when the target is @code{sh-*-linux*}.
13223
13224 @item -multcost=@var{number}
13225 @opindex multcost=@var{number}
13226 Set the cost to assume for a multiply insn.
13227
13228 @item -mdiv=@var{strategy}
13229 @opindex mdiv=@var{strategy}
13230 Set the division strategy to use for SHmedia code. @var{strategy} must be
13231 one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
13232 inv:call2, inv:fp .
13233 "fp" performs the operation in floating point. This has a very high latency,
13234 but needs only a few instructions, so it might be a good choice if
13235 your code has enough easily exploitable ILP to allow the compiler to
13236 schedule the floating point instructions together with other instructions.
13237 Division by zero causes a floating point exception.
13238 "inv" uses integer operations to calculate the inverse of the divisor,
13239 and then multiplies the dividend with the inverse. This strategy allows
13240 cse and hoisting of the inverse calculation. Division by zero calculates
13241 an unspecified result, but does not trap.
13242 "inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
13243 have been found, or if the entire operation has been hoisted to the same
13244 place, the last stages of the inverse calculation are intertwined with the
13245 final multiply to reduce the overall latency, at the expense of using a few
13246 more instructions, and thus offering fewer scheduling opportunities with
13247 other code.
13248 "call" calls a library function that usually implements the inv:minlat
13249 strategy.
13250 This gives high code density for m5-*media-nofpu compilations.
13251 "call2" uses a different entry point of the same library function, where it
13252 assumes that a pointer to a lookup table has already been set up, which
13253 exposes the pointer load to cse / code hoisting optimizations.
13254 "inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
13255 code generation, but if the code stays unoptimized, revert to the "call",
13256 "call2", or "fp" strategies, respectively. Note that the
13257 potentially-trapping side effect of division by zero is carried by a
13258 separate instruction, so it is possible that all the integer instructions
13259 are hoisted out, but the marker for the side effect stays where it is.
13260 A recombination to fp operations or a call is not possible in that case.
13261 "inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case
13262 that the inverse calculation was nor separated from the multiply, they speed
13263 up division where the dividend fits into 20 bits (plus sign where applicable),
13264 by inserting a test to skip a number of operations in this case; this test
13265 slows down the case of larger dividends. inv20u assumes the case of a such
13266 a small dividend to be unlikely, and inv20l assumes it to be likely.
13267
13268 @item -mdivsi3_libfunc=@var{name}
13269 @opindex mdivsi3_libfunc=@var{name}
13270 Set the name of the library function used for 32 bit signed division to
13271 @var{name}. This only affect the name used in the call and inv:call
13272 division strategies, and the compiler will still expect the same
13273 sets of input/output/clobbered registers as if this option was not present.
13274
13275 @item -madjust-unroll
13276 @opindex madjust-unroll
13277 Throttle unrolling to avoid thrashing target registers.
13278 This option only has an effect if the gcc code base supports the
13279 TARGET_ADJUST_UNROLL_MAX target hook.
13280
13281 @item -mindexed-addressing
13282 @opindex mindexed-addressing
13283 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
13284 This is only safe if the hardware and/or OS implement 32 bit wrap-around
13285 semantics for the indexed addressing mode. The architecture allows the
13286 implementation of processors with 64 bit MMU, which the OS could use to
13287 get 32 bit addressing, but since no current hardware implementation supports
13288 this or any other way to make the indexed addressing mode safe to use in
13289 the 32 bit ABI, the default is -mno-indexed-addressing.
13290
13291 @item -mgettrcost=@var{number}
13292 @opindex mgettrcost=@var{number}
13293 Set the cost assumed for the gettr instruction to @var{number}.
13294 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
13295
13296 @item -mpt-fixed
13297 @opindex mpt-fixed
13298 Assume pt* instructions won't trap. This will generally generate better
13299 scheduled code, but is unsafe on current hardware. The current architecture
13300 definition says that ptabs and ptrel trap when the target anded with 3 is 3.
13301 This has the unintentional effect of making it unsafe to schedule ptabs /
13302 ptrel before a branch, or hoist it out of a loop. For example,
13303 __do_global_ctors, a part of libgcc that runs constructors at program
13304 startup, calls functions in a list which is delimited by @minus{}1. With the
13305 -mpt-fixed option, the ptabs will be done before testing against @minus{}1.
13306 That means that all the constructors will be run a bit quicker, but when
13307 the loop comes to the end of the list, the program crashes because ptabs
13308 loads @minus{}1 into a target register. Since this option is unsafe for any
13309 hardware implementing the current architecture specification, the default
13310 is -mno-pt-fixed. Unless the user specifies a specific cost with
13311 @option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
13312 this deters register allocation using target registers for storing
13313 ordinary integers.
13314
13315 @item -minvalid-symbols
13316 @opindex minvalid-symbols
13317 Assume symbols might be invalid. Ordinary function symbols generated by
13318 the compiler will always be valid to load with movi/shori/ptabs or
13319 movi/shori/ptrel, but with assembler and/or linker tricks it is possible
13320 to generate symbols that will cause ptabs / ptrel to trap.
13321 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
13322 It will then prevent cross-basic-block cse, hoisting and most scheduling
13323 of symbol loads. The default is @option{-mno-invalid-symbols}.
13324 @end table
13325
13326 @node SPARC Options
13327 @subsection SPARC Options
13328 @cindex SPARC options
13329
13330 These @samp{-m} options are supported on the SPARC:
13331
13332 @table @gcctabopt
13333 @item -mno-app-regs
13334 @itemx -mapp-regs
13335 @opindex mno-app-regs
13336 @opindex mapp-regs
13337 Specify @option{-mapp-regs} to generate output using the global registers
13338 2 through 4, which the SPARC SVR4 ABI reserves for applications. This
13339 is the default.
13340
13341 To be fully SVR4 ABI compliant at the cost of some performance loss,
13342 specify @option{-mno-app-regs}. You should compile libraries and system
13343 software with this option.
13344
13345 @item -mfpu
13346 @itemx -mhard-float
13347 @opindex mfpu
13348 @opindex mhard-float
13349 Generate output containing floating point instructions. This is the
13350 default.
13351
13352 @item -mno-fpu
13353 @itemx -msoft-float
13354 @opindex mno-fpu
13355 @opindex msoft-float
13356 Generate output containing library calls for floating point.
13357 @strong{Warning:} the requisite libraries are not available for all SPARC
13358 targets. Normally the facilities of the machine's usual C compiler are
13359 used, but this cannot be done directly in cross-compilation. You must make
13360 your own arrangements to provide suitable library functions for
13361 cross-compilation. The embedded targets @samp{sparc-*-aout} and
13362 @samp{sparclite-*-*} do provide software floating point support.
13363
13364 @option{-msoft-float} changes the calling convention in the output file;
13365 therefore, it is only useful if you compile @emph{all} of a program with
13366 this option. In particular, you need to compile @file{libgcc.a}, the
13367 library that comes with GCC, with @option{-msoft-float} in order for
13368 this to work.
13369
13370 @item -mhard-quad-float
13371 @opindex mhard-quad-float
13372 Generate output containing quad-word (long double) floating point
13373 instructions.
13374
13375 @item -msoft-quad-float
13376 @opindex msoft-quad-float
13377 Generate output containing library calls for quad-word (long double)
13378 floating point instructions. The functions called are those specified
13379 in the SPARC ABI@. This is the default.
13380
13381 As of this writing, there are no SPARC implementations that have hardware
13382 support for the quad-word floating point instructions. They all invoke
13383 a trap handler for one of these instructions, and then the trap handler
13384 emulates the effect of the instruction. Because of the trap handler overhead,
13385 this is much slower than calling the ABI library routines. Thus the
13386 @option{-msoft-quad-float} option is the default.
13387
13388 @item -mno-unaligned-doubles
13389 @itemx -munaligned-doubles
13390 @opindex mno-unaligned-doubles
13391 @opindex munaligned-doubles
13392 Assume that doubles have 8 byte alignment. This is the default.
13393
13394 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
13395 alignment only if they are contained in another type, or if they have an
13396 absolute address. Otherwise, it assumes they have 4 byte alignment.
13397 Specifying this option avoids some rare compatibility problems with code
13398 generated by other compilers. It is not the default because it results
13399 in a performance loss, especially for floating point code.
13400
13401 @item -mno-faster-structs
13402 @itemx -mfaster-structs
13403 @opindex mno-faster-structs
13404 @opindex mfaster-structs
13405 With @option{-mfaster-structs}, the compiler assumes that structures
13406 should have 8 byte alignment. This enables the use of pairs of
13407 @code{ldd} and @code{std} instructions for copies in structure
13408 assignment, in place of twice as many @code{ld} and @code{st} pairs.
13409 However, the use of this changed alignment directly violates the SPARC
13410 ABI@. Thus, it's intended only for use on targets where the developer
13411 acknowledges that their resulting code will not be directly in line with
13412 the rules of the ABI@.
13413
13414 @item -mimpure-text
13415 @opindex mimpure-text
13416 @option{-mimpure-text}, used in addition to @option{-shared}, tells
13417 the compiler to not pass @option{-z text} to the linker when linking a
13418 shared object. Using this option, you can link position-dependent
13419 code into a shared object.
13420
13421 @option{-mimpure-text} suppresses the ``relocations remain against
13422 allocatable but non-writable sections'' linker error message.
13423 However, the necessary relocations will trigger copy-on-write, and the
13424 shared object is not actually shared across processes. Instead of
13425 using @option{-mimpure-text}, you should compile all source code with
13426 @option{-fpic} or @option{-fPIC}.
13427
13428 This option is only available on SunOS and Solaris.
13429
13430 @item -mcpu=@var{cpu_type}
13431 @opindex mcpu
13432 Set the instruction set, register set, and instruction scheduling parameters
13433 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
13434 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
13435 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
13436 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
13437 @samp{ultrasparc3}, and @samp{niagara}.
13438
13439 Default instruction scheduling parameters are used for values that select
13440 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
13441 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
13442
13443 Here is a list of each supported architecture and their supported
13444 implementations.
13445
13446 @smallexample
13447 v7: cypress
13448 v8: supersparc, hypersparc
13449 sparclite: f930, f934, sparclite86x
13450 sparclet: tsc701
13451 v9: ultrasparc, ultrasparc3, niagara
13452 @end smallexample
13453
13454 By default (unless configured otherwise), GCC generates code for the V7
13455 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
13456 additionally optimizes it for the Cypress CY7C602 chip, as used in the
13457 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
13458 SPARCStation 1, 2, IPX etc.
13459
13460 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
13461 architecture. The only difference from V7 code is that the compiler emits
13462 the integer multiply and integer divide instructions which exist in SPARC-V8
13463 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
13464 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
13465 2000 series.
13466
13467 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
13468 the SPARC architecture. This adds the integer multiply, integer divide step
13469 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
13470 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
13471 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
13472 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
13473 MB86934 chip, which is the more recent SPARClite with FPU@.
13474
13475 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
13476 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
13477 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
13478 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
13479 optimizes it for the TEMIC SPARClet chip.
13480
13481 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
13482 architecture. This adds 64-bit integer and floating-point move instructions,
13483 3 additional floating-point condition code registers and conditional move
13484 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
13485 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
13486 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
13487 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
13488 @option{-mcpu=niagara}, the compiler additionally optimizes it for
13489 Sun UltraSPARC T1 chips.
13490
13491 @item -mtune=@var{cpu_type}
13492 @opindex mtune
13493 Set the instruction scheduling parameters for machine type
13494 @var{cpu_type}, but do not set the instruction set or register set that the
13495 option @option{-mcpu=@var{cpu_type}} would.
13496
13497 The same values for @option{-mcpu=@var{cpu_type}} can be used for
13498 @option{-mtune=@var{cpu_type}}, but the only useful values are those
13499 that select a particular cpu implementation. Those are @samp{cypress},
13500 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
13501 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
13502 @samp{ultrasparc3}, and @samp{niagara}.
13503
13504 @item -mv8plus
13505 @itemx -mno-v8plus
13506 @opindex mv8plus
13507 @opindex mno-v8plus
13508 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
13509 difference from the V8 ABI is that the global and out registers are
13510 considered 64-bit wide. This is enabled by default on Solaris in 32-bit
13511 mode for all SPARC-V9 processors.
13512
13513 @item -mvis
13514 @itemx -mno-vis
13515 @opindex mvis
13516 @opindex mno-vis
13517 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
13518 Visual Instruction Set extensions. The default is @option{-mno-vis}.
13519 @end table
13520
13521 These @samp{-m} options are supported in addition to the above
13522 on SPARC-V9 processors in 64-bit environments:
13523
13524 @table @gcctabopt
13525 @item -mlittle-endian
13526 @opindex mlittle-endian
13527 Generate code for a processor running in little-endian mode. It is only
13528 available for a few configurations and most notably not on Solaris and Linux.
13529
13530 @item -m32
13531 @itemx -m64
13532 @opindex m32
13533 @opindex m64
13534 Generate code for a 32-bit or 64-bit environment.
13535 The 32-bit environment sets int, long and pointer to 32 bits.
13536 The 64-bit environment sets int to 32 bits and long and pointer
13537 to 64 bits.
13538
13539 @item -mcmodel=medlow
13540 @opindex mcmodel=medlow
13541 Generate code for the Medium/Low code model: 64-bit addresses, programs
13542 must be linked in the low 32 bits of memory. Programs can be statically
13543 or dynamically linked.
13544
13545 @item -mcmodel=medmid
13546 @opindex mcmodel=medmid
13547 Generate code for the Medium/Middle code model: 64-bit addresses, programs
13548 must be linked in the low 44 bits of memory, the text and data segments must
13549 be less than 2GB in size and the data segment must be located within 2GB of
13550 the text segment.
13551
13552 @item -mcmodel=medany
13553 @opindex mcmodel=medany
13554 Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
13555 may be linked anywhere in memory, the text and data segments must be less
13556 than 2GB in size and the data segment must be located within 2GB of the
13557 text segment.
13558
13559 @item -mcmodel=embmedany
13560 @opindex mcmodel=embmedany
13561 Generate code for the Medium/Anywhere code model for embedded systems:
13562 64-bit addresses, the text and data segments must be less than 2GB in
13563 size, both starting anywhere in memory (determined at link time). The
13564 global register %g4 points to the base of the data segment. Programs
13565 are statically linked and PIC is not supported.
13566
13567 @item -mstack-bias
13568 @itemx -mno-stack-bias
13569 @opindex mstack-bias
13570 @opindex mno-stack-bias
13571 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
13572 frame pointer if present, are offset by @minus{}2047 which must be added back
13573 when making stack frame references. This is the default in 64-bit mode.
13574 Otherwise, assume no such offset is present.
13575 @end table
13576
13577 These switches are supported in addition to the above on Solaris:
13578
13579 @table @gcctabopt
13580 @item -threads
13581 @opindex threads
13582 Add support for multithreading using the Solaris threads library. This
13583 option sets flags for both the preprocessor and linker. This option does
13584 not affect the thread safety of object code produced by the compiler or
13585 that of libraries supplied with it.
13586
13587 @item -pthreads
13588 @opindex pthreads
13589 Add support for multithreading using the POSIX threads library. This
13590 option sets flags for both the preprocessor and linker. This option does
13591 not affect the thread safety of object code produced by the compiler or
13592 that of libraries supplied with it.
13593
13594 @item -pthread
13595 @opindex pthread
13596 This is a synonym for @option{-pthreads}.
13597 @end table
13598
13599 @node SPU Options
13600 @subsection SPU Options
13601 @cindex SPU options
13602
13603 These @samp{-m} options are supported on the SPU:
13604
13605 @table @gcctabopt
13606 @item -mwarn-reloc
13607 @itemx -merror-reloc
13608 @opindex mwarn-reloc
13609 @opindex merror-reloc
13610
13611 The loader for SPU does not handle dynamic relocations. By default, GCC
13612 will give an error when it generates code that requires a dynamic
13613 relocation. @option{-mno-error-reloc} disables the error,
13614 @option{-mwarn-reloc} will generate a warning instead.
13615
13616 @item -msafe-dma
13617 @itemx -munsafe-dma
13618 @opindex msafe-dma
13619 @opindex munsafe-dma
13620
13621 Instructions which initiate or test completion of DMA must not be
13622 reordered with respect to loads and stores of the memory which is being
13623 accessed. Users typically address this problem using the volatile
13624 keyword, but that can lead to inefficient code in places where the
13625 memory is known to not change. Rather than mark the memory as volatile
13626 we treat the DMA instructions as potentially effecting all memory. With
13627 @option{-munsafe-dma} users must use the volatile keyword to protect
13628 memory accesses.
13629
13630 @item -mbranch-hints
13631 @opindex mbranch-hints
13632
13633 By default, GCC will generate a branch hint instruction to avoid
13634 pipeline stalls for always taken or probably taken branches. A hint
13635 will not be generated closer than 8 instructions away from its branch.
13636 There is little reason to disable them, except for debugging purposes,
13637 or to make an object a little bit smaller.
13638
13639 @item -msmall-mem
13640 @itemx -mlarge-mem
13641 @opindex msmall-mem
13642 @opindex mlarge-mem
13643
13644 By default, GCC generates code assuming that addresses are never larger
13645 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
13646 a full 32 bit address.
13647
13648 @item -mstdmain
13649 @opindex mstdmain
13650
13651 By default, GCC links against startup code that assumes the SPU-style
13652 main function interface (which has an unconventional parameter list).
13653 With @option{-mstdmain}, GCC will link your program against startup
13654 code that assumes a C99-style interface to @code{main}, including a
13655 local copy of @code{argv} strings.
13656
13657 @item -mfixed-range=@var{register-range}
13658 @opindex mfixed-range
13659 Generate code treating the given register range as fixed registers.
13660 A fixed register is one that the register allocator can not use. This is
13661 useful when compiling kernel code. A register range is specified as
13662 two registers separated by a dash. Multiple register ranges can be
13663 specified separated by a comma.
13664
13665 @end table
13666
13667 @node System V Options
13668 @subsection Options for System V
13669
13670 These additional options are available on System V Release 4 for
13671 compatibility with other compilers on those systems:
13672
13673 @table @gcctabopt
13674 @item -G
13675 @opindex G
13676 Create a shared object.
13677 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
13678
13679 @item -Qy
13680 @opindex Qy
13681 Identify the versions of each tool used by the compiler, in a
13682 @code{.ident} assembler directive in the output.
13683
13684 @item -Qn
13685 @opindex Qn
13686 Refrain from adding @code{.ident} directives to the output file (this is
13687 the default).
13688
13689 @item -YP,@var{dirs}
13690 @opindex YP
13691 Search the directories @var{dirs}, and no others, for libraries
13692 specified with @option{-l}.
13693
13694 @item -Ym,@var{dir}
13695 @opindex Ym
13696 Look in the directory @var{dir} to find the M4 preprocessor.
13697 The assembler uses this option.
13698 @c This is supposed to go with a -Yd for predefined M4 macro files, but
13699 @c the generic assembler that comes with Solaris takes just -Ym.
13700 @end table
13701
13702 @node TMS320C3x/C4x Options
13703 @subsection TMS320C3x/C4x Options
13704 @cindex TMS320C3x/C4x Options
13705
13706 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
13707
13708 @table @gcctabopt
13709
13710 @item -mcpu=@var{cpu_type}
13711 @opindex mcpu
13712 Set the instruction set, register set, and instruction scheduling
13713 parameters for machine type @var{cpu_type}. Supported values for
13714 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
13715 @samp{c44}. The default is @samp{c40} to generate code for the
13716 TMS320C40.
13717
13718 @item -mbig-memory
13719 @itemx -mbig
13720 @itemx -msmall-memory
13721 @itemx -msmall
13722 @opindex mbig-memory
13723 @opindex mbig
13724 @opindex msmall-memory
13725 @opindex msmall
13726 Generates code for the big or small memory model. The small memory
13727 model assumed that all data fits into one 64K word page. At run-time
13728 the data page (DP) register must be set to point to the 64K page
13729 containing the .bss and .data program sections. The big memory model is
13730 the default and requires reloading of the DP register for every direct
13731 memory access.
13732
13733 @item -mbk
13734 @itemx -mno-bk
13735 @opindex mbk
13736 @opindex mno-bk
13737 Allow (disallow) allocation of general integer operands into the block
13738 count register BK@.
13739
13740 @item -mdb
13741 @itemx -mno-db
13742 @opindex mdb
13743 @opindex mno-db
13744 Enable (disable) generation of code using decrement and branch,
13745 DBcond(D), instructions. This is enabled by default for the C4x. To be
13746 on the safe side, this is disabled for the C3x, since the maximum
13747 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
13748 @math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so
13749 that it can utilize the decrement and branch instruction, but will give
13750 up if there is more than one memory reference in the loop. Thus a loop
13751 where the loop counter is decremented can generate slightly more
13752 efficient code, in cases where the RPTB instruction cannot be utilized.
13753
13754 @item -mdp-isr-reload
13755 @itemx -mparanoid
13756 @opindex mdp-isr-reload
13757 @opindex mparanoid
13758 Force the DP register to be saved on entry to an interrupt service
13759 routine (ISR), reloaded to point to the data section, and restored on
13760 exit from the ISR@. This should not be required unless someone has
13761 violated the small memory model by modifying the DP register, say within
13762 an object library.
13763
13764 @item -mmpyi
13765 @itemx -mno-mpyi
13766 @opindex mmpyi
13767 @opindex mno-mpyi
13768 For the C3x use the 24-bit MPYI instruction for integer multiplies
13769 instead of a library call to guarantee 32-bit results. Note that if one
13770 of the operands is a constant, then the multiplication will be performed
13771 using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x,
13772 then squaring operations are performed inline instead of a library call.
13773
13774 @item -mfast-fix
13775 @itemx -mno-fast-fix
13776 @opindex mfast-fix
13777 @opindex mno-fast-fix
13778 The C3x/C4x FIX instruction to convert a floating point value to an
13779 integer value chooses the nearest integer less than or equal to the
13780 floating point value rather than to the nearest integer. Thus if the
13781 floating point number is negative, the result will be incorrectly
13782 truncated an additional code is necessary to detect and correct this
13783 case. This option can be used to disable generation of the additional
13784 code required to correct the result.
13785
13786 @item -mrptb
13787 @itemx -mno-rptb
13788 @opindex mrptb
13789 @opindex mno-rptb
13790 Enable (disable) generation of repeat block sequences using the RPTB
13791 instruction for zero overhead looping. The RPTB construct is only used
13792 for innermost loops that do not call functions or jump across the loop
13793 boundaries. There is no advantage having nested RPTB loops due to the
13794 overhead required to save and restore the RC, RS, and RE registers.
13795 This is enabled by default with @option{-O2}.
13796
13797 @item -mrpts=@var{count}
13798 @itemx -mno-rpts
13799 @opindex mrpts
13800 @opindex mno-rpts
13801 Enable (disable) the use of the single instruction repeat instruction
13802 RPTS@. If a repeat block contains a single instruction, and the loop
13803 count can be guaranteed to be less than the value @var{count}, GCC will
13804 emit a RPTS instruction instead of a RPTB@. If no value is specified,
13805 then a RPTS will be emitted even if the loop count cannot be determined
13806 at compile time. Note that the repeated instruction following RPTS does
13807 not have to be reloaded from memory each iteration, thus freeing up the
13808 CPU buses for operands. However, since interrupts are blocked by this
13809 instruction, it is disabled by default.
13810
13811 @item -mloop-unsigned
13812 @itemx -mno-loop-unsigned
13813 @opindex mloop-unsigned
13814 @opindex mno-loop-unsigned
13815 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
13816 is @math{2^{31} + 1} since these instructions test if the iteration count is
13817 negative to terminate the loop. If the iteration count is unsigned
13818 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
13819 exceeded. This switch allows an unsigned iteration count.
13820
13821 @item -mti
13822 @opindex mti
13823 Try to emit an assembler syntax that the TI assembler (asm30) is happy
13824 with. This also enforces compatibility with the API employed by the TI
13825 C3x C compiler. For example, long doubles are passed as structures
13826 rather than in floating point registers.
13827
13828 @item -mregparm
13829 @itemx -mmemparm
13830 @opindex mregparm
13831 @opindex mmemparm
13832 Generate code that uses registers (stack) for passing arguments to functions.
13833 By default, arguments are passed in registers where possible rather
13834 than by pushing arguments on to the stack.
13835
13836 @item -mparallel-insns
13837 @itemx -mno-parallel-insns
13838 @opindex mparallel-insns
13839 @opindex mno-parallel-insns
13840 Allow the generation of parallel instructions. This is enabled by
13841 default with @option{-O2}.
13842
13843 @item -mparallel-mpy
13844 @itemx -mno-parallel-mpy
13845 @opindex mparallel-mpy
13846 @opindex mno-parallel-mpy
13847 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
13848 provided @option{-mparallel-insns} is also specified. These instructions have
13849 tight register constraints which can pessimize the code generation
13850 of large functions.
13851
13852 @end table
13853
13854 @node V850 Options
13855 @subsection V850 Options
13856 @cindex V850 Options
13857
13858 These @samp{-m} options are defined for V850 implementations:
13859
13860 @table @gcctabopt
13861 @item -mlong-calls
13862 @itemx -mno-long-calls
13863 @opindex mlong-calls
13864 @opindex mno-long-calls
13865 Treat all calls as being far away (near). If calls are assumed to be
13866 far away, the compiler will always load the functions address up into a
13867 register, and call indirect through the pointer.
13868
13869 @item -mno-ep
13870 @itemx -mep
13871 @opindex mno-ep
13872 @opindex mep
13873 Do not optimize (do optimize) basic blocks that use the same index
13874 pointer 4 or more times to copy pointer into the @code{ep} register, and
13875 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
13876 option is on by default if you optimize.
13877
13878 @item -mno-prolog-function
13879 @itemx -mprolog-function
13880 @opindex mno-prolog-function
13881 @opindex mprolog-function
13882 Do not use (do use) external functions to save and restore registers
13883 at the prologue and epilogue of a function. The external functions
13884 are slower, but use less code space if more than one function saves
13885 the same number of registers. The @option{-mprolog-function} option
13886 is on by default if you optimize.
13887
13888 @item -mspace
13889 @opindex mspace
13890 Try to make the code as small as possible. At present, this just turns
13891 on the @option{-mep} and @option{-mprolog-function} options.
13892
13893 @item -mtda=@var{n}
13894 @opindex mtda
13895 Put static or global variables whose size is @var{n} bytes or less into
13896 the tiny data area that register @code{ep} points to. The tiny data
13897 area can hold up to 256 bytes in total (128 bytes for byte references).
13898
13899 @item -msda=@var{n}
13900 @opindex msda
13901 Put static or global variables whose size is @var{n} bytes or less into
13902 the small data area that register @code{gp} points to. The small data
13903 area can hold up to 64 kilobytes.
13904
13905 @item -mzda=@var{n}
13906 @opindex mzda
13907 Put static or global variables whose size is @var{n} bytes or less into
13908 the first 32 kilobytes of memory.
13909
13910 @item -mv850
13911 @opindex mv850
13912 Specify that the target processor is the V850.
13913
13914 @item -mbig-switch
13915 @opindex mbig-switch
13916 Generate code suitable for big switch tables. Use this option only if
13917 the assembler/linker complain about out of range branches within a switch
13918 table.
13919
13920 @item -mapp-regs
13921 @opindex mapp-regs
13922 This option will cause r2 and r5 to be used in the code generated by
13923 the compiler. This setting is the default.
13924
13925 @item -mno-app-regs
13926 @opindex mno-app-regs
13927 This option will cause r2 and r5 to be treated as fixed registers.
13928
13929 @item -mv850e1
13930 @opindex mv850e1
13931 Specify that the target processor is the V850E1. The preprocessor
13932 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
13933 this option is used.
13934
13935 @item -mv850e
13936 @opindex mv850e
13937 Specify that the target processor is the V850E@. The preprocessor
13938 constant @samp{__v850e__} will be defined if this option is used.
13939
13940 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
13941 are defined then a default target processor will be chosen and the
13942 relevant @samp{__v850*__} preprocessor constant will be defined.
13943
13944 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
13945 defined, regardless of which processor variant is the target.
13946
13947 @item -mdisable-callt
13948 @opindex mdisable-callt
13949 This option will suppress generation of the CALLT instruction for the
13950 v850e and v850e1 flavors of the v850 architecture. The default is
13951 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
13952
13953 @end table
13954
13955 @node VAX Options
13956 @subsection VAX Options
13957 @cindex VAX options
13958
13959 These @samp{-m} options are defined for the VAX:
13960
13961 @table @gcctabopt
13962 @item -munix
13963 @opindex munix
13964 Do not output certain jump instructions (@code{aobleq} and so on)
13965 that the Unix assembler for the VAX cannot handle across long
13966 ranges.
13967
13968 @item -mgnu
13969 @opindex mgnu
13970 Do output those jump instructions, on the assumption that you
13971 will assemble with the GNU assembler.
13972
13973 @item -mg
13974 @opindex mg
13975 Output code for g-format floating point numbers instead of d-format.
13976 @end table
13977
13978 @node VxWorks Options
13979 @subsection VxWorks Options
13980 @cindex VxWorks Options
13981
13982 The options in this section are defined for all VxWorks targets.
13983 Options specific to the target hardware are listed with the other
13984 options for that target.
13985
13986 @table @gcctabopt
13987 @item -mrtp
13988 @opindex mrtp
13989 GCC can generate code for both VxWorks kernels and real time processes
13990 (RTPs). This option switches from the former to the latter. It also
13991 defines the preprocessor macro @code{__RTP__}.
13992
13993 @item -non-static
13994 @opindex non-static
13995 Link an RTP executable against shared libraries rather than static
13996 libraries. The options @option{-static} and @option{-shared} can
13997 also be used for RTPs (@pxref{Link Options}); @option{-static}
13998 is the default.
13999
14000 @item -Bstatic
14001 @itemx -Bdynamic
14002 @opindex Bstatic
14003 @opindex Bdynamic
14004 These options are passed down to the linker. They are defined for
14005 compatibility with Diab.
14006
14007 @item -Xbind-lazy
14008 @opindex Xbind-lazy
14009 Enable lazy binding of function calls. This option is equivalent to
14010 @option{-Wl,-z,now} and is defined for compatibility with Diab.
14011
14012 @item -Xbind-now
14013 @opindex Xbind-now
14014 Disable lazy binding of function calls. This option is the default and
14015 is defined for compatibility with Diab.
14016 @end table
14017
14018 @node x86-64 Options
14019 @subsection x86-64 Options
14020 @cindex x86-64 options
14021
14022 These are listed under @xref{i386 and x86-64 Options}.
14023
14024 @node Xstormy16 Options
14025 @subsection Xstormy16 Options
14026 @cindex Xstormy16 Options
14027
14028 These options are defined for Xstormy16:
14029
14030 @table @gcctabopt
14031 @item -msim
14032 @opindex msim
14033 Choose startup files and linker script suitable for the simulator.
14034 @end table
14035
14036 @node Xtensa Options
14037 @subsection Xtensa Options
14038 @cindex Xtensa Options
14039
14040 These options are supported for Xtensa targets:
14041
14042 @table @gcctabopt
14043 @item -mconst16
14044 @itemx -mno-const16
14045 @opindex mconst16
14046 @opindex mno-const16
14047 Enable or disable use of @code{CONST16} instructions for loading
14048 constant values. The @code{CONST16} instruction is currently not a
14049 standard option from Tensilica. When enabled, @code{CONST16}
14050 instructions are always used in place of the standard @code{L32R}
14051 instructions. The use of @code{CONST16} is enabled by default only if
14052 the @code{L32R} instruction is not available.
14053
14054 @item -mfused-madd
14055 @itemx -mno-fused-madd
14056 @opindex mfused-madd
14057 @opindex mno-fused-madd
14058 Enable or disable use of fused multiply/add and multiply/subtract
14059 instructions in the floating-point option. This has no effect if the
14060 floating-point option is not also enabled. Disabling fused multiply/add
14061 and multiply/subtract instructions forces the compiler to use separate
14062 instructions for the multiply and add/subtract operations. This may be
14063 desirable in some cases where strict IEEE 754-compliant results are
14064 required: the fused multiply add/subtract instructions do not round the
14065 intermediate result, thereby producing results with @emph{more} bits of
14066 precision than specified by the IEEE standard. Disabling fused multiply
14067 add/subtract instructions also ensures that the program output is not
14068 sensitive to the compiler's ability to combine multiply and add/subtract
14069 operations.
14070
14071 @item -mtext-section-literals
14072 @itemx -mno-text-section-literals
14073 @opindex mtext-section-literals
14074 @opindex mno-text-section-literals
14075 Control the treatment of literal pools. The default is
14076 @option{-mno-text-section-literals}, which places literals in a separate
14077 section in the output file. This allows the literal pool to be placed
14078 in a data RAM/ROM, and it also allows the linker to combine literal
14079 pools from separate object files to remove redundant literals and
14080 improve code size. With @option{-mtext-section-literals}, the literals
14081 are interspersed in the text section in order to keep them as close as
14082 possible to their references. This may be necessary for large assembly
14083 files.
14084
14085 @item -mtarget-align
14086 @itemx -mno-target-align
14087 @opindex mtarget-align
14088 @opindex mno-target-align
14089 When this option is enabled, GCC instructs the assembler to
14090 automatically align instructions to reduce branch penalties at the
14091 expense of some code density. The assembler attempts to widen density
14092 instructions to align branch targets and the instructions following call
14093 instructions. If there are not enough preceding safe density
14094 instructions to align a target, no widening will be performed. The
14095 default is @option{-mtarget-align}. These options do not affect the
14096 treatment of auto-aligned instructions like @code{LOOP}, which the
14097 assembler will always align, either by widening density instructions or
14098 by inserting no-op instructions.
14099
14100 @item -mlongcalls
14101 @itemx -mno-longcalls
14102 @opindex mlongcalls
14103 @opindex mno-longcalls
14104 When this option is enabled, GCC instructs the assembler to translate
14105 direct calls to indirect calls unless it can determine that the target
14106 of a direct call is in the range allowed by the call instruction. This
14107 translation typically occurs for calls to functions in other source
14108 files. Specifically, the assembler translates a direct @code{CALL}
14109 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
14110 The default is @option{-mno-longcalls}. This option should be used in
14111 programs where the call target can potentially be out of range. This
14112 option is implemented in the assembler, not the compiler, so the
14113 assembly code generated by GCC will still show direct call
14114 instructions---look at the disassembled object code to see the actual
14115 instructions. Note that the assembler will use an indirect call for
14116 every cross-file call, not just those that really will be out of range.
14117 @end table
14118
14119 @node zSeries Options
14120 @subsection zSeries Options
14121 @cindex zSeries options
14122
14123 These are listed under @xref{S/390 and zSeries Options}.
14124
14125 @node Code Gen Options
14126 @section Options for Code Generation Conventions
14127 @cindex code generation conventions
14128 @cindex options, code generation
14129 @cindex run-time options
14130
14131 These machine-independent options control the interface conventions
14132 used in code generation.
14133
14134 Most of them have both positive and negative forms; the negative form
14135 of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
14136 one of the forms is listed---the one which is not the default. You
14137 can figure out the other form by either removing @samp{no-} or adding
14138 it.
14139
14140 @table @gcctabopt
14141 @item -fbounds-check
14142 @opindex fbounds-check
14143 For front-ends that support it, generate additional code to check that
14144 indices used to access arrays are within the declared range. This is
14145 currently only supported by the Java and Fortran front-ends, where
14146 this option defaults to true and false respectively.
14147
14148 @item -ftrapv
14149 @opindex ftrapv
14150 This option generates traps for signed overflow on addition, subtraction,
14151 multiplication operations.
14152
14153 @item -fwrapv
14154 @opindex fwrapv
14155 This option instructs the compiler to assume that signed arithmetic
14156 overflow of addition, subtraction and multiplication wraps around
14157 using twos-complement representation. This flag enables some optimizations
14158 and disables others. This option is enabled by default for the Java
14159 front-end, as required by the Java language specification.
14160
14161 @item -fexceptions
14162 @opindex fexceptions
14163 Enable exception handling. Generates extra code needed to propagate
14164 exceptions. For some targets, this implies GCC will generate frame
14165 unwind information for all functions, which can produce significant data
14166 size overhead, although it does not affect execution. If you do not
14167 specify this option, GCC will enable it by default for languages like
14168 C++ which normally require exception handling, and disable it for
14169 languages like C that do not normally require it. However, you may need
14170 to enable this option when compiling C code that needs to interoperate
14171 properly with exception handlers written in C++. You may also wish to
14172 disable this option if you are compiling older C++ programs that don't
14173 use exception handling.
14174
14175 @item -fnon-call-exceptions
14176 @opindex fnon-call-exceptions
14177 Generate code that allows trapping instructions to throw exceptions.
14178 Note that this requires platform-specific runtime support that does
14179 not exist everywhere. Moreover, it only allows @emph{trapping}
14180 instructions to throw exceptions, i.e.@: memory references or floating
14181 point instructions. It does not allow exceptions to be thrown from
14182 arbitrary signal handlers such as @code{SIGALRM}.
14183
14184 @item -funwind-tables
14185 @opindex funwind-tables
14186 Similar to @option{-fexceptions}, except that it will just generate any needed
14187 static data, but will not affect the generated code in any other way.
14188 You will normally not enable this option; instead, a language processor
14189 that needs this handling would enable it on your behalf.
14190
14191 @item -fasynchronous-unwind-tables
14192 @opindex fasynchronous-unwind-tables
14193 Generate unwind table in dwarf2 format, if supported by target machine. The
14194 table is exact at each instruction boundary, so it can be used for stack
14195 unwinding from asynchronous events (such as debugger or garbage collector).
14196
14197 @item -fpcc-struct-return
14198 @opindex fpcc-struct-return
14199 Return ``short'' @code{struct} and @code{union} values in memory like
14200 longer ones, rather than in registers. This convention is less
14201 efficient, but it has the advantage of allowing intercallability between
14202 GCC-compiled files and files compiled with other compilers, particularly
14203 the Portable C Compiler (pcc).
14204
14205 The precise convention for returning structures in memory depends
14206 on the target configuration macros.
14207
14208 Short structures and unions are those whose size and alignment match
14209 that of some integer type.
14210
14211 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14212 switch is not binary compatible with code compiled with the
14213 @option{-freg-struct-return} switch.
14214 Use it to conform to a non-default application binary interface.
14215
14216 @item -freg-struct-return
14217 @opindex freg-struct-return
14218 Return @code{struct} and @code{union} values in registers when possible.
14219 This is more efficient for small structures than
14220 @option{-fpcc-struct-return}.
14221
14222 If you specify neither @option{-fpcc-struct-return} nor
14223 @option{-freg-struct-return}, GCC defaults to whichever convention is
14224 standard for the target. If there is no standard convention, GCC
14225 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14226 the principal compiler. In those cases, we can choose the standard, and
14227 we chose the more efficient register return alternative.
14228
14229 @strong{Warning:} code compiled with the @option{-freg-struct-return}
14230 switch is not binary compatible with code compiled with the
14231 @option{-fpcc-struct-return} switch.
14232 Use it to conform to a non-default application binary interface.
14233
14234 @item -fshort-enums
14235 @opindex fshort-enums
14236 Allocate to an @code{enum} type only as many bytes as it needs for the
14237 declared range of possible values. Specifically, the @code{enum} type
14238 will be equivalent to the smallest integer type which has enough room.
14239
14240 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
14241 code that is not binary compatible with code generated without that switch.
14242 Use it to conform to a non-default application binary interface.
14243
14244 @item -fshort-double
14245 @opindex fshort-double
14246 Use the same size for @code{double} as for @code{float}.
14247
14248 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
14249 code that is not binary compatible with code generated without that switch.
14250 Use it to conform to a non-default application binary interface.
14251
14252 @item -fshort-wchar
14253 @opindex fshort-wchar
14254 Override the underlying type for @samp{wchar_t} to be @samp{short
14255 unsigned int} instead of the default for the target. This option is
14256 useful for building programs to run under WINE@.
14257
14258 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
14259 code that is not binary compatible with code generated without that switch.
14260 Use it to conform to a non-default application binary interface.
14261
14262 @item -fno-common
14263 @opindex fno-common
14264 In C, allocate even uninitialized global variables in the data section of the
14265 object file, rather than generating them as common blocks. This has the
14266 effect that if the same variable is declared (without @code{extern}) in
14267 two different compilations, you will get an error when you link them.
14268 The only reason this might be useful is if you wish to verify that the
14269 program will work on other systems which always work this way.
14270
14271 @item -fno-ident
14272 @opindex fno-ident
14273 Ignore the @samp{#ident} directive.
14274
14275 @item -finhibit-size-directive
14276 @opindex finhibit-size-directive
14277 Don't output a @code{.size} assembler directive, or anything else that
14278 would cause trouble if the function is split in the middle, and the
14279 two halves are placed at locations far apart in memory. This option is
14280 used when compiling @file{crtstuff.c}; you should not need to use it
14281 for anything else.
14282
14283 @item -fverbose-asm
14284 @opindex fverbose-asm
14285 Put extra commentary information in the generated assembly code to
14286 make it more readable. This option is generally only of use to those
14287 who actually need to read the generated assembly code (perhaps while
14288 debugging the compiler itself).
14289
14290 @option{-fno-verbose-asm}, the default, causes the
14291 extra information to be omitted and is useful when comparing two assembler
14292 files.
14293
14294 @item -frecord-gcc-switches
14295 @opindex frecord-gcc-switches
14296 This switch causes the command line that was used to invoke the
14297 compiler to be recorded into the object file that is being created.
14298 This switch is only implemented on some targets and the exact format
14299 of the recording is target and binary file format dependent, but it
14300 usually takes the form of a section containing ASCII text. This
14301 switch is related to the @option{-fverbose-asm} switch, but that
14302 switch only records information in the assembler output file as
14303 comments, so it never reaches the object file.
14304
14305 @item -fpic
14306 @opindex fpic
14307 @cindex global offset table
14308 @cindex PIC
14309 Generate position-independent code (PIC) suitable for use in a shared
14310 library, if supported for the target machine. Such code accesses all
14311 constant addresses through a global offset table (GOT)@. The dynamic
14312 loader resolves the GOT entries when the program starts (the dynamic
14313 loader is not part of GCC; it is part of the operating system). If
14314 the GOT size for the linked executable exceeds a machine-specific
14315 maximum size, you get an error message from the linker indicating that
14316 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14317 instead. (These maximums are 8k on the SPARC and 32k
14318 on the m68k and RS/6000. The 386 has no such limit.)
14319
14320 Position-independent code requires special support, and therefore works
14321 only on certain machines. For the 386, GCC supports PIC for System V
14322 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14323 position-independent.
14324
14325 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14326 are defined to 1.
14327
14328 @item -fPIC
14329 @opindex fPIC
14330 If supported for the target machine, emit position-independent code,
14331 suitable for dynamic linking and avoiding any limit on the size of the
14332 global offset table. This option makes a difference on the m68k,
14333 PowerPC and SPARC@.
14334
14335 Position-independent code requires special support, and therefore works
14336 only on certain machines.
14337
14338 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14339 are defined to 2.
14340
14341 @item -fpie
14342 @itemx -fPIE
14343 @opindex fpie
14344 @opindex fPIE
14345 These options are similar to @option{-fpic} and @option{-fPIC}, but
14346 generated position independent code can be only linked into executables.
14347 Usually these options are used when @option{-pie} GCC option will be
14348 used during linking.
14349
14350 @option{-fpie} and @option{-fPIE} both define the macros
14351 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14352 for @option{-fpie} and 2 for @option{-fPIE}.
14353
14354 @item -fno-jump-tables
14355 @opindex fno-jump-tables
14356 Do not use jump tables for switch statements even where it would be
14357 more efficient than other code generation strategies. This option is
14358 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14359 building code which forms part of a dynamic linker and cannot
14360 reference the address of a jump table. On some targets, jump tables
14361 do not require a GOT and this option is not needed.
14362
14363 @item -ffixed-@var{reg}
14364 @opindex ffixed
14365 Treat the register named @var{reg} as a fixed register; generated code
14366 should never refer to it (except perhaps as a stack pointer, frame
14367 pointer or in some other fixed role).
14368
14369 @var{reg} must be the name of a register. The register names accepted
14370 are machine-specific and are defined in the @code{REGISTER_NAMES}
14371 macro in the machine description macro file.
14372
14373 This flag does not have a negative form, because it specifies a
14374 three-way choice.
14375
14376 @item -fcall-used-@var{reg}
14377 @opindex fcall-used
14378 Treat the register named @var{reg} as an allocable register that is
14379 clobbered by function calls. It may be allocated for temporaries or
14380 variables that do not live across a call. Functions compiled this way
14381 will not save and restore the register @var{reg}.
14382
14383 It is an error to used this flag with the frame pointer or stack pointer.
14384 Use of this flag for other registers that have fixed pervasive roles in
14385 the machine's execution model will produce disastrous results.
14386
14387 This flag does not have a negative form, because it specifies a
14388 three-way choice.
14389
14390 @item -fcall-saved-@var{reg}
14391 @opindex fcall-saved
14392 Treat the register named @var{reg} as an allocable register saved by
14393 functions. It may be allocated even for temporaries or variables that
14394 live across a call. Functions compiled this way will save and restore
14395 the register @var{reg} if they use it.
14396
14397 It is an error to used this flag with the frame pointer or stack pointer.
14398 Use of this flag for other registers that have fixed pervasive roles in
14399 the machine's execution model will produce disastrous results.
14400
14401 A different sort of disaster will result from the use of this flag for
14402 a register in which function values may be returned.
14403
14404 This flag does not have a negative form, because it specifies a
14405 three-way choice.
14406
14407 @item -fpack-struct[=@var{n}]
14408 @opindex fpack-struct
14409 Without a value specified, pack all structure members together without
14410 holes. When a value is specified (which must be a small power of two), pack
14411 structure members according to this value, representing the maximum
14412 alignment (that is, objects with default alignment requirements larger than
14413 this will be output potentially unaligned at the next fitting location.
14414
14415 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14416 code that is not binary compatible with code generated without that switch.
14417 Additionally, it makes the code suboptimal.
14418 Use it to conform to a non-default application binary interface.
14419
14420 @item -finstrument-functions
14421 @opindex finstrument-functions
14422 Generate instrumentation calls for entry and exit to functions. Just
14423 after function entry and just before function exit, the following
14424 profiling functions will be called with the address of the current
14425 function and its call site. (On some platforms,
14426 @code{__builtin_return_address} does not work beyond the current
14427 function, so the call site information may not be available to the
14428 profiling functions otherwise.)
14429
14430 @smallexample
14431 void __cyg_profile_func_enter (void *this_fn,
14432 void *call_site);
14433 void __cyg_profile_func_exit (void *this_fn,
14434 void *call_site);
14435 @end smallexample
14436
14437 The first argument is the address of the start of the current function,
14438 which may be looked up exactly in the symbol table.
14439
14440 This instrumentation is also done for functions expanded inline in other
14441 functions. The profiling calls will indicate where, conceptually, the
14442 inline function is entered and exited. This means that addressable
14443 versions of such functions must be available. If all your uses of a
14444 function are expanded inline, this may mean an additional expansion of
14445 code size. If you use @samp{extern inline} in your C code, an
14446 addressable version of such functions must be provided. (This is
14447 normally the case anyways, but if you get lucky and the optimizer always
14448 expands the functions inline, you might have gotten away without
14449 providing static copies.)
14450
14451 A function may be given the attribute @code{no_instrument_function}, in
14452 which case this instrumentation will not be done. This can be used, for
14453 example, for the profiling functions listed above, high-priority
14454 interrupt routines, and any functions from which the profiling functions
14455 cannot safely be called (perhaps signal handlers, if the profiling
14456 routines generate output or allocate memory).
14457
14458 @item -fstack-check
14459 @opindex fstack-check
14460 Generate code to verify that you do not go beyond the boundary of the
14461 stack. You should specify this flag if you are running in an
14462 environment with multiple threads, but only rarely need to specify it in
14463 a single-threaded environment since stack overflow is automatically
14464 detected on nearly all systems if there is only one stack.
14465
14466 Note that this switch does not actually cause checking to be done; the
14467 operating system must do that. The switch causes generation of code
14468 to ensure that the operating system sees the stack being extended.
14469
14470 @item -fstack-limit-register=@var{reg}
14471 @itemx -fstack-limit-symbol=@var{sym}
14472 @itemx -fno-stack-limit
14473 @opindex fstack-limit-register
14474 @opindex fstack-limit-symbol
14475 @opindex fno-stack-limit
14476 Generate code to ensure that the stack does not grow beyond a certain value,
14477 either the value of a register or the address of a symbol. If the stack
14478 would grow beyond the value, a signal is raised. For most targets,
14479 the signal is raised before the stack overruns the boundary, so
14480 it is possible to catch the signal without taking special precautions.
14481
14482 For instance, if the stack starts at absolute address @samp{0x80000000}
14483 and grows downwards, you can use the flags
14484 @option{-fstack-limit-symbol=__stack_limit} and
14485 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
14486 of 128KB@. Note that this may only work with the GNU linker.
14487
14488 @cindex aliasing of parameters
14489 @cindex parameters, aliased
14490 @item -fargument-alias
14491 @itemx -fargument-noalias
14492 @itemx -fargument-noalias-global
14493 @itemx -fargument-noalias-anything
14494 @opindex fargument-alias
14495 @opindex fargument-noalias
14496 @opindex fargument-noalias-global
14497 @opindex fargument-noalias-anything
14498 Specify the possible relationships among parameters and between
14499 parameters and global data.
14500
14501 @option{-fargument-alias} specifies that arguments (parameters) may
14502 alias each other and may alias global storage.@*
14503 @option{-fargument-noalias} specifies that arguments do not alias
14504 each other, but may alias global storage.@*
14505 @option{-fargument-noalias-global} specifies that arguments do not
14506 alias each other and do not alias global storage.
14507 @option{-fargument-noalias-anything} specifies that arguments do not
14508 alias any other storage.
14509
14510 Each language will automatically use whatever option is required by
14511 the language standard. You should not need to use these options yourself.
14512
14513 @item -fleading-underscore
14514 @opindex fleading-underscore
14515 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14516 change the way C symbols are represented in the object file. One use
14517 is to help link with legacy assembly code.
14518
14519 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14520 generate code that is not binary compatible with code generated without that
14521 switch. Use it to conform to a non-default application binary interface.
14522 Not all targets provide complete support for this switch.
14523
14524 @item -ftls-model=@var{model}
14525 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14526 The @var{model} argument should be one of @code{global-dynamic},
14527 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
14528
14529 The default without @option{-fpic} is @code{initial-exec}; with
14530 @option{-fpic} the default is @code{global-dynamic}.
14531
14532 @item -fvisibility=@var{default|internal|hidden|protected}
14533 @opindex fvisibility
14534 Set the default ELF image symbol visibility to the specified option---all
14535 symbols will be marked with this unless overridden within the code.
14536 Using this feature can very substantially improve linking and
14537 load times of shared object libraries, produce more optimized
14538 code, provide near-perfect API export and prevent symbol clashes.
14539 It is @strong{strongly} recommended that you use this in any shared objects
14540 you distribute.
14541
14542 Despite the nomenclature, @code{default} always means public ie;
14543 available to be linked against from outside the shared object.
14544 @code{protected} and @code{internal} are pretty useless in real-world
14545 usage so the only other commonly used option will be @code{hidden}.
14546 The default if @option{-fvisibility} isn't specified is
14547 @code{default}, i.e., make every
14548 symbol public---this causes the same behavior as previous versions of
14549 GCC@.
14550
14551 A good explanation of the benefits offered by ensuring ELF
14552 symbols have the correct visibility is given by ``How To Write
14553 Shared Libraries'' by Ulrich Drepper (which can be found at
14554 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
14555 solution made possible by this option to marking things hidden when
14556 the default is public is to make the default hidden and mark things
14557 public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
14558 and @code{__attribute__ ((visibility("default")))} instead of
14559 @code{__declspec(dllexport)} you get almost identical semantics with
14560 identical syntax. This is a great boon to those working with
14561 cross-platform projects.
14562
14563 For those adding visibility support to existing code, you may find
14564 @samp{#pragma GCC visibility} of use. This works by you enclosing
14565 the declarations you wish to set visibility for with (for example)
14566 @samp{#pragma GCC visibility push(hidden)} and
14567 @samp{#pragma GCC visibility pop}.
14568 Bear in mind that symbol visibility should be viewed @strong{as
14569 part of the API interface contract} and thus all new code should
14570 always specify visibility when it is not the default ie; declarations
14571 only for use within the local DSO should @strong{always} be marked explicitly
14572 as hidden as so to avoid PLT indirection overheads---making this
14573 abundantly clear also aids readability and self-documentation of the code.
14574 Note that due to ISO C++ specification requirements, operator new and
14575 operator delete must always be of default visibility.
14576
14577 Be aware that headers from outside your project, in particular system
14578 headers and headers from any other library you use, may not be
14579 expecting to be compiled with visibility other than the default. You
14580 may need to explicitly say @samp{#pragma GCC visibility push(default)}
14581 before including any such headers.
14582
14583 @samp{extern} declarations are not affected by @samp{-fvisibility}, so
14584 a lot of code can be recompiled with @samp{-fvisibility=hidden} with
14585 no modifications. However, this means that calls to @samp{extern}
14586 functions with no explicit visibility will use the PLT, so it is more
14587 effective to use @samp{__attribute ((visibility))} and/or
14588 @samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
14589 declarations should be treated as hidden.
14590
14591 Note that @samp{-fvisibility} does affect C++ vague linkage
14592 entities. This means that, for instance, an exception class that will
14593 be thrown between DSOs must be explicitly marked with default
14594 visibility so that the @samp{type_info} nodes will be unified between
14595 the DSOs.
14596
14597 An overview of these techniques, their benefits and how to use them
14598 is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
14599
14600 @end table
14601
14602 @c man end
14603
14604 @node Environment Variables
14605 @section Environment Variables Affecting GCC
14606 @cindex environment variables
14607
14608 @c man begin ENVIRONMENT
14609 This section describes several environment variables that affect how GCC
14610 operates. Some of them work by specifying directories or prefixes to use
14611 when searching for various kinds of files. Some are used to specify other
14612 aspects of the compilation environment.
14613
14614 Note that you can also specify places to search using options such as
14615 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
14616 take precedence over places specified using environment variables, which
14617 in turn take precedence over those specified by the configuration of GCC@.
14618 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
14619 GNU Compiler Collection (GCC) Internals}.
14620
14621 @table @env
14622 @item LANG
14623 @itemx LC_CTYPE
14624 @c @itemx LC_COLLATE
14625 @itemx LC_MESSAGES
14626 @c @itemx LC_MONETARY
14627 @c @itemx LC_NUMERIC
14628 @c @itemx LC_TIME
14629 @itemx LC_ALL
14630 @findex LANG
14631 @findex LC_CTYPE
14632 @c @findex LC_COLLATE
14633 @findex LC_MESSAGES
14634 @c @findex LC_MONETARY
14635 @c @findex LC_NUMERIC
14636 @c @findex LC_TIME
14637 @findex LC_ALL
14638 @cindex locale
14639 These environment variables control the way that GCC uses
14640 localization information that allow GCC to work with different
14641 national conventions. GCC inspects the locale categories
14642 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
14643 so. These locale categories can be set to any value supported by your
14644 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
14645 Kingdom encoded in UTF-8.
14646
14647 The @env{LC_CTYPE} environment variable specifies character
14648 classification. GCC uses it to determine the character boundaries in
14649 a string; this is needed for some multibyte encodings that contain quote
14650 and escape characters that would otherwise be interpreted as a string
14651 end or escape.
14652
14653 The @env{LC_MESSAGES} environment variable specifies the language to
14654 use in diagnostic messages.
14655
14656 If the @env{LC_ALL} environment variable is set, it overrides the value
14657 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
14658 and @env{LC_MESSAGES} default to the value of the @env{LANG}
14659 environment variable. If none of these variables are set, GCC
14660 defaults to traditional C English behavior.
14661
14662 @item TMPDIR
14663 @findex TMPDIR
14664 If @env{TMPDIR} is set, it specifies the directory to use for temporary
14665 files. GCC uses temporary files to hold the output of one stage of
14666 compilation which is to be used as input to the next stage: for example,
14667 the output of the preprocessor, which is the input to the compiler
14668 proper.
14669
14670 @item GCC_EXEC_PREFIX
14671 @findex GCC_EXEC_PREFIX
14672 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
14673 names of the subprograms executed by the compiler. No slash is added
14674 when this prefix is combined with the name of a subprogram, but you can
14675 specify a prefix that ends with a slash if you wish.
14676
14677 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
14678 an appropriate prefix to use based on the pathname it was invoked with.
14679
14680 If GCC cannot find the subprogram using the specified prefix, it
14681 tries looking in the usual places for the subprogram.
14682
14683 The default value of @env{GCC_EXEC_PREFIX} is
14684 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
14685 the installed compiler. In many cases @var{prefix} is the value
14686 of @code{prefix} when you ran the @file{configure} script.
14687
14688 Other prefixes specified with @option{-B} take precedence over this prefix.
14689
14690 This prefix is also used for finding files such as @file{crt0.o} that are
14691 used for linking.
14692
14693 In addition, the prefix is used in an unusual way in finding the
14694 directories to search for header files. For each of the standard
14695 directories whose name normally begins with @samp{/usr/local/lib/gcc}
14696 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
14697 replacing that beginning with the specified prefix to produce an
14698 alternate directory name. Thus, with @option{-Bfoo/}, GCC will search
14699 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
14700 These alternate directories are searched first; the standard directories
14701 come next. If a standard directory begins with the configured
14702 @var{prefix} then the value of @var{prefix} is replaced by
14703 @env{GCC_EXEC_PREFIX} when looking for header files.
14704
14705 @item COMPILER_PATH
14706 @findex COMPILER_PATH
14707 The value of @env{COMPILER_PATH} is a colon-separated list of
14708 directories, much like @env{PATH}. GCC tries the directories thus
14709 specified when searching for subprograms, if it can't find the
14710 subprograms using @env{GCC_EXEC_PREFIX}.
14711
14712 @item LIBRARY_PATH
14713 @findex LIBRARY_PATH
14714 The value of @env{LIBRARY_PATH} is a colon-separated list of
14715 directories, much like @env{PATH}. When configured as a native compiler,
14716 GCC tries the directories thus specified when searching for special
14717 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
14718 using GCC also uses these directories when searching for ordinary
14719 libraries for the @option{-l} option (but directories specified with
14720 @option{-L} come first).
14721
14722 @item LANG
14723 @findex LANG
14724 @cindex locale definition
14725 This variable is used to pass locale information to the compiler. One way in
14726 which this information is used is to determine the character set to be used
14727 when character literals, string literals and comments are parsed in C and C++.
14728 When the compiler is configured to allow multibyte characters,
14729 the following values for @env{LANG} are recognized:
14730
14731 @table @samp
14732 @item C-JIS
14733 Recognize JIS characters.
14734 @item C-SJIS
14735 Recognize SJIS characters.
14736 @item C-EUCJP
14737 Recognize EUCJP characters.
14738 @end table
14739
14740 If @env{LANG} is not defined, or if it has some other value, then the
14741 compiler will use mblen and mbtowc as defined by the default locale to
14742 recognize and translate multibyte characters.
14743 @end table
14744
14745 @noindent
14746 Some additional environments variables affect the behavior of the
14747 preprocessor.
14748
14749 @include cppenv.texi
14750
14751 @c man end
14752
14753 @node Precompiled Headers
14754 @section Using Precompiled Headers
14755 @cindex precompiled headers
14756 @cindex speed of compilation
14757
14758 Often large projects have many header files that are included in every
14759 source file. The time the compiler takes to process these header files
14760 over and over again can account for nearly all of the time required to
14761 build the project. To make builds faster, GCC allows users to
14762 `precompile' a header file; then, if builds can use the precompiled
14763 header file they will be much faster.
14764
14765 To create a precompiled header file, simply compile it as you would any
14766 other file, if necessary using the @option{-x} option to make the driver
14767 treat it as a C or C++ header file. You will probably want to use a
14768 tool like @command{make} to keep the precompiled header up-to-date when
14769 the headers it contains change.
14770
14771 A precompiled header file will be searched for when @code{#include} is
14772 seen in the compilation. As it searches for the included file
14773 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
14774 compiler looks for a precompiled header in each directory just before it
14775 looks for the include file in that directory. The name searched for is
14776 the name specified in the @code{#include} with @samp{.gch} appended. If
14777 the precompiled header file can't be used, it is ignored.
14778
14779 For instance, if you have @code{#include "all.h"}, and you have
14780 @file{all.h.gch} in the same directory as @file{all.h}, then the
14781 precompiled header file will be used if possible, and the original
14782 header will be used otherwise.
14783
14784 Alternatively, you might decide to put the precompiled header file in a
14785 directory and use @option{-I} to ensure that directory is searched
14786 before (or instead of) the directory containing the original header.
14787 Then, if you want to check that the precompiled header file is always
14788 used, you can put a file of the same name as the original header in this
14789 directory containing an @code{#error} command.
14790
14791 This also works with @option{-include}. So yet another way to use
14792 precompiled headers, good for projects not designed with precompiled
14793 header files in mind, is to simply take most of the header files used by
14794 a project, include them from another header file, precompile that header
14795 file, and @option{-include} the precompiled header. If the header files
14796 have guards against multiple inclusion, they will be skipped because
14797 they've already been included (in the precompiled header).
14798
14799 If you need to precompile the same header file for different
14800 languages, targets, or compiler options, you can instead make a
14801 @emph{directory} named like @file{all.h.gch}, and put each precompiled
14802 header in the directory, perhaps using @option{-o}. It doesn't matter
14803 what you call the files in the directory, every precompiled header in
14804 the directory will be considered. The first precompiled header
14805 encountered in the directory that is valid for this compilation will
14806 be used; they're searched in no particular order.
14807
14808 There are many other possibilities, limited only by your imagination,
14809 good sense, and the constraints of your build system.
14810
14811 A precompiled header file can be used only when these conditions apply:
14812
14813 @itemize
14814 @item
14815 Only one precompiled header can be used in a particular compilation.
14816
14817 @item
14818 A precompiled header can't be used once the first C token is seen. You
14819 can have preprocessor directives before a precompiled header; you can
14820 even include a precompiled header from inside another header, so long as
14821 there are no C tokens before the @code{#include}.
14822
14823 @item
14824 The precompiled header file must be produced for the same language as
14825 the current compilation. You can't use a C precompiled header for a C++
14826 compilation.
14827
14828 @item
14829 The precompiled header file must have been produced by the same compiler
14830 binary as the current compilation is using.
14831
14832 @item
14833 Any macros defined before the precompiled header is included must
14834 either be defined in the same way as when the precompiled header was
14835 generated, or must not affect the precompiled header, which usually
14836 means that they don't appear in the precompiled header at all.
14837
14838 The @option{-D} option is one way to define a macro before a
14839 precompiled header is included; using a @code{#define} can also do it.
14840 There are also some options that define macros implicitly, like
14841 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
14842 defined this way.
14843
14844 @item If debugging information is output when using the precompiled
14845 header, using @option{-g} or similar, the same kind of debugging information
14846 must have been output when building the precompiled header. However,
14847 a precompiled header built using @option{-g} can be used in a compilation
14848 when no debugging information is being output.
14849
14850 @item The same @option{-m} options must generally be used when building
14851 and using the precompiled header. @xref{Submodel Options},
14852 for any cases where this rule is relaxed.
14853
14854 @item Each of the following options must be the same when building and using
14855 the precompiled header:
14856
14857 @gccoptlist{-fexceptions -funit-at-a-time}
14858
14859 @item
14860 Some other command-line options starting with @option{-f},
14861 @option{-p}, or @option{-O} must be defined in the same way as when
14862 the precompiled header was generated. At present, it's not clear
14863 which options are safe to change and which are not; the safest choice
14864 is to use exactly the same options when generating and using the
14865 precompiled header. The following are known to be safe:
14866
14867 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
14868 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
14869 -fsched-verbose=<number> -fschedule-insns -fvisibility= @gol
14870 -pedantic-errors}
14871
14872 @end itemize
14873
14874 For all of these except the last, the compiler will automatically
14875 ignore the precompiled header if the conditions aren't met. If you
14876 find an option combination that doesn't work and doesn't cause the
14877 precompiled header to be ignored, please consider filing a bug report,
14878 see @ref{Bugs}.
14879
14880 If you do use differing options when generating and using the
14881 precompiled header, the actual behavior will be a mixture of the
14882 behavior for the options. For instance, if you use @option{-g} to
14883 generate the precompiled header but not when using it, you may or may
14884 not get debugging information for routines in the precompiled header.
14885
14886 @node Running Protoize
14887 @section Running Protoize
14888
14889 The program @code{protoize} is an optional part of GCC@. You can use
14890 it to add prototypes to a program, thus converting the program to ISO
14891 C in one respect. The companion program @code{unprotoize} does the
14892 reverse: it removes argument types from any prototypes that are found.
14893
14894 When you run these programs, you must specify a set of source files as
14895 command line arguments. The conversion programs start out by compiling
14896 these files to see what functions they define. The information gathered
14897 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
14898
14899 After scanning comes actual conversion. The specified files are all
14900 eligible to be converted; any files they include (whether sources or
14901 just headers) are eligible as well.
14902
14903 But not all the eligible files are converted. By default,
14904 @code{protoize} and @code{unprotoize} convert only source and header
14905 files in the current directory. You can specify additional directories
14906 whose files should be converted with the @option{-d @var{directory}}
14907 option. You can also specify particular files to exclude with the
14908 @option{-x @var{file}} option. A file is converted if it is eligible, its
14909 directory name matches one of the specified directory names, and its
14910 name within the directory has not been excluded.
14911
14912 Basic conversion with @code{protoize} consists of rewriting most
14913 function definitions and function declarations to specify the types of
14914 the arguments. The only ones not rewritten are those for varargs
14915 functions.
14916
14917 @code{protoize} optionally inserts prototype declarations at the
14918 beginning of the source file, to make them available for any calls that
14919 precede the function's definition. Or it can insert prototype
14920 declarations with block scope in the blocks where undeclared functions
14921 are called.
14922
14923 Basic conversion with @code{unprotoize} consists of rewriting most
14924 function declarations to remove any argument types, and rewriting
14925 function definitions to the old-style pre-ISO form.
14926
14927 Both conversion programs print a warning for any function declaration or
14928 definition that they can't convert. You can suppress these warnings
14929 with @option{-q}.
14930
14931 The output from @code{protoize} or @code{unprotoize} replaces the
14932 original source file. The original file is renamed to a name ending
14933 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
14934 without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav}
14935 for DOS) file already exists, then the source file is simply discarded.
14936
14937 @code{protoize} and @code{unprotoize} both depend on GCC itself to
14938 scan the program and collect information about the functions it uses.
14939 So neither of these programs will work until GCC is installed.
14940
14941 Here is a table of the options you can use with @code{protoize} and
14942 @code{unprotoize}. Each option works with both programs unless
14943 otherwise stated.
14944
14945 @table @code
14946 @item -B @var{directory}
14947 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
14948 usual directory (normally @file{/usr/local/lib}). This file contains
14949 prototype information about standard system functions. This option
14950 applies only to @code{protoize}.
14951
14952 @item -c @var{compilation-options}
14953 Use @var{compilation-options} as the options when running @command{gcc} to
14954 produce the @samp{.X} files. The special option @option{-aux-info} is
14955 always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
14956
14957 Note that the compilation options must be given as a single argument to
14958 @code{protoize} or @code{unprotoize}. If you want to specify several
14959 @command{gcc} options, you must quote the entire set of compilation options
14960 to make them a single word in the shell.
14961
14962 There are certain @command{gcc} arguments that you cannot use, because they
14963 would produce the wrong kind of output. These include @option{-g},
14964 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
14965 the @var{compilation-options}, they are ignored.
14966
14967 @item -C
14968 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
14969 systems) instead of @samp{.c}. This is convenient if you are converting
14970 a C program to C++. This option applies only to @code{protoize}.
14971
14972 @item -g
14973 Add explicit global declarations. This means inserting explicit
14974 declarations at the beginning of each source file for each function
14975 that is called in the file and was not declared. These declarations
14976 precede the first function definition that contains a call to an
14977 undeclared function. This option applies only to @code{protoize}.
14978
14979 @item -i @var{string}
14980 Indent old-style parameter declarations with the string @var{string}.
14981 This option applies only to @code{protoize}.
14982
14983 @code{unprotoize} converts prototyped function definitions to old-style
14984 function definitions, where the arguments are declared between the
14985 argument list and the initial @samp{@{}. By default, @code{unprotoize}
14986 uses five spaces as the indentation. If you want to indent with just
14987 one space instead, use @option{-i " "}.
14988
14989 @item -k
14990 Keep the @samp{.X} files. Normally, they are deleted after conversion
14991 is finished.
14992
14993 @item -l
14994 Add explicit local declarations. @code{protoize} with @option{-l} inserts
14995 a prototype declaration for each function in each block which calls the
14996 function without any declaration. This option applies only to
14997 @code{protoize}.
14998
14999 @item -n
15000 Make no real changes. This mode just prints information about the conversions
15001 that would have been done without @option{-n}.
15002
15003 @item -N
15004 Make no @samp{.save} files. The original files are simply deleted.
15005 Use this option with caution.
15006
15007 @item -p @var{program}
15008 Use the program @var{program} as the compiler. Normally, the name
15009 @file{gcc} is used.
15010
15011 @item -q
15012 Work quietly. Most warnings are suppressed.
15013
15014 @item -v
15015 Print the version number, just like @option{-v} for @command{gcc}.
15016 @end table
15017
15018 If you need special compiler options to compile one of your program's
15019 source files, then you should generate that file's @samp{.X} file
15020 specially, by running @command{gcc} on that source file with the
15021 appropriate options and the option @option{-aux-info}. Then run
15022 @code{protoize} on the entire set of files. @code{protoize} will use
15023 the existing @samp{.X} file because it is newer than the source file.
15024 For example:
15025
15026 @smallexample
15027 gcc -Dfoo=bar file1.c -aux-info file1.X
15028 protoize *.c
15029 @end smallexample
15030
15031 @noindent
15032 You need to include the special files along with the rest in the
15033 @code{protoize} command, even though their @samp{.X} files already
15034 exist, because otherwise they won't get converted.
15035
15036 @xref{Protoize Caveats}, for more information on how to use
15037 @code{protoize} successfully.