]>
Commit | Line | Data |
---|---|---|
d0a5eb32 RK |
1 | @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
2 | @c 2000, 2001 Free Software Foundation, Inc. | |
74291a4b MM |
3 | @c This is part of the GCC manual. |
4 | @c For copying conditions, see the file gcc.texi. | |
5 | ||
9d86bffc JM |
6 | @ignore |
7 | @c man begin COPYRIGHT | |
8 | Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, | |
21c7361e | 9 | 1998, 1999, 2000, 2001 Free Software Foundation, Inc. |
9d86bffc | 10 | |
77bd67cb JM |
11 | Permission is granted to copy, distribute and/or modify this document |
12 | under the terms of the GNU Free Documentation License, Version 1.1 or | |
13 | any later version published by the Free Software Foundation; with the | |
14 | Invariant Sections being ``GNU General Public License'' and ``Funding | |
15 | Free Software'', the Front-Cover texts being (a) (see below), and with | |
16 | the Back-Cover Texts being (b) (see below). A copy of the license is | |
17 | included in the gfdl(7) man page. | |
9d86bffc | 18 | |
77bd67cb | 19 | (a) The FSF's Front-Cover Text is: |
9d86bffc | 20 | |
77bd67cb JM |
21 | A GNU Manual |
22 | ||
23 | (b) The FSF's Back-Cover Text is: | |
24 | ||
25 | You have freedom to copy and modify this GNU Manual, like GNU | |
26 | software. Copies published by the Free Software Foundation raise | |
27 | funds for GNU development. | |
9d86bffc JM |
28 | @c man end |
29 | @c Set file name and title for the man page. | |
30 | @setfilename gcc | |
31 | @settitle GNU project C and C++ compiler | |
32 | @c man begin SYNOPSIS | |
630d3d5a JM |
33 | gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}] |
34 | [@option{-g}] [@option{-pg}] [@option{-O}@var{level}] | |
35 | [@option{-W}@var{warn}@dots{}] [@option{-pedantic}] | |
36 | [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}] | |
37 | [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] | |
38 | [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}] | |
39 | [@option{-o} @var{outfile}] @var{infile}@dots{} | |
9d86bffc JM |
40 | |
41 | Only the most useful options are listed here; see below for the | |
42 | remainder. @samp{g++} accepts mostly the same options as @samp{gcc}. | |
43 | @c man end | |
44 | @c man begin SEEALSO | |
77bd67cb | 45 | gpl(7), gfdl(7), fsf-funding(7), |
9d86bffc JM |
46 | cpp(1), gcov(1), g77(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) |
47 | and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as}, | |
48 | @file{ld}, @file{binutils} and @file{gdb}. | |
49 | @c man end | |
2642624b JM |
50 | @c man begin BUGS |
51 | For instructions on reporting bugs, see | |
bedc7537 | 52 | @w{@uref{http://gcc.gnu.org/bugs.html}}. Use of the @command{gccbug} |
2642624b JM |
53 | script to report bugs is recommended. |
54 | @c man end | |
55 | @c man begin AUTHOR | |
56 | See the Info entry for @file{gcc}, or | |
161d7b59 | 57 | @w{@uref{http://gcc.gnu.org/thanks.html}}, for contributors to GCC@. |
2642624b | 58 | @c man end |
9d86bffc JM |
59 | @end ignore |
60 | ||
74291a4b | 61 | @node Invoking GCC |
0c2d1a2a JB |
62 | @chapter GCC Command Options |
63 | @cindex GCC command options | |
74291a4b | 64 | @cindex command options |
0c2d1a2a | 65 | @cindex options, GCC command |
74291a4b | 66 | |
9d86bffc JM |
67 | @c man begin DESCRIPTION |
68 | ||
0c2d1a2a | 69 | When you invoke GCC, it normally does preprocessing, compilation, |
74291a4b | 70 | assembly and linking. The ``overall options'' allow you to stop this |
630d3d5a | 71 | process at an intermediate stage. For example, the @option{-c} option |
74291a4b MM |
72 | says not to run the linker. Then the output consists of object files |
73 | output by the assembler. | |
74 | ||
75 | Other options are passed on to one stage of processing. Some options | |
76 | control the preprocessor and others the compiler itself. Yet other | |
77 | options control the assembler and linker; most of these are not | |
78 | documented here, since you rarely need to use any of them. | |
79 | ||
80 | @cindex C compilation options | |
0c2d1a2a | 81 | Most of the command line options that you can use with GCC are useful |
74291a4b MM |
82 | for C programs; when an option is only useful with another language |
83 | (usually C++), the explanation says so explicitly. If the description | |
84 | for a particular option does not mention a source language, you can use | |
85 | that option with all supported languages. | |
86 | ||
87 | @cindex C++ compilation options | |
88 | @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special | |
89 | options for compiling C++ programs. | |
90 | ||
91 | @cindex grouping options | |
92 | @cindex options, grouping | |
bedc7537 | 93 | The @command{gcc} program accepts options and file names as operands. Many |
b192711e | 94 | options have multi-letter names; therefore multiple single-letter options |
630d3d5a | 95 | may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d |
74291a4b MM |
96 | -r}}. |
97 | ||
98 | @cindex order of options | |
99 | @cindex options, order | |
100 | You can mix options and other arguments. For the most part, the order | |
101 | you use doesn't matter. Order does matter when you use several options | |
630d3d5a | 102 | of the same kind; for example, if you specify @option{-L} more than once, |
74291a4b MM |
103 | the directories are searched in the order specified. |
104 | ||
105 | Many options have long names starting with @samp{-f} or with | |
630d3d5a JM |
106 | @samp{-W}---for example, @option{-fforce-mem}, |
107 | @option{-fstrength-reduce}, @option{-Wformat} and so on. Most of | |
74291a4b | 108 | these have both positive and negative forms; the negative form of |
630d3d5a | 109 | @option{-ffoo} would be @option{-fno-foo}. This manual documents |
74291a4b MM |
110 | only one of these two forms, whichever one is not the default. |
111 | ||
9d86bffc JM |
112 | @c man end |
113 | ||
cd3bb277 JM |
114 | @xref{Option Index}, for an index to GCC's options. |
115 | ||
74291a4b MM |
116 | @menu |
117 | * Option Summary:: Brief list of all options, without explanations. | |
118 | * Overall Options:: Controlling the kind of output: | |
119 | an executable, object files, assembler files, | |
120 | or preprocessed source. | |
121 | * Invoking G++:: Compiling C++ programs. | |
122 | * C Dialect Options:: Controlling the variant of C language compiled. | |
123 | * C++ Dialect Options:: Variations on C++. | |
60de6385 | 124 | * Objective-C Dialect Options:: Variations on Objective-C. |
764dbbf2 | 125 | * Language Independent Options:: Controlling how diagnostics should be |
02f52e19 | 126 | formatted. |
74291a4b MM |
127 | * Warning Options:: How picky should the compiler be? |
128 | * Debugging Options:: Symbol tables, measurements, and debugging dumps. | |
129 | * Optimize Options:: How much optimization? | |
130 | * Preprocessor Options:: Controlling header files and macro definitions. | |
131 | Also, getting dependency information for Make. | |
132 | * Assembler Options:: Passing options to the assembler. | |
133 | * Link Options:: Specifying libraries and so on. | |
134 | * Directory Options:: Where to find header files and libraries. | |
135 | Where to find the compiler executable files. | |
a743d340 | 136 | * Spec Files:: How to pass switches to sub-processes. |
0c2d1a2a | 137 | * Target Options:: Running a cross-compiler, or an old version of GCC. |
74291a4b MM |
138 | * Submodel Options:: Specifying minor hardware or convention variations, |
139 | such as 68010 vs 68020. | |
140 | * Code Gen Options:: Specifying conventions for function calls, data layout | |
141 | and register usage. | |
0c2d1a2a | 142 | * Environment Variables:: Env vars that affect GCC. |
74291a4b MM |
143 | * Running Protoize:: Automatically adding or removing function prototypes. |
144 | @end menu | |
145 | ||
4bc1997b JM |
146 | @c man begin OPTIONS |
147 | ||
74291a4b MM |
148 | @node Option Summary |
149 | @section Option Summary | |
150 | ||
151 | Here is a summary of all the options, grouped by type. Explanations are | |
152 | in the following sections. | |
153 | ||
154 | @table @emph | |
155 | @item Overall Options | |
156 | @xref{Overall Options,,Options Controlling the Kind of Output}. | |
4bc1997b JM |
157 | @gccoptlist{ |
158 | -c -S -E -o @var{file} -pipe -pass-exit-codes -x @var{language} @gol | |
159 | -v --target-help --help} | |
74291a4b MM |
160 | |
161 | @item C Language Options | |
162 | @xref{C Dialect Options,,Options Controlling C Dialect}. | |
4bc1997b | 163 | @gccoptlist{ |
b1018de6 | 164 | -ansi -std=@var{standard} -aux-info @var{filename} @gol |
7d14c755 | 165 | -fno-asm -fno-builtin -fno-builtin-@var{function} @gol |
4bc1997b JM |
166 | -fhosted -ffreestanding @gol |
167 | -trigraphs -traditional -traditional-cpp @gol | |
168 | -fallow-single-precision -fcond-mismatch @gol | |
169 | -fsigned-bitfields -fsigned-char @gol | |
170 | -funsigned-bitfields -funsigned-char @gol | |
171 | -fwritable-strings -fshort-wchar} | |
74291a4b MM |
172 | |
173 | @item C++ Language Options | |
174 | @xref{C++ Dialect Options,,Options Controlling C++ Dialect}. | |
4bc1997b JM |
175 | @gccoptlist{ |
176 | -fno-access-control -fcheck-new -fconserve-space @gol | |
aa0cc562 JM |
177 | -fno-const-strings -fdollars-in-identifiers @gol |
178 | -fno-elide-constructors @gol | |
4bc1997b JM |
179 | -fno-enforce-eh-specs -fexternal-templates @gol |
180 | -falt-external-templates @gol | |
1dbb6023 | 181 | -ffor-scope -fno-for-scope -fno-gnu-keywords @gol |
90ecce3e | 182 | -fno-implicit-templates @gol |
4bc1997b JM |
183 | -fno-implicit-inline-templates @gol |
184 | -fno-implement-inlines -fms-extensions @gol | |
aa0cc562 | 185 | -fno-nonansi-builtins -fno-operator-names @gol |
4bc1997b | 186 | -fno-optional-diags -fpermissive @gol |
aa0cc562 | 187 | -frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol |
90ecce3e | 188 | -fuse-cxa-atexit -fvtable-gc -fno-weak -nostdinc++ @gol |
4bc1997b JM |
189 | -fno-default-inline -Wctor-dtor-privacy @gol |
190 | -Wnon-virtual-dtor -Wreorder @gol | |
191 | -Weffc++ -Wno-deprecated @gol | |
192 | -Wno-non-template-friend -Wold-style-cast @gol | |
193 | -Woverloaded-virtual -Wno-pmf-conversions @gol | |
194 | -Wsign-promo -Wsynth} | |
74291a4b | 195 | |
60de6385 SS |
196 | @item Objective-C Language Options |
197 | @xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}. | |
198 | @gccoptlist{ | |
630d3d5a | 199 | -fconstant-string-class=@var{class-name} @gol |
310668e8 | 200 | -fgnu-runtime -fnext-runtime -gen-decls @gol |
60de6385 SS |
201 | -Wno-protocol -Wselector} |
202 | ||
764dbbf2 GDR |
203 | @item Language Independent Options |
204 | @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. | |
4bc1997b JM |
205 | @gccoptlist{ |
206 | -fmessage-length=@var{n} @gol | |
207 | -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}} | |
764dbbf2 | 208 | |
74291a4b MM |
209 | @item Warning Options |
210 | @xref{Warning Options,,Options to Request or Suppress Warnings}. | |
4bc1997b JM |
211 | @gccoptlist{ |
212 | -fsyntax-only -pedantic -pedantic-errors @gol | |
213 | -w -W -Wall -Waggregate-return @gol | |
214 | -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol | |
6c36d76b | 215 | -Wconversion -Wdisabled-optimization -Wdiv-by-zero -Werror @gol |
4bc1997b | 216 | -Wfloat-equal -Wformat -Wformat=2 @gol |
feb48bde JM |
217 | -Wformat-nonliteral -Wformat-security @gol |
218 | -Wimplicit -Wimplicit-int @gol | |
4bc1997b JM |
219 | -Wimplicit-function-declaration @gol |
220 | -Werror-implicit-function-declaration @gol | |
221 | -Wimport -Winline @gol | |
222 | -Wlarger-than-@var{len} -Wlong-long @gol | |
1f0c3120 | 223 | -Wmain -Wmissing-braces -Wmissing-declarations @gol |
4bc1997b | 224 | -Wmissing-format-attribute -Wmissing-noreturn @gol |
feb48bde | 225 | -Wmultichar -Wno-format-extra-args -Wno-format-y2k @gol |
4bc1997b | 226 | -Wno-import -Wpacked -Wpadded @gol |
310668e8 | 227 | -Wparentheses -Wpointer-arith -Wredundant-decls @gol |
4bc1997b JM |
228 | -Wreturn-type -Wsequence-point -Wshadow @gol |
229 | -Wsign-compare -Wswitch -Wsystem-headers @gol | |
230 | -Wtrigraphs -Wundef -Wuninitialized @gol | |
231 | -Wunknown-pragmas -Wunreachable-code @gol | |
232 | -Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol | |
233 | -Wunused-value -Wunused-variable -Wwrite-strings} | |
74291a4b | 234 | |
fe50c0eb | 235 | @item C-only Warning Options |
4bc1997b | 236 | @gccoptlist{ |
310668e8 JM |
237 | -Wbad-function-cast -Wmissing-prototypes -Wnested-externs @gol |
238 | -Wstrict-prototypes -Wtraditional} | |
fe50c0eb | 239 | |
74291a4b MM |
240 | @item Debugging Options |
241 | @xref{Debugging Options,,Options for Debugging Your Program or GCC}. | |
4bc1997b | 242 | @gccoptlist{ |
8456b95a | 243 | -d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol |
92989aed | 244 | -fdump-unnumbered |
aee96fe9 | 245 | -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol |
22367161 NS |
246 | -fdump-tree-original@r{[}-@var{n}@r{]} -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol |
247 | -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol | |
e76b4820 | 248 | -fmem-report -fpretend-float @gol |
1f0c3120 | 249 | -fprofile-arcs -ftest-coverage -ftime-report @gol |
4bc1997b | 250 | -g -g@var{level} -gcoff -gdwarf -gdwarf-1 -gdwarf-1+ -gdwarf-2 @gol |
5f98259a | 251 | -ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol |
4bc1997b | 252 | -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol |
b1018de6 | 253 | -print-multi-directory -print-multi-lib @gol |
4bc1997b JM |
254 | -print-prog-name=@var{program} -print-search-dirs -Q @gol |
255 | -save-temps -time} | |
74291a4b MM |
256 | |
257 | @item Optimization Options | |
258 | @xref{Optimize Options,,Options that Control Optimization}. | |
4bc1997b JM |
259 | @gccoptlist{ |
260 | -falign-functions=@var{n} -falign-jumps=@var{n} @gol | |
261 | -falign-labels=@var{n} -falign-loops=@var{n} @gol | |
8582c27b | 262 | -fbranch-probabilities -fcaller-saves -fcprop-registers @gol |
62d285ff | 263 | -fcse-follow-jumps -fcse-skip-blocks -fdata-sections @gol |
4bc1997b JM |
264 | -fdelayed-branch -fdelete-null-pointer-checks @gol |
265 | -fexpensive-optimizations -ffast-math -ffloat-store @gol | |
feb48bde JM |
266 | -fforce-addr -fforce-mem -ffunction-sections @gol |
267 | -fgcse -fgcse-lm -fgcse-sm @gol | |
4bc1997b | 268 | -finline-functions -finline-limit=@var{n} -fkeep-inline-functions @gol |
201556f0 JJ |
269 | -fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol |
270 | -fmove-all-movables -fno-default-inline -fno-defer-pop @gol | |
feb48bde | 271 | -fno-function-cse -fno-guess-branch-probability @gol |
6cfc0341 | 272 | -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol |
de6c5979 | 273 | -funsafe-math-optimizations -fno-trapping-math @gol |
4bc1997b | 274 | -fomit-frame-pointer -foptimize-register-move @gol |
0dd0e980 | 275 | -foptimize-sibling-calls -fprefetch-loop-arrays -freduce-all-givs @gol |
4bc1997b JM |
276 | -fregmove -frename-registers @gol |
277 | -frerun-cse-after-loop -frerun-loop-opt @gol | |
278 | -fschedule-insns -fschedule-insns2 @gol | |
0b47e4c1 | 279 | -fsingle-precision-constant -fssa -fssa-ccp -fssa-dce @gol |
4bc1997b | 280 | -fstrength-reduce -fstrict-aliasing -fthread-jumps -ftrapv @gol |
86be733d | 281 | -funroll-all-loops -funroll-loops @gol |
3af64fd6 | 282 | --param @var{name}=@var{value} |
4bc1997b | 283 | -O -O0 -O1 -O2 -O3 -Os} |
74291a4b MM |
284 | |
285 | @item Preprocessor Options | |
286 | @xref{Preprocessor Options,,Options Controlling the Preprocessor}. | |
4bc1997b JM |
287 | @gccoptlist{ |
288 | -$ -A@var{question}=@var{answer} -A-@var{question}@r{[}=@var{answer}@r{]} @gol | |
289 | -C -dD -dI -dM -dN @gol | |
290 | -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol | |
291 | -idirafter @var{dir} @gol | |
292 | -include @var{file} -imacros @var{file} @gol | |
293 | -iprefix @var{file} -iwithprefix @var{dir} @gol | |
bdd42dd9 | 294 | -iwithprefixbefore @var{dir} -isystem @var{dir} @gol |
4bc1997b | 295 | -M -MM -MF -MG -MP -MQ -MT -nostdinc -P -remap @gol |
aee96fe9 | 296 | -trigraphs -undef -U@var{macro} -Wp,@var{option}} |
74291a4b MM |
297 | |
298 | @item Assembler Option | |
299 | @xref{Assembler Options,,Passing Options to the Assembler}. | |
4bc1997b | 300 | @gccoptlist{ |
aee96fe9 | 301 | -Wa,@var{option}} |
74291a4b MM |
302 | |
303 | @item Linker Options | |
304 | @xref{Link Options,,Options for Linking}. | |
4bc1997b JM |
305 | @gccoptlist{ |
306 | @var{object-file-name} -l@var{library} @gol | |
307 | -nostartfiles -nodefaultlibs -nostdlib @gol | |
308 | -s -static -static-libgcc -shared -shared-libgcc -symbolic @gol | |
aee96fe9 | 309 | -Wl,@var{option} -Xlinker @var{option} @gol |
4bc1997b | 310 | -u @var{symbol}} |
74291a4b MM |
311 | |
312 | @item Directory Options | |
313 | @xref{Directory Options,,Options for Directory Search}. | |
4bc1997b JM |
314 | @gccoptlist{ |
315 | -B@var{prefix} -I@var{dir} -I- -L@var{dir} -specs=@var{file}} | |
74291a4b MM |
316 | |
317 | @item Target Options | |
318 | @c I wrote this xref this way to avoid overfull hbox. -- rms | |
319 | @xref{Target Options}. | |
4bc1997b JM |
320 | @gccoptlist{ |
321 | -b @var{machine} -V @var{version}} | |
74291a4b MM |
322 | |
323 | @item Machine Dependent Options | |
324 | @xref{Submodel Options,,Hardware Models and Configurations}. | |
74291a4b | 325 | @emph{M680x0 Options} |
4bc1997b JM |
326 | @gccoptlist{ |
327 | -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol | |
feb48bde | 328 | -m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol |
310668e8 JM |
329 | -mfpa -mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol |
330 | -malign-int -mstrict-align} | |
74291a4b | 331 | |
2856c3e3 | 332 | @emph{M68hc1x Options} |
4bc1997b JM |
333 | @gccoptlist{ |
334 | -m6811 -m6812 -m68hc11 -m68hc12 @gol | |
335 | -mauto-incdec -mshort -msoft-reg-count=@var{count}} | |
2856c3e3 | 336 | |
74291a4b | 337 | @emph{VAX Options} |
4bc1997b JM |
338 | @gccoptlist{ |
339 | -mg -mgnu -munix} | |
74291a4b MM |
340 | |
341 | @emph{SPARC Options} | |
4bc1997b | 342 | @gccoptlist{ |
630d3d5a JM |
343 | -mcpu=@var{cpu-type} @gol |
344 | -mtune=@var{cpu-type} @gol | |
345 | -mcmodel=@var{code-model} @gol | |
4bc1997b JM |
346 | -m32 -m64 @gol |
347 | -mapp-regs -mbroken-saverestore -mcypress @gol | |
feb48bde | 348 | -mepilogue -mfaster-structs -mflat @gol |
4bc1997b JM |
349 | -mfpu -mhard-float -mhard-quad-float @gol |
350 | -mimpure-text -mlive-g0 -mno-app-regs @gol | |
310668e8 JM |
351 | -mno-epilogue -mno-faster-structs -mno-flat -mno-fpu @gol |
352 | -mno-impure-text -mno-stack-bias -mno-unaligned-doubles @gol | |
4bc1997b JM |
353 | -msoft-float -msoft-quad-float -msparclite -mstack-bias @gol |
354 | -msupersparc -munaligned-doubles -mv8} | |
74291a4b MM |
355 | |
356 | @emph{Convex Options} | |
4bc1997b JM |
357 | @gccoptlist{ |
358 | -mc1 -mc2 -mc32 -mc34 -mc38 @gol | |
359 | -margcount -mnoargcount @gol | |
360 | -mlong32 -mlong64 @gol | |
361 | -mvolatile-cache -mvolatile-nocache} | |
74291a4b MM |
362 | |
363 | @emph{AMD29K Options} | |
4bc1997b JM |
364 | @gccoptlist{ |
365 | -m29000 -m29050 -mbw -mnbw -mdw -mndw @gol | |
366 | -mlarge -mnormal -msmall @gol | |
367 | -mkernel-registers -mno-reuse-arg-regs @gol | |
368 | -mno-stack-check -mno-storem-bug @gol | |
369 | -mreuse-arg-regs -msoft-float -mstack-check @gol | |
370 | -mstorem-bug -muser-registers} | |
74291a4b MM |
371 | |
372 | @emph{ARM Options} | |
4bc1997b | 373 | @gccoptlist{ |
310668e8 JM |
374 | -mapcs-frame -mno-apcs-frame @gol |
375 | -mapcs-26 -mapcs-32 @gol | |
376 | -mapcs-stack-check -mno-apcs-stack-check @gol | |
377 | -mapcs-float -mno-apcs-float @gol | |
378 | -mapcs-reentrant -mno-apcs-reentrant @gol | |
379 | -msched-prolog -mno-sched-prolog @gol | |
380 | -mlittle-endian -mbig-endian -mwords-little-endian @gol | |
381 | -malignment-traps -mno-alignment-traps @gol | |
382 | -msoft-float -mhard-float -mfpe @gol | |
383 | -mthumb-interwork -mno-thumb-interwork @gol | |
384 | -mcpu=@var{name} -march=@var{name} -mfpe=@var{name} @gol | |
247f8561 | 385 | -mstructure-size-boundary=@var{n} @gol |
310668e8 | 386 | -mbsd -mxopen -mno-symrename @gol |
4bc1997b | 387 | -mabort-on-noreturn @gol |
310668e8 JM |
388 | -mlong-calls -mno-long-calls @gol |
389 | -msingle-pic-base -mno-single-pic-base @gol | |
247f8561 PB |
390 | -mpic-register=@var{reg} @gol |
391 | -mnop-fun-dllimport @gol | |
392 | -mpoke-function-name @gol | |
310668e8 JM |
393 | -mthumb -marm @gol |
394 | -mtpcs-frame -mtpcs-leaf-frame @gol | |
395 | -mcaller-super-interworking -mcallee-super-interworking } | |
74291a4b | 396 | |
ecff22ab | 397 | @emph{MN10200 Options} |
4bc1997b JM |
398 | @gccoptlist{ |
399 | -mrelax} | |
ecff22ab | 400 | |
6d6d0fa0 | 401 | @emph{MN10300 Options} |
4bc1997b | 402 | @gccoptlist{ |
c474f76b AO |
403 | -mmult-bug -mno-mult-bug @gol |
404 | -mam33 -mno-am33 @gol | |
405 | -mno-crt0 -mrelax} | |
6d6d0fa0 | 406 | |
861bb6c1 | 407 | @emph{M32R/D Options} |
4bc1997b | 408 | @gccoptlist{ |
98180123 | 409 | -m32rx -m32r -mcode-model=@var{model-type} -msdata=@var{sdata-type} @gol |
4bc1997b | 410 | -G @var{num}} |
861bb6c1 | 411 | |
74291a4b | 412 | @emph{M88K Options} |
4bc1997b JM |
413 | @gccoptlist{ |
414 | -m88000 -m88100 -m88110 -mbig-pic @gol | |
415 | -mcheck-zero-division -mhandle-large-shift @gol | |
416 | -midentify-revision -mno-check-zero-division @gol | |
417 | -mno-ocs-debug-info -mno-ocs-frame-position @gol | |
418 | -mno-optimize-arg-area -mno-serialize-volatile @gol | |
419 | -mno-underscores -mocs-debug-info @gol | |
420 | -mocs-frame-position -moptimize-arg-area @gol | |
421 | -mserialize-volatile -mshort-data-@var{num} -msvr3 @gol | |
422 | -msvr4 -mtrap-large-shift -muse-div-instruction @gol | |
423 | -mversion-03.00 -mwarn-passed-structs} | |
74291a4b MM |
424 | |
425 | @emph{RS/6000 and PowerPC Options} | |
4bc1997b | 426 | @gccoptlist{ |
630d3d5a JM |
427 | -mcpu=@var{cpu-type} @gol |
428 | -mtune=@var{cpu-type} @gol | |
4bc1997b JM |
429 | -mpower -mno-power -mpower2 -mno-power2 @gol |
430 | -mpowerpc -mpowerpc64 -mno-powerpc @gol | |
0ac081f6 | 431 | -maltivec -mno-altivec @gol |
4bc1997b JM |
432 | -mpowerpc-gpopt -mno-powerpc-gpopt @gol |
433 | -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol | |
434 | -mnew-mnemonics -mold-mnemonics @gol | |
435 | -mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc @gol | |
0a379b7a | 436 | -m64 -m32 -mxl-call -mno-xl-call -mpe @gol |
4bc1997b JM |
437 | -msoft-float -mhard-float -mmultiple -mno-multiple @gol |
438 | -mstring -mno-string -mupdate -mno-update @gol | |
439 | -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol | |
440 | -mstrict-align -mno-strict-align -mrelocatable @gol | |
441 | -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol | |
442 | -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol | |
9c34dbbf | 443 | -mcall-aix -mcall-sysv -mcall-netbsd @gol |
9904592e | 444 | -maix-struct-return -msvr4-struct-return |
0ac081f6 | 445 | -mabi=altivec @gol |
9c34dbbf | 446 | -mprototype -mno-prototype @gol |
4bc1997b | 447 | -msim -mmvme -mads -myellowknife -memb -msdata @gol |
0a379b7a | 448 | -msdata=@var{opt} -mvxworks -G @var{num} -pthread} |
74291a4b MM |
449 | |
450 | @emph{RT Options} | |
4bc1997b JM |
451 | @gccoptlist{ |
452 | -mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs @gol | |
453 | -mfull-fp-blocks -mhc-struct-return -min-line-mul @gol | |
454 | -mminimum-fp-blocks -mnohc-struct-return} | |
74291a4b MM |
455 | |
456 | @emph{MIPS Options} | |
4bc1997b | 457 | @gccoptlist{ |
7dac2f89 EC |
458 | -mabicalls -march=@var{cpu-type} -mtune=@var{cpu=type} @gol |
459 | -mcpu=@var{cpu-type} -membedded-data -muninit-const-in-rodata @gol | |
13fac94a GK |
460 | -membedded-pic -mfp32 -mfp64 -mfused-madd -mno-fused-madd @gol |
461 | -mgas -mgp32 -mgp64 @gol | |
4bc1997b | 462 | -mgpopt -mhalf-pic -mhard-float -mint64 -mips1 @gol |
feb48bde | 463 | -mips2 -mips3 -mips4 -mlong64 -mlong32 -mlong-calls -mmemcpy @gol |
4bc1997b | 464 | -mmips-as -mmips-tfile -mno-abicalls @gol |
feb48bde JM |
465 | -mno-embedded-data -mno-uninit-const-in-rodata @gol |
466 | -mno-embedded-pic -mno-gpopt -mno-long-calls @gol | |
4bc1997b JM |
467 | -mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats @gol |
468 | -mrnames -msoft-float @gol | |
469 | -m4650 -msingle-float -mmad @gol | |
470 | -mstats -EL -EB -G @var{num} -nocpp @gol | |
feb48bde | 471 | -mabi=32 -mabi=n32 -mabi=64 -mabi=eabi @gol |
d490e8ad | 472 | -mfix7000 -mno-crt0 -mflush-func=@var{func} -mno-flush-func} |
74291a4b | 473 | |
14f73b5a | 474 | @emph{i386 and x86-64 Options} |
4bc1997b | 475 | @gccoptlist{ |
965f5423 | 476 | -mcpu=@var{cpu-type} -march=@var{cpu-type} -mfpmath=@var{unit} @gol |
c93e80a5 | 477 | -masm=@var{dialect} -mno-fancy-math-387 @gol |
4bc1997b JM |
478 | -mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol |
479 | -mno-wide-multiply -mrtd -malign-double @gol | |
3e18fdf6 | 480 | -mpreferred-stack-boundary=@var{num} @gol |
965f5423 | 481 | -mmmx -msse -msse2 -msse-math -m3dnow @gol |
feb48bde JM |
482 | -mthreads -mno-align-stringops -minline-all-stringops @gol |
483 | -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol | |
14f73b5a JH |
484 | -m96bit-long-double -mregparm=@var{num} -momit-leaf-frame-pointer @gol |
485 | -mno-red-zone@gol | |
486 | -m32 -m64} | |
74291a4b MM |
487 | |
488 | @emph{HPPA Options} | |
4bc1997b | 489 | @gccoptlist{ |
630d3d5a | 490 | -march=@var{architecture-type} @gol |
feb48bde JM |
491 | -mbig-switch -mdisable-fpregs -mdisable-indexing @gol |
492 | -mfast-indirect-calls -mgas -mjump-in-delay @gol | |
4bc1997b JM |
493 | -mlong-load-store -mno-big-switch -mno-disable-fpregs @gol |
494 | -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol | |
feb48bde | 495 | -mno-jump-in-delay -mno-long-load-store @gol |
4bc1997b | 496 | -mno-portable-runtime -mno-soft-float @gol |
feb48bde JM |
497 | -mno-space-regs -msoft-float -mpa-risc-1-0 @gol |
498 | -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol | |
630d3d5a | 499 | -mschedule=@var{cpu-type} -mspace-regs} |
74291a4b MM |
500 | |
501 | @emph{Intel 960 Options} | |
4bc1997b | 502 | @gccoptlist{ |
630d3d5a | 503 | -m@var{cpu-type} -masm-compat -mclean-linkage @gol |
4bc1997b JM |
504 | -mcode-align -mcomplex-addr -mleaf-procedures @gol |
505 | -mic-compat -mic2.0-compat -mic3.0-compat @gol | |
506 | -mintel-asm -mno-clean-linkage -mno-code-align @gol | |
507 | -mno-complex-addr -mno-leaf-procedures @gol | |
508 | -mno-old-align -mno-strict-align -mno-tail-call @gol | |
509 | -mnumerics -mold-align -msoft-float -mstrict-align @gol | |
510 | -mtail-call} | |
74291a4b MM |
511 | |
512 | @emph{DEC Alpha Options} | |
4bc1997b | 513 | @gccoptlist{ |
310668e8 JM |
514 | -mfp-regs -mno-fp-regs -mno-soft-float -msoft-float @gol |
515 | -malpha-as -mgas @gol | |
4bc1997b JM |
516 | -mieee -mieee-with-inexact -mieee-conformant @gol |
517 | -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol | |
518 | -mtrap-precision=@var{mode} -mbuild-constants @gol | |
630d3d5a | 519 | -mcpu=@var{cpu-type} @gol |
310668e8 | 520 | -mbwx -mno-bwx -mcix -mno-cix -mmax -mno-max @gol |
4bc1997b | 521 | -mmemory-latency=@var{time}} |
74291a4b | 522 | |
d7c23cdc DR |
523 | @emph{DEC Alpha/VMS Options} |
524 | @gccoptlist{ | |
525 | -mvms-return-codes} | |
526 | ||
74291a4b | 527 | @emph{Clipper Options} |
4bc1997b JM |
528 | @gccoptlist{ |
529 | -mc300 -mc400} | |
74291a4b MM |
530 | |
531 | @emph{H8/300 Options} | |
4bc1997b | 532 | @gccoptlist{ |
310668e8 | 533 | -mrelax -mh -ms -mint32 -malign-300} |
74291a4b MM |
534 | |
535 | @emph{SH Options} | |
4bc1997b JM |
536 | @gccoptlist{ |
537 | -m1 -m2 -m3 -m3e @gol | |
538 | -m4-nofpu -m4-single-only -m4-single -m4 @gol | |
539 | -mb -ml -mdalign -mrelax @gol | |
540 | -mbigtable -mfmovd -mhitachi -mnomacsave @gol | |
c474f76b AO |
541 | -mieee -misize -mpadstruct -mspace @gol |
542 | -mprefergot -musermode} | |
74291a4b MM |
543 | |
544 | @emph{System V Options} | |
4bc1997b | 545 | @gccoptlist{ |
aee96fe9 | 546 | -Qy -Qn -YP,@var{paths} -Ym,@var{dir}} |
74291a4b | 547 | |
56b2d7a7 | 548 | @emph{ARC Options} |
4bc1997b JM |
549 | @gccoptlist{ |
550 | -EB -EL @gol | |
630d3d5a JM |
551 | -mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol |
552 | -mdata=@var{data-section} -mrodata=@var{readonly-data-section}} | |
56b2d7a7 | 553 | |
282a61e6 | 554 | @emph{TMS320C3x/C4x Options} |
4bc1997b | 555 | @gccoptlist{ |
310668e8 JM |
556 | -mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol |
557 | -mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol | |
558 | -mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol | |
559 | -mparallel-insns -mparallel-mpy -mpreserve-float} | |
282a61e6 | 560 | |
f84271d9 | 561 | @emph{V850 Options} |
4bc1997b | 562 | @gccoptlist{ |
310668e8 JM |
563 | -mlong-calls -mno-long-calls -mep -mno-ep @gol |
564 | -mprolog-function -mno-prolog-function -mspace @gol | |
565 | -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol | |
566 | -mv850 -mbig-switch} | |
83575957 ID |
567 | |
568 | @emph{NS32K Options} | |
4bc1997b | 569 | @gccoptlist{ |
310668e8 | 570 | -m32032 -m32332 -m32532 -m32081 -m32381 @gol |
feb48bde | 571 | -mmult-add -mnomult-add -msoft-float -mrtd -mnortd @gol |
310668e8 JM |
572 | -mregparam -mnoregparam -msb -mnosb @gol |
573 | -mbitfield -mnobitfield -mhimem -mnohimem} | |
789a3090 | 574 | |
052a4b28 | 575 | @emph{AVR Options} |
4bc1997b | 576 | @gccoptlist{ |
310668e8 JM |
577 | -mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol |
578 | -mcall-prologues -mno-tablejump -mtiny-stack} | |
052a4b28 | 579 | |
789a3090 | 580 | @emph{MCore Options} |
4bc1997b | 581 | @gccoptlist{ |
feb48bde | 582 | -mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol |
310668e8 JM |
583 | -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol |
584 | -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol | |
585 | -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol | |
586 | -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} | |
f84271d9 | 587 | |
bcf684c7 HPN |
588 | @emph{MMIX Options} |
589 | @gccoptlist{ | |
590 | -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol | |
591 | -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol | |
592 | -melf} | |
593 | ||
df6194d4 JW |
594 | @emph{IA-64 Options} |
595 | @gccoptlist{ | |
310668e8 JM |
596 | -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol |
597 | -mvolatile-asm-stop -mb-step -mregister-names -mno-sdata @gol | |
598 | -mconstant-gp -mauto-pic -minline-divide-min-latency @gol | |
599 | -minline-divide-max-throughput -mno-dwarf2-asm @gol | |
630d3d5a | 600 | -mfixed-range=@var{register-range}} |
df6194d4 | 601 | |
91abf72d HP |
602 | @emph{S/390 and zSeries Options} |
603 | @gccoptlist{ | |
604 | -mhard-float -msoft-float -mbackchain -mno-backchain @gol | |
605 | -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol | |
606 | -m64 -m31 -mdebug -mno-debug} | |
607 | ||
0b85d816 HPN |
608 | @emph{CRIS Options} |
609 | @gccoptlist{ | |
610 | -mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol | |
611 | -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol | |
612 | -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol | |
613 | -mstack-align -mdata-align -mconst-align @gol | |
614 | -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol | |
615 | -melf -maout -melinux -mlinux -sim -sim2} | |
616 | ||
74291a4b MM |
617 | @item Code Generation Options |
618 | @xref{Code Gen Options,,Options for Code Generation Conventions}. | |
4bc1997b JM |
619 | @gccoptlist{ |
620 | -fcall-saved-@var{reg} -fcall-used-@var{reg} @gol | |
6cfc0341 | 621 | -ffixed-@var{reg} -fexceptions @gol |
b932f770 | 622 | -fnon-call-exceptions -funwind-tables -fasynchronous-unwind-tables @gol |
4bc1997b | 623 | -finhibit-size-directive -finstrument-functions @gol |
4bc1997b JM |
624 | -fno-common -fno-ident -fno-gnu-linker @gol |
625 | -fpcc-struct-return -fpic -fPIC @gol | |
626 | -freg-struct-return -fshared-data -fshort-enums @gol | |
310668e8 JM |
627 | -fshort-double -fvolatile @gol |
628 | -fvolatile-global -fvolatile-static @gol | |
4bc1997b JM |
629 | -fverbose-asm -fpack-struct -fstack-check @gol |
630 | -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol | |
631 | -fargument-alias -fargument-noalias @gol | |
310668e8 | 632 | -fargument-noalias-global -fleading-underscore} |
74291a4b MM |
633 | @end table |
634 | ||
635 | @menu | |
636 | * Overall Options:: Controlling the kind of output: | |
637 | an executable, object files, assembler files, | |
638 | or preprocessed source. | |
639 | * C Dialect Options:: Controlling the variant of C language compiled. | |
640 | * C++ Dialect Options:: Variations on C++. | |
60de6385 | 641 | * Objective-C Dialect Options:: Variations on Objective-C. |
764dbbf2 | 642 | * Language Independent Options:: Controlling how diagnostics should be |
02f52e19 | 643 | formatted. |
74291a4b MM |
644 | * Warning Options:: How picky should the compiler be? |
645 | * Debugging Options:: Symbol tables, measurements, and debugging dumps. | |
646 | * Optimize Options:: How much optimization? | |
647 | * Preprocessor Options:: Controlling header files and macro definitions. | |
648 | Also, getting dependency information for Make. | |
649 | * Assembler Options:: Passing options to the assembler. | |
650 | * Link Options:: Specifying libraries and so on. | |
651 | * Directory Options:: Where to find header files and libraries. | |
652 | Where to find the compiler executable files. | |
a743d340 | 653 | * Spec Files:: How to pass switches to sub-processes. |
0c2d1a2a | 654 | * Target Options:: Running a cross-compiler, or an old version of GCC. |
74291a4b MM |
655 | @end menu |
656 | ||
657 | @node Overall Options | |
658 | @section Options Controlling the Kind of Output | |
659 | ||
660 | Compilation can involve up to four stages: preprocessing, compilation | |
661 | proper, assembly and linking, always in that order. The first three | |
662 | stages apply to an individual source file, and end by producing an | |
663 | object file; linking combines all the object files (those newly | |
664 | compiled, and those specified as input) into an executable file. | |
665 | ||
666 | @cindex file name suffix | |
667 | For any given input file, the file name suffix determines what kind of | |
668 | compilation is done: | |
669 | ||
2642624b | 670 | @table @gcctabopt |
74291a4b MM |
671 | @item @var{file}.c |
672 | C source code which must be preprocessed. | |
673 | ||
674 | @item @var{file}.i | |
675 | C source code which should not be preprocessed. | |
676 | ||
677 | @item @var{file}.ii | |
678 | C++ source code which should not be preprocessed. | |
679 | ||
680 | @item @var{file}.m | |
681 | Objective-C source code. Note that you must link with the library | |
682 | @file{libobjc.a} to make an Objective-C program work. | |
683 | ||
b9265ec1 JM |
684 | @item @var{file}.mi |
685 | Objective-C source code which should not be preprocessed. | |
686 | ||
74291a4b MM |
687 | @item @var{file}.h |
688 | C header file (not to be compiled or linked). | |
689 | ||
690 | @item @var{file}.cc | |
b9265ec1 | 691 | @itemx @var{file}.cp |
74291a4b MM |
692 | @itemx @var{file}.cxx |
693 | @itemx @var{file}.cpp | |
b9265ec1 | 694 | @itemx @var{file}.c++ |
74291a4b MM |
695 | @itemx @var{file}.C |
696 | C++ source code which must be preprocessed. Note that in @samp{.cxx}, | |
697 | the last two letters must both be literally @samp{x}. Likewise, | |
161d7b59 | 698 | @samp{.C} refers to a literal capital C@. |
74291a4b | 699 | |
b9265ec1 JM |
700 | @item @var{file}.f |
701 | @itemx @var{file}.for | |
702 | @itemx @var{file}.FOR | |
703 | Fortran source code which should not be preprocessed. | |
704 | ||
705 | @item @var{file}.F | |
706 | @itemx @var{file}.fpp | |
707 | @itemx @var{file}.FPP | |
708 | Fortran source code which must be preprocessed (with the traditional | |
709 | preprocessor). | |
710 | ||
711 | @item @var{file}.r | |
712 | Fortran source code which must be preprocessed with a RATFOR | |
161d7b59 | 713 | preprocessor (not included with GCC)@. |
b9265ec1 JM |
714 | |
715 | @xref{Overall Options,,Options Controlling the Kind of Output, g77, | |
716 | Using and Porting GNU Fortran}, for more details of the handling of | |
717 | Fortran input files. | |
718 | ||
719 | @c FIXME: Descriptions of Java file types. | |
720 | @c @var{file}.java | |
721 | @c @var{file}.class | |
722 | @c @var{file}.zip | |
723 | @c @var{file}.jar | |
724 | ||
e23381df GB |
725 | @item @var{file}.ads |
726 | Ada source code file which contains a library unit declaration (a | |
727 | declaration of a package, subprogram, or generic, or a generic | |
728 | instantiation), or a library unit renaming declaration (a package, | |
729 | generic, or subprogram renaming declaration). Such files are also | |
730 | called @dfn{specs}. | |
731 | ||
732 | @itemx @var{file}.adb | |
733 | Ada source code file containing a library unit body (a subprogram or | |
734 | package body). Such files are also called @dfn{bodies}. | |
735 | ||
b9265ec1 | 736 | @c GCC also knows about some suffixes for languages not yet included: |
b9265ec1 JM |
737 | @c Pascal: |
738 | @c @var{file}.p | |
739 | @c @var{file}.pas | |
740 | ||
741 | @item @var{file}.ch | |
742 | @itemx @var{file}.chi | |
743 | CHILL source code (preprocessed with the traditional preprocessor). | |
744 | ||
74291a4b MM |
745 | @item @var{file}.s |
746 | Assembler code. | |
747 | ||
748 | @item @var{file}.S | |
749 | Assembler code which must be preprocessed. | |
750 | ||
751 | @item @var{other} | |
752 | An object file to be fed straight into linking. | |
753 | Any file name with no recognized suffix is treated this way. | |
754 | @end table | |
755 | ||
cd3bb277 | 756 | @opindex x |
630d3d5a | 757 | You can specify the input language explicitly with the @option{-x} option: |
74291a4b | 758 | |
2642624b | 759 | @table @gcctabopt |
74291a4b MM |
760 | @item -x @var{language} |
761 | Specify explicitly the @var{language} for the following input files | |
762 | (rather than letting the compiler choose a default based on the file | |
763 | name suffix). This option applies to all following input files until | |
630d3d5a | 764 | the next @option{-x} option. Possible values for @var{language} are: |
74291a4b | 765 | @example |
b9265ec1 JM |
766 | c c-header cpp-output |
767 | c++ c++-cpp-output | |
768 | objective-c objc-cpp-output | |
74291a4b | 769 | assembler assembler-with-cpp |
e23381df GB |
770 | ada |
771 | chill | |
b9265ec1 | 772 | f77 f77-cpp-input ratfor |
e23381df | 773 | java |
74291a4b MM |
774 | @end example |
775 | ||
776 | @item -x none | |
777 | Turn off any specification of a language, so that subsequent files are | |
630d3d5a | 778 | handled according to their file name suffixes (as they are if @option{-x} |
74291a4b | 779 | has not been used at all). |
14a774a9 RK |
780 | |
781 | @item -pass-exit-codes | |
cd3bb277 | 782 | @opindex pass-exit-codes |
bedc7537 | 783 | Normally the @command{gcc} program will exit with the code of 1 if any |
14a774a9 | 784 | phase of the compiler returns a non-success return code. If you specify |
630d3d5a | 785 | @option{-pass-exit-codes}, the @command{gcc} program will instead return with |
14a774a9 RK |
786 | numerically highest error produced by any phase that returned an error |
787 | indication. | |
74291a4b MM |
788 | @end table |
789 | ||
790 | If you only want some of the stages of compilation, you can use | |
630d3d5a JM |
791 | @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and |
792 | one of the options @option{-c}, @option{-S}, or @option{-E} to say where | |
bedc7537 NC |
793 | @command{gcc} is to stop. Note that some combinations (for example, |
794 | @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. | |
74291a4b | 795 | |
2642624b | 796 | @table @gcctabopt |
74291a4b | 797 | @item -c |
cd3bb277 | 798 | @opindex c |
74291a4b MM |
799 | Compile or assemble the source files, but do not link. The linking |
800 | stage simply is not done. The ultimate output is in the form of an | |
801 | object file for each source file. | |
802 | ||
803 | By default, the object file name for a source file is made by replacing | |
804 | the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. | |
805 | ||
806 | Unrecognized input files, not requiring compilation or assembly, are | |
807 | ignored. | |
808 | ||
809 | @item -S | |
cd3bb277 | 810 | @opindex S |
74291a4b MM |
811 | Stop after the stage of compilation proper; do not assemble. The output |
812 | is in the form of an assembler code file for each non-assembler input | |
813 | file specified. | |
814 | ||
815 | By default, the assembler file name for a source file is made by | |
816 | replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. | |
817 | ||
818 | Input files that don't require compilation are ignored. | |
819 | ||
820 | @item -E | |
cd3bb277 | 821 | @opindex E |
74291a4b MM |
822 | Stop after the preprocessing stage; do not run the compiler proper. The |
823 | output is in the form of preprocessed source code, which is sent to the | |
824 | standard output. | |
825 | ||
826 | Input files which don't require preprocessing are ignored. | |
827 | ||
828 | @cindex output file option | |
829 | @item -o @var{file} | |
cd3bb277 | 830 | @opindex o |
74291a4b MM |
831 | Place output in file @var{file}. This applies regardless to whatever |
832 | sort of output is being produced, whether it be an executable file, | |
833 | an object file, an assembler file or preprocessed C code. | |
834 | ||
835 | Since only one output file can be specified, it does not make sense to | |
630d3d5a | 836 | use @option{-o} when compiling more than one input file, unless you are |
74291a4b MM |
837 | producing an executable file as output. |
838 | ||
630d3d5a | 839 | If @option{-o} is not specified, the default is to put an executable file |
74291a4b MM |
840 | in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in |
841 | @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and | |
bd819a4a | 842 | all preprocessed C source on standard output. |
74291a4b MM |
843 | |
844 | @item -v | |
cd3bb277 | 845 | @opindex v |
74291a4b MM |
846 | Print (on standard error output) the commands executed to run the stages |
847 | of compilation. Also print the version number of the compiler driver | |
848 | program and of the preprocessor and the compiler proper. | |
849 | ||
850 | @item -pipe | |
cd3bb277 | 851 | @opindex pipe |
74291a4b MM |
852 | Use pipes rather than temporary files for communication between the |
853 | various stages of compilation. This fails to work on some systems where | |
854 | the assembler is unable to read from a pipe; but the GNU assembler has | |
855 | no trouble. | |
844642e6 NC |
856 | |
857 | @item --help | |
cd3bb277 | 858 | @opindex help |
844642e6 | 859 | Print (on the standard output) a description of the command line options |
bedc7537 NC |
860 | understood by @command{gcc}. If the @option{-v} option is also specified |
861 | then @option{--help} will also be passed on to the various processes | |
862 | invoked by @command{gcc}, so that they can display the command line options | |
863 | they accept. If the @option{-W} option is also specified then command | |
844642e6 NC |
864 | line options which have no documentation associated with them will also |
865 | be displayed. | |
10501d8f CC |
866 | |
867 | @item --target-help | |
cd3bb277 | 868 | @opindex target-help |
10501d8f CC |
869 | Print (on the standard output) a description of target specific command |
870 | line options for each tool. | |
74291a4b MM |
871 | @end table |
872 | ||
873 | @node Invoking G++ | |
874 | @section Compiling C++ Programs | |
875 | ||
876 | @cindex suffixes for C++ source | |
877 | @cindex C++ source file suffixes | |
878 | C++ source files conventionally use one of the suffixes @samp{.C}, | |
bba975d4 | 879 | @samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx}; |
0c2d1a2a | 880 | preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes |
bba975d4 JM |
881 | files with these names and compiles them as C++ programs even if you |
882 | call the compiler the same way as for compiling C programs (usually with | |
bedc7537 | 883 | the name @command{gcc}). |
74291a4b MM |
884 | |
885 | @findex g++ | |
886 | @findex c++ | |
887 | However, C++ programs often require class libraries as well as a | |
888 | compiler that understands the C++ language---and under some | |
889 | circumstances, you might want to compile programs from standard input, | |
890 | or otherwise without a suffix that flags them as C++ programs. | |
bedc7537 | 891 | @command{g++} is a program that calls GCC with the default language |
e5e809f4 | 892 | set to C++, and automatically specifies linking against the C++ |
bedc7537 NC |
893 | library. On many systems, @command{g++} is also |
894 | installed with the name @command{c++}. | |
74291a4b | 895 | |
bedc7537 | 896 | @cindex invoking @command{g++} |
74291a4b MM |
897 | When you compile C++ programs, you may specify many of the same |
898 | command-line options that you use for compiling programs in any | |
899 | language; or command-line options meaningful for C and related | |
900 | languages; or options that are meaningful only for C++ programs. | |
901 | @xref{C Dialect Options,,Options Controlling C Dialect}, for | |
161d7b59 | 902 | explanations of options for languages related to C@. |
74291a4b MM |
903 | @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for |
904 | explanations of options that are meaningful only for C++ programs. | |
905 | ||
906 | @node C Dialect Options | |
907 | @section Options Controlling C Dialect | |
908 | @cindex dialect options | |
909 | @cindex language dialect options | |
910 | @cindex options, dialect | |
911 | ||
912 | The following options control the dialect of C (or languages derived | |
2147b154 | 913 | from C, such as C++ and Objective-C) that the compiler accepts: |
74291a4b | 914 | |
2642624b | 915 | @table @gcctabopt |
74291a4b | 916 | @cindex ANSI support |
c1030c7c | 917 | @cindex ISO support |
74291a4b | 918 | @item -ansi |
cd3bb277 | 919 | @opindex ansi |
c1030c7c | 920 | In C mode, support all ISO C89 programs. In C++ mode, |
775afb25 | 921 | remove GNU extensions that conflict with ISO C++. |
74291a4b | 922 | |
c1030c7c | 923 | This turns off certain features of GCC that are incompatible with ISO |
aee96fe9 | 924 | C89 (when compiling C code), or of standard C++ (when compiling C++ code), |
0c2d1a2a | 925 | such as the @code{asm} and @code{typeof} keywords, and |
74291a4b MM |
926 | predefined macros such as @code{unix} and @code{vax} that identify the |
927 | type of system you are using. It also enables the undesirable and | |
02f52e19 | 928 | rarely used ISO trigraph feature. For the C compiler, |
0c2d1a2a | 929 | it disables recognition of C++ style @samp{//} comments as well as |
775afb25 | 930 | the @code{inline} keyword. |
74291a4b MM |
931 | |
932 | The alternate keywords @code{__asm__}, @code{__extension__}, | |
933 | @code{__inline__} and @code{__typeof__} continue to work despite | |
630d3d5a | 934 | @option{-ansi}. You would not want to use them in an ISO C program, of |
74291a4b | 935 | course, but it is useful to put them in header files that might be included |
630d3d5a | 936 | in compilations done with @option{-ansi}. Alternate predefined macros |
74291a4b | 937 | such as @code{__unix__} and @code{__vax__} are also available, with or |
630d3d5a | 938 | without @option{-ansi}. |
74291a4b | 939 | |
630d3d5a JM |
940 | The @option{-ansi} option does not cause non-ISO programs to be |
941 | rejected gratuitously. For that, @option{-pedantic} is required in | |
942 | addition to @option{-ansi}. @xref{Warning Options}. | |
74291a4b | 943 | |
630d3d5a | 944 | The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} |
74291a4b MM |
945 | option is used. Some header files may notice this macro and refrain |
946 | from declaring certain functions or defining certain macros that the | |
c1030c7c | 947 | ISO standard doesn't call for; this is to avoid interfering with any |
74291a4b MM |
948 | programs that might use these names for other things. |
949 | ||
c771326b JM |
950 | Functions which would normally be built in but do not have semantics |
951 | defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in | |
630d3d5a | 952 | functions with @option{-ansi} is used. @xref{Other Builtins,,Other |
f0523f02 | 953 | built-in functions provided by GCC}, for details of the functions |
01702459 | 954 | affected. |
74291a4b | 955 | |
49419c8f | 956 | @item -std= |
cd3bb277 | 957 | @opindex std |
aee96fe9 JM |
958 | Determine the language standard. This option is currently only |
959 | supported when compiling C@. A value for this option must be provided; | |
02f52e19 | 960 | possible values are |
3932261a | 961 | |
ee457005 | 962 | @table @samp |
aee96fe9 JM |
963 | @item c89 |
964 | @itemx iso9899:1990 | |
965 | ISO C89 (same as @option{-ansi}). | |
3043b30e ML |
966 | |
967 | @item iso9899:199409 | |
aee96fe9 | 968 | ISO C89 as modified in amendment 1. |
3043b30e | 969 | |
49419c8f | 970 | @item c99 |
aee96fe9 JM |
971 | @itemx c9x |
972 | @itemx iso9899:1999 | |
973 | @itemx iso9899:199x | |
974 | ISO C99. Note that this standard is not yet fully supported; see | |
975 | @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The | |
976 | names @samp{c9x} and @samp{iso9899:199x} are deprecated. | |
3043b30e ML |
977 | |
978 | @item gnu89 | |
aee96fe9 | 979 | Default, ISO C89 plus GNU extensions (including some C99 features). |
3043b30e | 980 | |
49419c8f | 981 | @item gnu99 |
7dac2f89 | 982 | @item gnu9x |
d15a05b3 EC |
983 | ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, |
984 | this will become the default. The name @samp{gnu9x} is deprecated. | |
49419c8f | 985 | |
ee457005 | 986 | @end table |
3043b30e ML |
987 | |
988 | Even when this option is not specified, you can still use some of the | |
989 | features of newer standards in so far as they do not conflict with | |
990 | previous C standards. For example, you may use @code{__restrict__} even | |
bedc7537 | 991 | when @option{-std=c99} is not specified. |
3932261a | 992 | |
5490d604 JM |
993 | The @option{-std} options specifying some version of ISO C have the same |
994 | effects as @option{-ansi}, except that features that were not in ISO C89 | |
995 | but are in the specified version (for example, @samp{//} comments and | |
996 | the @code{inline} keyword in ISO C99) are not disabled. | |
997 | ||
c1030c7c JM |
998 | @xref{Standards,,Language Standards Supported by GCC}, for details of |
999 | these standard versions. | |
1000 | ||
b1018de6 AO |
1001 | @item -aux-info @var{filename} |
1002 | @opindex aux-info | |
1003 | Output to the given filename prototyped declarations for all functions | |
1004 | declared and/or defined in a translation unit, including those in header | |
161d7b59 | 1005 | files. This option is silently ignored in any language other than C@. |
b1018de6 AO |
1006 | |
1007 | Besides declarations, the file indicates, in comments, the origin of | |
1008 | each declaration (source file and line), whether the declaration was | |
1009 | implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or | |
1010 | @samp{O} for old, respectively, in the first character after the line | |
1011 | number and the colon), and whether it came from a declaration or a | |
1012 | definition (@samp{C} or @samp{F}, respectively, in the following | |
1013 | character). In the case of function definitions, a K&R-style list of | |
1014 | arguments followed by their declarations is also provided, inside | |
1015 | comments, after the declaration. | |
1016 | ||
74291a4b | 1017 | @item -fno-asm |
cd3bb277 | 1018 | @opindex fno-asm |
74291a4b MM |
1019 | Do not recognize @code{asm}, @code{inline} or @code{typeof} as a |
1020 | keyword, so that code can use these words as identifiers. You can use | |
1021 | the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} | |
630d3d5a | 1022 | instead. @option{-ansi} implies @option{-fno-asm}. |
74291a4b MM |
1023 | |
1024 | In C++, this switch only affects the @code{typeof} keyword, since | |
1025 | @code{asm} and @code{inline} are standard keywords. You may want to | |
630d3d5a | 1026 | use the @option{-fno-gnu-keywords} flag instead, which has the same |
5490d604 JM |
1027 | effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this |
1028 | switch only affects the @code{asm} and @code{typeof} keywords, since | |
1029 | @code{inline} is a standard keyword in ISO C99. | |
74291a4b MM |
1030 | |
1031 | @item -fno-builtin | |
7d14c755 | 1032 | @itemx -fno-builtin-@var{function} @r{(C and Objective-C only)} |
cd3bb277 | 1033 | @opindex fno-builtin |
c771326b JM |
1034 | @cindex built-in functions |
1035 | Don't recognize built-in functions that do not begin with | |
01702459 | 1036 | @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in |
f0523f02 | 1037 | functions provided by GCC}, for details of the functions affected, |
c771326b | 1038 | including those which are not built-in functions when @option{-ansi} or |
5490d604 JM |
1039 | @option{-std} options for strict ISO C conformance are used because they |
1040 | do not have an ISO standard meaning. | |
74291a4b | 1041 | |
c771326b | 1042 | GCC normally generates special code to handle certain built-in functions |
74291a4b MM |
1043 | more efficiently; for instance, calls to @code{alloca} may become single |
1044 | instructions that adjust the stack directly, and calls to @code{memcpy} | |
1045 | may become inline copy loops. The resulting code is often both smaller | |
1046 | and faster, but since the function calls no longer appear as such, you | |
1047 | cannot set a breakpoint on those calls, nor can you change the behavior | |
1048 | of the functions by linking with a different library. | |
1049 | ||
630d3d5a | 1050 | In C++, @option{-fno-builtin} is always in effect. The @option{-fbuiltin} |
0b1161fc | 1051 | option has no effect. Therefore, in C++, the only way to get the |
c771326b | 1052 | optimization benefits of built-in functions is to call the function |
0b1161fc | 1053 | using the @samp{__builtin_} prefix. The GNU C++ Standard Library uses |
c771326b | 1054 | built-in functions to implement many functions (like |
0b1161fc MM |
1055 | @code{std::strchr}), so that you automatically get efficient code. |
1056 | ||
7d14c755 JM |
1057 | With the @option{-fno-builtin-@var{function}} option, not available |
1058 | when compiling C++, only the built-in function @var{function} is | |
1059 | disabled. @var{function} must not begin with @samp{__builtin_}. If a | |
1060 | function is named this is not built-in in this version of GCC, this | |
1061 | option is ignored. There is no corresponding | |
1062 | @option{-fbuiltin-@var{function}} option; if you wish to enable | |
1063 | built-in functions selectively when using @option{-fno-builtin} or | |
1064 | @option{-ffreestanding}, you may define macros such as: | |
1065 | ||
1066 | @smallexample | |
1067 | #define abs(n) __builtin_abs ((n)) | |
1068 | #define strcpy(d, s) __builtin_strcpy ((d), (s)) | |
1069 | @end smallexample | |
1070 | ||
861bb6c1 | 1071 | @item -fhosted |
cd3bb277 | 1072 | @opindex fhosted |
861bb6c1 JL |
1073 | @cindex hosted environment |
1074 | ||
1075 | Assert that compilation takes place in a hosted environment. This implies | |
630d3d5a | 1076 | @option{-fbuiltin}. A hosted environment is one in which the |
861bb6c1 JL |
1077 | entire standard library is available, and in which @code{main} has a return |
1078 | type of @code{int}. Examples are nearly everything except a kernel. | |
630d3d5a | 1079 | This is equivalent to @option{-fno-freestanding}. |
861bb6c1 JL |
1080 | |
1081 | @item -ffreestanding | |
cd3bb277 | 1082 | @opindex ffreestanding |
861bb6c1 JL |
1083 | @cindex hosted environment |
1084 | ||
1085 | Assert that compilation takes place in a freestanding environment. This | |
630d3d5a | 1086 | implies @option{-fno-builtin}. A freestanding environment |
861bb6c1 JL |
1087 | is one in which the standard library may not exist, and program startup may |
1088 | not necessarily be at @code{main}. The most obvious example is an OS kernel. | |
630d3d5a | 1089 | This is equivalent to @option{-fno-hosted}. |
861bb6c1 | 1090 | |
c1030c7c JM |
1091 | @xref{Standards,,Language Standards Supported by GCC}, for details of |
1092 | freestanding and hosted environments. | |
1093 | ||
74291a4b | 1094 | @item -trigraphs |
cd3bb277 | 1095 | @opindex trigraphs |
3bce8a01 NB |
1096 | Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} |
1097 | options for strict ISO C conformance) implies @option{-trigraphs}. | |
74291a4b MM |
1098 | |
1099 | @cindex traditional C language | |
1100 | @cindex C language, traditional | |
1101 | @item -traditional | |
cd3bb277 | 1102 | @opindex traditional |
74291a4b MM |
1103 | Attempt to support some aspects of traditional C compilers. |
1104 | Specifically: | |
1105 | ||
1106 | @itemize @bullet | |
1107 | @item | |
1108 | All @code{extern} declarations take effect globally even if they | |
1109 | are written inside of a function definition. This includes implicit | |
1110 | declarations of functions. | |
1111 | ||
1112 | @item | |
1113 | The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const} | |
1114 | and @code{volatile} are not recognized. (You can still use the | |
1115 | alternative keywords such as @code{__typeof__}, @code{__inline__}, and | |
1116 | so on.) | |
1117 | ||
1118 | @item | |
1119 | Comparisons between pointers and integers are always allowed. | |
1120 | ||
1121 | @item | |
1122 | Integer types @code{unsigned short} and @code{unsigned char} promote | |
1123 | to @code{unsigned int}. | |
1124 | ||
1125 | @item | |
1126 | Out-of-range floating point literals are not an error. | |
1127 | ||
1128 | @item | |
c1030c7c | 1129 | Certain constructs which ISO regards as a single invalid preprocessing |
74291a4b MM |
1130 | number, such as @samp{0xe-0xd}, are treated as expressions instead. |
1131 | ||
1132 | @item | |
1133 | String ``constants'' are not necessarily constant; they are stored in | |
1134 | writable space, and identical looking constants are allocated | |
1135 | separately. (This is the same as the effect of | |
630d3d5a | 1136 | @option{-fwritable-strings}.) |
74291a4b MM |
1137 | |
1138 | @cindex @code{longjmp} and automatic variables | |
1139 | @item | |
1140 | All automatic variables not declared @code{register} are preserved by | |
c1030c7c | 1141 | @code{longjmp}. Ordinarily, GNU C follows ISO C: automatic variables |
74291a4b MM |
1142 | not declared @code{volatile} may be clobbered. |
1143 | ||
1144 | @item | |
cd3bb277 JM |
1145 | @cindex @samp{\x} |
1146 | @cindex @samp{\a} | |
74291a4b MM |
1147 | @cindex escape sequences, traditional |
1148 | The character escape sequences @samp{\x} and @samp{\a} evaluate as the | |
1149 | literal characters @samp{x} and @samp{a} respectively. Without | |
630d3d5a | 1150 | @w{@option{-traditional}}, @samp{\x} is a prefix for the hexadecimal |
74291a4b | 1151 | representation of a character, and @samp{\a} produces a bell. |
ad299d9b | 1152 | @end itemize |
74291a4b | 1153 | |
aa99bd09 JM |
1154 | This option is deprecated and may be removed. |
1155 | ||
630d3d5a | 1156 | You may wish to use @option{-fno-builtin} as well as @option{-traditional} |
c771326b | 1157 | if your program uses names that are normally GNU C built-in functions for |
74291a4b MM |
1158 | other purposes of its own. |
1159 | ||
630d3d5a | 1160 | You cannot use @option{-traditional} if you include any header files that |
c1030c7c | 1161 | rely on ISO C features. Some vendors are starting to ship systems with |
630d3d5a | 1162 | ISO C header files and you cannot use @option{-traditional} on such |
74291a4b MM |
1163 | systems to compile files that include any system headers. |
1164 | ||
9c34dbbf | 1165 | The @option{-traditional} option also enables @option{-traditional-cpp}. |
74291a4b MM |
1166 | |
1167 | @item -traditional-cpp | |
cd3bb277 | 1168 | @opindex traditional-cpp |
74291a4b | 1169 | Attempt to support some aspects of traditional C preprocessors. |
9c34dbbf | 1170 | See the GNU CPP manual for details. |
74291a4b MM |
1171 | |
1172 | @item -fcond-mismatch | |
cd3bb277 | 1173 | @opindex fcond-mismatch |
74291a4b | 1174 | Allow conditional expressions with mismatched types in the second and |
a7537031 JM |
1175 | third arguments. The value of such an expression is void. This option |
1176 | is not supported for C++. | |
74291a4b MM |
1177 | |
1178 | @item -funsigned-char | |
cd3bb277 | 1179 | @opindex funsigned-char |
74291a4b MM |
1180 | Let the type @code{char} be unsigned, like @code{unsigned char}. |
1181 | ||
1182 | Each kind of machine has a default for what @code{char} should | |
1183 | be. It is either like @code{unsigned char} by default or like | |
1184 | @code{signed char} by default. | |
1185 | ||
1186 | Ideally, a portable program should always use @code{signed char} or | |
1187 | @code{unsigned char} when it depends on the signedness of an object. | |
1188 | But many programs have been written to use plain @code{char} and | |
1189 | expect it to be signed, or expect it to be unsigned, depending on the | |
1190 | machines they were written for. This option, and its inverse, let you | |
1191 | make such a program work with the opposite default. | |
1192 | ||
1193 | The type @code{char} is always a distinct type from each of | |
1194 | @code{signed char} or @code{unsigned char}, even though its behavior | |
1195 | is always just like one of those two. | |
1196 | ||
1197 | @item -fsigned-char | |
cd3bb277 | 1198 | @opindex fsigned-char |
74291a4b MM |
1199 | Let the type @code{char} be signed, like @code{signed char}. |
1200 | ||
630d3d5a JM |
1201 | Note that this is equivalent to @option{-fno-unsigned-char}, which is |
1202 | the negative form of @option{-funsigned-char}. Likewise, the option | |
1203 | @option{-fno-signed-char} is equivalent to @option{-funsigned-char}. | |
74291a4b | 1204 | |
74291a4b MM |
1205 | @item -fsigned-bitfields |
1206 | @itemx -funsigned-bitfields | |
1207 | @itemx -fno-signed-bitfields | |
1208 | @itemx -fno-unsigned-bitfields | |
cd3bb277 JM |
1209 | @opindex fsigned-bitfields |
1210 | @opindex funsigned-bitfields | |
1211 | @opindex fno-signed-bitfields | |
1212 | @opindex fno-unsigned-bitfields | |
c771326b | 1213 | These options control whether a bit-field is signed or unsigned, when the |
74291a4b | 1214 | declaration does not use either @code{signed} or @code{unsigned}. By |
c771326b | 1215 | default, such a bit-field is signed, because this is consistent: the |
74291a4b MM |
1216 | basic integer types such as @code{int} are signed types. |
1217 | ||
c771326b | 1218 | However, when @option{-traditional} is used, bit-fields are all unsigned |
74291a4b MM |
1219 | no matter what. |
1220 | ||
1221 | @item -fwritable-strings | |
cd3bb277 | 1222 | @opindex fwritable-strings |
74291a4b MM |
1223 | Store string constants in the writable data segment and don't uniquize |
1224 | them. This is for compatibility with old programs which assume they can | |
630d3d5a | 1225 | write into string constants. The option @option{-traditional} also has |
74291a4b MM |
1226 | this effect. |
1227 | ||
1228 | Writing into string constants is a very bad idea; ``constants'' should | |
1229 | be constant. | |
1230 | ||
1231 | @item -fallow-single-precision | |
cd3bb277 | 1232 | @opindex fallow-single-precision |
74291a4b | 1233 | Do not promote single precision math operations to double precision, |
630d3d5a | 1234 | even when compiling with @option{-traditional}. |
74291a4b MM |
1235 | |
1236 | Traditional K&R C promotes all floating point operations to double | |
1237 | precision, regardless of the sizes of the operands. On the | |
1238 | architecture for which you are compiling, single precision may be faster | |
630d3d5a | 1239 | than double precision. If you must use @option{-traditional}, but want |
74291a4b MM |
1240 | to use single precision operations when the operands are single |
1241 | precision, use this option. This option has no effect when compiling | |
c1030c7c | 1242 | with ISO or GNU C conventions (the default). |
74291a4b | 1243 | |
3e37bef5 | 1244 | @item -fshort-wchar |
cd3bb277 | 1245 | @opindex fshort-wchar |
3e37bef5 JM |
1246 | Override the underlying type for @samp{wchar_t} to be @samp{short |
1247 | unsigned int} instead of the default for the target. This option is | |
161d7b59 | 1248 | useful for building programs to run under WINE@. |
74291a4b MM |
1249 | @end table |
1250 | ||
1251 | @node C++ Dialect Options | |
1252 | @section Options Controlling C++ Dialect | |
1253 | ||
1254 | @cindex compiler options, C++ | |
1255 | @cindex C++ options, command line | |
1256 | @cindex options, C++ | |
1257 | This section describes the command-line options that are only meaningful | |
1258 | for C++ programs; but you can also use most of the GNU compiler options | |
1259 | regardless of what language your program is in. For example, you | |
1260 | might compile a file @code{firstClass.C} like this: | |
1261 | ||
1262 | @example | |
1dc5fc4b | 1263 | g++ -g -frepo -O -c firstClass.C |
74291a4b MM |
1264 | @end example |
1265 | ||
1266 | @noindent | |
630d3d5a | 1267 | In this example, only @option{-frepo} is an option meant |
74291a4b | 1268 | only for C++ programs; you can use the other options with any |
161d7b59 | 1269 | language supported by GCC@. |
74291a4b MM |
1270 | |
1271 | Here is a list of options that are @emph{only} for compiling C++ programs: | |
1272 | ||
2642624b | 1273 | @table @gcctabopt |
74291a4b | 1274 | @item -fno-access-control |
cd3bb277 | 1275 | @opindex fno-access-control |
74291a4b MM |
1276 | Turn off all access checking. This switch is mainly useful for working |
1277 | around bugs in the access control code. | |
1278 | ||
74291a4b | 1279 | @item -fcheck-new |
cd3bb277 | 1280 | @opindex fcheck-new |
74291a4b MM |
1281 | Check that the pointer returned by @code{operator new} is non-null |
1282 | before attempting to modify the storage allocated. The current Working | |
1283 | Paper requires that @code{operator new} never return a null pointer, so | |
1284 | this check is normally unnecessary. | |
1285 | ||
1dc5fc4b JM |
1286 | An alternative to using this option is to specify that your |
1287 | @code{operator new} does not throw any exceptions; if you declare it | |
aee96fe9 | 1288 | @samp{throw()}, G++ will check the return value. See also @samp{new |
1dc5fc4b JM |
1289 | (nothrow)}. |
1290 | ||
74291a4b | 1291 | @item -fconserve-space |
cd3bb277 | 1292 | @opindex fconserve-space |
74291a4b MM |
1293 | Put uninitialized or runtime-initialized global variables into the |
1294 | common segment, as C does. This saves space in the executable at the | |
1295 | cost of not diagnosing duplicate definitions. If you compile with this | |
1296 | flag and your program mysteriously crashes after @code{main()} has | |
1297 | completed, you may have an object that is being destroyed twice because | |
1298 | two definitions were merged. | |
1299 | ||
1dc5fc4b JM |
1300 | This option is no longer useful on most targets, now that support has |
1301 | been added for putting variables into BSS without making them common. | |
1302 | ||
02f52e19 | 1303 | @item -fno-const-strings |
cd3bb277 | 1304 | @opindex fno-const-strings |
fcca588c MM |
1305 | Give string constants type @code{char *} instead of type @code{const |
1306 | char *}. By default, G++ uses type @code{const char *} as required by | |
630d3d5a | 1307 | the standard. Even if you use @option{-fno-const-strings}, you cannot |
fcca588c | 1308 | actually modify the value of a string constant, unless you also use |
630d3d5a | 1309 | @option{-fwritable-strings}. |
fcca588c MM |
1310 | |
1311 | This option might be removed in a future release of G++. For maximum | |
1312 | portability, you should structure your code so that it works with | |
1313 | string constants that have type @code{const char *}. | |
1314 | ||
74291a4b | 1315 | @item -fdollars-in-identifiers |
cd3bb277 | 1316 | @opindex fdollars-in-identifiers |
74291a4b | 1317 | Accept @samp{$} in identifiers. You can also explicitly prohibit use of |
630d3d5a | 1318 | @samp{$} with the option @option{-fno-dollars-in-identifiers}. (GNU C allows |
eb795509 | 1319 | @samp{$} by default on most target systems, but there are a few exceptions.) |
74291a4b | 1320 | Traditional C allowed the character @samp{$} to form part of |
c1030c7c | 1321 | identifiers. However, ISO C and C++ forbid @samp{$} in identifiers. |
74291a4b | 1322 | |
1dc5fc4b | 1323 | @item -fno-elide-constructors |
cd3bb277 | 1324 | @opindex fno-elide-constructors |
1dc5fc4b JM |
1325 | The C++ standard allows an implementation to omit creating a temporary |
1326 | which is only used to initialize another object of the same type. | |
aee96fe9 | 1327 | Specifying this option disables that optimization, and forces G++ to |
1dc5fc4b | 1328 | call the copy constructor in all cases. |
74291a4b | 1329 | |
dd1ba632 | 1330 | @item -fno-enforce-eh-specs |
cd3bb277 | 1331 | @opindex fno-enforce-eh-specs |
dd1ba632 JM |
1332 | Don't check for violation of exception specifications at runtime. This |
1333 | option violates the C++ standard, but may be useful for reducing code | |
1334 | size in production builds, much like defining @samp{NDEBUG}. The compiler | |
1335 | will still optimize based on the exception specifications. | |
1336 | ||
74291a4b | 1337 | @item -fexternal-templates |
cd3bb277 | 1338 | @opindex fexternal-templates |
9c34dbbf ZW |
1339 | |
1340 | Cause @samp{#pragma interface} and @samp{implementation} to apply to | |
1341 | template instantiation; template instances are emitted or not according | |
74291a4b MM |
1342 | to the location of the template definition. @xref{Template |
1343 | Instantiation}, for more information. | |
1344 | ||
37f6b6bf MM |
1345 | This option is deprecated. |
1346 | ||
74291a4b | 1347 | @item -falt-external-templates |
cd3bb277 | 1348 | @opindex falt-external-templates |
9c34dbbf ZW |
1349 | Similar to @option{-fexternal-templates}, but template instances are |
1350 | emitted or not according to the place where they are first instantiated. | |
74291a4b MM |
1351 | @xref{Template Instantiation}, for more information. |
1352 | ||
37f6b6bf MM |
1353 | This option is deprecated. |
1354 | ||
74291a4b | 1355 | @item -ffor-scope |
8c81598d | 1356 | @itemx -fno-for-scope |
cd3bb277 JM |
1357 | @opindex ffor-scope |
1358 | @opindex fno-for-scope | |
695ac33f | 1359 | If @option{-ffor-scope} is specified, the scope of variables declared in |
74291a4b | 1360 | a @i{for-init-statement} is limited to the @samp{for} loop itself, |
34527c47 | 1361 | as specified by the C++ standard. |
695ac33f | 1362 | If @option{-fno-for-scope} is specified, the scope of variables declared in |
74291a4b | 1363 | a @i{for-init-statement} extends to the end of the enclosing scope, |
aee96fe9 | 1364 | as was the case in old versions of G++, and other (traditional) |
74291a4b MM |
1365 | implementations of C++. |
1366 | ||
1367 | The default if neither flag is given to follow the standard, | |
1368 | but to allow and give a warning for old-style code that would | |
1369 | otherwise be invalid, or have different behavior. | |
1370 | ||
1371 | @item -fno-gnu-keywords | |
cd3bb277 | 1372 | @opindex fno-gnu-keywords |
9762e8a4 | 1373 | Do not recognize @code{typeof} as a keyword, so that code can use this |
767094dd | 1374 | word as an identifier. You can use the keyword @code{__typeof__} instead. |
630d3d5a | 1375 | @option{-ansi} implies @option{-fno-gnu-keywords}. |
74291a4b | 1376 | |
1dc5fc4b | 1377 | @item -fno-implicit-templates |
cd3bb277 | 1378 | @opindex fno-implicit-templates |
bba975d4 | 1379 | Never emit code for non-inline templates which are instantiated |
e979f9e8 | 1380 | implicitly (i.e.@: by use); only emit code for explicit instantiations. |
bba975d4 JM |
1381 | @xref{Template Instantiation}, for more information. |
1382 | ||
1383 | @item -fno-implicit-inline-templates | |
cd3bb277 | 1384 | @opindex fno-implicit-inline-templates |
bba975d4 JM |
1385 | Don't emit code for implicit instantiations of inline templates, either. |
1386 | The default is to handle inlines differently so that compiles with and | |
1387 | without optimization will need the same set of explicit instantiations. | |
1dc5fc4b | 1388 | |
74291a4b | 1389 | @item -fno-implement-inlines |
cd3bb277 | 1390 | @opindex fno-implement-inlines |
74291a4b MM |
1391 | To save space, do not emit out-of-line copies of inline functions |
1392 | controlled by @samp{#pragma implementation}. This will cause linker | |
1393 | errors if these functions are not inlined everywhere they are called. | |
1394 | ||
631cf95d | 1395 | @item -fms-extensions |
cd3bb277 | 1396 | @opindex fms-extensions |
32fb1fb2 PE |
1397 | Disable pedantic warnings about constructs used in MFC, such as implicit |
1398 | int and getting a pointer to member function via non-standard syntax. | |
631cf95d | 1399 | |
fcca588c | 1400 | @item -fno-nonansi-builtins |
cd3bb277 | 1401 | @opindex fno-nonansi-builtins |
c771326b | 1402 | Disable built-in declarations of functions that are not mandated by |
161d7b59 | 1403 | ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, |
fcca588c MM |
1404 | @code{index}, @code{bzero}, @code{conjf}, and other related functions. |
1405 | ||
775afb25 | 1406 | @item -fno-operator-names |
cd3bb277 | 1407 | @opindex fno-operator-names |
775afb25 | 1408 | Do not treat the operator name keywords @code{and}, @code{bitand}, |
74291a4b | 1409 | @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as |
775afb25 | 1410 | synonyms as keywords. |
74291a4b | 1411 | |
4f8b4fd9 | 1412 | @item -fno-optional-diags |
cd3bb277 | 1413 | @opindex fno-optional-diags |
4f8b4fd9 | 1414 | Disable diagnostics that the standard says a compiler does not need to |
aee96fe9 | 1415 | issue. Currently, the only such diagnostic issued by G++ is the one for |
bba975d4 | 1416 | a name having multiple meanings within a class. |
4f8b4fd9 | 1417 | |
8c7707b0 | 1418 | @item -fpermissive |
cd3bb277 | 1419 | @opindex fpermissive |
8c7707b0 | 1420 | Downgrade messages about nonconformant code from errors to warnings. By |
aee96fe9 | 1421 | default, G++ effectively sets @option{-pedantic-errors} without |
630d3d5a | 1422 | @option{-pedantic}; this option reverses that. This behavior and this |
161d7b59 | 1423 | option are superseded by @option{-pedantic}, which works as it does for GNU C@. |
8c7707b0 | 1424 | |
8c81598d | 1425 | @item -frepo |
cd3bb277 | 1426 | @opindex frepo |
9c34dbbf ZW |
1427 | Enable automatic template instantiation at link time. This option also |
1428 | implies @option{-fno-implicit-templates}. @xref{Template | |
1429 | Instantiation}, for more information. | |
8c81598d | 1430 | |
8c7707b0 | 1431 | @item -fno-rtti |
cd3bb277 | 1432 | @opindex fno-rtti |
a7fbfcf9 JM |
1433 | Disable generation of information about every class with virtual |
1434 | functions for use by the C++ runtime type identification features | |
1435 | (@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts | |
1436 | of the language, you can save some space by using this flag. Note that | |
1437 | exception handling uses the same information, but it will generate it as | |
1438 | needed. | |
8c7707b0 | 1439 | |
fcca588c | 1440 | @item -fstats |
cd3bb277 | 1441 | @opindex fstats |
fcca588c MM |
1442 | Emit statistics about front-end processing at the end of the compilation. |
1443 | This information is generally only useful to the G++ development team. | |
1444 | ||
1dc5fc4b | 1445 | @item -ftemplate-depth-@var{n} |
cd3bb277 | 1446 | @opindex ftemplate-depth |
1dc5fc4b JM |
1447 | Set the maximum instantiation depth for template classes to @var{n}. |
1448 | A limit on the template instantiation depth is needed to detect | |
767094dd | 1449 | endless recursions during template class instantiation. ANSI/ISO C++ |
1dc5fc4b JM |
1450 | conforming programs must not rely on a maximum depth greater than 17. |
1451 | ||
fc693822 | 1452 | @item -fuse-cxa-atexit |
cd3bb277 | 1453 | @opindex fuse-cxa-atexit |
fc693822 MM |
1454 | Register destructors for objects with static storage duration with the |
1455 | @code{__cxa_atexit} function rather than the @code{atexit} function. | |
1456 | This option is required for fully standards-compliant handling of static | |
1457 | destructors, but will only work if your C library supports | |
1458 | @code{__cxa_atexit}. | |
1459 | ||
90ecce3e | 1460 | @item -fvtable-gc |
cd3bb277 | 1461 | @opindex fvtable-gc |
90ecce3e JM |
1462 | Emit special relocations for vtables and virtual function references |
1463 | so that the linker can identify unused virtual functions and zero out | |
1464 | vtable slots that refer to them. This is most useful with | |
630d3d5a | 1465 | @option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to |
90ecce3e | 1466 | also discard the functions themselves. |
f5a1b0d2 | 1467 | |
90ecce3e | 1468 | This optimization requires GNU as and GNU ld. Not all systems support |
630d3d5a | 1469 | this option. @option{-Wl,--gc-sections} is ignored without @option{-static}. |
861bb6c1 | 1470 | |
02f52e19 | 1471 | @item -fno-weak |
cd3bb277 | 1472 | @opindex fno-weak |
90ecce3e | 1473 | Do not use weak symbol support, even if it is provided by the linker. |
fcca588c MM |
1474 | By default, G++ will use weak symbols if they are available. This |
1475 | option exists only for testing, and should not be used by end-users; | |
1476 | it will result in inferior code and has no benefits. This option may | |
1477 | be removed in a future release of G++. | |
1478 | ||
74291a4b | 1479 | @item -nostdinc++ |
cd3bb277 | 1480 | @opindex nostdinc++ |
74291a4b MM |
1481 | Do not search for header files in the standard directories specific to |
1482 | C++, but do still search the other standard directories. (This option | |
e5e809f4 | 1483 | is used when building the C++ library.) |
74291a4b MM |
1484 | @end table |
1485 | ||
1486 | In addition, these optimization, warning, and code generation options | |
1487 | have meanings only for C++ programs: | |
1488 | ||
2642624b | 1489 | @table @gcctabopt |
74291a4b | 1490 | @item -fno-default-inline |
cd3bb277 | 1491 | @opindex fno-default-inline |
74291a4b | 1492 | Do not assume @samp{inline} for functions defined inside a class scope. |
1dc5fc4b JM |
1493 | @xref{Optimize Options,,Options That Control Optimization}. Note that these |
1494 | functions will have linkage like inline functions; they just won't be | |
1495 | inlined by default. | |
74291a4b | 1496 | |
aee96fe9 | 1497 | @item -Wctor-dtor-privacy @r{(C++ only)} |
cd3bb277 | 1498 | @opindex Wctor-dtor-privacy |
bba975d4 JM |
1499 | Warn when a class seems unusable, because all the constructors or |
1500 | destructors in a class are private and the class has no friends or | |
1501 | public static member functions. | |
1502 | ||
aee96fe9 | 1503 | @item -Wnon-virtual-dtor @r{(C++ only)} |
cd3bb277 | 1504 | @opindex Wnon-virtual-dtor |
bba975d4 JM |
1505 | Warn when a class declares a non-virtual destructor that should probably |
1506 | be virtual, because it looks like the class will be used polymorphically. | |
1507 | ||
aee96fe9 | 1508 | @item -Wreorder @r{(C++ only)} |
cd3bb277 | 1509 | @opindex Wreorder |
bba975d4 JM |
1510 | @cindex reordering, warning |
1511 | @cindex warning for reordering of member initializers | |
1512 | Warn when the order of member initializers given in the code does not | |
1513 | match the order in which they must be executed. For instance: | |
1514 | ||
1515 | @smallexample | |
1516 | struct A @{ | |
1517 | int i; | |
1518 | int j; | |
1519 | A(): j (0), i (1) @{ @} | |
1520 | @}; | |
1521 | @end smallexample | |
1522 | ||
1523 | Here the compiler will warn that the member initializers for @samp{i} | |
1524 | and @samp{j} will be rearranged to match the declaration order of the | |
1525 | members. | |
1526 | @end table | |
1527 | ||
630d3d5a | 1528 | The following @option{-W@dots{}} options are not affected by @option{-Wall}. |
bba975d4 | 1529 | |
2642624b | 1530 | @table @gcctabopt |
aee96fe9 | 1531 | @item -Weffc++ @r{(C++ only)} |
cd3bb277 | 1532 | @opindex Weffc++ |
bba975d4 JM |
1533 | Warn about violations of various style guidelines from Scott Meyers' |
1534 | @cite{Effective C++} books. If you use this option, you should be aware | |
1535 | that the standard library headers do not obey all of these guidelines; | |
1536 | you can use @samp{grep -v} to filter out those warnings. | |
1537 | ||
aee96fe9 | 1538 | @item -Wno-deprecated @r{(C++ only)} |
cd3bb277 | 1539 | @opindex Wno-deprecated |
767094dd | 1540 | Do not warn about usage of deprecated features. @xref{Deprecated Features}. |
2de45c06 | 1541 | |
aee96fe9 | 1542 | @item -Wno-non-template-friend @r{(C++ only)} |
cd3bb277 | 1543 | @opindex Wno-non-template-friend |
bba975d4 | 1544 | Disable warnings when non-templatized friend functions are declared |
767094dd | 1545 | within a template. With the advent of explicit template specification |
aee96fe9 | 1546 | support in G++, if the name of the friend is an unqualified-id (i.e., |
bba975d4 | 1547 | @samp{friend foo(int)}), the C++ language specification demands that the |
767094dd | 1548 | friend declare or define an ordinary, nontemplate function. (Section |
aee96fe9 | 1549 | 14.5.3). Before G++ implemented explicit specification, unqualified-ids |
bba975d4 | 1550 | could be interpreted as a particular specialization of a templatized |
767094dd | 1551 | function. Because this non-conforming behavior is no longer the default |
aee96fe9 | 1552 | behavior for G++, @option{-Wnon-template-friend} allows the compiler to |
bba975d4 | 1553 | check existing code for potential trouble spots, and is on by default. |
2228d450 | 1554 | This new compiler behavior can be turned off with |
630d3d5a | 1555 | @option{-Wno-non-template-friend} which keeps the conformant compiler code |
2228d450 | 1556 | but disables the helpful warning. |
bba975d4 | 1557 | |
aee96fe9 | 1558 | @item -Wold-style-cast @r{(C++ only)} |
cd3bb277 | 1559 | @opindex Wold-style-cast |
323728aa NS |
1560 | Warn if an old-style (C-style) cast to a non-void type is used within |
1561 | a C++ program. The new-style casts (@samp{static_cast}, | |
1562 | @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to | |
1563 | unintended effects, and much easier to grep for. | |
bba975d4 | 1564 | |
aee96fe9 | 1565 | @item -Woverloaded-virtual @r{(C++ only)} |
cd3bb277 | 1566 | @opindex Woverloaded-virtual |
bba975d4 JM |
1567 | @cindex overloaded virtual fn, warning |
1568 | @cindex warning for overloaded virtual fn | |
3747f3dc MM |
1569 | Warn when a function declaration hides virtual functions from a |
1570 | base class. For example, in: | |
1571 | ||
1572 | @smallexample | |
1573 | struct A @{ | |
1574 | virtual void f(); | |
1575 | @}; | |
1576 | ||
1577 | struct B: public A @{ | |
1578 | void f(int); | |
1579 | @}; | |
1580 | @end smallexample | |
1581 | ||
1582 | the @code{A} class version of @code{f} is hidden in @code{B}, and code | |
1583 | like this: | |
1584 | ||
1585 | @smallexample | |
1586 | B* b; | |
1587 | b->f(); | |
1588 | @end smallexample | |
1589 | ||
1590 | will fail to compile. | |
bba975d4 | 1591 | |
aee96fe9 | 1592 | @item -Wno-pmf-conversions @r{(C++ only)} |
cd3bb277 | 1593 | @opindex Wno-pmf-conversions |
bba975d4 JM |
1594 | Disable the diagnostic for converting a bound pointer to member function |
1595 | to a plain pointer. | |
1596 | ||
aee96fe9 | 1597 | @item -Wsign-promo @r{(C++ only)} |
cd3bb277 | 1598 | @opindex Wsign-promo |
bba975d4 JM |
1599 | Warn when overload resolution chooses a promotion from unsigned or |
1600 | enumeral type to a signed type over a conversion to an unsigned type of | |
aee96fe9 | 1601 | the same size. Previous versions of G++ would try to preserve |
bba975d4 JM |
1602 | unsignedness, but the standard mandates the current behavior. |
1603 | ||
aee96fe9 | 1604 | @item -Wsynth @r{(C++ only)} |
cd3bb277 | 1605 | @opindex Wsynth |
bba975d4 JM |
1606 | @cindex warning for synthesized methods |
1607 | @cindex synthesized methods, warning | |
aee96fe9 | 1608 | Warn when G++'s synthesis behavior does not match that of cfront. For |
bba975d4 JM |
1609 | instance: |
1610 | ||
1611 | @smallexample | |
1612 | struct A @{ | |
1613 | operator int (); | |
1614 | A& operator = (int); | |
1615 | @}; | |
1616 | ||
1617 | main () | |
1618 | @{ | |
1619 | A a,b; | |
1620 | a = b; | |
1621 | @} | |
1622 | @end smallexample | |
74291a4b | 1623 | |
aee96fe9 | 1624 | In this example, G++ will synthesize a default @samp{A& operator = |
bba975d4 | 1625 | (const A&);}, while cfront will use the user-defined @samp{operator =}. |
74291a4b MM |
1626 | @end table |
1627 | ||
60de6385 SS |
1628 | @node Objective-C Dialect Options |
1629 | @section Options Controlling Objective-C Dialect | |
1630 | ||
1631 | @cindex compiler options, Objective-C | |
1632 | @cindex Objective-C options, command line | |
1633 | @cindex options, Objective-C | |
1634 | This section describes the command-line options that are only meaningful | |
1635 | for Objective-C programs; but you can also use most of the GNU compiler | |
1636 | options regardless of what language your program is in. For example, | |
1637 | you might compile a file @code{some_class.m} like this: | |
1638 | ||
1639 | @example | |
1640 | gcc -g -fgnu-runtime -O -c some_class.m | |
1641 | @end example | |
1642 | ||
1643 | @noindent | |
630d3d5a | 1644 | In this example, only @option{-fgnu-runtime} is an option meant only for |
60de6385 | 1645 | Objective-C programs; you can use the other options with any language |
161d7b59 | 1646 | supported by GCC@. |
60de6385 SS |
1647 | |
1648 | Here is a list of options that are @emph{only} for compiling Objective-C | |
1649 | programs: | |
1650 | ||
1651 | @table @gcctabopt | |
630d3d5a | 1652 | @item -fconstant-string-class=@var{class-name} |
cd3bb277 | 1653 | @opindex fconstant-string-class |
630d3d5a | 1654 | Use @var{class-name} as the name of the class to instantiate for each |
695ac33f | 1655 | literal string specified with the syntax @code{@@"@dots{}"}. The default |
60de6385 SS |
1656 | class name is @code{NXConstantString}. |
1657 | ||
1658 | @item -fgnu-runtime | |
cd3bb277 | 1659 | @opindex fgnu-runtime |
60de6385 SS |
1660 | Generate object code compatible with the standard GNU Objective-C |
1661 | runtime. This is the default for most types of systems. | |
1662 | ||
1663 | @item -fnext-runtime | |
cd3bb277 | 1664 | @opindex fnext-runtime |
60de6385 | 1665 | Generate output compatible with the NeXT runtime. This is the default |
161d7b59 | 1666 | for NeXT-based systems, including Darwin and Mac OS X@. |
60de6385 SS |
1667 | |
1668 | @item -gen-decls | |
cd3bb277 | 1669 | @opindex gen-decls |
60de6385 SS |
1670 | Dump interface declarations for all classes seen in the source file to a |
1671 | file named @file{@var{sourcename}.decl}. | |
1672 | ||
1673 | @item -Wno-protocol | |
cd3bb277 | 1674 | @opindex Wno-protocol |
60de6385 SS |
1675 | Do not warn if methods required by a protocol are not implemented |
1676 | in the class adopting it. | |
1677 | ||
1678 | @item -Wselector | |
cd3bb277 | 1679 | @opindex Wselector |
60de6385 SS |
1680 | Warn if a selector has multiple methods of different types defined. |
1681 | ||
1682 | @c not documented because only avail via -Wp | |
1683 | @c @item -print-objc-runtime-info | |
1684 | ||
1685 | @end table | |
1686 | ||
764dbbf2 GDR |
1687 | @node Language Independent Options |
1688 | @section Options to Control Diagnostic Messages Formatting | |
1689 | @cindex options to control diagnostics formatting | |
1690 | @cindex diagnostic messages | |
1691 | @cindex message formatting | |
1692 | ||
b192711e | 1693 | Traditionally, diagnostic messages have been formatted irrespective of |
e979f9e8 | 1694 | the output device's aspect (e.g.@: its width, @dots{}). The options described |
764dbbf2 | 1695 | below can be used to control the diagnostic messages formatting |
e979f9e8 | 1696 | algorithm, e.g.@: how many characters per line, how often source location |
6c0a4eab | 1697 | information should be reported. Right now, only the C++ front end can |
764dbbf2 | 1698 | honor these options. However it is expected, in the near future, that |
6c0a4eab | 1699 | the remaining front ends would be able to digest them correctly. |
764dbbf2 | 1700 | |
2642624b | 1701 | @table @gcctabopt |
764dbbf2 | 1702 | @item -fmessage-length=@var{n} |
cd3bb277 | 1703 | @opindex fmessage-length |
764dbbf2 | 1704 | Try to format error messages so that they fit on lines of about @var{n} |
aee96fe9 | 1705 | characters. The default is 72 characters for @command{g++} and 0 for the rest of |
161d7b59 | 1706 | the front ends supported by GCC@. If @var{n} is zero, then no |
02f52e19 | 1707 | line-wrapping will be done; each error message will appear on a single |
764dbbf2 GDR |
1708 | line. |
1709 | ||
cd3bb277 | 1710 | @opindex fdiagnostics-show-location |
764dbbf2 | 1711 | @item -fdiagnostics-show-location=once |
b192711e | 1712 | Only meaningful in line-wrapping mode. Instructs the diagnostic messages |
764dbbf2 GDR |
1713 | reporter to emit @emph{once} source location information; that is, in |
1714 | case the message is too long to fit on a single physical line and has to | |
1715 | be wrapped, the source location won't be emitted (as prefix) again, | |
1716 | over and over, in subsequent continuation lines. This is the default | |
c21cd8b1 | 1717 | behavior. |
764dbbf2 GDR |
1718 | |
1719 | @item -fdiagnostics-show-location=every-line | |
1720 | Only meaningful in line-wrapping mode. Instructs the diagnostic | |
1721 | messages reporter to emit the same source location information (as | |
4fe9b91c | 1722 | prefix) for physical lines that result from the process of breaking |
b192711e | 1723 | a message which is too long to fit on a single line. |
764dbbf2 GDR |
1724 | |
1725 | @end table | |
1726 | ||
74291a4b MM |
1727 | @node Warning Options |
1728 | @section Options to Request or Suppress Warnings | |
1729 | @cindex options to control warnings | |
1730 | @cindex warning messages | |
1731 | @cindex messages, warning | |
1732 | @cindex suppressing warnings | |
1733 | ||
1734 | Warnings are diagnostic messages that report constructions which | |
1735 | are not inherently erroneous but which are risky or suggest there | |
1736 | may have been an error. | |
1737 | ||
1738 | You can request many specific warnings with options beginning @samp{-W}, | |
630d3d5a | 1739 | for example @option{-Wimplicit} to request warnings on implicit |
74291a4b MM |
1740 | declarations. Each of these specific warning options also has a |
1741 | negative form beginning @samp{-Wno-} to turn off warnings; | |
630d3d5a | 1742 | for example, @option{-Wno-implicit}. This manual lists only one of the |
74291a4b MM |
1743 | two forms, whichever is not the default. |
1744 | ||
0c2d1a2a | 1745 | These options control the amount and kinds of warnings produced by GCC: |
74291a4b | 1746 | |
2642624b | 1747 | @table @gcctabopt |
74291a4b MM |
1748 | @cindex syntax checking |
1749 | @item -fsyntax-only | |
cd3bb277 | 1750 | @opindex fsyntax-only |
74291a4b MM |
1751 | Check the code for syntax errors, but don't do anything beyond that. |
1752 | ||
1753 | @item -pedantic | |
cd3bb277 | 1754 | @opindex pedantic |
074e95e3 JM |
1755 | Issue all the warnings demanded by strict ISO C and ISO C++; |
1756 | reject all programs that use forbidden extensions, and some other | |
1757 | programs that do not follow ISO C and ISO C++. For ISO C, follows the | |
630d3d5a | 1758 | version of the ISO C standard specified by any @option{-std} option used. |
74291a4b | 1759 | |
074e95e3 | 1760 | Valid ISO C and ISO C++ programs should compile properly with or without |
5490d604 | 1761 | this option (though a rare few will require @option{-ansi} or a |
161d7b59 | 1762 | @option{-std} option specifying the required version of ISO C)@. However, |
b1d16193 JL |
1763 | without this option, certain GNU extensions and traditional C and C++ |
1764 | features are supported as well. With this option, they are rejected. | |
74291a4b | 1765 | |
630d3d5a | 1766 | @option{-pedantic} does not cause warning messages for use of the |
74291a4b MM |
1767 | alternate keywords whose names begin and end with @samp{__}. Pedantic |
1768 | warnings are also disabled in the expression that follows | |
1769 | @code{__extension__}. However, only system header files should use | |
1770 | these escape routes; application programs should avoid them. | |
1771 | @xref{Alternate Keywords}. | |
1772 | ||
630d3d5a | 1773 | Some users try to use @option{-pedantic} to check programs for strict ISO |
74291a4b | 1774 | C conformance. They soon find that it does not do quite what they want: |
c1030c7c | 1775 | it finds some non-ISO practices, but not all---only those for which |
074e95e3 JM |
1776 | ISO C @emph{requires} a diagnostic, and some others for which |
1777 | diagnostics have been added. | |
74291a4b | 1778 | |
074e95e3 | 1779 | A feature to report any failure to conform to ISO C might be useful in |
74291a4b | 1780 | some instances, but would require considerable additional work and would |
630d3d5a | 1781 | be quite different from @option{-pedantic}. We don't have plans to |
892d0a6d | 1782 | support such a feature in the near future. |
74291a4b | 1783 | |
91ea548a JM |
1784 | Where the standard specified with @option{-std} represents a GNU |
1785 | extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a | |
1786 | corresponding @dfn{base standard}, the version of ISO C on which the GNU | |
1787 | extended dialect is based. Warnings from @option{-pedantic} are given | |
1788 | where they are required by the base standard. (It would not make sense | |
1789 | for such warnings to be given only for features not in the specified GNU | |
1790 | C dialect, since by definition the GNU dialects of C include all | |
1791 | features the compiler supports with the given option, and there would be | |
1792 | nothing to warn about.) | |
1793 | ||
74291a4b | 1794 | @item -pedantic-errors |
cd3bb277 | 1795 | @opindex pedantic-errors |
630d3d5a | 1796 | Like @option{-pedantic}, except that errors are produced rather than |
74291a4b MM |
1797 | warnings. |
1798 | ||
1799 | @item -w | |
cd3bb277 | 1800 | @opindex w |
74291a4b MM |
1801 | Inhibit all warning messages. |
1802 | ||
1803 | @item -Wno-import | |
cd3bb277 | 1804 | @opindex Wno-import |
74291a4b MM |
1805 | Inhibit warning messages about the use of @samp{#import}. |
1806 | ||
1807 | @item -Wchar-subscripts | |
cd3bb277 | 1808 | @opindex Wchar-subscripts |
74291a4b MM |
1809 | Warn if an array subscript has type @code{char}. This is a common cause |
1810 | of error, as programmers often forget that this type is signed on some | |
1811 | machines. | |
1812 | ||
1813 | @item -Wcomment | |
cd3bb277 | 1814 | @opindex Wcomment |
74291a4b MM |
1815 | Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} |
1816 | comment, or whenever a Backslash-Newline appears in a @samp{//} comment. | |
1817 | ||
1818 | @item -Wformat | |
cd3bb277 | 1819 | @opindex Wformat |
74291a4b MM |
1820 | Check calls to @code{printf} and @code{scanf}, etc., to make sure that |
1821 | the arguments supplied have types appropriate to the format string | |
26f6672d JM |
1822 | specified, and that the conversions specified in the format string make |
1823 | sense. This includes standard functions, and others specified by format | |
1824 | attributes (@pxref{Function Attributes}), in the @code{printf}, | |
1825 | @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, | |
1826 | not in the C standard) families. | |
74291a4b | 1827 | |
8308e0b7 JM |
1828 | The formats are checked against the format features supported by GNU |
1829 | libc version 2.2. These include all ISO C89 and C99 features, as well | |
1830 | as features from the Single Unix Specification and some BSD and GNU | |
1831 | extensions. Other library implementations may not support all these | |
1832 | features; GCC does not support warning about features that go beyond a | |
630d3d5a JM |
1833 | particular library's limitations. However, if @option{-pedantic} is used |
1834 | with @option{-Wformat}, warnings will be given about format features not | |
26f6672d JM |
1835 | in the selected standard version (but not for @code{strfmon} formats, |
1836 | since those are not in any version of the C standard). @xref{C Dialect | |
1837 | Options,,Options Controlling C Dialect}. | |
8308e0b7 | 1838 | |
630d3d5a JM |
1839 | @option{-Wformat} is included in @option{-Wall}. For more control over some |
1840 | aspects of format checking, the options @option{-Wno-format-y2k}, | |
1841 | @option{-Wno-format-extra-args}, @option{-Wformat-nonliteral}, | |
1842 | @option{-Wformat-security} and @option{-Wformat=2} are available, but are | |
1843 | not included in @option{-Wall}. | |
4d808927 JM |
1844 | |
1845 | @item -Wno-format-y2k | |
cd3bb277 | 1846 | @opindex Wno-format-y2k |
630d3d5a | 1847 | If @option{-Wformat} is specified, do not warn about @code{strftime} |
4d808927 JM |
1848 | formats which may yield only a two-digit year. |
1849 | ||
1850 | @item -Wno-format-extra-args | |
cd3bb277 | 1851 | @opindex Wno-format-extra-args |
630d3d5a | 1852 | If @option{-Wformat} is specified, do not warn about excess arguments to a |
4d808927 JM |
1853 | @code{printf} or @code{scanf} format function. The C standard specifies |
1854 | that such arguments are ignored. | |
1855 | ||
7e5fb12f JM |
1856 | Where the unused arguments lie between used arguments that are |
1857 | specified with @samp{$} operand number specifications, normally | |
1858 | warnings are still given, since the implementation could not know what | |
1859 | type to pass to @code{va_arg} to skip the unused arguments. However, | |
1860 | in the case of @code{scanf} formats, this option will suppress the | |
1861 | warning if the unused arguments are all pointers, since the Single | |
1862 | Unix Specification says that such unused arguments are allowed. | |
1863 | ||
4d808927 | 1864 | @item -Wformat-nonliteral |
cd3bb277 | 1865 | @opindex Wformat-nonliteral |
630d3d5a | 1866 | If @option{-Wformat} is specified, also warn if the format string is not a |
4d808927 JM |
1867 | string literal and so cannot be checked, unless the format function |
1868 | takes its format arguments as a @code{va_list}. | |
1869 | ||
c907e684 | 1870 | @item -Wformat-security |
cd3bb277 | 1871 | @opindex Wformat-security |
630d3d5a | 1872 | If @option{-Wformat} is specified, also warn about uses of format |
c907e684 JM |
1873 | functions that represent possible security problems. At present, this |
1874 | warns about calls to @code{printf} and @code{scanf} functions where the | |
1875 | format string is not a string literal and there are no format arguments, | |
1876 | as in @code{printf (foo);}. This may be a security hole if the format | |
1877 | string came from untrusted input and contains @samp{%n}. (This is | |
630d3d5a JM |
1878 | currently a subset of what @option{-Wformat-nonliteral} warns about, but |
1879 | in future warnings may be added to @option{-Wformat-security} that are not | |
1880 | included in @option{-Wformat-nonliteral}.) | |
c907e684 | 1881 | |
4d808927 | 1882 | @item -Wformat=2 |
cd3bb277 | 1883 | @opindex Wformat=2 |
630d3d5a JM |
1884 | Enable @option{-Wformat} plus format checks not included in |
1885 | @option{-Wformat}. Currently equivalent to @samp{-Wformat | |
c907e684 | 1886 | -Wformat-nonliteral -Wformat-security}. |
4d808927 | 1887 | |
e9a25f70 | 1888 | @item -Wimplicit-int |
cd3bb277 | 1889 | @opindex Wimplicit-int |
e9a25f70 JL |
1890 | Warn when a declaration does not specify a type. |
1891 | ||
f5963e61 JL |
1892 | @item -Wimplicit-function-declaration |
1893 | @itemx -Werror-implicit-function-declaration | |
cd3bb277 JM |
1894 | @opindex Wimplicit-function-declaration |
1895 | @opindex Werror-implicit-function-declaration | |
f5963e61 JL |
1896 | Give a warning (or error) whenever a function is used before being |
1897 | declared. | |
e9a25f70 | 1898 | |
74291a4b | 1899 | @item -Wimplicit |
cd3bb277 | 1900 | @opindex Wimplicit |
630d3d5a | 1901 | Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. |
861bb6c1 JL |
1902 | |
1903 | @item -Wmain | |
cd3bb277 | 1904 | @opindex Wmain |
861bb6c1 JL |
1905 | Warn if the type of @samp{main} is suspicious. @samp{main} should be a |
1906 | function with external linkage, returning int, taking either zero | |
1907 | arguments, two, or three arguments of appropriate types. | |
4a870dba | 1908 | |
1f0c3120 | 1909 | @item -Wmissing-braces |
cd3bb277 | 1910 | @opindex Wmissing-braces |
1f0c3120 JM |
1911 | Warn if an aggregate or union initializer is not fully bracketed. In |
1912 | the following example, the initializer for @samp{a} is not fully | |
1913 | bracketed, but that for @samp{b} is fully bracketed. | |
1914 | ||
1915 | @smallexample | |
1916 | int a[2][2] = @{ 0, 1, 2, 3 @}; | |
1917 | int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; | |
1918 | @end smallexample | |
1919 | ||
74291a4b | 1920 | @item -Wparentheses |
cd3bb277 | 1921 | @opindex Wparentheses |
74291a4b MM |
1922 | Warn if parentheses are omitted in certain contexts, such |
1923 | as when there is an assignment in a context where a truth value | |
1924 | is expected, or when operators are nested whose precedence people | |
1925 | often get confused about. | |
1926 | ||
e9a25f70 JL |
1927 | Also warn about constructions where there may be confusion to which |
1928 | @code{if} statement an @code{else} branch belongs. Here is an example of | |
1929 | such a case: | |
1930 | ||
1931 | @smallexample | |
aee96fe9 | 1932 | @group |
e9a25f70 JL |
1933 | @{ |
1934 | if (a) | |
1935 | if (b) | |
1936 | foo (); | |
1937 | else | |
1938 | bar (); | |
1939 | @} | |
aee96fe9 | 1940 | @end group |
e9a25f70 JL |
1941 | @end smallexample |
1942 | ||
1943 | In C, every @code{else} branch belongs to the innermost possible @code{if} | |
1944 | statement, which in this example is @code{if (b)}. This is often not | |
1945 | what the programmer expected, as illustrated in the above example by | |
1946 | indentation the programmer chose. When there is the potential for this | |
f0523f02 | 1947 | confusion, GCC will issue a warning when this flag is specified. |
e9a25f70 JL |
1948 | To eliminate the warning, add explicit braces around the innermost |
1949 | @code{if} statement so there is no way the @code{else} could belong to | |
1950 | the enclosing @code{if}. The resulting code would look like this: | |
1951 | ||
1952 | @smallexample | |
aee96fe9 | 1953 | @group |
e9a25f70 JL |
1954 | @{ |
1955 | if (a) | |
1956 | @{ | |
1957 | if (b) | |
1958 | foo (); | |
1959 | else | |
1960 | bar (); | |
1961 | @} | |
1962 | @} | |
aee96fe9 | 1963 | @end group |
e9a25f70 JL |
1964 | @end smallexample |
1965 | ||
bb58bec5 | 1966 | @item -Wsequence-point |
cd3bb277 | 1967 | @opindex Wsequence-point |
bb58bec5 JM |
1968 | Warn about code that may have undefined semantics because of violations |
1969 | of sequence point rules in the C standard. | |
1970 | ||
1971 | The C standard defines the order in which expressions in a C program are | |
1972 | evaluated in terms of @dfn{sequence points}, which represent a partial | |
1973 | ordering between the execution of parts of the program: those executed | |
1974 | before the sequence point, and those executed after it. These occur | |
1975 | after the evaluation of a full expression (one which is not part of a | |
1976 | larger expression), after the evaluation of the first operand of a | |
1977 | @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a | |
1978 | function is called (but after the evaluation of its arguments and the | |
1979 | expression denoting the called function), and in certain other places. | |
1980 | Other than as expressed by the sequence point rules, the order of | |
1981 | evaluation of subexpressions of an expression is not specified. All | |
1982 | these rules describe only a partial order rather than a total order, | |
1983 | since, for example, if two functions are called within one expression | |
1984 | with no sequence point between them, the order in which the functions | |
1985 | are called is not specified. However, the standards committee have | |
1986 | ruled that function calls do not overlap. | |
1987 | ||
1988 | It is not specified when between sequence points modifications to the | |
1989 | values of objects take effect. Programs whose behavior depends on this | |
1990 | have undefined behavior; the C standard specifies that ``Between the | |
1991 | previous and next sequence point an object shall have its stored value | |
1992 | modified at most once by the evaluation of an expression. Furthermore, | |
1993 | the prior value shall be read only to determine the value to be | |
1994 | stored.''. If a program breaks these rules, the results on any | |
1995 | particular implementation are entirely unpredictable. | |
1996 | ||
1997 | Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] | |
1998 | = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not | |
1999 | diagnosed by this option, and it may give an occasional false positive | |
2000 | result, but in general it has been found fairly effective at detecting | |
2001 | this sort of problem in programs. | |
2002 | ||
2003 | The present implementation of this option only works for C programs. A | |
2004 | future implementation may also work for C++ programs. | |
2005 | ||
9c34dbbf ZW |
2006 | The C standard is worded confusingly, therefore there is some debate |
2007 | over the precise meaning of the sequence point rules in subtle cases. | |
2008 | Links to discussions of the problem, including proposed formal | |
2009 | definitions, may be found on our readings page, at | |
c5122d75 | 2010 | @w{@uref{http://gcc.gnu.org/readings.html}}. |
bb58bec5 | 2011 | |
74291a4b | 2012 | @item -Wreturn-type |
cd3bb277 | 2013 | @opindex Wreturn-type |
32c4c36c ML |
2014 | Warn whenever a function is defined with a return-type that defaults to |
2015 | @code{int}. Also warn about any @code{return} statement with no | |
02f52e19 | 2016 | return-value in a function whose return-type is not @code{void}. |
32c4c36c ML |
2017 | |
2018 | For C++, a function without return type always produces a diagnostic | |
767094dd | 2019 | message, even when @option{-Wno-return-type} is specified. The only |
32c4c36c | 2020 | exceptions are @samp{main} and functions defined in system headers. |
74291a4b MM |
2021 | |
2022 | @item -Wswitch | |
cd3bb277 | 2023 | @opindex Wswitch |
74291a4b MM |
2024 | Warn whenever a @code{switch} statement has an index of enumeral type |
2025 | and lacks a @code{case} for one or more of the named codes of that | |
2026 | enumeration. (The presence of a @code{default} label prevents this | |
2027 | warning.) @code{case} labels outside the enumeration range also | |
2028 | provoke warnings when this option is used. | |
2029 | ||
2030 | @item -Wtrigraphs | |
cd3bb277 | 2031 | @opindex Wtrigraphs |
f2ecb02d JM |
2032 | Warn if any trigraphs are encountered that might change the meaning of |
2033 | the program (trigraphs within comments are not warned about). | |
74291a4b | 2034 | |
078721e1 | 2035 | @item -Wunused-function |
cd3bb277 | 2036 | @opindex Wunused-function |
078721e1 AC |
2037 | Warn whenever a static function is declared but not defined or a |
2038 | non\-inline static function is unused. | |
74291a4b | 2039 | |
078721e1 | 2040 | @item -Wunused-label |
cd3bb277 | 2041 | @opindex Wunused-label |
078721e1 AC |
2042 | Warn whenever a label is declared but not used. |
2043 | ||
2044 | To suppress this warning use the @samp{unused} attribute | |
2045 | (@pxref{Variable Attributes}). | |
2046 | ||
2047 | @item -Wunused-parameter | |
cd3bb277 | 2048 | @opindex Wunused-parameter |
078721e1 AC |
2049 | Warn whenever a function parameter is unused aside from its declaration. |
2050 | ||
2051 | To suppress this warning use the @samp{unused} attribute | |
2052 | (@pxref{Variable Attributes}). | |
956d6950 | 2053 | |
078721e1 | 2054 | @item -Wunused-variable |
cd3bb277 | 2055 | @opindex Wunused-variable |
078721e1 AC |
2056 | Warn whenever a local variable or non-constant static variable is unused |
2057 | aside from its declaration | |
2058 | ||
2059 | To suppress this warning use the @samp{unused} attribute | |
74291a4b MM |
2060 | (@pxref{Variable Attributes}). |
2061 | ||
078721e1 | 2062 | @item -Wunused-value |
cd3bb277 | 2063 | @opindex Wunused-value |
078721e1 AC |
2064 | Warn whenever a statement computes a result that is explicitly not used. |
2065 | ||
2066 | To suppress this warning cast the expression to @samp{void}. | |
2067 | ||
2068 | @item -Wunused | |
cd3bb277 | 2069 | @opindex Wunused |
630d3d5a | 2070 | All all the above @option{-Wunused} options combined. |
078721e1 AC |
2071 | |
2072 | In order to get a warning about an unused function parameter, you must | |
b192711e | 2073 | either specify @samp{-W -Wunused} or separately specify |
630d3d5a | 2074 | @option{-Wunused-parameter}. |
078721e1 | 2075 | |
74291a4b | 2076 | @item -Wuninitialized |
cd3bb277 | 2077 | @opindex Wuninitialized |
c5c76735 JL |
2078 | Warn if an automatic variable is used without first being initialized or |
2079 | if a variable may be clobbered by a @code{setjmp} call. | |
74291a4b MM |
2080 | |
2081 | These warnings are possible only in optimizing compilation, | |
2082 | because they require data flow information that is computed only | |
630d3d5a | 2083 | when optimizing. If you don't specify @option{-O}, you simply won't |
74291a4b MM |
2084 | get these warnings. |
2085 | ||
2086 | These warnings occur only for variables that are candidates for | |
2087 | register allocation. Therefore, they do not occur for a variable that | |
2088 | is declared @code{volatile}, or whose address is taken, or whose size | |
2089 | is other than 1, 2, 4 or 8 bytes. Also, they do not occur for | |
2090 | structures, unions or arrays, even when they are in registers. | |
2091 | ||
2092 | Note that there may be no warning about a variable that is used only | |
2093 | to compute a value that itself is never used, because such | |
2094 | computations may be deleted by data flow analysis before the warnings | |
2095 | are printed. | |
2096 | ||
0c2d1a2a | 2097 | These warnings are made optional because GCC is not smart |
74291a4b MM |
2098 | enough to see all the reasons why the code might be correct |
2099 | despite appearing to have an error. Here is one example of how | |
2100 | this can happen: | |
2101 | ||
2102 | @smallexample | |
aee96fe9 | 2103 | @group |
74291a4b MM |
2104 | @{ |
2105 | int x; | |
2106 | switch (y) | |
2107 | @{ | |
2108 | case 1: x = 1; | |
2109 | break; | |
2110 | case 2: x = 4; | |
2111 | break; | |
2112 | case 3: x = 5; | |
2113 | @} | |
2114 | foo (x); | |
2115 | @} | |
aee96fe9 | 2116 | @end group |
74291a4b MM |
2117 | @end smallexample |
2118 | ||
2119 | @noindent | |
2120 | If the value of @code{y} is always 1, 2 or 3, then @code{x} is | |
0c2d1a2a | 2121 | always initialized, but GCC doesn't know this. Here is |
74291a4b MM |
2122 | another common case: |
2123 | ||
2124 | @smallexample | |
2125 | @{ | |
2126 | int save_y; | |
2127 | if (change_y) save_y = y, y = new_y; | |
2128 | @dots{} | |
2129 | if (change_y) y = save_y; | |
2130 | @} | |
2131 | @end smallexample | |
2132 | ||
2133 | @noindent | |
2134 | This has no bug because @code{save_y} is used only if it is set. | |
2135 | ||
20300b05 | 2136 | @cindex @code{longjmp} warnings |
b192711e | 2137 | This option also warns when a non-volatile automatic variable might be |
c5c76735 JL |
2138 | changed by a call to @code{longjmp}. These warnings as well are possible |
2139 | only in optimizing compilation. | |
20300b05 GK |
2140 | |
2141 | The compiler sees only the calls to @code{setjmp}. It cannot know | |
2142 | where @code{longjmp} will be called; in fact, a signal handler could | |
2143 | call it at any point in the code. As a result, you may get a warning | |
2144 | even when there is in fact no problem because @code{longjmp} cannot | |
2145 | in fact be called at the place which would cause a problem. | |
2146 | ||
74291a4b MM |
2147 | Some spurious warnings can be avoided if you declare all the functions |
2148 | you use that never return as @code{noreturn}. @xref{Function | |
2149 | Attributes}. | |
2150 | ||
aee96fe9 | 2151 | @item -Wreorder @r{(C++ only)} |
cd3bb277 | 2152 | @opindex Wreorder |
c5c76735 JL |
2153 | @cindex reordering, warning |
2154 | @cindex warning for reordering of member initializers | |
2155 | Warn when the order of member initializers given in the code does not | |
2156 | match the order in which they must be executed. For instance: | |
2157 | ||
d300e551 | 2158 | @item -Wunknown-pragmas |
cd3bb277 | 2159 | @opindex Wunknown-pragmas |
d300e551 NC |
2160 | @cindex warning for unknown pragmas |
2161 | @cindex unknown pragmas, warning | |
2162 | @cindex pragmas, warning of unknown | |
2163 | Warn when a #pragma directive is encountered which is not understood by | |
161d7b59 | 2164 | GCC@. If this command line option is used, warnings will even be issued |
d300e551 | 2165 | for unknown pragmas in system header files. This is not the case if |
630d3d5a | 2166 | the warnings were only enabled by the @option{-Wall} command line option. |
d300e551 | 2167 | |
74291a4b | 2168 | @item -Wall |
cd3bb277 | 2169 | @opindex Wall |
74291a4b MM |
2170 | All of the above @samp{-W} options combined. This enables all the |
2171 | warnings about constructions that some users consider questionable, and | |
2172 | that are easy to avoid (or modify to prevent the warning), even in | |
2173 | conjunction with macros. | |
317639a8 | 2174 | |
6c36d76b NB |
2175 | @item -Wdiv-by-zero |
2176 | @opindex Wno-div-by-zero | |
2177 | @opindex Wdiv-by-zero | |
2178 | Warn about compile-time integer division by zero. This is default. To | |
2179 | inhibit the warning messages, use @option{-Wno-div-by-zero}. Floating | |
2180 | point division by zero is not warned about, as it can be a legitimate | |
2181 | way of obtaining infinities and NaNs. | |
2182 | ||
2183 | @item -Wmultichar | |
2184 | @opindex Wno-multichar | |
2185 | @opindex Wmultichar | |
2186 | Warn if a multicharacter constant (@samp{'FOOF'}) is used. This is | |
2187 | default. To inhibit the warning messages, use @option{-Wno-multichar}. | |
2188 | Usually they indicate a typo in the user's code, as they have | |
2189 | implementation-defined values, and should not be used in portable code. | |
2190 | ||
317639a8 | 2191 | @item -Wsystem-headers |
cd3bb277 | 2192 | @opindex Wsystem-headers |
317639a8 BC |
2193 | @cindex warnings from system headers |
2194 | @cindex system headers, warnings from | |
2195 | Print warning messages for constructs found in system header files. | |
2196 | Warnings from system headers are normally suppressed, on the assumption | |
2197 | that they usually do not indicate real problems and would only make the | |
2198 | compiler output harder to read. Using this command line option tells | |
2199 | GCC to emit warnings from system headers as if they occurred in user | |
630d3d5a | 2200 | code. However, note that using @option{-Wall} in conjunction with this |
317639a8 | 2201 | option will @emph{not} warn about unknown pragmas in system |
630d3d5a | 2202 | headers---for that, @option{-Wunknown-pragmas} must also be used. |
74291a4b MM |
2203 | @end table |
2204 | ||
630d3d5a | 2205 | The following @option{-W@dots{}} options are not implied by @option{-Wall}. |
74291a4b MM |
2206 | Some of them warn about constructions that users generally do not |
2207 | consider questionable, but which occasionally you might wish to check | |
2208 | for; others warn about constructions that are necessary or hard to avoid | |
2209 | in some cases, and there is no simple way to modify the code to suppress | |
2210 | the warning. | |
2211 | ||
2642624b | 2212 | @table @gcctabopt |
74291a4b | 2213 | @item -W |
cd3bb277 | 2214 | @opindex W |
74291a4b MM |
2215 | Print extra warning messages for these events: |
2216 | ||
2217 | @itemize @bullet | |
74291a4b MM |
2218 | @item |
2219 | A function can return either with or without a value. (Falling | |
2220 | off the end of the function body is considered returning without | |
2221 | a value.) For example, this function would evoke such a | |
2222 | warning: | |
2223 | ||
2224 | @smallexample | |
2225 | @group | |
2226 | foo (a) | |
2227 | @{ | |
2228 | if (a > 0) | |
2229 | return a; | |
2230 | @} | |
2231 | @end group | |
2232 | @end smallexample | |
2233 | ||
2234 | @item | |
2235 | An expression-statement or the left-hand side of a comma expression | |
2236 | contains no side effects. | |
2237 | To suppress the warning, cast the unused expression to void. | |
2238 | For example, an expression such as @samp{x[i,j]} will cause a warning, | |
2239 | but @samp{x[(void)i,j]} will not. | |
2240 | ||
2241 | @item | |
2242 | An unsigned value is compared against zero with @samp{<} or @samp{<=}. | |
2243 | ||
2244 | @item | |
2245 | A comparison like @samp{x<=y<=z} appears; this is equivalent to | |
2246 | @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from | |
2247 | that of ordinary mathematical notation. | |
2248 | ||
2249 | @item | |
2250 | Storage-class specifiers like @code{static} are not the first things in | |
2251 | a declaration. According to the C Standard, this usage is obsolescent. | |
2252 | ||
e0c9fbb7 JM |
2253 | @item |
2254 | The return type of a function has a type qualifier such as @code{const}. | |
2255 | Such a type qualifier has no effect, since the value returned by a | |
2256 | function is not an lvalue. (But don't warn about the GNU extension of | |
2257 | @code{volatile void} return types. That extension will be warned about | |
630d3d5a | 2258 | if @option{-pedantic} is specified.) |
e0c9fbb7 | 2259 | |
74291a4b | 2260 | @item |
630d3d5a | 2261 | If @option{-Wall} or @option{-Wunused} is also specified, warn about unused |
74291a4b MM |
2262 | arguments. |
2263 | ||
e9a25f70 JL |
2264 | @item |
2265 | A comparison between signed and unsigned values could produce an | |
2266 | incorrect result when the signed value is converted to unsigned. | |
630d3d5a | 2267 | (But don't warn if @option{-Wno-sign-compare} is also specified.) |
e9a25f70 | 2268 | |
74291a4b MM |
2269 | @item |
2270 | An aggregate has a partly bracketed initializer. | |
2271 | For example, the following code would evoke such a warning, | |
2272 | because braces are missing around the initializer for @code{x.h}: | |
2273 | ||
2274 | @smallexample | |
2275 | struct s @{ int f, g; @}; | |
2276 | struct t @{ struct s h; int i; @}; | |
2277 | struct t x = @{ 1, 2, 3 @}; | |
2278 | @end smallexample | |
dbde0d5d BH |
2279 | |
2280 | @item | |
2281 | An aggregate has an initializer which does not initialize all members. | |
2282 | For example, the following code would cause such a warning, because | |
2283 | @code{x.h} would be implicitly initialized to zero: | |
2284 | ||
2285 | @smallexample | |
2286 | struct s @{ int f, g, h; @}; | |
2287 | struct s x = @{ 3, 4 @}; | |
2288 | @end smallexample | |
74291a4b MM |
2289 | @end itemize |
2290 | ||
f793a95e | 2291 | @item -Wfloat-equal |
cd3bb277 | 2292 | @opindex Wfloat-equal |
f793a95e JL |
2293 | Warn if floating point values are used in equality comparisons. |
2294 | ||
488d3985 GK |
2295 | The idea behind this is that sometimes it is convenient (for the |
2296 | programmer) to consider floating-point values as approximations to | |
2297 | infinitely precise real numbers. If you are doing this, then you need | |
2298 | to compute (by analysing the code, or in some other way) the maximum or | |
2299 | likely maximum error that the computation introduces, and allow for it | |
2300 | when performing comparisons (and when producing output, but that's a | |
2301 | different problem). In particular, instead of testing for equality, you | |
2302 | would check to see whether the two values have ranges that overlap; and | |
2303 | this is done with the relational operators, so equality comparisons are | |
2304 | probably mistaken. | |
2305 | ||
aee96fe9 | 2306 | @item -Wtraditional @r{(C only)} |
cd3bb277 | 2307 | @opindex Wtraditional |
74291a4b | 2308 | Warn about certain constructs that behave differently in traditional and |
161d7b59 | 2309 | ISO C@. Also warn about ISO C constructs that have no traditional C |
c8abc684 | 2310 | equivalent, and/or problematic constructs which should be avoided. |
74291a4b MM |
2311 | |
2312 | @itemize @bullet | |
2313 | @item | |
da312b55 NB |
2314 | Macro parameters that appear within string literals in the macro body. |
2315 | In traditional C macro replacement takes place within string literals, | |
161d7b59 | 2316 | but does not in ISO C@. |
da312b55 NB |
2317 | |
2318 | @item | |
2319 | In traditional C, some preprocessor directives did not exist. | |
2320 | Traditional preprocessors would only consider a line to be a directive | |
2321 | if the @samp{#} appeared in column 1 on the line. Therefore | |
630d3d5a | 2322 | @option{-Wtraditional} warns about directives that traditional C |
da312b55 NB |
2323 | understands but would ignore because the @samp{#} does not appear as the |
2324 | first character on the line. It also suggests you hide directives like | |
2325 | @samp{#pragma} not understood by traditional C by indenting them. Some | |
c21cd8b1 | 2326 | traditional implementations would not recognize @samp{#elif}, so it |
da312b55 NB |
2327 | suggests avoiding it altogether. |
2328 | ||
2329 | @item | |
2330 | A function-like macro that appears without arguments. | |
2331 | ||
2332 | @item | |
2333 | The unary plus operator. | |
2334 | ||
2335 | @item | |
c771326b JM |
2336 | The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point |
2337 | constant suffixes. (Traditional C does support the @samp{L} suffix on integer | |
da312b55 | 2338 | constants.) Note, these suffixes appear in macros defined in the system |
e979f9e8 | 2339 | headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. |
c8abc684 KG |
2340 | Use of these macros in user code might normally lead to spurious |
2341 | warnings, however gcc's integrated preprocessor has enough context to | |
2342 | avoid warning in these cases. | |
74291a4b MM |
2343 | |
2344 | @item | |
2345 | A function declared external in one block and then used after the end of | |
2346 | the block. | |
2347 | ||
2348 | @item | |
2349 | A @code{switch} statement has an operand of type @code{long}. | |
db838bb8 KG |
2350 | |
2351 | @item | |
2352 | A non-@code{static} function declaration follows a @code{static} one. | |
2353 | This construct is not accepted by some traditional C compilers. | |
48776cde KG |
2354 | |
2355 | @item | |
c1030c7c | 2356 | The ISO type of an integer constant has a different width or |
48776cde | 2357 | signedness from its traditional type. This warning is only issued if |
e979f9e8 | 2358 | the base of the constant is ten. I.e.@: hexadecimal or octal values, which |
48776cde | 2359 | typically represent bit patterns, are not warned about. |
bb66adca KG |
2360 | |
2361 | @item | |
c1030c7c | 2362 | Usage of ISO string concatenation is detected. |
7f094a94 | 2363 | |
895ea614 KG |
2364 | @item |
2365 | Initialization of automatic aggregates. | |
2366 | ||
2367 | @item | |
2368 | Identifier conflicts with labels. Traditional C lacks a separate | |
2369 | namespace for labels. | |
253b6b82 KG |
2370 | |
2371 | @item | |
2372 | Initialization of unions. If the initializer is zero, the warning is | |
2373 | omitted. This is done under the assumption that the zero initializer in | |
e979f9e8 | 2374 | user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing |
253b6b82 KG |
2375 | initializer warnings and relies on default initialization to zero in the |
2376 | traditional C case. | |
03829ad2 KG |
2377 | |
2378 | @item | |
3ed56f8a KG |
2379 | Conversions by prototypes between fixed/floating point values and vice |
2380 | versa. The absence of these prototypes when compiling with traditional | |
2381 | C would cause serious problems. This is a subset of the possible | |
630d3d5a | 2382 | conversion warnings, for the full set use @option{-Wconversion}. |
74291a4b MM |
2383 | @end itemize |
2384 | ||
861bb6c1 | 2385 | @item -Wundef |
cd3bb277 | 2386 | @opindex Wundef |
861bb6c1 JL |
2387 | Warn if an undefined identifier is evaluated in an @samp{#if} directive. |
2388 | ||
74291a4b | 2389 | @item -Wshadow |
cd3bb277 | 2390 | @opindex Wshadow |
d773df5a DB |
2391 | Warn whenever a local variable shadows another local variable, parameter or |
2392 | global variable or whenever a built-in function is shadowed. | |
74291a4b | 2393 | |
74291a4b | 2394 | @item -Wlarger-than-@var{len} |
cd3bb277 | 2395 | @opindex Wlarger-than |
74291a4b MM |
2396 | Warn whenever an object of larger than @var{len} bytes is defined. |
2397 | ||
2398 | @item -Wpointer-arith | |
cd3bb277 | 2399 | @opindex Wpointer-arith |
74291a4b MM |
2400 | Warn about anything that depends on the ``size of'' a function type or |
2401 | of @code{void}. GNU C assigns these types a size of 1, for | |
2402 | convenience in calculations with @code{void *} pointers and pointers | |
2403 | to functions. | |
2404 | ||
aee96fe9 | 2405 | @item -Wbad-function-cast @r{(C only)} |
cd3bb277 | 2406 | @opindex Wbad-function-cast |
74291a4b MM |
2407 | Warn whenever a function call is cast to a non-matching type. |
2408 | For example, warn if @code{int malloc()} is cast to @code{anything *}. | |
2409 | ||
2410 | @item -Wcast-qual | |
cd3bb277 | 2411 | @opindex Wcast-qual |
74291a4b MM |
2412 | Warn whenever a pointer is cast so as to remove a type qualifier from |
2413 | the target type. For example, warn if a @code{const char *} is cast | |
2414 | to an ordinary @code{char *}. | |
2415 | ||
2416 | @item -Wcast-align | |
cd3bb277 | 2417 | @opindex Wcast-align |
74291a4b MM |
2418 | Warn whenever a pointer is cast such that the required alignment of the |
2419 | target is increased. For example, warn if a @code{char *} is cast to | |
2420 | an @code{int *} on machines where integers can only be accessed at | |
2421 | two- or four-byte boundaries. | |
2422 | ||
2423 | @item -Wwrite-strings | |
cd3bb277 | 2424 | @opindex Wwrite-strings |
aee96fe9 JM |
2425 | When compiling C, give string constants the type @code{const |
2426 | char[@var{length}]} so that | |
74291a4b | 2427 | copying the address of one into a non-@code{const} @code{char *} |
aee96fe9 JM |
2428 | pointer will get a warning; when compiling C++, warn about the |
2429 | deprecated conversion from string constants to @code{char *}. | |
2430 | These warnings will help you find at | |
74291a4b MM |
2431 | compile time code that can try to write into a string constant, but |
2432 | only if you have been very careful about using @code{const} in | |
2433 | declarations and prototypes. Otherwise, it will just be a nuisance; | |
630d3d5a | 2434 | this is why we did not make @option{-Wall} request these warnings. |
74291a4b MM |
2435 | |
2436 | @item -Wconversion | |
cd3bb277 | 2437 | @opindex Wconversion |
74291a4b MM |
2438 | Warn if a prototype causes a type conversion that is different from what |
2439 | would happen to the same argument in the absence of a prototype. This | |
2440 | includes conversions of fixed point to floating and vice versa, and | |
2441 | conversions changing the width or signedness of a fixed point argument | |
2442 | except when the same as the default promotion. | |
2443 | ||
2444 | Also, warn if a negative integer constant expression is implicitly | |
2445 | converted to an unsigned type. For example, warn about the assignment | |
2446 | @code{x = -1} if @code{x} is unsigned. But do not warn about explicit | |
2447 | casts like @code{(unsigned) -1}. | |
2448 | ||
e9a25f70 | 2449 | @item -Wsign-compare |
cd3bb277 | 2450 | @opindex Wsign-compare |
e9a25f70 JL |
2451 | @cindex warning for comparison of signed and unsigned values |
2452 | @cindex comparison of signed and unsigned values, warning | |
2453 | @cindex signed and unsigned values, comparison warning | |
2454 | Warn when a comparison between signed and unsigned values could produce | |
2455 | an incorrect result when the signed value is converted to unsigned. | |
630d3d5a JM |
2456 | This warning is also enabled by @option{-W}; to get the other warnings |
2457 | of @option{-W} without this warning, use @samp{-W -Wno-sign-compare}. | |
e9a25f70 | 2458 | |
74291a4b | 2459 | @item -Waggregate-return |
cd3bb277 | 2460 | @opindex Waggregate-return |
74291a4b MM |
2461 | Warn if any functions that return structures or unions are defined or |
2462 | called. (In languages where you can return an array, this also elicits | |
2463 | a warning.) | |
2464 | ||
aee96fe9 | 2465 | @item -Wstrict-prototypes @r{(C only)} |
cd3bb277 | 2466 | @opindex Wstrict-prototypes |
74291a4b MM |
2467 | Warn if a function is declared or defined without specifying the |
2468 | argument types. (An old-style function definition is permitted without | |
2469 | a warning if preceded by a declaration which specifies the argument | |
2470 | types.) | |
2471 | ||
aee96fe9 | 2472 | @item -Wmissing-prototypes @r{(C only)} |
cd3bb277 | 2473 | @opindex Wmissing-prototypes |
74291a4b MM |
2474 | Warn if a global function is defined without a previous prototype |
2475 | declaration. This warning is issued even if the definition itself | |
2476 | provides a prototype. The aim is to detect global functions that fail | |
2477 | to be declared in header files. | |
2478 | ||
2479 | @item -Wmissing-declarations | |
cd3bb277 | 2480 | @opindex Wmissing-declarations |
74291a4b MM |
2481 | Warn if a global function is defined without a previous declaration. |
2482 | Do so even if the definition itself provides a prototype. | |
2483 | Use this option to detect global functions that are not declared in | |
2484 | header files. | |
2485 | ||
0ca3fb0a | 2486 | @item -Wmissing-noreturn |
cd3bb277 | 2487 | @opindex Wmissing-noreturn |
0ca3fb0a KG |
2488 | Warn about functions which might be candidates for attribute @code{noreturn}. |
2489 | Note these are only possible candidates, not absolute ones. Care should | |
2490 | be taken to manually verify functions actually do not ever return before | |
2491 | adding the @code{noreturn} attribute, otherwise subtle code generation | |
21c7361e AJ |
2492 | bugs could be introduced. You will not get a warning for @code{main} in |
2493 | hosted C environments. | |
0ca3fb0a | 2494 | |
74ff4629 | 2495 | @item -Wmissing-format-attribute |
cd3bb277 JM |
2496 | @opindex Wmissing-format-attribute |
2497 | @opindex Wformat | |
630d3d5a | 2498 | If @option{-Wformat} is enabled, also warn about functions which might be |
74ff4629 JM |
2499 | candidates for @code{format} attributes. Note these are only possible |
2500 | candidates, not absolute ones. GCC will guess that @code{format} | |
2501 | attributes might be appropriate for any function that calls a function | |
2502 | like @code{vprintf} or @code{vscanf}, but this might not always be the | |
2503 | case, and some functions for which @code{format} attributes are | |
2504 | appropriate may not be detected. This option has no effect unless | |
630d3d5a | 2505 | @option{-Wformat} is enabled (possibly by @option{-Wall}). |
74ff4629 | 2506 | |
3c12fcc2 | 2507 | @item -Wpacked |
cd3bb277 | 2508 | @opindex Wpacked |
3c12fcc2 | 2509 | Warn if a structure is given the packed attribute, but the packed |
02f52e19 | 2510 | attribute has no effect on the layout or size of the structure. |
3c12fcc2 GM |
2511 | Such structures may be mis-aligned for little benefit. For |
2512 | instance, in this code, the variable @code{f.x} in @code{struct bar} | |
2513 | will be misaligned even though @code{struct bar} does not itself | |
2514 | have the packed attribute: | |
2515 | ||
2516 | @smallexample | |
2517 | @group | |
2518 | struct foo @{ | |
2519 | int x; | |
2520 | char a, b, c, d; | |
2521 | @} __attribute__((packed)); | |
2522 | struct bar @{ | |
2523 | char z; | |
2524 | struct foo f; | |
2525 | @}; | |
2526 | @end group | |
2527 | @end smallexample | |
2528 | ||
2529 | @item -Wpadded | |
cd3bb277 | 2530 | @opindex Wpadded |
3c12fcc2 GM |
2531 | Warn if padding is included in a structure, either to align an element |
2532 | of the structure or to align the whole structure. Sometimes when this | |
2533 | happens it is possible to rearrange the fields of the structure to | |
2534 | reduce the padding and so make the structure smaller. | |
2535 | ||
74291a4b | 2536 | @item -Wredundant-decls |
cd3bb277 | 2537 | @opindex Wredundant-decls |
74291a4b MM |
2538 | Warn if anything is declared more than once in the same scope, even in |
2539 | cases where multiple declaration is valid and changes nothing. | |
2540 | ||
aee96fe9 | 2541 | @item -Wnested-externs @r{(C only)} |
cd3bb277 | 2542 | @opindex Wnested-externs |
252215a7 | 2543 | Warn if an @code{extern} declaration is encountered within a function. |
74291a4b | 2544 | |
312f6255 | 2545 | @item -Wunreachable-code |
cd3bb277 | 2546 | @opindex Wunreachable-code |
312f6255 GK |
2547 | Warn if the compiler detects that code will never be executed. |
2548 | ||
2549 | This option is intended to warn when the compiler detects that at | |
2550 | least a whole line of source code will never be executed, because | |
2551 | some condition is never satisfied or because it is after a | |
2552 | procedure that never returns. | |
2553 | ||
2554 | It is possible for this option to produce a warning even though there | |
2555 | are circumstances under which part of the affected line can be executed, | |
2556 | so care should be taken when removing apparently-unreachable code. | |
2557 | ||
2558 | For instance, when a function is inlined, a warning may mean that the | |
02f52e19 | 2559 | line is unreachable in only one inlined copy of the function. |
312f6255 | 2560 | |
630d3d5a | 2561 | This option is not made part of @option{-Wall} because in a debugging |
312f6255 GK |
2562 | version of a program there is often substantial code which checks |
2563 | correct functioning of the program and is, hopefully, unreachable | |
2564 | because the program does work. Another common use of unreachable | |
c21cd8b1 | 2565 | code is to provide behavior which is selectable at compile-time. |
312f6255 | 2566 | |
74291a4b | 2567 | @item -Winline |
cd3bb277 | 2568 | @opindex Winline |
c5c76735 | 2569 | Warn if a function can not be inlined and it was declared as inline. |
74291a4b | 2570 | |
795add94 | 2571 | @item -Wlong-long |
cd3bb277 JM |
2572 | @opindex Wlong-long |
2573 | @opindex Wno-long-long | |
795add94 | 2574 | Warn if @samp{long long} type is used. This is default. To inhibit |
630d3d5a JM |
2575 | the warning messages, use @option{-Wno-long-long}. Flags |
2576 | @option{-Wlong-long} and @option{-Wno-long-long} are taken into account | |
2577 | only when @option{-pedantic} flag is used. | |
795add94 | 2578 | |
18424ae1 | 2579 | @item -Wdisabled-optimization |
cd3bb277 | 2580 | @opindex Wdisabled-optimization |
18424ae1 BL |
2581 | Warn if a requested optimization pass is disabled. This warning does |
2582 | not generally indicate that there is anything wrong with your code; it | |
2583 | merely indicates that GCC's optimizers were unable to handle the code | |
2584 | effectively. Often, the problem is that your code is too big or too | |
2585 | complex; GCC will refuse to optimize programs when the optimization | |
2586 | itself is likely to take inordinate amounts of time. | |
2587 | ||
74291a4b | 2588 | @item -Werror |
cd3bb277 | 2589 | @opindex Werror |
74291a4b MM |
2590 | Make all warnings into errors. |
2591 | @end table | |
2592 | ||
2593 | @node Debugging Options | |
0c2d1a2a | 2594 | @section Options for Debugging Your Program or GCC |
74291a4b MM |
2595 | @cindex options, debugging |
2596 | @cindex debugging information options | |
2597 | ||
0c2d1a2a | 2598 | GCC has various special options that are used for debugging |
74291a4b MM |
2599 | either your program or GCC: |
2600 | ||
2642624b | 2601 | @table @gcctabopt |
74291a4b | 2602 | @item -g |
cd3bb277 | 2603 | @opindex g |
74291a4b | 2604 | Produce debugging information in the operating system's native format |
161d7b59 | 2605 | (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging |
74291a4b MM |
2606 | information. |
2607 | ||
630d3d5a | 2608 | On most systems that use stabs format, @option{-g} enables use of extra |
74291a4b MM |
2609 | debugging information that only GDB can use; this extra information |
2610 | makes debugging work better in GDB but will probably make other debuggers | |
2611 | crash or | |
2612 | refuse to read the program. If you want to control for certain whether | |
630d3d5a | 2613 | to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, |
5f98259a RK |
2614 | @option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, @option{-gdwarf-1}, |
2615 | or @option{-gvms} (see below). | |
74291a4b | 2616 | |
630d3d5a JM |
2617 | Unlike most other C compilers, GCC allows you to use @option{-g} with |
2618 | @option{-O}. The shortcuts taken by optimized code may occasionally | |
74291a4b MM |
2619 | produce surprising results: some variables you declared may not exist |
2620 | at all; flow of control may briefly move where you did not expect it; | |
2621 | some statements may not be executed because they compute constant | |
2622 | results or their values were already at hand; some statements may | |
2623 | execute in different places because they were moved out of loops. | |
2624 | ||
2625 | Nevertheless it proves possible to debug optimized output. This makes | |
2626 | it reasonable to use the optimizer for programs that might have bugs. | |
2627 | ||
0c2d1a2a | 2628 | The following options are useful when GCC is generated with the |
74291a4b MM |
2629 | capability for more than one debugging format. |
2630 | ||
2631 | @item -ggdb | |
cd3bb277 | 2632 | @opindex ggdb |
161d7b59 | 2633 | Produce debugging information for use by GDB@. This means to use the |
861bb6c1 JL |
2634 | most expressive format available (DWARF 2, stabs, or the native format |
2635 | if neither of those are supported), including GDB extensions if at all | |
2636 | possible. | |
74291a4b MM |
2637 | |
2638 | @item -gstabs | |
cd3bb277 | 2639 | @opindex gstabs |
74291a4b MM |
2640 | Produce debugging information in stabs format (if that is supported), |
2641 | without GDB extensions. This is the format used by DBX on most BSD | |
2642 | systems. On MIPS, Alpha and System V Release 4 systems this option | |
161d7b59 | 2643 | produces stabs debugging output which is not understood by DBX or SDB@. |
74291a4b MM |
2644 | On System V Release 4 systems this option requires the GNU assembler. |
2645 | ||
2646 | @item -gstabs+ | |
cd3bb277 | 2647 | @opindex gstabs+ |
74291a4b | 2648 | Produce debugging information in stabs format (if that is supported), |
161d7b59 | 2649 | using GNU extensions understood only by the GNU debugger (GDB)@. The |
74291a4b MM |
2650 | use of these extensions is likely to make other debuggers crash or |
2651 | refuse to read the program. | |
2652 | ||
2653 | @item -gcoff | |
cd3bb277 | 2654 | @opindex gcoff |
74291a4b MM |
2655 | Produce debugging information in COFF format (if that is supported). |
2656 | This is the format used by SDB on most System V systems prior to | |
2657 | System V Release 4. | |
2658 | ||
2659 | @item -gxcoff | |
cd3bb277 | 2660 | @opindex gxcoff |
74291a4b MM |
2661 | Produce debugging information in XCOFF format (if that is supported). |
2662 | This is the format used by the DBX debugger on IBM RS/6000 systems. | |
2663 | ||
2664 | @item -gxcoff+ | |
cd3bb277 | 2665 | @opindex gxcoff+ |
74291a4b | 2666 | Produce debugging information in XCOFF format (if that is supported), |
161d7b59 | 2667 | using GNU extensions understood only by the GNU debugger (GDB)@. The |
74291a4b MM |
2668 | use of these extensions is likely to make other debuggers crash or |
2669 | refuse to read the program, and may cause assemblers other than the GNU | |
2670 | assembler (GAS) to fail with an error. | |
2671 | ||
2672 | @item -gdwarf | |
cd3bb277 | 2673 | @opindex gdwarf |
861bb6c1 JL |
2674 | Produce debugging information in DWARF version 1 format (if that is |
2675 | supported). This is the format used by SDB on most System V Release 4 | |
2676 | systems. | |
74291a4b MM |
2677 | |
2678 | @item -gdwarf+ | |
cd3bb277 | 2679 | @opindex gdwarf+ |
861bb6c1 JL |
2680 | Produce debugging information in DWARF version 1 format (if that is |
2681 | supported), using GNU extensions understood only by the GNU debugger | |
161d7b59 | 2682 | (GDB)@. The use of these extensions is likely to make other debuggers |
861bb6c1 JL |
2683 | crash or refuse to read the program. |
2684 | ||
2685 | @item -gdwarf-2 | |
cd3bb277 | 2686 | @opindex gdwarf-2 |
861bb6c1 JL |
2687 | Produce debugging information in DWARF version 2 format (if that is |
2688 | supported). This is the format used by DBX on IRIX 6. | |
74291a4b | 2689 | |
5f98259a RK |
2690 | @item -gvms |
2691 | @opindex gvms | |
2692 | Produce debugging information in VMS debug format (if that is | |
2693 | supported). This is the format used by DEBUG on VMS systems. | |
2694 | ||
74291a4b MM |
2695 | @item -g@var{level} |
2696 | @itemx -ggdb@var{level} | |
2697 | @itemx -gstabs@var{level} | |
2698 | @itemx -gcoff@var{level} | |
2699 | @itemx -gxcoff@var{level} | |
2700 | @itemx -gdwarf@var{level} | |
861bb6c1 | 2701 | @itemx -gdwarf-2@var{level} |
5f98259a | 2702 | @itemx -gvms@var{level} |
74291a4b MM |
2703 | Request debugging information and also use @var{level} to specify how |
2704 | much information. The default level is 2. | |
2705 | ||
2706 | Level 1 produces minimal information, enough for making backtraces in | |
2707 | parts of the program that you don't plan to debug. This includes | |
2708 | descriptions of functions and external variables, but no information | |
2709 | about local variables and no line numbers. | |
2710 | ||
2711 | Level 3 includes extra information, such as all the macro definitions | |
2712 | present in the program. Some debuggers support macro expansion when | |
630d3d5a | 2713 | you use @option{-g3}. |
74291a4b MM |
2714 | |
2715 | @cindex @code{prof} | |
2716 | @item -p | |
cd3bb277 | 2717 | @opindex p |
74291a4b MM |
2718 | Generate extra code to write profile information suitable for the |
2719 | analysis program @code{prof}. You must use this option when compiling | |
2720 | the source files you want data about, and you must also use it when | |
2721 | linking. | |
2722 | ||
2723 | @cindex @code{gprof} | |
2724 | @item -pg | |
cd3bb277 | 2725 | @opindex pg |
74291a4b MM |
2726 | Generate extra code to write profile information suitable for the |
2727 | analysis program @code{gprof}. You must use this option when compiling | |
2728 | the source files you want data about, and you must also use it when | |
2729 | linking. | |
2730 | ||
2731 | @cindex @code{tcov} | |
2732 | @item -a | |
cd3bb277 | 2733 | @opindex a |
74291a4b MM |
2734 | Generate extra code to write profile information for basic blocks, which will |
2735 | record the number of times each basic block is executed, the basic block start | |
630d3d5a | 2736 | address, and the function name containing the basic block. If @option{-g} is |
74291a4b MM |
2737 | used, the line number and filename of the start of the basic block will also be |
2738 | recorded. If not overridden by the machine description, the default action is | |
2739 | to append to the text file @file{bb.out}. | |
2740 | ||
2741 | This data could be analyzed by a program like @code{tcov}. Note, | |
2742 | however, that the format of the data is not what @code{tcov} expects. | |
2743 | Eventually GNU @code{gprof} should be extended to process this data. | |
2744 | ||
898f531b | 2745 | @item -Q |
cd3bb277 | 2746 | @opindex Q |
898f531b JL |
2747 | Makes the compiler print out each function name as it is compiled, and |
2748 | print some statistics about each pass when it finishes. | |
2749 | ||
1f0c3120 | 2750 | @item -ftime-report |
cd3bb277 | 2751 | @opindex ftime-report |
1f0c3120 JM |
2752 | Makes the compiler print some statistics about the time consumed by each |
2753 | pass when it finishes. | |
2754 | ||
2755 | @item -fmem-report | |
cd3bb277 | 2756 | @opindex fmem-report |
1f0c3120 JM |
2757 | Makes the compiler print some statistics about permanent memory |
2758 | allocation when it finishes. | |
2759 | ||
861bb6c1 | 2760 | @item -fprofile-arcs |
cd3bb277 | 2761 | @opindex fprofile-arcs |
3de87bf2 JJ |
2762 | Instrument @dfn{arcs} during compilation to generate coverage data |
2763 | or for profile-directed block ordering. During execution the program | |
2764 | records how many times each branch is executed and how many times it is | |
2765 | taken. When the compiled program exits it saves this data to a file | |
2766 | called @file{@var{sourcename}.da} for each source file. | |
2767 | ||
2768 | For profile-directed block ordering, compile the program with | |
2769 | @option{-fprofile-arcs} plus optimization and code generation options, | |
2770 | generate the arc profile information by running the program on a | |
2771 | selected workload, and then compile the program again with the same | |
2772 | optimization and code generation options plus | |
630d3d5a | 2773 | @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that |
3de87bf2 JJ |
2774 | Control Optimization}). |
2775 | ||
2776 | The other use of @option{-fprofile-arcs} is for use with @code{gcov}, | |
2777 | when it is used with the @option{-ftest-coverage} option. GCC | |
2778 | supports two methods of determining code coverage: the options that | |
2779 | support @code{gcov}, and options @option{-a} and @option{-ax}, which | |
2780 | write information to text files. The options that support @code{gcov} | |
2781 | do not need to instrument every arc in the program, so a program compiled | |
2782 | with them runs faster than a program compiled with @option{-a}, which | |
2783 | adds instrumentation code to every basic block in the program. The | |
2784 | tradeoff: since @code{gcov} does not have execution counts for all | |
2785 | branches, it must start with the execution counts for the instrumented | |
2786 | branches, and then iterate over the program flow graph until the entire | |
2787 | graph has been solved. Hence, @code{gcov} runs a little more slowly than | |
2788 | a program which uses information from @option{-a} and @option{-ax}. | |
2789 | ||
2790 | With @option{-fprofile-arcs}, for each function of your program GCC | |
2791 | creates a program flow graph, then finds a spanning tree for the graph. | |
2792 | Only arcs that are not on the spanning tree have to be instrumented: the | |
2793 | compiler adds code to count the number of times that these arcs are | |
2794 | executed. When an arc is the only exit or only entrance to a block, the | |
2795 | instrumentation code can be added to the block; otherwise, a new basic | |
2796 | block must be created to hold the instrumentation code. | |
2797 | ||
2798 | This option makes it possible to estimate branch probabilities and to | |
2799 | calculate basic block execution counts. In general, basic block | |
2800 | execution counts as provided by @option{-a} do not give enough | |
2801 | information to estimate all branch probabilities. | |
861bb6c1 JL |
2802 | |
2803 | @need 2000 | |
2804 | @item -ftest-coverage | |
cd3bb277 | 2805 | @opindex ftest-coverage |
861bb6c1 | 2806 | Create data files for the @code{gcov} code-coverage utility |
0c2d1a2a | 2807 | (@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}). |
861bb6c1 JL |
2808 | The data file names begin with the name of your source file: |
2809 | ||
2642624b | 2810 | @table @gcctabopt |
861bb6c1 JL |
2811 | @item @var{sourcename}.bb |
2812 | A mapping from basic blocks to line numbers, which @code{gcov} uses to | |
2813 | associate basic block execution counts with line numbers. | |
2814 | ||
2815 | @item @var{sourcename}.bbg | |
2816 | A list of all arcs in the program flow graph. This allows @code{gcov} | |
2817 | to reconstruct the program flow graph, so that it can compute all basic | |
2818 | block and arc execution counts from the information in the | |
3de87bf2 | 2819 | @code{@var{sourcename}.da} file. |
861bb6c1 JL |
2820 | @end table |
2821 | ||
3de87bf2 JJ |
2822 | Use @option{-ftest-coverage} with @option{-fprofile-arcs}; the latter |
2823 | option adds instrumentation to the program, which then writes | |
2824 | execution counts to another data file: | |
2825 | ||
2826 | @table @gcctabopt | |
2827 | @item @var{sourcename}.da | |
2828 | Runtime arc execution counts, used in conjunction with the arc | |
2829 | information in the file @code{@var{sourcename}.bbg}. | |
2830 | @end table | |
2831 | ||
2832 | Coverage data will map better to the source files if | |
2833 | @option{-ftest-coverage} is used without optimization. | |
2834 | ||
74291a4b | 2835 | @item -d@var{letters} |
cd3bb277 | 2836 | @opindex d |
74291a4b MM |
2837 | Says to make debugging dumps during compilation at times specified by |
2838 | @var{letters}. This is used for debugging the compiler. The file names | |
375e2d5c | 2839 | for most of the dumps are made by appending a pass number and a word to |
02f52e19 | 2840 | the source file name (e.g. @file{foo.c.00.rtl} or @file{foo.c.01.sibling}). |
375e2d5c | 2841 | Here are the possible letters for use in @var{letters}, and their meanings: |
74291a4b MM |
2842 | |
2843 | @table @samp | |
375e2d5c | 2844 | @item A |
cd3bb277 | 2845 | @opindex dA |
375e2d5c | 2846 | Annotate the assembler output with miscellaneous debugging information. |
956d6950 | 2847 | @item b |
cd3bb277 | 2848 | @opindex db |
0b47e4c1 | 2849 | Dump after computing branch probabilities, to @file{@var{file}.14.bp}. |
48d9ade5 | 2850 | @item B |
cd3bb277 | 2851 | @opindex dB |
0b47e4c1 | 2852 | Dump after block reordering, to @file{@var{file}.28.bbro}. |
032713aa | 2853 | @item c |
cd3bb277 | 2854 | @opindex dc |
0b47e4c1 | 2855 | Dump after instruction combination, to the file @file{@var{file}.16.combine}. |
470fc13d | 2856 | @item C |
cd3bb277 | 2857 | @opindex dC |
0b47e4c1 | 2858 | Dump after the first if conversion, to the file @file{@var{file}.17.ce}. |
032713aa | 2859 | @item d |
cd3bb277 | 2860 | @opindex dd |
0b47e4c1 | 2861 | Dump after delayed branch scheduling, to @file{@var{file}.31.dbr}. |
032713aa | 2862 | @item D |
cd3bb277 | 2863 | @opindex dD |
f5963e61 JL |
2864 | Dump all macro definitions, at the end of preprocessing, in addition to |
2865 | normal output. | |
48d9ade5 | 2866 | @item e |
cd3bb277 | 2867 | @opindex de |
0826f1d8 | 2868 | Dump after SSA optimizations, to @file{@var{file}.04.ssa} and |
0b47e4c1 | 2869 | @file{@var{file}.07.ussa}. |
470fc13d | 2870 | @item E |
cd3bb277 | 2871 | @opindex dE |
0b47e4c1 | 2872 | Dump after the second if conversion, to @file{@var{file}.26.ce2}. |
74291a4b | 2873 | @item f |
cd3bb277 | 2874 | @opindex df |
0b47e4c1 | 2875 | Dump after life analysis, to @file{@var{file}.15.life}. |
48d9ade5 | 2876 | @item F |
cd3bb277 | 2877 | @opindex dF |
0b47e4c1 | 2878 | Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.09.addressof}. |
74291a4b | 2879 | @item g |
cd3bb277 | 2880 | @opindex dg |
0b47e4c1 | 2881 | Dump after global register allocation, to @file{@var{file}.21.greg}. |
0826f1d8 JL |
2882 | @item h |
2883 | @opindex dh | |
2884 | Dump after finalization of EH handling code, to @file{@var{file}.02.eh}. | |
2885 | @item o | |
cd3bb277 | 2886 | @opindex do |
9c34dbbf | 2887 | Dump after post-reload optimizations, to @file{@var{file}.22.postreload}. |
02f52e19 | 2888 | @item G |
cd3bb277 | 2889 | @opindex dG |
0b47e4c1 | 2890 | Dump after GCSE, to @file{@var{file}.10.gcse}. |
48d9ade5 | 2891 | @item i |
cd3bb277 | 2892 | @opindex di |
48d9ade5 | 2893 | Dump after sibling call optimizations, to @file{@var{file}.01.sibling}. |
032713aa | 2894 | @item j |
cd3bb277 | 2895 | @opindex dj |
0826f1d8 | 2896 | Dump after the first jump optimization, to @file{@var{file}.03.jump}. |
74291a4b | 2897 | @item k |
cd3bb277 | 2898 | @opindex dk |
0b47e4c1 | 2899 | Dump after conversion from registers to stack, to @file{@var{file}.32.stack}. |
032713aa | 2900 | @item l |
cd3bb277 | 2901 | @opindex dl |
0b47e4c1 | 2902 | Dump after local register allocation, to @file{@var{file}.20.lreg}. |
032713aa | 2903 | @item L |
cd3bb277 | 2904 | @opindex dL |
0b47e4c1 | 2905 | Dump after loop optimization, to @file{@var{file}.11.loop}. |
032713aa | 2906 | @item M |
cd3bb277 | 2907 | @opindex dM |
032713aa | 2908 | Dump after performing the machine dependent reorganisation pass, to |
0b47e4c1 | 2909 | @file{@var{file}.30.mach}. |
48d9ade5 | 2910 | @item n |
cd3bb277 | 2911 | @opindex dn |
0b47e4c1 | 2912 | Dump after register renumbering, to @file{@var{file}.25.rnreg}. |
032713aa | 2913 | @item N |
cd3bb277 | 2914 | @opindex dN |
0b47e4c1 | 2915 | Dump after the register move pass, to @file{@var{file}.18.regmove}. |
032713aa | 2916 | @item r |
cd3bb277 | 2917 | @opindex dr |
375e2d5c | 2918 | Dump after RTL generation, to @file{@var{file}.00.rtl}. |
032713aa | 2919 | @item R |
cd3bb277 | 2920 | @opindex dR |
9c34dbbf | 2921 | Dump after the second scheduling pass, to @file{@var{file}.27.sched2}. |
032713aa | 2922 | @item s |
cd3bb277 | 2923 | @opindex ds |
032713aa | 2924 | Dump after CSE (including the jump optimization that sometimes follows |
0b47e4c1 | 2925 | CSE), to @file{@var{file}.08.cse}. |
032713aa | 2926 | @item S |
cd3bb277 | 2927 | @opindex dS |
9c34dbbf | 2928 | Dump after the first scheduling pass, to @file{@var{file}.19.sched}. |
032713aa | 2929 | @item t |
cd3bb277 | 2930 | @opindex dt |
032713aa | 2931 | Dump after the second CSE pass (including the jump optimization that |
0b47e4c1 | 2932 | sometimes follows CSE), to @file{@var{file}.12.cse2}. |
48d9ade5 | 2933 | @item w |
cd3bb277 | 2934 | @opindex dw |
0b47e4c1 | 2935 | Dump after the second flow pass, to @file{@var{file}.23.flow2}. |
470fc13d | 2936 | @item X |
cd3bb277 | 2937 | @opindex dX |
9c34dbbf | 2938 | Dump after SSA dead code elimination, to @file{@var{file}.06.ssadce}. |
48d9ade5 | 2939 | @item z |
cd3bb277 | 2940 | @opindex dz |
0b47e4c1 | 2941 | Dump after the peephole pass, to @file{@var{file}.24.peephole2}. |
74291a4b | 2942 | @item a |
cd3bb277 | 2943 | @opindex da |
74291a4b MM |
2944 | Produce all the dumps listed above. |
2945 | @item m | |
cd3bb277 | 2946 | @opindex dm |
74291a4b MM |
2947 | Print statistics on memory usage, at the end of the run, to |
2948 | standard error. | |
2949 | @item p | |
cd3bb277 | 2950 | @opindex dp |
74291a4b | 2951 | Annotate the assembler output with a comment indicating which |
f20b5577 MM |
2952 | pattern and alternative was used. The length of each instruction is |
2953 | also printed. | |
2856c3e3 | 2954 | @item P |
cd3bb277 | 2955 | @opindex dP |
2856c3e3 | 2956 | Dump the RTL in the assembler output as a comment before each instruction. |
630d3d5a | 2957 | Also turns on @option{-dp} annotation. |
375e2d5c | 2958 | @item v |
cd3bb277 | 2959 | @opindex dv |
375e2d5c RH |
2960 | For each of the other indicated dump files (except for |
2961 | @file{@var{file}.00.rtl}), dump a representation of the control flow graph | |
b192711e | 2962 | suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}. |
62a1403d | 2963 | @item x |
cd3bb277 | 2964 | @opindex dx |
62a1403d AS |
2965 | Just generate RTL for a function instead of compiling it. Usually used |
2966 | with @samp{r}. | |
032713aa | 2967 | @item y |
cd3bb277 | 2968 | @opindex dy |
032713aa | 2969 | Dump debugging information during parsing, to standard error. |
74291a4b MM |
2970 | @end table |
2971 | ||
b707b450 | 2972 | @item -fdump-unnumbered |
cd3bb277 | 2973 | @opindex fdump-unnumbered |
695ac33f | 2974 | When doing debugging dumps (see @option{-d} option above), suppress instruction |
b707b450 | 2975 | numbers and line number note output. This makes it more feasible to |
b192711e | 2976 | use diff on debugging dumps for compiler invocations with different |
695ac33f | 2977 | options, in particular with and without @option{-g}. |
b707b450 | 2978 | |
aee96fe9 | 2979 | @item -fdump-class-hierarchy @r{(C++ only)} |
22367161 | 2980 | @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} |
cd3bb277 | 2981 | @opindex fdump-class-hierarchy |
e76b4820 | 2982 | Dump a representation of each class's hierarchy and virtual function |
767094dd | 2983 | table layout to a file. The file name is made by appending @file{.class} |
22367161 NS |
2984 | to the source file name. If the @samp{-@var{options}} form is used, |
2985 | @var{options} controls the details of the dump as described for the | |
2986 | @option{-fdump-tree} options. | |
2987 | ||
2988 | @item -fdump-tree-@var{switch} @r{(C++ only)} | |
2989 | @itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)} | |
2990 | @opindex fdump-tree | |
2991 | Control the dumping at various stages of processing the intermediate | |
2992 | language tree to a file. The file name is generated by appending a switch | |
2993 | specific suffix to the source file name. If the @samp{-@var{options}} | |
2994 | form is used, @var{options} is a list of @samp{-} separated options that | |
2995 | control the details of the dump. Not all options are applicable to all | |
2996 | dumps, those which are not meaningful will be ignored. The following | |
2997 | options are available | |
f71f87f9 | 2998 | |
e76b4820 | 2999 | @table @samp |
22367161 | 3000 | @item address |
767094dd | 3001 | Print the address of each node. Usually this is not meaningful as it |
22367161 NS |
3002 | changes according to the environment and source file. Its primary use |
3003 | is for tying up a dump file with a debug environment. | |
3004 | @item slim | |
3005 | Inhibit dumping of members of a scope or body of a function merely | |
3006 | because that scope has been reached. Only dump such items when they | |
3007 | are directly reachable by some other path. | |
3008 | @item all | |
3009 | Turn on all options. | |
e76b4820 NS |
3010 | @end table |
3011 | ||
3012 | The following tree dumps are possible: | |
3013 | @table @samp | |
3014 | @item original | |
3015 | Dump before any tree based optimization, to @file{@var{file}.original}. | |
3016 | @item optimized | |
3017 | Dump after all tree based optimization, to @file{@var{file}.optimized}. | |
6be77748 | 3018 | @item inlined |
9c34dbbf | 3019 | Dump after function inlining, to @file{@var{file}.inlined}. |
e76b4820 | 3020 | @end table |
9965d119 | 3021 | |
74291a4b | 3022 | @item -fpretend-float |
cd3bb277 | 3023 | @opindex fpretend-float |
74291a4b MM |
3024 | When running a cross-compiler, pretend that the target machine uses the |
3025 | same floating point format as the host machine. This causes incorrect | |
3026 | output of the actual floating constants, but the actual instruction | |
0c2d1a2a | 3027 | sequence will probably be the same as GCC would make when running on |
74291a4b MM |
3028 | the target machine. |
3029 | ||
3030 | @item -save-temps | |
cd3bb277 | 3031 | @opindex save-temps |
74291a4b MM |
3032 | Store the usual ``temporary'' intermediate files permanently; place them |
3033 | in the current directory and name them based on the source file. Thus, | |
3034 | compiling @file{foo.c} with @samp{-c -save-temps} would produce files | |
f2ecb02d JM |
3035 | @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a |
3036 | preprocessed @file{foo.i} output file even though the compiler now | |
3037 | normally uses an integrated preprocessor. | |
74291a4b | 3038 | |
03c41c05 | 3039 | @item -time |
cd3bb277 | 3040 | @opindex time |
03c41c05 | 3041 | Report the CPU time taken by each subprocess in the compilation |
f2ecb02d JM |
3042 | sequence. For C source files, this is the compiler proper and assembler |
3043 | (plus the linker if linking is done). The output looks like this: | |
03c41c05 ZW |
3044 | |
3045 | @smallexample | |
03c41c05 ZW |
3046 | # cc1 0.12 0.01 |
3047 | # as 0.00 0.01 | |
3048 | @end smallexample | |
3049 | ||
3050 | The first number on each line is the ``user time,'' that is time spent | |
3051 | executing the program itself. The second number is ``system time,'' | |
3052 | time spent executing operating system routines on behalf of the program. | |
3053 | Both numbers are in seconds. | |
3054 | ||
74291a4b | 3055 | @item -print-file-name=@var{library} |
cd3bb277 | 3056 | @opindex print-file-name |
74291a4b MM |
3057 | Print the full absolute name of the library file @var{library} that |
3058 | would be used when linking---and don't do anything else. With this | |
0c2d1a2a | 3059 | option, GCC does not compile or link anything; it just prints the |
74291a4b MM |
3060 | file name. |
3061 | ||
b1018de6 AO |
3062 | @item -print-multi-directory |
3063 | @opindex print-multi-directory | |
3064 | Print the directory name corresponding to the multilib selected by any | |
3065 | other switches present in the command line. This directory is supposed | |
3066 | to exist in @env{GCC_EXEC_PREFIX}. | |
3067 | ||
3068 | @item -print-multi-lib | |
3069 | @opindex print-multi-lib | |
3070 | Print the mapping from multilib directory names to compiler switches | |
3071 | that enable them. The directory name is separated from the switches by | |
3072 | @samp{;}, and each switch starts with an @samp{@@} instead of the | |
3073 | @samp{-}, without spaces between multiple switches. This is supposed to | |
3074 | ease shell-processing. | |
3075 | ||
74291a4b | 3076 | @item -print-prog-name=@var{program} |
cd3bb277 | 3077 | @opindex print-prog-name |
630d3d5a | 3078 | Like @option{-print-file-name}, but searches for a program such as @samp{cpp}. |
74291a4b MM |
3079 | |
3080 | @item -print-libgcc-file-name | |
cd3bb277 | 3081 | @opindex print-libgcc-file-name |
630d3d5a | 3082 | Same as @option{-print-file-name=libgcc.a}. |
74291a4b | 3083 | |
630d3d5a | 3084 | This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} |
74291a4b MM |
3085 | but you do want to link with @file{libgcc.a}. You can do |
3086 | ||
3087 | @example | |
3088 | gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` | |
3089 | @end example | |
3090 | ||
3091 | @item -print-search-dirs | |
cd3bb277 | 3092 | @opindex print-search-dirs |
74291a4b MM |
3093 | Print the name of the configured installation directory and a list of |
3094 | program and library directories gcc will search---and don't do anything else. | |
3095 | ||
3096 | This is useful when gcc prints the error message | |
3c0b7970 JM |
3097 | @samp{installation problem, cannot exec cpp0: No such file or directory}. |
3098 | To resolve this you either need to put @file{cpp0} and the other compiler | |
74291a4b | 3099 | components where gcc expects to find them, or you can set the environment |
bedc7537 | 3100 | variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. |
74291a4b MM |
3101 | Don't forget the trailing '/'. |
3102 | @xref{Environment Variables}. | |
1f0c3120 JM |
3103 | |
3104 | @item -dumpmachine | |
cd3bb277 | 3105 | @opindex dumpmachine |
1f0c3120 JM |
3106 | Print the compiler's target machine (for example, |
3107 | @samp{i686-pc-linux-gnu})---and don't do anything else. | |
3108 | ||
3109 | @item -dumpversion | |
cd3bb277 | 3110 | @opindex dumpversion |
1f0c3120 JM |
3111 | Print the compiler version (for example, @samp{3.0})---and don't do |
3112 | anything else. | |
3113 | ||
3114 | @item -dumpspecs | |
cd3bb277 | 3115 | @opindex dumpspecs |
1f0c3120 JM |
3116 | Print the compiler's built-in specs---and don't do anything else. (This |
3117 | is used when GCC itself is being built.) @xref{Spec Files}. | |
74291a4b MM |
3118 | @end table |
3119 | ||
3120 | @node Optimize Options | |
3121 | @section Options That Control Optimization | |
3122 | @cindex optimize options | |
3123 | @cindex options, optimization | |
3124 | ||
3125 | These options control various sorts of optimizations: | |
3126 | ||
2642624b | 3127 | @table @gcctabopt |
74291a4b MM |
3128 | @item -O |
3129 | @itemx -O1 | |
cd3bb277 JM |
3130 | @opindex O |
3131 | @opindex O1 | |
74291a4b MM |
3132 | Optimize. Optimizing compilation takes somewhat more time, and a lot |
3133 | more memory for a large function. | |
3134 | ||
630d3d5a | 3135 | Without @option{-O}, the compiler's goal is to reduce the cost of |
74291a4b MM |
3136 | compilation and to make debugging produce the expected results. |
3137 | Statements are independent: if you stop the program with a breakpoint | |
3138 | between statements, you can then assign a new value to any variable or | |
3139 | change the program counter to any other statement in the function and | |
3140 | get exactly the results you would expect from the source code. | |
3141 | ||
630d3d5a | 3142 | With @option{-O}, the compiler tries to reduce code size and execution |
9c34dbbf ZW |
3143 | time, without performing any optimizations that take a great deal of |
3144 | compilation time. | |
74291a4b MM |
3145 | |
3146 | @item -O2 | |
cd3bb277 | 3147 | @opindex O2 |
0c2d1a2a | 3148 | Optimize even more. GCC performs nearly all supported optimizations |
74291a4b | 3149 | that do not involve a space-speed tradeoff. The compiler does not |
630d3d5a JM |
3150 | perform loop unrolling or function inlining when you specify @option{-O2}. |
3151 | As compared to @option{-O}, this option increases both compilation time | |
74291a4b MM |
3152 | and the performance of the generated code. |
3153 | ||
630d3d5a | 3154 | @option{-O2} turns on all optional optimizations except for loop unrolling, |
2b2a8f1f | 3155 | function inlining, and register renaming. It also turns on the |
630d3d5a | 3156 | @option{-fforce-mem} option on all machines and frame pointer elimination |
2b2a8f1f | 3157 | on machines where doing so does not interfere with debugging. |
74291a4b | 3158 | |
081ca317 BL |
3159 | Please note the warning under @option{-fgcse} about |
3160 | invoking @option{-O2} on programs that use computed gotos. | |
3161 | ||
74291a4b | 3162 | @item -O3 |
cd3bb277 | 3163 | @opindex O3 |
630d3d5a JM |
3164 | Optimize yet more. @option{-O3} turns on all optimizations specified by |
3165 | @option{-O2} and also turns on the @option{-finline-functions} and | |
3166 | @option{-frename-registers} options. | |
74291a4b MM |
3167 | |
3168 | @item -O0 | |
cd3bb277 | 3169 | @opindex O0 |
74291a4b MM |
3170 | Do not optimize. |
3171 | ||
c6aded7c | 3172 | @item -Os |
cd3bb277 | 3173 | @opindex Os |
630d3d5a | 3174 | Optimize for size. @option{-Os} enables all @option{-O2} optimizations that |
c6aded7c AG |
3175 | do not typically increase code size. It also performs further |
3176 | optimizations designed to reduce code size. | |
3177 | ||
630d3d5a | 3178 | If you use multiple @option{-O} options, with or without level numbers, |
74291a4b MM |
3179 | the last such option is the one that is effective. |
3180 | @end table | |
3181 | ||
630d3d5a | 3182 | Options of the form @option{-f@var{flag}} specify machine-independent |
74291a4b | 3183 | flags. Most flags have both positive and negative forms; the negative |
630d3d5a | 3184 | form of @option{-ffoo} would be @option{-fno-foo}. In the table below, |
74291a4b MM |
3185 | only one of the forms is listed---the one which is not the default. |
3186 | You can figure out the other form by either removing @samp{no-} or | |
3187 | adding it. | |
3188 | ||
2642624b | 3189 | @table @gcctabopt |
74291a4b | 3190 | @item -ffloat-store |
cd3bb277 | 3191 | @opindex ffloat-store |
74291a4b MM |
3192 | Do not store floating point variables in registers, and inhibit other |
3193 | options that might change whether a floating point value is taken from a | |
3194 | register or memory. | |
3195 | ||
3196 | @cindex floating point precision | |
3197 | This option prevents undesirable excess precision on machines such as | |
3198 | the 68000 where the floating registers (of the 68881) keep more | |
3199 | precision than a @code{double} is supposed to have. Similarly for the | |
3200 | x86 architecture. For most programs, the excess precision does only | |
3201 | good, but a few programs rely on the precise definition of IEEE floating | |
630d3d5a | 3202 | point. Use @option{-ffloat-store} for such programs, after modifying |
6fd74494 | 3203 | them to store all pertinent intermediate computations into variables. |
74291a4b MM |
3204 | |
3205 | @item -fno-default-inline | |
cd3bb277 | 3206 | @opindex fno-default-inline |
74291a4b MM |
3207 | Do not make member functions inline by default merely because they are |
3208 | defined inside the class scope (C++ only). Otherwise, when you specify | |
630d3d5a | 3209 | @w{@option{-O}}, member functions defined inside class scope are compiled |
74291a4b MM |
3210 | inline by default; i.e., you don't need to add @samp{inline} in front of |
3211 | the member function name. | |
3212 | ||
3213 | @item -fno-defer-pop | |
cd3bb277 | 3214 | @opindex fno-defer-pop |
74291a4b MM |
3215 | Always pop the arguments to each function call as soon as that function |
3216 | returns. For machines which must pop arguments after a function call, | |
3217 | the compiler normally lets arguments accumulate on the stack for several | |
3218 | function calls and pops them all at once. | |
3219 | ||
3220 | @item -fforce-mem | |
cd3bb277 | 3221 | @opindex fforce-mem |
74291a4b MM |
3222 | Force memory operands to be copied into registers before doing |
3223 | arithmetic on them. This produces better code by making all memory | |
3224 | references potential common subexpressions. When they are not common | |
3225 | subexpressions, instruction combination should eliminate the separate | |
630d3d5a | 3226 | register-load. The @option{-O2} option turns on this option. |
74291a4b MM |
3227 | |
3228 | @item -fforce-addr | |
cd3bb277 | 3229 | @opindex fforce-addr |
74291a4b MM |
3230 | Force memory address constants to be copied into registers before |
3231 | doing arithmetic on them. This may produce better code just as | |
630d3d5a | 3232 | @option{-fforce-mem} may. |
74291a4b MM |
3233 | |
3234 | @item -fomit-frame-pointer | |
cd3bb277 | 3235 | @opindex fomit-frame-pointer |
74291a4b MM |
3236 | Don't keep the frame pointer in a register for functions that |
3237 | don't need one. This avoids the instructions to save, set up and | |
3238 | restore frame pointers; it also makes an extra register available | |
3239 | in many functions. @strong{It also makes debugging impossible on | |
3240 | some machines.} | |
3241 | ||
8aeea6e6 | 3242 | On some machines, such as the VAX, this flag has no effect, because |
74291a4b MM |
3243 | the standard calling sequence automatically handles the frame pointer |
3244 | and nothing is saved by pretending it doesn't exist. The | |
3245 | machine-description macro @code{FRAME_POINTER_REQUIRED} controls | |
3246 | whether a target machine supports this flag. @xref{Registers,,Register | |
b11cc610 | 3247 | Usage, gccint, GNU Compiler Collection (GCC) Internals}. |
74291a4b | 3248 | |
1aaef9c1 | 3249 | @item -foptimize-sibling-calls |
cd3bb277 | 3250 | @opindex foptimize-sibling-calls |
1aaef9c1 JH |
3251 | Optimize sibling and tail recursive calls. |
3252 | ||
91ce572a | 3253 | @item -ftrapv |
cd3bb277 | 3254 | @opindex ftrapv |
91ce572a CC |
3255 | This option generates traps for signed overflow on addition, subtraction, |
3256 | multiplication operations. | |
3257 | ||
74291a4b | 3258 | @item -fno-inline |
cd3bb277 | 3259 | @opindex fno-inline |
74291a4b MM |
3260 | Don't pay attention to the @code{inline} keyword. Normally this option |
3261 | is used to keep the compiler from expanding any functions inline. | |
3262 | Note that if you are not optimizing, no functions can be expanded inline. | |
3263 | ||
3264 | @item -finline-functions | |
cd3bb277 | 3265 | @opindex finline-functions |
74291a4b MM |
3266 | Integrate all simple functions into their callers. The compiler |
3267 | heuristically decides which functions are simple enough to be worth | |
3268 | integrating in this way. | |
3269 | ||
3270 | If all calls to a given function are integrated, and the function is | |
3271 | declared @code{static}, then the function is normally not output as | |
3272 | assembler code in its own right. | |
3273 | ||
efa3896a | 3274 | @item -finline-limit=@var{n} |
cd3bb277 | 3275 | @opindex finline-limit |
f9e814f1 TP |
3276 | By default, gcc limits the size of functions that can be inlined. This flag |
3277 | allows the control of this limit for functions that are explicitly marked as | |
02f52e19 AJ |
3278 | inline (ie marked with the inline keyword or defined within the class |
3279 | definition in c++). @var{n} is the size of functions that can be inlined in | |
f9e814f1 | 3280 | number of pseudo instructions (not counting parameter handling). The default |
93ee12c4 GP |
3281 | value of @var{n} is 600. |
3282 | Increasing this value can result in more inlined code at | |
f9e814f1 | 3283 | the cost of compilation time and memory consumption. Decreasing usually makes |
02f52e19 AJ |
3284 | the compilation faster and less code will be inlined (which presumably |
3285 | means slower programs). This option is particularly useful for programs that | |
aee96fe9 | 3286 | use inlining heavily such as those based on recursive templates with C++. |
f9e814f1 TP |
3287 | |
3288 | @emph{Note:} pseudo instruction represents, in this particular context, an | |
3289 | abstract measurement of function's size. In no way, it represents a count | |
3290 | of assembly instructions and as such its exact meaning might change from one | |
3291 | release to an another. | |
3292 | ||
74291a4b | 3293 | @item -fkeep-inline-functions |
cd3bb277 | 3294 | @opindex fkeep-inline-functions |
74291a4b MM |
3295 | Even if all calls to a given function are integrated, and the function |
3296 | is declared @code{static}, nevertheless output a separate run-time | |
3297 | callable version of the function. This switch does not affect | |
3298 | @code{extern inline} functions. | |
3299 | ||
3300 | @item -fkeep-static-consts | |
cd3bb277 | 3301 | @opindex fkeep-static-consts |
74291a4b MM |
3302 | Emit variables declared @code{static const} when optimization isn't turned |
3303 | on, even if the variables aren't referenced. | |
3304 | ||
0c2d1a2a | 3305 | GCC enables this option by default. If you want to force the compiler to |
74291a4b | 3306 | check if the variable was referenced, regardless of whether or not |
630d3d5a | 3307 | optimization is turned on, use the @option{-fno-keep-static-consts} option. |
74291a4b | 3308 | |
201556f0 JJ |
3309 | @item -fmerge-constants |
3310 | Attempt to merge identical constants (string constants and floating point | |
3311 | constants) accross compilation units. | |
3312 | ||
3313 | This option is default for optimized compilation if assembler and linker | |
c21cd8b1 | 3314 | support it. Use @option{-fno-merge-constants} to inhibit this behavior. |
201556f0 JJ |
3315 | |
3316 | @item -fmerge-all-constants | |
3317 | Attempt to merge identical constants and identical variables. | |
3318 | ||
3319 | This option implies @option{-fmerge-constants}. In addition to | |
3320 | @option{-fmerge-constants} this considers e.g. even constant initialized | |
3321 | arrays or initialized constant variables with integral or floating point | |
3322 | types. Languages like C or C++ require each non-automatic variable to | |
3323 | have distinct location, so using this option will result in non-conforming | |
c21cd8b1 | 3324 | behavior. |
201556f0 | 3325 | |
74291a4b | 3326 | @item -fno-function-cse |
cd3bb277 | 3327 | @opindex fno-function-cse |
74291a4b MM |
3328 | Do not put function addresses in registers; make each instruction that |
3329 | calls a constant function contain the function's address explicitly. | |
3330 | ||
3331 | This option results in less efficient code, but some strange hacks | |
3332 | that alter the assembler output may be confused by the optimizations | |
3333 | performed when this option is not used. | |
3334 | ||
3335 | @item -ffast-math | |
cd3bb277 | 3336 | @opindex ffast-math |
9c34dbbf ZW |
3337 | Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, and @* |
3338 | @option{-fno-trapping-math}. | |
de6c5979 | 3339 | |
630d3d5a | 3340 | This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. |
74291a4b | 3341 | |
630d3d5a | 3342 | This option should never be turned on by any @option{-O} option since |
74291a4b | 3343 | it can result in incorrect output for programs which depend on |
c1030c7c | 3344 | an exact implementation of IEEE or ISO rules/specifications for |
74291a4b | 3345 | math functions. |
9605da8a BL |
3346 | |
3347 | @item -fno-math-errno | |
cd3bb277 | 3348 | @opindex fno-math-errno |
9605da8a BL |
3349 | Do not set ERRNO after calling math functions that are executed |
3350 | with a single instruction, e.g., sqrt. A program that relies on | |
3351 | IEEE exceptions for math error handling may want to use this flag | |
3352 | for speed while maintaining IEEE arithmetic compatibility. | |
3353 | ||
630d3d5a | 3354 | This option should never be turned on by any @option{-O} option since |
de6c5979 BL |
3355 | it can result in incorrect output for programs which depend on |
3356 | an exact implementation of IEEE or ISO rules/specifications for | |
3357 | math functions. | |
3358 | ||
9c34dbbf | 3359 | The default is @option{-fmath-errno}. |
de6c5979 BL |
3360 | |
3361 | @item -funsafe-math-optimizations | |
cd3bb277 | 3362 | @opindex funsafe-math-optimizations |
de6c5979 BL |
3363 | Allow optimizations for floating-point arithmetic that (a) assume |
3364 | that arguments and results are valid and (b) may violate IEEE or | |
237b14f7 RH |
3365 | ANSI standards. When used at link-time, it may include libraries |
3366 | or startup files that change the default FPU control word or other | |
3367 | similar optimizations. | |
de6c5979 | 3368 | |
630d3d5a | 3369 | This option should never be turned on by any @option{-O} option since |
de6c5979 BL |
3370 | it can result in incorrect output for programs which depend on |
3371 | an exact implementation of IEEE or ISO rules/specifications for | |
3372 | math functions. | |
3373 | ||
9c34dbbf | 3374 | The default is @option{-fno-unsafe-math-optimizations}. |
de6c5979 BL |
3375 | |
3376 | @item -fno-trapping-math | |
cd3bb277 | 3377 | @opindex fno-trapping-math |
de6c5979 BL |
3378 | Compile code assuming that floating-point operations cannot generate |
3379 | user-visible traps. Setting this option may allow faster code | |
3380 | if one relies on ``non-stop'' IEEE arithmetic, for example. | |
3381 | ||
630d3d5a | 3382 | This option should never be turned on by any @option{-O} option since |
de6c5979 BL |
3383 | it can result in incorrect output for programs which depend on |
3384 | an exact implementation of IEEE or ISO rules/specifications for | |
3385 | math functions. | |
3386 | ||
9c34dbbf | 3387 | The default is @option{-ftrapping-math}. |
74291a4b MM |
3388 | @end table |
3389 | ||
630d3d5a JM |
3390 | The following options control specific optimizations. The @option{-O2} |
3391 | option turns on all of these optimizations except @option{-funroll-loops} | |
3392 | and @option{-funroll-all-loops}. On most machines, the @option{-O} option | |
3393 | turns on the @option{-fthread-jumps} and @option{-fdelayed-branch} options, | |
74291a4b MM |
3394 | but specific machines may handle it differently. |
3395 | ||
3396 | You can use the following flags in the rare cases when ``fine-tuning'' | |
3397 | of optimizations to be performed is desired. | |
3398 | ||
9c34dbbf ZW |
3399 | Not all of the optimizations performed by GCC have @option{-f} options |
3400 | to control them. | |
3401 | ||
ad919812 | 3402 | @table @gcctabopt |
74291a4b | 3403 | @item -fstrength-reduce |
cd3bb277 | 3404 | @opindex fstrength-reduce |
74291a4b MM |
3405 | Perform the optimizations of loop strength reduction and |
3406 | elimination of iteration variables. | |
3407 | ||
3408 | @item -fthread-jumps | |
cd3bb277 | 3409 | @opindex fthread-jumps |
74291a4b MM |
3410 | Perform optimizations where we check to see if a jump branches to a |
3411 | location where another comparison subsumed by the first is found. If | |
3412 | so, the first branch is redirected to either the destination of the | |
3413 | second branch or a point immediately following it, depending on whether | |
3414 | the condition is known to be true or false. | |
3415 | ||
3416 | @item -fcse-follow-jumps | |
cd3bb277 | 3417 | @opindex fcse-follow-jumps |
74291a4b MM |
3418 | In common subexpression elimination, scan through jump instructions |
3419 | when the target of the jump is not reached by any other path. For | |
3420 | example, when CSE encounters an @code{if} statement with an | |
3421 | @code{else} clause, CSE will follow the jump when the condition | |
3422 | tested is false. | |
3423 | ||
3424 | @item -fcse-skip-blocks | |
cd3bb277 | 3425 | @opindex fcse-skip-blocks |
630d3d5a | 3426 | This is similar to @option{-fcse-follow-jumps}, but causes CSE to |
74291a4b MM |
3427 | follow jumps which conditionally skip over blocks. When CSE |
3428 | encounters a simple @code{if} statement with no else clause, | |
630d3d5a | 3429 | @option{-fcse-skip-blocks} causes CSE to follow the jump around the |
74291a4b MM |
3430 | body of the @code{if}. |
3431 | ||
3432 | @item -frerun-cse-after-loop | |
cd3bb277 | 3433 | @opindex frerun-cse-after-loop |
74291a4b MM |
3434 | Re-run common subexpression elimination after loop optimizations has been |
3435 | performed. | |
3436 | ||
6d6d0fa0 | 3437 | @item -frerun-loop-opt |
cd3bb277 | 3438 | @opindex frerun-loop-opt |
6d6d0fa0 JL |
3439 | Run the loop optimizer twice. |
3440 | ||
7506f491 | 3441 | @item -fgcse |
cd3bb277 | 3442 | @opindex fgcse |
7506f491 DE |
3443 | Perform a global common subexpression elimination pass. |
3444 | This pass also performs global constant and copy propagation. | |
3445 | ||
081ca317 BL |
3446 | @emph{Note:} When compiling a program using computed gotos, a GCC |
3447 | extension, you may get better runtime performance if you disable | |
3448 | the global common subexpression elmination pass by adding | |
3449 | @option{-fno-gcse} to the command line. | |
3450 | ||
a13d4ebf | 3451 | @item -fgcse-lm |
cd3bb277 | 3452 | @opindex fgcse-lm |
695ac33f | 3453 | When @option{-fgcse-lm} is enabled, global common subexpression elimination will |
767094dd | 3454 | attempt to move loads which are only killed by stores into themselves. This |
a13d4ebf | 3455 | allows a loop containing a load/store sequence to be changed to a load outside |
02f52e19 | 3456 | the loop, and a copy/store within the loop. |
a13d4ebf AM |
3457 | |
3458 | @item -fgcse-sm | |
cd3bb277 | 3459 | @opindex fgcse-sm |
695ac33f | 3460 | When @option{-fgcse-sm} is enabled, A store motion pass is run after global common |
767094dd | 3461 | subexpression elimination. This pass will attempt to move stores out of loops. |
695ac33f | 3462 | When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence |
a13d4ebf AM |
3463 | can be changed to a load before the loop and a store after the loop. |
3464 | ||
b6d24183 | 3465 | @item -fdelete-null-pointer-checks |
cd3bb277 | 3466 | @opindex fdelete-null-pointer-checks |
9c34dbbf ZW |
3467 | Use global dataflow analysis to identify and eliminate useless checks |
3468 | for null pointers. The compiler assumes that dereferencing a null | |
3469 | pointer would have halted the program. If a pointer is checked after | |
3470 | it has already been dereferenced, it cannot be null. | |
3471 | ||
3472 | In some environments, this assumption is not true, and programs can | |
3473 | safely dereference null pointers. Use | |
3474 | @option{-fno-delete-null-pointer-checks} to disable this optimization | |
3475 | for programs which depend on that behavior. | |
b6d24183 | 3476 | |
74291a4b | 3477 | @item -fexpensive-optimizations |
cd3bb277 | 3478 | @opindex fexpensive-optimizations |
74291a4b MM |
3479 | Perform a number of minor optimizations that are relatively expensive. |
3480 | ||
639726ba | 3481 | @item -foptimize-register-move |
59d40964 | 3482 | @itemx -fregmove |
cd3bb277 JM |
3483 | @opindex foptimize-register-move |
3484 | @opindex fregmove | |
9ec36da5 JL |
3485 | Attempt to reassign register numbers in move instructions and as |
3486 | operands of other simple instructions in order to maximize the amount of | |
56159047 | 3487 | register tying. This is especially helpful on machines with two-operand |
630d3d5a | 3488 | instructions. GCC enables this optimization by default with @option{-O2} |
9ec36da5 JL |
3489 | or higher. |
3490 | ||
bedc7537 | 3491 | Note @option{-fregmove} and @option{-foptimize-register-move} are the same |
9ec36da5 JL |
3492 | optimization. |
3493 | ||
74291a4b | 3494 | @item -fdelayed-branch |
cd3bb277 | 3495 | @opindex fdelayed-branch |
74291a4b MM |
3496 | If supported for the target machine, attempt to reorder instructions |
3497 | to exploit instruction slots available after delayed branch | |
3498 | instructions. | |
3499 | ||
3500 | @item -fschedule-insns | |
cd3bb277 | 3501 | @opindex fschedule-insns |
74291a4b MM |
3502 | If supported for the target machine, attempt to reorder instructions to |
3503 | eliminate execution stalls due to required data being unavailable. This | |
3504 | helps machines that have slow floating point or memory load instructions | |
3505 | by allowing other instructions to be issued until the result of the load | |
3506 | or floating point instruction is required. | |
3507 | ||
3508 | @item -fschedule-insns2 | |
cd3bb277 | 3509 | @opindex fschedule-insns2 |
630d3d5a | 3510 | Similar to @option{-fschedule-insns}, but requests an additional pass of |
74291a4b MM |
3511 | instruction scheduling after register allocation has been done. This is |
3512 | especially useful on machines with a relatively small number of | |
3513 | registers and where memory load instructions take more than one cycle. | |
3514 | ||
3515 | @item -ffunction-sections | |
59d40964 | 3516 | @itemx -fdata-sections |
cd3bb277 JM |
3517 | @opindex ffunction-sections |
3518 | @opindex fdata-sections | |
7d0756fb CM |
3519 | Place each function or data item into its own section in the output |
3520 | file if the target supports arbitrary sections. The name of the | |
3521 | function or the name of the data item determines the section's name | |
3522 | in the output file. | |
74291a4b | 3523 | |
7d0756fb | 3524 | Use these options on systems where the linker can perform optimizations |
74291a4b MM |
3525 | to improve locality of reference in the instruction space. HPPA |
3526 | processors running HP-UX and Sparc processors running Solaris 2 have | |
3527 | linkers with such optimizations. Other systems using the ELF object format | |
3528 | as well as AIX may have these optimizations in the future. | |
3529 | ||
7d0756fb CM |
3530 | Only use these options when there are significant benefits from doing |
3531 | so. When you specify these options, the assembler and linker will | |
74291a4b MM |
3532 | create larger object and executable files and will also be slower. |
3533 | You will not be able to use @code{gprof} on all systems if you | |
3534 | specify this option and you may have problems with debugging if | |
630d3d5a | 3535 | you specify both this option and @option{-g}. |
74291a4b MM |
3536 | |
3537 | @item -fcaller-saves | |
cd3bb277 | 3538 | @opindex fcaller-saves |
74291a4b MM |
3539 | Enable values to be allocated in registers that will be clobbered by |
3540 | function calls, by emitting extra instructions to save and restore the | |
3541 | registers around such calls. Such allocation is done only when it | |
3542 | seems to result in better code than would otherwise be produced. | |
3543 | ||
81610a0d HPN |
3544 | This option is always enabled by default on certain machines, usually |
3545 | those which have no call-preserved registers to use instead. | |
3546 | ||
3547 | For all machines, optimization level 2 and higher enables this flag by | |
3548 | default. | |
74291a4b MM |
3549 | |
3550 | @item -funroll-loops | |
cd3bb277 | 3551 | @opindex funroll-loops |
9c34dbbf ZW |
3552 | Unroll loops whose number of iterations can be determined at compile |
3553 | time or upon entry to the loop. @option{-funroll-loops} implies both | |
3554 | @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}. This | |
3555 | option makes code larger, and may or may not make it run faster. | |
74291a4b MM |
3556 | |
3557 | @item -funroll-all-loops | |
cd3bb277 | 3558 | @opindex funroll-all-loops |
9c34dbbf ZW |
3559 | Unroll all loops, even if their number of iterations is uncertain when |
3560 | the loop is entered. This usually makes programs run more slowly. | |
3561 | @option{-funroll-all-loops} implies the same options as | |
3562 | @option{-funroll-loops}, | |
3563 | ||
0dd0e980 JH |
3564 | @item -fprefetch-loop-arrays |
3565 | @opindex fprefetch-loop-arrays | |
3566 | If supported by the target machine, generate instructions to prefetch | |
3567 | memory to improve the performance of loops that access large arrays. | |
74291a4b | 3568 | |
e5eb27e5 | 3569 | @item -fmove-all-movables |
cd3bb277 | 3570 | @opindex fmove-all-movables |
e5eb27e5 JL |
3571 | Forces all invariant computations in loops to be moved |
3572 | outside the loop. | |
3573 | ||
3574 | @item -freduce-all-givs | |
cd3bb277 | 3575 | @opindex freduce-all-givs |
e5eb27e5 JL |
3576 | Forces all general-induction variables in loops to be |
3577 | strength-reduced. | |
3578 | ||
3579 | @emph{Note:} When compiling programs written in Fortran, | |
630d3d5a | 3580 | @option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled |
e5eb27e5 JL |
3581 | by default when you use the optimizer. |
3582 | ||
3583 | These options may generate better or worse code; results are highly | |
3584 | dependent on the structure of loops within the source code. | |
3585 | ||
3586 | These two options are intended to be removed someday, once | |
3587 | they have helped determine the efficacy of various | |
3588 | approaches to improving loop optimizations. | |
3589 | ||
2642624b | 3590 | Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}}) |
e5eb27e5 JL |
3591 | know how use of these options affects |
3592 | the performance of your production code. | |
3593 | We're very interested in code that runs @emph{slower} | |
3594 | when these options are @emph{enabled}. | |
3595 | ||
74291a4b | 3596 | @item -fno-peephole |
6cfc0341 | 3597 | @itemx -fno-peephole2 |
cd3bb277 | 3598 | @opindex fno-peephole |
6cfc0341 RH |
3599 | @opindex fno-peephole2 |
3600 | Disable any machine-specific peephole optimizations. The difference | |
630d3d5a | 3601 | between @option{-fno-peephole} and @option{-fno-peephole2} is in how they |
6cfc0341 RH |
3602 | are implemented in the compiler; some targets use one, some use the |
3603 | other, a few use both. | |
861bb6c1 JL |
3604 | |
3605 | @item -fbranch-probabilities | |
cd3bb277 | 3606 | @opindex fbranch-probabilities |
630d3d5a | 3607 | After running a program compiled with @option{-fprofile-arcs} |
861bb6c1 | 3608 | (@pxref{Debugging Options,, Options for Debugging Your Program or |
bedc7537 | 3609 | @command{gcc}}), you can compile it a second time using |
630d3d5a | 3610 | @option{-fbranch-probabilities}, to improve optimizations based on |
3de87bf2 JJ |
3611 | the number of times each branch was taken. When the program |
3612 | compiled with @option{-fprofile-arcs} exits it saves arc execution | |
3613 | counts to a file called @file{@var{sourcename}.da} for each source | |
3614 | file The information in this data file is very dependent on the | |
3615 | structure of the generated code, so you must use the same source code | |
3616 | and the same optimization options for both compilations. | |
861bb6c1 | 3617 | |
630d3d5a | 3618 | With @option{-fbranch-probabilities}, GCC puts a @samp{REG_EXEC_COUNT} |
861bb6c1 JL |
3619 | note on the first instruction of each basic block, and a |
3620 | @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. | |
3621 | These can be used to improve optimization. Currently, they are only | |
3622 | used in one place: in @file{reorg.c}, instead of guessing which path a | |
3623 | branch is mostly to take, the @samp{REG_BR_PROB} values are used to | |
3624 | exactly determine which path is taken more often. | |
8c660648 | 3625 | |
454d0cc7 | 3626 | @item -fno-guess-branch-probability |
cd3bb277 | 3627 | @opindex fno-guess-branch-probability |
9c34dbbf ZW |
3628 | Do not guess branch probabilities using a randomized model. |
3629 | ||
3630 | Sometimes gcc will opt to use a randomized model to guess branch | |
3631 | probabilities, when none are available from either profiling feedback | |
3632 | (@option{-fprofile-arcs}) or @samp{__builtin_expect}. This means that | |
3633 | different runs of the compiler on the same program may produce different | |
3634 | object code. | |
3635 | ||
3636 | In a hard real-time system, people don't want different runs of the | |
3637 | compiler to produce code that has different behavior; minimizing | |
3638 | non-determinism is of paramount import. This switch allows users to | |
3639 | reduce non-determinism, possibly at the expense of inferior | |
3640 | optimization. | |
454d0cc7 | 3641 | |
41472af8 | 3642 | @item -fstrict-aliasing |
cd3bb277 | 3643 | @opindex fstrict-aliasing |
41472af8 MM |
3644 | Allows the compiler to assume the strictest aliasing rules applicable to |
3645 | the language being compiled. For C (and C++), this activates | |
3646 | optimizations based on the type of expressions. In particular, an | |
3647 | object of one type is assumed never to reside at the same address as an | |
3648 | object of a different type, unless the types are almost the same. For | |
3649 | example, an @code{unsigned int} can alias an @code{int}, but not a | |
3650 | @code{void*} or a @code{double}. A character type may alias any other | |
02f52e19 | 3651 | type. |
41472af8 MM |
3652 | |
3653 | Pay special attention to code like this: | |
3654 | @example | |
02f52e19 | 3655 | union a_union @{ |
41472af8 MM |
3656 | int i; |
3657 | double d; | |
3658 | @}; | |
3659 | ||
3660 | int f() @{ | |
3661 | a_union t; | |
3662 | t.d = 3.0; | |
3663 | return t.i; | |
3664 | @} | |
3665 | @end example | |
3666 | The practice of reading from a different union member than the one most | |
3667 | recently written to (called ``type-punning'') is common. Even with | |
630d3d5a | 3668 | @option{-fstrict-aliasing}, type-punning is allowed, provided the memory |
41472af8 MM |
3669 | is accessed through the union type. So, the code above will work as |
3670 | expected. However, this code might not: | |
3671 | @example | |
02f52e19 | 3672 | int f() @{ |
41472af8 MM |
3673 | a_union t; |
3674 | int* ip; | |
3675 | t.d = 3.0; | |
3676 | ip = &t.i; | |
3677 | return *ip; | |
3678 | @} | |
3679 | @end example | |
3680 | ||
41472af8 MM |
3681 | Every language that wishes to perform language-specific alias analysis |
3682 | should define a function that computes, given an @code{tree} | |
3683 | node, an alias set for the node. Nodes in different alias sets are not | |
3684 | allowed to alias. For an example, see the C front-end function | |
3685 | @code{c_get_alias_set}. | |
41472af8 | 3686 | |
efa3896a GK |
3687 | @item -falign-functions |
3688 | @itemx -falign-functions=@var{n} | |
cd3bb277 | 3689 | @opindex falign-functions |
efa3896a GK |
3690 | Align the start of functions to the next power-of-two greater than |
3691 | @var{n}, skipping up to @var{n} bytes. For instance, | |
630d3d5a JM |
3692 | @option{-falign-functions=32} aligns functions to the next 32-byte |
3693 | boundary, but @option{-falign-functions=24} would align to the next | |
efa3896a GK |
3694 | 32-byte boundary only if this can be done by skipping 23 bytes or less. |
3695 | ||
630d3d5a | 3696 | @option{-fno-align-functions} and @option{-falign-functions=1} are |
efa3896a GK |
3697 | equivalent and mean that functions will not be aligned. |
3698 | ||
3699 | Some assemblers only support this flag when @var{n} is a power of two; | |
3700 | in that case, it is rounded up. | |
3701 | ||
3702 | If @var{n} is not specified, use a machine-dependent default. | |
3703 | ||
3704 | @item -falign-labels | |
3705 | @itemx -falign-labels=@var{n} | |
cd3bb277 | 3706 | @opindex falign-labels |
efa3896a | 3707 | Align all branch targets to a power-of-two boundary, skipping up to |
630d3d5a | 3708 | @var{n} bytes like @option{-falign-functions}. This option can easily |
efa3896a GK |
3709 | make code slower, because it must insert dummy operations for when the |
3710 | branch target is reached in the usual flow of the code. | |
3711 | ||
630d3d5a | 3712 | If @option{-falign-loops} or @option{-falign-jumps} are applicable and |
efa3896a GK |
3713 | are greater than this value, then their values are used instead. |
3714 | ||
3715 | If @var{n} is not specified, use a machine-dependent default which is | |
3716 | very likely to be @samp{1}, meaning no alignment. | |
3717 | ||
3718 | @item -falign-loops | |
3719 | @itemx -falign-loops=@var{n} | |
cd3bb277 | 3720 | @opindex falign-loops |
efa3896a | 3721 | Align loops to a power-of-two boundary, skipping up to @var{n} bytes |
630d3d5a | 3722 | like @option{-falign-functions}. The hope is that the loop will be |
efa3896a GK |
3723 | executed many times, which will make up for any execution of the dummy |
3724 | operations. | |
3725 | ||
3726 | If @var{n} is not specified, use a machine-dependent default. | |
3727 | ||
3728 | @item -falign-jumps | |
3729 | @itemx -falign-jumps=@var{n} | |
cd3bb277 | 3730 | @opindex falign-jumps |
efa3896a GK |
3731 | Align branch targets to a power-of-two boundary, for branch targets |
3732 | where the targets can only be reached by jumping, skipping up to @var{n} | |
630d3d5a | 3733 | bytes like @option{-falign-functions}. In this case, no dummy operations |
efa3896a GK |
3734 | need be executed. |
3735 | ||
3736 | If @var{n} is not specified, use a machine-dependent default. | |
3737 | ||
4bae0b47 | 3738 | @item -fssa |
cd3bb277 | 3739 | @opindex fssa |
4bae0b47 AS |
3740 | Perform optimizations in static single assignment form. Each function's |
3741 | flow graph is translated into SSA form, optimizations are performed, and | |
90ecce3e | 3742 | the flow graph is translated back from SSA form. Users should not |
b53978a3 JO |
3743 | specify this option, since it is not yet ready for production use. |
3744 | ||
0b47e4c1 JL |
3745 | @item -fssa-ccp |
3746 | @opindex fssa-ccp | |
3747 | Perform Sparse Conditional Constant Propagation in SSA form. Requires | |
3748 | @option{-fssa}. Like @option{-fssa}, this is an experimental feature. | |
3749 | ||
62d285ff JL |
3750 | @item -fssa-dce |
3751 | @opindex fssa-dce | |
3752 | Perform aggressive dead-code elimination in SSA form. Requires @option{-fssa}. | |
3753 | Like @option{-fssa}, this is an experimental feature. | |
4bae0b47 | 3754 | |
46d3a873 | 3755 | @item -fsingle-precision-constant |
cd3bb277 | 3756 | @opindex fsingle-precision-constant |
46d3a873 CC |
3757 | Treat floating point constant as single precision constant instead of |
3758 | implicitly converting it to double precision constant. | |
3759 | ||
2b2a8f1f | 3760 | @item -frename-registers |
cd3bb277 | 3761 | @opindex frename-registers |
c771326b | 3762 | Attempt to avoid false dependencies in scheduled code by making use |
2b2a8f1f RH |
3763 | of registers left over after register allocation. This optimization |
3764 | will most benefit processors with lots of registers. It can, however, | |
3765 | make debugging impossible, since variables will no longer stay in | |
3766 | a ``home register''. | |
3af64fd6 | 3767 | |
8582c27b RH |
3768 | @item -fno-cprop-registers |
3769 | @opindex fno-cprop-registers | |
3770 | After register allocation and post-register allocation instruction splitting, | |
3771 | we perform a copy-propagation pass to try to reduce scheduling dependencies | |
3772 | and occasionally eliminate the copy. | |
3773 | ||
3af64fd6 | 3774 | @item --param @var{name}=@var{value} |
cd3bb277 | 3775 | @opindex param |
3af64fd6 MM |
3776 | In some places, GCC uses various constants to control the amount of |
3777 | optimization that is done. For example, GCC will not inline functions | |
3778 | that contain more that a certain number of instructions. You can | |
3779 | control some of these constants on the command-line using the | |
630d3d5a | 3780 | @option{--param} option. |
3af64fd6 | 3781 | |
4fe9b91c | 3782 | In each case, the @var{value} is an integer. The allowable choices for |
3af64fd6 MM |
3783 | @var{name} are given in the following table: |
3784 | ||
3785 | @table @gcctabopt | |
1c4c47db JO |
3786 | @item max-delay-slot-insn-search |
3787 | The maximum number of instructions to consider when looking for an | |
3788 | instruction to fill a delay slot. If more than this arbitrary number of | |
3789 | instructions is searched, the time savings from filling the delay slot | |
3790 | will be minimal so stop searching. Increasing values mean more | |
3791 | aggressive optimization, making the compile time increase with probably | |
3792 | small improvement in executable run time. | |
3793 | ||
3794 | @item max-delay-slot-live-search | |
3795 | When trying to fill delay slots, the maximum number of instructions to | |
3796 | consider when searching for a block with valid live register | |
3797 | information. Increasing this arbitrarily chosen value means more | |
3798 | aggressive optimization, increasing the compile time. This parameter | |
3799 | should be removed when the delay slot code is rewritten to maintain the | |
3800 | control-flow graph. | |
33d3b05b MM |
3801 | |
3802 | @item max-gcse-memory | |
3803 | The approximate maximum amount of memory that will be allocated in | |
3804 | order to perform the global common subexpression elimination | |
3805 | optimization. If more memory than specified is required, the | |
3806 | optimization will not be done. | |
3af64fd6 | 3807 | |
740f35a0 | 3808 | @item max-gcse-passes |
7dac2f89 | 3809 | The maximum number of passes of GCSE to run. |
740f35a0 | 3810 | |
4a121cc3 | 3811 | @item max-pending-list-length |
0c688a7d | 3812 | The maximum number of pending dependencies scheduling will allow |
4a121cc3 AM |
3813 | before flushing the current state and starting over. Large functions |
3814 | with few branches or calls can create excessively large lists which | |
3815 | needlessly consume memory and resources. | |
3816 | ||
1c4c47db JO |
3817 | @item max-inline-insns |
3818 | If an function contains more than this many instructions, it | |
3819 | will not be inlined. This option is precisely equivalent to | |
630d3d5a | 3820 | @option{-finline-limit}. |
1c4c47db JO |
3821 | |
3822 | @end table | |
74291a4b MM |
3823 | @end table |
3824 | ||
3825 | @node Preprocessor Options | |
3826 | @section Options Controlling the Preprocessor | |
3827 | @cindex preprocessor options | |
3828 | @cindex options, preprocessor | |
3829 | ||
3830 | These options control the C preprocessor, which is run on each C source | |
3831 | file before actual compilation. | |
3832 | ||
630d3d5a JM |
3833 | If you use the @option{-E} option, nothing is done except preprocessing. |
3834 | Some of these options make sense only together with @option{-E} because | |
74291a4b MM |
3835 | they cause the preprocessor output to be unsuitable for actual |
3836 | compilation. | |
3837 | ||
2642624b | 3838 | @table @gcctabopt |
74291a4b | 3839 | @item -include @var{file} |
cd3bb277 | 3840 | @opindex include |
74291a4b | 3841 | Process @var{file} as input before processing the regular input file. |
630d3d5a JM |
3842 | In effect, the contents of @var{file} are compiled first. Any @option{-D} |
3843 | and @option{-U} options on the command line are always processed before | |
3844 | @option{-include @var{file}}, regardless of the order in which they are | |
3845 | written. All the @option{-include} and @option{-imacros} options are | |
74291a4b MM |
3846 | processed in the order in which they are written. |
3847 | ||
3848 | @item -imacros @var{file} | |
cd3bb277 | 3849 | @opindex imacros |
74291a4b MM |
3850 | Process @var{file} as input, discarding the resulting output, before |
3851 | processing the regular input file. Because the output generated from | |
630d3d5a | 3852 | @var{file} is discarded, the only effect of @option{-imacros @var{file}} |
74291a4b | 3853 | is to make the macros defined in @var{file} available for use in the |
630d3d5a | 3854 | main input. All the @option{-include} and @option{-imacros} options are |
e582248c | 3855 | processed in the order in which they are written. |
74291a4b MM |
3856 | |
3857 | @item -idirafter @var{dir} | |
cd3bb277 | 3858 | @opindex idirafter |
74291a4b MM |
3859 | @cindex second include path |
3860 | Add the directory @var{dir} to the second include path. The directories | |
3861 | on the second include path are searched when a header file is not found | |
3862 | in any of the directories in the main include path (the one that | |
630d3d5a | 3863 | @option{-I} adds to). |
74291a4b MM |
3864 | |
3865 | @item -iprefix @var{prefix} | |
cd3bb277 | 3866 | @opindex iprefix |
630d3d5a | 3867 | Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix} |
74291a4b MM |
3868 | options. |
3869 | ||
3870 | @item -iwithprefix @var{dir} | |
cd3bb277 | 3871 | @opindex iwithprefix |
74291a4b MM |
3872 | Add a directory to the second include path. The directory's name is |
3873 | made by concatenating @var{prefix} and @var{dir}, where @var{prefix} was | |
630d3d5a | 3874 | specified previously with @option{-iprefix}. If you have not specified a |
74291a4b MM |
3875 | prefix yet, the directory containing the installed passes of the |
3876 | compiler is used as the default. | |
3877 | ||
3878 | @item -iwithprefixbefore @var{dir} | |
cd3bb277 | 3879 | @opindex iwithprefixbefore |
74291a4b MM |
3880 | Add a directory to the main include path. The directory's name is made |
3881 | by concatenating @var{prefix} and @var{dir}, as in the case of | |
630d3d5a | 3882 | @option{-iwithprefix}. |
74291a4b MM |
3883 | |
3884 | @item -isystem @var{dir} | |
cd3bb277 | 3885 | @opindex isystem |
74291a4b MM |
3886 | Add a directory to the beginning of the second include path, marking it |
3887 | as a system directory, so that it gets the same special treatment as | |
3888 | is applied to the standard system directories. | |
3889 | ||
3890 | @item -nostdinc | |
cd3bb277 | 3891 | @opindex nostdinc |
74291a4b | 3892 | Do not search the standard system directories for header files. Only |
630d3d5a | 3893 | the directories you have specified with @option{-I} options (and the |
74291a4b | 3894 | current directory, if appropriate) are searched. @xref{Directory |
630d3d5a | 3895 | Options}, for information on @option{-I}. |
74291a4b | 3896 | |
dfb5868d NS |
3897 | By using both @option{-nostdinc} and @option{-I-}, you can limit the include-file |
3898 | search path to only those directories you specify explicitly. | |
74291a4b | 3899 | |
e582248c | 3900 | @item -remap |
cd3bb277 | 3901 | @opindex remap |
e582248c NB |
3902 | When searching for a header file in a directory, remap file names if a |
3903 | file named @file{header.gcc} exists in that directory. This can be used | |
3904 | to work around limitations of file systems with file name restrictions. | |
3905 | The @file{header.gcc} file should contain a series of lines with two | |
3906 | tokens on each line: the first token is the name to map, and the second | |
3907 | token is the actual name to use. | |
3908 | ||
74291a4b | 3909 | @item -undef |
cd3bb277 | 3910 | @opindex undef |
74291a4b MM |
3911 | Do not predefine any nonstandard macros. (Including architecture flags). |
3912 | ||
3913 | @item -E | |
cd3bb277 | 3914 | @opindex E |
74291a4b MM |
3915 | Run only the C preprocessor. Preprocess all the C source files |
3916 | specified and output the results to standard output or to the | |
3917 | specified output file. | |
3918 | ||
3919 | @item -C | |
cd3bb277 | 3920 | @opindex C |
74291a4b | 3921 | Tell the preprocessor not to discard comments. Used with the |
630d3d5a | 3922 | @option{-E} option. |
74291a4b MM |
3923 | |
3924 | @item -P | |
cd3bb277 | 3925 | @opindex P |
74291a4b | 3926 | Tell the preprocessor not to generate @samp{#line} directives. |
630d3d5a | 3927 | Used with the @option{-E} option. |
74291a4b MM |
3928 | |
3929 | @cindex make | |
3930 | @cindex dependencies, make | |
3931 | @item -M | |
cd3bb277 | 3932 | @opindex M |
e582248c NB |
3933 | Instead of outputting the result of preprocessing, output a rule |
3934 | suitable for @code{make} describing the dependencies of the main source | |
3935 | file. The preprocessor outputs one @code{make} rule containing the | |
3936 | object file name for that source file, a colon, and the names of all the | |
48ce6bbb NS |
3937 | included files. Unless overridden explicitly, the object file name |
3938 | consists of the basename of the source file with any suffix replaced with | |
767094dd | 3939 | object file suffix. If there are many included files then the |
48ce6bbb | 3940 | rule is split into several lines using @samp{\}-newline. |
74291a4b | 3941 | |
630d3d5a | 3942 | @option{-M} implies @option{-E}. |
74291a4b | 3943 | |
e582248c | 3944 | @item -MM |
cd3bb277 | 3945 | @opindex MM |
630d3d5a | 3946 | Like @option{-M}, but mention only the files included with @samp{#include |
e582248c NB |
3947 | "@var{file}"}. System header files included with @samp{#include |
3948 | <@var{file}>} are omitted. | |
3949 | ||
7da723ef | 3950 | @item -MD |
cd3bb277 | 3951 | @opindex MD |
630d3d5a | 3952 | Like @option{-M} but the dependency information is written to a file |
7da723ef | 3953 | rather than stdout. @code{gcc} will use the same file name and |
695ac33f | 3954 | directory as the object file, but with the suffix @file{.d} instead. |
7da723ef | 3955 | |
630d3d5a JM |
3956 | This is in addition to compiling the main file as specified---@option{-MD} |
3957 | does not inhibit ordinary compilation the way @option{-M} does, | |
3958 | unless you also specify @option{-MG}. | |
7da723ef NB |
3959 | |
3960 | With Mach, you can use the utility @code{md} to merge multiple | |
3961 | dependency files into a single dependency file suitable for using with | |
3962 | the @samp{make} command. | |
3963 | ||
d396403a | 3964 | @item -MMD |
cd3bb277 | 3965 | @opindex MMD |
630d3d5a | 3966 | Like @option{-MD} except mention only user header files, not system |
7da723ef NB |
3967 | -header files. |
3968 | ||
e582248c | 3969 | @item -MF @var{file} |
cd3bb277 | 3970 | @opindex MF |
630d3d5a | 3971 | When used with @option{-M} or @option{-MM}, specifies a file to write the |
e582248c | 3972 | dependencies to. This allows the preprocessor to write the preprocessed |
630d3d5a | 3973 | file to stdout normally. If no @option{-MF} switch is given, CPP sends |
e582248c NB |
3974 | the rules to stdout and suppresses normal preprocessed output. |
3975 | ||
74291a4b | 3976 | Another way to specify output of a @code{make} rule is by setting |
bedc7537 | 3977 | the environment variable @env{DEPENDENCIES_OUTPUT} (@pxref{Environment |
74291a4b MM |
3978 | Variables}). |
3979 | ||
74291a4b | 3980 | @item -MG |
cd3bb277 | 3981 | @opindex MG |
630d3d5a | 3982 | When used with @option{-M} or @option{-MM}, @option{-MG} says to treat missing |
e582248c NB |
3983 | header files as generated files and assume they live in the same |
3984 | directory as the source file. It suppresses preprocessed output, as a | |
3985 | missing header file is ordinarily an error. | |
3986 | ||
3987 | This feature is used in automatic updating of makefiles. | |
3988 | ||
3989 | @item -MP | |
cd3bb277 | 3990 | @opindex MP |
e582248c NB |
3991 | This option instructs CPP to add a phony target for each dependency |
3992 | other than the main file, causing each to depend on nothing. These | |
3993 | dummy rules work around errors @code{make} gives if you remove header | |
3994 | files without updating the @code{Makefile} to match. | |
3995 | ||
3996 | This is typical output:- | |
3997 | ||
3998 | @smallexample | |
3999 | /tmp/test.o: /tmp/test.c /tmp/test.h | |
4000 | ||
4001 | /tmp/test.h: | |
4002 | @end smallexample | |
4003 | ||
4004 | @item -MQ @var{target} | |
4005 | @item -MT @var{target} | |
cd3bb277 JM |
4006 | @opindex MQ |
4007 | @opindex MT | |
e582248c NB |
4008 | By default CPP uses the main file name, including any path, and appends |
4009 | the object suffix, normally ``.o'', to it to obtain the name of the | |
630d3d5a | 4010 | target for dependency generation. With @option{-MT} you can specify a |
e582248c NB |
4011 | target yourself, overriding the default one. |
4012 | ||
4013 | If you want multiple targets, you can specify them as a single argument | |
630d3d5a | 4014 | to @option{-MT}, or use multiple @option{-MT} options. |
e582248c NB |
4015 | |
4016 | The targets you specify are output in the order they appear on the | |
630d3d5a JM |
4017 | command line. @option{-MQ} is identical to @option{-MT}, except that the |
4018 | target name is quoted for Make, but with @option{-MT} it isn't. For | |
4019 | example, @option{-MT '$(objpfx)foo.o'} gives | |
e582248c NB |
4020 | |
4021 | @smallexample | |
4022 | $(objpfx)foo.o: /tmp/foo.c | |
4023 | @end smallexample | |
4024 | ||
630d3d5a | 4025 | but @option{-MQ '$(objpfx)foo.o'} gives |
e582248c NB |
4026 | |
4027 | @smallexample | |
4028 | $$(objpfx)foo.o: /tmp/foo.c | |
4029 | @end smallexample | |
4030 | ||
4031 | The default target is automatically quoted, as if it were given with | |
630d3d5a | 4032 | @option{-MQ}. |
74291a4b MM |
4033 | |
4034 | @item -H | |
cd3bb277 | 4035 | @opindex H |
74291a4b MM |
4036 | Print the name of each header file used, in addition to other normal |
4037 | activities. | |
4038 | ||
4039 | @item -A@var{question}(@var{answer}) | |
cd3bb277 | 4040 | @opindex A |
74291a4b MM |
4041 | Assert the answer @var{answer} for @var{question}, in case it is tested |
4042 | with a preprocessing conditional such as @samp{#if | |
630d3d5a | 4043 | #@var{question}(@var{answer})}. @option{-A-} disables the standard |
74291a4b MM |
4044 | assertions that normally describe the target machine. |
4045 | ||
4046 | @item -D@var{macro} | |
cd3bb277 | 4047 | @opindex D |
74291a4b MM |
4048 | Define macro @var{macro} with the string @samp{1} as its definition. |
4049 | ||
4050 | @item -D@var{macro}=@var{defn} | |
630d3d5a JM |
4051 | Define macro @var{macro} as @var{defn}. All instances of @option{-D} on |
4052 | the command line are processed before any @option{-U} options. | |
74291a4b | 4053 | |
630d3d5a JM |
4054 | Any @option{-D} and @option{-U} options on the command line are processed in |
4055 | order, and always before @option{-imacros @var{file}}, regardless of the | |
e582248c NB |
4056 | order in which they are written. |
4057 | ||
74291a4b | 4058 | @item -U@var{macro} |
cd3bb277 | 4059 | @opindex U |
630d3d5a JM |
4060 | Undefine macro @var{macro}. @option{-U} options are evaluated after all |
4061 | @option{-D} options, but before any @option{-include} and @option{-imacros} | |
74291a4b MM |
4062 | options. |
4063 | ||
630d3d5a JM |
4064 | Any @option{-D} and @option{-U} options on the command line are processed in |
4065 | order, and always before @option{-imacros @var{file}}, regardless of the | |
e582248c NB |
4066 | order in which they are written. |
4067 | ||
74291a4b | 4068 | @item -dM |
cd3bb277 | 4069 | @opindex dM |
74291a4b | 4070 | Tell the preprocessor to output only a list of the macro definitions |
630d3d5a | 4071 | that are in effect at the end of preprocessing. Used with the @option{-E} |
74291a4b MM |
4072 | option. |
4073 | ||
4074 | @item -dD | |
cd3bb277 | 4075 | @opindex dD |
74291a4b MM |
4076 | Tell the preprocessing to pass all macro definitions into the output, in |
4077 | their proper sequence in the rest of the output. | |
4078 | ||
4079 | @item -dN | |
cd3bb277 | 4080 | @opindex dN |
630d3d5a | 4081 | Like @option{-dD} except that the macro arguments and contents are omitted. |
74291a4b MM |
4082 | Only @samp{#define @var{name}} is included in the output. |
4083 | ||
e582248c | 4084 | @item -dI |
cd3bb277 | 4085 | @opindex dI |
e582248c NB |
4086 | Output @samp{#include} directives in addition to the result of |
4087 | preprocessing. | |
4088 | ||
3bce8a01 NB |
4089 | @item -fpreprocessed |
4090 | @opindex fpreprocessed | |
4091 | Indicate to the preprocessor that the input file has already been | |
4092 | preprocessed. This suppresses things like macro expansion, trigraph | |
4093 | conversion, escaped newline splicing, and processing of most directives. | |
6d34c1c4 NB |
4094 | The preprocessor still recognizes and removes comments, so that you can |
4095 | pass a file preprocessed with @option{-C} to the compiler without | |
4096 | problems. In this mode the integrated preprocessor is little more than | |
4097 | a tokenizer for the front ends. | |
3bce8a01 | 4098 | |
630d3d5a | 4099 | @option{-fpreprocessed} is implicit if the input file has one of the |
6d34c1c4 NB |
4100 | extensions @samp{i}, @samp{ii} or @samp{mi}. These are the extensions |
4101 | that GCC uses for preprocessed files created by @option{-save-temps}. | |
3bce8a01 | 4102 | |
74291a4b | 4103 | @item -trigraphs |
cd3bb277 | 4104 | @opindex trigraphs |
e582248c NB |
4105 | Process ISO standard trigraph sequences. These are three-character |
4106 | sequences, all starting with @samp{??}, that are defined by ISO C to | |
4107 | stand for single characters. For example, @samp{??/} stands for | |
4108 | @samp{\}, so @samp{'??/n'} is a character constant for a newline. By | |
4109 | default, GCC ignores trigraphs, but in standard-conforming modes it | |
630d3d5a | 4110 | converts them. See the @option{-std} and @option{-ansi} options. |
e582248c NB |
4111 | |
4112 | The nine trigraph sequences are | |
4113 | @table @samp | |
4114 | @item ??( | |
aee96fe9 | 4115 | @expansion{} @samp{[} |
e582248c NB |
4116 | |
4117 | @item ??) | |
aee96fe9 | 4118 | @expansion{} @samp{]} |
e582248c NB |
4119 | |
4120 | @item ??< | |
aee96fe9 | 4121 | @expansion{} @samp{@{} |
e582248c NB |
4122 | |
4123 | @item ??> | |
aee96fe9 | 4124 | @expansion{} @samp{@}} |
e582248c NB |
4125 | |
4126 | @item ??= | |
aee96fe9 | 4127 | @expansion{} @samp{#} |
e582248c NB |
4128 | |
4129 | @item ??/ | |
aee96fe9 | 4130 | @expansion{} @samp{\} |
e582248c NB |
4131 | |
4132 | @item ??' | |
aee96fe9 | 4133 | @expansion{} @samp{^} |
e582248c NB |
4134 | |
4135 | @item ??! | |
aee96fe9 | 4136 | @expansion{} @samp{|} |
e582248c NB |
4137 | |
4138 | @item ??- | |
aee96fe9 | 4139 | @expansion{} @samp{~} |
e582248c NB |
4140 | |
4141 | @end table | |
4142 | ||
4143 | Trigraph support is not popular, so many compilers do not implement it | |
4144 | properly. Portable code should not rely on trigraphs being either | |
4145 | converted or ignored. | |
74291a4b | 4146 | |
aee96fe9 | 4147 | @item -Wp,@var{option} |
cd3bb277 | 4148 | @opindex Wp |
bedc7537 | 4149 | Pass @var{option} as an option to the preprocessor. If @var{option} |
74291a4b MM |
4150 | contains commas, it is split into multiple options at the commas. |
4151 | @end table | |
4152 | ||
4153 | @node Assembler Options | |
4154 | @section Passing Options to the Assembler | |
4155 | ||
4156 | @c prevent bad page break with this line | |
4157 | You can pass options to the assembler. | |
4158 | ||
2642624b | 4159 | @table @gcctabopt |
aee96fe9 | 4160 | @item -Wa,@var{option} |
cd3bb277 | 4161 | @opindex Wa |
74291a4b MM |
4162 | Pass @var{option} as an option to the assembler. If @var{option} |
4163 | contains commas, it is split into multiple options at the commas. | |
4164 | @end table | |
4165 | ||
4166 | @node Link Options | |
4167 | @section Options for Linking | |
4168 | @cindex link options | |
4169 | @cindex options, linking | |
4170 | ||
4171 | These options come into play when the compiler links object files into | |
4172 | an executable output file. They are meaningless if the compiler is | |
4173 | not doing a link step. | |
4174 | ||
2642624b | 4175 | @table @gcctabopt |
74291a4b MM |
4176 | @cindex file names |
4177 | @item @var{object-file-name} | |
4178 | A file name that does not end in a special recognized suffix is | |
4179 | considered to name an object file or library. (Object files are | |
4180 | distinguished from libraries by the linker according to the file | |
4181 | contents.) If linking is done, these object files are used as input | |
4182 | to the linker. | |
4183 | ||
4184 | @item -c | |
4185 | @itemx -S | |
4186 | @itemx -E | |
cd3bb277 JM |
4187 | @opindex c |
4188 | @opindex S | |
4189 | @opindex E | |
74291a4b MM |
4190 | If any of these options is used, then the linker is not run, and |
4191 | object file names should not be used as arguments. @xref{Overall | |
4192 | Options}. | |
4193 | ||
4194 | @cindex Libraries | |
4195 | @item -l@var{library} | |
4275c4c4 | 4196 | @itemx -l @var{library} |
cd3bb277 | 4197 | @opindex l |
4275c4c4 JS |
4198 | Search the library named @var{library} when linking. (The second |
4199 | alternative with the library as a separate argument is only for | |
4200 | POSIX compliance and is not recommended.) | |
74291a4b MM |
4201 | |
4202 | It makes a difference where in the command you write this option; the | |
4275c4c4 | 4203 | linker searches and processes libraries and object files in the order they |
74291a4b MM |
4204 | are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} |
4205 | after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers | |
4206 | to functions in @samp{z}, those functions may not be loaded. | |
4207 | ||
4208 | The linker searches a standard list of directories for the library, | |
4209 | which is actually a file named @file{lib@var{library}.a}. The linker | |
4210 | then uses this file as if it had been specified precisely by name. | |
4211 | ||
4212 | The directories searched include several standard system directories | |
630d3d5a | 4213 | plus any that you specify with @option{-L}. |
74291a4b MM |
4214 | |
4215 | Normally the files found this way are library files---archive files | |
4216 | whose members are object files. The linker handles an archive file by | |
4217 | scanning through it for members which define symbols that have so far | |
4218 | been referenced but not defined. But if the file that is found is an | |
4219 | ordinary object file, it is linked in the usual fashion. The only | |
630d3d5a JM |
4220 | difference between using an @option{-l} option and specifying a file name |
4221 | is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} | |
74291a4b MM |
4222 | and searches several directories. |
4223 | ||
4224 | @item -lobjc | |
cd3bb277 | 4225 | @opindex lobjc |
630d3d5a | 4226 | You need this special case of the @option{-l} option in order to |
2147b154 | 4227 | link an Objective-C program. |
74291a4b MM |
4228 | |
4229 | @item -nostartfiles | |
cd3bb277 | 4230 | @opindex nostartfiles |
74291a4b | 4231 | Do not use the standard system startup files when linking. |
bedc7537 NC |
4232 | The standard system libraries are used normally, unless @option{-nostdlib} |
4233 | or @option{-nodefaultlibs} is used. | |
74291a4b MM |
4234 | |
4235 | @item -nodefaultlibs | |
cd3bb277 | 4236 | @opindex nodefaultlibs |
74291a4b MM |
4237 | Do not use the standard system libraries when linking. |
4238 | Only the libraries you specify will be passed to the linker. | |
bedc7537 | 4239 | The standard startup files are used normally, unless @option{-nostartfiles} |
4754172c | 4240 | is used. The compiler may generate calls to memcmp, memset, and memcpy |
c1030c7c | 4241 | for System V (and ISO C) environments or to bcopy and bzero for |
4754172c CM |
4242 | BSD environments. These entries are usually resolved by entries in |
4243 | libc. These entry points should be supplied through some other | |
4244 | mechanism when this option is specified. | |
74291a4b MM |
4245 | |
4246 | @item -nostdlib | |
cd3bb277 | 4247 | @opindex nostdlib |
74291a4b MM |
4248 | Do not use the standard system startup files or libraries when linking. |
4249 | No startup files and only the libraries you specify will be passed to | |
767094dd | 4250 | the linker. The compiler may generate calls to memcmp, memset, and memcpy |
c1030c7c | 4251 | for System V (and ISO C) environments or to bcopy and bzero for |
4754172c CM |
4252 | BSD environments. These entries are usually resolved by entries in |
4253 | libc. These entry points should be supplied through some other | |
4254 | mechanism when this option is specified. | |
74291a4b | 4255 | |
630d3d5a JM |
4256 | @cindex @option{-lgcc}, use with @option{-nostdlib} |
4257 | @cindex @option{-nostdlib} and unresolved references | |
4258 | @cindex unresolved references and @option{-nostdlib} | |
4259 | @cindex @option{-lgcc}, use with @option{-nodefaultlibs} | |
4260 | @cindex @option{-nodefaultlibs} and unresolved references | |
4261 | @cindex unresolved references and @option{-nodefaultlibs} | |
4262 | One of the standard libraries bypassed by @option{-nostdlib} and | |
4263 | @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines | |
0c2d1a2a | 4264 | that GCC uses to overcome shortcomings of particular machines, or special |
74291a4b | 4265 | needs for some languages. |
b11cc610 JM |
4266 | (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler |
4267 | Collection (GCC) Internals}, | |
74291a4b | 4268 | for more discussion of @file{libgcc.a}.) |
74291a4b | 4269 | In most cases, you need @file{libgcc.a} even when you want to avoid |
630d3d5a JM |
4270 | other standard libraries. In other words, when you specify @option{-nostdlib} |
4271 | or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. | |
0c2d1a2a | 4272 | This ensures that you have no unresolved references to internal GCC |
74291a4b | 4273 | library subroutines. (For example, @samp{__main}, used to ensure C++ |
b11cc610 JM |
4274 | constructors will be called; @pxref{Collect2,,@code{collect2}, gccint, |
4275 | GNU Compiler Collection (GCC) Internals}.) | |
74291a4b MM |
4276 | |
4277 | @item -s | |
cd3bb277 | 4278 | @opindex s |
74291a4b MM |
4279 | Remove all symbol table and relocation information from the executable. |
4280 | ||
4281 | @item -static | |
cd3bb277 | 4282 | @opindex static |
74291a4b MM |
4283 | On systems that support dynamic linking, this prevents linking with the shared |
4284 | libraries. On other systems, this option has no effect. | |
4285 | ||
4286 | @item -shared | |
cd3bb277 | 4287 | @opindex shared |
74291a4b | 4288 | Produce a shared object which can then be linked with other objects to |
1d3b0e2c | 4289 | form an executable. Not all systems support this option. For predictable |
02f52e19 | 4290 | results, you must also specify the same set of options that were used to |
630d3d5a | 4291 | generate code (@option{-fpic}, @option{-fPIC}, or model suboptions) |
2642624b | 4292 | when you specify this option.@footnote{On some systems, @samp{gcc -shared} |
767094dd | 4293 | needs to build supplementary stub code for constructors to work. On |
2642624b | 4294 | multi-libbed systems, @samp{gcc -shared} must select the correct support |
1d3b0e2c | 4295 | libraries to link against. Failing to supply the correct flags may lead |
767094dd | 4296 | to subtle defects. Supplying them in cases where they are not necessary |
1d3b0e2c | 4297 | is innocuous.} |
74291a4b | 4298 | |
9db0819e RH |
4299 | @item -shared-libgcc |
4300 | @itemx -static-libgcc | |
cd3bb277 JM |
4301 | @opindex shared-libgcc |
4302 | @opindex static-libgcc | |
9db0819e RH |
4303 | On systems that provide @file{libgcc} as a shared library, these options |
4304 | force the use of either the shared or static version respectively. | |
4305 | If no shared version of @file{libgcc} was built when the compiler was | |
4306 | configured, these options have no effect. | |
4307 | ||
4308 | There are several situations in which an application should use the | |
4309 | shared @file{libgcc} instead of the static version. The most common | |
4310 | of these is when the application wishes to throw and catch exceptions | |
4311 | across different shared libraries. In that case, each of the libraries | |
4312 | as well as the application itself should use the shared @file{libgcc}. | |
4313 | ||
630d3d5a JM |
4314 | Therefore, whenever you specify the @option{-shared} option, the GCC |
4315 | driver automatically adds @option{-shared-libgcc}, unless you explicitly | |
4316 | specify @option{-static-libgcc}. The G++ driver automatically adds | |
4317 | @option{-shared-libgcc} when you build a main executable as well because | |
049f6ec9 MM |
4318 | for C++ programs that is typically the right thing to do. |
4319 | (Exception-handling will not work reliably otherwise.) | |
4320 | ||
4321 | However, when linking a main executable written in C, you must | |
630d3d5a | 4322 | explicitly say @option{-shared-libgcc} if you want to use the shared |
049f6ec9 | 4323 | @file{libgcc}. |
9db0819e | 4324 | |
74291a4b | 4325 | @item -symbolic |
cd3bb277 | 4326 | @opindex symbolic |
74291a4b MM |
4327 | Bind references to global symbols when building a shared object. Warn |
4328 | about any unresolved references (unless overridden by the link editor | |
4329 | option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support | |
4330 | this option. | |
4331 | ||
4332 | @item -Xlinker @var{option} | |
cd3bb277 | 4333 | @opindex Xlinker |
74291a4b | 4334 | Pass @var{option} as an option to the linker. You can use this to |
0c2d1a2a | 4335 | supply system-specific linker options which GCC does not know how to |
74291a4b MM |
4336 | recognize. |
4337 | ||
4338 | If you want to pass an option that takes an argument, you must use | |
630d3d5a JM |
4339 | @option{-Xlinker} twice, once for the option and once for the argument. |
4340 | For example, to pass @option{-assert definitions}, you must write | |
74291a4b | 4341 | @samp{-Xlinker -assert -Xlinker definitions}. It does not work to write |
630d3d5a | 4342 | @option{-Xlinker "-assert definitions"}, because this passes the entire |
74291a4b MM |
4343 | string as a single argument, which is not what the linker expects. |
4344 | ||
aee96fe9 | 4345 | @item -Wl,@var{option} |
cd3bb277 | 4346 | @opindex Wl |
74291a4b MM |
4347 | Pass @var{option} as an option to the linker. If @var{option} contains |
4348 | commas, it is split into multiple options at the commas. | |
4349 | ||
4350 | @item -u @var{symbol} | |
cd3bb277 | 4351 | @opindex u |
74291a4b | 4352 | Pretend the symbol @var{symbol} is undefined, to force linking of |
630d3d5a | 4353 | library modules to define it. You can use @option{-u} multiple times with |
74291a4b MM |
4354 | different symbols to force loading of additional library modules. |
4355 | @end table | |
4356 | ||
4357 | @node Directory Options | |
4358 | @section Options for Directory Search | |
4359 | @cindex directory options | |
4360 | @cindex options, directory search | |
4361 | @cindex search path | |
4362 | ||
4363 | These options specify directories to search for header files, for | |
4364 | libraries and for parts of the compiler: | |
4365 | ||
2642624b | 4366 | @table @gcctabopt |
74291a4b | 4367 | @item -I@var{dir} |
cd3bb277 | 4368 | @opindex I |
861bb6c1 JL |
4369 | Add the directory @var{dir} to the head of the list of directories to be |
4370 | searched for header files. This can be used to override a system header | |
4371 | file, substituting your own version, since these directories are | |
d0a5eb32 RK |
4372 | searched before the system header file directories. However, you should |
4373 | not use this option to add directories that contain vendor-supplied | |
767094dd | 4374 | system header files (use @option{-isystem} for that). If you use more than |
630d3d5a | 4375 | one @option{-I} option, the directories are scanned in left-to-right |
74291a4b MM |
4376 | order; the standard system directories come after. |
4377 | ||
dbead49c NS |
4378 | If a standard system include directory, or a directory specified with |
4379 | @option{-isystem}, is also specified with @option{-I}, it will be | |
4380 | searched only in the position requested by @option{-I}. Also, it will | |
4381 | not be considered a system include directory. If that directory really | |
4382 | does contain system headers, there is a good chance that they will | |
4383 | break. For instance, if GCC's installation procedure edited the headers | |
4384 | in @file{/usr/include} to fix bugs, @samp{-I/usr/include} will cause the | |
4385 | original, buggy headers to be found instead of the corrected ones. GCC | |
4386 | will issue a warning when a system include directory is hidden in this | |
4387 | way. | |
4388 | ||
74291a4b | 4389 | @item -I- |
cd3bb277 | 4390 | @opindex I- |
630d3d5a | 4391 | Any directories you specify with @option{-I} options before the @option{-I-} |
74291a4b MM |
4392 | option are searched only for the case of @samp{#include "@var{file}"}; |
4393 | they are not searched for @samp{#include <@var{file}>}. | |
4394 | ||
630d3d5a JM |
4395 | If additional directories are specified with @option{-I} options after |
4396 | the @option{-I-}, these directories are searched for all @samp{#include} | |
4397 | directives. (Ordinarily @emph{all} @option{-I} directories are used | |
74291a4b MM |
4398 | this way.) |
4399 | ||
630d3d5a | 4400 | In addition, the @option{-I-} option inhibits the use of the current |
74291a4b MM |
4401 | directory (where the current input file came from) as the first search |
4402 | directory for @samp{#include "@var{file}"}. There is no way to | |
630d3d5a | 4403 | override this effect of @option{-I-}. With @option{-I.} you can specify |
74291a4b MM |
4404 | searching the directory which was current when the compiler was |
4405 | invoked. That is not exactly the same as what the preprocessor does | |
4406 | by default, but it is often satisfactory. | |
4407 | ||
630d3d5a JM |
4408 | @option{-I-} does not inhibit the use of the standard system directories |
4409 | for header files. Thus, @option{-I-} and @option{-nostdinc} are | |
74291a4b MM |
4410 | independent. |
4411 | ||
4412 | @item -L@var{dir} | |
cd3bb277 | 4413 | @opindex L |
74291a4b | 4414 | Add directory @var{dir} to the list of directories to be searched |
630d3d5a | 4415 | for @option{-l}. |
74291a4b MM |
4416 | |
4417 | @item -B@var{prefix} | |
cd3bb277 | 4418 | @opindex B |
74291a4b MM |
4419 | This option specifies where to find the executables, libraries, |
4420 | include files, and data files of the compiler itself. | |
4421 | ||
4422 | The compiler driver program runs one or more of the subprograms | |
4423 | @file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries | |
4424 | @var{prefix} as a prefix for each program it tries to run, both with and | |
4425 | without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). | |
4426 | ||
4427 | For each subprogram to be run, the compiler driver first tries the | |
630d3d5a | 4428 | @option{-B} prefix, if any. If that name is not found, or if @option{-B} |
74291a4b MM |
4429 | was not specified, the driver tries two standard prefixes, which are |
4430 | @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}. If neither of | |
4431 | those results in a file name that is found, the unmodified program | |
4432 | name is searched for using the directories specified in your | |
bedc7537 | 4433 | @env{PATH} environment variable. |
74291a4b | 4434 | |
07804c3b NC |
4435 | The compiler will check to see if the path provided by the @option{-B} |
4436 | refers to a directory, and if necessary it will add a directory | |
4437 | separator character at the end of the path. | |
4438 | ||
630d3d5a | 4439 | @option{-B} prefixes that effectively specify directory names also apply |
74291a4b | 4440 | to libraries in the linker, because the compiler translates these |
630d3d5a | 4441 | options into @option{-L} options for the linker. They also apply to |
74291a4b | 4442 | includes files in the preprocessor, because the compiler translates these |
630d3d5a | 4443 | options into @option{-isystem} options for the preprocessor. In this case, |
74291a4b MM |
4444 | the compiler appends @samp{include} to the prefix. |
4445 | ||
4446 | The run-time support file @file{libgcc.a} can also be searched for using | |
630d3d5a | 4447 | the @option{-B} prefix, if needed. If it is not found there, the two |
74291a4b MM |
4448 | standard prefixes above are tried, and that is all. The file is left |
4449 | out of the link if it is not found by those means. | |
4450 | ||
630d3d5a | 4451 | Another way to specify a prefix much like the @option{-B} prefix is to use |
bedc7537 | 4452 | the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment |
74291a4b | 4453 | Variables}. |
861bb6c1 | 4454 | |
07804c3b | 4455 | As a special kludge, if the path provided by @option{-B} is |
bf4eebe0 NC |
4456 | @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to |
4457 | 9, then it will be replaced by @file{[dir/]include}. This is to help | |
7dac2f89 | 4458 | with boot-strapping the compiler. |
07804c3b | 4459 | |
861bb6c1 | 4460 | @item -specs=@var{file} |
cd3bb277 | 4461 | @opindex specs |
861bb6c1 JL |
4462 | Process @var{file} after the compiler reads in the standard @file{specs} |
4463 | file, in order to override the defaults that the @file{gcc} driver | |
4464 | program uses when determining what switches to pass to @file{cc1}, | |
4465 | @file{cc1plus}, @file{as}, @file{ld}, etc. More than one | |
630d3d5a | 4466 | @option{-specs=@var{file}} can be specified on the command line, and they |
861bb6c1 | 4467 | are processed in order, from left to right. |
74291a4b MM |
4468 | @end table |
4469 | ||
ee457005 JM |
4470 | @c man end |
4471 | ||
a743d340 NC |
4472 | @node Spec Files |
4473 | @section Specifying subprocesses and the switches to pass to them | |
4474 | @cindex Spec Files | |
bedc7537 | 4475 | @command{gcc} is a driver program. It performs its job by invoking a |
a743d340 NC |
4476 | sequence of other programs to do the work of compiling, assembling and |
4477 | linking. GCC interprets its command-line parameters and uses these to | |
4478 | deduce which programs it should invoke, and which command-line options | |
c21cd8b1 | 4479 | it ought to place on their command lines. This behavior is controlled |
a743d340 NC |
4480 | by @dfn{spec strings}. In most cases there is one spec string for each |
4481 | program that GCC can invoke, but a few programs have multiple spec | |
c21cd8b1 | 4482 | strings to control their behavior. The spec strings built into GCC can |
630d3d5a | 4483 | be overridden by using the @option{-specs=} command-line switch to specify |
a743d340 NC |
4484 | a spec file. |
4485 | ||
4486 | @dfn{Spec files} are plaintext files that are used to construct spec | |
4487 | strings. They consist of a sequence of directives separated by blank | |
4488 | lines. The type of directive is determined by the first non-whitespace | |
4489 | character on the line and it can be one of the following: | |
4490 | ||
4491 | @table @code | |
4492 | @item %@var{command} | |
4493 | Issues a @var{command} to the spec file processor. The commands that can | |
02f52e19 | 4494 | appear here are: |
a743d340 NC |
4495 | |
4496 | @table @code | |
4497 | @item %include <@var{file}> | |
4498 | @cindex %include | |
4499 | Search for @var{file} and insert its text at the current point in the | |
4500 | specs file. | |
4501 | ||
4502 | @item %include_noerr <@var{file}> | |
4503 | @cindex %include_noerr | |
4504 | Just like @samp{%include}, but do not generate an error message if the include | |
4505 | file cannot be found. | |
4506 | ||
4507 | @item %rename @var{old_name} @var{new_name} | |
4508 | @cindex %rename | |
4509 | Rename the spec string @var{old_name} to @var{new_name}. | |
4510 | ||
4511 | @end table | |
4512 | ||
4513 | @item *[@var{spec_name}]: | |
4514 | This tells the compiler to create, override or delete the named spec | |
4515 | string. All lines after this directive up to the next directive or | |
4516 | blank line are considered to be the text for the spec string. If this | |
4517 | results in an empty string then the spec will be deleted. (Or, if the | |
4518 | spec did not exist, then nothing will happened.) Otherwise, if the spec | |
4519 | does not currently exist a new spec will be created. If the spec does | |
4520 | exist then its contents will be overridden by the text of this | |
4521 | directive, unless the first character of that text is the @samp{+} | |
4522 | character, in which case the text will be appended to the spec. | |
4523 | ||
4524 | @item [@var{suffix}]: | |
4525 | Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive | |
4526 | and up to the next directive or blank line are considered to make up the | |
02f52e19 | 4527 | spec string for the indicated suffix. When the compiler encounters an |
a743d340 NC |
4528 | input file with the named suffix, it will processes the spec string in |
4529 | order to work out how to compile that file. For example: | |
4530 | ||
4531 | @smallexample | |
4532 | .ZZ: | |
4533 | z-compile -input %i | |
4534 | @end smallexample | |
4535 | ||
4536 | This says that any input file whose name ends in @samp{.ZZ} should be | |
4537 | passed to the program @samp{z-compile}, which should be invoked with the | |
630d3d5a | 4538 | command-line switch @option{-input} and with the result of performing the |
a743d340 NC |
4539 | @samp{%i} substitution. (See below.) |
4540 | ||
4541 | As an alternative to providing a spec string, the text that follows a | |
4542 | suffix directive can be one of the following: | |
4543 | ||
4544 | @table @code | |
4545 | @item @@@var{language} | |
4546 | This says that the suffix is an alias for a known @var{language}. This is | |
bedc7537 | 4547 | similar to using the @option{-x} command-line switch to GCC to specify a |
a743d340 NC |
4548 | language explicitly. For example: |
4549 | ||
4550 | @smallexample | |
4551 | .ZZ: | |
4552 | @@c++ | |
4553 | @end smallexample | |
4554 | ||
4555 | Says that .ZZ files are, in fact, C++ source files. | |
4556 | ||
4557 | @item #@var{name} | |
4558 | This causes an error messages saying: | |
4559 | ||
4560 | @smallexample | |
4561 | @var{name} compiler not installed on this system. | |
4562 | @end smallexample | |
4563 | @end table | |
4564 | ||
4565 | GCC already has an extensive list of suffixes built into it. | |
4566 | This directive will add an entry to the end of the list of suffixes, but | |
4567 | since the list is searched from the end backwards, it is effectively | |
4568 | possible to override earlier entries using this technique. | |
4569 | ||
4570 | @end table | |
4571 | ||
4572 | GCC has the following spec strings built into it. Spec files can | |
4573 | override these strings or create their own. Note that individual | |
02f52e19 | 4574 | targets can also add their own spec strings to this list. |
a743d340 NC |
4575 | |
4576 | @smallexample | |
4577 | asm Options to pass to the assembler | |
4578 | asm_final Options to pass to the assembler post-processor | |
4579 | cpp Options to pass to the C preprocessor | |
4580 | cc1 Options to pass to the C compiler | |
4581 | cc1plus Options to pass to the C++ compiler | |
4582 | endfile Object files to include at the end of the link | |
4583 | link Options to pass to the linker | |
4584 | lib Libraries to include on the command line to the linker | |
4585 | libgcc Decides which GCC support library to pass to the linker | |
4586 | linker Sets the name of the linker | |
4587 | predefines Defines to be passed to the C preprocessor | |
310668e8 JM |
4588 | signed_char Defines to pass to CPP to say whether @code{char} is signed |
4589 | by default | |
a743d340 NC |
4590 | startfile Object files to include at the start of the link |
4591 | @end smallexample | |
4592 | ||
4593 | Here is a small example of a spec file: | |
4594 | ||
4595 | @smallexample | |
4596 | %rename lib old_lib | |
4597 | ||
4598 | *lib: | |
4599 | --start-group -lgcc -lc -leval1 --end-group %(old_lib) | |
4600 | @end smallexample | |
4601 | ||
4602 | This example renames the spec called @samp{lib} to @samp{old_lib} and | |
4603 | then overrides the previous definition of @samp{lib} with a new one. | |
4604 | The new definition adds in some extra command-line options before | |
4605 | including the text of the old definition. | |
4606 | ||
4607 | @dfn{Spec strings} are a list of command-line options to be passed to their | |
4608 | corresponding program. In addition, the spec strings can contain | |
4609 | @samp{%}-prefixed sequences to substitute variable text or to | |
4610 | conditionally insert text into the command line. Using these constructs | |
4611 | it is possible to generate quite complex command lines. | |
4612 | ||
4613 | Here is a table of all defined @samp{%}-sequences for spec | |
4614 | strings. Note that spaces are not generated automatically around the | |
4615 | results of expanding these sequences. Therefore you can concatenate them | |
02f52e19 | 4616 | together or combine them with constant text in a single argument. |
a743d340 NC |
4617 | |
4618 | @table @code | |
4619 | @item %% | |
4620 | Substitute one @samp{%} into the program name or argument. | |
4621 | ||
4622 | @item %i | |
4623 | Substitute the name of the input file being processed. | |
4624 | ||
4625 | @item %b | |
4626 | Substitute the basename of the input file being processed. | |
4627 | This is the substring up to (and not including) the last period | |
4628 | and not including the directory. | |
4629 | ||
371e300b NC |
4630 | @item %B |
4631 | This is the same as @samp{%b}, but include the file suffix (text after | |
4632 | the last period). | |
4633 | ||
a743d340 NC |
4634 | @item %d |
4635 | Marks the argument containing or following the @samp{%d} as a | |
4636 | temporary file name, so that that file will be deleted if GCC exits | |
4637 | successfully. Unlike @samp{%g}, this contributes no text to the | |
02f52e19 | 4638 | argument. |
a743d340 NC |
4639 | |
4640 | @item %g@var{suffix} | |
4641 | Substitute a file name that has suffix @var{suffix} and is chosen | |
4642 | once per compilation, and mark the argument in the same way as | |
4643 | @samp{%d}. To reduce exposure to denial-of-service attacks, the file | |
02f52e19 | 4644 | name is now chosen in a way that is hard to predict even when previously |
695ac33f | 4645 | chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} |
a743d340 NC |
4646 | might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches |
4647 | the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is | |
4648 | treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} | |
4649 | was simply substituted with a file name chosen once per compilation, | |
4650 | without regard to any appended suffix (which was therefore treated | |
4651 | just like ordinary text), making such attacks more likely to succeed. | |
4652 | ||
4653 | @item %u@var{suffix} | |
4654 | Like @samp{%g}, but generates a new temporary file name even if | |
4655 | @samp{%u@var{suffix}} was already seen. | |
4656 | ||
4657 | @item %U@var{suffix} | |
4658 | Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a | |
4659 | new one if there is no such last file name. In the absence of any | |
4660 | @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share | |
695ac33f | 4661 | the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} |
a743d340 NC |
4662 | would involve the generation of two distinct file names, one |
4663 | for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was | |
4664 | simply substituted with a file name chosen for the previous @samp{%u}, | |
4665 | without regard to any appended suffix. | |
4666 | ||
371e300b | 4667 | @item %j@var{SUFFIX} |
aee96fe9 | 4668 | Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is |
371e300b NC |
4669 | writable, and if save-temps is off; otherwise, substitute the name |
4670 | of a temporary file, just like @samp{%u}. This temporary file is not | |
4671 | meant for communication between processes, but rather as a junk | |
4672 | disposal mechanism. | |
4673 | ||
4674 | @item %.@var{SUFFIX} | |
4675 | Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args | |
767094dd | 4676 | when it is subsequently output with @samp{%*}. @var{SUFFIX} is |
371e300b NC |
4677 | terminated by the next space or %. |
4678 | ||
a743d340 NC |
4679 | @item %w |
4680 | Marks the argument containing or following the @samp{%w} as the | |
4681 | designated output file of this compilation. This puts the argument | |
4682 | into the sequence of arguments that @samp{%o} will substitute later. | |
4683 | ||
4684 | @item %o | |
4685 | Substitutes the names of all the output files, with spaces | |
4686 | automatically placed around them. You should write spaces | |
4687 | around the @samp{%o} as well or the results are undefined. | |
4688 | @samp{%o} is for use in the specs for running the linker. | |
4689 | Input files whose names have no recognized suffix are not compiled | |
4690 | at all, but they are included among the output files, so they will | |
4691 | be linked. | |
4692 | ||
4693 | @item %O | |
4694 | Substitutes the suffix for object files. Note that this is | |
4695 | handled specially when it immediately follows @samp{%g, %u, or %U}, | |
4696 | because of the need for those to form complete file names. The | |
4697 | handling is such that @samp{%O} is treated exactly as if it had already | |
4698 | been substituted, except that @samp{%g, %u, and %U} do not currently | |
4699 | support additional @var{suffix} characters following @samp{%O} as they would | |
4700 | following, for example, @samp{.o}. | |
4701 | ||
4702 | @item %p | |
4703 | Substitutes the standard macro predefinitions for the | |
4704 | current target machine. Use this when running @code{cpp}. | |
4705 | ||
4706 | @item %P | |
4707 | Like @samp{%p}, but puts @samp{__} before and after the name of each | |
4708 | predefined macro, except for macros that start with @samp{__} or with | |
c1030c7c | 4709 | @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO |
161d7b59 | 4710 | C@. |
a743d340 NC |
4711 | |
4712 | @item %I | |
aee96fe9 | 4713 | Substitute a @option{-iprefix} option made from @env{GCC_EXEC_PREFIX}. |
a743d340 NC |
4714 | |
4715 | @item %s | |
4716 | Current argument is the name of a library or startup file of some sort. | |
4717 | Search for that file in a standard list of directories and substitute | |
02f52e19 | 4718 | the full name found. |
a743d340 NC |
4719 | |
4720 | @item %e@var{str} | |
4721 | Print @var{str} as an error message. @var{str} is terminated by a newline. | |
4722 | Use this when inconsistent options are detected. | |
4723 | ||
4724 | @item %| | |
4725 | Output @samp{-} if the input for the current command is coming from a pipe. | |
4726 | ||
4727 | @item %(@var{name}) | |
4728 | Substitute the contents of spec string @var{name} at this point. | |
4729 | ||
4730 | @item %[@var{name}] | |
630d3d5a | 4731 | Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments. |
a743d340 NC |
4732 | |
4733 | @item %x@{@var{option}@} | |
4734 | Accumulate an option for @samp{%X}. | |
4735 | ||
4736 | @item %X | |
630d3d5a | 4737 | Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} |
a743d340 NC |
4738 | spec string. |
4739 | ||
4740 | @item %Y | |
630d3d5a | 4741 | Output the accumulated assembler options specified by @option{-Wa}. |
a743d340 NC |
4742 | |
4743 | @item %Z | |
630d3d5a | 4744 | Output the accumulated preprocessor options specified by @option{-Wp}. |
a743d340 NC |
4745 | |
4746 | @item %v1 | |
161d7b59 | 4747 | Substitute the major version number of GCC@. |
a743d340 NC |
4748 | (For version 2.9.5, this is 2.) |
4749 | ||
4750 | @item %v2 | |
161d7b59 | 4751 | Substitute the minor version number of GCC@. |
a743d340 NC |
4752 | (For version 2.9.5, this is 9.) |
4753 | ||
371e300b | 4754 | @item %v3 |
161d7b59 | 4755 | Substitute the patch level number of GCC@. |
371e300b NC |
4756 | (For version 2.9.5, this is 5.) |
4757 | ||
a743d340 NC |
4758 | @item %a |
4759 | Process the @code{asm} spec. This is used to compute the | |
4760 | switches to be passed to the assembler. | |
4761 | ||
4762 | @item %A | |
4763 | Process the @code{asm_final} spec. This is a spec string for | |
4764 | passing switches to an assembler post-processor, if such a program is | |
4765 | needed. | |
4766 | ||
4767 | @item %l | |
4768 | Process the @code{link} spec. This is the spec for computing the | |
4769 | command line passed to the linker. Typically it will make use of the | |
4770 | @samp{%L %G %S %D and %E} sequences. | |
4771 | ||
4772 | @item %D | |
630d3d5a | 4773 | Dump out a @option{-L} option for each directory that GCC believes might |
a743d340 | 4774 | contain startup files. If the target supports multilibs then the |
02f52e19 | 4775 | current multilib directory will be prepended to each of these paths. |
a743d340 | 4776 | |
371e300b | 4777 | @item %M |
c771326b | 4778 | Output the multilib directory with directory separators replaced with |
695ac33f JM |
4779 | @samp{_}. If multilib directories are not set, or the multilib directory is |
4780 | @file{.} then this option emits nothing. | |
371e300b | 4781 | |
a743d340 NC |
4782 | @item %L |
4783 | Process the @code{lib} spec. This is a spec string for deciding which | |
02f52e19 | 4784 | libraries should be included on the command line to the linker. |
a743d340 NC |
4785 | |
4786 | @item %G | |
4787 | Process the @code{libgcc} spec. This is a spec string for deciding | |
02f52e19 | 4788 | which GCC support library should be included on the command line to the linker. |
a743d340 NC |
4789 | |
4790 | @item %S | |
4791 | Process the @code{startfile} spec. This is a spec for deciding which | |
4792 | object files should be the first ones passed to the linker. Typically | |
02f52e19 | 4793 | this might be a file named @file{crt0.o}. |
a743d340 NC |
4794 | |
4795 | @item %E | |
4796 | Process the @code{endfile} spec. This is a spec string that specifies | |
02f52e19 | 4797 | the last object files that will be passed to the linker. |
a743d340 NC |
4798 | |
4799 | @item %C | |
4800 | Process the @code{cpp} spec. This is used to construct the arguments | |
4801 | to be passed to the C preprocessor. | |
4802 | ||
4803 | @item %c | |
4804 | Process the @code{signed_char} spec. This is intended to be used | |
02f52e19 | 4805 | to tell cpp whether a char is signed. It typically has the definition: |
a743d340 NC |
4806 | @smallexample |
4807 | %@{funsigned-char:-D__CHAR_UNSIGNED__@} | |
4808 | @end smallexample | |
4809 | ||
4810 | @item %1 | |
4811 | Process the @code{cc1} spec. This is used to construct the options to be | |
4812 | passed to the actual C compiler (@samp{cc1}). | |
4813 | ||
4814 | @item %2 | |
4815 | Process the @code{cc1plus} spec. This is used to construct the options to be | |
4816 | passed to the actual C++ compiler (@samp{cc1plus}). | |
4817 | ||
4818 | @item %* | |
4819 | Substitute the variable part of a matched option. See below. | |
4820 | Note that each comma in the substituted string is replaced by | |
4821 | a single space. | |
4822 | ||
4823 | @item %@{@code{S}@} | |
161d7b59 | 4824 | Substitutes the @code{-S} switch, if that switch was given to GCC@. |
a743d340 NC |
4825 | If that switch was not specified, this substitutes nothing. Note that |
4826 | the leading dash is omitted when specifying this option, and it is | |
4827 | automatically inserted if the substitution is performed. Thus the spec | |
630d3d5a JM |
4828 | string @samp{%@{foo@}} would match the command-line option @option{-foo} |
4829 | and would output the command line option @option{-foo}. | |
a743d340 NC |
4830 | |
4831 | @item %W@{@code{S}@} | |
4832 | Like %@{@code{S}@} but mark last argument supplied within as a file to be | |
02f52e19 | 4833 | deleted on failure. |
a743d340 NC |
4834 | |
4835 | @item %@{@code{S}*@} | |
4836 | Substitutes all the switches specified to GCC whose names start | |
4837 | with @code{-S}, but which also take an argument. This is used for | |
695ac33f | 4838 | switches like @option{-o}, @option{-D}, @option{-I}, etc. |
630d3d5a | 4839 | GCC considers @option{-o foo} as being |
a743d340 | 4840 | one switch whose names starts with @samp{o}. %@{o*@} would substitute this |
02f52e19 | 4841 | text, including the space. Thus two arguments would be generated. |
a743d340 NC |
4842 | |
4843 | @item %@{^@code{S}*@} | |
4844 | Like %@{@code{S}*@}, but don't put a blank between a switch and its | |
4845 | argument. Thus %@{^o*@} would only generate one argument, not two. | |
4846 | ||
371e300b NC |
4847 | @item %@{@code{S}*&@code{T}*@} |
4848 | Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options | |
4849 | (the order of @code{S} and @code{T} in the spec is not significant). | |
4850 | There can be any number of ampersand-separated variables; for each the | |
4851 | wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. | |
4852 | ||
d630442f | 4853 | @item %@{<@code{S}@} |
695ac33f | 4854 | Remove all occurrences of @code{-S} from the command line. Note---this |
d630442f | 4855 | command is position dependent. @samp{%} commands in the spec string |
50c57e7b | 4856 | before this option will see @code{-S}, @samp{%} commands in the spec |
d630442f NC |
4857 | string after this option will not. |
4858 | ||
a743d340 NC |
4859 | @item %@{@code{S}*:@code{X}@} |
4860 | Substitutes @code{X} if one or more switches whose names start with | |
161d7b59 | 4861 | @code{-S} are specified to GCC@. Note that the tail part of the |
e979f9e8 | 4862 | @code{-S} option (i.e.@: the part matched by the @samp{*}) will be substituted |
02f52e19 | 4863 | for each occurrence of @samp{%*} within @code{X}. |
a743d340 NC |
4864 | |
4865 | @item %@{@code{S}:@code{X}@} | |
161d7b59 | 4866 | Substitutes @code{X}, but only if the @samp{-S} switch was given to GCC@. |
a743d340 NC |
4867 | |
4868 | @item %@{!@code{S}:@code{X}@} | |
161d7b59 | 4869 | Substitutes @code{X}, but only if the @samp{-S} switch was @emph{not} given to GCC@. |
a743d340 NC |
4870 | |
4871 | @item %@{|@code{S}:@code{X}@} | |
4872 | Like %@{@code{S}:@code{X}@}, but if no @code{S} switch, substitute @samp{-}. | |
4873 | ||
4874 | @item %@{|!@code{S}:@code{X}@} | |
4875 | Like %@{!@code{S}:@code{X}@}, but if there is an @code{S} switch, substitute @samp{-}. | |
4876 | ||
4877 | @item %@{.@code{S}:@code{X}@} | |
4878 | Substitutes @code{X}, but only if processing a file with suffix @code{S}. | |
4879 | ||
4880 | @item %@{!.@code{S}:@code{X}@} | |
4881 | Substitutes @code{X}, but only if @emph{not} processing a file with suffix @code{S}. | |
4882 | ||
4883 | @item %@{@code{S}|@code{P}:@code{X}@} | |
161d7b59 | 4884 | Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. This may be |
a743d340 NC |
4885 | combined with @samp{!} and @samp{.} sequences as well, although they |
4886 | have a stronger binding than the @samp{|}. For example a spec string | |
4887 | like this: | |
4888 | ||
4889 | @smallexample | |
4890 | %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} | |
4891 | @end smallexample | |
4892 | ||
4893 | will output the following command-line options from the following input | |
4894 | command-line options: | |
4895 | ||
4896 | @smallexample | |
4897 | fred.c -foo -baz | |
4898 | jim.d -bar -boggle | |
4899 | -d fred.c -foo -baz -boggle | |
4900 | -d jim.d -bar -baz -boggle | |
4901 | @end smallexample | |
4902 | ||
4903 | @end table | |
4904 | ||
4905 | The conditional text @code{X} in a %@{@code{S}:@code{X}@} or | |
4906 | %@{!@code{S}:@code{X}@} construct may contain other nested @samp{%} constructs | |
4907 | or spaces, or even newlines. They are processed as usual, as described | |
02f52e19 | 4908 | above. |
a743d340 | 4909 | |
695ac33f JM |
4910 | The @option{-O}, @option{-f}, @option{-m}, and @option{-W} |
4911 | switches are handled specifically in these | |
630d3d5a JM |
4912 | constructs. If another value of @option{-O} or the negated form of a @option{-f}, @option{-m}, or |
4913 | @option{-W} switch is found later in the command line, the earlier switch | |
a743d340 NC |
4914 | value is ignored, except with @{@code{S}*@} where @code{S} is just one |
4915 | letter, which passes all matching options. | |
4916 | ||
4917 | The character @samp{|} at the beginning of the predicate text is used to indicate | |
630d3d5a | 4918 | that a command should be piped to the following command, but only if @option{-pipe} |
a743d340 NC |
4919 | is specified. |
4920 | ||
4921 | It is built into GCC which switches take arguments and which do not. | |
4922 | (You might think it would be useful to generalize this to allow each | |
4923 | compiler's spec to say which switches take arguments. But this cannot | |
4924 | be done in a consistent fashion. GCC cannot even decide which input | |
4925 | files have been specified without knowing which switches take arguments, | |
4926 | and it must know which input files to compile in order to tell which | |
02f52e19 | 4927 | compilers to run). |
a743d340 | 4928 | |
630d3d5a | 4929 | GCC also knows implicitly that arguments starting in @option{-l} are to be |
a743d340 NC |
4930 | treated as compiler output files, and passed to the linker in their |
4931 | proper position among the other output files. | |
4932 | ||
ee457005 JM |
4933 | @c man begin OPTIONS |
4934 | ||
74291a4b MM |
4935 | @node Target Options |
4936 | @section Specifying Target Machine and Compiler Version | |
4937 | @cindex target options | |
4938 | @cindex cross compiling | |
4939 | @cindex specifying machine version | |
4940 | @cindex specifying compiler version and target machine | |
4941 | @cindex compiler version, specifying | |
4942 | @cindex target machine, specifying | |
4943 | ||
0c2d1a2a | 4944 | By default, GCC compiles code for the same type of machine that you |
74291a4b MM |
4945 | are using. However, it can also be installed as a cross-compiler, to |
4946 | compile for some other type of machine. In fact, several different | |
0c2d1a2a | 4947 | configurations of GCC, for different target machines, can be |
74291a4b | 4948 | installed side by side. Then you specify which one to use with the |
630d3d5a | 4949 | @option{-b} option. |
74291a4b | 4950 | |
0c2d1a2a | 4951 | In addition, older and newer versions of GCC can be installed side |
74291a4b MM |
4952 | by side. One of them (probably the newest) will be the default, but |
4953 | you may sometimes wish to use another. | |
4954 | ||
2642624b | 4955 | @table @gcctabopt |
74291a4b | 4956 | @item -b @var{machine} |
cd3bb277 | 4957 | @opindex b |
74291a4b | 4958 | The argument @var{machine} specifies the target machine for compilation. |
0c2d1a2a | 4959 | This is useful when you have installed GCC as a cross-compiler. |
74291a4b MM |
4960 | |
4961 | The value to use for @var{machine} is the same as was specified as the | |
0c2d1a2a | 4962 | machine type when configuring GCC as a cross-compiler. For |
74291a4b MM |
4963 | example, if a cross-compiler was configured with @samp{configure |
4964 | i386v}, meaning to compile for an 80386 running System V, then you | |
630d3d5a | 4965 | would specify @option{-b i386v} to run that cross compiler. |
74291a4b | 4966 | |
630d3d5a | 4967 | When you do not specify @option{-b}, it normally means to compile for |
74291a4b MM |
4968 | the same type of machine that you are using. |
4969 | ||
4970 | @item -V @var{version} | |
cd3bb277 | 4971 | @opindex V |
0c2d1a2a | 4972 | The argument @var{version} specifies which version of GCC to run. |
74291a4b | 4973 | This is useful when multiple versions are installed. For example, |
0c2d1a2a | 4974 | @var{version} might be @samp{2.0}, meaning to run GCC version 2.0. |
74291a4b | 4975 | |
630d3d5a | 4976 | The default version, when you do not specify @option{-V}, is the last |
0c2d1a2a | 4977 | version of GCC that you installed. |
74291a4b MM |
4978 | @end table |
4979 | ||
630d3d5a | 4980 | The @option{-b} and @option{-V} options actually work by controlling part of |
74291a4b | 4981 | the file name used for the executable files and libraries used for |
0c2d1a2a | 4982 | compilation. A given version of GCC, for a given target machine, is |
bd819a4a | 4983 | normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}. |
74291a4b | 4984 | |
630d3d5a | 4985 | Thus, sites can customize the effect of @option{-b} or @option{-V} either by |
74291a4b MM |
4986 | changing the names of these directories or adding alternate names (or |
4987 | symbolic links). If in directory @file{/usr/local/lib/gcc-lib/} the | |
630d3d5a JM |
4988 | file @file{80386} is a link to the file @file{i386v}, then @option{-b |
4989 | 80386} becomes an alias for @option{-b i386v}. | |
74291a4b | 4990 | |
630d3d5a | 4991 | In one respect, the @option{-b} or @option{-V} do not completely change |
bedc7537 | 4992 | to a different compiler: the top-level driver program @command{gcc} |
74291a4b MM |
4993 | that you originally invoked continues to run and invoke the other |
4994 | executables (preprocessor, compiler per se, assembler and linker) | |
4995 | that do the real work. However, since no real work is done in the | |
4996 | driver program, it usually does not matter that the driver program | |
8c7b74b9 JM |
4997 | in use is not the one for the specified target. It is common for the |
4998 | interface to the other executables to change incompatibly between | |
4999 | compiler versions, so unless the version specified is very close to that | |
630d3d5a JM |
5000 | of the driver (for example, @option{-V 3.0} with a driver program from GCC |
5001 | version 3.0.1), use of @option{-V} may not work; for example, using | |
5002 | @option{-V 2.95.2} will not work with a driver program from GCC 3.0. | |
74291a4b MM |
5003 | |
5004 | The only way that the driver program depends on the target machine is | |
5005 | in the parsing and handling of special machine-specific options. | |
5006 | However, this is controlled by a file which is found, along with the | |
5007 | other executables, in the directory for the specified version and | |
5008 | target machine. As a result, a single installed driver program adapts | |
8c7b74b9 JM |
5009 | to any specified target machine, and sufficiently similar compiler |
5010 | versions. | |
74291a4b MM |
5011 | |
5012 | The driver program executable does control one significant thing, | |
5013 | however: the default version and target machine. Therefore, you can | |
5014 | install different instances of the driver program, compiled for | |
5015 | different targets or versions, under different names. | |
5016 | ||
bedc7537 NC |
5017 | For example, if the driver for version 2.0 is installed as @command{ogcc} |
5018 | and that for version 2.1 is installed as @command{gcc}, then the command | |
5019 | @command{gcc} will use version 2.1 by default, while @command{ogcc} will use | |
74291a4b | 5020 | 2.0 by default. However, you can choose either version with either |
630d3d5a | 5021 | command with the @option{-V} option. |
74291a4b MM |
5022 | |
5023 | @node Submodel Options | |
5024 | @section Hardware Models and Configurations | |
5025 | @cindex submodel options | |
5026 | @cindex specifying hardware config | |
5027 | @cindex hardware models and configurations, specifying | |
5028 | @cindex machine dependent options | |
5029 | ||
630d3d5a | 5030 | Earlier we discussed the standard option @option{-b} which chooses among |
74291a4b | 5031 | different installed compilers for completely different target |
8aeea6e6 | 5032 | machines, such as VAX vs.@: 68000 vs.@: 80386. |
74291a4b MM |
5033 | |
5034 | In addition, each of these target machine types can have its own | |
5035 | special options, starting with @samp{-m}, to choose among various | |
5036 | hardware models or configurations---for example, 68010 vs 68020, | |
5037 | floating coprocessor or none. A single installed version of the | |
5038 | compiler can compile for any model or configuration, according to the | |
5039 | options specified. | |
5040 | ||
5041 | Some configurations of the compiler also support additional special | |
5042 | options, usually for compatibility with other compilers on the same | |
5043 | platform. | |
5044 | ||
74291a4b MM |
5045 | These options are defined by the macro @code{TARGET_SWITCHES} in the |
5046 | machine description. The default for the options is also defined by | |
5047 | that macro, which enables you to change the defaults. | |
74291a4b MM |
5048 | |
5049 | @menu | |
5050 | * M680x0 Options:: | |
2856c3e3 | 5051 | * M68hc1x Options:: |
74291a4b MM |
5052 | * VAX Options:: |
5053 | * SPARC Options:: | |
5054 | * Convex Options:: | |
5055 | * AMD29K Options:: | |
5056 | * ARM Options:: | |
ecff22ab | 5057 | * MN10200 Options:: |
6d6d0fa0 | 5058 | * MN10300 Options:: |
861bb6c1 | 5059 | * M32R/D Options:: |
74291a4b MM |
5060 | * M88K Options:: |
5061 | * RS/6000 and PowerPC Options:: | |
5062 | * RT Options:: | |
5063 | * MIPS Options:: | |
14f73b5a | 5064 | * i386 and x86-64 Options:: |
74291a4b MM |
5065 | * HPPA Options:: |
5066 | * Intel 960 Options:: | |
5067 | * DEC Alpha Options:: | |
d7c23cdc | 5068 | * DEC Alpha/VMS Options:: |
74291a4b MM |
5069 | * Clipper Options:: |
5070 | * H8/300 Options:: | |
5071 | * SH Options:: | |
5072 | * System V Options:: | |
282a61e6 | 5073 | * TMS320C3x/C4x Options:: |
f84271d9 | 5074 | * V850 Options:: |
56b2d7a7 | 5075 | * ARC Options:: |
83575957 | 5076 | * NS32K Options:: |
052a4b28 DC |
5077 | * AVR Options:: |
5078 | * MCore Options:: | |
df6194d4 | 5079 | * IA-64 Options:: |
e8ad90e5 | 5080 | * D30V Options:: |
91abf72d | 5081 | * S/390 and zSeries Options:: |
0b85d816 | 5082 | * CRIS Options:: |
bcf684c7 | 5083 | * MMIX Options:: |
74291a4b MM |
5084 | @end menu |
5085 | ||
5086 | @node M680x0 Options | |
5087 | @subsection M680x0 Options | |
5088 | @cindex M680x0 options | |
5089 | ||
5090 | These are the @samp{-m} options defined for the 68000 series. The default | |
5091 | values for these options depends on which style of 68000 was selected when | |
5092 | the compiler was configured; the defaults for the most common choices are | |
5093 | given below. | |
5094 | ||
2642624b | 5095 | @table @gcctabopt |
74291a4b MM |
5096 | @item -m68000 |
5097 | @itemx -mc68000 | |
cd3bb277 JM |
5098 | @opindex m68000 |
5099 | @opindex mc68000 | |
74291a4b MM |
5100 | Generate output for a 68000. This is the default |
5101 | when the compiler is configured for 68000-based systems. | |
5102 | ||
74cf1c6d RK |
5103 | Use this option for microcontrollers with a 68000 or EC000 core, |
5104 | including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. | |
5105 | ||
74291a4b MM |
5106 | @item -m68020 |
5107 | @itemx -mc68020 | |
cd3bb277 JM |
5108 | @opindex m68020 |
5109 | @opindex mc68020 | |
74291a4b MM |
5110 | Generate output for a 68020. This is the default |
5111 | when the compiler is configured for 68020-based systems. | |
5112 | ||
5113 | @item -m68881 | |
cd3bb277 | 5114 | @opindex m68881 |
74291a4b | 5115 | Generate output containing 68881 instructions for floating point. |
630d3d5a | 5116 | This is the default for most 68020 systems unless @option{--nfp} was |
74291a4b MM |
5117 | specified when the compiler was configured. |
5118 | ||
5119 | @item -m68030 | |
cd3bb277 | 5120 | @opindex m68030 |
74291a4b MM |
5121 | Generate output for a 68030. This is the default when the compiler is |
5122 | configured for 68030-based systems. | |
5123 | ||
5124 | @item -m68040 | |
cd3bb277 | 5125 | @opindex m68040 |
74291a4b MM |
5126 | Generate output for a 68040. This is the default when the compiler is |
5127 | configured for 68040-based systems. | |
5128 | ||
5129 | This option inhibits the use of 68881/68882 instructions that have to be | |
74cf1c6d RK |
5130 | emulated by software on the 68040. Use this option if your 68040 does not |
5131 | have code to emulate those instructions. | |
74291a4b MM |
5132 | |
5133 | @item -m68060 | |
cd3bb277 | 5134 | @opindex m68060 |
74291a4b MM |
5135 | Generate output for a 68060. This is the default when the compiler is |
5136 | configured for 68060-based systems. | |
5137 | ||
5138 | This option inhibits the use of 68020 and 68881/68882 instructions that | |
74cf1c6d RK |
5139 | have to be emulated by software on the 68060. Use this option if your 68060 |
5140 | does not have code to emulate those instructions. | |
5141 | ||
5142 | @item -mcpu32 | |
cd3bb277 | 5143 | @opindex mcpu32 |
767094dd | 5144 | Generate output for a CPU32. This is the default |
74cf1c6d RK |
5145 | when the compiler is configured for CPU32-based systems. |
5146 | ||
5147 | Use this option for microcontrollers with a | |
5148 | CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, | |
5149 | 68336, 68340, 68341, 68349 and 68360. | |
74291a4b MM |
5150 | |
5151 | @item -m5200 | |
cd3bb277 | 5152 | @opindex m5200 |
695ac33f | 5153 | Generate output for a 520X ``coldfire'' family cpu. This is the default |
74291a4b MM |
5154 | when the compiler is configured for 520X-based systems. |
5155 | ||
02f52e19 | 5156 | Use this option for microcontroller with a 5200 core, including |
74cf1c6d RK |
5157 | the MCF5202, MCF5203, MCF5204 and MCF5202. |
5158 | ||
74291a4b MM |
5159 | |
5160 | @item -m68020-40 | |
cd3bb277 | 5161 | @opindex m68020-40 |
74291a4b MM |
5162 | Generate output for a 68040, without using any of the new instructions. |
5163 | This results in code which can run relatively efficiently on either a | |
5164 | 68020/68881 or a 68030 or a 68040. The generated code does use the | |
5165 | 68881 instructions that are emulated on the 68040. | |
5166 | ||
861bb6c1 | 5167 | @item -m68020-60 |
cd3bb277 | 5168 | @opindex m68020-60 |
861bb6c1 JL |
5169 | Generate output for a 68060, without using any of the new instructions. |
5170 | This results in code which can run relatively efficiently on either a | |
5171 | 68020/68881 or a 68030 or a 68040. The generated code does use the | |
5172 | 68881 instructions that are emulated on the 68060. | |
5173 | ||
74291a4b | 5174 | @item -mfpa |
cd3bb277 | 5175 | @opindex mfpa |
74291a4b MM |
5176 | Generate output containing Sun FPA instructions for floating point. |
5177 | ||
5178 | @item -msoft-float | |
cd3bb277 | 5179 | @opindex msoft-float |
74291a4b MM |
5180 | Generate output containing library calls for floating point. |
5181 | @strong{Warning:} the requisite libraries are not available for all m68k | |
5182 | targets. Normally the facilities of the machine's usual C compiler are | |
5183 | used, but this can't be done directly in cross-compilation. You must | |
5184 | make your own arrangements to provide suitable library functions for | |
5185 | cross-compilation. The embedded targets @samp{m68k-*-aout} and | |
5186 | @samp{m68k-*-coff} do provide software floating point support. | |
5187 | ||
5188 | @item -mshort | |
cd3bb277 | 5189 | @opindex mshort |
74291a4b MM |
5190 | Consider type @code{int} to be 16 bits wide, like @code{short int}. |
5191 | ||
5192 | @item -mnobitfield | |
cd3bb277 | 5193 | @opindex mnobitfield |
630d3d5a JM |
5194 | Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} |
5195 | and @option{-m5200} options imply @w{@option{-mnobitfield}}. | |
74291a4b MM |
5196 | |
5197 | @item -mbitfield | |
cd3bb277 | 5198 | @opindex mbitfield |
630d3d5a JM |
5199 | Do use the bit-field instructions. The @option{-m68020} option implies |
5200 | @option{-mbitfield}. This is the default if you use a configuration | |
74291a4b MM |
5201 | designed for a 68020. |
5202 | ||
5203 | @item -mrtd | |
cd3bb277 | 5204 | @opindex mrtd |
74291a4b MM |
5205 | Use a different function-calling convention, in which functions |
5206 | that take a fixed number of arguments return with the @code{rtd} | |
5207 | instruction, which pops their arguments while returning. This | |
5208 | saves one instruction in the caller since there is no need to pop | |
5209 | the arguments there. | |
5210 | ||
5211 | This calling convention is incompatible with the one normally | |
5212 | used on Unix, so you cannot use it if you need to call libraries | |
5213 | compiled with the Unix compiler. | |
5214 | ||
5215 | Also, you must provide function prototypes for all functions that | |
5216 | take variable numbers of arguments (including @code{printf}); | |
5217 | otherwise incorrect code will be generated for calls to those | |
5218 | functions. | |
5219 | ||
5220 | In addition, seriously incorrect code will result if you call a | |
5221 | function with too many arguments. (Normally, extra arguments are | |
5222 | harmlessly ignored.) | |
5223 | ||
5224 | The @code{rtd} instruction is supported by the 68010, 68020, 68030, | |
74cf1c6d | 5225 | 68040, 68060 and CPU32 processors, but not by the 68000 or 5200. |
861bb6c1 JL |
5226 | |
5227 | @item -malign-int | |
5228 | @itemx -mno-align-int | |
cd3bb277 JM |
5229 | @opindex malign-int |
5230 | @opindex mno-align-int | |
02f52e19 | 5231 | Control whether GCC aligns @code{int}, @code{long}, @code{long long}, |
861bb6c1 | 5232 | @code{float}, @code{double}, and @code{long double} variables on a 32-bit |
630d3d5a | 5233 | boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). |
861bb6c1 JL |
5234 | Aligning variables on 32-bit boundaries produces code that runs somewhat |
5235 | faster on processors with 32-bit busses at the expense of more memory. | |
5236 | ||
630d3d5a | 5237 | @strong{Warning:} if you use the @option{-malign-int} switch, GCC will |
861bb6c1 JL |
5238 | align structures containing the above types differently than |
5239 | most published application binary interface specifications for the m68k. | |
5240 | ||
fb868474 | 5241 | @item -mpcrel |
cd3bb277 | 5242 | @opindex mpcrel |
fb868474 | 5243 | Use the pc-relative addressing mode of the 68000 directly, instead of |
695ac33f JM |
5244 | using a global offset table. At present, this option implies @option{-fpic}, |
5245 | allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is | |
5246 | not presently supported with @option{-mpcrel}, though this could be supported for | |
fb868474 DL |
5247 | 68020 and higher processors. |
5248 | ||
b71733d5 GM |
5249 | @item -mno-strict-align |
5250 | @itemx -mstrict-align | |
cd3bb277 JM |
5251 | @opindex mno-strict-align |
5252 | @opindex mstrict-align | |
b71733d5 GM |
5253 | Do not (do) assume that unaligned memory references will be handled by |
5254 | the system. | |
5255 | ||
74291a4b MM |
5256 | @end table |
5257 | ||
2856c3e3 SC |
5258 | @node M68hc1x Options |
5259 | @subsection M68hc1x Options | |
5260 | @cindex M68hc1x options | |
5261 | ||
5262 | These are the @samp{-m} options defined for the 68hc11 and 68hc12 | |
02f52e19 | 5263 | microcontrollers. The default values for these options depends on |
2856c3e3 SC |
5264 | which style of microcontroller was selected when the compiler was configured; |
5265 | the defaults for the most common choices are given below. | |
5266 | ||
2642624b | 5267 | @table @gcctabopt |
2856c3e3 SC |
5268 | @item -m6811 |
5269 | @itemx -m68hc11 | |
cd3bb277 JM |
5270 | @opindex m6811 |
5271 | @opindex m68hc11 | |
2856c3e3 SC |
5272 | Generate output for a 68HC11. This is the default |
5273 | when the compiler is configured for 68HC11-based systems. | |
5274 | ||
5275 | @item -m6812 | |
5276 | @itemx -m68hc12 | |
cd3bb277 JM |
5277 | @opindex m6812 |
5278 | @opindex m68hc12 | |
2856c3e3 SC |
5279 | Generate output for a 68HC12. This is the default |
5280 | when the compiler is configured for 68HC12-based systems. | |
5281 | ||
5282 | @item -mauto-incdec | |
cd3bb277 | 5283 | @opindex mauto-incdec |
2856c3e3 SC |
5284 | Enable the use of 68HC12 pre and post auto-increment and auto-decrement |
5285 | addressing modes. | |
5286 | ||
5287 | @item -mshort | |
cd3bb277 | 5288 | @opindex mshort |
2856c3e3 SC |
5289 | Consider type @code{int} to be 16 bits wide, like @code{short int}. |
5290 | ||
5291 | @item -msoft-reg-count=@var{count} | |
cd3bb277 | 5292 | @opindex msoft-reg-count |
2856c3e3 SC |
5293 | Specify the number of pseudo-soft registers which are used for the |
5294 | code generation. The maximum number is 32. Using more pseudo-soft | |
5295 | register may or may not result in better code depending on the program. | |
5296 | The default is 4 for 68HC11 and 2 for 68HC12. | |
5297 | ||
5298 | @end table | |
5299 | ||
74291a4b MM |
5300 | @node VAX Options |
5301 | @subsection VAX Options | |
5302 | @cindex VAX options | |
5303 | ||
8aeea6e6 | 5304 | These @samp{-m} options are defined for the VAX: |
74291a4b | 5305 | |
2642624b | 5306 | @table @gcctabopt |
74291a4b | 5307 | @item -munix |
cd3bb277 | 5308 | @opindex munix |
74291a4b | 5309 | Do not output certain jump instructions (@code{aobleq} and so on) |
8aeea6e6 | 5310 | that the Unix assembler for the VAX cannot handle across long |
74291a4b MM |
5311 | ranges. |
5312 | ||
5313 | @item -mgnu | |
cd3bb277 | 5314 | @opindex mgnu |
74291a4b MM |
5315 | Do output those jump instructions, on the assumption that you |
5316 | will assemble with the GNU assembler. | |
5317 | ||
5318 | @item -mg | |
cd3bb277 | 5319 | @opindex mg |
74291a4b MM |
5320 | Output code for g-format floating point numbers instead of d-format. |
5321 | @end table | |
5322 | ||
5323 | @node SPARC Options | |
5324 | @subsection SPARC Options | |
5325 | @cindex SPARC options | |
5326 | ||
5327 | These @samp{-m} switches are supported on the SPARC: | |
5328 | ||
2642624b | 5329 | @table @gcctabopt |
74291a4b MM |
5330 | @item -mno-app-regs |
5331 | @itemx -mapp-regs | |
cd3bb277 JM |
5332 | @opindex mno-app-regs |
5333 | @opindex mapp-regs | |
630d3d5a | 5334 | Specify @option{-mapp-regs} to generate output using the global registers |
74291a4b MM |
5335 | 2 through 4, which the SPARC SVR4 ABI reserves for applications. This |
5336 | is the default. | |
5337 | ||
5338 | To be fully SVR4 ABI compliant at the cost of some performance loss, | |
630d3d5a | 5339 | specify @option{-mno-app-regs}. You should compile libraries and system |
74291a4b MM |
5340 | software with this option. |
5341 | ||
5342 | @item -mfpu | |
5343 | @itemx -mhard-float | |
cd3bb277 JM |
5344 | @opindex mfpu |
5345 | @opindex mhard-float | |
74291a4b MM |
5346 | Generate output containing floating point instructions. This is the |
5347 | default. | |
5348 | ||
5349 | @item -mno-fpu | |
5350 | @itemx -msoft-float | |
cd3bb277 JM |
5351 | @opindex mno-fpu |
5352 | @opindex msoft-float | |
74291a4b MM |
5353 | Generate output containing library calls for floating point. |
5354 | @strong{Warning:} the requisite libraries are not available for all SPARC | |
5355 | targets. Normally the facilities of the machine's usual C compiler are | |
5356 | used, but this cannot be done directly in cross-compilation. You must make | |
5357 | your own arrangements to provide suitable library functions for | |
5358 | cross-compilation. The embedded targets @samp{sparc-*-aout} and | |
5359 | @samp{sparclite-*-*} do provide software floating point support. | |
5360 | ||
630d3d5a | 5361 | @option{-msoft-float} changes the calling convention in the output file; |
74291a4b MM |
5362 | therefore, it is only useful if you compile @emph{all} of a program with |
5363 | this option. In particular, you need to compile @file{libgcc.a}, the | |
630d3d5a | 5364 | library that comes with GCC, with @option{-msoft-float} in order for |
74291a4b MM |
5365 | this to work. |
5366 | ||
5367 | @item -mhard-quad-float | |
cd3bb277 | 5368 | @opindex mhard-quad-float |
74291a4b MM |
5369 | Generate output containing quad-word (long double) floating point |
5370 | instructions. | |
5371 | ||
5372 | @item -msoft-quad-float | |
cd3bb277 | 5373 | @opindex msoft-quad-float |
74291a4b MM |
5374 | Generate output containing library calls for quad-word (long double) |
5375 | floating point instructions. The functions called are those specified | |
161d7b59 | 5376 | in the SPARC ABI@. This is the default. |
74291a4b MM |
5377 | |
5378 | As of this writing, there are no sparc implementations that have hardware | |
5379 | support for the quad-word floating point instructions. They all invoke | |
5380 | a trap handler for one of these instructions, and then the trap handler | |
5381 | emulates the effect of the instruction. Because of the trap handler overhead, | |
5382 | this is much slower than calling the ABI library routines. Thus the | |
630d3d5a | 5383 | @option{-msoft-quad-float} option is the default. |
74291a4b MM |
5384 | |
5385 | @item -mno-epilogue | |
5386 | @itemx -mepilogue | |
cd3bb277 JM |
5387 | @opindex mno-epilogue |
5388 | @opindex mepilogue | |
630d3d5a | 5389 | With @option{-mepilogue} (the default), the compiler always emits code for |
74291a4b MM |
5390 | function exit at the end of each function. Any function exit in |
5391 | the middle of the function (such as a return statement in C) will | |
5392 | generate a jump to the exit code at the end of the function. | |
5393 | ||
630d3d5a | 5394 | With @option{-mno-epilogue}, the compiler tries to emit exit code inline |
74291a4b MM |
5395 | at every function exit. |
5396 | ||
5397 | @item -mno-flat | |
5398 | @itemx -mflat | |
cd3bb277 JM |
5399 | @opindex mno-flat |
5400 | @opindex mflat | |
630d3d5a | 5401 | With @option{-mflat}, the compiler does not generate save/restore instructions |
695ac33f | 5402 | and will use a ``flat'' or single register window calling convention. |
74291a4b MM |
5403 | This model uses %i7 as the frame pointer and is compatible with the normal |
5404 | register window model. Code from either may be intermixed. | |
aee96fe9 | 5405 | The local registers and the input registers (0--5) are still treated as |
695ac33f | 5406 | ``call saved'' registers and will be saved on the stack as necessary. |
74291a4b | 5407 | |
630d3d5a | 5408 | With @option{-mno-flat} (the default), the compiler emits save/restore |
74291a4b MM |
5409 | instructions (except for leaf functions) and is the normal mode of operation. |
5410 | ||
5411 | @item -mno-unaligned-doubles | |
5412 | @itemx -munaligned-doubles | |
cd3bb277 JM |
5413 | @opindex mno-unaligned-doubles |
5414 | @opindex munaligned-doubles | |
74291a4b MM |
5415 | Assume that doubles have 8 byte alignment. This is the default. |
5416 | ||
630d3d5a | 5417 | With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte |
74291a4b MM |
5418 | alignment only if they are contained in another type, or if they have an |
5419 | absolute address. Otherwise, it assumes they have 4 byte alignment. | |
5420 | Specifying this option avoids some rare compatibility problems with code | |
5421 | generated by other compilers. It is not the default because it results | |
5422 | in a performance loss, especially for floating point code. | |
5423 | ||
c219ddf7 BK |
5424 | @item -mno-faster-structs |
5425 | @itemx -mfaster-structs | |
cd3bb277 JM |
5426 | @opindex mno-faster-structs |
5427 | @opindex mfaster-structs | |
630d3d5a | 5428 | With @option{-mfaster-structs}, the compiler assumes that structures |
c219ddf7 BK |
5429 | should have 8 byte alignment. This enables the use of pairs of |
5430 | @code{ldd} and @code{std} instructions for copies in structure | |
5431 | assignment, in place of twice as many @code{ld} and @code{st} pairs. | |
5432 | However, the use of this changed alignment directly violates the Sparc | |
161d7b59 | 5433 | ABI@. Thus, it's intended only for use on targets where the developer |
c219ddf7 | 5434 | acknowledges that their resulting code will not be directly in line with |
161d7b59 | 5435 | the rules of the ABI@. |
c219ddf7 | 5436 | |
74291a4b MM |
5437 | @item -mv8 |
5438 | @itemx -msparclite | |
cd3bb277 JM |
5439 | @opindex mv8 |
5440 | @opindex msparclite | |
74291a4b MM |
5441 | These two options select variations on the SPARC architecture. |
5442 | ||
5443 | By default (unless specifically configured for the Fujitsu SPARClite), | |
5444 | GCC generates code for the v7 variant of the SPARC architecture. | |
5445 | ||
630d3d5a | 5446 | @option{-mv8} will give you SPARC v8 code. The only difference from v7 |
74291a4b MM |
5447 | code is that the compiler emits the integer multiply and integer |
5448 | divide instructions which exist in SPARC v8 but not in SPARC v7. | |
5449 | ||
630d3d5a | 5450 | @option{-msparclite} will give you SPARClite code. This adds the integer |
74291a4b MM |
5451 | multiply, integer divide step and scan (@code{ffs}) instructions which |
5452 | exist in SPARClite but not in SPARC v7. | |
5453 | ||
0c2d1a2a | 5454 | These options are deprecated and will be deleted in a future GCC release. |
630d3d5a | 5455 | They have been replaced with @option{-mcpu=xxx}. |
74291a4b MM |
5456 | |
5457 | @item -mcypress | |
5458 | @itemx -msupersparc | |
cd3bb277 JM |
5459 | @opindex mcypress |
5460 | @opindex msupersparc | |
c21cd8b1 | 5461 | These two options select the processor for which the code is optimized. |
74291a4b | 5462 | |
630d3d5a | 5463 | With @option{-mcypress} (the default), the compiler optimizes code for the |
74291a4b MM |
5464 | Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series. |
5465 | This is also appropriate for the older SparcStation 1, 2, IPX etc. | |
5466 | ||
630d3d5a | 5467 | With @option{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as |
767094dd | 5468 | used in the SparcStation 10, 1000 and 2000 series. This flag also enables use |
74291a4b MM |
5469 | of the full SPARC v8 instruction set. |
5470 | ||
0c2d1a2a | 5471 | These options are deprecated and will be deleted in a future GCC release. |
630d3d5a | 5472 | They have been replaced with @option{-mcpu=xxx}. |
74291a4b MM |
5473 | |
5474 | @item -mcpu=@var{cpu_type} | |
cd3bb277 | 5475 | @opindex mcpu |
c0498f43 DE |
5476 | Set the instruction set, register set, and instruction scheduling parameters |
5477 | for machine type @var{cpu_type}. Supported values for @var{cpu_type} are | |
5478 | @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite}, | |
ad6843d7 RH |
5479 | @samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934}, |
5480 | @samp{sparclet}, @samp{tsc701}, @samp{v9}, and @samp{ultrasparc}. | |
c0498f43 DE |
5481 | |
5482 | Default instruction scheduling parameters are used for values that select | |
5483 | an architecture and not an implementation. These are @samp{v7}, @samp{v8}, | |
5484 | @samp{sparclite}, @samp{sparclet}, @samp{v9}. | |
5485 | ||
5486 | Here is a list of each supported architecture and their supported | |
5487 | implementations. | |
5488 | ||
5489 | @smallexample | |
5490 | v7: cypress | |
ad6843d7 RH |
5491 | v8: supersparc, hypersparc |
5492 | sparclite: f930, f934, sparclite86x | |
c0498f43 DE |
5493 | sparclet: tsc701 |
5494 | v9: ultrasparc | |
5495 | @end smallexample | |
74291a4b MM |
5496 | |
5497 | @item -mtune=@var{cpu_type} | |
cd3bb277 | 5498 | @opindex mtune |
74291a4b | 5499 | Set the instruction scheduling parameters for machine type |
c0498f43 | 5500 | @var{cpu_type}, but do not set the instruction set or register set that the |
630d3d5a | 5501 | option @option{-mcpu=@var{cpu_type}} would. |
c0498f43 | 5502 | |
9c34dbbf ZW |
5503 | The same values for @option{-mcpu=@var{cpu_type}} can be used for |
5504 | @option{-mtune=@var{cpu_type}}, but the only useful values are those | |
5505 | that select a particular cpu implementation. Those are @samp{cypress}, | |
5506 | @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934}, | |
5507 | @samp{sparclite86x}, @samp{tsc701}, and @samp{ultrasparc}. | |
74291a4b MM |
5508 | |
5509 | @end table | |
5510 | ||
5511 | These @samp{-m} switches are supported in addition to the above | |
5512 | on the SPARCLET processor. | |
5513 | ||
2642624b | 5514 | @table @gcctabopt |
74291a4b | 5515 | @item -mlittle-endian |
cd3bb277 | 5516 | @opindex mlittle-endian |
74291a4b MM |
5517 | Generate code for a processor running in little-endian mode. |
5518 | ||
5519 | @item -mlive-g0 | |
cd3bb277 | 5520 | @opindex mlive-g0 |
74291a4b MM |
5521 | Treat register @code{%g0} as a normal register. |
5522 | GCC will continue to clobber it as necessary but will not assume | |
5523 | it always reads as 0. | |
5524 | ||
5525 | @item -mbroken-saverestore | |
cd3bb277 | 5526 | @opindex mbroken-saverestore |
74291a4b MM |
5527 | Generate code that does not use non-trivial forms of the @code{save} and |
5528 | @code{restore} instructions. Early versions of the SPARCLET processor do | |
5529 | not correctly handle @code{save} and @code{restore} instructions used with | |
5530 | arguments. They correctly handle them used without arguments. A @code{save} | |
5531 | instruction used without arguments increments the current window pointer | |
5532 | but does not allocate a new stack frame. It is assumed that the window | |
5533 | overflow trap handler will properly handle this case as will interrupt | |
5534 | handlers. | |
5535 | @end table | |
5536 | ||
5537 | These @samp{-m} switches are supported in addition to the above | |
02f52e19 | 5538 | on SPARC V9 processors in 64-bit environments. |
74291a4b | 5539 | |
2642624b | 5540 | @table @gcctabopt |
74291a4b | 5541 | @item -mlittle-endian |
cd3bb277 | 5542 | @opindex mlittle-endian |
74291a4b MM |
5543 | Generate code for a processor running in little-endian mode. |
5544 | ||
ded17aad DE |
5545 | @item -m32 |
5546 | @itemx -m64 | |
cd3bb277 JM |
5547 | @opindex m32 |
5548 | @opindex m64 | |
02f52e19 AJ |
5549 | Generate code for a 32-bit or 64-bit environment. |
5550 | The 32-bit environment sets int, long and pointer to 32 bits. | |
5551 | The 64-bit environment sets int to 32 bits and long and pointer | |
ded17aad DE |
5552 | to 64 bits. |
5553 | ||
5554 | @item -mcmodel=medlow | |
cd3bb277 | 5555 | @opindex mcmodel=medlow |
ded17aad DE |
5556 | Generate code for the Medium/Low code model: the program must be linked |
5557 | in the low 32 bits of the address space. Pointers are 64 bits. | |
5558 | Programs can be statically or dynamically linked. | |
5559 | ||
5560 | @item -mcmodel=medmid | |
cd3bb277 | 5561 | @opindex mcmodel=medmid |
ded17aad DE |
5562 | Generate code for the Medium/Middle code model: the program must be linked |
5563 | in the low 44 bits of the address space, the text segment must be less than | |
5564 | 2G bytes, and data segment must be within 2G of the text segment. | |
5565 | Pointers are 64 bits. | |
5566 | ||
5567 | @item -mcmodel=medany | |
cd3bb277 | 5568 | @opindex mcmodel=medany |
ded17aad DE |
5569 | Generate code for the Medium/Anywhere code model: the program may be linked |
5570 | anywhere in the address space, the text segment must be less than | |
5571 | 2G bytes, and data segment must be within 2G of the text segment. | |
5572 | Pointers are 64 bits. | |
5573 | ||
5574 | @item -mcmodel=embmedany | |
cd3bb277 | 5575 | @opindex mcmodel=embmedany |
ded17aad | 5576 | Generate code for the Medium/Anywhere code model for embedded systems: |
02f52e19 | 5577 | assume a 32-bit text and a 32-bit data segment, both starting anywhere |
ded17aad | 5578 | (determined at link time). Register %g4 points to the base of the |
02f52e19 | 5579 | data segment. Pointers are still 64 bits. |
ded17aad | 5580 | Programs are statically linked, PIC is not supported. |
74291a4b MM |
5581 | |
5582 | @item -mstack-bias | |
5583 | @itemx -mno-stack-bias | |
cd3bb277 JM |
5584 | @opindex mstack-bias |
5585 | @opindex mno-stack-bias | |
630d3d5a JM |
5586 | With @option{-mstack-bias}, GCC assumes that the stack pointer, and |
5587 | frame pointer if present, are offset by @minus{}2047 which must be added back | |
74291a4b MM |
5588 | when making stack frame references. |
5589 | Otherwise, assume no such offset is present. | |
5590 | @end table | |
5591 | ||
5592 | @node Convex Options | |
5593 | @subsection Convex Options | |
5594 | @cindex Convex options | |
5595 | ||
5596 | These @samp{-m} options are defined for Convex: | |
5597 | ||
2642624b | 5598 | @table @gcctabopt |
74291a4b | 5599 | @item -mc1 |
cd3bb277 | 5600 | @opindex mc1 |
74291a4b MM |
5601 | Generate output for C1. The code will run on any Convex machine. |
5602 | The preprocessor symbol @code{__convex__c1__} is defined. | |
5603 | ||
5604 | @item -mc2 | |
cd3bb277 | 5605 | @opindex mc2 |
74291a4b MM |
5606 | Generate output for C2. Uses instructions not available on C1. |
5607 | Scheduling and other optimizations are chosen for max performance on C2. | |
5608 | The preprocessor symbol @code{__convex_c2__} is defined. | |
5609 | ||
5610 | @item -mc32 | |
cd3bb277 | 5611 | @opindex mc32 |
74291a4b MM |
5612 | Generate output for C32xx. Uses instructions not available on C1. |
5613 | Scheduling and other optimizations are chosen for max performance on C32. | |
5614 | The preprocessor symbol @code{__convex_c32__} is defined. | |
5615 | ||
5616 | @item -mc34 | |
cd3bb277 | 5617 | @opindex mc34 |
74291a4b MM |
5618 | Generate output for C34xx. Uses instructions not available on C1. |
5619 | Scheduling and other optimizations are chosen for max performance on C34. | |
5620 | The preprocessor symbol @code{__convex_c34__} is defined. | |
5621 | ||
5622 | @item -mc38 | |
cd3bb277 | 5623 | @opindex mc38 |
74291a4b MM |
5624 | Generate output for C38xx. Uses instructions not available on C1. |
5625 | Scheduling and other optimizations are chosen for max performance on C38. | |
5626 | The preprocessor symbol @code{__convex_c38__} is defined. | |
5627 | ||
5628 | @item -margcount | |
cd3bb277 | 5629 | @opindex margcount |
74291a4b MM |
5630 | Generate code which puts an argument count in the word preceding each |
5631 | argument list. This is compatible with regular CC, and a few programs | |
5632 | may need the argument count word. GDB and other source-level debuggers | |
5633 | do not need it; this info is in the symbol table. | |
5634 | ||
5635 | @item -mnoargcount | |
cd3bb277 | 5636 | @opindex mnoargcount |
74291a4b MM |
5637 | Omit the argument count word. This is the default. |
5638 | ||
5639 | @item -mvolatile-cache | |
cd3bb277 | 5640 | @opindex mvolatile-cache |
74291a4b MM |
5641 | Allow volatile references to be cached. This is the default. |
5642 | ||
5643 | @item -mvolatile-nocache | |
cd3bb277 | 5644 | @opindex mvolatile-nocache |
74291a4b MM |
5645 | Volatile references bypass the data cache, going all the way to memory. |
5646 | This is only needed for multi-processor code that does not use standard | |
5647 | synchronization instructions. Making non-volatile references to volatile | |
5648 | locations will not necessarily work. | |
5649 | ||
5650 | @item -mlong32 | |
cd3bb277 | 5651 | @opindex mlong32 |
74291a4b MM |
5652 | Type long is 32 bits, the same as type int. This is the default. |
5653 | ||
5654 | @item -mlong64 | |
cd3bb277 | 5655 | @opindex mlong64 |
74291a4b MM |
5656 | Type long is 64 bits, the same as type long long. This option is useless, |
5657 | because no library support exists for it. | |
5658 | @end table | |
5659 | ||
5660 | @node AMD29K Options | |
5661 | @subsection AMD29K Options | |
5662 | @cindex AMD29K options | |
5663 | ||
5664 | These @samp{-m} options are defined for the AMD Am29000: | |
5665 | ||
2642624b | 5666 | @table @gcctabopt |
74291a4b | 5667 | @item -mdw |
cd3bb277 | 5668 | @opindex mdw |
74291a4b MM |
5669 | @cindex DW bit (29k) |
5670 | Generate code that assumes the @code{DW} bit is set, i.e., that byte and | |
5671 | halfword operations are directly supported by the hardware. This is the | |
5672 | default. | |
5673 | ||
5674 | @item -mndw | |
cd3bb277 | 5675 | @opindex mndw |
74291a4b MM |
5676 | Generate code that assumes the @code{DW} bit is not set. |
5677 | ||
5678 | @item -mbw | |
cd3bb277 | 5679 | @opindex mbw |
74291a4b MM |
5680 | @cindex byte writes (29k) |
5681 | Generate code that assumes the system supports byte and halfword write | |
5682 | operations. This is the default. | |
5683 | ||
5684 | @item -mnbw | |
cd3bb277 | 5685 | @opindex mnbw |
74291a4b | 5686 | Generate code that assumes the systems does not support byte and |
630d3d5a | 5687 | halfword write operations. @option{-mnbw} implies @option{-mndw}. |
74291a4b MM |
5688 | |
5689 | @item -msmall | |
cd3bb277 | 5690 | @opindex msmall |
74291a4b MM |
5691 | @cindex memory model (29k) |
5692 | Use a small memory model that assumes that all function addresses are | |
5693 | either within a single 256 KB segment or at an absolute address of less | |
5694 | than 256k. This allows the @code{call} instruction to be used instead | |
5695 | of a @code{const}, @code{consth}, @code{calli} sequence. | |
5696 | ||
5697 | @item -mnormal | |
cd3bb277 | 5698 | @opindex mnormal |
74291a4b MM |
5699 | Use the normal memory model: Generate @code{call} instructions only when |
5700 | calling functions in the same file and @code{calli} instructions | |
5701 | otherwise. This works if each file occupies less than 256 KB but allows | |
161d7b59 | 5702 | the entire executable to be larger than 256 KB@. This is the default. |
74291a4b MM |
5703 | |
5704 | @item -mlarge | |
cd3bb277 | 5705 | @opindex mlarge |
74291a4b MM |
5706 | Always use @code{calli} instructions. Specify this option if you expect |
5707 | a single file to compile into more than 256 KB of code. | |
5708 | ||
5709 | @item -m29050 | |
cd3bb277 | 5710 | @opindex m29050 |
74291a4b MM |
5711 | @cindex processor selection (29k) |
5712 | Generate code for the Am29050. | |
5713 | ||
5714 | @item -m29000 | |
cd3bb277 | 5715 | @opindex m29000 |
74291a4b MM |
5716 | Generate code for the Am29000. This is the default. |
5717 | ||
5718 | @item -mkernel-registers | |
cd3bb277 | 5719 | @opindex mkernel-registers |
74291a4b MM |
5720 | @cindex kernel and user registers (29k) |
5721 | Generate references to registers @code{gr64-gr95} instead of to | |
5722 | registers @code{gr96-gr127}. This option can be used when compiling | |
5723 | kernel code that wants a set of global registers disjoint from that used | |
5724 | by user-mode code. | |
5725 | ||
5726 | Note that when this option is used, register names in @samp{-f} flags | |
5727 | must use the normal, user-mode, names. | |
5728 | ||
5729 | @item -muser-registers | |
cd3bb277 | 5730 | @opindex muser-registers |
74291a4b MM |
5731 | Use the normal set of global registers, @code{gr96-gr127}. This is the |
5732 | default. | |
5733 | ||
5734 | @item -mstack-check | |
5735 | @itemx -mno-stack-check | |
cd3bb277 JM |
5736 | @opindex mstack-check |
5737 | @opindex mno-stack-check | |
74291a4b MM |
5738 | @cindex stack checks (29k) |
5739 | Insert (or do not insert) a call to @code{__msp_check} after each stack | |
5740 | adjustment. This is often used for kernel code. | |
5741 | ||
5742 | @item -mstorem-bug | |
5743 | @itemx -mno-storem-bug | |
cd3bb277 JM |
5744 | @opindex mstorem-bug |
5745 | @opindex mno-storem-bug | |
74291a4b | 5746 | @cindex storem bug (29k) |
630d3d5a | 5747 | @option{-mstorem-bug} handles 29k processors which cannot handle the |
74291a4b MM |
5748 | separation of a mtsrim insn and a storem instruction (most 29000 chips |
5749 | to date, but not the 29050). | |
5750 | ||
5751 | @item -mno-reuse-arg-regs | |
5752 | @itemx -mreuse-arg-regs | |
cd3bb277 JM |
5753 | @opindex mno-reuse-arg-regs |
5754 | @opindex mreuse-arg-regs | |
630d3d5a | 5755 | @option{-mno-reuse-arg-regs} tells the compiler to only use incoming argument |
74291a4b MM |
5756 | registers for copying out arguments. This helps detect calling a function |
5757 | with fewer arguments than it was declared with. | |
5758 | ||
861bb6c1 JL |
5759 | @item -mno-impure-text |
5760 | @itemx -mimpure-text | |
cd3bb277 JM |
5761 | @opindex mno-impure-text |
5762 | @opindex mimpure-text | |
630d3d5a JM |
5763 | @option{-mimpure-text}, used in addition to @option{-shared}, tells the compiler to |
5764 | not pass @option{-assert pure-text} to the linker when linking a shared object. | |
861bb6c1 | 5765 | |
74291a4b | 5766 | @item -msoft-float |
cd3bb277 | 5767 | @opindex msoft-float |
74291a4b | 5768 | Generate output containing library calls for floating point. |
161d7b59 | 5769 | @strong{Warning:} the requisite libraries are not part of GCC@. |
74291a4b MM |
5770 | Normally the facilities of the machine's usual C compiler are used, but |
5771 | this can't be done directly in cross-compilation. You must make your | |
5772 | own arrangements to provide suitable library functions for | |
5773 | cross-compilation. | |
4e8d7ddc JW |
5774 | |
5775 | @item -mno-multm | |
cd3bb277 | 5776 | @opindex mno-multm |
4e8d7ddc JW |
5777 | Do not generate multm or multmu instructions. This is useful for some embedded |
5778 | systems which do not have trap handlers for these instructions. | |
74291a4b MM |
5779 | @end table |
5780 | ||
5781 | @node ARM Options | |
5782 | @subsection ARM Options | |
5783 | @cindex ARM options | |
5784 | ||
5785 | These @samp{-m} options are defined for Advanced RISC Machines (ARM) | |
5786 | architectures: | |
5787 | ||
2642624b | 5788 | @table @gcctabopt |
74291a4b | 5789 | @item -mapcs-frame |
cd3bb277 | 5790 | @opindex mapcs-frame |
74291a4b MM |
5791 | Generate a stack frame that is compliant with the ARM Procedure Call |
5792 | Standard for all functions, even if this is not strictly necessary for | |
630d3d5a | 5793 | correct execution of the code. Specifying @option{-fomit-frame-pointer} |
157a620e | 5794 | with this option will cause the stack frames not to be generated for |
630d3d5a | 5795 | leaf functions. The default is @option{-mno-apcs-frame}. |
157a620e NC |
5796 | |
5797 | @item -mapcs | |
cd3bb277 | 5798 | @opindex mapcs |
630d3d5a | 5799 | This is a synonym for @option{-mapcs-frame}. |
74291a4b MM |
5800 | |
5801 | @item -mapcs-26 | |
cd3bb277 | 5802 | @opindex mapcs-26 |
74291a4b MM |
5803 | Generate code for a processor running with a 26-bit program counter, |
5804 | and conforming to the function calling standards for the APCS 26-bit | |
630d3d5a | 5805 | option. This option replaces the @option{-m2} and @option{-m3} options |
74291a4b MM |
5806 | of previous releases of the compiler. |
5807 | ||
5808 | @item -mapcs-32 | |
cd3bb277 | 5809 | @opindex mapcs-32 |
74291a4b MM |
5810 | Generate code for a processor running with a 32-bit program counter, |
5811 | and conforming to the function calling standards for the APCS 32-bit | |
630d3d5a | 5812 | option. This option replaces the @option{-m6} option of previous releases |
74291a4b MM |
5813 | of the compiler. |
5814 | ||
247f8561 PB |
5815 | @ignore |
5816 | @c not currently implemented | |
157a620e | 5817 | @item -mapcs-stack-check |
cd3bb277 | 5818 | @opindex mapcs-stack-check |
157a620e NC |
5819 | Generate code to check the amount of stack space available upon entry to |
5820 | every function (that actually uses some stack space). If there is | |
5821 | insufficient space available then either the function | |
5822 | @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be | |
5823 | called, depending upon the amount of stack space required. The run time | |
5824 | system is required to provide these functions. The default is | |
630d3d5a | 5825 | @option{-mno-apcs-stack-check}, since this produces smaller code. |
157a620e | 5826 | |
247f8561 | 5827 | @c not currently implemented |
157a620e | 5828 | @item -mapcs-float |
cd3bb277 | 5829 | @opindex mapcs-float |
157a620e | 5830 | Pass floating point arguments using the float point registers. This is |
161d7b59 | 5831 | one of the variants of the APCS@. This option is recommended if the |
157a620e NC |
5832 | target hardware has a floating point unit or if a lot of floating point |
5833 | arithmetic is going to be performed by the code. The default is | |
630d3d5a JM |
5834 | @option{-mno-apcs-float}, since integer only code is slightly increased in |
5835 | size if @option{-mapcs-float} is used. | |
157a620e | 5836 | |
247f8561 | 5837 | @c not currently implemented |
157a620e | 5838 | @item -mapcs-reentrant |
cd3bb277 | 5839 | @opindex mapcs-reentrant |
247f8561 | 5840 | Generate reentrant, position independent code. The default is |
630d3d5a | 5841 | @option{-mno-apcs-reentrant}. |
247f8561 | 5842 | @end ignore |
157a620e NC |
5843 | |
5844 | @item -mthumb-interwork | |
cd3bb277 | 5845 | @opindex mthumb-interwork |
247f8561 | 5846 | Generate code which supports calling between the ARM and Thumb |
157a620e NC |
5847 | instruction sets. Without this option the two instruction sets cannot |
5848 | be reliably used inside one program. The default is | |
630d3d5a JM |
5849 | @option{-mno-thumb-interwork}, since slightly larger code is generated |
5850 | when @option{-mthumb-interwork} is specified. | |
157a620e NC |
5851 | |
5852 | @item -mno-sched-prolog | |
cd3bb277 | 5853 | @opindex mno-sched-prolog |
157a620e NC |
5854 | Prevent the reordering of instructions in the function prolog, or the |
5855 | merging of those instruction with the instructions in the function's | |
ed0e6530 PB |
5856 | body. This means that all functions will start with a recognizable set |
5857 | of instructions (or in fact one of a choice from a small set of | |
157a620e NC |
5858 | different function prologues), and this information can be used to |
5859 | locate the start if functions inside an executable piece of code. The | |
630d3d5a | 5860 | default is @option{-msched-prolog}. |
157a620e | 5861 | |
74291a4b | 5862 | @item -mhard-float |
cd3bb277 | 5863 | @opindex mhard-float |
74291a4b MM |
5864 | Generate output containing floating point instructions. This is the |
5865 | default. | |
5866 | ||
5867 | @item -msoft-float | |
cd3bb277 | 5868 | @opindex msoft-float |
74291a4b MM |
5869 | Generate output containing library calls for floating point. |
5870 | @strong{Warning:} the requisite libraries are not available for all ARM | |
5871 | targets. Normally the facilities of the machine's usual C compiler are | |
5872 | used, but this cannot be done directly in cross-compilation. You must make | |
5873 | your own arrangements to provide suitable library functions for | |
5874 | cross-compilation. | |
5875 | ||
630d3d5a | 5876 | @option{-msoft-float} changes the calling convention in the output file; |
74291a4b MM |
5877 | therefore, it is only useful if you compile @emph{all} of a program with |
5878 | this option. In particular, you need to compile @file{libgcc.a}, the | |
630d3d5a | 5879 | library that comes with GCC, with @option{-msoft-float} in order for |
74291a4b MM |
5880 | this to work. |
5881 | ||
5882 | @item -mlittle-endian | |
cd3bb277 | 5883 | @opindex mlittle-endian |
74291a4b MM |
5884 | Generate code for a processor running in little-endian mode. This is |
5885 | the default for all standard configurations. | |
5886 | ||
5887 | @item -mbig-endian | |
cd3bb277 | 5888 | @opindex mbig-endian |
74291a4b MM |
5889 | Generate code for a processor running in big-endian mode; the default is |
5890 | to compile code for a little-endian processor. | |
5891 | ||
5892 | @item -mwords-little-endian | |
cd3bb277 | 5893 | @opindex mwords-little-endian |
74291a4b MM |
5894 | This option only applies when generating code for big-endian processors. |
5895 | Generate code for a little-endian word order but a big-endian byte | |
5896 | order. That is, a byte order of the form @samp{32107654}. Note: this | |
5897 | option should only be used if you require compatibility with code for | |
5898 | big-endian ARM processors generated by versions of the compiler prior to | |
5899 | 2.8. | |
5900 | ||
5f1e6755 | 5901 | @item -malignment-traps |
cd3bb277 | 5902 | @opindex malignment-traps |
5f1e6755 NC |
5903 | Generate code that will not trap if the MMU has alignment traps enabled. |
5904 | On ARM architectures prior to ARMv4, there were no instructions to | |
5905 | access half-word objects stored in memory. However, when reading from | |
5906 | memory a feature of the ARM architecture allows a word load to be used, | |
5907 | even if the address is unaligned, and the processor core will rotate the | |
5908 | data as it is being loaded. This option tells the compiler that such | |
5909 | misaligned accesses will cause a MMU trap and that it should instead | |
5910 | synthesise the access as a series of byte accesses. The compiler can | |
5911 | still use word accesses to load half-word data if it knows that the | |
5912 | address is aligned to a word boundary. | |
5913 | ||
5914 | This option is ignored when compiling for ARM architecture 4 or later, | |
5915 | since these processors have instructions to directly access half-word | |
02f52e19 AJ |
5916 | objects in memory. |
5917 | ||
5f1e6755 | 5918 | @item -mno-alignment-traps |
cd3bb277 | 5919 | @opindex mno-alignment-traps |
5f1e6755 NC |
5920 | Generate code that assumes that the MMU will not trap unaligned |
5921 | accesses. This produces better code when the target instruction set | |
e979f9e8 | 5922 | does not have half-word memory operations (i.e.@: implementations prior to |
02f52e19 | 5923 | ARMv4). |
5f1e6755 NC |
5924 | |
5925 | Note that you cannot use this option to access unaligned word objects, | |
5926 | since the processor will only fetch one 32-bit aligned object from | |
02f52e19 | 5927 | memory. |
5f1e6755 | 5928 | |
695ac33f | 5929 | The default setting for most targets is @option{-mno-alignment-traps}, since |
5f1e6755 | 5930 | this produces better code when there are no half-word memory |
02f52e19 | 5931 | instructions available. |
5f1e6755 | 5932 | |
74291a4b | 5933 | @item -mshort-load-bytes |
247f8561 | 5934 | @itemx -mno-short-load-words |
cd3bb277 JM |
5935 | @opindex mshort-load-bytes |
5936 | @opindex mno-short-load-words | |
630d3d5a | 5937 | These are deprecated aliases for @option{-malignment-traps}. |
74291a4b MM |
5938 | |
5939 | @item -mno-short-load-bytes | |
247f8561 | 5940 | @itemx -mshort-load-words |
cd3bb277 JM |
5941 | @opindex mno-short-load-bytes |
5942 | @opindex mshort-load-words | |
630d3d5a | 5943 | This are deprecated aliases for @option{-mno-alignment-traps}. |
157a620e | 5944 | |
74291a4b | 5945 | @item -mbsd |
cd3bb277 | 5946 | @opindex mbsd |
161d7b59 | 5947 | This option only applies to RISC iX@. Emulate the native BSD-mode |
630d3d5a | 5948 | compiler. This is the default if @option{-ansi} is not specified. |
74291a4b MM |
5949 | |
5950 | @item -mxopen | |
cd3bb277 | 5951 | @opindex mxopen |
161d7b59 | 5952 | This option only applies to RISC iX@. Emulate the native X/Open-mode |
74291a4b MM |
5953 | compiler. |
5954 | ||
5955 | @item -mno-symrename | |
cd3bb277 | 5956 | @opindex mno-symrename |
161d7b59 | 5957 | This option only applies to RISC iX@. Do not run the assembler |
74291a4b MM |
5958 | post-processor, @samp{symrename}, after code has been assembled. |
5959 | Normally it is necessary to modify some of the standard symbols in | |
5960 | preparation for linking with the RISC iX C library; this option | |
5961 | suppresses this pass. The post-processor is never run when the | |
5962 | compiler is built for cross-compilation. | |
157a620e | 5963 | |
cd3bb277 JM |
5964 | @item -mcpu=@var{name} |
5965 | @opindex mcpu | |
157a620e | 5966 | This specifies the name of the target ARM processor. GCC uses this name |
247f8561 | 5967 | to determine what kind of instructions it can emit when generating |
aee96fe9 JM |
5968 | assembly code. Permissible names are: @samp{arm2}, @samp{arm250}, |
5969 | @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, | |
5970 | @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, | |
5971 | @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, | |
5972 | @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, | |
5973 | @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8}, | |
5974 | @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, | |
5975 | @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, | |
5976 | @samp{arm920t}, @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, | |
5977 | @samp{arm1020t}, @samp{xscale}. | |
62b10bbc | 5978 | |
cd3bb277 JM |
5979 | @itemx -mtune=@var{name} |
5980 | @opindex mtune | |
630d3d5a | 5981 | This option is very similar to the @option{-mcpu=} option, except that |
62b10bbc NC |
5982 | instead of specifying the actual target processor type, and hence |
5983 | restricting which instructions can be used, it specifies that GCC should | |
5984 | tune the performance of the code as if the target were of the type | |
5985 | specified in this option, but still choosing the instructions that it | |
630d3d5a | 5986 | will generate based on the cpu specified by a @option{-mcpu=} option. |
247f8561 | 5987 | For some ARM implementations better performance can be obtained by using |
62b10bbc | 5988 | this option. |
157a620e | 5989 | |
cd3bb277 JM |
5990 | @item -march=@var{name} |
5991 | @opindex march | |
157a620e | 5992 | This specifies the name of the target ARM architecture. GCC uses this |
247f8561 | 5993 | name to determine what kind of instructions it can emit when generating |
157a620e | 5994 | assembly code. This option can be used in conjunction with or instead |
aee96fe9 JM |
5995 | of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, |
5996 | @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, | |
5997 | @samp{armv5}, @samp{armv5t}, @samp{armv5te}. | |
157a620e | 5998 | |
cd3bb277 JM |
5999 | @item -mfpe=@var{number} |
6000 | @itemx -mfp=@var{number} | |
6001 | @opindex mfpe | |
6002 | @opindex mfp | |
b192711e | 6003 | This specifies the version of the floating point emulation available on |
630d3d5a | 6004 | the target. Permissible values are 2 and 3. @option{-mfp=} is a synonym |
161d7b59 | 6005 | for @option{-mfpe=}, for compatibility with older versions of GCC@. |
157a620e | 6006 | |
cd3bb277 JM |
6007 | @item -mstructure-size-boundary=@var{n} |
6008 | @opindex mstructure-size-boundary | |
157a620e | 6009 | The size of all structures and unions will be rounded up to a multiple |
ed0e6530 | 6010 | of the number of bits set by this option. Permissible values are 8 and |
157a620e NC |
6011 | 32. The default value varies for different toolchains. For the COFF |
6012 | targeted toolchain the default value is 8. Specifying the larger number | |
ed0e6530 | 6013 | can produce faster, more efficient code, but can also increase the size |
157a620e NC |
6014 | of the program. The two values are potentially incompatible. Code |
6015 | compiled with one value cannot necessarily expect to work with code or | |
6016 | libraries compiled with the other value, if they exchange information | |
247f8561 | 6017 | using structures or unions. |
157a620e | 6018 | |
f5a1b0d2 | 6019 | @item -mabort-on-noreturn |
cd3bb277 | 6020 | @opindex mabort-on-noreturn |
247f8561 PB |
6021 | Generate a call to the function @code{abort} at the end of a |
6022 | @code{noreturn} function. It will be executed if the function tries to | |
6023 | return. | |
f5a1b0d2 | 6024 | |
c27ba912 DM |
6025 | @item -mlong-calls |
6026 | @itemx -mno-long-calls | |
cd3bb277 JM |
6027 | @opindex mlong-calls |
6028 | @opindex mno-long-calls | |
c27ba912 DM |
6029 | Tells the compiler to perform function calls by first loading the |
6030 | address of the function into a register and then performing a subroutine | |
6031 | call on this register. This switch is needed if the target function | |
6032 | will lie outside of the 64 megabyte addressing range of the offset based | |
02f52e19 | 6033 | version of subroutine call instruction. |
c27ba912 DM |
6034 | |
6035 | Even if this switch is enabled, not all function calls will be turned | |
6036 | into long calls. The heuristic is that static functions, functions | |
6037 | which have the @samp{short-call} attribute, functions that are inside | |
6038 | the scope of a @samp{#pragma no_long_calls} directive and functions whose | |
6039 | definitions have already been compiled within the current compilation | |
6040 | unit, will not be turned into long calls. The exception to this rule is | |
b192711e | 6041 | that weak function definitions, functions with the @samp{long-call} |
c27ba912 DM |
6042 | attribute or the @samp{section} attribute, and functions that are within |
6043 | the scope of a @samp{#pragma long_calls} directive, will always be | |
6044 | turned into long calls. | |
6045 | ||
6046 | This feature is not enabled by default. Specifying | |
c21cd8b1 | 6047 | @option{-mno-long-calls} will restore the default behavior, as will |
c27ba912 DM |
6048 | placing the function calls within the scope of a @samp{#pragma |
6049 | long_calls_off} directive. Note these switches have no effect on how | |
6050 | the compiler generates code to handle function calls via function | |
02f52e19 | 6051 | pointers. |
c27ba912 | 6052 | |
62b10bbc | 6053 | @item -mnop-fun-dllimport |
cd3bb277 | 6054 | @opindex mnop-fun-dllimport |
aee96fe9 | 6055 | Disable support for the @code{dllimport} attribute. |
62b10bbc | 6056 | |
ed0e6530 | 6057 | @item -msingle-pic-base |
cd3bb277 | 6058 | @opindex msingle-pic-base |
ed0e6530 PB |
6059 | Treat the register used for PIC addressing as read-only, rather than |
6060 | loading it in the prologue for each function. The run-time system is | |
c21cd8b1 | 6061 | responsible for initializing this register with an appropriate value |
ed0e6530 PB |
6062 | before execution begins. |
6063 | ||
cd3bb277 JM |
6064 | @item -mpic-register=@var{reg} |
6065 | @opindex mpic-register | |
ed0e6530 PB |
6066 | Specify the register to be used for PIC addressing. The default is R10 |
6067 | unless stack-checking is enabled, when R9 is used. | |
6068 | ||
247f8561 | 6069 | @item -mpoke-function-name |
cd3bb277 | 6070 | @opindex mpoke-function-name |
247f8561 PB |
6071 | Write the name of each function into the text section, directly |
6072 | preceding the function prologue. The generated code is similar to this: | |
74291a4b | 6073 | |
247f8561 PB |
6074 | @smallexample |
6075 | t0 | |
6076 | .ascii "arm_poke_function_name", 0 | |
6077 | .align | |
6078 | t1 | |
6079 | .word 0xff000000 + (t1 - t0) | |
6080 | arm_poke_function_name | |
6081 | mov ip, sp | |
6082 | stmfd sp!, @{fp, ip, lr, pc@} | |
6083 | sub fp, ip, #4 | |
6084 | @end smallexample | |
157a620e | 6085 | |
247f8561 PB |
6086 | When performing a stack backtrace, code can inspect the value of |
6087 | @code{pc} stored at @code{fp + 0}. If the trace function then looks at | |
6088 | location @code{pc - 12} and the top 8 bits are set, then we know that | |
6089 | there is a function name embedded immediately preceding this location | |
6090 | and has length @code{((pc[-3]) & 0xff000000)}. | |
157a620e | 6091 | |
247f8561 | 6092 | @item -mthumb |
cd3bb277 | 6093 | @opindex mthumb |
247f8561 PB |
6094 | Generate code for the 16-bit Thumb instruction set. The default is to |
6095 | use the 32-bit ARM instruction set. | |
157a620e NC |
6096 | |
6097 | @item -mtpcs-frame | |
cd3bb277 | 6098 | @opindex mtpcs-frame |
157a620e NC |
6099 | Generate a stack frame that is compliant with the Thumb Procedure Call |
6100 | Standard for all non-leaf functions. (A leaf function is one that does | |
630d3d5a | 6101 | not call any other functions.) The default is @option{-mno-tpcs-frame}. |
157a620e NC |
6102 | |
6103 | @item -mtpcs-leaf-frame | |
cd3bb277 | 6104 | @opindex mtpcs-leaf-frame |
157a620e NC |
6105 | Generate a stack frame that is compliant with the Thumb Procedure Call |
6106 | Standard for all leaf functions. (A leaf function is one that does | |
630d3d5a | 6107 | not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. |
62b10bbc NC |
6108 | |
6109 | @item -mcallee-super-interworking | |
cd3bb277 | 6110 | @opindex mcallee-super-interworking |
62b10bbc NC |
6111 | Gives all externally visible functions in the file being compiled an ARM |
6112 | instruction set header which switches to Thumb mode before executing the | |
6113 | rest of the function. This allows these functions to be called from | |
6114 | non-interworking code. | |
6115 | ||
6116 | @item -mcaller-super-interworking | |
cd3bb277 | 6117 | @opindex mcaller-super-interworking |
62b10bbc NC |
6118 | Allows calls via function pointers (including virtual functions) to |
6119 | execute correctly regardless of whether the target code has been | |
6120 | compiled for interworking or not. There is a small overhead in the cost | |
4bdc1ac7 PB |
6121 | of executing a function pointer if this option is enabled. |
6122 | ||
157a620e NC |
6123 | @end table |
6124 | ||
ecff22ab JL |
6125 | @node MN10200 Options |
6126 | @subsection MN10200 Options | |
6127 | @cindex MN10200 options | |
630d3d5a | 6128 | These @option{-m} options are defined for Matsushita MN10200 architectures: |
2642624b | 6129 | @table @gcctabopt |
ecff22ab JL |
6130 | |
6131 | @item -mrelax | |
cd3bb277 | 6132 | @opindex mrelax |
ecff22ab JL |
6133 | Indicate to the linker that it should perform a relaxation optimization pass |
6134 | to shorten branches, calls and absolute memory addresses. This option only | |
6135 | has an effect when used on the command line for the final link step. | |
6136 | ||
02f52e19 | 6137 | This option makes symbolic debugging impossible. |
ecff22ab | 6138 | @end table |
157a620e | 6139 | |
6d6d0fa0 JL |
6140 | @node MN10300 Options |
6141 | @subsection MN10300 Options | |
6142 | @cindex MN10300 options | |
630d3d5a | 6143 | These @option{-m} options are defined for Matsushita MN10300 architectures: |
6d6d0fa0 | 6144 | |
2642624b | 6145 | @table @gcctabopt |
6d6d0fa0 | 6146 | @item -mmult-bug |
cd3bb277 | 6147 | @opindex mmult-bug |
6d6d0fa0 JL |
6148 | Generate code to avoid bugs in the multiply instructions for the MN10300 |
6149 | processors. This is the default. | |
6150 | ||
6151 | @item -mno-mult-bug | |
cd3bb277 | 6152 | @opindex mno-mult-bug |
6d6d0fa0 JL |
6153 | Do not generate code to avoid bugs in the multiply instructions for the |
6154 | MN10300 processors. | |
ecff22ab | 6155 | |
705ac34f | 6156 | @item -mam33 |
cd3bb277 | 6157 | @opindex mam33 |
705ac34f JL |
6158 | Generate code which uses features specific to the AM33 processor. |
6159 | ||
6160 | @item -mno-am33 | |
cd3bb277 | 6161 | @opindex mno-am33 |
705ac34f JL |
6162 | Do not generate code which uses features specific to the AM33 processor. This |
6163 | is the default. | |
6164 | ||
c474f76b AO |
6165 | @item -mno-crt0 |
6166 | @opindex mno-crt0 | |
6167 | Do not link in the C run-time initialization object file. | |
6168 | ||
ecff22ab | 6169 | @item -mrelax |
cd3bb277 | 6170 | @opindex mrelax |
ecff22ab JL |
6171 | Indicate to the linker that it should perform a relaxation optimization pass |
6172 | to shorten branches, calls and absolute memory addresses. This option only | |
6173 | has an effect when used on the command line for the final link step. | |
6174 | ||
02f52e19 | 6175 | This option makes symbolic debugging impossible. |
6d6d0fa0 JL |
6176 | @end table |
6177 | ||
ecff22ab | 6178 | |
861bb6c1 JL |
6179 | @node M32R/D Options |
6180 | @subsection M32R/D Options | |
6181 | @cindex M32R/D options | |
6182 | ||
630d3d5a | 6183 | These @option{-m} options are defined for Mitsubishi M32R/D architectures: |
861bb6c1 | 6184 | |
2642624b | 6185 | @table @gcctabopt |
98180123 NC |
6186 | @item -m32rx |
6187 | @opindex m32rx | |
0bf93a51 | 6188 | Generate code for the M32R/X@. |
98180123 NC |
6189 | |
6190 | @item -m32r | |
6191 | @opindex m32r | |
0bf93a51 | 6192 | Generate code for the M32R@. This is the default. |
de41e41c | 6193 | |
861bb6c1 | 6194 | @item -mcode-model=small |
cd3bb277 | 6195 | @opindex mcode-model=small |
861bb6c1 JL |
6196 | Assume all objects live in the lower 16MB of memory (so that their addresses |
6197 | can be loaded with the @code{ld24} instruction), and assume all subroutines | |
6198 | are reachable with the @code{bl} instruction. | |
6199 | This is the default. | |
6200 | ||
6201 | The addressability of a particular object can be set with the | |
6202 | @code{model} attribute. | |
6203 | ||
6204 | @item -mcode-model=medium | |
cd3bb277 | 6205 | @opindex mcode-model=medium |
02f52e19 | 6206 | Assume objects may be anywhere in the 32-bit address space (the compiler |
861bb6c1 JL |
6207 | will generate @code{seth/add3} instructions to load their addresses), and |
6208 | assume all subroutines are reachable with the @code{bl} instruction. | |
6209 | ||
6210 | @item -mcode-model=large | |
cd3bb277 | 6211 | @opindex mcode-model=large |
02f52e19 | 6212 | Assume objects may be anywhere in the 32-bit address space (the compiler |
861bb6c1 JL |
6213 | will generate @code{seth/add3} instructions to load their addresses), and |
6214 | assume subroutines may not be reachable with the @code{bl} instruction | |
6215 | (the compiler will generate the much slower @code{seth/add3/jl} | |
6216 | instruction sequence). | |
6217 | ||
6218 | @item -msdata=none | |
cd3bb277 | 6219 | @opindex msdata=none |
861bb6c1 JL |
6220 | Disable use of the small data area. Variables will be put into |
6221 | one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the | |
6222 | @code{section} attribute has been specified). | |
6223 | This is the default. | |
6224 | ||
6225 | The small data area consists of sections @samp{.sdata} and @samp{.sbss}. | |
6226 | Objects may be explicitly put in the small data area with the | |
6227 | @code{section} attribute using one of these sections. | |
6228 | ||
6229 | @item -msdata=sdata | |
cd3bb277 | 6230 | @opindex msdata=sdata |
861bb6c1 JL |
6231 | Put small global and static data in the small data area, but do not |
6232 | generate special code to reference them. | |
6233 | ||
6234 | @item -msdata=use | |
cd3bb277 | 6235 | @opindex msdata=use |
861bb6c1 JL |
6236 | Put small global and static data in the small data area, and generate |
6237 | special instructions to reference them. | |
6238 | ||
6239 | @item -G @var{num} | |
cd3bb277 | 6240 | @opindex G |
861bb6c1 JL |
6241 | @cindex smaller data references |
6242 | Put global and static objects less than or equal to @var{num} bytes | |
6243 | into the small data or bss sections instead of the normal data or bss | |
6244 | sections. The default value of @var{num} is 8. | |
630d3d5a | 6245 | The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} |
861bb6c1 JL |
6246 | for this option to have any effect. |
6247 | ||
630d3d5a | 6248 | All modules should be compiled with the same @option{-G @var{num}} value. |
861bb6c1 | 6249 | Compiling with different values of @var{num} may or may not work; if it |
695ac33f | 6250 | doesn't the linker will give an error message---incorrect code will not be |
861bb6c1 JL |
6251 | generated. |
6252 | ||
6253 | @end table | |
6254 | ||
74291a4b MM |
6255 | @node M88K Options |
6256 | @subsection M88K Options | |
6257 | @cindex M88k options | |
6258 | ||
6259 | These @samp{-m} options are defined for Motorola 88k architectures: | |
6260 | ||
2642624b | 6261 | @table @gcctabopt |
74291a4b | 6262 | @item -m88000 |
cd3bb277 | 6263 | @opindex m88000 |
74291a4b MM |
6264 | Generate code that works well on both the m88100 and the |
6265 | m88110. | |
6266 | ||
6267 | @item -m88100 | |
cd3bb277 | 6268 | @opindex m88100 |
74291a4b MM |
6269 | Generate code that works best for the m88100, but that also |
6270 | runs on the m88110. | |
6271 | ||
6272 | @item -m88110 | |
cd3bb277 | 6273 | @opindex m88110 |
74291a4b MM |
6274 | Generate code that works best for the m88110, and may not run |
6275 | on the m88100. | |
6276 | ||
6277 | @item -mbig-pic | |
cd3bb277 | 6278 | @opindex mbig-pic |
74291a4b | 6279 | Obsolete option to be removed from the next revision. |
630d3d5a | 6280 | Use @option{-fPIC}. |
74291a4b MM |
6281 | |
6282 | @item -midentify-revision | |
cd3bb277 | 6283 | @opindex midentify-revision |
74291a4b MM |
6284 | @cindex identifying source, compiler (88k) |
6285 | Include an @code{ident} directive in the assembler output recording the | |
6286 | source file name, compiler name and version, timestamp, and compilation | |
6287 | flags used. | |
6288 | ||
6289 | @item -mno-underscores | |
cd3bb277 | 6290 | @opindex mno-underscores |
74291a4b MM |
6291 | @cindex underscores, avoiding (88k) |
6292 | In assembler output, emit symbol names without adding an underscore | |
6293 | character at the beginning of each name. The default is to use an | |
6294 | underscore as prefix on each name. | |
6295 | ||
6296 | @item -mocs-debug-info | |
6297 | @itemx -mno-ocs-debug-info | |
cd3bb277 JM |
6298 | @opindex mocs-debug-info |
6299 | @opindex mno-ocs-debug-info | |
74291a4b MM |
6300 | @cindex OCS (88k) |
6301 | @cindex debugging, 88k OCS | |
6302 | Include (or omit) additional debugging information (about registers used | |
6303 | in each stack frame) as specified in the 88open Object Compatibility | |
161d7b59 | 6304 | Standard, ``OCS''@. This extra information allows debugging of code that |
74291a4b MM |
6305 | has had the frame pointer eliminated. The default for DG/UX, SVr4, and |
6306 | Delta 88 SVr3.2 is to include this information; other 88k configurations | |
6307 | omit this information by default. | |
6308 | ||
6309 | @item -mocs-frame-position | |
cd3bb277 | 6310 | @opindex mocs-frame-position |
74291a4b MM |
6311 | @cindex register positions in frame (88k) |
6312 | When emitting COFF debugging information for automatic variables and | |
6313 | parameters stored on the stack, use the offset from the canonical frame | |
6314 | address, which is the stack pointer (register 31) on entry to the | |
6315 | function. The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use | |
630d3d5a JM |
6316 | @option{-mocs-frame-position}; other 88k configurations have the default |
6317 | @option{-mno-ocs-frame-position}. | |
74291a4b MM |
6318 | |
6319 | @item -mno-ocs-frame-position | |
cd3bb277 | 6320 | @opindex mno-ocs-frame-position |
74291a4b MM |
6321 | @cindex register positions in frame (88k) |
6322 | When emitting COFF debugging information for automatic variables and | |
6323 | parameters stored on the stack, use the offset from the frame pointer | |
6324 | register (register 30). When this option is in effect, the frame | |
6325 | pointer is not eliminated when debugging information is selected by the | |
6326 | -g switch. | |
6327 | ||
6328 | @item -moptimize-arg-area | |
cd3bb277 | 6329 | @opindex moptimize-arg-area |
74291a4b | 6330 | @cindex arguments in frame (88k) |
9c34dbbf ZW |
6331 | Save space by reorganizing the stack frame. This option generates code |
6332 | that does not agree with the 88open specifications, but uses less | |
6333 | memory. | |
6334 | ||
6335 | @itemx -mno-optimize-arg-area | |
6336 | @opindex mno-optimize-arg-area | |
6337 | Do not reorganize the stack frame to save space. This is the default. | |
6338 | The generated conforms to the specification, but uses more memory. | |
74291a4b MM |
6339 | |
6340 | @item -mshort-data-@var{num} | |
cd3bb277 | 6341 | @opindex mshort-data |
74291a4b MM |
6342 | @cindex smaller data references (88k) |
6343 | @cindex r0-relative references (88k) | |
6344 | Generate smaller data references by making them relative to @code{r0}, | |
6345 | which allows loading a value using a single instruction (rather than the | |
6346 | usual two). You control which data references are affected by | |
6347 | specifying @var{num} with this option. For example, if you specify | |
630d3d5a | 6348 | @option{-mshort-data-512}, then the data references affected are those |
74291a4b | 6349 | involving displacements of less than 512 bytes. |
630d3d5a | 6350 | @option{-mshort-data-@var{num}} is not effective for @var{num} greater |
74291a4b MM |
6351 | than 64k. |
6352 | ||
6353 | @item -mserialize-volatile | |
cd3bb277 | 6354 | @opindex mserialize-volatile |
74291a4b | 6355 | @itemx -mno-serialize-volatile |
cd3bb277 | 6356 | @opindex mno-serialize-volatile |
74291a4b MM |
6357 | @cindex sequential consistency on 88k |
6358 | Do, or don't, generate code to guarantee sequential consistency | |
6359 | of volatile memory references. By default, consistency is | |
6360 | guaranteed. | |
6361 | ||
6362 | The order of memory references made by the MC88110 processor does | |
6363 | not always match the order of the instructions requesting those | |
6364 | references. In particular, a load instruction may execute before | |
6365 | a preceding store instruction. Such reordering violates | |
6366 | sequential consistency of volatile memory references, when there | |
6367 | are multiple processors. When consistency must be guaranteed, | |
f0523f02 | 6368 | GCC generates special instructions, as needed, to force |
74291a4b MM |
6369 | execution in the proper order. |
6370 | ||
6371 | The MC88100 processor does not reorder memory references and so | |
f0523f02 JM |
6372 | always provides sequential consistency. However, by default, GCC |
6373 | generates the special instructions to guarantee consistency | |
630d3d5a | 6374 | even when you use @option{-m88100}, so that the code may be run on an |
74291a4b | 6375 | MC88110 processor. If you intend to run your code only on the |
630d3d5a | 6376 | MC88100 processor, you may use @option{-mno-serialize-volatile}. |
74291a4b MM |
6377 | |
6378 | The extra code generated to guarantee consistency may affect the | |
6379 | performance of your application. If you know that you can safely | |
630d3d5a | 6380 | forgo this guarantee, you may use @option{-mno-serialize-volatile}. |
74291a4b MM |
6381 | |
6382 | @item -msvr4 | |
6383 | @itemx -msvr3 | |
cd3bb277 JM |
6384 | @opindex msvr4 |
6385 | @opindex msvr3 | |
74291a4b MM |
6386 | @cindex assembler syntax, 88k |
6387 | @cindex SVr4 | |
630d3d5a | 6388 | Turn on (@option{-msvr4}) or off (@option{-msvr3}) compiler extensions |
74291a4b MM |
6389 | related to System V release 4 (SVr4). This controls the following: |
6390 | ||
6391 | @enumerate | |
6392 | @item | |
6393 | Which variant of the assembler syntax to emit. | |
6394 | @item | |
630d3d5a | 6395 | @option{-msvr4} makes the C preprocessor recognize @samp{#pragma weak} |
74291a4b MM |
6396 | that is used on System V release 4. |
6397 | @item | |
630d3d5a | 6398 | @option{-msvr4} makes GCC issue additional declaration directives used in |
74291a4b MM |
6399 | SVr4. |
6400 | @end enumerate | |
6401 | ||
630d3d5a | 6402 | @option{-msvr4} is the default for the m88k-motorola-sysv4 and |
767094dd | 6403 | m88k-dg-dgux m88k configurations. @option{-msvr3} is the default for all |
74291a4b MM |
6404 | other m88k configurations. |
6405 | ||
6406 | @item -mversion-03.00 | |
cd3bb277 | 6407 | @opindex mversion-03.00 |
74291a4b MM |
6408 | This option is obsolete, and is ignored. |
6409 | @c ??? which asm syntax better for GAS? option there too? | |
6410 | ||
6411 | @item -mno-check-zero-division | |
6412 | @itemx -mcheck-zero-division | |
cd3bb277 JM |
6413 | @opindex mno-check-zero-division |
6414 | @opindex mcheck-zero-division | |
74291a4b MM |
6415 | @cindex zero division on 88k |
6416 | Do, or don't, generate code to guarantee that integer division by | |
6417 | zero will be detected. By default, detection is guaranteed. | |
6418 | ||
6419 | Some models of the MC88100 processor fail to trap upon integer | |
6420 | division by zero under certain conditions. By default, when | |
f0523f02 | 6421 | compiling code that might be run on such a processor, GCC |
74291a4b MM |
6422 | generates code that explicitly checks for zero-valued divisors |
6423 | and traps with exception number 503 when one is detected. Use of | |
9c34dbbf | 6424 | @option{-mno-check-zero-division} suppresses such checking for code |
74291a4b MM |
6425 | generated to run on an MC88100 processor. |
6426 | ||
9c34dbbf ZW |
6427 | GCC assumes that the MC88110 processor correctly detects all instances |
6428 | of integer division by zero. When @option{-m88110} is specified, no | |
6429 | explicit checks for zero-valued divisors are generated, and both | |
6430 | @option{-mcheck-zero-division} and @option{-mno-check-zero-division} are | |
6431 | ignored. | |
74291a4b MM |
6432 | |
6433 | @item -muse-div-instruction | |
cd3bb277 | 6434 | @opindex muse-div-instruction |
74291a4b MM |
6435 | @cindex divide instruction, 88k |
6436 | Use the div instruction for signed integer division on the | |
6437 | MC88100 processor. By default, the div instruction is not used. | |
6438 | ||
6439 | On the MC88100 processor the signed integer division instruction | |
6440 | div) traps to the operating system on a negative operand. The | |
6441 | operating system transparently completes the operation, but at a | |
6442 | large cost in execution time. By default, when compiling code | |
f0523f02 | 6443 | that might be run on an MC88100 processor, GCC emulates signed |
74291a4b MM |
6444 | integer division using the unsigned integer division instruction |
6445 | divu), thereby avoiding the large penalty of a trap to the | |
6446 | operating system. Such emulation has its own, smaller, execution | |
6447 | cost in both time and space. To the extent that your code's | |
6448 | important signed integer division operations are performed on two | |
6449 | nonnegative operands, it may be desirable to use the div | |
6450 | instruction directly. | |
6451 | ||
6452 | On the MC88110 processor the div instruction (also known as the | |
6453 | divs instruction) processes negative operands without trapping to | |
630d3d5a JM |
6454 | the operating system. When @option{-m88110} is specified, |
6455 | @option{-muse-div-instruction} is ignored, and the div instruction is used | |
74291a4b MM |
6456 | for signed integer division. |
6457 | ||
630d3d5a | 6458 | Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined. In |
74291a4b | 6459 | particular, the behavior of such a division with and without |
630d3d5a | 6460 | @option{-muse-div-instruction} may differ. |
74291a4b MM |
6461 | |
6462 | @item -mtrap-large-shift | |
6463 | @itemx -mhandle-large-shift | |
cd3bb277 JM |
6464 | @opindex mtrap-large-shift |
6465 | @opindex mhandle-large-shift | |
74291a4b MM |
6466 | @cindex bit shift overflow (88k) |
6467 | @cindex large bit shifts (88k) | |
6468 | Include code to detect bit-shifts of more than 31 bits; respectively, | |
0c2d1a2a | 6469 | trap such shifts or emit code to handle them properly. By default GCC |
74291a4b MM |
6470 | makes no special provision for large bit shifts. |
6471 | ||
6472 | @item -mwarn-passed-structs | |
cd3bb277 | 6473 | @opindex mwarn-passed-structs |
74291a4b MM |
6474 | @cindex structure passing (88k) |
6475 | Warn when a function passes a struct as an argument or result. | |
6476 | Structure-passing conventions have changed during the evolution of the C | |
6477 | language, and are often the source of portability problems. By default, | |
0c2d1a2a | 6478 | GCC issues no such warning. |
74291a4b MM |
6479 | @end table |
6480 | ||
9c34dbbf ZW |
6481 | @c break page here to avoid unsightly interparagraph stretch. |
6482 | @c -zw, 2001-8-17 | |
6483 | @page | |
6484 | ||
74291a4b MM |
6485 | @node RS/6000 and PowerPC Options |
6486 | @subsection IBM RS/6000 and PowerPC Options | |
6487 | @cindex RS/6000 and PowerPC Options | |
6488 | @cindex IBM RS/6000 and PowerPC Options | |
6489 | ||
6490 | These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: | |
2642624b | 6491 | @table @gcctabopt |
74291a4b MM |
6492 | @item -mpower |
6493 | @itemx -mno-power | |
6494 | @itemx -mpower2 | |
6495 | @itemx -mno-power2 | |
6496 | @itemx -mpowerpc | |
6497 | @itemx -mno-powerpc | |
6498 | @itemx -mpowerpc-gpopt | |
6499 | @itemx -mno-powerpc-gpopt | |
6500 | @itemx -mpowerpc-gfxopt | |
6501 | @itemx -mno-powerpc-gfxopt | |
7fe90e7b DE |
6502 | @itemx -mpowerpc64 |
6503 | @itemx -mno-powerpc64 | |
cd3bb277 JM |
6504 | @opindex mpower |
6505 | @opindex mno-power | |
6506 | @opindex mpower2 | |
6507 | @opindex mno-power2 | |
6508 | @opindex mpowerpc | |
6509 | @opindex mno-powerpc | |
6510 | @opindex mpowerpc-gpopt | |
6511 | @opindex mno-powerpc-gpopt | |
6512 | @opindex mpowerpc-gfxopt | |
6513 | @opindex mno-powerpc-gfxopt | |
6514 | @opindex mpowerpc64 | |
6515 | @opindex mno-powerpc64 | |
0c2d1a2a | 6516 | GCC supports two related instruction set architectures for the |
161d7b59 | 6517 | RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those |
74291a4b MM |
6518 | instructions supported by the @samp{rios} chip set used in the original |
6519 | RS/6000 systems and the @dfn{PowerPC} instruction set is the | |
6520 | architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and | |
861bb6c1 | 6521 | the IBM 4xx microprocessors. |
74291a4b MM |
6522 | |
6523 | Neither architecture is a subset of the other. However there is a | |
6524 | large common subset of instructions supported by both. An MQ | |
6525 | register is included in processors supporting the POWER architecture. | |
6526 | ||
6527 | You use these options to specify which instructions are available on the | |
6528 | processor you are using. The default value of these options is | |
161d7b59 | 6529 | determined when configuring GCC@. Specifying the |
630d3d5a JM |
6530 | @option{-mcpu=@var{cpu_type}} overrides the specification of these |
6531 | options. We recommend you use the @option{-mcpu=@var{cpu_type}} option | |
74291a4b MM |
6532 | rather than the options listed above. |
6533 | ||
630d3d5a | 6534 | The @option{-mpower} option allows GCC to generate instructions that |
74291a4b | 6535 | are found only in the POWER architecture and to use the MQ register. |
630d3d5a | 6536 | Specifying @option{-mpower2} implies @option{-power} and also allows GCC |
74291a4b MM |
6537 | to generate instructions that are present in the POWER2 architecture but |
6538 | not the original POWER architecture. | |
6539 | ||
630d3d5a | 6540 | The @option{-mpowerpc} option allows GCC to generate instructions that |
74291a4b | 6541 | are found only in the 32-bit subset of the PowerPC architecture. |
630d3d5a | 6542 | Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows |
0c2d1a2a | 6543 | GCC to use the optional PowerPC architecture instructions in the |
74291a4b | 6544 | General Purpose group, including floating-point square root. Specifying |
630d3d5a | 6545 | @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to |
74291a4b MM |
6546 | use the optional PowerPC architecture instructions in the Graphics |
6547 | group, including floating-point select. | |
6548 | ||
630d3d5a | 6549 | The @option{-mpowerpc64} option allows GCC to generate the additional |
7fe90e7b | 6550 | 64-bit instructions that are found in the full PowerPC64 architecture |
0c2d1a2a | 6551 | and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to |
630d3d5a | 6552 | @option{-mno-powerpc64}. |
7fe90e7b | 6553 | |
630d3d5a | 6554 | If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC |
74291a4b MM |
6555 | will use only the instructions in the common subset of both |
6556 | architectures plus some special AIX common-mode calls, and will not use | |
630d3d5a | 6557 | the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc} |
0c2d1a2a | 6558 | permits GCC to use any instruction from either architecture and to |
74291a4b MM |
6559 | allow use of the MQ register; specify this for the Motorola MPC601. |
6560 | ||
6561 | @item -mnew-mnemonics | |
6562 | @itemx -mold-mnemonics | |
cd3bb277 JM |
6563 | @opindex mnew-mnemonics |
6564 | @opindex mold-mnemonics | |
9c34dbbf ZW |
6565 | Select which mnemonics to use in the generated assembler code. With |
6566 | @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for | |
6567 | the PowerPC architecture. With @option{-mold-mnemonics} it uses the | |
6568 | assembler mnemonics defined for the POWER architecture. Instructions | |
6569 | defined in only one architecture have only one mnemonic; GCC uses that | |
6570 | mnemonic irrespective of which of these options is specified. | |
74291a4b | 6571 | |
0c2d1a2a | 6572 | GCC defaults to the mnemonics appropriate for the architecture in |
630d3d5a | 6573 | use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the |
7fe90e7b | 6574 | value of these option. Unless you are building a cross-compiler, you |
630d3d5a JM |
6575 | should normally not specify either @option{-mnew-mnemonics} or |
6576 | @option{-mold-mnemonics}, but should instead accept the default. | |
74291a4b MM |
6577 | |
6578 | @item -mcpu=@var{cpu_type} | |
cd3bb277 | 6579 | @opindex mcpu |
74291a4b MM |
6580 | Set architecture type, register usage, choice of mnemonics, and |
6581 | instruction scheduling parameters for machine type @var{cpu_type}. | |
5f59ecb7 DE |
6582 | Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1}, |
6583 | @samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602}, | |
6584 | @samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, | |
ed947a96 DJ |
6585 | @samp{630}, @samp{740}, @samp{7400}, @samp{7450}, @samp{750}, |
6586 | @samp{power}, @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505}, | |
6587 | @samp{801}, @samp{821}, @samp{823}, and @samp{860} and @samp{common}. | |
9c34dbbf ZW |
6588 | |
6589 | @option{-mcpu=common} selects a completely generic processor. Code | |
6590 | generated under this option will run on any POWER or PowerPC processor. | |
6591 | GCC will use only the instructions in the common subset of both | |
6592 | architectures, and will not use the MQ register. GCC assumes a generic | |
74291a4b MM |
6593 | processor model for scheduling purposes. |
6594 | ||
9c34dbbf ZW |
6595 | @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and |
6596 | @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit | |
6597 | PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine | |
6598 | types, with an appropriate, generic processor model assumed for | |
6599 | scheduling purposes. | |
74291a4b | 6600 | |
9c34dbbf ZW |
6601 | The other options specify a specific processor. Code generated under |
6602 | those options will run best on that processor, and may not run at all on | |
6603 | others. | |
6604 | ||
6605 | The @option{-mcpu} options automatically enable or disable other | |
6606 | @option{-m} options as follows: | |
6607 | ||
6608 | @table @samp | |
6609 | @item common | |
6610 | @option{-mno-power}, @option{-mno-powerc} | |
6611 | ||
6612 | @item power | |
6613 | @itemx power2 | |
6614 | @itemx rios1 | |
6615 | @itemx rios2 | |
6616 | @itemx rsc | |
6617 | @option{-mpower}, @option{-mno-powerpc}, @option{-mno-new-mnemonics} | |
6618 | ||
6619 | @item powerpc | |
6620 | @itemx rs64a | |
6621 | @itemx 602 | |
6622 | @itemx 603 | |
6623 | @itemx 603e | |
6624 | @itemx 604 | |
6625 | @itemx 620 | |
6626 | @itemx 630 | |
6627 | @itemx 740 | |
ed947a96 DJ |
6628 | @itemx 7400 |
6629 | @itemx 7450 | |
9c34dbbf ZW |
6630 | @itemx 750 |
6631 | @itemx 505 | |
6632 | @option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics} | |
6633 | ||
6634 | @item 601 | |
6635 | @option{-mpower}, @option{-mpowerpc}, @option{-mnew-mnemonics} | |
6636 | ||
6637 | @item 403 | |
6638 | @itemx 821 | |
6639 | @itemx 860 | |
6640 | @option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}, @option{-msoft-float} | |
6641 | @end table | |
74291a4b MM |
6642 | |
6643 | @item -mtune=@var{cpu_type} | |
cd3bb277 | 6644 | @opindex mtune |
74291a4b | 6645 | Set the instruction scheduling parameters for machine type |
9c34dbbf ZW |
6646 | @var{cpu_type}, but do not set the architecture type, register usage, or |
6647 | choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same | |
6648 | values for @var{cpu_type} are used for @option{-mtune} as for | |
6649 | @option{-mcpu}. If both are specified, the code generated will use the | |
6650 | architecture, registers, and mnemonics set by @option{-mcpu}, but the | |
6651 | scheduling parameters set by @option{-mtune}. | |
74291a4b | 6652 | |
0ac081f6 AH |
6653 | @item -maltivec |
6654 | @itemx -mno-altivec | |
6655 | @opindex maltivec | |
6656 | @opindex mno-altivec | |
6657 | These switches enable or disable the use of built-in functions that | |
6658 | allow access to the AltiVec instruction set. You may also need to set | |
6659 | @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI | |
6660 | enhancements. | |
6661 | ||
74291a4b MM |
6662 | @item -mfull-toc |
6663 | @itemx -mno-fp-in-toc | |
6664 | @itemx -mno-sum-in-toc | |
6665 | @itemx -mminimal-toc | |
cd3bb277 JM |
6666 | @opindex mfull-toc |
6667 | @opindex mno-fp-in-toc | |
6668 | @opindex mno-sum-in-toc | |
6669 | @opindex mminimal-toc | |
74291a4b | 6670 | Modify generation of the TOC (Table Of Contents), which is created for |
630d3d5a | 6671 | every executable file. The @option{-mfull-toc} option is selected by |
0c2d1a2a JB |
6672 | default. In that case, GCC will allocate at least one TOC entry for |
6673 | each unique non-automatic variable reference in your program. GCC | |
161d7b59 JM |
6674 | will also place floating-point constants in the TOC@. However, only |
6675 | 16,384 entries are available in the TOC@. | |
74291a4b MM |
6676 | |
6677 | If you receive a linker error message that saying you have overflowed | |
6678 | the available TOC space, you can reduce the amount of TOC space used | |
630d3d5a JM |
6679 | with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. |
6680 | @option{-mno-fp-in-toc} prevents GCC from putting floating-point | |
6681 | constants in the TOC and @option{-mno-sum-in-toc} forces GCC to | |
74291a4b | 6682 | generate code to calculate the sum of an address and a constant at |
161d7b59 | 6683 | run-time instead of putting that sum into the TOC@. You may specify one |
0c2d1a2a | 6684 | or both of these options. Each causes GCC to produce very slightly |
74291a4b MM |
6685 | slower and larger code at the expense of conserving TOC space. |
6686 | ||
6687 | If you still run out of space in the TOC even when you specify both of | |
630d3d5a | 6688 | these options, specify @option{-mminimal-toc} instead. This option causes |
0c2d1a2a JB |
6689 | GCC to make only one TOC entry for every file. When you specify this |
6690 | option, GCC will produce code that is slower and larger but which | |
74291a4b | 6691 | uses extremely little TOC space. You may wish to use this option |
bd819a4a | 6692 | only on files that contain less frequently executed code. |
74291a4b | 6693 | |
fa06229f GK |
6694 | @item -maix64 |
6695 | @itemx -maix32 | |
cd3bb277 JM |
6696 | @opindex maix64 |
6697 | @opindex maix32 | |
fa06229f | 6698 | Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit |
7fe90e7b | 6699 | @code{long} type, and the infrastructure needed to support them. |
630d3d5a JM |
6700 | Specifying @option{-maix64} implies @option{-mpowerpc64} and |
6701 | @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and | |
6702 | implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. | |
7fe90e7b | 6703 | |
74291a4b MM |
6704 | @item -mxl-call |
6705 | @itemx -mno-xl-call | |
cd3bb277 JM |
6706 | @opindex mxl-call |
6707 | @opindex mno-xl-call | |
74291a4b MM |
6708 | On AIX, pass floating-point arguments to prototyped functions beyond the |
6709 | register save area (RSA) on the stack in addition to argument FPRs. The | |
6710 | AIX calling convention was extended but not initially documented to | |
6711 | handle an obscure K&R C case of calling a function that takes the | |
6712 | address of its arguments with fewer arguments than declared. AIX XL | |
7fe90e7b DE |
6713 | compilers access floating point arguments which do not fit in the |
6714 | RSA from the stack when a subroutine is compiled without | |
74291a4b MM |
6715 | optimization. Because always storing floating-point arguments on the |
6716 | stack is inefficient and rarely needed, this option is not enabled by | |
6717 | default and only is necessary when calling subroutines compiled by AIX | |
6718 | XL compilers without optimization. | |
6719 | ||
861bb6c1 | 6720 | @item -mpe |
cd3bb277 | 6721 | @opindex mpe |
161d7b59 | 6722 | Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an |
861bb6c1 JL |
6723 | application written to use message passing with special startup code to |
6724 | enable the application to run. The system must have PE installed in the | |
6725 | standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file | |
630d3d5a | 6726 | must be overridden with the @option{-specs=} option to specify the |
861bb6c1 | 6727 | appropriate directory location. The Parallel Environment does not |
0a379b7a | 6728 | support threads, so the @option{-mpe} option and the @option{-pthread} |
861bb6c1 JL |
6729 | option are incompatible. |
6730 | ||
74291a4b MM |
6731 | @item -msoft-float |
6732 | @itemx -mhard-float | |
cd3bb277 JM |
6733 | @opindex msoft-float |
6734 | @opindex mhard-float | |
74291a4b MM |
6735 | Generate code that does not use (uses) the floating-point register set. |
6736 | Software floating point emulation is provided if you use the | |
630d3d5a | 6737 | @option{-msoft-float} option, and pass the option to GCC when linking. |
74291a4b MM |
6738 | |
6739 | @item -mmultiple | |
6740 | @itemx -mno-multiple | |
cd3bb277 JM |
6741 | @opindex mmultiple |
6742 | @opindex mno-multiple | |
74291a4b MM |
6743 | Generate code that uses (does not use) the load multiple word |
6744 | instructions and the store multiple word instructions. These | |
6745 | instructions are generated by default on POWER systems, and not | |
630d3d5a | 6746 | generated on PowerPC systems. Do not use @option{-mmultiple} on little |
74291a4b | 6747 | endian PowerPC systems, since those instructions do not work when the |
bef84347 VM |
6748 | processor is in little endian mode. The exceptions are PPC740 and |
6749 | PPC750 which permit the instructions usage in little endian mode. | |
74291a4b MM |
6750 | |
6751 | @item -mstring | |
6752 | @itemx -mno-string | |
cd3bb277 JM |
6753 | @opindex mstring |
6754 | @opindex mno-string | |
bef84347 VM |
6755 | Generate code that uses (does not use) the load string instructions |
6756 | and the store string word instructions to save multiple registers and | |
6757 | do small block moves. These instructions are generated by default on | |
6758 | POWER systems, and not generated on PowerPC systems. Do not use | |
630d3d5a | 6759 | @option{-mstring} on little endian PowerPC systems, since those |
bef84347 VM |
6760 | instructions do not work when the processor is in little endian mode. |
6761 | The exceptions are PPC740 and PPC750 which permit the instructions | |
6762 | usage in little endian mode. | |
74291a4b | 6763 | |
861bb6c1 JL |
6764 | @item -mupdate |
6765 | @itemx -mno-update | |
cd3bb277 JM |
6766 | @opindex mupdate |
6767 | @opindex mno-update | |
861bb6c1 JL |
6768 | Generate code that uses (does not use) the load or store instructions |
6769 | that update the base register to the address of the calculated memory | |
6770 | location. These instructions are generated by default. If you use | |
630d3d5a | 6771 | @option{-mno-update}, there is a small window between the time that the |
861bb6c1 JL |
6772 | stack pointer is updated and the address of the previous frame is |
6773 | stored, which means code that walks the stack frame across interrupts or | |
6774 | signals may get corrupted data. | |
6775 | ||
6776 | @item -mfused-madd | |
6777 | @itemx -mno-fused-madd | |
cd3bb277 JM |
6778 | @opindex mfused-madd |
6779 | @opindex mno-fused-madd | |
861bb6c1 JL |
6780 | Generate code that uses (does not use) the floating point multiply and |
6781 | accumulate instructions. These instructions are generated by default if | |
6782 | hardware floating is used. | |
6783 | ||
74291a4b MM |
6784 | @item -mno-bit-align |
6785 | @itemx -mbit-align | |
cd3bb277 JM |
6786 | @opindex mno-bit-align |
6787 | @opindex mbit-align | |
74291a4b | 6788 | On System V.4 and embedded PowerPC systems do not (do) force structures |
c771326b JM |
6789 | and unions that contain bit-fields to be aligned to the base type of the |
6790 | bit-field. | |
74291a4b MM |
6791 | |
6792 | For example, by default a structure containing nothing but 8 | |
c771326b | 6793 | @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte |
630d3d5a | 6794 | boundary and have a size of 4 bytes. By using @option{-mno-bit-align}, |
74291a4b MM |
6795 | the structure would be aligned to a 1 byte boundary and be one byte in |
6796 | size. | |
6797 | ||
6798 | @item -mno-strict-align | |
6799 | @itemx -mstrict-align | |
cd3bb277 JM |
6800 | @opindex mno-strict-align |
6801 | @opindex mstrict-align | |
74291a4b MM |
6802 | On System V.4 and embedded PowerPC systems do not (do) assume that |
6803 | unaligned memory references will be handled by the system. | |
6804 | ||
6805 | @item -mrelocatable | |
6806 | @itemx -mno-relocatable | |
cd3bb277 JM |
6807 | @opindex mrelocatable |
6808 | @opindex mno-relocatable | |
74291a4b MM |
6809 | On embedded PowerPC systems generate code that allows (does not allow) |
6810 | the program to be relocated to a different address at runtime. If you | |
630d3d5a JM |
6811 | use @option{-mrelocatable} on any module, all objects linked together must |
6812 | be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}. | |
74291a4b MM |
6813 | |
6814 | @item -mrelocatable-lib | |
6815 | @itemx -mno-relocatable-lib | |
cd3bb277 JM |
6816 | @opindex mrelocatable-lib |
6817 | @opindex mno-relocatable-lib | |
74291a4b MM |
6818 | On embedded PowerPC systems generate code that allows (does not allow) |
6819 | the program to be relocated to a different address at runtime. Modules | |
630d3d5a JM |
6820 | compiled with @option{-mrelocatable-lib} can be linked with either modules |
6821 | compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or | |
6822 | with modules compiled with the @option{-mrelocatable} options. | |
74291a4b MM |
6823 | |
6824 | @item -mno-toc | |
6825 | @itemx -mtoc | |
cd3bb277 JM |
6826 | @opindex mno-toc |
6827 | @opindex mtoc | |
74291a4b MM |
6828 | On System V.4 and embedded PowerPC systems do not (do) assume that |
6829 | register 2 contains a pointer to a global area pointing to the addresses | |
6830 | used in the program. | |
6831 | ||
74291a4b MM |
6832 | @item -mlittle |
6833 | @itemx -mlittle-endian | |
cd3bb277 JM |
6834 | @opindex mlittle |
6835 | @opindex mlittle-endian | |
74291a4b | 6836 | On System V.4 and embedded PowerPC systems compile code for the |
630d3d5a JM |
6837 | processor in little endian mode. The @option{-mlittle-endian} option is |
6838 | the same as @option{-mlittle}. | |
74291a4b MM |
6839 | |
6840 | @item -mbig | |
6841 | @itemx -mbig-endian | |
cd3bb277 JM |
6842 | @opindex mbig |
6843 | @opindex mbig-endian | |
74291a4b | 6844 | On System V.4 and embedded PowerPC systems compile code for the |
630d3d5a JM |
6845 | processor in big endian mode. The @option{-mbig-endian} option is |
6846 | the same as @option{-mbig}. | |
74291a4b MM |
6847 | |
6848 | @item -mcall-sysv | |
cd3bb277 | 6849 | @opindex mcall-sysv |
74291a4b MM |
6850 | On System V.4 and embedded PowerPC systems compile code using calling |
6851 | conventions that adheres to the March 1995 draft of the System V | |
6852 | Application Binary Interface, PowerPC processor supplement. This is the | |
6853 | default unless you configured GCC using @samp{powerpc-*-eabiaix}. | |
6854 | ||
6855 | @item -mcall-sysv-eabi | |
cd3bb277 | 6856 | @opindex mcall-sysv-eabi |
630d3d5a | 6857 | Specify both @option{-mcall-sysv} and @option{-meabi} options. |
74291a4b MM |
6858 | |
6859 | @item -mcall-sysv-noeabi | |
cd3bb277 | 6860 | @opindex mcall-sysv-noeabi |
630d3d5a | 6861 | Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. |
74291a4b MM |
6862 | |
6863 | @item -mcall-aix | |
cd3bb277 | 6864 | @opindex mcall-aix |
74291a4b | 6865 | On System V.4 and embedded PowerPC systems compile code using calling |
161d7b59 | 6866 | conventions that are similar to those used on AIX@. This is the |
74291a4b MM |
6867 | default if you configured GCC using @samp{powerpc-*-eabiaix}. |
6868 | ||
6869 | @item -mcall-solaris | |
cd3bb277 | 6870 | @opindex mcall-solaris |
74291a4b MM |
6871 | On System V.4 and embedded PowerPC systems compile code for the Solaris |
6872 | operating system. | |
6873 | ||
6874 | @item -mcall-linux | |
cd3bb277 | 6875 | @opindex mcall-linux |
861bb6c1 JL |
6876 | On System V.4 and embedded PowerPC systems compile code for the |
6877 | Linux-based GNU system. | |
74291a4b | 6878 | |
48180d68 RM |
6879 | @item -mcall-gnu |
6880 | @opindex mcall-gnu | |
6881 | On System V.4 and embedded PowerPC systems compile code for the | |
6882 | Hurd-based GNU system. | |
6883 | ||
edf1b3f3 AC |
6884 | @item -mcall-netbsd |
6885 | @opindex mcall-netbsd | |
6886 | On System V.4 and embedded PowerPC systems compile code for the | |
6887 | NetBSD operating system. | |
6888 | ||
9904592e ZW |
6889 | @item -maix-struct-return |
6890 | @opindex maix-struct-return | |
6891 | Return all structures in memory (as specified by the AIX ABI)@. | |
6892 | ||
6893 | @item -msvr4-struct-return | |
6894 | @opindex msvr4-struct-return | |
6895 | Return structures smaller than 8 bytes in registers (as specified by the | |
6896 | SVR4 ABI)@. | |
6897 | ||
0ac081f6 AH |
6898 | @item -mabi=altivec |
6899 | @opindex mabi=altivec | |
6900 | Extend the current ABI with AltiVec ABI extensions. This does not | |
6901 | change the default ABI, instead it adds the AltiVec ABI extensions to | |
6902 | the current ABI@. | |
6903 | ||
74291a4b | 6904 | @item -mprototype |
e9a25f70 | 6905 | @itemx -mno-prototype |
cd3bb277 JM |
6906 | @opindex mprototype |
6907 | @opindex mno-prototype | |
74291a4b MM |
6908 | On System V.4 and embedded PowerPC systems assume that all calls to |
6909 | variable argument functions are properly prototyped. Otherwise, the | |
6910 | compiler must insert an instruction before every non prototyped call to | |
6911 | set or clear bit 6 of the condition code register (@var{CR}) to | |
6912 | indicate whether floating point values were passed in the floating point | |
6913 | registers in case the function takes a variable arguments. With | |
630d3d5a | 6914 | @option{-mprototype}, only calls to prototyped variable argument functions |
74291a4b MM |
6915 | will set or clear the bit. |
6916 | ||
6917 | @item -msim | |
cd3bb277 | 6918 | @opindex msim |
74291a4b MM |
6919 | On embedded PowerPC systems, assume that the startup module is called |
6920 | @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and | |
6921 | @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}. | |
6922 | configurations. | |
6923 | ||
6924 | @item -mmvme | |
cd3bb277 | 6925 | @opindex mmvme |
74291a4b | 6926 | On embedded PowerPC systems, assume that the startup module is called |
e9a25f70 JL |
6927 | @file{crt0.o} and the standard C libraries are @file{libmvme.a} and |
6928 | @file{libc.a}. | |
6929 | ||
6930 | @item -mads | |
cd3bb277 | 6931 | @opindex mads |
e9a25f70 JL |
6932 | On embedded PowerPC systems, assume that the startup module is called |
6933 | @file{crt0.o} and the standard C libraries are @file{libads.a} and | |
6934 | @file{libc.a}. | |
6935 | ||
6936 | @item -myellowknife | |
cd3bb277 | 6937 | @opindex myellowknife |
e9a25f70 JL |
6938 | On embedded PowerPC systems, assume that the startup module is called |
6939 | @file{crt0.o} and the standard C libraries are @file{libyk.a} and | |
74291a4b MM |
6940 | @file{libc.a}. |
6941 | ||
bff46771 | 6942 | @item -mvxworks |
cd3bb277 | 6943 | @opindex mvxworks |
bff46771 GK |
6944 | On System V.4 and embedded PowerPC systems, specify that you are |
6945 | compiling for a VxWorks system. | |
6946 | ||
74291a4b | 6947 | @item -memb |
cd3bb277 | 6948 | @opindex memb |
74291a4b MM |
6949 | On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags |
6950 | header to indicate that @samp{eabi} extended relocations are used. | |
6951 | ||
6952 | @item -meabi | |
6953 | @itemx -mno-eabi | |
cd3bb277 JM |
6954 | @opindex meabi |
6955 | @opindex mno-eabi | |
74291a4b MM |
6956 | On System V.4 and embedded PowerPC systems do (do not) adhere to the |
6957 | Embedded Applications Binary Interface (eabi) which is a set of | |
bedc7537 | 6958 | modifications to the System V.4 specifications. Selecting @option{-meabi} |
74291a4b MM |
6959 | means that the stack is aligned to an 8 byte boundary, a function |
6960 | @code{__eabi} is called to from @code{main} to set up the eabi | |
630d3d5a | 6961 | environment, and the @option{-msdata} option can use both @code{r2} and |
74291a4b | 6962 | @code{r13} to point to two separate small data areas. Selecting |
bedc7537 | 6963 | @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary, |
74291a4b | 6964 | do not call an initialization function from @code{main}, and the |
630d3d5a JM |
6965 | @option{-msdata} option will only use @code{r13} to point to a single |
6966 | small data area. The @option{-meabi} option is on by default if you | |
74291a4b MM |
6967 | configured GCC using one of the @samp{powerpc*-*-eabi*} options. |
6968 | ||
6969 | @item -msdata=eabi | |
cd3bb277 | 6970 | @opindex msdata=eabi |
74291a4b MM |
6971 | On System V.4 and embedded PowerPC systems, put small initialized |
6972 | @code{const} global and static data in the @samp{.sdata2} section, which | |
6973 | is pointed to by register @code{r2}. Put small initialized | |
6974 | non-@code{const} global and static data in the @samp{.sdata} section, | |
6975 | which is pointed to by register @code{r13}. Put small uninitialized | |
6976 | global and static data in the @samp{.sbss} section, which is adjacent to | |
630d3d5a JM |
6977 | the @samp{.sdata} section. The @option{-msdata=eabi} option is |
6978 | incompatible with the @option{-mrelocatable} option. The | |
6979 | @option{-msdata=eabi} option also sets the @option{-memb} option. | |
74291a4b MM |
6980 | |
6981 | @item -msdata=sysv | |
cd3bb277 | 6982 | @opindex msdata=sysv |
74291a4b MM |
6983 | On System V.4 and embedded PowerPC systems, put small global and static |
6984 | data in the @samp{.sdata} section, which is pointed to by register | |
6985 | @code{r13}. Put small uninitialized global and static data in the | |
6986 | @samp{.sbss} section, which is adjacent to the @samp{.sdata} section. | |
630d3d5a JM |
6987 | The @option{-msdata=sysv} option is incompatible with the |
6988 | @option{-mrelocatable} option. | |
74291a4b MM |
6989 | |
6990 | @item -msdata=default | |
6991 | @itemx -msdata | |
cd3bb277 JM |
6992 | @opindex msdata=default |
6993 | @opindex msdata | |
630d3d5a JM |
6994 | On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, |
6995 | compile code the same as @option{-msdata=eabi}, otherwise compile code the | |
6996 | same as @option{-msdata=sysv}. | |
74291a4b MM |
6997 | |
6998 | @item -msdata-data | |
cd3bb277 | 6999 | @opindex msdata-data |
74291a4b MM |
7000 | On System V.4 and embedded PowerPC systems, put small global and static |
7001 | data in the @samp{.sdata} section. Put small uninitialized global and | |
7002 | static data in the @samp{.sbss} section. Do not use register @code{r13} | |
7003 | to address small data however. This is the default behavior unless | |
630d3d5a | 7004 | other @option{-msdata} options are used. |
74291a4b MM |
7005 | |
7006 | @item -msdata=none | |
7007 | @itemx -mno-sdata | |
cd3bb277 JM |
7008 | @opindex msdata=none |
7009 | @opindex mno-sdata | |
74291a4b MM |
7010 | On embedded PowerPC systems, put all initialized global and static data |
7011 | in the @samp{.data} section, and all uninitialized data in the | |
7012 | @samp{.bss} section. | |
7013 | ||
7014 | @item -G @var{num} | |
cd3bb277 | 7015 | @opindex G |
74291a4b MM |
7016 | @cindex smaller data references (PowerPC) |
7017 | @cindex .sdata/.sdata2 references (PowerPC) | |
956d6950 | 7018 | On embedded PowerPC systems, put global and static items less than or |
74291a4b MM |
7019 | equal to @var{num} bytes into the small data or bss sections instead of |
7020 | the normal data or bss section. By default, @var{num} is 8. The | |
630d3d5a JM |
7021 | @option{-G @var{num}} switch is also passed to the linker. |
7022 | All modules should be compiled with the same @option{-G @var{num}} value. | |
74291a4b MM |
7023 | |
7024 | @item -mregnames | |
7025 | @itemx -mno-regnames | |
cd3bb277 JM |
7026 | @opindex mregnames |
7027 | @opindex mno-regnames | |
74291a4b MM |
7028 | On System V.4 and embedded PowerPC systems do (do not) emit register |
7029 | names in the assembly language output using symbolic forms. | |
f5a1b0d2 | 7030 | |
0a379b7a CR |
7031 | @item -pthread |
7032 | @opindex pthread | |
7033 | Adds support for multithreading with the @dfn{pthreads} library. | |
7034 | This option sets flags for both the preprocessor and linker. | |
7035 | ||
74291a4b | 7036 | @end table |
f5a1b0d2 | 7037 | |
74291a4b MM |
7038 | @node RT Options |
7039 | @subsection IBM RT Options | |
7040 | @cindex RT options | |
7041 | @cindex IBM RT options | |
7042 | ||
7043 | These @samp{-m} options are defined for the IBM RT PC: | |
7044 | ||
2642624b | 7045 | @table @gcctabopt |
74291a4b | 7046 | @item -min-line-mul |
cd3bb277 | 7047 | @opindex min-line-mul |
74291a4b MM |
7048 | Use an in-line code sequence for integer multiplies. This is the |
7049 | default. | |
7050 | ||
7051 | @item -mcall-lib-mul | |
cd3bb277 | 7052 | @opindex mcall-lib-mul |
74291a4b MM |
7053 | Call @code{lmul$$} for integer multiples. |
7054 | ||
7055 | @item -mfull-fp-blocks | |
cd3bb277 | 7056 | @opindex mfull-fp-blocks |
74291a4b | 7057 | Generate full-size floating point data blocks, including the minimum |
161d7b59 | 7058 | amount of scratch space recommended by IBM@. This is the default. |
74291a4b MM |
7059 | |
7060 | @item -mminimum-fp-blocks | |
cd3bb277 | 7061 | @opindex mminimum-fp-blocks |
74291a4b MM |
7062 | Do not include extra scratch space in floating point data blocks. This |
7063 | results in smaller code, but slower execution, since scratch space must | |
7064 | be allocated dynamically. | |
7065 | ||
7066 | @cindex @file{varargs.h} and RT PC | |
7067 | @cindex @file{stdarg.h} and RT PC | |
7068 | @item -mfp-arg-in-fpregs | |
cd3bb277 | 7069 | @opindex mfp-arg-in-fpregs |
74291a4b MM |
7070 | Use a calling sequence incompatible with the IBM calling convention in |
7071 | which floating point arguments are passed in floating point registers. | |
c771326b | 7072 | Note that @code{varargs.h} and @code{stdarg.h} will not work with |
74291a4b MM |
7073 | floating point operands if this option is specified. |
7074 | ||
7075 | @item -mfp-arg-in-gregs | |
cd3bb277 | 7076 | @opindex mfp-arg-in-gregs |
74291a4b MM |
7077 | Use the normal calling convention for floating point arguments. This is |
7078 | the default. | |
7079 | ||
7080 | @item -mhc-struct-return | |
cd3bb277 | 7081 | @opindex mhc-struct-return |
74291a4b MM |
7082 | Return structures of more than one word in memory, rather than in a |
7083 | register. This provides compatibility with the MetaWare HighC (hc) | |
630d3d5a | 7084 | compiler. Use the option @option{-fpcc-struct-return} for compatibility |
74291a4b MM |
7085 | with the Portable C Compiler (pcc). |
7086 | ||
7087 | @item -mnohc-struct-return | |
cd3bb277 | 7088 | @opindex mnohc-struct-return |
74291a4b MM |
7089 | Return some structures of more than one word in registers, when |
7090 | convenient. This is the default. For compatibility with the | |
630d3d5a JM |
7091 | IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the |
7092 | option @option{-mhc-struct-return}. | |
74291a4b MM |
7093 | @end table |
7094 | ||
7095 | @node MIPS Options | |
7096 | @subsection MIPS Options | |
7097 | @cindex MIPS options | |
7098 | ||
7099 | These @samp{-m} options are defined for the MIPS family of computers: | |
7100 | ||
2642624b | 7101 | @table @gcctabopt |
7dac2f89 EC |
7102 | |
7103 | @item -march=@var{cpu-type} | |
7104 | @opindex march | |
7105 | Assume the defaults for the machine type @var{cpu-type} when generating | |
7106 | instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000}, | |
7107 | @samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400}, | |
7108 | @samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000}, | |
7109 | and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000}, | |
7110 | @samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as | |
7111 | @samp{r2k} (or @samp{r2K}), @samp{r3k}, etc. | |
7112 | ||
7113 | @item -mtune=@var{cpu-type} | |
7114 | @opindex mtune | |
630d3d5a JM |
7115 | Assume the defaults for the machine type @var{cpu-type} when scheduling |
7116 | instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000}, | |
8b9243df JJ |
7117 | @samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400}, |
7118 | @samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000}, | |
7119 | and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000}, | |
7120 | @samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as | |
7121 | @samp{r2k} (or @samp{r2K}), @samp{r3k}, etc. While picking a specific | |
630d3d5a | 7122 | @var{cpu-type} will schedule things appropriately for that particular |
8b9243df | 7123 | chip, the compiler will not generate any code that does not meet level 1 |
630d3d5a JM |
7124 | of the MIPS ISA (instruction set architecture) without a @option{-mipsX} |
7125 | or @option{-mabi} switch being used. | |
74291a4b | 7126 | |
7dac2f89 EC |
7127 | @item -mcpu=@var{cpu-type} |
7128 | @opindex mcpu | |
7129 | This is identical to specifying both @option{-march} and @option{-mtune}. | |
7130 | ||
74291a4b | 7131 | @item -mips1 |
cd3bb277 | 7132 | @opindex mips1 |
161d7b59 | 7133 | Issue instructions from level 1 of the MIPS ISA@. This is the default. |
630d3d5a | 7134 | @samp{r3000} is the default @var{cpu-type} at this ISA level. |
74291a4b MM |
7135 | |
7136 | @item -mips2 | |
cd3bb277 | 7137 | @opindex mips2 |
74291a4b | 7138 | Issue instructions from level 2 of the MIPS ISA (branch likely, square |
630d3d5a | 7139 | root instructions). @samp{r6000} is the default @var{cpu-type} at this |
74291a4b MM |
7140 | ISA level. |
7141 | ||
7142 | @item -mips3 | |
cd3bb277 | 7143 | @opindex mips3 |
02f52e19 | 7144 | Issue instructions from level 3 of the MIPS ISA (64-bit instructions). |
630d3d5a | 7145 | @samp{r4000} is the default @var{cpu-type} at this ISA level. |
74291a4b | 7146 | |
3398f47f | 7147 | @item -mips4 |
cd3bb277 | 7148 | @opindex mips4 |
8b9243df JJ |
7149 | Issue instructions from level 4 of the MIPS ISA (conditional move, |
7150 | prefetch, enhanced FPU instructions). @samp{r8000} is the default | |
630d3d5a | 7151 | @var{cpu-type} at this ISA level. |
3398f47f | 7152 | |
74291a4b | 7153 | @item -mfp32 |
cd3bb277 | 7154 | @opindex mfp32 |
74291a4b MM |
7155 | Assume that 32 32-bit floating point registers are available. This is |
7156 | the default. | |
7157 | ||
7158 | @item -mfp64 | |
cd3bb277 | 7159 | @opindex mfp64 |
74291a4b | 7160 | Assume that 32 64-bit floating point registers are available. This is |
630d3d5a | 7161 | the default when the @option{-mips3} option is used. |
74291a4b | 7162 | |
13fac94a GK |
7163 | @item -mfused-madd |
7164 | @itemx -mno-fused-madd | |
7165 | @opindex mfused-madd | |
7166 | @opindex mno-fused-madd | |
7167 | Generate code that uses (does not use) the floating point multiply and | |
7168 | accumulate instructions, when they are available. These instructions | |
7169 | are generated by default if they are available, but this may be | |
7170 | undesirable if the extra precision causes problems or on certain chips | |
7171 | in the mode where denormals are rounded to zero where denormals | |
7172 | generated by multiply and accumulate instructions cause exceptions | |
7173 | anyway. | |
7174 | ||
74291a4b | 7175 | @item -mgp32 |
cd3bb277 | 7176 | @opindex mgp32 |
74291a4b MM |
7177 | Assume that 32 32-bit general purpose registers are available. This is |
7178 | the default. | |
7179 | ||
7180 | @item -mgp64 | |
cd3bb277 | 7181 | @opindex mgp64 |
74291a4b | 7182 | Assume that 32 64-bit general purpose registers are available. This is |
630d3d5a | 7183 | the default when the @option{-mips3} option is used. |
74291a4b MM |
7184 | |
7185 | @item -mint64 | |
cd3bb277 | 7186 | @opindex mint64 |
630d3d5a | 7187 | Force int and long types to be 64 bits wide. See @option{-mlong32} for an |
3ce1ba83 | 7188 | explanation of the default, and the width of pointers. |
74291a4b MM |
7189 | |
7190 | @item -mlong64 | |
cd3bb277 | 7191 | @opindex mlong64 |
630d3d5a | 7192 | Force long types to be 64 bits wide. See @option{-mlong32} for an |
3ce1ba83 | 7193 | explanation of the default, and the width of pointers. |
fb1bf66d | 7194 | |
3ce1ba83 | 7195 | @item -mlong32 |
cd3bb277 | 7196 | @opindex mlong32 |
3ce1ba83 GRK |
7197 | Force long, int, and pointer types to be 32 bits wide. |
7198 | ||
630d3d5a | 7199 | If none of @option{-mlong32}, @option{-mlong64}, or @option{-mint64} are set, |
b192711e | 7200 | the size of ints, longs, and pointers depends on the ABI and ISA chosen. |
630d3d5a JM |
7201 | For @option{-mabi=32}, and @option{-mabi=n32}, ints and longs are 32 bits |
7202 | wide. For @option{-mabi=64}, ints are 32 bits, and longs are 64 bits wide. | |
7203 | For @option{-mabi=eabi} and either @option{-mips1} or @option{-mips2}, ints | |
7204 | and longs are 32 bits wide. For @option{-mabi=eabi} and higher ISAs, ints | |
3ce1ba83 GRK |
7205 | are 32 bits, and longs are 64 bits wide. The width of pointer types is |
7206 | the smaller of the width of longs or the width of general purpose | |
161d7b59 | 7207 | registers (which in turn depends on the ISA)@. |
74291a4b | 7208 | |
62a1403d | 7209 | @item -mabi=32 |
8b9243df | 7210 | @itemx -mabi=o64 |
3398f47f MM |
7211 | @itemx -mabi=n32 |
7212 | @itemx -mabi=64 | |
7213 | @itemx -mabi=eabi | |
cd3bb277 JM |
7214 | @opindex mabi=32 |
7215 | @opindex mabi=o64 | |
7216 | @opindex mabi=n32 | |
7217 | @opindex mabi=64 | |
7218 | @opindex mabi=eabi | |
161d7b59 | 7219 | Generate code for the indicated ABI@. The default instruction level is |
630d3d5a JM |
7220 | @option{-mips1} for @samp{32}, @option{-mips3} for @samp{n32}, and |
7221 | @option{-mips4} otherwise. Conversely, with @option{-mips1} or | |
7222 | @option{-mips2}, the default ABI is @samp{32}; otherwise, the default ABI | |
8b9243df | 7223 | is @samp{64}. |
3398f47f | 7224 | |
74291a4b | 7225 | @item -mmips-as |
cd3bb277 | 7226 | @opindex mmips-as |
74291a4b MM |
7227 | Generate code for the MIPS assembler, and invoke @file{mips-tfile} to |
7228 | add normal debug information. This is the default for all | |
7229 | platforms except for the OSF/1 reference platform, using the OSF/rose | |
630d3d5a | 7230 | object format. If the either of the @option{-gstabs} or @option{-gstabs+} |
74291a4b | 7231 | switches are used, the @file{mips-tfile} program will encapsulate the |
161d7b59 | 7232 | stabs within MIPS ECOFF@. |
74291a4b MM |
7233 | |
7234 | @item -mgas | |
cd3bb277 | 7235 | @opindex mgas |
74291a4b | 7236 | Generate code for the GNU assembler. This is the default on the OSF/1 |
861bb6c1 | 7237 | reference platform, using the OSF/rose object format. Also, this is |
630d3d5a | 7238 | the default if the configure option @option{--with-gnu-as} is used. |
861bb6c1 JL |
7239 | |
7240 | @item -msplit-addresses | |
7241 | @itemx -mno-split-addresses | |
cd3bb277 JM |
7242 | @opindex msplit-addresses |
7243 | @opindex mno-split-addresses | |
861bb6c1 | 7244 | Generate code to load the high and low parts of address constants separately. |
aee96fe9 | 7245 | This allows GCC to optimize away redundant loads of the high order |
861bb6c1 JL |
7246 | bits of addresses. This optimization requires GNU as and GNU ld. |
7247 | This optimization is enabled by default for some embedded targets where | |
7248 | GNU as and GNU ld are standard. | |
74291a4b MM |
7249 | |
7250 | @item -mrnames | |
7251 | @itemx -mno-rnames | |
cd3bb277 JM |
7252 | @opindex mrnames |
7253 | @opindex mno-rnames | |
630d3d5a | 7254 | The @option{-mrnames} switch says to output code using the MIPS software |
74291a4b MM |
7255 | names for the registers, instead of the hardware names (ie, @var{a0} |
7256 | instead of @var{$4}). The only known assembler that supports this option | |
7257 | is the Algorithmics assembler. | |
7258 | ||
7259 | @item -mgpopt | |
7260 | @itemx -mno-gpopt | |
cd3bb277 JM |
7261 | @opindex mgpopt |
7262 | @opindex mno-gpopt | |
630d3d5a | 7263 | The @option{-mgpopt} switch says to write all of the data declarations |
74291a4b MM |
7264 | before the instructions in the text section, this allows the MIPS |
7265 | assembler to generate one word memory references instead of using two | |
7266 | words for short global or static data items. This is on by default if | |
7267 | optimization is selected. | |
7268 | ||
7269 | @item -mstats | |
7270 | @itemx -mno-stats | |
cd3bb277 JM |
7271 | @opindex mstats |
7272 | @opindex mno-stats | |
630d3d5a | 7273 | For each non-inline function processed, the @option{-mstats} switch |
74291a4b MM |
7274 | causes the compiler to emit one line to the standard error file to |
7275 | print statistics about the program (number of registers saved, stack | |
7276 | size, etc.). | |
7277 | ||
7278 | @item -mmemcpy | |
7279 | @itemx -mno-memcpy | |
cd3bb277 JM |
7280 | @opindex mmemcpy |
7281 | @opindex mno-memcpy | |
630d3d5a | 7282 | The @option{-mmemcpy} switch makes all block moves call the appropriate |
74291a4b MM |
7283 | string function (@samp{memcpy} or @samp{bcopy}) instead of possibly |
7284 | generating inline code. | |
7285 | ||
7286 | @item -mmips-tfile | |
7287 | @itemx -mno-mips-tfile | |
cd3bb277 JM |
7288 | @opindex mmips-tfile |
7289 | @opindex mno-mips-tfile | |
630d3d5a | 7290 | The @option{-mno-mips-tfile} switch causes the compiler not |
74291a4b MM |
7291 | postprocess the object file with the @file{mips-tfile} program, |
7292 | after the MIPS assembler has generated it to add debug support. If | |
7293 | @file{mips-tfile} is not run, then no local variables will be | |
7294 | available to the debugger. In addition, @file{stage2} and | |
7295 | @file{stage3} objects will have the temporary file names passed to the | |
7296 | assembler embedded in the object file, which means the objects will | |
630d3d5a | 7297 | not compare the same. The @option{-mno-mips-tfile} switch should only |
74291a4b MM |
7298 | be used when there are bugs in the @file{mips-tfile} program that |
7299 | prevents compilation. | |
7300 | ||
7301 | @item -msoft-float | |
cd3bb277 | 7302 | @opindex msoft-float |
74291a4b | 7303 | Generate output containing library calls for floating point. |
161d7b59 | 7304 | @strong{Warning:} the requisite libraries are not part of GCC@. |
74291a4b MM |
7305 | Normally the facilities of the machine's usual C compiler are used, but |
7306 | this can't be done directly in cross-compilation. You must make your | |
7307 | own arrangements to provide suitable library functions for | |
7308 | cross-compilation. | |
7309 | ||
7310 | @item -mhard-float | |
cd3bb277 | 7311 | @opindex mhard-float |
74291a4b MM |
7312 | Generate output containing floating point instructions. This is the |
7313 | default if you use the unmodified sources. | |
7314 | ||
7315 | @item -mabicalls | |
7316 | @itemx -mno-abicalls | |
cd3bb277 JM |
7317 | @opindex mabicalls |
7318 | @opindex mno-abicalls | |
74291a4b MM |
7319 | Emit (or do not emit) the pseudo operations @samp{.abicalls}, |
7320 | @samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for | |
7321 | position independent code. | |
7322 | ||
7323 | @item -mlong-calls | |
7324 | @itemx -mno-long-calls | |
cd3bb277 JM |
7325 | @opindex mlong-calls |
7326 | @opindex mno-long-calls | |
74291a4b MM |
7327 | Do all calls with the @samp{JALR} instruction, which requires |
7328 | loading up a function's address into a register before the call. | |
7329 | You need to use this switch, if you call outside of the current | |
7330 | 512 megabyte segment to functions that are not through pointers. | |
7331 | ||
7332 | @item -mhalf-pic | |
7333 | @itemx -mno-half-pic | |
cd3bb277 JM |
7334 | @opindex mhalf-pic |
7335 | @opindex mno-half-pic | |
74291a4b MM |
7336 | Put pointers to extern references into the data section and load them |
7337 | up, rather than put the references in the text section. | |
7338 | ||
7339 | @item -membedded-pic | |
7340 | @itemx -mno-embedded-pic | |
cd3bb277 JM |
7341 | @opindex membedded-pic |
7342 | @opindex mno-embedded-pic | |
69fa83cf JW |
7343 | Generate PIC code suitable for some embedded systems. All calls are |
7344 | made using PC relative address, and all data is addressed using the $gp | |
7345 | register. No more than 65536 bytes of global data may be used. This | |
7346 | requires GNU as and GNU ld which do most of the work. This currently | |
161d7b59 | 7347 | only works on targets which use ECOFF; it does not work with ELF@. |
74291a4b MM |
7348 | |
7349 | @item -membedded-data | |
7350 | @itemx -mno-embedded-data | |
cd3bb277 JM |
7351 | @opindex membedded-data |
7352 | @opindex mno-embedded-data | |
74291a4b MM |
7353 | Allocate variables to the read-only data section first if possible, then |
7354 | next in the small data section if possible, otherwise in data. This gives | |
7355 | slightly slower code than the default, but reduces the amount of RAM required | |
7356 | when executing, and thus may be preferred for some embedded systems. | |
7357 | ||
919509ce DN |
7358 | @item -muninit-const-in-rodata |
7359 | @itemx -mno-uninit-const-in-rodata | |
cd3bb277 JM |
7360 | @opindex muninit-const-in-rodata |
7361 | @opindex mno-uninit-const-in-rodata | |
695ac33f | 7362 | When used together with @option{-membedded-data}, it will always store uninitialized |
919509ce | 7363 | const variables in the read-only data section. |
02f52e19 | 7364 | |
74291a4b MM |
7365 | @item -msingle-float |
7366 | @itemx -mdouble-float | |
cd3bb277 JM |
7367 | @opindex msingle-float |
7368 | @opindex mdouble-float | |
630d3d5a | 7369 | The @option{-msingle-float} switch tells gcc to assume that the floating |
74291a4b | 7370 | point coprocessor only supports single precision operations, as on the |
630d3d5a | 7371 | @samp{r4650} chip. The @option{-mdouble-float} switch permits gcc to use |
74291a4b MM |
7372 | double precision operations. This is the default. |
7373 | ||
7374 | @item -mmad | |
7375 | @itemx -mno-mad | |
cd3bb277 JM |
7376 | @opindex mmad |
7377 | @opindex mno-mad | |
74291a4b MM |
7378 | Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions, |
7379 | as on the @samp{r4650} chip. | |
7380 | ||
7381 | @item -m4650 | |
cd3bb277 | 7382 | @opindex m4650 |
630d3d5a JM |
7383 | Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now, |
7384 | @option{-mcpu=r4650}. | |
74291a4b | 7385 | |
8b9243df JJ |
7386 | @item -mips16 |
7387 | @itemx -mno-mips16 | |
cd3bb277 JM |
7388 | @opindex mips16 |
7389 | @opindex mno-mips16 | |
8b9243df JJ |
7390 | Enable 16-bit instructions. |
7391 | ||
7392 | @item -mentry | |
cd3bb277 | 7393 | @opindex mentry |
8b9243df | 7394 | Use the entry and exit pseudo ops. This option can only be used with |
630d3d5a | 7395 | @option{-mips16}. |
8b9243df | 7396 | |
74291a4b | 7397 | @item -EL |
cd3bb277 | 7398 | @opindex EL |
74291a4b MM |
7399 | Compile code for the processor in little endian mode. |
7400 | The requisite libraries are assumed to exist. | |
7401 | ||
7402 | @item -EB | |
cd3bb277 | 7403 | @opindex EB |
74291a4b MM |
7404 | Compile code for the processor in big endian mode. |
7405 | The requisite libraries are assumed to exist. | |
7406 | ||
7407 | @item -G @var{num} | |
cd3bb277 | 7408 | @opindex G |
74291a4b MM |
7409 | @cindex smaller data references (MIPS) |
7410 | @cindex gp-relative references (MIPS) | |
7411 | Put global and static items less than or equal to @var{num} bytes into | |
7412 | the small data or bss sections instead of the normal data or bss | |
7413 | section. This allows the assembler to emit one word memory reference | |
7414 | instructions based on the global pointer (@var{gp} or @var{$28}), | |
7415 | instead of the normal two words used. By default, @var{num} is 8 when | |
7416 | the MIPS assembler is used, and 0 when the GNU assembler is used. The | |
630d3d5a JM |
7417 | @option{-G @var{num}} switch is also passed to the assembler and linker. |
7418 | All modules should be compiled with the same @option{-G @var{num}} | |
74291a4b MM |
7419 | value. |
7420 | ||
7421 | @item -nocpp | |
cd3bb277 | 7422 | @opindex nocpp |
9ec36da5 | 7423 | Tell the MIPS assembler to not run its preprocessor over user |
74291a4b | 7424 | assembler files (with a @samp{.s} suffix) when assembling them. |
63357d93 | 7425 | |
1e387156 | 7426 | @item -mfix7000 |
cd3bb277 | 7427 | @opindex mfix7000 |
1e387156 CM |
7428 | Pass an option to gas which will cause nops to be inserted if |
7429 | the read of the destination register of an mfhi or mflo instruction | |
7430 | occurs in the following two instructions. | |
7431 | ||
63357d93 | 7432 | @item -no-crt0 |
cd3bb277 | 7433 | @opindex no-crt0 |
63357d93 | 7434 | Do not include the default crt0. |
d490e8ad DD |
7435 | |
7436 | @item -mflush-func=@var{func} | |
7437 | @itemx -mno-flush-func | |
7438 | @opindex mflush-func | |
7439 | Specifies the function to call to flush the I and D caches, or to not | |
7440 | call any such function. If called, the function must take the same | |
7441 | arguments as the common @code{_flush_func()}, that is, the address of the | |
7442 | memory range for which the cache is being flushed, the size of the | |
7443 | memory range, and the number 3 (to flush both caches). The default | |
7444 | depends on the target gcc was configured for, but commonly is either | |
7445 | @samp{_flush_func} or @samp{__cpu_flush}. | |
74291a4b MM |
7446 | @end table |
7447 | ||
74291a4b MM |
7448 | These options are defined by the macro |
7449 | @code{TARGET_SWITCHES} in the machine description. The default for the | |
7450 | options is also defined by that macro, which enables you to change the | |
7451 | defaults. | |
74291a4b | 7452 | |
14f73b5a JH |
7453 | @node i386 and x86-64 Options |
7454 | @subsection Intel 386 and AMD x86-64 Options | |
74291a4b | 7455 | @cindex i386 Options |
14f73b5a | 7456 | @cindex x86-64 Options |
74291a4b | 7457 | @cindex Intel 386 Options |
14f73b5a | 7458 | @cindex AMD x86-64 Options |
74291a4b | 7459 | |
14f73b5a JH |
7460 | These @samp{-m} options are defined for the i386 and x86-64 family of |
7461 | computers: | |
74291a4b | 7462 | |
2642624b | 7463 | @table @gcctabopt |
630d3d5a | 7464 | @item -mcpu=@var{cpu-type} |
cd3bb277 | 7465 | @opindex mcpu |
0dd0e980 JH |
7466 | Tune to @var{cpu-type} everything applicable about the generated code, except |
7467 | for the ABI and the set of available instructions. The choices for | |
7468 | @var{cpu-type} are @samp{i386}, @samp{i486}, @samp{i586}, @samp{i686}, | |
7469 | @samp{pentium}, @samp{pentium-mmx}, @samp{pentiumpro}, @samp{pentium2}, | |
7470 | @samp{pentium3}, @samp{pentium4}, @samp{k6}, @samp{k6-2}, @samp{k6-3}, | |
7471 | @samp{athlon}, @samp{athlon-tbird}, @samp{athlon-4}, @samp{athlon-xp} | |
7472 | and @samp{athlon-mp}. | |
6f670fde | 7473 | |
630d3d5a | 7474 | While picking a specific @var{cpu-type} will schedule things appropriately |
6f670fde | 7475 | for that particular chip, the compiler will not generate any code that |
630d3d5a | 7476 | does not run on the i386 without the @option{-march=@var{cpu-type}} option |
7001ee2d | 7477 | being used. @samp{i586} is equivalent to @samp{pentium} and @samp{i686} |
6ca3ad1b | 7478 | is equivalent to @samp{pentiumpro}. @samp{k6} and @samp{athlon} are the |
b4e89e2d | 7479 | AMD chips as opposed to the Intel ones. |
a9f3e1a4 | 7480 | |
630d3d5a | 7481 | @item -march=@var{cpu-type} |
cd3bb277 | 7482 | @opindex march |
630d3d5a JM |
7483 | Generate instructions for the machine type @var{cpu-type}. The choices |
7484 | for @var{cpu-type} are the same as for @option{-mcpu}. Moreover, | |
7485 | specifying @option{-march=@var{cpu-type}} implies @option{-mcpu=@var{cpu-type}}. | |
a9f3e1a4 JL |
7486 | |
7487 | @item -m386 | |
7488 | @itemx -m486 | |
7489 | @itemx -mpentium | |
7490 | @itemx -mpentiumpro | |
cd3bb277 JM |
7491 | @opindex m386 |
7492 | @opindex m486 | |
7493 | @opindex mpentium | |
7494 | @opindex mpentiumpro | |
9c34dbbf ZW |
7495 | These options are synonyms for @option{-mcpu=i386}, @option{-mcpu=i486}, |
7496 | @option{-mcpu=pentium}, and @option{-mcpu=pentiumpro} respectively. | |
7497 | These synonyms are deprecated. | |
74291a4b | 7498 | |
965f5423 JH |
7499 | @item -mfpmath=@var{unit} |
7500 | @opindex march | |
7501 | generate floating point arithmetics for selected unit @var{unit}. the choices | |
7502 | for @var{unit} are: | |
7503 | ||
7504 | @table @samp | |
7505 | @item 387 | |
7506 | Use the standard 387 floating point coprocessor present majority of chips and | |
7507 | emulated otherwise. Code compiled with this option will run almost everywhere. | |
7508 | The temporary results are computed in 80bit precesion instead of precision | |
7509 | specified by the type resulting in slightly different results compared to most | |
7510 | of other chips. See @option{-ffloat-store} for more detailed description. | |
7511 | ||
7512 | This is the default choice for i386 compiler. | |
7513 | ||
7514 | @item sse | |
7515 | Use scalar floating point instructions present in the SSE instruction set. | |
7516 | This instruction set is supported by Pentium3 and newer chips, in the AMD line | |
7517 | by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE | |
7518 | instruction set supports only single precision arithmetics, thus the double and | |
7519 | extended precision arithmetics is still done using 387. Later version, present | |
7520 | only in Pentium4 and the future AMD x86-64 chips supports double precision | |
7521 | arithmetics too. | |
7522 | ||
7523 | For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or | |
7524 | @option{-msse2} switches to enable SSE extensions and make this option | |
7525 | effective. For x86-64 compiler, these extensions are enabled by default. | |
7526 | ||
7527 | The resulting code should be considerably faster in majority of cases and avoid | |
7528 | the numerical instability problems of 387 code, but may break some existing | |
7529 | code that expects temporaries to be 80bit. | |
7530 | ||
7531 | This is the default choice for x86-64 compiler. | |
7532 | ||
7533 | @item sse,387 | |
7534 | Attempt to utilize both instruction sets at once. This effectivly double the | |
7535 | amount of available registers and on chips with separate execution units for | |
7536 | 387 and SSE the execution resources too. Use this option with care, as it is | |
7537 | still experimental, because gcc register allocator does not model separate | |
7538 | functional units well resulting in instable performance. | |
7539 | @end table | |
7540 | ||
c93e80a5 JH |
7541 | @item -masm=@var{dialect} |
7542 | @opindex masm=@var{dialect} | |
7543 | Output asm instructions using selected @var{dialect}. Supported choices are | |
7544 | @samp{intel} or @samp{att} (the default one). | |
04e149ab | 7545 | |
74291a4b MM |
7546 | @item -mieee-fp |
7547 | @itemx -mno-ieee-fp | |
cd3bb277 JM |
7548 | @opindex mieee-fp |
7549 | @opindex mno-ieee-fp | |
74291a4b MM |
7550 | Control whether or not the compiler uses IEEE floating point |
7551 | comparisons. These handle correctly the case where the result of a | |
7552 | comparison is unordered. | |
7553 | ||
7554 | @item -msoft-float | |
cd3bb277 | 7555 | @opindex msoft-float |
74291a4b | 7556 | Generate output containing library calls for floating point. |
161d7b59 | 7557 | @strong{Warning:} the requisite libraries are not part of GCC@. |
74291a4b MM |
7558 | Normally the facilities of the machine's usual C compiler are used, but |
7559 | this can't be done directly in cross-compilation. You must make your | |
7560 | own arrangements to provide suitable library functions for | |
7561 | cross-compilation. | |
7562 | ||
7563 | On machines where a function returns floating point results in the 80387 | |
7564 | register stack, some floating point opcodes may be emitted even if | |
630d3d5a | 7565 | @option{-msoft-float} is used. |
74291a4b MM |
7566 | |
7567 | @item -mno-fp-ret-in-387 | |
cd3bb277 | 7568 | @opindex mno-fp-ret-in-387 |
74291a4b MM |
7569 | Do not use the FPU registers for return values of functions. |
7570 | ||
7571 | The usual calling convention has functions return values of types | |
7572 | @code{float} and @code{double} in an FPU register, even if there | |
161d7b59 JM |
7573 | is no FPU@. The idea is that the operating system should emulate |
7574 | an FPU@. | |
74291a4b | 7575 | |
630d3d5a | 7576 | The option @option{-mno-fp-ret-in-387} causes such values to be returned |
74291a4b MM |
7577 | in ordinary CPU registers instead. |
7578 | ||
7579 | @item -mno-fancy-math-387 | |
cd3bb277 | 7580 | @opindex mno-fancy-math-387 |
74291a4b MM |
7581 | Some 387 emulators do not support the @code{sin}, @code{cos} and |
7582 | @code{sqrt} instructions for the 387. Specify this option to avoid | |
161d7b59 | 7583 | generating those instructions. This option is the default on FreeBSD@. |
74291a4b | 7584 | As of revision 2.6.1, these instructions are not generated unless you |
630d3d5a | 7585 | also use the @option{-funsafe-math-optimizations} switch. |
74291a4b MM |
7586 | |
7587 | @item -malign-double | |
7588 | @itemx -mno-align-double | |
cd3bb277 JM |
7589 | @opindex malign-double |
7590 | @opindex mno-align-double | |
0c2d1a2a | 7591 | Control whether GCC aligns @code{double}, @code{long double}, and |
74291a4b MM |
7592 | @code{long long} variables on a two word boundary or a one word |
7593 | boundary. Aligning @code{double} variables on a two word boundary will | |
7594 | produce code that runs somewhat faster on a @samp{Pentium} at the | |
7595 | expense of more memory. | |
7596 | ||
2b589241 | 7597 | @item -m128bit-long-double |
cd3bb277 | 7598 | @opindex m128bit-long-double |
2b589241 JH |
7599 | Control the size of @code{long double} type. i386 application binary interface |
7600 | specify the size to be 12 bytes, while modern architectures (Pentium and newer) | |
c771326b | 7601 | prefer @code{long double} aligned to 8 or 16 byte boundary. This is |
2b589241 JH |
7602 | impossible to reach with 12 byte long doubles in the array accesses. |
7603 | ||
630d3d5a | 7604 | @strong{Warning:} if you use the @option{-m128bit-long-double} switch, the |
2b589241 JH |
7605 | structures and arrays containing @code{long double} will change their size as |
7606 | well as function calling convention for function taking @code{long double} | |
02f52e19 | 7607 | will be modified. |
2b589241 JH |
7608 | |
7609 | @item -m96bit-long-double | |
cd3bb277 | 7610 | @opindex m96bit-long-double |
0a75e5c3 | 7611 | Set the size of @code{long double} to 96 bits as required by the i386 |
2b589241 | 7612 | application binary interface. This is the default. |
74291a4b MM |
7613 | |
7614 | @item -msvr3-shlib | |
7615 | @itemx -mno-svr3-shlib | |
cd3bb277 JM |
7616 | @opindex msvr3-shlib |
7617 | @opindex mno-svr3-shlib | |
9c34dbbf ZW |
7618 | Control whether GCC places uninitialized local variables into the |
7619 | @code{bss} or @code{data} segments. @option{-msvr3-shlib} places them | |
7620 | into @code{bss}. These options are meaningful only on System V Release 3. | |
74291a4b | 7621 | |
74291a4b | 7622 | @item -mrtd |
cd3bb277 | 7623 | @opindex mrtd |
74291a4b MM |
7624 | Use a different function-calling convention, in which functions that |
7625 | take a fixed number of arguments return with the @code{ret} @var{num} | |
7626 | instruction, which pops their arguments while returning. This saves one | |
7627 | instruction in the caller since there is no need to pop the arguments | |
7628 | there. | |
7629 | ||
7630 | You can specify that an individual function is called with this calling | |
7631 | sequence with the function attribute @samp{stdcall}. You can also | |
630d3d5a | 7632 | override the @option{-mrtd} option by using the function attribute |
0b433de6 | 7633 | @samp{cdecl}. @xref{Function Attributes}. |
74291a4b MM |
7634 | |
7635 | @strong{Warning:} this calling convention is incompatible with the one | |
7636 | normally used on Unix, so you cannot use it if you need to call | |
7637 | libraries compiled with the Unix compiler. | |
7638 | ||
7639 | Also, you must provide function prototypes for all functions that | |
7640 | take variable numbers of arguments (including @code{printf}); | |
7641 | otherwise incorrect code will be generated for calls to those | |
7642 | functions. | |
7643 | ||
7644 | In addition, seriously incorrect code will result if you call a | |
7645 | function with too many arguments. (Normally, extra arguments are | |
7646 | harmlessly ignored.) | |
7647 | ||
74291a4b | 7648 | @item -mregparm=@var{num} |
cd3bb277 | 7649 | @opindex mregparm |
74291a4b MM |
7650 | Control how many registers are used to pass integer arguments. By |
7651 | default, no registers are used to pass arguments, and at most 3 | |
7652 | registers can be used. You can control this behavior for a specific | |
0b433de6 JL |
7653 | function by using the function attribute @samp{regparm}. |
7654 | @xref{Function Attributes}. | |
74291a4b MM |
7655 | |
7656 | @strong{Warning:} if you use this switch, and | |
7657 | @var{num} is nonzero, then you must build all modules with the same | |
7658 | value, including any libraries. This includes the system libraries and | |
7659 | startup modules. | |
7660 | ||
3af4bd89 | 7661 | @item -mpreferred-stack-boundary=@var{num} |
cd3bb277 | 7662 | @opindex mpreferred-stack-boundary |
3af4bd89 | 7663 | Attempt to keep the stack boundary aligned to a 2 raised to @var{num} |
630d3d5a | 7664 | byte boundary. If @option{-mpreferred-stack-boundary} is not specified, |
fbb83b43 AO |
7665 | the default is 4 (16 bytes or 128 bits), except when optimizing for code |
7666 | size (@option{-Os}), in which case the default is the minimum correct | |
7667 | alignment (4 bytes for x86, and 8 bytes for x86-64). | |
3af4bd89 | 7668 | |
fbb83b43 AO |
7669 | On Pentium and PentiumPro, @code{double} and @code{long double} values |
7670 | should be aligned to an 8 byte boundary (see @option{-malign-double}) or | |
7671 | suffer significant run time performance penalties. On Pentium III, the | |
b192711e | 7672 | Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar |
3af4bd89 JH |
7673 | penalties if it is not 16 byte aligned. |
7674 | ||
7675 | To ensure proper alignment of this values on the stack, the stack boundary | |
02f52e19 | 7676 | must be as aligned as that required by any value stored on the stack. |
3af4bd89 JH |
7677 | Further, every function must be generated such that it keeps the stack |
7678 | aligned. Thus calling a function compiled with a higher preferred | |
7679 | stack boundary from a function compiled with a lower preferred stack | |
7680 | boundary will most likely misalign the stack. It is recommended that | |
7681 | libraries that use callbacks always use the default setting. | |
7682 | ||
fbb83b43 AO |
7683 | This extra alignment does consume extra stack space, and generally |
7684 | increases code size. Code that is sensitive to stack space usage, such | |
7685 | as embedded systems and operating system kernels, may want to reduce the | |
7686 | preferred alignment to @option{-mpreferred-stack-boundary=2}. | |
f22a97d2 | 7687 | |
1255c85c BS |
7688 | @item -mmmx |
7689 | @itemx -mno-mmx | |
7690 | @item -msse | |
7691 | @itemx -mno-sse | |
965f5423 JH |
7692 | @item -msse2 |
7693 | @itemx -mno-sse2 | |
1255c85c BS |
7694 | @item -m3dnow |
7695 | @itemx -mno-3dnow | |
7696 | @opindex mmmx | |
7697 | @opindex mno-mmx | |
7698 | @opindex msse | |
7699 | @opindex mno-sse | |
7700 | @opindex m3dnow | |
7701 | @opindex mno-3dnow | |
7702 | These switches enable or disable the use of built-in functions that allow | |
7703 | direct access to the MMX, SSE and 3Dnow extensions of the instruction set. | |
7704 | ||
80ebf43e | 7705 | The following machine modes are available for use with MMX built-in functions |
1255c85c BS |
7706 | (@pxref{Vector Extensions}): @code{V2SI} for a vector of two 32 bit integers, |
7707 | @code{V4HI} for a vector of four 16 bit integers, and @code{V8QI} for a | |
80ebf43e BS |
7708 | vector of eight 8 bit integers. Some of the built-in functions operate on |
7709 | MMX registers as a whole 64 bit entity, these use @code{DI} as their mode. | |
1255c85c BS |
7710 | |
7711 | If 3Dnow extensions are enabled, @code{V2SF} is used as a mode for a vector | |
7712 | of two 32 bit floating point values. | |
7713 | ||
7714 | If SSE extensions are enabled, @code{V4SF} is used for a vector of four 32 bit | |
7715 | floating point values. Some instructions use a vector of four 32 bit | |
7716 | integers, these use @code{V4SI}. Finally, some instructions operate on an | |
7717 | entire vector register, interpreting it as a 128 bit integer, these use mode | |
7718 | @code{TI}. | |
7719 | ||
80ebf43e | 7720 | The following built-in functions are made available by @option{-mmmx}: |
1255c85c BS |
7721 | @table @code |
7722 | @item v8qi __builtin_ia32_paddb (v8qi, v8qi) | |
7723 | Generates the @code{paddb} machine instruction. | |
7724 | @item v4hi __builtin_ia32_paddw (v4hi, v4hi) | |
7725 | Generates the @code{paddw} machine instruction. | |
7726 | @item v2si __builtin_ia32_paddd (v2si, v2si) | |
7727 | Generates the @code{paddd} machine instruction. | |
7728 | @item v8qi __builtin_ia32_psubb (v8qi, v8qi) | |
7729 | Generates the @code{psubb} machine instruction. | |
7730 | @item v4hi __builtin_ia32_psubw (v4hi, v4hi) | |
7731 | Generates the @code{psubw} machine instruction. | |
7732 | @item v2si __builtin_ia32_psubd (v2si, v2si) | |
7733 | Generates the @code{psubd} machine instruction. | |
7734 | ||
7735 | @item v8qi __builtin_ia32_paddsb (v8qi, v8qi) | |
7736 | Generates the @code{paddsb} machine instruction. | |
7737 | @item v4hi __builtin_ia32_paddsw (v4hi, v4hi) | |
7738 | Generates the @code{paddsw} machine instruction. | |
7739 | @item v8qi __builtin_ia32_psubsb (v8qi, v8qi) | |
7740 | Generates the @code{psubsb} machine instruction. | |
7741 | @item v4hi __builtin_ia32_psubsw (v4hi, v4hi) | |
7742 | Generates the @code{psubsw} machine instruction. | |
7743 | ||
7744 | @item v8qi __builtin_ia32_paddusb (v8qi, v8qi) | |
7745 | Generates the @code{paddusb} machine instruction. | |
7746 | @item v4hi __builtin_ia32_paddusw (v4hi, v4hi) | |
7747 | Generates the @code{paddusw} machine instruction. | |
7748 | @item v8qi __builtin_ia32_psubusb (v8qi, v8qi) | |
7749 | Generates the @code{psubusb} machine instruction. | |
7750 | @item v4hi __builtin_ia32_psubusw (v4hi, v4hi) | |
7751 | Generates the @code{psubusw} machine instruction. | |
7752 | ||
7753 | @item v4hi __builtin_ia32_pmullw (v4hi, v4hi) | |
7754 | Generates the @code{pmullw} machine instruction. | |
7755 | @item v4hi __builtin_ia32_pmulhw (v4hi, v4hi) | |
7756 | Generates the @code{pmulhw} machine instruction. | |
7757 | ||
7758 | @item di __builtin_ia32_pand (di, di) | |
7759 | Generates the @code{pand} machine instruction. | |
7760 | @item di __builtin_ia32_pandn (di,di) | |
7761 | Generates the @code{pandn} machine instruction. | |
7762 | @item di __builtin_ia32_por (di, di) | |
7763 | Generates the @code{por} machine instruction. | |
7764 | @item di __builtin_ia32_pxor (di, di) | |
7765 | Generates the @code{pxor} machine instruction. | |
7766 | ||
7767 | @item v8qi __builtin_ia32_pcmpeqb (v8qi, v8qi) | |
7768 | Generates the @code{pcmpeqb} machine instruction. | |
7769 | @item v4hi __builtin_ia32_pcmpeqw (v4hi, v4hi) | |
7770 | Generates the @code{pcmpeqw} machine instruction. | |
7771 | @item v2si __builtin_ia32_pcmpeqd (v2si, v2si) | |
7772 | Generates the @code{pcmpeqd} machine instruction. | |
7773 | @item v8qi __builtin_ia32_pcmpgtb (v8qi, v8qi) | |
7774 | Generates the @code{pcmpgtb} machine instruction. | |
7775 | @item v4hi __builtin_ia32_pcmpgtw (v4hi, v4hi) | |
7776 | Generates the @code{pcmpgtw} machine instruction. | |
7777 | @item v2si __builtin_ia32_pcmpgtd (v2si, v2si) | |
7778 | Generates the @code{pcmpgtd} machine instruction. | |
7779 | ||
7780 | @item v8qi __builtin_ia32_punpckhbw (v8qi, v8qi) | |
7781 | Generates the @code{punpckhbw} machine instruction. | |
7782 | @item v4hi __builtin_ia32_punpckhwd (v4hi, v4hi) | |
7783 | Generates the @code{punpckhwd} machine instruction. | |
7784 | @item v2si __builtin_ia32_punpckhdq (v2si, v2si) | |
7785 | Generates the @code{punpckhdq} machine instruction. | |
7786 | @item v8qi __builtin_ia32_punpcklbw (v8qi, v8qi) | |
7787 | Generates the @code{punpcklbw} machine instruction. | |
7788 | @item v4hi __builtin_ia32_punpcklwd (v4hi, v4hi) | |
7789 | Generates the @code{punpcklwd} machine instruction. | |
7790 | @item v2si __builtin_ia32_punpckldq (v2si, v2si) | |
7791 | Generates the @code{punpckldq} machine instruction. | |
7792 | ||
7793 | @item v8qi __builtin_ia32_packsswb (v4hi, v4hi) | |
7794 | Generates the @code{packsswb} machine instruction. | |
7795 | @item v4hi __builtin_ia32_packssdw (v2si, v2si) | |
7796 | Generates the @code{packssdw} machine instruction. | |
7797 | @item v8qi __builtin_ia32_packuswb (v4hi, v4hi) | |
7798 | Generates the @code{packuswb} machine instruction. | |
7799 | ||
7800 | @end table | |
7801 | ||
80ebf43e | 7802 | The following built-in functions are made available either with @option{-msse}, or |
1255c85c BS |
7803 | with a combination of @option{-m3dnow} and @option{-march=athlon}. |
7804 | @table @code | |
7805 | ||
7806 | @item v4hi __builtin_ia32_pmulhuw (v4hi, v4hi) | |
7807 | Generates the @code{pmulhuw} machine instruction. | |
7808 | ||
7809 | @item v8qi __builtin_ia32_pavgb (v8qi, v8qi) | |
7810 | Generates the @code{pavgb} machine instruction. | |
7811 | @item v4hi __builtin_ia32_pavgw (v4hi, v4hi) | |
7812 | Generates the @code{pavgw} machine instruction. | |
7813 | @item v4hi __builtin_ia32_psadbw (v8qi, v8qi) | |
7814 | Generates the @code{psadbw} machine instruction. | |
7815 | ||
7816 | @item v8qi __builtin_ia32_pmaxub (v8qi, v8qi) | |
7817 | Generates the @code{pmaxub} machine instruction. | |
7818 | @item v4hi __builtin_ia32_pmaxsw (v4hi, v4hi) | |
7819 | Generates the @code{pmaxsw} machine instruction. | |
7820 | @item v8qi __builtin_ia32_pminub (v8qi, v8qi) | |
7821 | Generates the @code{pminub} machine instruction. | |
7822 | @item v4hi __builtin_ia32_pminsw (v4hi, v4hi) | |
7823 | Generates the @code{pminsw} machine instruction. | |
7824 | ||
7825 | @item int __builtin_ia32_pextrw (v4hi, int) | |
7826 | Generates the @code{pextrw} machine instruction. | |
7827 | @item v4hi __builtin_ia32_pinsrw (v4hi, int, int) | |
7828 | Generates the @code{pinsrw} machine instruction. | |
7829 | ||
7830 | @item int __builtin_ia32_pmovmskb (v8qi) | |
7831 | Generates the @code{pmovmskb} machine instruction. | |
7832 | @item void __builtin_ia32_maskmovq (v8qi, v8qi, char *) | |
7833 | Generates the @code{maskmovq} machine instruction. | |
acb0aa65 | 7834 | @item void __builtin_ia32_movntq (di *, di) |
1255c85c | 7835 | Generates the @code{movntq} machine instruction. |
acb0aa65 | 7836 | @item void __builtin_ia32_sfence (void) |
1255c85c BS |
7837 | Generates the @code{sfence} machine instruction. |
7838 | @item void __builtin_ia32_prefetch (char *, int selector) | |
7839 | Generates a prefetch machine instruction, depending on the value of | |
7840 | selector. If @code{selector} is 0, it generates @code{prefetchnta}; for | |
7841 | a value of 1, it generates @code{prefetcht0}; for a value of 2, it generates | |
7842 | @code{prefetcht1}; and for a value of 3 it generates @code{prefetcht2}. | |
7843 | ||
7844 | @end table | |
7845 | ||
80ebf43e | 7846 | The following built-in functions are available when @option{-msse} is used. |
1255c85c BS |
7847 | |
7848 | @table @code | |
acb0aa65 | 7849 | @item int __builtin_ia32_comieq (v4sf, v4sf) |
1255c85c BS |
7850 | Generates the @code{comiss} machine instruction and performs an equality |
7851 | comparison. The return value is the truth value of that comparison. | |
acb0aa65 | 7852 | @item int __builtin_ia32_comineq (v4sf, v4sf) |
1255c85c BS |
7853 | Generates the @code{comiss} machine instruction and performs an inequality |
7854 | comparison. The return value is the truth value of that comparison. | |
acb0aa65 | 7855 | @item int __builtin_ia32_comilt (v4sf, v4sf) |
1255c85c BS |
7856 | Generates the @code{comiss} machine instruction and performs a ``less than'' |
7857 | comparison. The return value is the truth value of that comparison. | |
acb0aa65 | 7858 | @item int __builtin_ia32_comile (v4sf, v4sf) |
1255c85c BS |
7859 | Generates the @code{comiss} machine instruction and performs a ``less or |
7860 | equal'' comparison. The return value is the truth value of that comparison. | |
acb0aa65 | 7861 | @item int __builtin_ia32_comigt (v4sf, v4sf) |
1255c85c BS |
7862 | Generates the @code{comiss} machine instruction and performs a ``greater than'' |
7863 | comparison. The return value is the truth value of that comparison. | |
acb0aa65 | 7864 | @item int __builtin_ia32_comige (v4sf, v4sf) |
1255c85c BS |
7865 | Generates the @code{comiss} machine instruction and performs a ``greater or |
7866 | equal'' comparison. The return value is the truth value of that comparison. | |
7867 | ||
acb0aa65 | 7868 | @item int __builtin_ia32_ucomieq (v4sf, v4sf) |
1255c85c BS |
7869 | Generates the @code{ucomiss} machine instruction and performs an equality |
7870 | comparison. The return value is the truth value of that comparison. | |
acb0aa65 | 7871 | @item int __builtin_ia32_ucomineq (v4sf, v4sf) |
1255c85c BS |
7872 | Generates the @code{ucomiss} machine instruction and performs an inequality |
7873 | comparison. The return value is the truth value of that comparison. | |
acb0aa65 | 7874 | @item int __builtin_ia32_ucomilt (v4sf, v4sf) |
1255c85c BS |
7875 | Generates the @code{ucomiss} machine instruction and performs a ``less than'' |
7876 | comparison. The return value is the truth value of that comparison. | |
acb0aa65 | 7877 | @item int __builtin_ia32_ucomile (v4sf, v4sf) |
1255c85c BS |
7878 | Generates the @code{ucomiss} machine instruction and performs a ``less or |
7879 | equal'' comparison. The return value is the truth value of that comparison. | |
acb0aa65 | 7880 | @item int __builtin_ia32_ucomigt (v4sf, v4sf) |
1255c85c BS |
7881 | Generates the @code{ucomiss} machine instruction and performs a ``greater than'' |
7882 | comparison. The return value is the truth value of that comparison. | |
acb0aa65 | 7883 | @item int __builtin_ia32_ucomige (v4sf, v4sf) |
1255c85c BS |
7884 | Generates the @code{ucomiss} machine instruction and performs a ``greater or |
7885 | equal'' comparison. The return value is the truth value of that comparison. | |
7886 | ||
acb0aa65 | 7887 | @item v4sf __builtin_ia32_addps (v4sf, v4sf) |
1255c85c | 7888 | Generates the @code{addps} machine instruction. |
acb0aa65 | 7889 | @item v4sf __builtin_ia32_addss (v4sf, v4sf) |
1255c85c | 7890 | Generates the @code{addss} machine instruction. |
acb0aa65 | 7891 | @item v4sf __builtin_ia32_subps (v4sf, v4sf) |
1255c85c | 7892 | Generates the @code{subps} machine instruction. |
acb0aa65 | 7893 | @item v4sf __builtin_ia32_subss (v4sf, v4sf) |
1255c85c | 7894 | Generates the @code{subss} machine instruction. |
acb0aa65 | 7895 | @item v4sf __builtin_ia32_mulps (v4sf, v4sf) |
1255c85c | 7896 | Generates the @code{mulps} machine instruction. |
acb0aa65 | 7897 | @item v4sf __builtin_ia32_mulss (v4sf, v4sf) |
1255c85c | 7898 | Generates the @code{mulss} machine instruction. |
acb0aa65 | 7899 | @item v4sf __builtin_ia32_divps (v4sf, v4sf) |
1255c85c | 7900 | Generates the @code{divps} machine instruction. |
acb0aa65 | 7901 | @item v4sf __builtin_ia32_divss (v4sf, v4sf) |
1255c85c BS |
7902 | Generates the @code{divss} machine instruction. |
7903 | ||
acb0aa65 | 7904 | @item v4si __builtin_ia32_cmpeqps (v4sf, v4sf) |
1255c85c | 7905 | Generates the @code{cmpeqps} machine instruction. |
acb0aa65 | 7906 | @item v4si __builtin_ia32_cmplts (v4sf, v4sf) |
1255c85c | 7907 | Generates the @code{cmpltps} machine instruction. |
acb0aa65 | 7908 | @item v4si __builtin_ia32_cmpleps (v4sf, v4sf) |
1255c85c | 7909 | Generates the @code{cmpleps} machine instruction. |
acb0aa65 | 7910 | @item v4si __builtin_ia32_cmpgtps (v4sf, v4sf) |
1255c85c | 7911 | Generates the @code{cmpgtps} machine instruction. |
acb0aa65 | 7912 | @item v4si __builtin_ia32_cmpgeps (v4sf, v4sf) |
1255c85c | 7913 | Generates the @code{cmpgeps} machine instruction. |
acb0aa65 | 7914 | @item v4si __builtin_ia32_cmpunordps (v4sf, v4sf) |
1255c85c | 7915 | Generates the @code{cmpunodps} machine instruction. |
acb0aa65 | 7916 | @item v4si __builtin_ia32_cmpneqps (v4sf, v4sf) |
1255c85c | 7917 | Generates the @code{cmpeqps} machine instruction. |
acb0aa65 | 7918 | @item v4si __builtin_ia32_cmpnltps (v4sf, v4sf) |
1255c85c | 7919 | Generates the @code{cmpltps} machine instruction. |
acb0aa65 | 7920 | @item v4si __builtin_ia32_cmpnleps (v4sf, v4sf) |
1255c85c | 7921 | Generates the @code{cmpleps} machine instruction. |
acb0aa65 | 7922 | @item v4si __builtin_ia32_cmpngtps (v4sf, v4sf) |
1255c85c | 7923 | Generates the @code{cmpgtps} machine instruction. |
acb0aa65 | 7924 | @item v4si __builtin_ia32_cmpngeps (v4sf, v4sf) |
1255c85c | 7925 | Generates the @code{cmpgeps} machine instruction. |
acb0aa65 | 7926 | @item v4si __builtin_ia32_cmpordps (v4sf, v4sf) |
1255c85c BS |
7927 | Generates the @code{cmpunodps} machine instruction. |
7928 | ||
acb0aa65 | 7929 | @item v4si __builtin_ia32_cmpeqss (v4sf, v4sf) |
1255c85c | 7930 | Generates the @code{cmpeqss} machine instruction. |
acb0aa65 | 7931 | @item v4si __builtin_ia32_cmpltss (v4sf, v4sf) |
1255c85c | 7932 | Generates the @code{cmpltss} machine instruction. |
acb0aa65 | 7933 | @item v4si __builtin_ia32_cmpless (v4sf, v4sf) |
1255c85c | 7934 | Generates the @code{cmpless} machine instruction. |
acb0aa65 | 7935 | @item v4si __builtin_ia32_cmpgtss (v4sf, v4sf) |
1255c85c | 7936 | Generates the @code{cmpgtss} machine instruction. |
acb0aa65 | 7937 | @item v4si __builtin_ia32_cmpgess (v4sf, v4sf) |
1255c85c | 7938 | Generates the @code{cmpgess} machine instruction. |
acb0aa65 | 7939 | @item v4si __builtin_ia32_cmpunordss (v4sf, v4sf) |
1255c85c | 7940 | Generates the @code{cmpunodss} machine instruction. |
acb0aa65 | 7941 | @item v4si __builtin_ia32_cmpneqss (v4sf, v4sf) |
1255c85c | 7942 | Generates the @code{cmpeqss} machine instruction. |
acb0aa65 | 7943 | @item v4si __builtin_ia32_cmpnlts (v4sf, v4sf) |
1255c85c | 7944 | Generates the @code{cmpltss} machine instruction. |
acb0aa65 | 7945 | @item v4si __builtin_ia32_cmpnless (v4sf, v4sf) |
1255c85c | 7946 | Generates the @code{cmpless} machine instruction. |
acb0aa65 | 7947 | @item v4si __builtin_ia32_cmpngtss (v4sf, v4sf) |
1255c85c | 7948 | Generates the @code{cmpgtss} machine instruction. |
acb0aa65 | 7949 | @item v4si __builtin_ia32_cmpngess (v4sf, v4sf) |
1255c85c | 7950 | Generates the @code{cmpgess} machine instruction. |
acb0aa65 | 7951 | @item v4si __builtin_ia32_cmpordss (v4sf, v4sf) |
1255c85c BS |
7952 | Generates the @code{cmpunodss} machine instruction. |
7953 | ||
acb0aa65 | 7954 | @item v4sf __builtin_ia32_maxps (v4sf, v4sf) |
1255c85c | 7955 | Generates the @code{maxps} machine instruction. |
acb0aa65 | 7956 | @item v4sf __builtin_ia32_maxsss (v4sf, v4sf) |
1255c85c | 7957 | Generates the @code{maxss} machine instruction. |
acb0aa65 | 7958 | @item v4sf __builtin_ia32_minps (v4sf, v4sf) |
1255c85c | 7959 | Generates the @code{minps} machine instruction. |
acb0aa65 | 7960 | @item v4sf __builtin_ia32_minsss (v4sf, v4sf) |
1255c85c BS |
7961 | Generates the @code{minss} machine instruction. |
7962 | ||
acb0aa65 | 7963 | @item ti __builtin_ia32_andps (ti, ti) |
1255c85c | 7964 | Generates the @code{andps} machine instruction. |
acb0aa65 | 7965 | @item ti __builtin_ia32_andnps (ti, ti) |
1255c85c | 7966 | Generates the @code{andnps} machine instruction. |
acb0aa65 | 7967 | @item ti __builtin_ia32_orps (ti, ti) |
1255c85c | 7968 | Generates the @code{orps} machine instruction. |
acb0aa65 | 7969 | @item ti __builtin_ia32_xorps (ti, ti) |
1255c85c BS |
7970 | Generates the @code{xorps} machine instruction. |
7971 | ||
acb0aa65 | 7972 | @item v4sf __builtin_ia32_movps (v4sf, v4sf) |
1255c85c | 7973 | Generates the @code{movps} machine instruction. |
acb0aa65 | 7974 | @item v4sf __builtin_ia32_movhlps (v4sf, v4sf) |
1255c85c | 7975 | Generates the @code{movhlps} machine instruction. |
acb0aa65 | 7976 | @item v4sf __builtin_ia32_movlhps (v4sf, v4sf) |
1255c85c | 7977 | Generates the @code{movlhps} machine instruction. |
acb0aa65 | 7978 | @item v4sf __builtin_ia32_unpckhps (v4sf, v4sf) |
1255c85c | 7979 | Generates the @code{unpckhps} machine instruction. |
acb0aa65 | 7980 | @item v4sf __builtin_ia32_unpcklps (v4sf, v4sf) |
1255c85c BS |
7981 | Generates the @code{unpcklps} machine instruction. |
7982 | ||
acb0aa65 | 7983 | @item v4sf __builtin_ia32_cvtpi2ps (v4sf, v2si) |
1255c85c | 7984 | Generates the @code{cvtpi2ps} machine instruction. |
acb0aa65 | 7985 | @item v2si __builtin_ia32_cvtps2pi (v4sf) |
1255c85c | 7986 | Generates the @code{cvtps2pi} machine instruction. |
acb0aa65 | 7987 | @item v4sf __builtin_ia32_cvtsi2ss (v4sf, int) |
1255c85c | 7988 | Generates the @code{cvtsi2ss} machine instruction. |
acb0aa65 | 7989 | @item int __builtin_ia32_cvtss2si (v4sf) |
1255c85c | 7990 | Generates the @code{cvtsi2ss} machine instruction. |
acb0aa65 | 7991 | @item v2si __builtin_ia32_cvttps2pi (v4sf) |
1255c85c | 7992 | Generates the @code{cvttps2pi} machine instruction. |
acb0aa65 | 7993 | @item int __builtin_ia32_cvttss2si (v4sf) |
1255c85c BS |
7994 | Generates the @code{cvttsi2ss} machine instruction. |
7995 | ||
acb0aa65 | 7996 | @item v4sf __builtin_ia32_rcpps (v4sf) |
1255c85c | 7997 | Generates the @code{rcpps} machine instruction. |
acb0aa65 | 7998 | @item v4sf __builtin_ia32_rsqrtps (v4sf) |
1255c85c | 7999 | Generates the @code{rsqrtps} machine instruction. |
acb0aa65 | 8000 | @item v4sf __builtin_ia32_sqrtps (v4sf) |
1255c85c | 8001 | Generates the @code{sqrtps} machine instruction. |
acb0aa65 | 8002 | @item v4sf __builtin_ia32_rcpss (v4sf) |
1255c85c | 8003 | Generates the @code{rcpss} machine instruction. |
acb0aa65 | 8004 | @item v4sf __builtin_ia32_rsqrtss (v4sf) |
1255c85c | 8005 | Generates the @code{rsqrtss} machine instruction. |
acb0aa65 | 8006 | @item v4sf __builtin_ia32_sqrtss (v4sf) |
1255c85c BS |
8007 | Generates the @code{sqrtss} machine instruction. |
8008 | ||
acb0aa65 | 8009 | @item v4sf __builtin_ia32_shufps (v4sf, v4sf, int) |
1255c85c BS |
8010 | Generates the @code{shufps} machine instruction. |
8011 | ||
acb0aa65 | 8012 | @item v4sf __builtin_ia32_loadaps (float *) |
1255c85c | 8013 | Generates the @code{movaps} machine instruction as a load from memory. |
acb0aa65 | 8014 | @item void __builtin_ia32_storeaps (float *, v4sf) |
1255c85c | 8015 | Generates the @code{movaps} machine instruction as a store to memory. |
acb0aa65 | 8016 | @item v4sf __builtin_ia32_loadups (float *) |
1255c85c | 8017 | Generates the @code{movups} machine instruction as a load from memory. |
acb0aa65 | 8018 | @item void __builtin_ia32_storeups (float *, v4sf) |
1255c85c | 8019 | Generates the @code{movups} machine instruction as a store to memory. |
acb0aa65 | 8020 | @item v4sf __builtin_ia32_loadsss (float *) |
1255c85c | 8021 | Generates the @code{movss} machine instruction as a load from memory. |
acb0aa65 | 8022 | @item void __builtin_ia32_storess (float *, v4sf) |
1255c85c BS |
8023 | Generates the @code{movss} machine instruction as a store to memory. |
8024 | ||
acb0aa65 | 8025 | @item v4sf __builtin_ia32_loadhps (v4sf, v2si *) |
1255c85c | 8026 | Generates the @code{movhps} machine instruction as a load from memory. |
acb0aa65 | 8027 | @item v4sf __builtin_ia32_loadlps (v4sf, v2si *) |
1255c85c | 8028 | Generates the @code{movlps} machine instruction as a load from memory |
acb0aa65 | 8029 | @item void __builtin_ia32_storehps (v4sf, v2si *) |
1255c85c | 8030 | Generates the @code{movhps} machine instruction as a store to memory. |
acb0aa65 | 8031 | @item void __builtin_ia32_storelps (v4sf, v2si *) |
1255c85c BS |
8032 | Generates the @code{movlps} machine instruction as a store to memory. |
8033 | ||
acb0aa65 | 8034 | @item void __builtin_ia32_movntps (float *, v4sf) |
1255c85c | 8035 | Generates the @code{movntps} machine instruction. |
acb0aa65 | 8036 | @item int __builtin_ia32_movmskps (v4sf) |
1255c85c BS |
8037 | Generates the @code{movntps} machine instruction. |
8038 | ||
acb0aa65 | 8039 | @item void __builtin_ia32_storeps1 (float *, v4sf) |
1255c85c BS |
8040 | Generates the @code{movaps} machine instruction as a store to memory. |
8041 | Before storing, the value is modified with a @code{shufps} instruction | |
8042 | so that the lowest of the four floating point elements is replicated | |
8043 | across the entire vector that is stored. | |
acb0aa65 | 8044 | @item void __builtin_ia32_storerps (float *, v4sf) |
1255c85c BS |
8045 | Generates the @code{movaps} machine instruction as a store to memory. |
8046 | Before storing, the value is modified with a @code{shufps} instruction | |
8047 | so that the order of the four floating point elements in the vector is | |
8048 | reversed. | |
acb0aa65 | 8049 | @item v4sf __builtin_ia32_loadps1 (float *) |
1255c85c BS |
8050 | Generates a @code{movss} machine instruction to load a floating point |
8051 | value from memory, and a @code{shufps} instruction to replicate the | |
8052 | loaded value across all four elements of the result vector. | |
acb0aa65 | 8053 | @item v4sf __builtin_ia32_loadrps (float *) |
1255c85c BS |
8054 | Generates a @code{movaps} machine instruction to load a vector from |
8055 | memory, and a @code{shufps} instruction to reverse the order of the | |
8056 | four floating point elements in the result vector. | |
8057 | @item v4sf __builtin_ia32_setps (float, float, float, float) | |
8058 | Constructs a vector from four single floating point values. The return | |
8059 | value is equal to the value that would result from storing the four | |
8060 | arguments into consecutive memory locations and then executing a | |
8061 | @code{movaps} to load the vector from memory. | |
8062 | @item v4sf __builtin_ia32_setps1 (float) | |
8063 | Constructs a vector from a single floating point value by replicating | |
8064 | it across all four elements of the result vector. | |
8065 | @end table | |
8066 | ||
f73ad30e | 8067 | @item -mpush-args |
a7939b1d | 8068 | @itemx -mno-push-args |
cd3bb277 | 8069 | @opindex mpush-args |
a7939b1d | 8070 | @opindex mno-push-args |
767094dd | 8071 | Use PUSH operations to store outgoing parameters. This method is shorter |
f73ad30e | 8072 | and usually equally fast as method using SUB/MOV operations and is enabled |
767094dd | 8073 | by default. In some cases disabling it may improve performance because of |
f73ad30e JH |
8074 | improved scheduling and reduced dependencies. |
8075 | ||
8076 | @item -maccumulate-outgoing-args | |
cd3bb277 | 8077 | @opindex maccumulate-outgoing-args |
f73ad30e | 8078 | If enabled, the maximum amount of space required for outgoing arguments will be |
a7939b1d | 8079 | computed in the function prologue. This is faster on most modern CPUs |
b192711e | 8080 | because of reduced dependencies, improved scheduling and reduced stack usage |
f73ad30e | 8081 | when preferred stack boundary is not equal to 2. The drawback is a notable |
767094dd | 8082 | increase in code size. This switch implies @option{-mno-push-args}. |
f73ad30e | 8083 | |
f22a97d2 | 8084 | @item -mthreads |
cd3bb277 | 8085 | @opindex mthreads |
767094dd | 8086 | Support thread-safe exception handling on @samp{Mingw32}. Code that relies |
02f52e19 | 8087 | on thread-safe exception handling must compile and link all code with the |
767094dd | 8088 | @option{-mthreads} option. When compiling, @option{-mthreads} defines |
630d3d5a JM |
8089 | @option{-D_MT}; when linking, it links in a special thread helper library |
8090 | @option{-lmingwthrd} which cleans up per thread exception handling data. | |
79f05c19 JH |
8091 | |
8092 | @item -mno-align-stringops | |
cd3bb277 | 8093 | @opindex mno-align-stringops |
767094dd | 8094 | Do not align destination of inlined string operations. This switch reduces |
79f05c19 JH |
8095 | code size and improves performance in case the destination is already aligned, |
8096 | but gcc don't know about it. | |
8097 | ||
8098 | @item -minline-all-stringops | |
cd3bb277 | 8099 | @opindex minline-all-stringops |
79f05c19 | 8100 | By default GCC inlines string operations only when destination is known to be |
767094dd | 8101 | aligned at least to 4 byte boundary. This enables more inlining, increase code |
79f05c19 JH |
8102 | size, but may improve performance of code that depends on fast memcpy, strlen |
8103 | and memset for short lengths. | |
762e166b AJ |
8104 | |
8105 | @item -momit-leaf-frame-pointer | |
cd3bb277 | 8106 | @opindex momit-leaf-frame-pointer |
762e166b AJ |
8107 | Don't keep the frame pointer in a register for leaf functions. This |
8108 | avoids the instructions to save, set up and restore frame pointers and | |
8109 | makes an extra register available in leaf functions. The option | |
630d3d5a | 8110 | @option{-fomit-frame-pointer} removes the frame pointer for all functions |
762e166b | 8111 | which might make debugging harder. |
3af4bd89 JH |
8112 | @end table |
8113 | ||
14f73b5a JH |
8114 | These @samp{-m} switches are supported in addition to the above |
8115 | on AMD x86-64 processors in 64-bit environments. | |
8116 | ||
8117 | @table @gcctabopt | |
8118 | @item -m32 | |
8119 | @itemx -m64 | |
8120 | @opindex m32 | |
8121 | @opindex m64 | |
8122 | Generate code for a 32-bit or 64-bit environment. | |
8123 | The 32-bit environment sets int, long and pointer to 32 bits and | |
8124 | generates code that runs on any i386 system. | |
8125 | The 64-bit environment sets int to 32 bits and long and pointer | |
8126 | to 64 bits and generates code for AMD's x86-64 architecture. | |
8127 | ||
8128 | @item -mno-red-zone | |
8129 | @opindex no-red-zone | |
8130 | Do not use a so called red zone for x86-64 code. The red zone is mandated | |
8131 | by the x86-64 ABI, it is a 128-byte area beyond the location of the | |
8132 | stack pointer that will not be modified by signal or interrupt handlers | |
8133 | and therefore can be used for temporary data without adjusting the stack | |
8134 | pointer. The flag @option{-mno-red-zone} disables this red zone. | |
8135 | @end table | |
8136 | ||
74291a4b MM |
8137 | @node HPPA Options |
8138 | @subsection HPPA Options | |
8139 | @cindex HPPA Options | |
8140 | ||
8141 | These @samp{-m} options are defined for the HPPA family of computers: | |
8142 | ||
2642624b | 8143 | @table @gcctabopt |
630d3d5a | 8144 | @item -march=@var{architecture-type} |
cd3bb277 | 8145 | @opindex march |
ea3bfbfe | 8146 | Generate code for the specified architecture. The choices for |
630d3d5a | 8147 | @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA |
ea3bfbfe JQ |
8148 | 1.1, and @samp{2.0} for PA 2.0 processors. Refer to |
8149 | @file{/usr/lib/sched.models} on an HP-UX system to determine the proper | |
8150 | architecture option for your machine. Code compiled for lower numbered | |
8151 | architectures will run on higher numbered architectures, but not the | |
8152 | other way around. | |
8153 | ||
8154 | PA 2.0 support currently requires gas snapshot 19990413 or later. The | |
8155 | next release of binutils (current is 2.9.1) will probably contain PA 2.0 | |
02f52e19 | 8156 | support. |
74291a4b | 8157 | |
ea3bfbfe | 8158 | @item -mpa-risc-1-0 |
62a1403d AS |
8159 | @itemx -mpa-risc-1-1 |
8160 | @itemx -mpa-risc-2-0 | |
cd3bb277 JM |
8161 | @opindex mpa-risc-1-0 |
8162 | @opindex mpa-risc-1-1 | |
8163 | @opindex mpa-risc-2-0 | |
695ac33f | 8164 | Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. |
74291a4b | 8165 | |
861bb6c1 | 8166 | @item -mbig-switch |
cd3bb277 | 8167 | @opindex mbig-switch |
861bb6c1 JL |
8168 | Generate code suitable for big switch tables. Use this option only if |
8169 | the assembler/linker complain about out of range branches within a switch | |
8170 | table. | |
8171 | ||
74291a4b | 8172 | @item -mjump-in-delay |
cd3bb277 | 8173 | @opindex mjump-in-delay |
74291a4b MM |
8174 | Fill delay slots of function calls with unconditional jump instructions |
8175 | by modifying the return pointer for the function call to be the target | |
8176 | of the conditional jump. | |
8177 | ||
8178 | @item -mdisable-fpregs | |
cd3bb277 | 8179 | @opindex mdisable-fpregs |
74291a4b MM |
8180 | Prevent floating point registers from being used in any manner. This is |
8181 | necessary for compiling kernels which perform lazy context switching of | |
8182 | floating point registers. If you use this option and attempt to perform | |
8183 | floating point operations, the compiler will abort. | |
8184 | ||
8185 | @item -mdisable-indexing | |
cd3bb277 | 8186 | @opindex mdisable-indexing |
74291a4b | 8187 | Prevent the compiler from using indexing address modes. This avoids some |
161d7b59 | 8188 | rather obscure problems when compiling MIG generated code under MACH@. |
74291a4b MM |
8189 | |
8190 | @item -mno-space-regs | |
cd3bb277 | 8191 | @opindex mno-space-regs |
74291a4b MM |
8192 | Generate code that assumes the target has no space registers. This allows |
8193 | GCC to generate faster indirect calls and use unscaled index address modes. | |
8194 | ||
8195 | Such code is suitable for level 0 PA systems and kernels. | |
8196 | ||
8197 | @item -mfast-indirect-calls | |
cd3bb277 | 8198 | @opindex mfast-indirect-calls |
74291a4b MM |
8199 | Generate code that assumes calls never cross space boundaries. This |
8200 | allows GCC to emit code which performs faster indirect calls. | |
8201 | ||
b192711e | 8202 | This option will not work in the presence of shared libraries or nested |
74291a4b MM |
8203 | functions. |
8204 | ||
74291a4b | 8205 | @item -mlong-load-store |
cd3bb277 | 8206 | @opindex mlong-load-store |
74291a4b MM |
8207 | Generate 3-instruction load and store sequences as sometimes required by |
8208 | the HP-UX 10 linker. This is equivalent to the @samp{+k} option to | |
8209 | the HP compilers. | |
8210 | ||
8211 | @item -mportable-runtime | |
cd3bb277 | 8212 | @opindex mportable-runtime |
74291a4b MM |
8213 | Use the portable calling conventions proposed by HP for ELF systems. |
8214 | ||
8215 | @item -mgas | |
cd3bb277 | 8216 | @opindex mgas |
74291a4b MM |
8217 | Enable the use of assembler directives only GAS understands. |
8218 | ||
630d3d5a | 8219 | @item -mschedule=@var{cpu-type} |
cd3bb277 | 8220 | @opindex mschedule |
74291a4b | 8221 | Schedule code according to the constraints for the machine type |
630d3d5a | 8222 | @var{cpu-type}. The choices for @var{cpu-type} are @samp{700} |
02f52e19 | 8223 | @samp{7100}, @samp{7100LC}, @samp{7200}, and @samp{8000}. Refer to |
732135bf JL |
8224 | @file{/usr/lib/sched.models} on an HP-UX system to determine the |
8225 | proper scheduling option for your machine. | |
74291a4b MM |
8226 | |
8227 | @item -mlinker-opt | |
cd3bb277 | 8228 | @opindex mlinker-opt |
74291a4b MM |
8229 | Enable the optimization pass in the HPUX linker. Note this makes symbolic |
8230 | debugging impossible. It also triggers a bug in the HPUX 8 and HPUX 9 linkers | |
8231 | in which they give bogus error messages when linking some programs. | |
8232 | ||
8233 | @item -msoft-float | |
cd3bb277 | 8234 | @opindex msoft-float |
74291a4b MM |
8235 | Generate output containing library calls for floating point. |
8236 | @strong{Warning:} the requisite libraries are not available for all HPPA | |
8237 | targets. Normally the facilities of the machine's usual C compiler are | |
8238 | used, but this cannot be done directly in cross-compilation. You must make | |
8239 | your own arrangements to provide suitable library functions for | |
8240 | cross-compilation. The embedded target @samp{hppa1.1-*-pro} | |
8241 | does provide software floating point support. | |
8242 | ||
630d3d5a | 8243 | @option{-msoft-float} changes the calling convention in the output file; |
74291a4b MM |
8244 | therefore, it is only useful if you compile @emph{all} of a program with |
8245 | this option. In particular, you need to compile @file{libgcc.a}, the | |
630d3d5a | 8246 | library that comes with GCC, with @option{-msoft-float} in order for |
74291a4b MM |
8247 | this to work. |
8248 | @end table | |
8249 | ||
8250 | @node Intel 960 Options | |
8251 | @subsection Intel 960 Options | |
8252 | ||
8253 | These @samp{-m} options are defined for the Intel 960 implementations: | |
8254 | ||
2642624b | 8255 | @table @gcctabopt |
cd3bb277 JM |
8256 | @item -m@var{cpu-type} |
8257 | @opindex mka | |
8258 | @opindex mkb | |
8259 | @opindex mmc | |
8260 | @opindex mca | |
8261 | @opindex mcf | |
8262 | @opindex msa | |
8263 | @opindex msb | |
8264 | Assume the defaults for the machine type @var{cpu-type} for some of | |
74291a4b | 8265 | the other options, including instruction scheduling, floating point |
cd3bb277 | 8266 | support, and addressing modes. The choices for @var{cpu-type} are |
74291a4b MM |
8267 | @samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf}, |
8268 | @samp{sa}, and @samp{sb}. | |
8269 | The default is | |
8270 | @samp{kb}. | |
8271 | ||
8272 | @item -mnumerics | |
8273 | @itemx -msoft-float | |
cd3bb277 JM |
8274 | @opindex mnumerics |
8275 | @opindex msoft-float | |
630d3d5a JM |
8276 | The @option{-mnumerics} option indicates that the processor does support |
8277 | floating-point instructions. The @option{-msoft-float} option indicates | |
74291a4b MM |
8278 | that floating-point support should not be assumed. |
8279 | ||
8280 | @item -mleaf-procedures | |
8281 | @itemx -mno-leaf-procedures | |
cd3bb277 JM |
8282 | @opindex mleaf-procedures |
8283 | @opindex mno-leaf-procedures | |
74291a4b MM |
8284 | Do (or do not) attempt to alter leaf procedures to be callable with the |
8285 | @code{bal} instruction as well as @code{call}. This will result in more | |
8286 | efficient code for explicit calls when the @code{bal} instruction can be | |
8287 | substituted by the assembler or linker, but less efficient code in other | |
8288 | cases, such as calls via function pointers, or using a linker that doesn't | |
8289 | support this optimization. | |
8290 | ||
8291 | @item -mtail-call | |
8292 | @itemx -mno-tail-call | |
cd3bb277 JM |
8293 | @opindex mtail-call |
8294 | @opindex mno-tail-call | |
74291a4b MM |
8295 | Do (or do not) make additional attempts (beyond those of the |
8296 | machine-independent portions of the compiler) to optimize tail-recursive | |
8297 | calls into branches. You may not want to do this because the detection of | |
8298 | cases where this is not valid is not totally complete. The default is | |
630d3d5a | 8299 | @option{-mno-tail-call}. |
74291a4b MM |
8300 | |
8301 | @item -mcomplex-addr | |
8302 | @itemx -mno-complex-addr | |
cd3bb277 JM |
8303 | @opindex mcomplex-addr |
8304 | @opindex mno-complex-addr | |
74291a4b MM |
8305 | Assume (or do not assume) that the use of a complex addressing mode is a |
8306 | win on this implementation of the i960. Complex addressing modes may not | |
8307 | be worthwhile on the K-series, but they definitely are on the C-series. | |
630d3d5a | 8308 | The default is currently @option{-mcomplex-addr} for all processors except |
161d7b59 | 8309 | the CB and CC@. |
74291a4b MM |
8310 | |
8311 | @item -mcode-align | |
8312 | @itemx -mno-code-align | |
cd3bb277 JM |
8313 | @opindex mcode-align |
8314 | @opindex mno-code-align | |
74291a4b MM |
8315 | Align code to 8-byte boundaries for faster fetching (or don't bother). |
8316 | Currently turned on by default for C-series implementations only. | |
8317 | ||
8318 | @ignore | |
8319 | @item -mclean-linkage | |
8320 | @itemx -mno-clean-linkage | |
cd3bb277 JM |
8321 | @opindex mclean-linkage |
8322 | @opindex mno-clean-linkage | |
74291a4b MM |
8323 | These options are not fully implemented. |
8324 | @end ignore | |
8325 | ||
8326 | @item -mic-compat | |
8327 | @itemx -mic2.0-compat | |
8328 | @itemx -mic3.0-compat | |
cd3bb277 JM |
8329 | @opindex mic-compat |
8330 | @opindex mic2.0-compat | |
8331 | @opindex mic3.0-compat | |
74291a4b MM |
8332 | Enable compatibility with iC960 v2.0 or v3.0. |
8333 | ||
8334 | @item -masm-compat | |
8335 | @itemx -mintel-asm | |
cd3bb277 JM |
8336 | @opindex masm-compat |
8337 | @opindex mintel-asm | |
74291a4b MM |
8338 | Enable compatibility with the iC960 assembler. |
8339 | ||
8340 | @item -mstrict-align | |
8341 | @itemx -mno-strict-align | |
cd3bb277 JM |
8342 | @opindex mstrict-align |
8343 | @opindex mno-strict-align | |
74291a4b MM |
8344 | Do not permit (do permit) unaligned accesses. |
8345 | ||
8346 | @item -mold-align | |
cd3bb277 | 8347 | @opindex mold-align |
74291a4b | 8348 | Enable structure-alignment compatibility with Intel's gcc release version |
630d3d5a | 8349 | 1.3 (based on gcc 1.37). This option implies @option{-mstrict-align}. |
eaa4b44c VM |
8350 | |
8351 | @item -mlong-double-64 | |
cd3bb277 | 8352 | @opindex mlong-double-64 |
eaa4b44c VM |
8353 | Implement type @samp{long double} as 64-bit floating point numbers. |
8354 | Without the option @samp{long double} is implemented by 80-bit | |
8355 | floating point numbers. The only reason we have it because there is | |
8356 | no 128-bit @samp{long double} support in @samp{fp-bit.c} yet. So it | |
8357 | is only useful for people using soft-float targets. Otherwise, we | |
8358 | should recommend against use of it. | |
8359 | ||
74291a4b MM |
8360 | @end table |
8361 | ||
8362 | @node DEC Alpha Options | |
8363 | @subsection DEC Alpha Options | |
8364 | ||
8365 | These @samp{-m} options are defined for the DEC Alpha implementations: | |
8366 | ||
2642624b | 8367 | @table @gcctabopt |
74291a4b MM |
8368 | @item -mno-soft-float |
8369 | @itemx -msoft-float | |
cd3bb277 JM |
8370 | @opindex mno-soft-float |
8371 | @opindex msoft-float | |
74291a4b | 8372 | Use (do not use) the hardware floating-point instructions for |
bedc7537 | 8373 | floating-point operations. When @option{-msoft-float} is specified, |
7857f134 | 8374 | functions in @file{libgcc.a} will be used to perform floating-point |
74291a4b MM |
8375 | operations. Unless they are replaced by routines that emulate the |
8376 | floating-point operations, or compiled in such a way as to call such | |
8377 | emulations routines, these routines will issue floating-point | |
8378 | operations. If you are compiling for an Alpha without floating-point | |
8379 | operations, you must ensure that the library is built so as not to call | |
8380 | them. | |
8381 | ||
8382 | Note that Alpha implementations without floating-point operations are | |
8383 | required to have floating-point registers. | |
8384 | ||
8385 | @item -mfp-reg | |
8386 | @itemx -mno-fp-regs | |
cd3bb277 JM |
8387 | @opindex mfp-reg |
8388 | @opindex mno-fp-regs | |
74291a4b | 8389 | Generate code that uses (does not use) the floating-point register set. |
bedc7537 | 8390 | @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point |
74291a4b MM |
8391 | register set is not used, floating point operands are passed in integer |
8392 | registers as if they were integers and floating-point results are passed | |
8393 | in $0 instead of $f0. This is a non-standard calling sequence, so any | |
8394 | function with a floating-point argument or return value called by code | |
bedc7537 | 8395 | compiled with @option{-mno-fp-regs} must also be compiled with that |
74291a4b MM |
8396 | option. |
8397 | ||
8398 | A typical use of this option is building a kernel that does not use, | |
8399 | and hence need not save and restore, any floating-point registers. | |
8400 | ||
8401 | @item -mieee | |
cd3bb277 | 8402 | @opindex mieee |
74291a4b MM |
8403 | The Alpha architecture implements floating-point hardware optimized for |
8404 | maximum performance. It is mostly compliant with the IEEE floating | |
8405 | point standard. However, for full compliance, software assistance is | |
8406 | required. This option generates code fully IEEE compliant code | |
630d3d5a | 8407 | @emph{except} that the @var{inexact-flag} is not maintained (see below). |
9c34dbbf ZW |
8408 | If this option is turned on, the preprocessor macro @code{_IEEE_FP} is |
8409 | defined during compilation. The resulting code is less efficient but is | |
8410 | able to correctly support denormalized numbers and exceptional IEEE | |
8411 | values such as not-a-number and plus/minus infinity. Other Alpha | |
8412 | compilers call this option @option{-ieee_with_no_inexact}. | |
74291a4b MM |
8413 | |
8414 | @item -mieee-with-inexact | |
cd3bb277 | 8415 | @opindex mieee-with-inexact |
9c34dbbf ZW |
8416 | This is like @option{-mieee} except the generated code also maintains |
8417 | the IEEE @var{inexact-flag}. Turning on this option causes the | |
8418 | generated code to implement fully-compliant IEEE math. In addition to | |
8419 | @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor | |
8420 | macro. On some Alpha implementations the resulting code may execute | |
8421 | significantly slower than the code generated by default. Since there is | |
8422 | very little code that depends on the @var{inexact-flag}, you should | |
74291a4b | 8423 | normally not specify this option. Other Alpha compilers call this |
630d3d5a | 8424 | option @option{-ieee_with_inexact}. |
74291a4b | 8425 | |
630d3d5a | 8426 | @item -mfp-trap-mode=@var{trap-mode} |
cd3bb277 | 8427 | @opindex mfp-trap-mode |
74291a4b | 8428 | This option controls what floating-point related traps are enabled. |
630d3d5a | 8429 | Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. |
74291a4b MM |
8430 | The trap mode can be set to one of four values: |
8431 | ||
8432 | @table @samp | |
8433 | @item n | |
8434 | This is the default (normal) setting. The only traps that are enabled | |
8435 | are the ones that cannot be disabled in software (e.g., division by zero | |
8436 | trap). | |
8437 | ||
8438 | @item u | |
8439 | In addition to the traps enabled by @samp{n}, underflow traps are enabled | |
8440 | as well. | |
8441 | ||
8442 | @item su | |
8443 | Like @samp{su}, but the instructions are marked to be safe for software | |
8444 | completion (see Alpha architecture manual for details). | |
8445 | ||
8446 | @item sui | |
8447 | Like @samp{su}, but inexact traps are enabled as well. | |
8448 | @end table | |
8449 | ||
630d3d5a | 8450 | @item -mfp-rounding-mode=@var{rounding-mode} |
cd3bb277 | 8451 | @opindex mfp-rounding-mode |
74291a4b | 8452 | Selects the IEEE rounding mode. Other Alpha compilers call this option |
630d3d5a | 8453 | @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one |
74291a4b MM |
8454 | of: |
8455 | ||
8456 | @table @samp | |
8457 | @item n | |
8458 | Normal IEEE rounding mode. Floating point numbers are rounded towards | |
8459 | the nearest machine number or towards the even machine number in case | |
8460 | of a tie. | |
8461 | ||
8462 | @item m | |
8463 | Round towards minus infinity. | |
8464 | ||
8465 | @item c | |
8466 | Chopped rounding mode. Floating point numbers are rounded towards zero. | |
8467 | ||
8468 | @item d | |
8469 | Dynamic rounding mode. A field in the floating point control register | |
8470 | (@var{fpcr}, see Alpha architecture reference manual) controls the | |
8471 | rounding mode in effect. The C library initializes this register for | |
8472 | rounding towards plus infinity. Thus, unless your program modifies the | |
ec4b2ecb CB |
8473 | @var{fpcr}, @samp{d} corresponds to round towards plus infinity. |
8474 | @end table | |
74291a4b | 8475 | |
630d3d5a | 8476 | @item -mtrap-precision=@var{trap-precision} |
cd3bb277 | 8477 | @opindex mtrap-precision |
74291a4b MM |
8478 | In the Alpha architecture, floating point traps are imprecise. This |
8479 | means without software assistance it is impossible to recover from a | |
8480 | floating trap and program execution normally needs to be terminated. | |
0c2d1a2a | 8481 | GCC can generate code that can assist operating system trap handlers |
74291a4b MM |
8482 | in determining the exact location that caused a floating point trap. |
8483 | Depending on the requirements of an application, different levels of | |
8484 | precisions can be selected: | |
8485 | ||
8486 | @table @samp | |
8487 | @item p | |
8488 | Program precision. This option is the default and means a trap handler | |
8489 | can only identify which program caused a floating point exception. | |
8490 | ||
8491 | @item f | |
8492 | Function precision. The trap handler can determine the function that | |
8493 | caused a floating point exception. | |
8494 | ||
8495 | @item i | |
8496 | Instruction precision. The trap handler can determine the exact | |
8497 | instruction that caused a floating point exception. | |
8498 | @end table | |
8499 | ||
8500 | Other Alpha compilers provide the equivalent options called | |
630d3d5a | 8501 | @option{-scope_safe} and @option{-resumption_safe}. |
74291a4b MM |
8502 | |
8503 | @item -mieee-conformant | |
cd3bb277 | 8504 | @opindex mieee-conformant |
74291a4b | 8505 | This option marks the generated code as IEEE conformant. You must not |
630d3d5a JM |
8506 | use this option unless you also specify @option{-mtrap-precision=i} and either |
8507 | @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect | |
74291a4b MM |
8508 | is to emit the line @samp{.eflag 48} in the function prologue of the |
8509 | generated assembly file. Under DEC Unix, this has the effect that | |
8510 | IEEE-conformant math library routines will be linked in. | |
8511 | ||
8512 | @item -mbuild-constants | |
cd3bb277 | 8513 | @opindex mbuild-constants |
0c2d1a2a | 8514 | Normally GCC examines a 32- or 64-bit integer constant to |
74291a4b MM |
8515 | see if it can construct it from smaller constants in two or three |
8516 | instructions. If it cannot, it will output the constant as a literal and | |
956d6950 | 8517 | generate code to load it from the data segment at runtime. |
74291a4b | 8518 | |
0c2d1a2a | 8519 | Use this option to require GCC to construct @emph{all} integer constants |
74291a4b MM |
8520 | using code, even if it takes more instructions (the maximum is six). |
8521 | ||
8522 | You would typically use this option to build a shared library dynamic | |
8523 | loader. Itself a shared library, it must relocate itself in memory | |
8524 | before it can find the variables and constants in its own data segment. | |
956d6950 JL |
8525 | |
8526 | @item -malpha-as | |
8527 | @itemx -mgas | |
cd3bb277 JM |
8528 | @opindex malpha-as |
8529 | @opindex mgas | |
956d6950 | 8530 | Select whether to generate code to be assembled by the vendor-supplied |
630d3d5a | 8531 | assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}. |
956d6950 JL |
8532 | |
8533 | @item -mbwx | |
8534 | @itemx -mno-bwx | |
8535 | @itemx -mcix | |
8536 | @itemx -mno-cix | |
8537 | @itemx -mmax | |
8538 | @itemx -mno-max | |
cd3bb277 JM |
8539 | @opindex mbwx |
8540 | @opindex mno-bwx | |
8541 | @opindex mcix | |
8542 | @opindex mno-cix | |
8543 | @opindex mmax | |
8544 | @opindex mno-max | |
0c2d1a2a | 8545 | Indicate whether GCC should generate code to use the optional BWX, |
956d6950 | 8546 | CIX, and MAX instruction sets. The default is to use the instruction sets |
630d3d5a | 8547 | supported by the CPU type specified via @option{-mcpu=} option or that |
0c2d1a2a | 8548 | of the CPU on which GCC was built if none was specified. |
956d6950 | 8549 | |
956d6950 | 8550 | @item -mcpu=@var{cpu_type} |
cd3bb277 | 8551 | @opindex mcpu |
956d6950 JL |
8552 | Set the instruction set, register set, and instruction scheduling |
8553 | parameters for machine type @var{cpu_type}. You can specify either the | |
0c2d1a2a | 8554 | @samp{EV} style name or the corresponding chip number. GCC |
956d6950 JL |
8555 | supports scheduling parameters for the EV4 and EV5 family of processors |
8556 | and will choose the default values for the instruction set from | |
8557 | the processor you specify. If you do not specify a processor type, | |
0c2d1a2a | 8558 | GCC will default to the processor on which the compiler was built. |
956d6950 JL |
8559 | |
8560 | Supported values for @var{cpu_type} are | |
8561 | ||
8562 | @table @samp | |
8563 | @item ev4 | |
8564 | @itemx 21064 | |
8565 | Schedules as an EV4 and has no instruction set extensions. | |
8566 | ||
8567 | @item ev5 | |
8568 | @itemx 21164 | |
8569 | Schedules as an EV5 and has no instruction set extensions. | |
8570 | ||
8571 | @item ev56 | |
8572 | @itemx 21164a | |
8573 | Schedules as an EV5 and supports the BWX extension. | |
8574 | ||
8575 | @item pca56 | |
4f69985c | 8576 | @itemx 21164pc |
956d6950 JL |
8577 | @itemx 21164PC |
8578 | Schedules as an EV5 and supports the BWX and MAX extensions. | |
8579 | ||
8580 | @item ev6 | |
8581 | @itemx 21264 | |
8582 | Schedules as an EV5 (until Digital releases the scheduling parameters | |
8583 | for the EV6) and supports the BWX, CIX, and MAX extensions. | |
4f69985c RH |
8584 | @end table |
8585 | ||
8586 | @item -mmemory-latency=@var{time} | |
cd3bb277 | 8587 | @opindex mmemory-latency |
4f69985c RH |
8588 | Sets the latency the scheduler should assume for typical memory |
8589 | references as seen by the application. This number is highly | |
b192711e | 8590 | dependent on the memory access patterns used by the application |
4f69985c RH |
8591 | and the size of the external cache on the machine. |
8592 | ||
8593 | Valid options for @var{time} are | |
8594 | ||
8595 | @table @samp | |
8596 | @item @var{number} | |
8597 | A decimal number representing clock cycles. | |
8598 | ||
8599 | @item L1 | |
8600 | @itemx L2 | |
8601 | @itemx L3 | |
8602 | @itemx main | |
8603 | The compiler contains estimates of the number of clock cycles for | |
8604 | ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches | |
8605 | (also called Dcache, Scache, and Bcache), as well as to main memory. | |
8606 | Note that L3 is only valid for EV5. | |
8607 | ||
956d6950 | 8608 | @end table |
74291a4b MM |
8609 | @end table |
8610 | ||
d7c23cdc DR |
8611 | @node DEC Alpha/VMS Options |
8612 | @subsection DEC Alpha/VMS Options | |
8613 | ||
8614 | These @samp{-m} options are defined for the DEC Alpha/VMS implementations: | |
8615 | ||
8616 | @table @gcctabopt | |
8617 | @item -mvms-return-codes | |
8618 | @opindex mvms-return-codes | |
bf6cfc5e RK |
8619 | Return VMS condition codes from main. The default is to return POSIX |
8620 | style condition (e.g.@ error) codes. | |
d7c23cdc DR |
8621 | @end table |
8622 | ||
74291a4b MM |
8623 | @node Clipper Options |
8624 | @subsection Clipper Options | |
8625 | ||
8626 | These @samp{-m} options are defined for the Clipper implementations: | |
8627 | ||
2642624b | 8628 | @table @gcctabopt |
74291a4b | 8629 | @item -mc300 |
cd3bb277 | 8630 | @opindex mc300 |
767094dd | 8631 | Produce code for a C300 Clipper processor. This is the default. |
74291a4b | 8632 | |
62a1403d | 8633 | @item -mc400 |
cd3bb277 | 8634 | @opindex mc400 |
9c34dbbf ZW |
8635 | Produce code for a C400 Clipper processor, i.e.@: use floating point |
8636 | registers f8--f15. | |
74291a4b MM |
8637 | @end table |
8638 | ||
8639 | @node H8/300 Options | |
8640 | @subsection H8/300 Options | |
8641 | ||
8642 | These @samp{-m} options are defined for the H8/300 implementations: | |
8643 | ||
2642624b | 8644 | @table @gcctabopt |
74291a4b | 8645 | @item -mrelax |
cd3bb277 | 8646 | @opindex mrelax |
74291a4b | 8647 | Shorten some address references at link time, when possible; uses the |
630d3d5a | 8648 | linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, |
74291a4b MM |
8649 | ld.info, Using ld}, for a fuller description. |
8650 | ||
8651 | @item -mh | |
cd3bb277 | 8652 | @opindex mh |
161d7b59 | 8653 | Generate code for the H8/300H@. |
74291a4b | 8654 | |
dcb9d1f0 | 8655 | @item -ms |
cd3bb277 | 8656 | @opindex ms |
161d7b59 | 8657 | Generate code for the H8/S@. |
dcb9d1f0 | 8658 | |
17f0f8fa | 8659 | @item -ms2600 |
cd3bb277 | 8660 | @opindex ms2600 |
695ac33f | 8661 | Generate code for the H8/S2600. This switch must be used with @option{-ms}. |
17f0f8fa | 8662 | |
74291a4b | 8663 | @item -mint32 |
cd3bb277 | 8664 | @opindex mint32 |
74291a4b MM |
8665 | Make @code{int} data 32 bits by default. |
8666 | ||
8667 | @item -malign-300 | |
cd3bb277 | 8668 | @opindex malign-300 |
2c54abce KH |
8669 | On the H8/300H and H8/S, use the same alignment rules as for the H8/300. |
8670 | The default for the H8/300H and H8/S is to align longs and floats on 4 | |
8671 | byte boundaries. | |
630d3d5a | 8672 | @option{-malign-300} causes them to be aligned on 2 byte boundaries. |
2c54abce | 8673 | This option has no effect on the H8/300. |
74291a4b MM |
8674 | @end table |
8675 | ||
8676 | @node SH Options | |
8677 | @subsection SH Options | |
8678 | ||
8679 | These @samp{-m} options are defined for the SH implementations: | |
8680 | ||
2642624b | 8681 | @table @gcctabopt |
74291a4b | 8682 | @item -m1 |
cd3bb277 | 8683 | @opindex m1 |
74291a4b MM |
8684 | Generate code for the SH1. |
8685 | ||
8686 | @item -m2 | |
cd3bb277 | 8687 | @opindex m2 |
74291a4b MM |
8688 | Generate code for the SH2. |
8689 | ||
8690 | @item -m3 | |
cd3bb277 | 8691 | @opindex m3 |
74291a4b MM |
8692 | Generate code for the SH3. |
8693 | ||
8694 | @item -m3e | |
cd3bb277 | 8695 | @opindex m3e |
74291a4b MM |
8696 | Generate code for the SH3e. |
8697 | ||
3cadd778 | 8698 | @item -m4-nofpu |
cd3bb277 | 8699 | @opindex m4-nofpu |
3cadd778 AO |
8700 | Generate code for the SH4 without a floating-point unit. |
8701 | ||
8702 | @item -m4-single-only | |
cd3bb277 | 8703 | @opindex m4-single-only |
3cadd778 | 8704 | Generate code for the SH4 with a floating-point unit that only |
c771326b | 8705 | supports single-precision arithmetic. |
3cadd778 AO |
8706 | |
8707 | @item -m4-single | |
cd3bb277 | 8708 | @opindex m4-single |
3cadd778 AO |
8709 | Generate code for the SH4 assuming the floating-point unit is in |
8710 | single-precision mode by default. | |
8711 | ||
8712 | @item -m4 | |
cd3bb277 | 8713 | @opindex m4 |
3cadd778 AO |
8714 | Generate code for the SH4. |
8715 | ||
74291a4b | 8716 | @item -mb |
cd3bb277 | 8717 | @opindex mb |
74291a4b MM |
8718 | Compile code for the processor in big endian mode. |
8719 | ||
8720 | @item -ml | |
cd3bb277 | 8721 | @opindex ml |
74291a4b MM |
8722 | Compile code for the processor in little endian mode. |
8723 | ||
3d5a0820 | 8724 | @item -mdalign |
cd3bb277 | 8725 | @opindex mdalign |
02f52e19 | 8726 | Align doubles at 64-bit boundaries. Note that this changes the calling |
3d5a0820 | 8727 | conventions, and thus some functions from the standard C library will |
695ac33f | 8728 | not work unless you recompile it first with @option{-mdalign}. |
3d5a0820 | 8729 | |
74291a4b | 8730 | @item -mrelax |
cd3bb277 | 8731 | @opindex mrelax |
74291a4b | 8732 | Shorten some address references at link time, when possible; uses the |
630d3d5a | 8733 | linker option @option{-relax}. |
3cadd778 AO |
8734 | |
8735 | @item -mbigtable | |
cd3bb277 | 8736 | @opindex mbigtable |
3cadd778 AO |
8737 | Use 32-bit offsets in @code{switch} tables. The default is to use |
8738 | 16-bit offsets. | |
8739 | ||
8740 | @item -mfmovd | |
cd3bb277 | 8741 | @opindex mfmovd |
3cadd778 AO |
8742 | Enable the use of the instruction @code{fmovd}. |
8743 | ||
8744 | @item -mhitachi | |
cd3bb277 | 8745 | @opindex mhitachi |
3cadd778 AO |
8746 | Comply with the calling conventions defined by Hitachi. |
8747 | ||
8748 | @item -mnomacsave | |
cd3bb277 | 8749 | @opindex mnomacsave |
3cadd778 | 8750 | Mark the @code{MAC} register as call-clobbered, even if |
bedc7537 | 8751 | @option{-mhitachi} is given. |
3cadd778 | 8752 | |
c474f76b AO |
8753 | @item -mieee |
8754 | @opindex mieee | |
8755 | Increase IEEE-compliance of floating-point code. | |
8756 | ||
3cadd778 | 8757 | @item -misize |
cd3bb277 | 8758 | @opindex misize |
3cadd778 AO |
8759 | Dump instruction size and location in the assembly code. |
8760 | ||
8761 | @item -mpadstruct | |
cd3bb277 | 8762 | @opindex mpadstruct |
3cadd778 | 8763 | This option is deprecated. It pads structures to multiple of 4 bytes, |
161d7b59 | 8764 | which is incompatible with the SH ABI@. |
3cadd778 AO |
8765 | |
8766 | @item -mspace | |
cd3bb277 | 8767 | @opindex mspace |
bedc7537 | 8768 | Optimize for space instead of speed. Implied by @option{-Os}. |
1a66cd67 AO |
8769 | |
8770 | @item -mprefergot | |
cd3bb277 | 8771 | @opindex mprefergot |
1a66cd67 AO |
8772 | When generating position-independent code, emit function calls using |
8773 | the Global Offset Table instead of the Procedure Linkage Table. | |
93ca1662 NY |
8774 | |
8775 | @item -musermode | |
cd3bb277 | 8776 | @opindex musermode |
93ca1662 NY |
8777 | Generate a library function call to invalidate instruction cache |
8778 | entries, after fixing up a trampoline. This library function call | |
8779 | doesn't assume it can write to the whole memory address space. This | |
8780 | is the default when the target is @code{sh-*-linux*}. | |
74291a4b MM |
8781 | @end table |
8782 | ||
8783 | @node System V Options | |
8784 | @subsection Options for System V | |
8785 | ||
8786 | These additional options are available on System V Release 4 for | |
8787 | compatibility with other compilers on those systems: | |
8788 | ||
2642624b | 8789 | @table @gcctabopt |
74291a4b | 8790 | @item -G |
cd3bb277 | 8791 | @opindex G |
74291a4b | 8792 | Create a shared object. |
630d3d5a | 8793 | It is recommended that @option{-symbolic} or @option{-shared} be used instead. |
74291a4b MM |
8794 | |
8795 | @item -Qy | |
cd3bb277 | 8796 | @opindex Qy |
74291a4b MM |
8797 | Identify the versions of each tool used by the compiler, in a |
8798 | @code{.ident} assembler directive in the output. | |
8799 | ||
8800 | @item -Qn | |
cd3bb277 | 8801 | @opindex Qn |
74291a4b MM |
8802 | Refrain from adding @code{.ident} directives to the output file (this is |
8803 | the default). | |
8804 | ||
aee96fe9 | 8805 | @item -YP,@var{dirs} |
cd3bb277 | 8806 | @opindex YP |
74291a4b | 8807 | Search the directories @var{dirs}, and no others, for libraries |
630d3d5a | 8808 | specified with @option{-l}. |
74291a4b | 8809 | |
aee96fe9 | 8810 | @item -Ym,@var{dir} |
cd3bb277 | 8811 | @opindex Ym |
bedc7537 | 8812 | Look in the directory @var{dir} to find the M4 preprocessor. |
74291a4b MM |
8813 | The assembler uses this option. |
8814 | @c This is supposed to go with a -Yd for predefined M4 macro files, but | |
8815 | @c the generic assembler that comes with Solaris takes just -Ym. | |
8816 | @end table | |
8817 | ||
282a61e6 MH |
8818 | @node TMS320C3x/C4x Options |
8819 | @subsection TMS320C3x/C4x Options | |
8820 | @cindex TMS320C3x/C4x Options | |
8821 | ||
8822 | These @samp{-m} options are defined for TMS320C3x/C4x implementations: | |
8823 | ||
2642624b | 8824 | @table @gcctabopt |
282a61e6 MH |
8825 | |
8826 | @item -mcpu=@var{cpu_type} | |
cd3bb277 | 8827 | @opindex mcpu |
282a61e6 MH |
8828 | Set the instruction set, register set, and instruction scheduling |
8829 | parameters for machine type @var{cpu_type}. Supported values for | |
8830 | @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and | |
8831 | @samp{c44}. The default is @samp{c40} to generate code for the | |
8832 | TMS320C40. | |
8833 | ||
8834 | @item -mbig-memory | |
8835 | @item -mbig | |
8836 | @itemx -msmall-memory | |
8837 | @itemx -msmall | |
cd3bb277 JM |
8838 | @opindex mbig-memory |
8839 | @opindex mbig | |
8840 | @opindex msmall-memory | |
8841 | @opindex msmall | |
282a61e6 MH |
8842 | Generates code for the big or small memory model. The small memory |
8843 | model assumed that all data fits into one 64K word page. At run-time | |
8844 | the data page (DP) register must be set to point to the 64K page | |
8845 | containing the .bss and .data program sections. The big memory model is | |
8846 | the default and requires reloading of the DP register for every direct | |
8847 | memory access. | |
8848 | ||
8849 | @item -mbk | |
8850 | @itemx -mno-bk | |
cd3bb277 JM |
8851 | @opindex mbk |
8852 | @opindex mno-bk | |
282a61e6 | 8853 | Allow (disallow) allocation of general integer operands into the block |
161d7b59 | 8854 | count register BK@. |
282a61e6 MH |
8855 | |
8856 | @item -mdb | |
8857 | @itemx -mno-db | |
cd3bb277 JM |
8858 | @opindex mdb |
8859 | @opindex mno-db | |
282a61e6 MH |
8860 | Enable (disable) generation of code using decrement and branch, |
8861 | DBcond(D), instructions. This is enabled by default for the C4x. To be | |
8862 | on the safe side, this is disabled for the C3x, since the maximum | |
aee96fe9 JM |
8863 | iteration count on the C3x is @math{2^23 + 1} (but who iterates loops more than |
8864 | @math{2^23} times on the C3x?). Note that GCC will try to reverse a loop so | |
282a61e6 MH |
8865 | that it can utilise the decrement and branch instruction, but will give |
8866 | up if there is more than one memory reference in the loop. Thus a loop | |
8867 | where the loop counter is decremented can generate slightly more | |
8868 | efficient code, in cases where the RPTB instruction cannot be utilised. | |
8869 | ||
8870 | @item -mdp-isr-reload | |
8871 | @itemx -mparanoid | |
cd3bb277 JM |
8872 | @opindex mdp-isr-reload |
8873 | @opindex mparanoid | |
282a61e6 MH |
8874 | Force the DP register to be saved on entry to an interrupt service |
8875 | routine (ISR), reloaded to point to the data section, and restored on | |
161d7b59 | 8876 | exit from the ISR@. This should not be required unless someone has |
282a61e6 MH |
8877 | violated the small memory model by modifying the DP register, say within |
8878 | an object library. | |
8879 | ||
8880 | @item -mmpyi | |
8881 | @itemx -mno-mpyi | |
cd3bb277 JM |
8882 | @opindex mmpyi |
8883 | @opindex mno-mpyi | |
282a61e6 MH |
8884 | For the C3x use the 24-bit MPYI instruction for integer multiplies |
8885 | instead of a library call to guarantee 32-bit results. Note that if one | |
8886 | of the operands is a constant, then the multiplication will be performed | |
695ac33f | 8887 | using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x, |
282a61e6 MH |
8888 | then squaring operations are performed inline instead of a library call. |
8889 | ||
8890 | @item -mfast-fix | |
8891 | @itemx -mno-fast-fix | |
cd3bb277 JM |
8892 | @opindex mfast-fix |
8893 | @opindex mno-fast-fix | |
282a61e6 MH |
8894 | The C3x/C4x FIX instruction to convert a floating point value to an |
8895 | integer value chooses the nearest integer less than or equal to the | |
8896 | floating point value rather than to the nearest integer. Thus if the | |
8897 | floating point number is negative, the result will be incorrectly | |
8898 | truncated an additional code is necessary to detect and correct this | |
8899 | case. This option can be used to disable generation of the additional | |
8900 | code required to correct the result. | |
8901 | ||
8902 | @item -mrptb | |
8903 | @itemx -mno-rptb | |
cd3bb277 JM |
8904 | @opindex mrptb |
8905 | @opindex mno-rptb | |
282a61e6 MH |
8906 | Enable (disable) generation of repeat block sequences using the RPTB |
8907 | instruction for zero overhead looping. The RPTB construct is only used | |
8908 | for innermost loops that do not call functions or jump across the loop | |
8909 | boundaries. There is no advantage having nested RPTB loops due to the | |
8910 | overhead required to save and restore the RC, RS, and RE registers. | |
695ac33f | 8911 | This is enabled by default with @option{-O2}. |
282a61e6 MH |
8912 | |
8913 | @item -mrpts=@var{count} | |
8914 | @itemx -mno-rpts | |
cd3bb277 JM |
8915 | @opindex mrpts |
8916 | @opindex mno-rpts | |
282a61e6 | 8917 | Enable (disable) the use of the single instruction repeat instruction |
161d7b59 | 8918 | RPTS@. If a repeat block contains a single instruction, and the loop |
282a61e6 | 8919 | count can be guaranteed to be less than the value @var{count}, GCC will |
161d7b59 | 8920 | emit a RPTS instruction instead of a RPTB@. If no value is specified, |
282a61e6 MH |
8921 | then a RPTS will be emitted even if the loop count cannot be determined |
8922 | at compile time. Note that the repeated instruction following RPTS does | |
8923 | not have to be reloaded from memory each iteration, thus freeing up the | |
b192711e | 8924 | CPU buses for operands. However, since interrupts are blocked by this |
282a61e6 MH |
8925 | instruction, it is disabled by default. |
8926 | ||
8927 | @item -mloop-unsigned | |
8928 | @itemx -mno-loop-unsigned | |
cd3bb277 JM |
8929 | @opindex mloop-unsigned |
8930 | @opindex mno-loop-unsigned | |
282a61e6 | 8931 | The maximum iteration count when using RPTS and RPTB (and DB on the C40) |
aee96fe9 | 8932 | is @math{2^31 + 1} since these instructions test if the iteration count is |
282a61e6 | 8933 | negative to terminate the loop. If the iteration count is unsigned |
aee96fe9 | 8934 | there is a possibility than the @math{2^31 + 1} maximum iteration count may be |
282a61e6 MH |
8935 | exceeded. This switch allows an unsigned iteration count. |
8936 | ||
8937 | @item -mti | |
cd3bb277 | 8938 | @opindex mti |
282a61e6 MH |
8939 | Try to emit an assembler syntax that the TI assembler (asm30) is happy |
8940 | with. This also enforces compatibility with the API employed by the TI | |
8941 | C3x C compiler. For example, long doubles are passed as structures | |
8942 | rather than in floating point registers. | |
8943 | ||
8944 | @item -mregparm | |
8945 | @itemx -mmemparm | |
cd3bb277 JM |
8946 | @opindex mregparm |
8947 | @opindex mmemparm | |
282a61e6 MH |
8948 | Generate code that uses registers (stack) for passing arguments to functions. |
8949 | By default, arguments are passed in registers where possible rather | |
8950 | than by pushing arguments on to the stack. | |
8951 | ||
8952 | @item -mparallel-insns | |
8953 | @itemx -mno-parallel-insns | |
cd3bb277 JM |
8954 | @opindex mparallel-insns |
8955 | @opindex mno-parallel-insns | |
282a61e6 | 8956 | Allow the generation of parallel instructions. This is enabled by |
695ac33f | 8957 | default with @option{-O2}. |
282a61e6 MH |
8958 | |
8959 | @item -mparallel-mpy | |
8960 | @itemx -mno-parallel-mpy | |
cd3bb277 JM |
8961 | @opindex mparallel-mpy |
8962 | @opindex mno-parallel-mpy | |
282a61e6 | 8963 | Allow the generation of MPY||ADD and MPY||SUB parallel instructions, |
695ac33f | 8964 | provided @option{-mparallel-insns} is also specified. These instructions have |
282a61e6 MH |
8965 | tight register constraints which can pessimize the code generation |
8966 | of large functions. | |
8967 | ||
8968 | @end table | |
8969 | ||
f84271d9 JL |
8970 | @node V850 Options |
8971 | @subsection V850 Options | |
8972 | @cindex V850 Options | |
8973 | ||
8974 | These @samp{-m} options are defined for V850 implementations: | |
8975 | ||
2642624b | 8976 | @table @gcctabopt |
f84271d9 JL |
8977 | @item -mlong-calls |
8978 | @itemx -mno-long-calls | |
cd3bb277 JM |
8979 | @opindex mlong-calls |
8980 | @opindex mno-long-calls | |
f84271d9 JL |
8981 | Treat all calls as being far away (near). If calls are assumed to be |
8982 | far away, the compiler will always load the functions address up into a | |
8983 | register, and call indirect through the pointer. | |
8984 | ||
8985 | @item -mno-ep | |
bd762873 | 8986 | @itemx -mep |
cd3bb277 JM |
8987 | @opindex mno-ep |
8988 | @opindex mep | |
f84271d9 JL |
8989 | Do not optimize (do optimize) basic blocks that use the same index |
8990 | pointer 4 or more times to copy pointer into the @code{ep} register, and | |
630d3d5a | 8991 | use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} |
f84271d9 JL |
8992 | option is on by default if you optimize. |
8993 | ||
8994 | @item -mno-prolog-function | |
8995 | @itemx -mprolog-function | |
cd3bb277 JM |
8996 | @opindex mno-prolog-function |
8997 | @opindex mprolog-function | |
f84271d9 JL |
8998 | Do not use (do use) external functions to save and restore registers at |
8999 | the prolog and epilog of a function. The external functions are slower, | |
9000 | but use less code space if more than one function saves the same number | |
630d3d5a | 9001 | of registers. The @option{-mprolog-function} option is on by default if |
f84271d9 JL |
9002 | you optimize. |
9003 | ||
9004 | @item -mspace | |
cd3bb277 | 9005 | @opindex mspace |
f84271d9 | 9006 | Try to make the code as small as possible. At present, this just turns |
630d3d5a | 9007 | on the @option{-mep} and @option{-mprolog-function} options. |
f84271d9 JL |
9008 | |
9009 | @item -mtda=@var{n} | |
cd3bb277 | 9010 | @opindex mtda |
f84271d9 JL |
9011 | Put static or global variables whose size is @var{n} bytes or less into |
9012 | the tiny data area that register @code{ep} points to. The tiny data | |
9013 | area can hold up to 256 bytes in total (128 bytes for byte references). | |
9014 | ||
9015 | @item -msda=@var{n} | |
cd3bb277 | 9016 | @opindex msda |
f84271d9 JL |
9017 | Put static or global variables whose size is @var{n} bytes or less into |
9018 | the small data area that register @code{gp} points to. The small data | |
9019 | area can hold up to 64 kilobytes. | |
9020 | ||
9021 | @item -mzda=@var{n} | |
cd3bb277 | 9022 | @opindex mzda |
f84271d9 JL |
9023 | Put static or global variables whose size is @var{n} bytes or less into |
9024 | the first 32 kilobytes of memory. | |
02f52e19 | 9025 | |
48f0be1b | 9026 | @item -mv850 |
cd3bb277 | 9027 | @opindex mv850 |
48f0be1b SC |
9028 | Specify that the target processor is the V850. |
9029 | ||
e9a25f70 | 9030 | @item -mbig-switch |
cd3bb277 | 9031 | @opindex mbig-switch |
e9a25f70 JL |
9032 | Generate code suitable for big switch tables. Use this option only if |
9033 | the assembler/linker complain about out of range branches within a switch | |
9034 | table. | |
f84271d9 JL |
9035 | @end table |
9036 | ||
56b2d7a7 JL |
9037 | @node ARC Options |
9038 | @subsection ARC Options | |
9039 | @cindex ARC Options | |
9040 | ||
9041 | These options are defined for ARC implementations: | |
9042 | ||
2642624b | 9043 | @table @gcctabopt |
56b2d7a7 | 9044 | @item -EL |
cd3bb277 | 9045 | @opindex EL |
56b2d7a7 JL |
9046 | Compile code for little endian mode. This is the default. |
9047 | ||
9048 | @item -EB | |
cd3bb277 | 9049 | @opindex EB |
56b2d7a7 JL |
9050 | Compile code for big endian mode. |
9051 | ||
9052 | @item -mmangle-cpu | |
cd3bb277 | 9053 | @opindex mmangle-cpu |
56b2d7a7 JL |
9054 | Prepend the name of the cpu to all public symbol names. |
9055 | In multiple-processor systems, there are many ARC variants with different | |
9056 | instruction and register set characteristics. This flag prevents code | |
9057 | compiled for one cpu to be linked with code compiled for another. | |
695ac33f | 9058 | No facility exists for handling variants that are ``almost identical''. |
56b2d7a7 JL |
9059 | This is an all or nothing option. |
9060 | ||
9061 | @item -mcpu=@var{cpu} | |
cd3bb277 | 9062 | @opindex mcpu |
56b2d7a7 JL |
9063 | Compile code for ARC variant @var{cpu}. |
9064 | Which variants are supported depend on the configuration. | |
630d3d5a | 9065 | All variants support @option{-mcpu=base}, this is the default. |
56b2d7a7 | 9066 | |
630d3d5a JM |
9067 | @item -mtext=@var{text-section} |
9068 | @itemx -mdata=@var{data-section} | |
9069 | @itemx -mrodata=@var{readonly-data-section} | |
cd3bb277 JM |
9070 | @opindex mtext |
9071 | @opindex mdata | |
9072 | @opindex mrodata | |
630d3d5a JM |
9073 | Put functions, data, and readonly data in @var{text-section}, |
9074 | @var{data-section}, and @var{readonly-data-section} respectively | |
56b2d7a7 | 9075 | by default. This can be overridden with the @code{section} attribute. |
0b433de6 | 9076 | @xref{Variable Attributes}. |
56b2d7a7 JL |
9077 | |
9078 | @end table | |
9079 | ||
83575957 ID |
9080 | @node NS32K Options |
9081 | @subsection NS32K Options | |
9082 | @cindex NS32K options | |
9083 | ||
9084 | These are the @samp{-m} options defined for the 32000 series. The default | |
9085 | values for these options depends on which style of 32000 was selected when | |
9086 | the compiler was configured; the defaults for the most common choices are | |
9087 | given below. | |
9088 | ||
2642624b | 9089 | @table @gcctabopt |
83575957 ID |
9090 | @item -m32032 |
9091 | @itemx -m32032 | |
cd3bb277 JM |
9092 | @opindex m32032 |
9093 | @opindex m32032 | |
83575957 ID |
9094 | Generate output for a 32032. This is the default |
9095 | when the compiler is configured for 32032 and 32016 based systems. | |
9096 | ||
9097 | @item -m32332 | |
9098 | @itemx -m32332 | |
cd3bb277 JM |
9099 | @opindex m32332 |
9100 | @opindex m32332 | |
83575957 ID |
9101 | Generate output for a 32332. This is the default |
9102 | when the compiler is configured for 32332-based systems. | |
9103 | ||
9104 | @item -m32532 | |
9105 | @itemx -m32532 | |
cd3bb277 JM |
9106 | @opindex m32532 |
9107 | @opindex m32532 | |
83575957 ID |
9108 | Generate output for a 32532. This is the default |
9109 | when the compiler is configured for 32532-based systems. | |
9110 | ||
9111 | @item -m32081 | |
cd3bb277 | 9112 | @opindex m32081 |
83575957 ID |
9113 | Generate output containing 32081 instructions for floating point. |
9114 | This is the default for all systems. | |
9115 | ||
9116 | @item -m32381 | |
cd3bb277 | 9117 | @opindex m32381 |
83575957 | 9118 | Generate output containing 32381 instructions for floating point. This |
767094dd JM |
9119 | also implies @option{-m32081}. The 32381 is only compatible with the 32332 |
9120 | and 32532 cpus. This is the default for the pc532-netbsd configuration. | |
83575957 ID |
9121 | |
9122 | @item -mmulti-add | |
cd3bb277 | 9123 | @opindex mmulti-add |
83575957 | 9124 | Try and generate multiply-add floating point instructions @code{polyF} |
767094dd | 9125 | and @code{dotF}. This option is only available if the @option{-m32381} |
14976c58 | 9126 | option is in effect. Using these instructions requires changes to |
83575957 ID |
9127 | register allocation which generally has a negative impact on |
9128 | performance. This option should only be enabled when compiling code | |
9129 | particularly likely to make heavy use of multiply-add instructions. | |
9130 | ||
9131 | @item -mnomulti-add | |
cd3bb277 | 9132 | @opindex mnomulti-add |
83575957 | 9133 | Do not try and generate multiply-add floating point instructions |
767094dd | 9134 | @code{polyF} and @code{dotF}. This is the default on all platforms. |
83575957 ID |
9135 | |
9136 | @item -msoft-float | |
cd3bb277 | 9137 | @opindex msoft-float |
83575957 ID |
9138 | Generate output containing library calls for floating point. |
9139 | @strong{Warning:} the requisite libraries may not be available. | |
9140 | ||
9141 | @item -mnobitfield | |
cd3bb277 | 9142 | @opindex mnobitfield |
767094dd JM |
9143 | Do not use the bit-field instructions. On some machines it is faster to |
9144 | use shifting and masking operations. This is the default for the pc532. | |
83575957 ID |
9145 | |
9146 | @item -mbitfield | |
cd3bb277 | 9147 | @opindex mbitfield |
767094dd | 9148 | Do use the bit-field instructions. This is the default for all platforms |
83575957 ID |
9149 | except the pc532. |
9150 | ||
9151 | @item -mrtd | |
cd3bb277 | 9152 | @opindex mrtd |
83575957 ID |
9153 | Use a different function-calling convention, in which functions |
9154 | that take a fixed number of arguments return pop their | |
9155 | arguments on return with the @code{ret} instruction. | |
9156 | ||
9157 | This calling convention is incompatible with the one normally | |
9158 | used on Unix, so you cannot use it if you need to call libraries | |
9159 | compiled with the Unix compiler. | |
9160 | ||
9161 | Also, you must provide function prototypes for all functions that | |
9162 | take variable numbers of arguments (including @code{printf}); | |
9163 | otherwise incorrect code will be generated for calls to those | |
9164 | functions. | |
9165 | ||
9166 | In addition, seriously incorrect code will result if you call a | |
9167 | function with too many arguments. (Normally, extra arguments are | |
9168 | harmlessly ignored.) | |
9169 | ||
9170 | This option takes its name from the 680x0 @code{rtd} instruction. | |
9171 | ||
9172 | ||
9173 | @item -mregparam | |
cd3bb277 | 9174 | @opindex mregparam |
83575957 ID |
9175 | Use a different function-calling convention where the first two arguments |
9176 | are passed in registers. | |
9177 | ||
9178 | This calling convention is incompatible with the one normally | |
9179 | used on Unix, so you cannot use it if you need to call libraries | |
9180 | compiled with the Unix compiler. | |
9181 | ||
9182 | @item -mnoregparam | |
cd3bb277 | 9183 | @opindex mnoregparam |
767094dd | 9184 | Do not pass any arguments in registers. This is the default for all |
83575957 ID |
9185 | targets. |
9186 | ||
9187 | @item -msb | |
cd3bb277 | 9188 | @opindex msb |
83575957 | 9189 | It is OK to use the sb as an index register which is always loaded with |
767094dd | 9190 | zero. This is the default for the pc532-netbsd target. |
83575957 ID |
9191 | |
9192 | @item -mnosb | |
cd3bb277 | 9193 | @opindex mnosb |
83575957 | 9194 | The sb register is not available for use or has not been initialized to |
767094dd JM |
9195 | zero by the run time system. This is the default for all targets except |
9196 | the pc532-netbsd. It is also implied whenever @option{-mhimem} or | |
630d3d5a | 9197 | @option{-fpic} is set. |
83575957 ID |
9198 | |
9199 | @item -mhimem | |
cd3bb277 | 9200 | @opindex mhimem |
161d7b59 | 9201 | Many ns32000 series addressing modes use displacements of up to 512MB@. |
83575957 | 9202 | If an address is above 512MB then displacements from zero can not be used. |
161d7b59 | 9203 | This option causes code to be generated which can be loaded above 512MB@. |
83575957 ID |
9204 | This may be useful for operating systems or ROM code. |
9205 | ||
9206 | @item -mnohimem | |
cd3bb277 | 9207 | @opindex mnohimem |
83575957 ID |
9208 | Assume code will be loaded in the first 512MB of virtual address space. |
9209 | This is the default for all platforms. | |
9210 | ||
9211 | ||
9212 | @end table | |
9213 | ||
052a4b28 DC |
9214 | @node AVR Options |
9215 | @subsection AVR Options | |
9216 | @cindex AVR Options | |
9217 | ||
9218 | These options are defined for AVR implementations: | |
9219 | ||
2642624b | 9220 | @table @gcctabopt |
052a4b28 | 9221 | @item -mmcu=@var{mcu} |
cd3bb277 | 9222 | @opindex mmcu |
3a69a7d5 MM |
9223 | Specify ATMEL AVR instruction set or MCU type. |
9224 | ||
9225 | Instruction set avr1 is for the minimal AVR core, not supported by the C | |
9226 | compiler, only for assembler programs (MCU types: at90s1200, attiny10, | |
9227 | attiny11, attiny12, attiny15, attiny28). | |
9228 | ||
9229 | Instruction set avr2 (default) is for the classic AVR core with up to | |
9230 | 8K program memory space (MCU types: at90s2313, at90s2323, attiny22, | |
9231 | at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, | |
9232 | at90c8534, at90s8535). | |
9233 | ||
9234 | Instruction set avr3 is for the classic AVR core with up to 128K program | |
9235 | memory space (MCU types: atmega103, atmega603). | |
9236 | ||
9237 | Instruction set avr4 is for the enhanced AVR core with up to 8K program | |
9238 | memory space (MCU types: atmega83, atmega85). | |
9239 | ||
9240 | Instruction set avr5 is for the enhanced AVR core with up to 128K program | |
9241 | memory space (MCU types: atmega161, atmega163, atmega32, at94k). | |
052a4b28 DC |
9242 | |
9243 | @item -msize | |
cd3bb277 | 9244 | @opindex msize |
3a69a7d5 | 9245 | Output instruction sizes to the asm file. |
052a4b28 DC |
9246 | |
9247 | @item -minit-stack=@var{N} | |
cd3bb277 | 9248 | @opindex minit-stack |
3a69a7d5 | 9249 | Specify the initial stack address, which may be a symbol or numeric value, |
aee96fe9 | 9250 | @samp{__stack} is the default. |
052a4b28 DC |
9251 | |
9252 | @item -mno-interrupts | |
cd3bb277 | 9253 | @opindex mno-interrupts |
052a4b28 DC |
9254 | Generated code is not compatible with hardware interrupts. |
9255 | Code size will be smaller. | |
9256 | ||
9257 | @item -mcall-prologues | |
cd3bb277 | 9258 | @opindex mcall-prologues |
052a4b28 | 9259 | Functions prologues/epilogues expanded as call to appropriate |
767094dd | 9260 | subroutines. Code size will be smaller. |
3a69a7d5 MM |
9261 | |
9262 | @item -mno-tablejump | |
cd3bb277 | 9263 | @opindex mno-tablejump |
3a69a7d5 MM |
9264 | Do not generate tablejump insns which sometimes increase code size. |
9265 | ||
9266 | @item -mtiny-stack | |
cd3bb277 | 9267 | @opindex mtiny-stack |
3a69a7d5 | 9268 | Change only the low 8 bits of the stack pointer. |
052a4b28 DC |
9269 | @end table |
9270 | ||
789a3090 NC |
9271 | @node MCore Options |
9272 | @subsection MCore Options | |
9273 | @cindex MCore options | |
9274 | ||
9275 | These are the @samp{-m} options defined for the Motorola M*Core | |
02f52e19 | 9276 | processors. |
789a3090 | 9277 | |
2642624b | 9278 | @table @gcctabopt |
789a3090 NC |
9279 | |
9280 | @item -mhardlit | |
9281 | @itemx -mhardlit | |
9282 | @itemx -mno-hardlit | |
cd3bb277 JM |
9283 | @opindex mhardlit |
9284 | @opindex mhardlit | |
9285 | @opindex mno-hardlit | |
789a3090 NC |
9286 | Inline constants into the code stream if it can be done in two |
9287 | instructions or less. | |
9288 | ||
9289 | @item -mdiv | |
9290 | @itemx -mdiv | |
9291 | @itemx -mno-div | |
cd3bb277 JM |
9292 | @opindex mdiv |
9293 | @opindex mdiv | |
9294 | @opindex mno-div | |
789a3090 NC |
9295 | Use the divide instruction. (Enabled by default). |
9296 | ||
9297 | @item -mrelax-immediate | |
9298 | @itemx -mrelax-immediate | |
9299 | @itemx -mno-relax-immediate | |
cd3bb277 JM |
9300 | @opindex mrelax-immediate |
9301 | @opindex mrelax-immediate | |
9302 | @opindex mno-relax-immediate | |
b192711e | 9303 | Allow arbitrary sized immediates in bit operations. |
789a3090 NC |
9304 | |
9305 | @item -mwide-bitfields | |
9306 | @itemx -mwide-bitfields | |
9307 | @itemx -mno-wide-bitfields | |
cd3bb277 JM |
9308 | @opindex mwide-bitfields |
9309 | @opindex mwide-bitfields | |
9310 | @opindex mno-wide-bitfields | |
c771326b | 9311 | Always treat bit-fields as int-sized. |
789a3090 NC |
9312 | |
9313 | @item -m4byte-functions | |
9314 | @itemx -m4byte-functions | |
9315 | @itemx -mno-4byte-functions | |
cd3bb277 JM |
9316 | @opindex m4byte-functions |
9317 | @opindex m4byte-functions | |
9318 | @opindex mno-4byte-functions | |
b192711e | 9319 | Force all functions to be aligned to a four byte boundary. |
789a3090 NC |
9320 | |
9321 | @item -mcallgraph-data | |
9322 | @itemx -mcallgraph-data | |
9323 | @itemx -mno-callgraph-data | |
cd3bb277 JM |
9324 | @opindex mcallgraph-data |
9325 | @opindex mcallgraph-data | |
9326 | @opindex mno-callgraph-data | |
789a3090 NC |
9327 | Emit callgraph information. |
9328 | ||
9329 | @item -mslow-bytes | |
9330 | @itemx -mslow-bytes | |
9331 | @itemx -mno-slow-bytes | |
cd3bb277 JM |
9332 | @opindex mslow-bytes |
9333 | @opindex mslow-bytes | |
9334 | @opindex mno-slow-bytes | |
789a3090 NC |
9335 | Prefer word access when reading byte quantities. |
9336 | ||
9337 | @item -mlittle-endian | |
9338 | @itemx -mlittle-endian | |
9339 | @itemx -mbig-endian | |
cd3bb277 JM |
9340 | @opindex mlittle-endian |
9341 | @opindex mlittle-endian | |
9342 | @opindex mbig-endian | |
b192711e | 9343 | Generate code for a little endian target. |
789a3090 NC |
9344 | |
9345 | @item -m210 | |
9346 | @itemx -m210 | |
9347 | @itemx -m340 | |
cd3bb277 JM |
9348 | @opindex m210 |
9349 | @opindex m210 | |
9350 | @opindex m340 | |
789a3090 | 9351 | Generate code for the 210 processor. |
789a3090 | 9352 | @end table |
83575957 | 9353 | |
df6194d4 JW |
9354 | @node IA-64 Options |
9355 | @subsection IA-64 Options | |
9356 | @cindex IA-64 Options | |
9357 | ||
9358 | These are the @samp{-m} options defined for the Intel IA-64 architecture. | |
9359 | ||
9360 | @table @gcctabopt | |
9361 | @item -mbig-endian | |
cd3bb277 | 9362 | @opindex mbig-endian |
161d7b59 | 9363 | Generate code for a big endian target. This is the default for HPUX@. |
df6194d4 JW |
9364 | |
9365 | @item -mlittle-endian | |
cd3bb277 | 9366 | @opindex mlittle-endian |
df6194d4 JW |
9367 | Generate code for a little endian target. This is the default for AIX5 |
9368 | and Linux. | |
9369 | ||
9370 | @item -mgnu-as | |
9371 | @itemx -mno-gnu-as | |
cd3bb277 JM |
9372 | @opindex mgnu-as |
9373 | @opindex mno-gnu-as | |
15d3a111 | 9374 | Generate (or don't) code for the GNU assembler. This is the default. |
630d3d5a | 9375 | @c Also, this is the default if the configure option @option{--with-gnu-as} |
15d3a111 | 9376 | @c is used. |
df6194d4 JW |
9377 | |
9378 | @item -mgnu-ld | |
9379 | @itemx -mno-gnu-ld | |
cd3bb277 JM |
9380 | @opindex mgnu-ld |
9381 | @opindex mno-gnu-ld | |
15d3a111 | 9382 | Generate (or don't) code for the GNU linker. This is the default. |
630d3d5a | 9383 | @c Also, this is the default if the configure option @option{--with-gnu-ld} |
15d3a111 | 9384 | @c is used. |
df6194d4 JW |
9385 | |
9386 | @item -mno-pic | |
cd3bb277 | 9387 | @opindex mno-pic |
15d3a111 | 9388 | Generate code that does not use a global pointer register. The result |
161d7b59 | 9389 | is not position independent code, and violates the IA-64 ABI@. |
df6194d4 JW |
9390 | |
9391 | @item -mvolatile-asm-stop | |
9392 | @itemx -mno-volatile-asm-stop | |
cd3bb277 JM |
9393 | @opindex mvolatile-asm-stop |
9394 | @opindex mno-volatile-asm-stop | |
15d3a111 JW |
9395 | Generate (or don't) a stop bit immediately before and after volatile asm |
9396 | statements. | |
df6194d4 JW |
9397 | |
9398 | @item -mb-step | |
cd3bb277 | 9399 | @opindex mb-step |
df6194d4 JW |
9400 | Generate code that works around Itanium B step errata. |
9401 | ||
9402 | @item -mregister-names | |
9403 | @itemx -mno-register-names | |
cd3bb277 JM |
9404 | @opindex mregister-names |
9405 | @opindex mno-register-names | |
15d3a111 JW |
9406 | Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for |
9407 | the stacked registers. This may make assembler output more readable. | |
df6194d4 JW |
9408 | |
9409 | @item -mno-sdata | |
9410 | @itemx -msdata | |
cd3bb277 JM |
9411 | @opindex mno-sdata |
9412 | @opindex msdata | |
15d3a111 JW |
9413 | Disable (or enable) optimizations that use the small data section. This may |
9414 | be useful for working around optimizer bugs. | |
df6194d4 JW |
9415 | |
9416 | @item -mconstant-gp | |
cd3bb277 | 9417 | @opindex mconstant-gp |
df6194d4 JW |
9418 | Generate code that uses a single constant global pointer value. This is |
9419 | useful when compiling kernel code. | |
9420 | ||
9421 | @item -mauto-pic | |
cd3bb277 | 9422 | @opindex mauto-pic |
630d3d5a | 9423 | Generate code that is self-relocatable. This implies @option{-mconstant-gp}. |
df6194d4 JW |
9424 | This is useful when compiling firmware code. |
9425 | ||
9426 | @item -minline-divide-min-latency | |
cd3bb277 | 9427 | @opindex minline-divide-min-latency |
df6194d4 JW |
9428 | Generate code for inline divides using the minimum latency algorithm. |
9429 | ||
9430 | @item -minline-divide-max-throughput | |
cd3bb277 | 9431 | @opindex minline-divide-max-throughput |
df6194d4 JW |
9432 | Generate code for inline divides using the maximum throughput algorithm. |
9433 | ||
9434 | @item -mno-dwarf2-asm | |
9435 | @itemx -mdwarf2-asm | |
cd3bb277 JM |
9436 | @opindex mno-dwarf2-asm |
9437 | @opindex mdwarf2-asm | |
15d3a111 JW |
9438 | Don't (or do) generate assembler code for the DWARF2 line number debugging |
9439 | info. This may be useful when not using the GNU assembler. | |
df6194d4 | 9440 | |
630d3d5a | 9441 | @item -mfixed-range=@var{register-range} |
cd3bb277 | 9442 | @opindex mfixed-range |
df6194d4 JW |
9443 | Generate code treating the given register range as fixed registers. |
9444 | A fixed register is one that the register allocator can not use. This is | |
9445 | useful when compiling kernel code. A register range is specified as | |
9446 | two registers separated by a dash. Multiple register ranges can be | |
9447 | specified separated by a comma. | |
9448 | @end table | |
9449 | ||
e8ad90e5 MM |
9450 | @node D30V Options |
9451 | @subsection D30V Options | |
9452 | @cindex D30V Options | |
9453 | ||
9454 | These @samp{-m} options are defined for D30V implementations: | |
9455 | ||
2642624b | 9456 | @table @gcctabopt |
e8ad90e5 | 9457 | @item -mextmem |
cd3bb277 | 9458 | @opindex mextmem |
e8ad90e5 MM |
9459 | Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings}, |
9460 | @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external | |
9461 | memory, which starts at location @code{0x80000000}. | |
9462 | ||
9463 | @item -mextmemory | |
cd3bb277 | 9464 | @opindex mextmemory |
630d3d5a | 9465 | Same as the @option{-mextmem} switch. |
e8ad90e5 MM |
9466 | |
9467 | @item -monchip | |
cd3bb277 | 9468 | @opindex monchip |
e8ad90e5 MM |
9469 | Link the @samp{.text} section into onchip text memory, which starts at |
9470 | location @code{0x0}. Also link @samp{.data}, @samp{.bss}, | |
9471 | @samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections | |
9472 | into onchip data memory, which starts at location @code{0x20000000}. | |
9473 | ||
9474 | @item -mno-asm-optimize | |
9475 | @itemx -masm-optimize | |
cd3bb277 JM |
9476 | @opindex mno-asm-optimize |
9477 | @opindex masm-optimize | |
630d3d5a JM |
9478 | Disable (enable) passing @option{-O} to the assembler when optimizing. |
9479 | The assembler uses the @option{-O} option to automatically parallelize | |
e8ad90e5 MM |
9480 | adjacent short instructions where possible. |
9481 | ||
9482 | @item -mbranch-cost=@var{n} | |
cd3bb277 | 9483 | @opindex mbranch-cost |
e8ad90e5 MM |
9484 | Increase the internal costs of branches to @var{n}. Higher costs means |
9485 | that the compiler will issue more instructions to avoid doing a branch. | |
9486 | The default is 2. | |
9487 | ||
9488 | @item -mcond-exec=@var{n} | |
cd3bb277 | 9489 | @opindex mcond-exec |
e8ad90e5 MM |
9490 | Specify the maximum number of conditionally executed instructions that |
9491 | replace a branch. The default is 4. | |
9492 | @end table | |
56b2d7a7 | 9493 | |
91abf72d HP |
9494 | @node S/390 and zSeries Options |
9495 | @subsection S/390 and zSeries Options | |
9496 | @cindex S/390 and zSeries Options | |
9497 | ||
9498 | These are the @samp{-m} options defined for the S/390 and zSeries architecture. | |
9499 | ||
9500 | @table @gcctabopt | |
9501 | @item -mhard-float | |
9502 | @itemx -msoft-float | |
9503 | @opindex mhard-float | |
9504 | @opindex msoft-float | |
9505 | Use (do not use) the hardware floating-point instructions and registers | |
9506 | for floating-point operations. When @option{-msoft-float} is specified, | |
9507 | functions in @file{libgcc.a} will be used to perform floating-point | |
9508 | operations. When @option{-mhard-float} is specified, the compiler | |
9509 | generates IEEE floating-point instructions. This is the default. | |
9510 | ||
9511 | @item -mbackchain | |
9512 | @itemx -mno-backchain | |
9513 | @opindex mbackchain | |
9514 | @opindex mno-backchain | |
9515 | Generate (or do not generate) code which maintains an explicit | |
9516 | backchain within the stack frame that points to the caller's frame. | |
9517 | This is currently needed to allow debugging. The default is to | |
9518 | generate the backchain. | |
9519 | ||
9520 | @item -msmall-exec | |
9521 | @itemx -mno-small-exec | |
9522 | @opindex msmall-exec | |
9523 | @opindex mno-small-exec | |
9524 | Generate (or do not generate) code using the @code{bras} instruction | |
9525 | to do subroutine calls. | |
9526 | This only works reliably if the total executable size does not | |
9527 | exceed 64k. The default is to use the @code{basr} instruction instead, | |
9528 | which does not have this limitation. | |
9529 | ||
9530 | @item -m64 | |
9531 | @itemx -m31 | |
9532 | @opindex m64 | |
9533 | @opindex m31 | |
9534 | When @option{-m31} is specified, generate code compliant to the | |
9535 | Linux for S/390 ABI@. When @option{-m64} is specified, generate | |
9536 | code compliant to the Linux for zSeries ABI@. This allows GCC in | |
9537 | particular to generate 64-bit instructions. For the @samp{s390} | |
9538 | targets, the default is @option{-m31}, while the @samp{s390x} | |
9539 | targets default to @option{-m64}. | |
9540 | ||
9541 | @item -mmvcle | |
9542 | @itemx -mno-mvcle | |
9543 | @opindex mmvcle | |
9544 | @opindex mno-mvcle | |
9545 | Generate (or do not generate) code using the @code{mvcle} instruction | |
9546 | to perform block moves. When @option{-mno-mvcle} is specifed, | |
9547 | use a @code{mvc} loop instead. This is the default. | |
9548 | ||
9549 | @item -mdebug | |
9550 | @itemx -mno-debug | |
9551 | @opindex mdebug | |
9552 | @opindex mno-debug | |
9553 | Print (or do not print) additional debug information when compiling. | |
9554 | The default is to not print debug information. | |
9555 | ||
9556 | @end table | |
9557 | ||
0b85d816 HPN |
9558 | @node CRIS Options |
9559 | @subsection CRIS Options | |
9560 | @cindex CRIS Options | |
9561 | ||
9562 | These options are defined specifically for the CRIS ports. | |
9563 | ||
9564 | @table @gcctabopt | |
9565 | @item -march=@var{architecture-type} | |
9566 | @itemx -mcpu=@var{architecture-type} | |
9567 | @opindex march | |
9568 | @opindex mcpu | |
9569 | Generate code for the specified architecture. The choices for | |
9570 | @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for | |
9571 | respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX. | |
9572 | Default is @samp{v0} except for cris-axis-linux-gnu, where the default is | |
9573 | @samp{v10}. | |
9574 | ||
9575 | @item -mtune=@var{architecture-type} | |
9576 | @opindex mtune | |
9577 | Tune to @var{architecture-type} everything applicable about the generated | |
9578 | code, except for the ABI and the set of available instructions. The | |
9579 | choices for @var{architecture-type} are the same as for | |
9580 | @option{-march=@var{architecture-type}}. | |
9581 | ||
9582 | @item -mmax-stack-frame=@var{n} | |
9583 | @opindex mmax-stack-frame | |
9584 | Warn when the stack frame of a function exceeds @var{n} bytes. | |
9585 | ||
9586 | @item -melinux-stacksize=@var{n} | |
9587 | @opindex melinux-stacksize | |
9588 | Only available with the @samp{cris-axis-aout} target. Arranges for | |
9589 | indications in the program to the kernel loader that the stack of the | |
9590 | program should be set to @var{n} bytes. | |
9591 | ||
9592 | @item -metrax4 | |
9593 | @itemx -metrax100 | |
9594 | @opindex metrax4 | |
9595 | @opindex metrax100 | |
9596 | The options @option{-metrax4} and @option{-metrax100} are synonyms for | |
9597 | @option{-march=v3} and @option{-march=v8} respectively. | |
9598 | ||
9599 | @item -mpdebug | |
9600 | @opindex mpdebug | |
9601 | Enable CRIS-specific verbose debug-related information in the assembly | |
9602 | code. This option also has the effect to turn off the @samp{#NO_APP} | |
9603 | formatted-code indicator to the assembler at the beginning of the | |
9604 | assembly file. | |
9605 | ||
9606 | @item -mcc-init | |
9607 | @opindex mcc-init | |
9608 | Do not use condition-code results from previous instruction; always emit | |
9609 | compare and test instructions before use of condition codes. | |
9610 | ||
9611 | @item -mno-side-effects | |
9612 | @opindex mno-side-effects | |
9613 | Do not emit instructions with side-effects in addressing modes other than | |
9614 | post-increment. | |
9615 | ||
9616 | @item -mstack-align | |
9617 | @itemx -mno-stack-align | |
9618 | @itemx -mdata-align | |
9619 | @itemx -mno-data-align | |
9620 | @itemx -mconst-align | |
9621 | @itemx -mno-const-align | |
9622 | @opindex mstack-align | |
9623 | @opindex mno-stack-align | |
9624 | @opindex mdata-align | |
9625 | @opindex mno-data-align | |
9626 | @opindex mconst-align | |
9627 | @opindex mno-const-align | |
9628 | These options (no-options) arranges (eliminate arrangements) for the | |
9629 | stack-frame, individual data and constants to be aligned for the maximum | |
9630 | single data access size for the chosen CPU model. The default is to | |
9631 | arrange for 32-bit alignment. ABI details such as structure layout are | |
9632 | not affected by these options. | |
9633 | ||
9634 | @item -m32-bit | |
9635 | @itemx -m16-bit | |
9636 | @itemx -m8-bit | |
9637 | @opindex m32-bit | |
9638 | @opindex m16-bit | |
9639 | @opindex m8-bit | |
9640 | Similar to the stack- data- and const-align options above, these options | |
9641 | arrange for stack-frame, writable data and constants to all be 32-bit, | |
9642 | 16-bit or 8-bit aligned. The default is 32-bit alignment. | |
9643 | ||
9644 | @item -mno-prologue-epilogue | |
9645 | @itemx -mprologue-epilogue | |
9646 | @opindex mno-prologue-epilogue | |
9647 | @opindex mprologue-epilogue | |
9648 | With @option{-mno-prologue-epilogue}, the normal function prologue and | |
9649 | epilogue that sets up the stack-frame are omitted and no return | |
9650 | instructions or return sequences are generated in the code. Use this | |
9651 | option only together with visual inspection of the compiled code: no | |
9652 | warnings or errors are generated when call-saved registers must be saved, | |
9653 | or storage for local variable needs to be allocated. | |
9654 | ||
9655 | @item -mno-gotplt | |
9656 | @itemx -mgotplt | |
9657 | @opindex mno-gotplt | |
9658 | @opindex mgotplt | |
9659 | With @option{-fpic} and @option{-fPIC}, don't generate (do generate) | |
9660 | instruction sequences that load addresses for functions from the PLT part | |
9661 | of the GOT rather than (traditional on other architectures) calls to the | |
9662 | PLT. The default is @option{-mgotplt}. | |
9663 | ||
9664 | @item -maout | |
9665 | @opindex maout | |
9666 | Legacy no-op option only recognized with the cris-axis-aout target. | |
9667 | ||
9668 | @item -melf | |
9669 | @opindex melf | |
9670 | Legacy no-op option only recognized with the cris-axis-elf and | |
9671 | cris-axis-linux-gnu targets. | |
9672 | ||
9673 | @item -melinux | |
9674 | @opindex melinux | |
9675 | Only recognized with the cris-axis-aout target, where it selects a | |
9676 | GNU/linux-like multilib, include files and instruction set for | |
9677 | @option{-march=v8}. | |
9678 | ||
9679 | @item -mlinux | |
9680 | @opindex mlinux | |
9681 | Legacy no-op option only recognized with the cris-axis-linux-gnu target. | |
9682 | ||
9683 | @item -sim | |
9684 | @opindex sim | |
9685 | This option, recognized for the cris-axis-aout and cris-axis-elf arranges | |
9686 | to link with input-output functions from a simulator library. Code, | |
9687 | initialized data and zero-initialized data are allocated consecutively. | |
9688 | ||
9689 | @item -sim2 | |
9690 | @opindex sim2 | |
9691 | Like @option{-sim}, but pass linker options to locate initialized data at | |
9692 | 0x40000000 and zero-initialized data at 0x80000000. | |
9693 | @end table | |
9694 | ||
bcf684c7 HPN |
9695 | @node MMIX Options |
9696 | @subsection MMIX Options | |
9697 | @cindex MMIX Options | |
9698 | ||
9699 | These options are defined for the MMIX: | |
9700 | ||
9701 | @table @code | |
9702 | @item -mlibfuncs | |
9703 | @itemx -mno-libfuncs | |
9704 | Specify that intrinsic library functions are being compiled, passing all | |
9705 | values in registers, no matter the size. | |
9706 | ||
9707 | @item -mepsilon | |
9708 | @itemx -mno-epsilon | |
9709 | Generate floating-point comparison instructions that compare with respect | |
9710 | to the @code{rE} epsilon register. | |
9711 | ||
9712 | @item -mabi=mmixware | |
9713 | @itemx -mabi=gnu | |
9714 | Generate code that passes function parameters and return values that (in | |
9715 | the called function) are seen as registers @code{$0} and up, as opposed to | |
9716 | the GNU ABI which uses global registers @code{$231} and up. | |
9717 | ||
9718 | @item -mzero-extend | |
9719 | @item -mno-zero-extend | |
9720 | When reading data from memory in sizes shorter than 64 bits, use (do not | |
9721 | use) zero-extending load instructions by default, rather than | |
9722 | sign-extending ones. | |
9723 | ||
9724 | @item -mknuthdiv | |
9725 | @itemx -mno-knuthdiv | |
9726 | Make the result of a division yielding a remainder have the same sign as | |
9727 | the divisor. With the default, @option{-mno-knuthdiv}, the sign of the | |
7fba3293 HPN |
9728 | remainder follows the sign of the dividend. Both methods are |
9729 | arithmetically valid, the latter being almost exclusively used. | |
bcf684c7 HPN |
9730 | |
9731 | @item -mtoplevel-symbols | |
9732 | @itemx -mno-toplevel-symbols | |
7fba3293 | 9733 | Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly |
bcf684c7 HPN |
9734 | code can be used with the @code{PREFIX} assembly directive. |
9735 | ||
9736 | @item -melf | |
7fba3293 | 9737 | Generate an executable in the ELF format, rather than the default |
bcf684c7 HPN |
9738 | @samp{mmo} format used by the @command{mmix} simulator. |
9739 | @end table | |
9740 | ||
74291a4b MM |
9741 | @node Code Gen Options |
9742 | @section Options for Code Generation Conventions | |
9743 | @cindex code generation conventions | |
9744 | @cindex options, code generation | |
9745 | @cindex run-time options | |
9746 | ||
9747 | These machine-independent options control the interface conventions | |
9748 | used in code generation. | |
9749 | ||
9750 | Most of them have both positive and negative forms; the negative form | |
630d3d5a | 9751 | of @option{-ffoo} would be @option{-fno-foo}. In the table below, only |
74291a4b MM |
9752 | one of the forms is listed---the one which is not the default. You |
9753 | can figure out the other form by either removing @samp{no-} or adding | |
9754 | it. | |
9755 | ||
2642624b | 9756 | @table @gcctabopt |
956d6950 | 9757 | @item -fexceptions |
cd3bb277 | 9758 | @opindex fexceptions |
767094dd | 9759 | Enable exception handling. Generates extra code needed to propagate |
f0523f02 | 9760 | exceptions. For some targets, this implies GCC will generate frame |
c5c76735 JL |
9761 | unwind information for all functions, which can produce significant data |
9762 | size overhead, although it does not affect execution. If you do not | |
f0523f02 | 9763 | specify this option, GCC will enable it by default for languages like |
90ecce3e | 9764 | C++ which normally require exception handling, and disable it for |
c5c76735 JL |
9765 | languages like C that do not normally require it. However, you may need |
9766 | to enable this option when compiling C code that needs to interoperate | |
9767 | properly with exception handlers written in C++. You may also wish to | |
9768 | disable this option if you are compiling older C++ programs that don't | |
9769 | use exception handling. | |
956d6950 | 9770 | |
6cfc0341 RH |
9771 | @item -fnon-call-exceptions |
9772 | @opindex fnon-call-exceptions | |
9773 | Generate code that allows trapping instructions to throw exceptions. | |
9774 | Note that this requires platform-specific runtime support that does | |
9775 | not exist everywhere. Moreover, it only allows @emph{trapping} | |
e979f9e8 | 9776 | instructions to throw exceptions, i.e.@: memory references or floating |
6cfc0341 RH |
9777 | point instructions. It does not allow exceptions to be thrown from |
9778 | arbitrary signal handlers such as @code{SIGALRM}. | |
9779 | ||
14a774a9 | 9780 | @item -funwind-tables |
cd3bb277 | 9781 | @opindex funwind-tables |
bedc7537 | 9782 | Similar to @option{-fexceptions}, except that it will just generate any needed |
14a774a9 RK |
9783 | static data, but will not affect the generated code in any other way. |
9784 | You will normally not enable this option; instead, a language processor | |
9785 | that needs this handling would enable it on your behalf. | |
9786 | ||
b932f770 JH |
9787 | @item -fasynchronous-unwind-tables |
9788 | @opindex funwind-tables | |
9789 | Generate unwind table in dwarf2 format, if supported by target machine. The | |
9790 | table is exact at each instruction boundary, so it can be used for stack | |
9791 | unwinding from asynchronous events (such as debugger or garbage collector). | |
9792 | ||
74291a4b | 9793 | @item -fpcc-struct-return |
cd3bb277 | 9794 | @opindex fpcc-struct-return |
74291a4b MM |
9795 | Return ``short'' @code{struct} and @code{union} values in memory like |
9796 | longer ones, rather than in registers. This convention is less | |
9797 | efficient, but it has the advantage of allowing intercallability between | |
0c2d1a2a | 9798 | GCC-compiled files and files compiled with other compilers. |
74291a4b MM |
9799 | |
9800 | The precise convention for returning structures in memory depends | |
9801 | on the target configuration macros. | |
9802 | ||
9803 | Short structures and unions are those whose size and alignment match | |
9804 | that of some integer type. | |
9805 | ||
9806 | @item -freg-struct-return | |
cd3bb277 | 9807 | @opindex freg-struct-return |
9c34dbbf ZW |
9808 | Return @code{struct} and @code{union} values in registers when possible. |
9809 | This is more efficient for small structures than | |
9810 | @option{-fpcc-struct-return}. | |
74291a4b | 9811 | |
9c34dbbf | 9812 | If you specify neither @option{-fpcc-struct-return} nor |
630d3d5a | 9813 | @option{-freg-struct-return}, GCC defaults to whichever convention is |
0c2d1a2a | 9814 | standard for the target. If there is no standard convention, GCC |
9c34dbbf ZW |
9815 | defaults to @option{-fpcc-struct-return}, except on targets where GCC is |
9816 | the principal compiler. In those cases, we can choose the standard, and | |
9817 | we chose the more efficient register return alternative. | |
74291a4b MM |
9818 | |
9819 | @item -fshort-enums | |
cd3bb277 | 9820 | @opindex fshort-enums |
74291a4b MM |
9821 | Allocate to an @code{enum} type only as many bytes as it needs for the |
9822 | declared range of possible values. Specifically, the @code{enum} type | |
9823 | will be equivalent to the smallest integer type which has enough room. | |
9824 | ||
9825 | @item -fshort-double | |
cd3bb277 | 9826 | @opindex fshort-double |
74291a4b MM |
9827 | Use the same size for @code{double} as for @code{float}. |
9828 | ||
9829 | @item -fshared-data | |
cd3bb277 | 9830 | @opindex fshared-data |
74291a4b MM |
9831 | Requests that the data and non-@code{const} variables of this |
9832 | compilation be shared data rather than private data. The distinction | |
9833 | makes sense only on certain operating systems, where shared data is | |
9834 | shared between processes running the same program, while private data | |
9835 | exists in one copy per process. | |
9836 | ||
9837 | @item -fno-common | |
cd3bb277 | 9838 | @opindex fno-common |
90ecce3e | 9839 | In C, allocate even uninitialized global variables in the data section of the |
74291a4b MM |
9840 | object file, rather than generating them as common blocks. This has the |
9841 | effect that if the same variable is declared (without @code{extern}) in | |
9842 | two different compilations, you will get an error when you link them. | |
9843 | The only reason this might be useful is if you wish to verify that the | |
9844 | program will work on other systems which always work this way. | |
9845 | ||
9846 | @item -fno-ident | |
cd3bb277 | 9847 | @opindex fno-ident |
74291a4b MM |
9848 | Ignore the @samp{#ident} directive. |
9849 | ||
9850 | @item -fno-gnu-linker | |
cd3bb277 | 9851 | @opindex fno-gnu-linker |
74291a4b MM |
9852 | Do not output global initializations (such as C++ constructors and |
9853 | destructors) in the form used by the GNU linker (on systems where the GNU | |
9854 | linker is the standard method of handling them). Use this option when | |
9855 | you want to use a non-GNU linker, which also requires using the | |
bedc7537 NC |
9856 | @command{collect2} program to make sure the system linker includes |
9857 | constructors and destructors. (@command{collect2} is included in the GCC | |
9858 | distribution.) For systems which @emph{must} use @command{collect2}, the | |
9859 | compiler driver @command{gcc} is configured to do this automatically. | |
74291a4b MM |
9860 | |
9861 | @item -finhibit-size-directive | |
cd3bb277 | 9862 | @opindex finhibit-size-directive |
74291a4b MM |
9863 | Don't output a @code{.size} assembler directive, or anything else that |
9864 | would cause trouble if the function is split in the middle, and the | |
9865 | two halves are placed at locations far apart in memory. This option is | |
9866 | used when compiling @file{crtstuff.c}; you should not need to use it | |
9867 | for anything else. | |
9868 | ||
9869 | @item -fverbose-asm | |
cd3bb277 | 9870 | @opindex fverbose-asm |
74291a4b MM |
9871 | Put extra commentary information in the generated assembly code to |
9872 | make it more readable. This option is generally only of use to those | |
9873 | who actually need to read the generated assembly code (perhaps while | |
9874 | debugging the compiler itself). | |
9875 | ||
630d3d5a | 9876 | @option{-fno-verbose-asm}, the default, causes the |
74291a4b MM |
9877 | extra information to be omitted and is useful when comparing two assembler |
9878 | files. | |
9879 | ||
9880 | @item -fvolatile | |
cd3bb277 | 9881 | @opindex fvolatile |
74291a4b MM |
9882 | Consider all memory references through pointers to be volatile. |
9883 | ||
9884 | @item -fvolatile-global | |
cd3bb277 | 9885 | @opindex fvolatile-global |
74291a4b | 9886 | Consider all memory references to extern and global data items to |
0c2d1a2a | 9887 | be volatile. GCC does not consider static data items to be volatile |
ab87f8c8 JL |
9888 | because of this switch. |
9889 | ||
9890 | @item -fvolatile-static | |
cd3bb277 | 9891 | @opindex fvolatile-static |
ab87f8c8 | 9892 | Consider all memory references to static data to be volatile. |
74291a4b MM |
9893 | |
9894 | @item -fpic | |
cd3bb277 | 9895 | @opindex fpic |
74291a4b MM |
9896 | @cindex global offset table |
9897 | @cindex PIC | |
9898 | Generate position-independent code (PIC) suitable for use in a shared | |
9899 | library, if supported for the target machine. Such code accesses all | |
161d7b59 | 9900 | constant addresses through a global offset table (GOT)@. The dynamic |
861bb6c1 | 9901 | loader resolves the GOT entries when the program starts (the dynamic |
0c2d1a2a | 9902 | loader is not part of GCC; it is part of the operating system). If |
861bb6c1 JL |
9903 | the GOT size for the linked executable exceeds a machine-specific |
9904 | maximum size, you get an error message from the linker indicating that | |
630d3d5a | 9905 | @option{-fpic} does not work; in that case, recompile with @option{-fPIC} |
861bb6c1 JL |
9906 | instead. (These maximums are 16k on the m88k, 8k on the Sparc, and 32k |
9907 | on the m68k and RS/6000. The 386 has no such limit.) | |
74291a4b MM |
9908 | |
9909 | Position-independent code requires special support, and therefore works | |
0c2d1a2a | 9910 | only on certain machines. For the 386, GCC supports PIC for System V |
74291a4b MM |
9911 | but not for the Sun 386i. Code generated for the IBM RS/6000 is always |
9912 | position-independent. | |
9913 | ||
74291a4b | 9914 | @item -fPIC |
cd3bb277 | 9915 | @opindex fPIC |
74291a4b MM |
9916 | If supported for the target machine, emit position-independent code, |
9917 | suitable for dynamic linking and avoiding any limit on the size of the | |
9918 | global offset table. This option makes a difference on the m68k, m88k, | |
9919 | and the Sparc. | |
9920 | ||
9921 | Position-independent code requires special support, and therefore works | |
9922 | only on certain machines. | |
9923 | ||
9924 | @item -ffixed-@var{reg} | |
cd3bb277 | 9925 | @opindex ffixed |
74291a4b MM |
9926 | Treat the register named @var{reg} as a fixed register; generated code |
9927 | should never refer to it (except perhaps as a stack pointer, frame | |
9928 | pointer or in some other fixed role). | |
9929 | ||
9930 | @var{reg} must be the name of a register. The register names accepted | |
9931 | are machine-specific and are defined in the @code{REGISTER_NAMES} | |
9932 | macro in the machine description macro file. | |
9933 | ||
9934 | This flag does not have a negative form, because it specifies a | |
9935 | three-way choice. | |
9936 | ||
9937 | @item -fcall-used-@var{reg} | |
cd3bb277 | 9938 | @opindex fcall-used |
956d6950 | 9939 | Treat the register named @var{reg} as an allocable register that is |
74291a4b MM |
9940 | clobbered by function calls. It may be allocated for temporaries or |
9941 | variables that do not live across a call. Functions compiled this way | |
9942 | will not save and restore the register @var{reg}. | |
9943 | ||
cb2fdc84 GRK |
9944 | It is an error to used this flag with the frame pointer or stack pointer. |
9945 | Use of this flag for other registers that have fixed pervasive roles in | |
9946 | the machine's execution model will produce disastrous results. | |
74291a4b MM |
9947 | |
9948 | This flag does not have a negative form, because it specifies a | |
9949 | three-way choice. | |
9950 | ||
9951 | @item -fcall-saved-@var{reg} | |
cd3bb277 | 9952 | @opindex fcall-saved |
956d6950 | 9953 | Treat the register named @var{reg} as an allocable register saved by |
74291a4b MM |
9954 | functions. It may be allocated even for temporaries or variables that |
9955 | live across a call. Functions compiled this way will save and restore | |
9956 | the register @var{reg} if they use it. | |
9957 | ||
cb2fdc84 GRK |
9958 | It is an error to used this flag with the frame pointer or stack pointer. |
9959 | Use of this flag for other registers that have fixed pervasive roles in | |
9960 | the machine's execution model will produce disastrous results. | |
74291a4b MM |
9961 | |
9962 | A different sort of disaster will result from the use of this flag for | |
9963 | a register in which function values may be returned. | |
9964 | ||
9965 | This flag does not have a negative form, because it specifies a | |
9966 | three-way choice. | |
9967 | ||
9968 | @item -fpack-struct | |
cd3bb277 | 9969 | @opindex fpack-struct |
74291a4b MM |
9970 | Pack all structure members together without holes. Usually you would |
9971 | not want to use this option, since it makes the code suboptimal, and | |
9972 | the offsets of structure members won't agree with system libraries. | |
9973 | ||
07417085 | 9974 | @item -finstrument-functions |
cd3bb277 | 9975 | @opindex finstrument-functions |
07417085 KR |
9976 | Generate instrumentation calls for entry and exit to functions. Just |
9977 | after function entry and just before function exit, the following | |
9978 | profiling functions will be called with the address of the current | |
9979 | function and its call site. (On some platforms, | |
9980 | @code{__builtin_return_address} does not work beyond the current | |
9981 | function, so the call site information may not be available to the | |
9982 | profiling functions otherwise.) | |
9983 | ||
9984 | @example | |
310668e8 JM |
9985 | void __cyg_profile_func_enter (void *this_fn, |
9986 | void *call_site); | |
9987 | void __cyg_profile_func_exit (void *this_fn, | |
9988 | void *call_site); | |
07417085 KR |
9989 | @end example |
9990 | ||
9991 | The first argument is the address of the start of the current function, | |
9992 | which may be looked up exactly in the symbol table. | |
9993 | ||
9994 | This instrumentation is also done for functions expanded inline in other | |
9995 | functions. The profiling calls will indicate where, conceptually, the | |
9996 | inline function is entered and exited. This means that addressable | |
9997 | versions of such functions must be available. If all your uses of a | |
9998 | function are expanded inline, this may mean an additional expansion of | |
9999 | code size. If you use @samp{extern inline} in your C code, an | |
10000 | addressable version of such functions must be provided. (This is | |
10001 | normally the case anyways, but if you get lucky and the optimizer always | |
10002 | expands the functions inline, you might have gotten away without | |
10003 | providing static copies.) | |
10004 | ||
10005 | A function may be given the attribute @code{no_instrument_function}, in | |
10006 | which case this instrumentation will not be done. This can be used, for | |
10007 | example, for the profiling functions listed above, high-priority | |
10008 | interrupt routines, and any functions from which the profiling functions | |
10009 | cannot safely be called (perhaps signal handlers, if the profiling | |
10010 | routines generate output or allocate memory). | |
10011 | ||
861bb6c1 | 10012 | @item -fstack-check |
cd3bb277 | 10013 | @opindex fstack-check |
861bb6c1 JL |
10014 | Generate code to verify that you do not go beyond the boundary of the |
10015 | stack. You should specify this flag if you are running in an | |
10016 | environment with multiple threads, but only rarely need to specify it in | |
10017 | a single-threaded environment since stack overflow is automatically | |
10018 | detected on nearly all systems if there is only one stack. | |
10019 | ||
a157febd GK |
10020 | Note that this switch does not actually cause checking to be done; the |
10021 | operating system must do that. The switch causes generation of code | |
10022 | to ensure that the operating system sees the stack being extended. | |
10023 | ||
10024 | @item -fstack-limit-register=@var{reg} | |
10025 | @itemx -fstack-limit-symbol=@var{sym} | |
10026 | @itemx -fno-stack-limit | |
cd3bb277 JM |
10027 | @opindex fstack-limit-register |
10028 | @opindex fstack-limit-symbol | |
10029 | @opindex fno-stack-limit | |
a157febd GK |
10030 | Generate code to ensure that the stack does not grow beyond a certain value, |
10031 | either the value of a register or the address of a symbol. If the stack | |
10032 | would grow beyond the value, a signal is raised. For most targets, | |
10033 | the signal is raised before the stack overruns the boundary, so | |
10034 | it is possible to catch the signal without taking special precautions. | |
10035 | ||
9c34dbbf ZW |
10036 | For instance, if the stack starts at absolute address @samp{0x80000000} |
10037 | and grows downwards, you can use the flags | |
10038 | @option{-fstack-limit-symbol=__stack_limit} and | |
10039 | @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit | |
10040 | of 128KB@. Note that this may only work with the GNU linker. | |
a157febd | 10041 | |
e5eb27e5 JL |
10042 | @cindex aliasing of parameters |
10043 | @cindex parameters, aliased | |
10044 | @item -fargument-alias | |
04afd9d6 JL |
10045 | @itemx -fargument-noalias |
10046 | @itemx -fargument-noalias-global | |
cd3bb277 JM |
10047 | @opindex fargument-alias |
10048 | @opindex fargument-noalias | |
10049 | @opindex fargument-noalias-global | |
e5eb27e5 JL |
10050 | Specify the possible relationships among parameters and between |
10051 | parameters and global data. | |
10052 | ||
630d3d5a | 10053 | @option{-fargument-alias} specifies that arguments (parameters) may |
9c34dbbf | 10054 | alias each other and may alias global storage.@* |
630d3d5a | 10055 | @option{-fargument-noalias} specifies that arguments do not alias |
9c34dbbf | 10056 | each other, but may alias global storage.@* |
630d3d5a | 10057 | @option{-fargument-noalias-global} specifies that arguments do not |
e5eb27e5 JL |
10058 | alias each other and do not alias global storage. |
10059 | ||
10060 | Each language will automatically use whatever option is required by | |
10061 | the language standard. You should not need to use these options yourself. | |
19283265 RH |
10062 | |
10063 | @item -fleading-underscore | |
cd3bb277 | 10064 | @opindex fleading-underscore |
695ac33f | 10065 | This option and its counterpart, @option{-fno-leading-underscore}, forcibly |
19283265 RH |
10066 | change the way C symbols are represented in the object file. One use |
10067 | is to help link with legacy assembly code. | |
10068 | ||
10069 | Be warned that you should know what you are doing when invoking this | |
10070 | option, and that not all targets provide complete support for it. | |
74291a4b MM |
10071 | @end table |
10072 | ||
ee457005 JM |
10073 | @c man end |
10074 | ||
74291a4b | 10075 | @node Environment Variables |
0c2d1a2a | 10076 | @section Environment Variables Affecting GCC |
74291a4b MM |
10077 | @cindex environment variables |
10078 | ||
ee457005 JM |
10079 | @c man begin ENVIRONMENT |
10080 | ||
0c2d1a2a JB |
10081 | This section describes several environment variables that affect how GCC |
10082 | operates. Some of them work by specifying directories or prefixes to use | |
767094dd | 10083 | when searching for various kinds of files. Some are used to specify other |
46103ab4 | 10084 | aspects of the compilation environment. |
74291a4b | 10085 | |
74291a4b | 10086 | Note that you can also specify places to search using options such as |
630d3d5a | 10087 | @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These |
74291a4b | 10088 | take precedence over places specified using environment variables, which |
161d7b59 | 10089 | in turn take precedence over those specified by the configuration of GCC@. |
b11cc610 JM |
10090 | @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, |
10091 | GNU Compiler Collection (GCC) Internals}. | |
74291a4b | 10092 | |
bedc7537 | 10093 | @table @env |
ab87f8c8 JL |
10094 | @item LANG |
10095 | @itemx LC_CTYPE | |
10096 | @c @itemx LC_COLLATE | |
10097 | @itemx LC_MESSAGES | |
10098 | @c @itemx LC_MONETARY | |
10099 | @c @itemx LC_NUMERIC | |
10100 | @c @itemx LC_TIME | |
10101 | @itemx LC_ALL | |
10102 | @findex LANG | |
10103 | @findex LC_CTYPE | |
10104 | @c @findex LC_COLLATE | |
10105 | @findex LC_MESSAGES | |
10106 | @c @findex LC_MONETARY | |
10107 | @c @findex LC_NUMERIC | |
10108 | @c @findex LC_TIME | |
10109 | @findex LC_ALL | |
10110 | @cindex locale | |
0c2d1a2a JB |
10111 | These environment variables control the way that GCC uses |
10112 | localization information that allow GCC to work with different | |
10113 | national conventions. GCC inspects the locale categories | |
bedc7537 | 10114 | @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do |
ab87f8c8 JL |
10115 | so. These locale categories can be set to any value supported by your |
10116 | installation. A typical value is @samp{en_UK} for English in the United | |
10117 | Kingdom. | |
10118 | ||
bedc7537 | 10119 | The @env{LC_CTYPE} environment variable specifies character |
0c2d1a2a | 10120 | classification. GCC uses it to determine the character boundaries in |
ab87f8c8 JL |
10121 | a string; this is needed for some multibyte encodings that contain quote |
10122 | and escape characters that would otherwise be interpreted as a string | |
10123 | end or escape. | |
10124 | ||
bedc7537 | 10125 | The @env{LC_MESSAGES} environment variable specifies the language to |
ab87f8c8 JL |
10126 | use in diagnostic messages. |
10127 | ||
bedc7537 NC |
10128 | If the @env{LC_ALL} environment variable is set, it overrides the value |
10129 | of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} | |
10130 | and @env{LC_MESSAGES} default to the value of the @env{LANG} | |
0c2d1a2a | 10131 | environment variable. If none of these variables are set, GCC |
ab87f8c8 JL |
10132 | defaults to traditional C English behavior. |
10133 | ||
74291a4b MM |
10134 | @item TMPDIR |
10135 | @findex TMPDIR | |
bedc7537 | 10136 | If @env{TMPDIR} is set, it specifies the directory to use for temporary |
0c2d1a2a | 10137 | files. GCC uses temporary files to hold the output of one stage of |
74291a4b MM |
10138 | compilation which is to be used as input to the next stage: for example, |
10139 | the output of the preprocessor, which is the input to the compiler | |
10140 | proper. | |
10141 | ||
10142 | @item GCC_EXEC_PREFIX | |
10143 | @findex GCC_EXEC_PREFIX | |
bedc7537 | 10144 | If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the |
74291a4b MM |
10145 | names of the subprograms executed by the compiler. No slash is added |
10146 | when this prefix is combined with the name of a subprogram, but you can | |
10147 | specify a prefix that ends with a slash if you wish. | |
10148 | ||
f0523f02 | 10149 | If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out |
0deb20df TT |
10150 | an appropriate prefix to use based on the pathname it was invoked with. |
10151 | ||
0c2d1a2a | 10152 | If GCC cannot find the subprogram using the specified prefix, it |
74291a4b MM |
10153 | tries looking in the usual places for the subprogram. |
10154 | ||
bedc7537 | 10155 | The default value of @env{GCC_EXEC_PREFIX} is |
74291a4b MM |
10156 | @file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value |
10157 | of @code{prefix} when you ran the @file{configure} script. | |
10158 | ||
630d3d5a | 10159 | Other prefixes specified with @option{-B} take precedence over this prefix. |
74291a4b MM |
10160 | |
10161 | This prefix is also used for finding files such as @file{crt0.o} that are | |
10162 | used for linking. | |
10163 | ||
10164 | In addition, the prefix is used in an unusual way in finding the | |
10165 | directories to search for header files. For each of the standard | |
10166 | directories whose name normally begins with @samp{/usr/local/lib/gcc-lib} | |
bedc7537 | 10167 | (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries |
74291a4b | 10168 | replacing that beginning with the specified prefix to produce an |
630d3d5a | 10169 | alternate directory name. Thus, with @option{-Bfoo/}, GCC will search |
74291a4b MM |
10170 | @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}. |
10171 | These alternate directories are searched first; the standard directories | |
10172 | come next. | |
10173 | ||
10174 | @item COMPILER_PATH | |
10175 | @findex COMPILER_PATH | |
bedc7537 NC |
10176 | The value of @env{COMPILER_PATH} is a colon-separated list of |
10177 | directories, much like @env{PATH}. GCC tries the directories thus | |
74291a4b | 10178 | specified when searching for subprograms, if it can't find the |
bedc7537 | 10179 | subprograms using @env{GCC_EXEC_PREFIX}. |
74291a4b MM |
10180 | |
10181 | @item LIBRARY_PATH | |
10182 | @findex LIBRARY_PATH | |
bedc7537 NC |
10183 | The value of @env{LIBRARY_PATH} is a colon-separated list of |
10184 | directories, much like @env{PATH}. When configured as a native compiler, | |
0c2d1a2a | 10185 | GCC tries the directories thus specified when searching for special |
bedc7537 | 10186 | linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking |
0c2d1a2a | 10187 | using GCC also uses these directories when searching for ordinary |
630d3d5a JM |
10188 | libraries for the @option{-l} option (but directories specified with |
10189 | @option{-L} come first). | |
74291a4b MM |
10190 | |
10191 | @item C_INCLUDE_PATH | |
10192 | @itemx CPLUS_INCLUDE_PATH | |
10193 | @itemx OBJC_INCLUDE_PATH | |
10194 | @findex C_INCLUDE_PATH | |
10195 | @findex CPLUS_INCLUDE_PATH | |
10196 | @findex OBJC_INCLUDE_PATH | |
10197 | @c @itemx OBJCPLUS_INCLUDE_PATH | |
10198 | These environment variables pertain to particular languages. Each | |
10199 | variable's value is a colon-separated list of directories, much like | |
bedc7537 | 10200 | @env{PATH}. When GCC searches for header files, it tries the |
74291a4b | 10201 | directories listed in the variable for the language you are using, after |
630d3d5a | 10202 | the directories specified with @option{-I} but before the standard header |
74291a4b MM |
10203 | file directories. |
10204 | ||
10205 | @item DEPENDENCIES_OUTPUT | |
10206 | @findex DEPENDENCIES_OUTPUT | |
10207 | @cindex dependencies for make as output | |
10208 | If this variable is set, its value specifies how to output dependencies | |
10209 | for Make based on the header files processed by the compiler. This | |
630d3d5a | 10210 | output looks much like the output from the @option{-M} option |
74291a4b MM |
10211 | (@pxref{Preprocessor Options}), but it goes to a separate file, and is |
10212 | in addition to the usual results of compilation. | |
10213 | ||
bedc7537 | 10214 | The value of @env{DEPENDENCIES_OUTPUT} can be just a file name, in |
74291a4b MM |
10215 | which case the Make rules are written to that file, guessing the target |
10216 | name from the source file name. Or the value can have the form | |
10217 | @samp{@var{file} @var{target}}, in which case the rules are written to | |
10218 | file @var{file} using @var{target} as the target name. | |
56f48ce9 DB |
10219 | |
10220 | @item LANG | |
10221 | @findex LANG | |
10222 | @cindex locale definition | |
767094dd | 10223 | This variable is used to pass locale information to the compiler. One way in |
56f48ce9 DB |
10224 | which this information is used is to determine the character set to be used |
10225 | when character literals, string literals and comments are parsed in C and C++. | |
10226 | When the compiler is configured to allow multibyte characters, | |
bedc7537 | 10227 | the following values for @env{LANG} are recognized: |
56f48ce9 | 10228 | |
2642624b | 10229 | @table @samp |
56f48ce9 DB |
10230 | @item C-JIS |
10231 | Recognize JIS characters. | |
10232 | @item C-SJIS | |
10233 | Recognize SJIS characters. | |
10234 | @item C-EUCJP | |
10235 | Recognize EUCJP characters. | |
10236 | @end table | |
10237 | ||
bedc7537 | 10238 | If @env{LANG} is not defined, or if it has some other value, then the |
56f48ce9 DB |
10239 | compiler will use mblen and mbtowc as defined by the default locale to |
10240 | recognize and translate multibyte characters. | |
74291a4b MM |
10241 | @end table |
10242 | ||
9d86bffc JM |
10243 | @c man end |
10244 | ||
74291a4b MM |
10245 | @node Running Protoize |
10246 | @section Running Protoize | |
10247 | ||
161d7b59 | 10248 | The program @code{protoize} is an optional part of GCC@. You can use |
c1030c7c | 10249 | it to add prototypes to a program, thus converting the program to ISO |
74291a4b MM |
10250 | C in one respect. The companion program @code{unprotoize} does the |
10251 | reverse: it removes argument types from any prototypes that are found. | |
10252 | ||
10253 | When you run these programs, you must specify a set of source files as | |
10254 | command line arguments. The conversion programs start out by compiling | |
10255 | these files to see what functions they define. The information gathered | |
10256 | about a file @var{foo} is saved in a file named @file{@var{foo}.X}. | |
10257 | ||
10258 | After scanning comes actual conversion. The specified files are all | |
10259 | eligible to be converted; any files they include (whether sources or | |
10260 | just headers) are eligible as well. | |
10261 | ||
10262 | But not all the eligible files are converted. By default, | |
10263 | @code{protoize} and @code{unprotoize} convert only source and header | |
10264 | files in the current directory. You can specify additional directories | |
630d3d5a | 10265 | whose files should be converted with the @option{-d @var{directory}} |
74291a4b | 10266 | option. You can also specify particular files to exclude with the |
630d3d5a | 10267 | @option{-x @var{file}} option. A file is converted if it is eligible, its |
74291a4b MM |
10268 | directory name matches one of the specified directory names, and its |
10269 | name within the directory has not been excluded. | |
10270 | ||
10271 | Basic conversion with @code{protoize} consists of rewriting most | |
10272 | function definitions and function declarations to specify the types of | |
10273 | the arguments. The only ones not rewritten are those for varargs | |
10274 | functions. | |
10275 | ||
10276 | @code{protoize} optionally inserts prototype declarations at the | |
10277 | beginning of the source file, to make them available for any calls that | |
10278 | precede the function's definition. Or it can insert prototype | |
10279 | declarations with block scope in the blocks where undeclared functions | |
10280 | are called. | |
10281 | ||
10282 | Basic conversion with @code{unprotoize} consists of rewriting most | |
10283 | function declarations to remove any argument types, and rewriting | |
c1030c7c | 10284 | function definitions to the old-style pre-ISO form. |
74291a4b MM |
10285 | |
10286 | Both conversion programs print a warning for any function declaration or | |
10287 | definition that they can't convert. You can suppress these warnings | |
630d3d5a | 10288 | with @option{-q}. |
74291a4b MM |
10289 | |
10290 | The output from @code{protoize} or @code{unprotoize} replaces the | |
10291 | original source file. The original file is renamed to a name ending | |
02f52e19 | 10292 | with @samp{.save} (for DOS, the saved filename ends in @samp{.sav} |
a7db8bbb MK |
10293 | without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav} |
10294 | for DOS) file already exists, then the source file is simply discarded. | |
74291a4b | 10295 | |
0c2d1a2a | 10296 | @code{protoize} and @code{unprotoize} both depend on GCC itself to |
74291a4b | 10297 | scan the program and collect information about the functions it uses. |
0c2d1a2a | 10298 | So neither of these programs will work until GCC is installed. |
74291a4b MM |
10299 | |
10300 | Here is a table of the options you can use with @code{protoize} and | |
10301 | @code{unprotoize}. Each option works with both programs unless | |
10302 | otherwise stated. | |
10303 | ||
10304 | @table @code | |
10305 | @item -B @var{directory} | |
10306 | Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the | |
10307 | usual directory (normally @file{/usr/local/lib}). This file contains | |
10308 | prototype information about standard system functions. This option | |
10309 | applies only to @code{protoize}. | |
10310 | ||
10311 | @item -c @var{compilation-options} | |
10312 | Use @var{compilation-options} as the options when running @code{gcc} to | |
630d3d5a | 10313 | produce the @samp{.X} files. The special option @option{-aux-info} is |
74291a4b MM |
10314 | always passed in addition, to tell @code{gcc} to write a @samp{.X} file. |
10315 | ||
10316 | Note that the compilation options must be given as a single argument to | |
10317 | @code{protoize} or @code{unprotoize}. If you want to specify several | |
10318 | @code{gcc} options, you must quote the entire set of compilation options | |
10319 | to make them a single word in the shell. | |
10320 | ||
10321 | There are certain @code{gcc} arguments that you cannot use, because they | |
630d3d5a JM |
10322 | would produce the wrong kind of output. These include @option{-g}, |
10323 | @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in | |
74291a4b MM |
10324 | the @var{compilation-options}, they are ignored. |
10325 | ||
10326 | @item -C | |
a7db8bbb | 10327 | Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file |
02f52e19 | 10328 | systems) instead of @samp{.c}. This is convenient if you are converting |
ee77eda5 | 10329 | a C program to C++. This option applies only to @code{protoize}. |
74291a4b MM |
10330 | |
10331 | @item -g | |
10332 | Add explicit global declarations. This means inserting explicit | |
10333 | declarations at the beginning of each source file for each function | |
10334 | that is called in the file and was not declared. These declarations | |
10335 | precede the first function definition that contains a call to an | |
10336 | undeclared function. This option applies only to @code{protoize}. | |
10337 | ||
10338 | @item -i @var{string} | |
10339 | Indent old-style parameter declarations with the string @var{string}. | |
10340 | This option applies only to @code{protoize}. | |
10341 | ||
10342 | @code{unprotoize} converts prototyped function definitions to old-style | |
10343 | function definitions, where the arguments are declared between the | |
10344 | argument list and the initial @samp{@{}. By default, @code{unprotoize} | |
10345 | uses five spaces as the indentation. If you want to indent with just | |
630d3d5a | 10346 | one space instead, use @option{-i " "}. |
74291a4b MM |
10347 | |
10348 | @item -k | |
10349 | Keep the @samp{.X} files. Normally, they are deleted after conversion | |
10350 | is finished. | |
10351 | ||
10352 | @item -l | |
630d3d5a | 10353 | Add explicit local declarations. @code{protoize} with @option{-l} inserts |
74291a4b MM |
10354 | a prototype declaration for each function in each block which calls the |
10355 | function without any declaration. This option applies only to | |
10356 | @code{protoize}. | |
10357 | ||
10358 | @item -n | |
10359 | Make no real changes. This mode just prints information about the conversions | |
630d3d5a | 10360 | that would have been done without @option{-n}. |
74291a4b MM |
10361 | |
10362 | @item -N | |
10363 | Make no @samp{.save} files. The original files are simply deleted. | |
10364 | Use this option with caution. | |
10365 | ||
10366 | @item -p @var{program} | |
10367 | Use the program @var{program} as the compiler. Normally, the name | |
10368 | @file{gcc} is used. | |
10369 | ||
10370 | @item -q | |
10371 | Work quietly. Most warnings are suppressed. | |
10372 | ||
10373 | @item -v | |
630d3d5a | 10374 | Print the version number, just like @option{-v} for @code{gcc}. |
74291a4b MM |
10375 | @end table |
10376 | ||
10377 | If you need special compiler options to compile one of your program's | |
10378 | source files, then you should generate that file's @samp{.X} file | |
10379 | specially, by running @code{gcc} on that source file with the | |
630d3d5a | 10380 | appropriate options and the option @option{-aux-info}. Then run |
74291a4b MM |
10381 | @code{protoize} on the entire set of files. @code{protoize} will use |
10382 | the existing @samp{.X} file because it is newer than the source file. | |
10383 | For example: | |
10384 | ||
10385 | @example | |
b1018de6 | 10386 | gcc -Dfoo=bar file1.c -aux-info file1.X |
74291a4b MM |
10387 | protoize *.c |
10388 | @end example | |
10389 | ||
10390 | @noindent | |
10391 | You need to include the special files along with the rest in the | |
10392 | @code{protoize} command, even though their @samp{.X} files already | |
10393 | exist, because otherwise they won't get converted. | |
10394 | ||
10395 | @xref{Protoize Caveats}, for more information on how to use | |
10396 | @code{protoize} successfully. |