]>
Commit | Line | Data |
---|---|---|
d0a5eb32 | 1 | @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
4dd57c18 | 2 | @c 2000, 2001, 2002 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, | |
4dd57c18 | 9 | 1998, 1999, 2000, 2001, 2002 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 | |
24dbb440 GP |
56 | See the Info entry for @command{gcc}, or |
57 | @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}}, | |
58 | for contributors to GCC@. | |
2642624b | 59 | @c man end |
9d86bffc JM |
60 | @end ignore |
61 | ||
74291a4b | 62 | @node Invoking GCC |
0c2d1a2a JB |
63 | @chapter GCC Command Options |
64 | @cindex GCC command options | |
74291a4b | 65 | @cindex command options |
0c2d1a2a | 66 | @cindex options, GCC command |
74291a4b | 67 | |
9d86bffc JM |
68 | @c man begin DESCRIPTION |
69 | ||
0c2d1a2a | 70 | When you invoke GCC, it normally does preprocessing, compilation, |
74291a4b | 71 | assembly and linking. The ``overall options'' allow you to stop this |
630d3d5a | 72 | process at an intermediate stage. For example, the @option{-c} option |
74291a4b MM |
73 | says not to run the linker. Then the output consists of object files |
74 | output by the assembler. | |
75 | ||
76 | Other options are passed on to one stage of processing. Some options | |
77 | control the preprocessor and others the compiler itself. Yet other | |
78 | options control the assembler and linker; most of these are not | |
79 | documented here, since you rarely need to use any of them. | |
80 | ||
81 | @cindex C compilation options | |
0c2d1a2a | 82 | Most of the command line options that you can use with GCC are useful |
74291a4b MM |
83 | for C programs; when an option is only useful with another language |
84 | (usually C++), the explanation says so explicitly. If the description | |
85 | for a particular option does not mention a source language, you can use | |
86 | that option with all supported languages. | |
87 | ||
88 | @cindex C++ compilation options | |
89 | @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special | |
90 | options for compiling C++ programs. | |
91 | ||
92 | @cindex grouping options | |
93 | @cindex options, grouping | |
bedc7537 | 94 | The @command{gcc} program accepts options and file names as operands. Many |
b192711e | 95 | options have multi-letter names; therefore multiple single-letter options |
630d3d5a | 96 | may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d |
74291a4b MM |
97 | -r}}. |
98 | ||
99 | @cindex order of options | |
100 | @cindex options, order | |
101 | You can mix options and other arguments. For the most part, the order | |
102 | you use doesn't matter. Order does matter when you use several options | |
630d3d5a | 103 | of the same kind; for example, if you specify @option{-L} more than once, |
74291a4b MM |
104 | the directories are searched in the order specified. |
105 | ||
106 | Many options have long names starting with @samp{-f} or with | |
630d3d5a JM |
107 | @samp{-W}---for example, @option{-fforce-mem}, |
108 | @option{-fstrength-reduce}, @option{-Wformat} and so on. Most of | |
74291a4b | 109 | these have both positive and negative forms; the negative form of |
630d3d5a | 110 | @option{-ffoo} would be @option{-fno-foo}. This manual documents |
74291a4b MM |
111 | only one of these two forms, whichever one is not the default. |
112 | ||
9d86bffc JM |
113 | @c man end |
114 | ||
cd3bb277 JM |
115 | @xref{Option Index}, for an index to GCC's options. |
116 | ||
74291a4b MM |
117 | @menu |
118 | * Option Summary:: Brief list of all options, without explanations. | |
119 | * Overall Options:: Controlling the kind of output: | |
120 | an executable, object files, assembler files, | |
121 | or preprocessed source. | |
122 | * Invoking G++:: Compiling C++ programs. | |
123 | * C Dialect Options:: Controlling the variant of C language compiled. | |
124 | * C++ Dialect Options:: Variations on C++. | |
60de6385 | 125 | * Objective-C Dialect Options:: Variations on Objective-C. |
764dbbf2 | 126 | * Language Independent Options:: Controlling how diagnostics should be |
02f52e19 | 127 | formatted. |
74291a4b MM |
128 | * Warning Options:: How picky should the compiler be? |
129 | * Debugging Options:: Symbol tables, measurements, and debugging dumps. | |
130 | * Optimize Options:: How much optimization? | |
131 | * Preprocessor Options:: Controlling header files and macro definitions. | |
132 | Also, getting dependency information for Make. | |
133 | * Assembler Options:: Passing options to the assembler. | |
134 | * Link Options:: Specifying libraries and so on. | |
135 | * Directory Options:: Where to find header files and libraries. | |
136 | Where to find the compiler executable files. | |
a743d340 | 137 | * Spec Files:: How to pass switches to sub-processes. |
0c2d1a2a | 138 | * Target Options:: Running a cross-compiler, or an old version of GCC. |
74291a4b MM |
139 | * Submodel Options:: Specifying minor hardware or convention variations, |
140 | such as 68010 vs 68020. | |
141 | * Code Gen Options:: Specifying conventions for function calls, data layout | |
142 | and register usage. | |
0c2d1a2a | 143 | * Environment Variables:: Env vars that affect GCC. |
74291a4b MM |
144 | * Running Protoize:: Automatically adding or removing function prototypes. |
145 | @end menu | |
146 | ||
4bc1997b JM |
147 | @c man begin OPTIONS |
148 | ||
74291a4b MM |
149 | @node Option Summary |
150 | @section Option Summary | |
151 | ||
152 | Here is a summary of all the options, grouped by type. Explanations are | |
153 | in the following sections. | |
154 | ||
155 | @table @emph | |
156 | @item Overall Options | |
157 | @xref{Overall Options,,Options Controlling the Kind of Output}. | |
4bc1997b JM |
158 | @gccoptlist{ |
159 | -c -S -E -o @var{file} -pipe -pass-exit-codes -x @var{language} @gol | |
160 | -v --target-help --help} | |
74291a4b MM |
161 | |
162 | @item C Language Options | |
163 | @xref{C Dialect Options,,Options Controlling C Dialect}. | |
4bc1997b | 164 | @gccoptlist{ |
b1018de6 | 165 | -ansi -std=@var{standard} -aux-info @var{filename} @gol |
7d14c755 | 166 | -fno-asm -fno-builtin -fno-builtin-@var{function} @gol |
4bc1997b JM |
167 | -fhosted -ffreestanding @gol |
168 | -trigraphs -traditional -traditional-cpp @gol | |
169 | -fallow-single-precision -fcond-mismatch @gol | |
170 | -fsigned-bitfields -fsigned-char @gol | |
171 | -funsigned-bitfields -funsigned-char @gol | |
172 | -fwritable-strings -fshort-wchar} | |
74291a4b MM |
173 | |
174 | @item C++ Language Options | |
175 | @xref{C++ Dialect Options,,Options Controlling C++ Dialect}. | |
4bc1997b JM |
176 | @gccoptlist{ |
177 | -fno-access-control -fcheck-new -fconserve-space @gol | |
aa0cc562 JM |
178 | -fno-const-strings -fdollars-in-identifiers @gol |
179 | -fno-elide-constructors @gol | |
4bc1997b JM |
180 | -fno-enforce-eh-specs -fexternal-templates @gol |
181 | -falt-external-templates @gol | |
1dbb6023 | 182 | -ffor-scope -fno-for-scope -fno-gnu-keywords @gol |
90ecce3e | 183 | -fno-implicit-templates @gol |
4bc1997b JM |
184 | -fno-implicit-inline-templates @gol |
185 | -fno-implement-inlines -fms-extensions @gol | |
aa0cc562 | 186 | -fno-nonansi-builtins -fno-operator-names @gol |
4bc1997b | 187 | -fno-optional-diags -fpermissive @gol |
aa0cc562 | 188 | -frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol |
90ecce3e | 189 | -fuse-cxa-atexit -fvtable-gc -fno-weak -nostdinc++ @gol |
4bc1997b JM |
190 | -fno-default-inline -Wctor-dtor-privacy @gol |
191 | -Wnon-virtual-dtor -Wreorder @gol | |
192 | -Weffc++ -Wno-deprecated @gol | |
193 | -Wno-non-template-friend -Wold-style-cast @gol | |
194 | -Woverloaded-virtual -Wno-pmf-conversions @gol | |
195 | -Wsign-promo -Wsynth} | |
74291a4b | 196 | |
60de6385 SS |
197 | @item Objective-C Language Options |
198 | @xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}. | |
199 | @gccoptlist{ | |
630d3d5a | 200 | -fconstant-string-class=@var{class-name} @gol |
310668e8 | 201 | -fgnu-runtime -fnext-runtime -gen-decls @gol |
60de6385 SS |
202 | -Wno-protocol -Wselector} |
203 | ||
764dbbf2 GDR |
204 | @item Language Independent Options |
205 | @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. | |
4bc1997b JM |
206 | @gccoptlist{ |
207 | -fmessage-length=@var{n} @gol | |
208 | -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}} | |
764dbbf2 | 209 | |
74291a4b MM |
210 | @item Warning Options |
211 | @xref{Warning Options,,Options to Request or Suppress Warnings}. | |
4bc1997b JM |
212 | @gccoptlist{ |
213 | -fsyntax-only -pedantic -pedantic-errors @gol | |
214 | -w -W -Wall -Waggregate-return @gol | |
215 | -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol | |
e23bd218 IR |
216 | -Wconversion -Wno-deprecated-declarations @gol |
217 | -Wdisabled-optimization -Wdiv-by-zero -Werror @gol | |
4bc1997b | 218 | -Wfloat-equal -Wformat -Wformat=2 @gol |
feb48bde JM |
219 | -Wformat-nonliteral -Wformat-security @gol |
220 | -Wimplicit -Wimplicit-int @gol | |
4bc1997b JM |
221 | -Wimplicit-function-declaration @gol |
222 | -Werror-implicit-function-declaration @gol | |
223 | -Wimport -Winline @gol | |
224 | -Wlarger-than-@var{len} -Wlong-long @gol | |
1f0c3120 | 225 | -Wmain -Wmissing-braces -Wmissing-declarations @gol |
4bc1997b | 226 | -Wmissing-format-attribute -Wmissing-noreturn @gol |
feb48bde | 227 | -Wmultichar -Wno-format-extra-args -Wno-format-y2k @gol |
4bc1997b | 228 | -Wno-import -Wpacked -Wpadded @gol |
310668e8 | 229 | -Wparentheses -Wpointer-arith -Wredundant-decls @gol |
4bc1997b JM |
230 | -Wreturn-type -Wsequence-point -Wshadow @gol |
231 | -Wsign-compare -Wswitch -Wsystem-headers @gol | |
232 | -Wtrigraphs -Wundef -Wuninitialized @gol | |
233 | -Wunknown-pragmas -Wunreachable-code @gol | |
234 | -Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol | |
235 | -Wunused-value -Wunused-variable -Wwrite-strings} | |
74291a4b | 236 | |
fe50c0eb | 237 | @item C-only Warning Options |
4bc1997b | 238 | @gccoptlist{ |
310668e8 JM |
239 | -Wbad-function-cast -Wmissing-prototypes -Wnested-externs @gol |
240 | -Wstrict-prototypes -Wtraditional} | |
fe50c0eb | 241 | |
74291a4b MM |
242 | @item Debugging Options |
243 | @xref{Debugging Options,,Options for Debugging Your Program or GCC}. | |
4bc1997b | 244 | @gccoptlist{ |
8456b95a | 245 | -d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol |
92989aed | 246 | -fdump-unnumbered |
aee96fe9 | 247 | -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol |
22367161 NS |
248 | -fdump-tree-original@r{[}-@var{n}@r{]} -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol |
249 | -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol | |
e76b4820 | 250 | -fmem-report -fpretend-float @gol |
1f0c3120 | 251 | -fprofile-arcs -ftest-coverage -ftime-report @gol |
4bc1997b | 252 | -g -g@var{level} -gcoff -gdwarf -gdwarf-1 -gdwarf-1+ -gdwarf-2 @gol |
5f98259a | 253 | -ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol |
4bc1997b | 254 | -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol |
b1018de6 | 255 | -print-multi-directory -print-multi-lib @gol |
4bc1997b JM |
256 | -print-prog-name=@var{program} -print-search-dirs -Q @gol |
257 | -save-temps -time} | |
74291a4b MM |
258 | |
259 | @item Optimization Options | |
260 | @xref{Optimize Options,,Options that Control Optimization}. | |
4bc1997b JM |
261 | @gccoptlist{ |
262 | -falign-functions=@var{n} -falign-jumps=@var{n} @gol | |
263 | -falign-labels=@var{n} -falign-loops=@var{n} @gol | |
8582c27b | 264 | -fbranch-probabilities -fcaller-saves -fcprop-registers @gol |
62d285ff | 265 | -fcse-follow-jumps -fcse-skip-blocks -fdata-sections @gol |
4bc1997b JM |
266 | -fdelayed-branch -fdelete-null-pointer-checks @gol |
267 | -fexpensive-optimizations -ffast-math -ffloat-store @gol | |
feb48bde JM |
268 | -fforce-addr -fforce-mem -ffunction-sections @gol |
269 | -fgcse -fgcse-lm -fgcse-sm @gol | |
4bc1997b | 270 | -finline-functions -finline-limit=@var{n} -fkeep-inline-functions @gol |
201556f0 JJ |
271 | -fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol |
272 | -fmove-all-movables -fno-default-inline -fno-defer-pop @gol | |
feb48bde | 273 | -fno-function-cse -fno-guess-branch-probability @gol |
6cfc0341 | 274 | -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol |
de6c5979 | 275 | -funsafe-math-optimizations -fno-trapping-math @gol |
4bc1997b | 276 | -fomit-frame-pointer -foptimize-register-move @gol |
5d22c1a5 JM |
277 | -foptimize-sibling-calls -fprefetch-loop-arrays @gol |
278 | -freduce-all-givs -fregmove -frename-registers @gol | |
4bc1997b JM |
279 | -frerun-cse-after-loop -frerun-loop-opt @gol |
280 | -fschedule-insns -fschedule-insns2 @gol | |
0b47e4c1 | 281 | -fsingle-precision-constant -fssa -fssa-ccp -fssa-dce @gol |
4bc1997b | 282 | -fstrength-reduce -fstrict-aliasing -fthread-jumps -ftrapv @gol |
86be733d | 283 | -funroll-all-loops -funroll-loops @gol |
3af64fd6 | 284 | --param @var{name}=@var{value} |
4bc1997b | 285 | -O -O0 -O1 -O2 -O3 -Os} |
74291a4b MM |
286 | |
287 | @item Preprocessor Options | |
288 | @xref{Preprocessor Options,,Options Controlling the Preprocessor}. | |
4bc1997b JM |
289 | @gccoptlist{ |
290 | -$ -A@var{question}=@var{answer} -A-@var{question}@r{[}=@var{answer}@r{]} @gol | |
291 | -C -dD -dI -dM -dN @gol | |
292 | -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol | |
293 | -idirafter @var{dir} @gol | |
294 | -include @var{file} -imacros @var{file} @gol | |
295 | -iprefix @var{file} -iwithprefix @var{dir} @gol | |
bdd42dd9 | 296 | -iwithprefixbefore @var{dir} -isystem @var{dir} @gol |
4bc1997b | 297 | -M -MM -MF -MG -MP -MQ -MT -nostdinc -P -remap @gol |
aee96fe9 | 298 | -trigraphs -undef -U@var{macro} -Wp,@var{option}} |
74291a4b MM |
299 | |
300 | @item Assembler Option | |
301 | @xref{Assembler Options,,Passing Options to the Assembler}. | |
4bc1997b | 302 | @gccoptlist{ |
aee96fe9 | 303 | -Wa,@var{option}} |
74291a4b MM |
304 | |
305 | @item Linker Options | |
306 | @xref{Link Options,,Options for Linking}. | |
4bc1997b JM |
307 | @gccoptlist{ |
308 | @var{object-file-name} -l@var{library} @gol | |
309 | -nostartfiles -nodefaultlibs -nostdlib @gol | |
310 | -s -static -static-libgcc -shared -shared-libgcc -symbolic @gol | |
aee96fe9 | 311 | -Wl,@var{option} -Xlinker @var{option} @gol |
4bc1997b | 312 | -u @var{symbol}} |
74291a4b MM |
313 | |
314 | @item Directory Options | |
315 | @xref{Directory Options,,Options for Directory Search}. | |
4bc1997b JM |
316 | @gccoptlist{ |
317 | -B@var{prefix} -I@var{dir} -I- -L@var{dir} -specs=@var{file}} | |
74291a4b MM |
318 | |
319 | @item Target Options | |
320 | @c I wrote this xref this way to avoid overfull hbox. -- rms | |
321 | @xref{Target Options}. | |
4bc1997b JM |
322 | @gccoptlist{ |
323 | -b @var{machine} -V @var{version}} | |
74291a4b MM |
324 | |
325 | @item Machine Dependent Options | |
326 | @xref{Submodel Options,,Hardware Models and Configurations}. | |
5d22c1a5 | 327 | |
74291a4b | 328 | @emph{M680x0 Options} |
4bc1997b JM |
329 | @gccoptlist{ |
330 | -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol | |
feb48bde | 331 | -m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol |
310668e8 JM |
332 | -mfpa -mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol |
333 | -malign-int -mstrict-align} | |
74291a4b | 334 | |
2856c3e3 | 335 | @emph{M68hc1x Options} |
4bc1997b JM |
336 | @gccoptlist{ |
337 | -m6811 -m6812 -m68hc11 -m68hc12 @gol | |
338 | -mauto-incdec -mshort -msoft-reg-count=@var{count}} | |
2856c3e3 | 339 | |
74291a4b | 340 | @emph{VAX Options} |
4bc1997b JM |
341 | @gccoptlist{ |
342 | -mg -mgnu -munix} | |
74291a4b MM |
343 | |
344 | @emph{SPARC Options} | |
4bc1997b | 345 | @gccoptlist{ |
630d3d5a JM |
346 | -mcpu=@var{cpu-type} @gol |
347 | -mtune=@var{cpu-type} @gol | |
348 | -mcmodel=@var{code-model} @gol | |
4bc1997b JM |
349 | -m32 -m64 @gol |
350 | -mapp-regs -mbroken-saverestore -mcypress @gol | |
feb48bde | 351 | -mepilogue -mfaster-structs -mflat @gol |
4bc1997b JM |
352 | -mfpu -mhard-float -mhard-quad-float @gol |
353 | -mimpure-text -mlive-g0 -mno-app-regs @gol | |
310668e8 JM |
354 | -mno-epilogue -mno-faster-structs -mno-flat -mno-fpu @gol |
355 | -mno-impure-text -mno-stack-bias -mno-unaligned-doubles @gol | |
4bc1997b JM |
356 | -msoft-float -msoft-quad-float -msparclite -mstack-bias @gol |
357 | -msupersparc -munaligned-doubles -mv8} | |
74291a4b MM |
358 | |
359 | @emph{Convex Options} | |
4bc1997b JM |
360 | @gccoptlist{ |
361 | -mc1 -mc2 -mc32 -mc34 -mc38 @gol | |
362 | -margcount -mnoargcount @gol | |
363 | -mlong32 -mlong64 @gol | |
364 | -mvolatile-cache -mvolatile-nocache} | |
74291a4b MM |
365 | |
366 | @emph{AMD29K Options} | |
4bc1997b JM |
367 | @gccoptlist{ |
368 | -m29000 -m29050 -mbw -mnbw -mdw -mndw @gol | |
369 | -mlarge -mnormal -msmall @gol | |
370 | -mkernel-registers -mno-reuse-arg-regs @gol | |
371 | -mno-stack-check -mno-storem-bug @gol | |
372 | -mreuse-arg-regs -msoft-float -mstack-check @gol | |
373 | -mstorem-bug -muser-registers} | |
74291a4b MM |
374 | |
375 | @emph{ARM Options} | |
4bc1997b | 376 | @gccoptlist{ |
310668e8 JM |
377 | -mapcs-frame -mno-apcs-frame @gol |
378 | -mapcs-26 -mapcs-32 @gol | |
379 | -mapcs-stack-check -mno-apcs-stack-check @gol | |
380 | -mapcs-float -mno-apcs-float @gol | |
381 | -mapcs-reentrant -mno-apcs-reentrant @gol | |
382 | -msched-prolog -mno-sched-prolog @gol | |
383 | -mlittle-endian -mbig-endian -mwords-little-endian @gol | |
384 | -malignment-traps -mno-alignment-traps @gol | |
385 | -msoft-float -mhard-float -mfpe @gol | |
386 | -mthumb-interwork -mno-thumb-interwork @gol | |
387 | -mcpu=@var{name} -march=@var{name} -mfpe=@var{name} @gol | |
247f8561 | 388 | -mstructure-size-boundary=@var{n} @gol |
310668e8 | 389 | -mbsd -mxopen -mno-symrename @gol |
4bc1997b | 390 | -mabort-on-noreturn @gol |
310668e8 JM |
391 | -mlong-calls -mno-long-calls @gol |
392 | -msingle-pic-base -mno-single-pic-base @gol | |
247f8561 PB |
393 | -mpic-register=@var{reg} @gol |
394 | -mnop-fun-dllimport @gol | |
395 | -mpoke-function-name @gol | |
310668e8 JM |
396 | -mthumb -marm @gol |
397 | -mtpcs-frame -mtpcs-leaf-frame @gol | |
398 | -mcaller-super-interworking -mcallee-super-interworking } | |
74291a4b | 399 | |
ecff22ab | 400 | @emph{MN10200 Options} |
4bc1997b JM |
401 | @gccoptlist{ |
402 | -mrelax} | |
ecff22ab | 403 | |
6d6d0fa0 | 404 | @emph{MN10300 Options} |
4bc1997b | 405 | @gccoptlist{ |
c474f76b AO |
406 | -mmult-bug -mno-mult-bug @gol |
407 | -mam33 -mno-am33 @gol | |
408 | -mno-crt0 -mrelax} | |
6d6d0fa0 | 409 | |
861bb6c1 | 410 | @emph{M32R/D Options} |
4bc1997b | 411 | @gccoptlist{ |
98180123 | 412 | -m32rx -m32r -mcode-model=@var{model-type} -msdata=@var{sdata-type} @gol |
4bc1997b | 413 | -G @var{num}} |
861bb6c1 | 414 | |
74291a4b | 415 | @emph{M88K Options} |
4bc1997b JM |
416 | @gccoptlist{ |
417 | -m88000 -m88100 -m88110 -mbig-pic @gol | |
418 | -mcheck-zero-division -mhandle-large-shift @gol | |
419 | -midentify-revision -mno-check-zero-division @gol | |
420 | -mno-ocs-debug-info -mno-ocs-frame-position @gol | |
421 | -mno-optimize-arg-area -mno-serialize-volatile @gol | |
422 | -mno-underscores -mocs-debug-info @gol | |
423 | -mocs-frame-position -moptimize-arg-area @gol | |
424 | -mserialize-volatile -mshort-data-@var{num} -msvr3 @gol | |
425 | -msvr4 -mtrap-large-shift -muse-div-instruction @gol | |
426 | -mversion-03.00 -mwarn-passed-structs} | |
74291a4b MM |
427 | |
428 | @emph{RS/6000 and PowerPC Options} | |
4bc1997b | 429 | @gccoptlist{ |
630d3d5a JM |
430 | -mcpu=@var{cpu-type} @gol |
431 | -mtune=@var{cpu-type} @gol | |
4bc1997b JM |
432 | -mpower -mno-power -mpower2 -mno-power2 @gol |
433 | -mpowerpc -mpowerpc64 -mno-powerpc @gol | |
0ac081f6 | 434 | -maltivec -mno-altivec @gol |
4bc1997b JM |
435 | -mpowerpc-gpopt -mno-powerpc-gpopt @gol |
436 | -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol | |
437 | -mnew-mnemonics -mold-mnemonics @gol | |
438 | -mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc @gol | |
0a379b7a | 439 | -m64 -m32 -mxl-call -mno-xl-call -mpe @gol |
4bc1997b JM |
440 | -msoft-float -mhard-float -mmultiple -mno-multiple @gol |
441 | -mstring -mno-string -mupdate -mno-update @gol | |
442 | -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol | |
443 | -mstrict-align -mno-strict-align -mrelocatable @gol | |
444 | -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol | |
445 | -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol | |
9c34dbbf | 446 | -mcall-aix -mcall-sysv -mcall-netbsd @gol |
9904592e | 447 | -maix-struct-return -msvr4-struct-return |
0ac081f6 | 448 | -mabi=altivec @gol |
9c34dbbf | 449 | -mprototype -mno-prototype @gol |
4bc1997b | 450 | -msim -mmvme -mads -myellowknife -memb -msdata @gol |
0a379b7a | 451 | -msdata=@var{opt} -mvxworks -G @var{num} -pthread} |
74291a4b MM |
452 | |
453 | @emph{RT Options} | |
4bc1997b JM |
454 | @gccoptlist{ |
455 | -mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs @gol | |
456 | -mfull-fp-blocks -mhc-struct-return -min-line-mul @gol | |
457 | -mminimum-fp-blocks -mnohc-struct-return} | |
74291a4b MM |
458 | |
459 | @emph{MIPS Options} | |
4bc1997b | 460 | @gccoptlist{ |
7dac2f89 EC |
461 | -mabicalls -march=@var{cpu-type} -mtune=@var{cpu=type} @gol |
462 | -mcpu=@var{cpu-type} -membedded-data -muninit-const-in-rodata @gol | |
13fac94a GK |
463 | -membedded-pic -mfp32 -mfp64 -mfused-madd -mno-fused-madd @gol |
464 | -mgas -mgp32 -mgp64 @gol | |
4bc1997b | 465 | -mgpopt -mhalf-pic -mhard-float -mint64 -mips1 @gol |
feb48bde | 466 | -mips2 -mips3 -mips4 -mlong64 -mlong32 -mlong-calls -mmemcpy @gol |
4bc1997b | 467 | -mmips-as -mmips-tfile -mno-abicalls @gol |
feb48bde JM |
468 | -mno-embedded-data -mno-uninit-const-in-rodata @gol |
469 | -mno-embedded-pic -mno-gpopt -mno-long-calls @gol | |
4bc1997b JM |
470 | -mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats @gol |
471 | -mrnames -msoft-float @gol | |
472 | -m4650 -msingle-float -mmad @gol | |
473 | -mstats -EL -EB -G @var{num} -nocpp @gol | |
feb48bde | 474 | -mabi=32 -mabi=n32 -mabi=64 -mabi=eabi @gol |
d490e8ad | 475 | -mfix7000 -mno-crt0 -mflush-func=@var{func} -mno-flush-func} |
74291a4b | 476 | |
14f73b5a | 477 | @emph{i386 and x86-64 Options} |
4bc1997b | 478 | @gccoptlist{ |
965f5423 | 479 | -mcpu=@var{cpu-type} -march=@var{cpu-type} -mfpmath=@var{unit} @gol |
c93e80a5 | 480 | -masm=@var{dialect} -mno-fancy-math-387 @gol |
4bc1997b JM |
481 | -mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol |
482 | -mno-wide-multiply -mrtd -malign-double @gol | |
3e18fdf6 | 483 | -mpreferred-stack-boundary=@var{num} @gol |
965f5423 | 484 | -mmmx -msse -msse2 -msse-math -m3dnow @gol |
feb48bde JM |
485 | -mthreads -mno-align-stringops -minline-all-stringops @gol |
486 | -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol | |
14f73b5a JH |
487 | -m96bit-long-double -mregparm=@var{num} -momit-leaf-frame-pointer @gol |
488 | -mno-red-zone@gol | |
489 | -m32 -m64} | |
74291a4b MM |
490 | |
491 | @emph{HPPA Options} | |
4bc1997b | 492 | @gccoptlist{ |
630d3d5a | 493 | -march=@var{architecture-type} @gol |
feb48bde JM |
494 | -mbig-switch -mdisable-fpregs -mdisable-indexing @gol |
495 | -mfast-indirect-calls -mgas -mjump-in-delay @gol | |
4bc1997b JM |
496 | -mlong-load-store -mno-big-switch -mno-disable-fpregs @gol |
497 | -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol | |
feb48bde | 498 | -mno-jump-in-delay -mno-long-load-store @gol |
4bc1997b | 499 | -mno-portable-runtime -mno-soft-float @gol |
feb48bde JM |
500 | -mno-space-regs -msoft-float -mpa-risc-1-0 @gol |
501 | -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol | |
630d3d5a | 502 | -mschedule=@var{cpu-type} -mspace-regs} |
74291a4b MM |
503 | |
504 | @emph{Intel 960 Options} | |
4bc1997b | 505 | @gccoptlist{ |
630d3d5a | 506 | -m@var{cpu-type} -masm-compat -mclean-linkage @gol |
4bc1997b JM |
507 | -mcode-align -mcomplex-addr -mleaf-procedures @gol |
508 | -mic-compat -mic2.0-compat -mic3.0-compat @gol | |
509 | -mintel-asm -mno-clean-linkage -mno-code-align @gol | |
510 | -mno-complex-addr -mno-leaf-procedures @gol | |
511 | -mno-old-align -mno-strict-align -mno-tail-call @gol | |
512 | -mnumerics -mold-align -msoft-float -mstrict-align @gol | |
513 | -mtail-call} | |
74291a4b MM |
514 | |
515 | @emph{DEC Alpha Options} | |
4bc1997b | 516 | @gccoptlist{ |
58605ba0 | 517 | -mno-fp-regs -msoft-float -malpha-as -mgas @gol |
4bc1997b JM |
518 | -mieee -mieee-with-inexact -mieee-conformant @gol |
519 | -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol | |
520 | -mtrap-precision=@var{mode} -mbuild-constants @gol | |
58605ba0 RH |
521 | -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol |
522 | -mbwx -mmax -mfix -mcix @gol | |
523 | -mfloat-vax -mfloat-ieee @gol | |
524 | -mexplicit-relocs -msmall-data -mlarge-data @gol | |
4bc1997b | 525 | -mmemory-latency=@var{time}} |
74291a4b | 526 | |
d7c23cdc DR |
527 | @emph{DEC Alpha/VMS Options} |
528 | @gccoptlist{ | |
529 | -mvms-return-codes} | |
530 | ||
74291a4b | 531 | @emph{Clipper Options} |
4bc1997b JM |
532 | @gccoptlist{ |
533 | -mc300 -mc400} | |
74291a4b MM |
534 | |
535 | @emph{H8/300 Options} | |
4bc1997b | 536 | @gccoptlist{ |
310668e8 | 537 | -mrelax -mh -ms -mint32 -malign-300} |
74291a4b MM |
538 | |
539 | @emph{SH Options} | |
4bc1997b JM |
540 | @gccoptlist{ |
541 | -m1 -m2 -m3 -m3e @gol | |
542 | -m4-nofpu -m4-single-only -m4-single -m4 @gol | |
543 | -mb -ml -mdalign -mrelax @gol | |
544 | -mbigtable -mfmovd -mhitachi -mnomacsave @gol | |
c474f76b AO |
545 | -mieee -misize -mpadstruct -mspace @gol |
546 | -mprefergot -musermode} | |
74291a4b MM |
547 | |
548 | @emph{System V Options} | |
4bc1997b | 549 | @gccoptlist{ |
aee96fe9 | 550 | -Qy -Qn -YP,@var{paths} -Ym,@var{dir}} |
74291a4b | 551 | |
56b2d7a7 | 552 | @emph{ARC Options} |
4bc1997b JM |
553 | @gccoptlist{ |
554 | -EB -EL @gol | |
630d3d5a JM |
555 | -mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol |
556 | -mdata=@var{data-section} -mrodata=@var{readonly-data-section}} | |
56b2d7a7 | 557 | |
282a61e6 | 558 | @emph{TMS320C3x/C4x Options} |
4bc1997b | 559 | @gccoptlist{ |
310668e8 JM |
560 | -mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol |
561 | -mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol | |
562 | -mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol | |
563 | -mparallel-insns -mparallel-mpy -mpreserve-float} | |
282a61e6 | 564 | |
f84271d9 | 565 | @emph{V850 Options} |
4bc1997b | 566 | @gccoptlist{ |
310668e8 JM |
567 | -mlong-calls -mno-long-calls -mep -mno-ep @gol |
568 | -mprolog-function -mno-prolog-function -mspace @gol | |
569 | -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol | |
570 | -mv850 -mbig-switch} | |
83575957 ID |
571 | |
572 | @emph{NS32K Options} | |
4bc1997b | 573 | @gccoptlist{ |
310668e8 | 574 | -m32032 -m32332 -m32532 -m32081 -m32381 @gol |
feb48bde | 575 | -mmult-add -mnomult-add -msoft-float -mrtd -mnortd @gol |
310668e8 JM |
576 | -mregparam -mnoregparam -msb -mnosb @gol |
577 | -mbitfield -mnobitfield -mhimem -mnohimem} | |
789a3090 | 578 | |
052a4b28 | 579 | @emph{AVR Options} |
4bc1997b | 580 | @gccoptlist{ |
310668e8 JM |
581 | -mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol |
582 | -mcall-prologues -mno-tablejump -mtiny-stack} | |
052a4b28 | 583 | |
789a3090 | 584 | @emph{MCore Options} |
4bc1997b | 585 | @gccoptlist{ |
feb48bde | 586 | -mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol |
310668e8 JM |
587 | -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol |
588 | -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol | |
589 | -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol | |
590 | -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} | |
f84271d9 | 591 | |
bcf684c7 HPN |
592 | @emph{MMIX Options} |
593 | @gccoptlist{ | |
594 | -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol | |
595 | -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol | |
3e0f61ac HPN |
596 | -melf -mbranch-predict -mreg-stack-fill-bug-workaround @gol |
597 | -mno-branch-predict -mno-reg-stack-fill-bug-workaround} | |
bcf684c7 | 598 | |
df6194d4 JW |
599 | @emph{IA-64 Options} |
600 | @gccoptlist{ | |
310668e8 JM |
601 | -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol |
602 | -mvolatile-asm-stop -mb-step -mregister-names -mno-sdata @gol | |
603 | -mconstant-gp -mauto-pic -minline-divide-min-latency @gol | |
604 | -minline-divide-max-throughput -mno-dwarf2-asm @gol | |
630d3d5a | 605 | -mfixed-range=@var{register-range}} |
df6194d4 | 606 | |
5d22c1a5 JM |
607 | @emph{D30V Options} |
608 | @gccoptlist{ | |
609 | -mextmem -mextmemory -monchip -mno-asm-optimize -masm-optimize @gol | |
610 | -mbranch-cost=@var{n} -mcond-exec=@var{n}} | |
611 | ||
91abf72d HP |
612 | @emph{S/390 and zSeries Options} |
613 | @gccoptlist{ | |
614 | -mhard-float -msoft-float -mbackchain -mno-backchain @gol | |
615 | -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol | |
616 | -m64 -m31 -mdebug -mno-debug} | |
617 | ||
0b85d816 HPN |
618 | @emph{CRIS Options} |
619 | @gccoptlist{ | |
620 | -mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol | |
621 | -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol | |
622 | -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol | |
623 | -mstack-align -mdata-align -mconst-align @gol | |
624 | -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol | |
625 | -melf -maout -melinux -mlinux -sim -sim2} | |
626 | ||
9f85bca7 JM |
627 | @emph{PDP-11 Options} |
628 | @gccoptlist{ | |
629 | -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol | |
630 | -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol | |
631 | -mint16 -mno-int32 -mfloat32 -mno-float64 @gol | |
632 | -mfloat64 -mno-float32 -mabshi -mno-abshi @gol | |
633 | -mbranch-expensive -mbranch-cheap @gol | |
634 | -msplit -mno-split -munix-asm -mdec-asm} | |
635 | ||
74291a4b MM |
636 | @item Code Generation Options |
637 | @xref{Code Gen Options,,Options for Code Generation Conventions}. | |
4bc1997b JM |
638 | @gccoptlist{ |
639 | -fcall-saved-@var{reg} -fcall-used-@var{reg} @gol | |
6cfc0341 | 640 | -ffixed-@var{reg} -fexceptions @gol |
5d22c1a5 JM |
641 | -fnon-call-exceptions -funwind-tables @gol |
642 | -fasynchronous-unwind-tables @gol | |
4bc1997b | 643 | -finhibit-size-directive -finstrument-functions @gol |
4bc1997b JM |
644 | -fno-common -fno-ident -fno-gnu-linker @gol |
645 | -fpcc-struct-return -fpic -fPIC @gol | |
646 | -freg-struct-return -fshared-data -fshort-enums @gol | |
310668e8 JM |
647 | -fshort-double -fvolatile @gol |
648 | -fvolatile-global -fvolatile-static @gol | |
4bc1997b JM |
649 | -fverbose-asm -fpack-struct -fstack-check @gol |
650 | -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol | |
651 | -fargument-alias -fargument-noalias @gol | |
310668e8 | 652 | -fargument-noalias-global -fleading-underscore} |
74291a4b MM |
653 | @end table |
654 | ||
655 | @menu | |
656 | * Overall Options:: Controlling the kind of output: | |
657 | an executable, object files, assembler files, | |
658 | or preprocessed source. | |
659 | * C Dialect Options:: Controlling the variant of C language compiled. | |
660 | * C++ Dialect Options:: Variations on C++. | |
60de6385 | 661 | * Objective-C Dialect Options:: Variations on Objective-C. |
764dbbf2 | 662 | * Language Independent Options:: Controlling how diagnostics should be |
02f52e19 | 663 | formatted. |
74291a4b MM |
664 | * Warning Options:: How picky should the compiler be? |
665 | * Debugging Options:: Symbol tables, measurements, and debugging dumps. | |
666 | * Optimize Options:: How much optimization? | |
667 | * Preprocessor Options:: Controlling header files and macro definitions. | |
668 | Also, getting dependency information for Make. | |
669 | * Assembler Options:: Passing options to the assembler. | |
670 | * Link Options:: Specifying libraries and so on. | |
671 | * Directory Options:: Where to find header files and libraries. | |
672 | Where to find the compiler executable files. | |
a743d340 | 673 | * Spec Files:: How to pass switches to sub-processes. |
0c2d1a2a | 674 | * Target Options:: Running a cross-compiler, or an old version of GCC. |
74291a4b MM |
675 | @end menu |
676 | ||
677 | @node Overall Options | |
678 | @section Options Controlling the Kind of Output | |
679 | ||
680 | Compilation can involve up to four stages: preprocessing, compilation | |
681 | proper, assembly and linking, always in that order. The first three | |
682 | stages apply to an individual source file, and end by producing an | |
683 | object file; linking combines all the object files (those newly | |
684 | compiled, and those specified as input) into an executable file. | |
685 | ||
686 | @cindex file name suffix | |
687 | For any given input file, the file name suffix determines what kind of | |
688 | compilation is done: | |
689 | ||
2642624b | 690 | @table @gcctabopt |
74291a4b MM |
691 | @item @var{file}.c |
692 | C source code which must be preprocessed. | |
693 | ||
694 | @item @var{file}.i | |
695 | C source code which should not be preprocessed. | |
696 | ||
697 | @item @var{file}.ii | |
698 | C++ source code which should not be preprocessed. | |
699 | ||
700 | @item @var{file}.m | |
701 | Objective-C source code. Note that you must link with the library | |
702 | @file{libobjc.a} to make an Objective-C program work. | |
703 | ||
b9265ec1 JM |
704 | @item @var{file}.mi |
705 | Objective-C source code which should not be preprocessed. | |
706 | ||
74291a4b MM |
707 | @item @var{file}.h |
708 | C header file (not to be compiled or linked). | |
709 | ||
710 | @item @var{file}.cc | |
b9265ec1 | 711 | @itemx @var{file}.cp |
74291a4b MM |
712 | @itemx @var{file}.cxx |
713 | @itemx @var{file}.cpp | |
b9265ec1 | 714 | @itemx @var{file}.c++ |
74291a4b MM |
715 | @itemx @var{file}.C |
716 | C++ source code which must be preprocessed. Note that in @samp{.cxx}, | |
717 | the last two letters must both be literally @samp{x}. Likewise, | |
161d7b59 | 718 | @samp{.C} refers to a literal capital C@. |
74291a4b | 719 | |
b9265ec1 JM |
720 | @item @var{file}.f |
721 | @itemx @var{file}.for | |
722 | @itemx @var{file}.FOR | |
723 | Fortran source code which should not be preprocessed. | |
724 | ||
725 | @item @var{file}.F | |
726 | @itemx @var{file}.fpp | |
727 | @itemx @var{file}.FPP | |
728 | Fortran source code which must be preprocessed (with the traditional | |
729 | preprocessor). | |
730 | ||
731 | @item @var{file}.r | |
732 | Fortran source code which must be preprocessed with a RATFOR | |
161d7b59 | 733 | preprocessor (not included with GCC)@. |
b9265ec1 JM |
734 | |
735 | @xref{Overall Options,,Options Controlling the Kind of Output, g77, | |
736 | Using and Porting GNU Fortran}, for more details of the handling of | |
737 | Fortran input files. | |
738 | ||
739 | @c FIXME: Descriptions of Java file types. | |
740 | @c @var{file}.java | |
741 | @c @var{file}.class | |
742 | @c @var{file}.zip | |
743 | @c @var{file}.jar | |
744 | ||
e23381df GB |
745 | @item @var{file}.ads |
746 | Ada source code file which contains a library unit declaration (a | |
747 | declaration of a package, subprogram, or generic, or a generic | |
748 | instantiation), or a library unit renaming declaration (a package, | |
749 | generic, or subprogram renaming declaration). Such files are also | |
750 | called @dfn{specs}. | |
751 | ||
752 | @itemx @var{file}.adb | |
753 | Ada source code file containing a library unit body (a subprogram or | |
754 | package body). Such files are also called @dfn{bodies}. | |
755 | ||
b9265ec1 | 756 | @c GCC also knows about some suffixes for languages not yet included: |
b9265ec1 JM |
757 | @c Pascal: |
758 | @c @var{file}.p | |
759 | @c @var{file}.pas | |
760 | ||
761 | @item @var{file}.ch | |
762 | @itemx @var{file}.chi | |
763 | CHILL source code (preprocessed with the traditional preprocessor). | |
764 | ||
74291a4b MM |
765 | @item @var{file}.s |
766 | Assembler code. | |
767 | ||
768 | @item @var{file}.S | |
769 | Assembler code which must be preprocessed. | |
770 | ||
771 | @item @var{other} | |
772 | An object file to be fed straight into linking. | |
773 | Any file name with no recognized suffix is treated this way. | |
774 | @end table | |
775 | ||
cd3bb277 | 776 | @opindex x |
630d3d5a | 777 | You can specify the input language explicitly with the @option{-x} option: |
74291a4b | 778 | |
2642624b | 779 | @table @gcctabopt |
74291a4b MM |
780 | @item -x @var{language} |
781 | Specify explicitly the @var{language} for the following input files | |
782 | (rather than letting the compiler choose a default based on the file | |
783 | name suffix). This option applies to all following input files until | |
630d3d5a | 784 | the next @option{-x} option. Possible values for @var{language} are: |
74291a4b | 785 | @example |
b9265ec1 JM |
786 | c c-header cpp-output |
787 | c++ c++-cpp-output | |
788 | objective-c objc-cpp-output | |
74291a4b | 789 | assembler assembler-with-cpp |
e23381df GB |
790 | ada |
791 | chill | |
b9265ec1 | 792 | f77 f77-cpp-input ratfor |
e23381df | 793 | java |
74291a4b MM |
794 | @end example |
795 | ||
796 | @item -x none | |
797 | Turn off any specification of a language, so that subsequent files are | |
630d3d5a | 798 | handled according to their file name suffixes (as they are if @option{-x} |
74291a4b | 799 | has not been used at all). |
14a774a9 RK |
800 | |
801 | @item -pass-exit-codes | |
cd3bb277 | 802 | @opindex pass-exit-codes |
bedc7537 | 803 | Normally the @command{gcc} program will exit with the code of 1 if any |
14a774a9 | 804 | phase of the compiler returns a non-success return code. If you specify |
630d3d5a | 805 | @option{-pass-exit-codes}, the @command{gcc} program will instead return with |
14a774a9 RK |
806 | numerically highest error produced by any phase that returned an error |
807 | indication. | |
74291a4b MM |
808 | @end table |
809 | ||
810 | If you only want some of the stages of compilation, you can use | |
630d3d5a JM |
811 | @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and |
812 | one of the options @option{-c}, @option{-S}, or @option{-E} to say where | |
bedc7537 NC |
813 | @command{gcc} is to stop. Note that some combinations (for example, |
814 | @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. | |
74291a4b | 815 | |
2642624b | 816 | @table @gcctabopt |
74291a4b | 817 | @item -c |
cd3bb277 | 818 | @opindex c |
74291a4b MM |
819 | Compile or assemble the source files, but do not link. The linking |
820 | stage simply is not done. The ultimate output is in the form of an | |
821 | object file for each source file. | |
822 | ||
823 | By default, the object file name for a source file is made by replacing | |
824 | the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. | |
825 | ||
826 | Unrecognized input files, not requiring compilation or assembly, are | |
827 | ignored. | |
828 | ||
829 | @item -S | |
cd3bb277 | 830 | @opindex S |
74291a4b MM |
831 | Stop after the stage of compilation proper; do not assemble. The output |
832 | is in the form of an assembler code file for each non-assembler input | |
833 | file specified. | |
834 | ||
835 | By default, the assembler file name for a source file is made by | |
836 | replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. | |
837 | ||
838 | Input files that don't require compilation are ignored. | |
839 | ||
840 | @item -E | |
cd3bb277 | 841 | @opindex E |
74291a4b MM |
842 | Stop after the preprocessing stage; do not run the compiler proper. The |
843 | output is in the form of preprocessed source code, which is sent to the | |
844 | standard output. | |
845 | ||
846 | Input files which don't require preprocessing are ignored. | |
847 | ||
848 | @cindex output file option | |
849 | @item -o @var{file} | |
cd3bb277 | 850 | @opindex o |
74291a4b MM |
851 | Place output in file @var{file}. This applies regardless to whatever |
852 | sort of output is being produced, whether it be an executable file, | |
853 | an object file, an assembler file or preprocessed C code. | |
854 | ||
855 | Since only one output file can be specified, it does not make sense to | |
630d3d5a | 856 | use @option{-o} when compiling more than one input file, unless you are |
74291a4b MM |
857 | producing an executable file as output. |
858 | ||
630d3d5a | 859 | If @option{-o} is not specified, the default is to put an executable file |
74291a4b MM |
860 | in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in |
861 | @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and | |
bd819a4a | 862 | all preprocessed C source on standard output. |
74291a4b MM |
863 | |
864 | @item -v | |
cd3bb277 | 865 | @opindex v |
74291a4b MM |
866 | Print (on standard error output) the commands executed to run the stages |
867 | of compilation. Also print the version number of the compiler driver | |
868 | program and of the preprocessor and the compiler proper. | |
869 | ||
870 | @item -pipe | |
cd3bb277 | 871 | @opindex pipe |
74291a4b MM |
872 | Use pipes rather than temporary files for communication between the |
873 | various stages of compilation. This fails to work on some systems where | |
874 | the assembler is unable to read from a pipe; but the GNU assembler has | |
875 | no trouble. | |
844642e6 NC |
876 | |
877 | @item --help | |
cd3bb277 | 878 | @opindex help |
844642e6 | 879 | Print (on the standard output) a description of the command line options |
bedc7537 NC |
880 | understood by @command{gcc}. If the @option{-v} option is also specified |
881 | then @option{--help} will also be passed on to the various processes | |
882 | invoked by @command{gcc}, so that they can display the command line options | |
883 | they accept. If the @option{-W} option is also specified then command | |
844642e6 NC |
884 | line options which have no documentation associated with them will also |
885 | be displayed. | |
10501d8f CC |
886 | |
887 | @item --target-help | |
cd3bb277 | 888 | @opindex target-help |
10501d8f CC |
889 | Print (on the standard output) a description of target specific command |
890 | line options for each tool. | |
74291a4b MM |
891 | @end table |
892 | ||
893 | @node Invoking G++ | |
894 | @section Compiling C++ Programs | |
895 | ||
896 | @cindex suffixes for C++ source | |
897 | @cindex C++ source file suffixes | |
898 | C++ source files conventionally use one of the suffixes @samp{.C}, | |
bba975d4 | 899 | @samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx}; |
0c2d1a2a | 900 | preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes |
bba975d4 JM |
901 | files with these names and compiles them as C++ programs even if you |
902 | call the compiler the same way as for compiling C programs (usually with | |
bedc7537 | 903 | the name @command{gcc}). |
74291a4b MM |
904 | |
905 | @findex g++ | |
906 | @findex c++ | |
907 | However, C++ programs often require class libraries as well as a | |
908 | compiler that understands the C++ language---and under some | |
909 | circumstances, you might want to compile programs from standard input, | |
910 | or otherwise without a suffix that flags them as C++ programs. | |
bedc7537 | 911 | @command{g++} is a program that calls GCC with the default language |
e5e809f4 | 912 | set to C++, and automatically specifies linking against the C++ |
bedc7537 NC |
913 | library. On many systems, @command{g++} is also |
914 | installed with the name @command{c++}. | |
74291a4b | 915 | |
bedc7537 | 916 | @cindex invoking @command{g++} |
74291a4b MM |
917 | When you compile C++ programs, you may specify many of the same |
918 | command-line options that you use for compiling programs in any | |
919 | language; or command-line options meaningful for C and related | |
920 | languages; or options that are meaningful only for C++ programs. | |
921 | @xref{C Dialect Options,,Options Controlling C Dialect}, for | |
161d7b59 | 922 | explanations of options for languages related to C@. |
74291a4b MM |
923 | @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for |
924 | explanations of options that are meaningful only for C++ programs. | |
925 | ||
926 | @node C Dialect Options | |
927 | @section Options Controlling C Dialect | |
928 | @cindex dialect options | |
929 | @cindex language dialect options | |
930 | @cindex options, dialect | |
931 | ||
932 | The following options control the dialect of C (or languages derived | |
2147b154 | 933 | from C, such as C++ and Objective-C) that the compiler accepts: |
74291a4b | 934 | |
2642624b | 935 | @table @gcctabopt |
74291a4b | 936 | @cindex ANSI support |
c1030c7c | 937 | @cindex ISO support |
74291a4b | 938 | @item -ansi |
cd3bb277 | 939 | @opindex ansi |
c1030c7c | 940 | In C mode, support all ISO C89 programs. In C++ mode, |
775afb25 | 941 | remove GNU extensions that conflict with ISO C++. |
74291a4b | 942 | |
c1030c7c | 943 | This turns off certain features of GCC that are incompatible with ISO |
aee96fe9 | 944 | C89 (when compiling C code), or of standard C++ (when compiling C++ code), |
0c2d1a2a | 945 | such as the @code{asm} and @code{typeof} keywords, and |
74291a4b MM |
946 | predefined macros such as @code{unix} and @code{vax} that identify the |
947 | type of system you are using. It also enables the undesirable and | |
02f52e19 | 948 | rarely used ISO trigraph feature. For the C compiler, |
0c2d1a2a | 949 | it disables recognition of C++ style @samp{//} comments as well as |
775afb25 | 950 | the @code{inline} keyword. |
74291a4b MM |
951 | |
952 | The alternate keywords @code{__asm__}, @code{__extension__}, | |
953 | @code{__inline__} and @code{__typeof__} continue to work despite | |
630d3d5a | 954 | @option{-ansi}. You would not want to use them in an ISO C program, of |
74291a4b | 955 | course, but it is useful to put them in header files that might be included |
630d3d5a | 956 | in compilations done with @option{-ansi}. Alternate predefined macros |
74291a4b | 957 | such as @code{__unix__} and @code{__vax__} are also available, with or |
630d3d5a | 958 | without @option{-ansi}. |
74291a4b | 959 | |
630d3d5a JM |
960 | The @option{-ansi} option does not cause non-ISO programs to be |
961 | rejected gratuitously. For that, @option{-pedantic} is required in | |
962 | addition to @option{-ansi}. @xref{Warning Options}. | |
74291a4b | 963 | |
630d3d5a | 964 | The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} |
74291a4b MM |
965 | option is used. Some header files may notice this macro and refrain |
966 | from declaring certain functions or defining certain macros that the | |
c1030c7c | 967 | ISO standard doesn't call for; this is to avoid interfering with any |
74291a4b MM |
968 | programs that might use these names for other things. |
969 | ||
c771326b JM |
970 | Functions which would normally be built in but do not have semantics |
971 | defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in | |
630d3d5a | 972 | functions with @option{-ansi} is used. @xref{Other Builtins,,Other |
f0523f02 | 973 | built-in functions provided by GCC}, for details of the functions |
01702459 | 974 | affected. |
74291a4b | 975 | |
49419c8f | 976 | @item -std= |
cd3bb277 | 977 | @opindex std |
aee96fe9 JM |
978 | Determine the language standard. This option is currently only |
979 | supported when compiling C@. A value for this option must be provided; | |
02f52e19 | 980 | possible values are |
3932261a | 981 | |
ee457005 | 982 | @table @samp |
aee96fe9 JM |
983 | @item c89 |
984 | @itemx iso9899:1990 | |
985 | ISO C89 (same as @option{-ansi}). | |
3043b30e ML |
986 | |
987 | @item iso9899:199409 | |
aee96fe9 | 988 | ISO C89 as modified in amendment 1. |
3043b30e | 989 | |
49419c8f | 990 | @item c99 |
aee96fe9 JM |
991 | @itemx c9x |
992 | @itemx iso9899:1999 | |
993 | @itemx iso9899:199x | |
994 | ISO C99. Note that this standard is not yet fully supported; see | |
995 | @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The | |
996 | names @samp{c9x} and @samp{iso9899:199x} are deprecated. | |
3043b30e ML |
997 | |
998 | @item gnu89 | |
aee96fe9 | 999 | Default, ISO C89 plus GNU extensions (including some C99 features). |
3043b30e | 1000 | |
49419c8f | 1001 | @item gnu99 |
7dac2f89 | 1002 | @item gnu9x |
d15a05b3 EC |
1003 | ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, |
1004 | this will become the default. The name @samp{gnu9x} is deprecated. | |
49419c8f | 1005 | |
ee457005 | 1006 | @end table |
3043b30e ML |
1007 | |
1008 | Even when this option is not specified, you can still use some of the | |
1009 | features of newer standards in so far as they do not conflict with | |
1010 | previous C standards. For example, you may use @code{__restrict__} even | |
bedc7537 | 1011 | when @option{-std=c99} is not specified. |
3932261a | 1012 | |
5490d604 JM |
1013 | The @option{-std} options specifying some version of ISO C have the same |
1014 | effects as @option{-ansi}, except that features that were not in ISO C89 | |
1015 | but are in the specified version (for example, @samp{//} comments and | |
1016 | the @code{inline} keyword in ISO C99) are not disabled. | |
1017 | ||
c1030c7c JM |
1018 | @xref{Standards,,Language Standards Supported by GCC}, for details of |
1019 | these standard versions. | |
1020 | ||
b1018de6 AO |
1021 | @item -aux-info @var{filename} |
1022 | @opindex aux-info | |
1023 | Output to the given filename prototyped declarations for all functions | |
1024 | declared and/or defined in a translation unit, including those in header | |
161d7b59 | 1025 | files. This option is silently ignored in any language other than C@. |
b1018de6 AO |
1026 | |
1027 | Besides declarations, the file indicates, in comments, the origin of | |
1028 | each declaration (source file and line), whether the declaration was | |
1029 | implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or | |
1030 | @samp{O} for old, respectively, in the first character after the line | |
1031 | number and the colon), and whether it came from a declaration or a | |
1032 | definition (@samp{C} or @samp{F}, respectively, in the following | |
1033 | character). In the case of function definitions, a K&R-style list of | |
1034 | arguments followed by their declarations is also provided, inside | |
1035 | comments, after the declaration. | |
1036 | ||
74291a4b | 1037 | @item -fno-asm |
cd3bb277 | 1038 | @opindex fno-asm |
74291a4b MM |
1039 | Do not recognize @code{asm}, @code{inline} or @code{typeof} as a |
1040 | keyword, so that code can use these words as identifiers. You can use | |
1041 | the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} | |
630d3d5a | 1042 | instead. @option{-ansi} implies @option{-fno-asm}. |
74291a4b MM |
1043 | |
1044 | In C++, this switch only affects the @code{typeof} keyword, since | |
1045 | @code{asm} and @code{inline} are standard keywords. You may want to | |
630d3d5a | 1046 | use the @option{-fno-gnu-keywords} flag instead, which has the same |
5490d604 JM |
1047 | effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this |
1048 | switch only affects the @code{asm} and @code{typeof} keywords, since | |
1049 | @code{inline} is a standard keyword in ISO C99. | |
74291a4b MM |
1050 | |
1051 | @item -fno-builtin | |
7d14c755 | 1052 | @itemx -fno-builtin-@var{function} @r{(C and Objective-C only)} |
cd3bb277 | 1053 | @opindex fno-builtin |
c771326b JM |
1054 | @cindex built-in functions |
1055 | Don't recognize built-in functions that do not begin with | |
01702459 | 1056 | @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in |
f0523f02 | 1057 | functions provided by GCC}, for details of the functions affected, |
c771326b | 1058 | including those which are not built-in functions when @option{-ansi} or |
5490d604 JM |
1059 | @option{-std} options for strict ISO C conformance are used because they |
1060 | do not have an ISO standard meaning. | |
74291a4b | 1061 | |
c771326b | 1062 | GCC normally generates special code to handle certain built-in functions |
74291a4b MM |
1063 | more efficiently; for instance, calls to @code{alloca} may become single |
1064 | instructions that adjust the stack directly, and calls to @code{memcpy} | |
1065 | may become inline copy loops. The resulting code is often both smaller | |
1066 | and faster, but since the function calls no longer appear as such, you | |
1067 | cannot set a breakpoint on those calls, nor can you change the behavior | |
1068 | of the functions by linking with a different library. | |
1069 | ||
630d3d5a | 1070 | In C++, @option{-fno-builtin} is always in effect. The @option{-fbuiltin} |
0b1161fc | 1071 | option has no effect. Therefore, in C++, the only way to get the |
c771326b | 1072 | optimization benefits of built-in functions is to call the function |
0b1161fc | 1073 | using the @samp{__builtin_} prefix. The GNU C++ Standard Library uses |
c771326b | 1074 | built-in functions to implement many functions (like |
0b1161fc MM |
1075 | @code{std::strchr}), so that you automatically get efficient code. |
1076 | ||
7d14c755 JM |
1077 | With the @option{-fno-builtin-@var{function}} option, not available |
1078 | when compiling C++, only the built-in function @var{function} is | |
1079 | disabled. @var{function} must not begin with @samp{__builtin_}. If a | |
1080 | function is named this is not built-in in this version of GCC, this | |
1081 | option is ignored. There is no corresponding | |
1082 | @option{-fbuiltin-@var{function}} option; if you wish to enable | |
1083 | built-in functions selectively when using @option{-fno-builtin} or | |
1084 | @option{-ffreestanding}, you may define macros such as: | |
1085 | ||
1086 | @smallexample | |
1087 | #define abs(n) __builtin_abs ((n)) | |
1088 | #define strcpy(d, s) __builtin_strcpy ((d), (s)) | |
1089 | @end smallexample | |
1090 | ||
861bb6c1 | 1091 | @item -fhosted |
cd3bb277 | 1092 | @opindex fhosted |
861bb6c1 JL |
1093 | @cindex hosted environment |
1094 | ||
1095 | Assert that compilation takes place in a hosted environment. This implies | |
630d3d5a | 1096 | @option{-fbuiltin}. A hosted environment is one in which the |
861bb6c1 JL |
1097 | entire standard library is available, and in which @code{main} has a return |
1098 | type of @code{int}. Examples are nearly everything except a kernel. | |
630d3d5a | 1099 | This is equivalent to @option{-fno-freestanding}. |
861bb6c1 JL |
1100 | |
1101 | @item -ffreestanding | |
cd3bb277 | 1102 | @opindex ffreestanding |
861bb6c1 JL |
1103 | @cindex hosted environment |
1104 | ||
1105 | Assert that compilation takes place in a freestanding environment. This | |
630d3d5a | 1106 | implies @option{-fno-builtin}. A freestanding environment |
861bb6c1 JL |
1107 | is one in which the standard library may not exist, and program startup may |
1108 | not necessarily be at @code{main}. The most obvious example is an OS kernel. | |
630d3d5a | 1109 | This is equivalent to @option{-fno-hosted}. |
861bb6c1 | 1110 | |
c1030c7c JM |
1111 | @xref{Standards,,Language Standards Supported by GCC}, for details of |
1112 | freestanding and hosted environments. | |
1113 | ||
74291a4b | 1114 | @item -trigraphs |
cd3bb277 | 1115 | @opindex trigraphs |
3bce8a01 NB |
1116 | Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} |
1117 | options for strict ISO C conformance) implies @option{-trigraphs}. | |
74291a4b MM |
1118 | |
1119 | @cindex traditional C language | |
1120 | @cindex C language, traditional | |
1121 | @item -traditional | |
cd3bb277 | 1122 | @opindex traditional |
74291a4b MM |
1123 | Attempt to support some aspects of traditional C compilers. |
1124 | Specifically: | |
1125 | ||
1126 | @itemize @bullet | |
1127 | @item | |
1128 | All @code{extern} declarations take effect globally even if they | |
1129 | are written inside of a function definition. This includes implicit | |
1130 | declarations of functions. | |
1131 | ||
1132 | @item | |
1133 | The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const} | |
1134 | and @code{volatile} are not recognized. (You can still use the | |
1135 | alternative keywords such as @code{__typeof__}, @code{__inline__}, and | |
1136 | so on.) | |
1137 | ||
1138 | @item | |
1139 | Comparisons between pointers and integers are always allowed. | |
1140 | ||
1141 | @item | |
1142 | Integer types @code{unsigned short} and @code{unsigned char} promote | |
1143 | to @code{unsigned int}. | |
1144 | ||
1145 | @item | |
1146 | Out-of-range floating point literals are not an error. | |
1147 | ||
1148 | @item | |
c1030c7c | 1149 | Certain constructs which ISO regards as a single invalid preprocessing |
74291a4b MM |
1150 | number, such as @samp{0xe-0xd}, are treated as expressions instead. |
1151 | ||
1152 | @item | |
1153 | String ``constants'' are not necessarily constant; they are stored in | |
1154 | writable space, and identical looking constants are allocated | |
1155 | separately. (This is the same as the effect of | |
630d3d5a | 1156 | @option{-fwritable-strings}.) |
74291a4b MM |
1157 | |
1158 | @cindex @code{longjmp} and automatic variables | |
1159 | @item | |
1160 | All automatic variables not declared @code{register} are preserved by | |
c1030c7c | 1161 | @code{longjmp}. Ordinarily, GNU C follows ISO C: automatic variables |
74291a4b MM |
1162 | not declared @code{volatile} may be clobbered. |
1163 | ||
1164 | @item | |
cd3bb277 JM |
1165 | @cindex @samp{\x} |
1166 | @cindex @samp{\a} | |
74291a4b MM |
1167 | @cindex escape sequences, traditional |
1168 | The character escape sequences @samp{\x} and @samp{\a} evaluate as the | |
1169 | literal characters @samp{x} and @samp{a} respectively. Without | |
630d3d5a | 1170 | @w{@option{-traditional}}, @samp{\x} is a prefix for the hexadecimal |
74291a4b | 1171 | representation of a character, and @samp{\a} produces a bell. |
ad299d9b | 1172 | @end itemize |
74291a4b | 1173 | |
aa99bd09 JM |
1174 | This option is deprecated and may be removed. |
1175 | ||
630d3d5a | 1176 | You may wish to use @option{-fno-builtin} as well as @option{-traditional} |
c771326b | 1177 | if your program uses names that are normally GNU C built-in functions for |
74291a4b MM |
1178 | other purposes of its own. |
1179 | ||
630d3d5a | 1180 | You cannot use @option{-traditional} if you include any header files that |
c1030c7c | 1181 | rely on ISO C features. Some vendors are starting to ship systems with |
630d3d5a | 1182 | ISO C header files and you cannot use @option{-traditional} on such |
74291a4b MM |
1183 | systems to compile files that include any system headers. |
1184 | ||
9c34dbbf | 1185 | The @option{-traditional} option also enables @option{-traditional-cpp}. |
74291a4b MM |
1186 | |
1187 | @item -traditional-cpp | |
cd3bb277 | 1188 | @opindex traditional-cpp |
74291a4b | 1189 | Attempt to support some aspects of traditional C preprocessors. |
9c34dbbf | 1190 | See the GNU CPP manual for details. |
74291a4b MM |
1191 | |
1192 | @item -fcond-mismatch | |
cd3bb277 | 1193 | @opindex fcond-mismatch |
74291a4b | 1194 | Allow conditional expressions with mismatched types in the second and |
a7537031 JM |
1195 | third arguments. The value of such an expression is void. This option |
1196 | is not supported for C++. | |
74291a4b MM |
1197 | |
1198 | @item -funsigned-char | |
cd3bb277 | 1199 | @opindex funsigned-char |
74291a4b MM |
1200 | Let the type @code{char} be unsigned, like @code{unsigned char}. |
1201 | ||
1202 | Each kind of machine has a default for what @code{char} should | |
1203 | be. It is either like @code{unsigned char} by default or like | |
1204 | @code{signed char} by default. | |
1205 | ||
1206 | Ideally, a portable program should always use @code{signed char} or | |
1207 | @code{unsigned char} when it depends on the signedness of an object. | |
1208 | But many programs have been written to use plain @code{char} and | |
1209 | expect it to be signed, or expect it to be unsigned, depending on the | |
1210 | machines they were written for. This option, and its inverse, let you | |
1211 | make such a program work with the opposite default. | |
1212 | ||
1213 | The type @code{char} is always a distinct type from each of | |
1214 | @code{signed char} or @code{unsigned char}, even though its behavior | |
1215 | is always just like one of those two. | |
1216 | ||
1217 | @item -fsigned-char | |
cd3bb277 | 1218 | @opindex fsigned-char |
74291a4b MM |
1219 | Let the type @code{char} be signed, like @code{signed char}. |
1220 | ||
630d3d5a JM |
1221 | Note that this is equivalent to @option{-fno-unsigned-char}, which is |
1222 | the negative form of @option{-funsigned-char}. Likewise, the option | |
1223 | @option{-fno-signed-char} is equivalent to @option{-funsigned-char}. | |
74291a4b | 1224 | |
74291a4b MM |
1225 | @item -fsigned-bitfields |
1226 | @itemx -funsigned-bitfields | |
1227 | @itemx -fno-signed-bitfields | |
1228 | @itemx -fno-unsigned-bitfields | |
cd3bb277 JM |
1229 | @opindex fsigned-bitfields |
1230 | @opindex funsigned-bitfields | |
1231 | @opindex fno-signed-bitfields | |
1232 | @opindex fno-unsigned-bitfields | |
c771326b | 1233 | These options control whether a bit-field is signed or unsigned, when the |
74291a4b | 1234 | declaration does not use either @code{signed} or @code{unsigned}. By |
c771326b | 1235 | default, such a bit-field is signed, because this is consistent: the |
74291a4b MM |
1236 | basic integer types such as @code{int} are signed types. |
1237 | ||
c771326b | 1238 | However, when @option{-traditional} is used, bit-fields are all unsigned |
74291a4b MM |
1239 | no matter what. |
1240 | ||
1241 | @item -fwritable-strings | |
cd3bb277 | 1242 | @opindex fwritable-strings |
74291a4b MM |
1243 | Store string constants in the writable data segment and don't uniquize |
1244 | them. This is for compatibility with old programs which assume they can | |
630d3d5a | 1245 | write into string constants. The option @option{-traditional} also has |
74291a4b MM |
1246 | this effect. |
1247 | ||
1248 | Writing into string constants is a very bad idea; ``constants'' should | |
1249 | be constant. | |
1250 | ||
1251 | @item -fallow-single-precision | |
cd3bb277 | 1252 | @opindex fallow-single-precision |
74291a4b | 1253 | Do not promote single precision math operations to double precision, |
630d3d5a | 1254 | even when compiling with @option{-traditional}. |
74291a4b MM |
1255 | |
1256 | Traditional K&R C promotes all floating point operations to double | |
1257 | precision, regardless of the sizes of the operands. On the | |
1258 | architecture for which you are compiling, single precision may be faster | |
630d3d5a | 1259 | than double precision. If you must use @option{-traditional}, but want |
74291a4b MM |
1260 | to use single precision operations when the operands are single |
1261 | precision, use this option. This option has no effect when compiling | |
c1030c7c | 1262 | with ISO or GNU C conventions (the default). |
74291a4b | 1263 | |
3e37bef5 | 1264 | @item -fshort-wchar |
cd3bb277 | 1265 | @opindex fshort-wchar |
3e37bef5 JM |
1266 | Override the underlying type for @samp{wchar_t} to be @samp{short |
1267 | unsigned int} instead of the default for the target. This option is | |
161d7b59 | 1268 | useful for building programs to run under WINE@. |
74291a4b MM |
1269 | @end table |
1270 | ||
1271 | @node C++ Dialect Options | |
1272 | @section Options Controlling C++ Dialect | |
1273 | ||
1274 | @cindex compiler options, C++ | |
1275 | @cindex C++ options, command line | |
1276 | @cindex options, C++ | |
1277 | This section describes the command-line options that are only meaningful | |
1278 | for C++ programs; but you can also use most of the GNU compiler options | |
1279 | regardless of what language your program is in. For example, you | |
1280 | might compile a file @code{firstClass.C} like this: | |
1281 | ||
1282 | @example | |
1dc5fc4b | 1283 | g++ -g -frepo -O -c firstClass.C |
74291a4b MM |
1284 | @end example |
1285 | ||
1286 | @noindent | |
630d3d5a | 1287 | In this example, only @option{-frepo} is an option meant |
74291a4b | 1288 | only for C++ programs; you can use the other options with any |
161d7b59 | 1289 | language supported by GCC@. |
74291a4b MM |
1290 | |
1291 | Here is a list of options that are @emph{only} for compiling C++ programs: | |
1292 | ||
2642624b | 1293 | @table @gcctabopt |
74291a4b | 1294 | @item -fno-access-control |
cd3bb277 | 1295 | @opindex fno-access-control |
74291a4b MM |
1296 | Turn off all access checking. This switch is mainly useful for working |
1297 | around bugs in the access control code. | |
1298 | ||
74291a4b | 1299 | @item -fcheck-new |
cd3bb277 | 1300 | @opindex fcheck-new |
74291a4b MM |
1301 | Check that the pointer returned by @code{operator new} is non-null |
1302 | before attempting to modify the storage allocated. The current Working | |
1303 | Paper requires that @code{operator new} never return a null pointer, so | |
1304 | this check is normally unnecessary. | |
1305 | ||
1dc5fc4b JM |
1306 | An alternative to using this option is to specify that your |
1307 | @code{operator new} does not throw any exceptions; if you declare it | |
aee96fe9 | 1308 | @samp{throw()}, G++ will check the return value. See also @samp{new |
1dc5fc4b JM |
1309 | (nothrow)}. |
1310 | ||
74291a4b | 1311 | @item -fconserve-space |
cd3bb277 | 1312 | @opindex fconserve-space |
74291a4b MM |
1313 | Put uninitialized or runtime-initialized global variables into the |
1314 | common segment, as C does. This saves space in the executable at the | |
1315 | cost of not diagnosing duplicate definitions. If you compile with this | |
1316 | flag and your program mysteriously crashes after @code{main()} has | |
1317 | completed, you may have an object that is being destroyed twice because | |
1318 | two definitions were merged. | |
1319 | ||
1dc5fc4b JM |
1320 | This option is no longer useful on most targets, now that support has |
1321 | been added for putting variables into BSS without making them common. | |
1322 | ||
02f52e19 | 1323 | @item -fno-const-strings |
cd3bb277 | 1324 | @opindex fno-const-strings |
fcca588c MM |
1325 | Give string constants type @code{char *} instead of type @code{const |
1326 | char *}. By default, G++ uses type @code{const char *} as required by | |
630d3d5a | 1327 | the standard. Even if you use @option{-fno-const-strings}, you cannot |
fcca588c | 1328 | actually modify the value of a string constant, unless you also use |
630d3d5a | 1329 | @option{-fwritable-strings}. |
fcca588c MM |
1330 | |
1331 | This option might be removed in a future release of G++. For maximum | |
1332 | portability, you should structure your code so that it works with | |
1333 | string constants that have type @code{const char *}. | |
1334 | ||
74291a4b | 1335 | @item -fdollars-in-identifiers |
cd3bb277 | 1336 | @opindex fdollars-in-identifiers |
74291a4b | 1337 | Accept @samp{$} in identifiers. You can also explicitly prohibit use of |
630d3d5a | 1338 | @samp{$} with the option @option{-fno-dollars-in-identifiers}. (GNU C allows |
eb795509 | 1339 | @samp{$} by default on most target systems, but there are a few exceptions.) |
74291a4b | 1340 | Traditional C allowed the character @samp{$} to form part of |
c1030c7c | 1341 | identifiers. However, ISO C and C++ forbid @samp{$} in identifiers. |
74291a4b | 1342 | |
1dc5fc4b | 1343 | @item -fno-elide-constructors |
cd3bb277 | 1344 | @opindex fno-elide-constructors |
1dc5fc4b JM |
1345 | The C++ standard allows an implementation to omit creating a temporary |
1346 | which is only used to initialize another object of the same type. | |
aee96fe9 | 1347 | Specifying this option disables that optimization, and forces G++ to |
1dc5fc4b | 1348 | call the copy constructor in all cases. |
74291a4b | 1349 | |
dd1ba632 | 1350 | @item -fno-enforce-eh-specs |
cd3bb277 | 1351 | @opindex fno-enforce-eh-specs |
dd1ba632 JM |
1352 | Don't check for violation of exception specifications at runtime. This |
1353 | option violates the C++ standard, but may be useful for reducing code | |
1354 | size in production builds, much like defining @samp{NDEBUG}. The compiler | |
1355 | will still optimize based on the exception specifications. | |
1356 | ||
74291a4b | 1357 | @item -fexternal-templates |
cd3bb277 | 1358 | @opindex fexternal-templates |
9c34dbbf ZW |
1359 | |
1360 | Cause @samp{#pragma interface} and @samp{implementation} to apply to | |
1361 | template instantiation; template instances are emitted or not according | |
74291a4b MM |
1362 | to the location of the template definition. @xref{Template |
1363 | Instantiation}, for more information. | |
1364 | ||
37f6b6bf MM |
1365 | This option is deprecated. |
1366 | ||
74291a4b | 1367 | @item -falt-external-templates |
cd3bb277 | 1368 | @opindex falt-external-templates |
9c34dbbf ZW |
1369 | Similar to @option{-fexternal-templates}, but template instances are |
1370 | emitted or not according to the place where they are first instantiated. | |
74291a4b MM |
1371 | @xref{Template Instantiation}, for more information. |
1372 | ||
37f6b6bf MM |
1373 | This option is deprecated. |
1374 | ||
74291a4b | 1375 | @item -ffor-scope |
8c81598d | 1376 | @itemx -fno-for-scope |
cd3bb277 JM |
1377 | @opindex ffor-scope |
1378 | @opindex fno-for-scope | |
695ac33f | 1379 | If @option{-ffor-scope} is specified, the scope of variables declared in |
74291a4b | 1380 | a @i{for-init-statement} is limited to the @samp{for} loop itself, |
34527c47 | 1381 | as specified by the C++ standard. |
695ac33f | 1382 | If @option{-fno-for-scope} is specified, the scope of variables declared in |
74291a4b | 1383 | a @i{for-init-statement} extends to the end of the enclosing scope, |
aee96fe9 | 1384 | as was the case in old versions of G++, and other (traditional) |
74291a4b MM |
1385 | implementations of C++. |
1386 | ||
1387 | The default if neither flag is given to follow the standard, | |
1388 | but to allow and give a warning for old-style code that would | |
1389 | otherwise be invalid, or have different behavior. | |
1390 | ||
1391 | @item -fno-gnu-keywords | |
cd3bb277 | 1392 | @opindex fno-gnu-keywords |
9762e8a4 | 1393 | Do not recognize @code{typeof} as a keyword, so that code can use this |
767094dd | 1394 | word as an identifier. You can use the keyword @code{__typeof__} instead. |
630d3d5a | 1395 | @option{-ansi} implies @option{-fno-gnu-keywords}. |
74291a4b | 1396 | |
1dc5fc4b | 1397 | @item -fno-implicit-templates |
cd3bb277 | 1398 | @opindex fno-implicit-templates |
bba975d4 | 1399 | Never emit code for non-inline templates which are instantiated |
e979f9e8 | 1400 | implicitly (i.e.@: by use); only emit code for explicit instantiations. |
bba975d4 JM |
1401 | @xref{Template Instantiation}, for more information. |
1402 | ||
1403 | @item -fno-implicit-inline-templates | |
cd3bb277 | 1404 | @opindex fno-implicit-inline-templates |
bba975d4 JM |
1405 | Don't emit code for implicit instantiations of inline templates, either. |
1406 | The default is to handle inlines differently so that compiles with and | |
1407 | without optimization will need the same set of explicit instantiations. | |
1dc5fc4b | 1408 | |
74291a4b | 1409 | @item -fno-implement-inlines |
cd3bb277 | 1410 | @opindex fno-implement-inlines |
74291a4b MM |
1411 | To save space, do not emit out-of-line copies of inline functions |
1412 | controlled by @samp{#pragma implementation}. This will cause linker | |
1413 | errors if these functions are not inlined everywhere they are called. | |
1414 | ||
631cf95d | 1415 | @item -fms-extensions |
cd3bb277 | 1416 | @opindex fms-extensions |
32fb1fb2 PE |
1417 | Disable pedantic warnings about constructs used in MFC, such as implicit |
1418 | int and getting a pointer to member function via non-standard syntax. | |
631cf95d | 1419 | |
fcca588c | 1420 | @item -fno-nonansi-builtins |
cd3bb277 | 1421 | @opindex fno-nonansi-builtins |
c771326b | 1422 | Disable built-in declarations of functions that are not mandated by |
161d7b59 | 1423 | ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, |
fcca588c MM |
1424 | @code{index}, @code{bzero}, @code{conjf}, and other related functions. |
1425 | ||
775afb25 | 1426 | @item -fno-operator-names |
cd3bb277 | 1427 | @opindex fno-operator-names |
775afb25 | 1428 | Do not treat the operator name keywords @code{and}, @code{bitand}, |
74291a4b | 1429 | @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as |
775afb25 | 1430 | synonyms as keywords. |
74291a4b | 1431 | |
4f8b4fd9 | 1432 | @item -fno-optional-diags |
cd3bb277 | 1433 | @opindex fno-optional-diags |
4f8b4fd9 | 1434 | Disable diagnostics that the standard says a compiler does not need to |
aee96fe9 | 1435 | issue. Currently, the only such diagnostic issued by G++ is the one for |
bba975d4 | 1436 | a name having multiple meanings within a class. |
4f8b4fd9 | 1437 | |
8c7707b0 | 1438 | @item -fpermissive |
cd3bb277 | 1439 | @opindex fpermissive |
8c7707b0 | 1440 | Downgrade messages about nonconformant code from errors to warnings. By |
aee96fe9 | 1441 | default, G++ effectively sets @option{-pedantic-errors} without |
630d3d5a | 1442 | @option{-pedantic}; this option reverses that. This behavior and this |
161d7b59 | 1443 | option are superseded by @option{-pedantic}, which works as it does for GNU C@. |
8c7707b0 | 1444 | |
8c81598d | 1445 | @item -frepo |
cd3bb277 | 1446 | @opindex frepo |
9c34dbbf ZW |
1447 | Enable automatic template instantiation at link time. This option also |
1448 | implies @option{-fno-implicit-templates}. @xref{Template | |
1449 | Instantiation}, for more information. | |
8c81598d | 1450 | |
8c7707b0 | 1451 | @item -fno-rtti |
cd3bb277 | 1452 | @opindex fno-rtti |
a7fbfcf9 JM |
1453 | Disable generation of information about every class with virtual |
1454 | functions for use by the C++ runtime type identification features | |
1455 | (@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts | |
1456 | of the language, you can save some space by using this flag. Note that | |
1457 | exception handling uses the same information, but it will generate it as | |
1458 | needed. | |
8c7707b0 | 1459 | |
fcca588c | 1460 | @item -fstats |
cd3bb277 | 1461 | @opindex fstats |
fcca588c MM |
1462 | Emit statistics about front-end processing at the end of the compilation. |
1463 | This information is generally only useful to the G++ development team. | |
1464 | ||
1dc5fc4b | 1465 | @item -ftemplate-depth-@var{n} |
cd3bb277 | 1466 | @opindex ftemplate-depth |
1dc5fc4b JM |
1467 | Set the maximum instantiation depth for template classes to @var{n}. |
1468 | A limit on the template instantiation depth is needed to detect | |
767094dd | 1469 | endless recursions during template class instantiation. ANSI/ISO C++ |
1dc5fc4b JM |
1470 | conforming programs must not rely on a maximum depth greater than 17. |
1471 | ||
fc693822 | 1472 | @item -fuse-cxa-atexit |
cd3bb277 | 1473 | @opindex fuse-cxa-atexit |
fc693822 MM |
1474 | Register destructors for objects with static storage duration with the |
1475 | @code{__cxa_atexit} function rather than the @code{atexit} function. | |
1476 | This option is required for fully standards-compliant handling of static | |
1477 | destructors, but will only work if your C library supports | |
1478 | @code{__cxa_atexit}. | |
1479 | ||
90ecce3e | 1480 | @item -fvtable-gc |
cd3bb277 | 1481 | @opindex fvtable-gc |
90ecce3e JM |
1482 | Emit special relocations for vtables and virtual function references |
1483 | so that the linker can identify unused virtual functions and zero out | |
1484 | vtable slots that refer to them. This is most useful with | |
630d3d5a | 1485 | @option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to |
90ecce3e | 1486 | also discard the functions themselves. |
f5a1b0d2 | 1487 | |
90ecce3e | 1488 | This optimization requires GNU as and GNU ld. Not all systems support |
630d3d5a | 1489 | this option. @option{-Wl,--gc-sections} is ignored without @option{-static}. |
861bb6c1 | 1490 | |
02f52e19 | 1491 | @item -fno-weak |
cd3bb277 | 1492 | @opindex fno-weak |
90ecce3e | 1493 | Do not use weak symbol support, even if it is provided by the linker. |
fcca588c MM |
1494 | By default, G++ will use weak symbols if they are available. This |
1495 | option exists only for testing, and should not be used by end-users; | |
1496 | it will result in inferior code and has no benefits. This option may | |
1497 | be removed in a future release of G++. | |
1498 | ||
74291a4b | 1499 | @item -nostdinc++ |
cd3bb277 | 1500 | @opindex nostdinc++ |
74291a4b MM |
1501 | Do not search for header files in the standard directories specific to |
1502 | C++, but do still search the other standard directories. (This option | |
e5e809f4 | 1503 | is used when building the C++ library.) |
74291a4b MM |
1504 | @end table |
1505 | ||
1506 | In addition, these optimization, warning, and code generation options | |
1507 | have meanings only for C++ programs: | |
1508 | ||
2642624b | 1509 | @table @gcctabopt |
74291a4b | 1510 | @item -fno-default-inline |
cd3bb277 | 1511 | @opindex fno-default-inline |
74291a4b | 1512 | Do not assume @samp{inline} for functions defined inside a class scope. |
1dc5fc4b JM |
1513 | @xref{Optimize Options,,Options That Control Optimization}. Note that these |
1514 | functions will have linkage like inline functions; they just won't be | |
1515 | inlined by default. | |
74291a4b | 1516 | |
aee96fe9 | 1517 | @item -Wctor-dtor-privacy @r{(C++ only)} |
cd3bb277 | 1518 | @opindex Wctor-dtor-privacy |
bba975d4 JM |
1519 | Warn when a class seems unusable, because all the constructors or |
1520 | destructors in a class are private and the class has no friends or | |
1521 | public static member functions. | |
1522 | ||
aee96fe9 | 1523 | @item -Wnon-virtual-dtor @r{(C++ only)} |
cd3bb277 | 1524 | @opindex Wnon-virtual-dtor |
bba975d4 JM |
1525 | Warn when a class declares a non-virtual destructor that should probably |
1526 | be virtual, because it looks like the class will be used polymorphically. | |
1527 | ||
aee96fe9 | 1528 | @item -Wreorder @r{(C++ only)} |
cd3bb277 | 1529 | @opindex Wreorder |
bba975d4 JM |
1530 | @cindex reordering, warning |
1531 | @cindex warning for reordering of member initializers | |
1532 | Warn when the order of member initializers given in the code does not | |
1533 | match the order in which they must be executed. For instance: | |
1534 | ||
1535 | @smallexample | |
1536 | struct A @{ | |
1537 | int i; | |
1538 | int j; | |
1539 | A(): j (0), i (1) @{ @} | |
1540 | @}; | |
1541 | @end smallexample | |
1542 | ||
1543 | Here the compiler will warn that the member initializers for @samp{i} | |
1544 | and @samp{j} will be rearranged to match the declaration order of the | |
1545 | members. | |
1546 | @end table | |
1547 | ||
630d3d5a | 1548 | The following @option{-W@dots{}} options are not affected by @option{-Wall}. |
bba975d4 | 1549 | |
2642624b | 1550 | @table @gcctabopt |
aee96fe9 | 1551 | @item -Weffc++ @r{(C++ only)} |
cd3bb277 | 1552 | @opindex Weffc++ |
bba975d4 JM |
1553 | Warn about violations of various style guidelines from Scott Meyers' |
1554 | @cite{Effective C++} books. If you use this option, you should be aware | |
1555 | that the standard library headers do not obey all of these guidelines; | |
1556 | you can use @samp{grep -v} to filter out those warnings. | |
1557 | ||
aee96fe9 | 1558 | @item -Wno-deprecated @r{(C++ only)} |
cd3bb277 | 1559 | @opindex Wno-deprecated |
767094dd | 1560 | Do not warn about usage of deprecated features. @xref{Deprecated Features}. |
2de45c06 | 1561 | |
aee96fe9 | 1562 | @item -Wno-non-template-friend @r{(C++ only)} |
cd3bb277 | 1563 | @opindex Wno-non-template-friend |
bba975d4 | 1564 | Disable warnings when non-templatized friend functions are declared |
767094dd | 1565 | within a template. With the advent of explicit template specification |
aee96fe9 | 1566 | support in G++, if the name of the friend is an unqualified-id (i.e., |
bba975d4 | 1567 | @samp{friend foo(int)}), the C++ language specification demands that the |
767094dd | 1568 | friend declare or define an ordinary, nontemplate function. (Section |
aee96fe9 | 1569 | 14.5.3). Before G++ implemented explicit specification, unqualified-ids |
bba975d4 | 1570 | could be interpreted as a particular specialization of a templatized |
767094dd | 1571 | function. Because this non-conforming behavior is no longer the default |
aee96fe9 | 1572 | behavior for G++, @option{-Wnon-template-friend} allows the compiler to |
bba975d4 | 1573 | check existing code for potential trouble spots, and is on by default. |
2228d450 | 1574 | This new compiler behavior can be turned off with |
630d3d5a | 1575 | @option{-Wno-non-template-friend} which keeps the conformant compiler code |
2228d450 | 1576 | but disables the helpful warning. |
bba975d4 | 1577 | |
aee96fe9 | 1578 | @item -Wold-style-cast @r{(C++ only)} |
cd3bb277 | 1579 | @opindex Wold-style-cast |
323728aa NS |
1580 | Warn if an old-style (C-style) cast to a non-void type is used within |
1581 | a C++ program. The new-style casts (@samp{static_cast}, | |
1582 | @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to | |
1583 | unintended effects, and much easier to grep for. | |
bba975d4 | 1584 | |
aee96fe9 | 1585 | @item -Woverloaded-virtual @r{(C++ only)} |
cd3bb277 | 1586 | @opindex Woverloaded-virtual |
bba975d4 JM |
1587 | @cindex overloaded virtual fn, warning |
1588 | @cindex warning for overloaded virtual fn | |
3747f3dc MM |
1589 | Warn when a function declaration hides virtual functions from a |
1590 | base class. For example, in: | |
1591 | ||
1592 | @smallexample | |
1593 | struct A @{ | |
1594 | virtual void f(); | |
1595 | @}; | |
1596 | ||
1597 | struct B: public A @{ | |
1598 | void f(int); | |
1599 | @}; | |
1600 | @end smallexample | |
1601 | ||
1602 | the @code{A} class version of @code{f} is hidden in @code{B}, and code | |
1603 | like this: | |
1604 | ||
1605 | @smallexample | |
1606 | B* b; | |
1607 | b->f(); | |
1608 | @end smallexample | |
1609 | ||
1610 | will fail to compile. | |
bba975d4 | 1611 | |
aee96fe9 | 1612 | @item -Wno-pmf-conversions @r{(C++ only)} |
cd3bb277 | 1613 | @opindex Wno-pmf-conversions |
bba975d4 JM |
1614 | Disable the diagnostic for converting a bound pointer to member function |
1615 | to a plain pointer. | |
1616 | ||
aee96fe9 | 1617 | @item -Wsign-promo @r{(C++ only)} |
cd3bb277 | 1618 | @opindex Wsign-promo |
bba975d4 JM |
1619 | Warn when overload resolution chooses a promotion from unsigned or |
1620 | enumeral type to a signed type over a conversion to an unsigned type of | |
aee96fe9 | 1621 | the same size. Previous versions of G++ would try to preserve |
bba975d4 JM |
1622 | unsignedness, but the standard mandates the current behavior. |
1623 | ||
aee96fe9 | 1624 | @item -Wsynth @r{(C++ only)} |
cd3bb277 | 1625 | @opindex Wsynth |
bba975d4 JM |
1626 | @cindex warning for synthesized methods |
1627 | @cindex synthesized methods, warning | |
aee96fe9 | 1628 | Warn when G++'s synthesis behavior does not match that of cfront. For |
bba975d4 JM |
1629 | instance: |
1630 | ||
1631 | @smallexample | |
1632 | struct A @{ | |
1633 | operator int (); | |
1634 | A& operator = (int); | |
1635 | @}; | |
1636 | ||
1637 | main () | |
1638 | @{ | |
1639 | A a,b; | |
1640 | a = b; | |
1641 | @} | |
1642 | @end smallexample | |
74291a4b | 1643 | |
aee96fe9 | 1644 | In this example, G++ will synthesize a default @samp{A& operator = |
bba975d4 | 1645 | (const A&);}, while cfront will use the user-defined @samp{operator =}. |
74291a4b MM |
1646 | @end table |
1647 | ||
60de6385 SS |
1648 | @node Objective-C Dialect Options |
1649 | @section Options Controlling Objective-C Dialect | |
1650 | ||
1651 | @cindex compiler options, Objective-C | |
1652 | @cindex Objective-C options, command line | |
1653 | @cindex options, Objective-C | |
1654 | This section describes the command-line options that are only meaningful | |
1655 | for Objective-C programs; but you can also use most of the GNU compiler | |
1656 | options regardless of what language your program is in. For example, | |
1657 | you might compile a file @code{some_class.m} like this: | |
1658 | ||
1659 | @example | |
1660 | gcc -g -fgnu-runtime -O -c some_class.m | |
1661 | @end example | |
1662 | ||
1663 | @noindent | |
630d3d5a | 1664 | In this example, only @option{-fgnu-runtime} is an option meant only for |
60de6385 | 1665 | Objective-C programs; you can use the other options with any language |
161d7b59 | 1666 | supported by GCC@. |
60de6385 SS |
1667 | |
1668 | Here is a list of options that are @emph{only} for compiling Objective-C | |
1669 | programs: | |
1670 | ||
1671 | @table @gcctabopt | |
630d3d5a | 1672 | @item -fconstant-string-class=@var{class-name} |
cd3bb277 | 1673 | @opindex fconstant-string-class |
630d3d5a | 1674 | Use @var{class-name} as the name of the class to instantiate for each |
695ac33f | 1675 | literal string specified with the syntax @code{@@"@dots{}"}. The default |
60de6385 SS |
1676 | class name is @code{NXConstantString}. |
1677 | ||
1678 | @item -fgnu-runtime | |
cd3bb277 | 1679 | @opindex fgnu-runtime |
60de6385 SS |
1680 | Generate object code compatible with the standard GNU Objective-C |
1681 | runtime. This is the default for most types of systems. | |
1682 | ||
1683 | @item -fnext-runtime | |
cd3bb277 | 1684 | @opindex fnext-runtime |
60de6385 | 1685 | Generate output compatible with the NeXT runtime. This is the default |
161d7b59 | 1686 | for NeXT-based systems, including Darwin and Mac OS X@. |
60de6385 SS |
1687 | |
1688 | @item -gen-decls | |
cd3bb277 | 1689 | @opindex gen-decls |
60de6385 SS |
1690 | Dump interface declarations for all classes seen in the source file to a |
1691 | file named @file{@var{sourcename}.decl}. | |
1692 | ||
1693 | @item -Wno-protocol | |
cd3bb277 | 1694 | @opindex Wno-protocol |
60de6385 SS |
1695 | Do not warn if methods required by a protocol are not implemented |
1696 | in the class adopting it. | |
1697 | ||
1698 | @item -Wselector | |
cd3bb277 | 1699 | @opindex Wselector |
60de6385 SS |
1700 | Warn if a selector has multiple methods of different types defined. |
1701 | ||
1702 | @c not documented because only avail via -Wp | |
1703 | @c @item -print-objc-runtime-info | |
1704 | ||
1705 | @end table | |
1706 | ||
764dbbf2 GDR |
1707 | @node Language Independent Options |
1708 | @section Options to Control Diagnostic Messages Formatting | |
1709 | @cindex options to control diagnostics formatting | |
1710 | @cindex diagnostic messages | |
1711 | @cindex message formatting | |
1712 | ||
b192711e | 1713 | Traditionally, diagnostic messages have been formatted irrespective of |
e979f9e8 | 1714 | the output device's aspect (e.g.@: its width, @dots{}). The options described |
764dbbf2 | 1715 | below can be used to control the diagnostic messages formatting |
e979f9e8 | 1716 | algorithm, e.g.@: how many characters per line, how often source location |
6c0a4eab | 1717 | information should be reported. Right now, only the C++ front end can |
764dbbf2 | 1718 | honor these options. However it is expected, in the near future, that |
6c0a4eab | 1719 | the remaining front ends would be able to digest them correctly. |
764dbbf2 | 1720 | |
2642624b | 1721 | @table @gcctabopt |
764dbbf2 | 1722 | @item -fmessage-length=@var{n} |
cd3bb277 | 1723 | @opindex fmessage-length |
764dbbf2 | 1724 | Try to format error messages so that they fit on lines of about @var{n} |
aee96fe9 | 1725 | characters. The default is 72 characters for @command{g++} and 0 for the rest of |
161d7b59 | 1726 | the front ends supported by GCC@. If @var{n} is zero, then no |
02f52e19 | 1727 | line-wrapping will be done; each error message will appear on a single |
764dbbf2 GDR |
1728 | line. |
1729 | ||
cd3bb277 | 1730 | @opindex fdiagnostics-show-location |
764dbbf2 | 1731 | @item -fdiagnostics-show-location=once |
b192711e | 1732 | Only meaningful in line-wrapping mode. Instructs the diagnostic messages |
764dbbf2 GDR |
1733 | reporter to emit @emph{once} source location information; that is, in |
1734 | case the message is too long to fit on a single physical line and has to | |
1735 | be wrapped, the source location won't be emitted (as prefix) again, | |
1736 | over and over, in subsequent continuation lines. This is the default | |
c21cd8b1 | 1737 | behavior. |
764dbbf2 GDR |
1738 | |
1739 | @item -fdiagnostics-show-location=every-line | |
1740 | Only meaningful in line-wrapping mode. Instructs the diagnostic | |
1741 | messages reporter to emit the same source location information (as | |
4fe9b91c | 1742 | prefix) for physical lines that result from the process of breaking |
b192711e | 1743 | a message which is too long to fit on a single line. |
764dbbf2 GDR |
1744 | |
1745 | @end table | |
1746 | ||
74291a4b MM |
1747 | @node Warning Options |
1748 | @section Options to Request or Suppress Warnings | |
1749 | @cindex options to control warnings | |
1750 | @cindex warning messages | |
1751 | @cindex messages, warning | |
1752 | @cindex suppressing warnings | |
1753 | ||
1754 | Warnings are diagnostic messages that report constructions which | |
1755 | are not inherently erroneous but which are risky or suggest there | |
1756 | may have been an error. | |
1757 | ||
1758 | You can request many specific warnings with options beginning @samp{-W}, | |
630d3d5a | 1759 | for example @option{-Wimplicit} to request warnings on implicit |
74291a4b MM |
1760 | declarations. Each of these specific warning options also has a |
1761 | negative form beginning @samp{-Wno-} to turn off warnings; | |
630d3d5a | 1762 | for example, @option{-Wno-implicit}. This manual lists only one of the |
74291a4b MM |
1763 | two forms, whichever is not the default. |
1764 | ||
0c2d1a2a | 1765 | These options control the amount and kinds of warnings produced by GCC: |
74291a4b | 1766 | |
2642624b | 1767 | @table @gcctabopt |
74291a4b MM |
1768 | @cindex syntax checking |
1769 | @item -fsyntax-only | |
cd3bb277 | 1770 | @opindex fsyntax-only |
74291a4b MM |
1771 | Check the code for syntax errors, but don't do anything beyond that. |
1772 | ||
1773 | @item -pedantic | |
cd3bb277 | 1774 | @opindex pedantic |
074e95e3 JM |
1775 | Issue all the warnings demanded by strict ISO C and ISO C++; |
1776 | reject all programs that use forbidden extensions, and some other | |
1777 | programs that do not follow ISO C and ISO C++. For ISO C, follows the | |
630d3d5a | 1778 | version of the ISO C standard specified by any @option{-std} option used. |
74291a4b | 1779 | |
074e95e3 | 1780 | Valid ISO C and ISO C++ programs should compile properly with or without |
5490d604 | 1781 | this option (though a rare few will require @option{-ansi} or a |
161d7b59 | 1782 | @option{-std} option specifying the required version of ISO C)@. However, |
b1d16193 JL |
1783 | without this option, certain GNU extensions and traditional C and C++ |
1784 | features are supported as well. With this option, they are rejected. | |
74291a4b | 1785 | |
630d3d5a | 1786 | @option{-pedantic} does not cause warning messages for use of the |
74291a4b MM |
1787 | alternate keywords whose names begin and end with @samp{__}. Pedantic |
1788 | warnings are also disabled in the expression that follows | |
1789 | @code{__extension__}. However, only system header files should use | |
1790 | these escape routes; application programs should avoid them. | |
1791 | @xref{Alternate Keywords}. | |
1792 | ||
630d3d5a | 1793 | Some users try to use @option{-pedantic} to check programs for strict ISO |
74291a4b | 1794 | C conformance. They soon find that it does not do quite what they want: |
c1030c7c | 1795 | it finds some non-ISO practices, but not all---only those for which |
074e95e3 JM |
1796 | ISO C @emph{requires} a diagnostic, and some others for which |
1797 | diagnostics have been added. | |
74291a4b | 1798 | |
074e95e3 | 1799 | A feature to report any failure to conform to ISO C might be useful in |
74291a4b | 1800 | some instances, but would require considerable additional work and would |
630d3d5a | 1801 | be quite different from @option{-pedantic}. We don't have plans to |
892d0a6d | 1802 | support such a feature in the near future. |
74291a4b | 1803 | |
91ea548a JM |
1804 | Where the standard specified with @option{-std} represents a GNU |
1805 | extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a | |
1806 | corresponding @dfn{base standard}, the version of ISO C on which the GNU | |
1807 | extended dialect is based. Warnings from @option{-pedantic} are given | |
1808 | where they are required by the base standard. (It would not make sense | |
1809 | for such warnings to be given only for features not in the specified GNU | |
1810 | C dialect, since by definition the GNU dialects of C include all | |
1811 | features the compiler supports with the given option, and there would be | |
1812 | nothing to warn about.) | |
1813 | ||
74291a4b | 1814 | @item -pedantic-errors |
cd3bb277 | 1815 | @opindex pedantic-errors |
630d3d5a | 1816 | Like @option{-pedantic}, except that errors are produced rather than |
74291a4b MM |
1817 | warnings. |
1818 | ||
1819 | @item -w | |
cd3bb277 | 1820 | @opindex w |
74291a4b MM |
1821 | Inhibit all warning messages. |
1822 | ||
1823 | @item -Wno-import | |
cd3bb277 | 1824 | @opindex Wno-import |
74291a4b MM |
1825 | Inhibit warning messages about the use of @samp{#import}. |
1826 | ||
1827 | @item -Wchar-subscripts | |
cd3bb277 | 1828 | @opindex Wchar-subscripts |
74291a4b MM |
1829 | Warn if an array subscript has type @code{char}. This is a common cause |
1830 | of error, as programmers often forget that this type is signed on some | |
1831 | machines. | |
1832 | ||
1833 | @item -Wcomment | |
cd3bb277 | 1834 | @opindex Wcomment |
74291a4b MM |
1835 | Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} |
1836 | comment, or whenever a Backslash-Newline appears in a @samp{//} comment. | |
1837 | ||
1838 | @item -Wformat | |
cd3bb277 | 1839 | @opindex Wformat |
74291a4b MM |
1840 | Check calls to @code{printf} and @code{scanf}, etc., to make sure that |
1841 | the arguments supplied have types appropriate to the format string | |
26f6672d JM |
1842 | specified, and that the conversions specified in the format string make |
1843 | sense. This includes standard functions, and others specified by format | |
1844 | attributes (@pxref{Function Attributes}), in the @code{printf}, | |
1845 | @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, | |
1846 | not in the C standard) families. | |
74291a4b | 1847 | |
8308e0b7 JM |
1848 | The formats are checked against the format features supported by GNU |
1849 | libc version 2.2. These include all ISO C89 and C99 features, as well | |
1850 | as features from the Single Unix Specification and some BSD and GNU | |
1851 | extensions. Other library implementations may not support all these | |
1852 | features; GCC does not support warning about features that go beyond a | |
630d3d5a JM |
1853 | particular library's limitations. However, if @option{-pedantic} is used |
1854 | with @option{-Wformat}, warnings will be given about format features not | |
26f6672d JM |
1855 | in the selected standard version (but not for @code{strfmon} formats, |
1856 | since those are not in any version of the C standard). @xref{C Dialect | |
1857 | Options,,Options Controlling C Dialect}. | |
8308e0b7 | 1858 | |
630d3d5a JM |
1859 | @option{-Wformat} is included in @option{-Wall}. For more control over some |
1860 | aspects of format checking, the options @option{-Wno-format-y2k}, | |
1861 | @option{-Wno-format-extra-args}, @option{-Wformat-nonliteral}, | |
1862 | @option{-Wformat-security} and @option{-Wformat=2} are available, but are | |
1863 | not included in @option{-Wall}. | |
4d808927 JM |
1864 | |
1865 | @item -Wno-format-y2k | |
cd3bb277 | 1866 | @opindex Wno-format-y2k |
630d3d5a | 1867 | If @option{-Wformat} is specified, do not warn about @code{strftime} |
4d808927 JM |
1868 | formats which may yield only a two-digit year. |
1869 | ||
1870 | @item -Wno-format-extra-args | |
cd3bb277 | 1871 | @opindex Wno-format-extra-args |
630d3d5a | 1872 | If @option{-Wformat} is specified, do not warn about excess arguments to a |
4d808927 JM |
1873 | @code{printf} or @code{scanf} format function. The C standard specifies |
1874 | that such arguments are ignored. | |
1875 | ||
7e5fb12f JM |
1876 | Where the unused arguments lie between used arguments that are |
1877 | specified with @samp{$} operand number specifications, normally | |
1878 | warnings are still given, since the implementation could not know what | |
1879 | type to pass to @code{va_arg} to skip the unused arguments. However, | |
1880 | in the case of @code{scanf} formats, this option will suppress the | |
1881 | warning if the unused arguments are all pointers, since the Single | |
1882 | Unix Specification says that such unused arguments are allowed. | |
1883 | ||
4d808927 | 1884 | @item -Wformat-nonliteral |
cd3bb277 | 1885 | @opindex Wformat-nonliteral |
630d3d5a | 1886 | If @option{-Wformat} is specified, also warn if the format string is not a |
4d808927 JM |
1887 | string literal and so cannot be checked, unless the format function |
1888 | takes its format arguments as a @code{va_list}. | |
1889 | ||
c907e684 | 1890 | @item -Wformat-security |
cd3bb277 | 1891 | @opindex Wformat-security |
630d3d5a | 1892 | If @option{-Wformat} is specified, also warn about uses of format |
c907e684 JM |
1893 | functions that represent possible security problems. At present, this |
1894 | warns about calls to @code{printf} and @code{scanf} functions where the | |
1895 | format string is not a string literal and there are no format arguments, | |
1896 | as in @code{printf (foo);}. This may be a security hole if the format | |
1897 | string came from untrusted input and contains @samp{%n}. (This is | |
630d3d5a JM |
1898 | currently a subset of what @option{-Wformat-nonliteral} warns about, but |
1899 | in future warnings may be added to @option{-Wformat-security} that are not | |
1900 | included in @option{-Wformat-nonliteral}.) | |
c907e684 | 1901 | |
4d808927 | 1902 | @item -Wformat=2 |
cd3bb277 | 1903 | @opindex Wformat=2 |
630d3d5a JM |
1904 | Enable @option{-Wformat} plus format checks not included in |
1905 | @option{-Wformat}. Currently equivalent to @samp{-Wformat | |
c907e684 | 1906 | -Wformat-nonliteral -Wformat-security}. |
4d808927 | 1907 | |
e9a25f70 | 1908 | @item -Wimplicit-int |
cd3bb277 | 1909 | @opindex Wimplicit-int |
e9a25f70 JL |
1910 | Warn when a declaration does not specify a type. |
1911 | ||
f5963e61 JL |
1912 | @item -Wimplicit-function-declaration |
1913 | @itemx -Werror-implicit-function-declaration | |
cd3bb277 JM |
1914 | @opindex Wimplicit-function-declaration |
1915 | @opindex Werror-implicit-function-declaration | |
f5963e61 JL |
1916 | Give a warning (or error) whenever a function is used before being |
1917 | declared. | |
e9a25f70 | 1918 | |
74291a4b | 1919 | @item -Wimplicit |
cd3bb277 | 1920 | @opindex Wimplicit |
630d3d5a | 1921 | Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. |
861bb6c1 JL |
1922 | |
1923 | @item -Wmain | |
cd3bb277 | 1924 | @opindex Wmain |
861bb6c1 JL |
1925 | Warn if the type of @samp{main} is suspicious. @samp{main} should be a |
1926 | function with external linkage, returning int, taking either zero | |
1927 | arguments, two, or three arguments of appropriate types. | |
4a870dba | 1928 | |
1f0c3120 | 1929 | @item -Wmissing-braces |
cd3bb277 | 1930 | @opindex Wmissing-braces |
1f0c3120 JM |
1931 | Warn if an aggregate or union initializer is not fully bracketed. In |
1932 | the following example, the initializer for @samp{a} is not fully | |
1933 | bracketed, but that for @samp{b} is fully bracketed. | |
1934 | ||
1935 | @smallexample | |
1936 | int a[2][2] = @{ 0, 1, 2, 3 @}; | |
1937 | int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; | |
1938 | @end smallexample | |
1939 | ||
74291a4b | 1940 | @item -Wparentheses |
cd3bb277 | 1941 | @opindex Wparentheses |
74291a4b MM |
1942 | Warn if parentheses are omitted in certain contexts, such |
1943 | as when there is an assignment in a context where a truth value | |
1944 | is expected, or when operators are nested whose precedence people | |
1945 | often get confused about. | |
1946 | ||
e9a25f70 JL |
1947 | Also warn about constructions where there may be confusion to which |
1948 | @code{if} statement an @code{else} branch belongs. Here is an example of | |
1949 | such a case: | |
1950 | ||
1951 | @smallexample | |
aee96fe9 | 1952 | @group |
e9a25f70 JL |
1953 | @{ |
1954 | if (a) | |
1955 | if (b) | |
1956 | foo (); | |
1957 | else | |
1958 | bar (); | |
1959 | @} | |
aee96fe9 | 1960 | @end group |
e9a25f70 JL |
1961 | @end smallexample |
1962 | ||
1963 | In C, every @code{else} branch belongs to the innermost possible @code{if} | |
1964 | statement, which in this example is @code{if (b)}. This is often not | |
1965 | what the programmer expected, as illustrated in the above example by | |
1966 | indentation the programmer chose. When there is the potential for this | |
f0523f02 | 1967 | confusion, GCC will issue a warning when this flag is specified. |
e9a25f70 JL |
1968 | To eliminate the warning, add explicit braces around the innermost |
1969 | @code{if} statement so there is no way the @code{else} could belong to | |
1970 | the enclosing @code{if}. The resulting code would look like this: | |
1971 | ||
1972 | @smallexample | |
aee96fe9 | 1973 | @group |
e9a25f70 JL |
1974 | @{ |
1975 | if (a) | |
1976 | @{ | |
1977 | if (b) | |
1978 | foo (); | |
1979 | else | |
1980 | bar (); | |
1981 | @} | |
1982 | @} | |
aee96fe9 | 1983 | @end group |
e9a25f70 JL |
1984 | @end smallexample |
1985 | ||
bb58bec5 | 1986 | @item -Wsequence-point |
cd3bb277 | 1987 | @opindex Wsequence-point |
bb58bec5 JM |
1988 | Warn about code that may have undefined semantics because of violations |
1989 | of sequence point rules in the C standard. | |
1990 | ||
1991 | The C standard defines the order in which expressions in a C program are | |
1992 | evaluated in terms of @dfn{sequence points}, which represent a partial | |
1993 | ordering between the execution of parts of the program: those executed | |
1994 | before the sequence point, and those executed after it. These occur | |
1995 | after the evaluation of a full expression (one which is not part of a | |
1996 | larger expression), after the evaluation of the first operand of a | |
1997 | @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a | |
1998 | function is called (but after the evaluation of its arguments and the | |
1999 | expression denoting the called function), and in certain other places. | |
2000 | Other than as expressed by the sequence point rules, the order of | |
2001 | evaluation of subexpressions of an expression is not specified. All | |
2002 | these rules describe only a partial order rather than a total order, | |
2003 | since, for example, if two functions are called within one expression | |
2004 | with no sequence point between them, the order in which the functions | |
2005 | are called is not specified. However, the standards committee have | |
2006 | ruled that function calls do not overlap. | |
2007 | ||
2008 | It is not specified when between sequence points modifications to the | |
2009 | values of objects take effect. Programs whose behavior depends on this | |
2010 | have undefined behavior; the C standard specifies that ``Between the | |
2011 | previous and next sequence point an object shall have its stored value | |
2012 | modified at most once by the evaluation of an expression. Furthermore, | |
2013 | the prior value shall be read only to determine the value to be | |
2014 | stored.''. If a program breaks these rules, the results on any | |
2015 | particular implementation are entirely unpredictable. | |
2016 | ||
2017 | Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] | |
2018 | = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not | |
2019 | diagnosed by this option, and it may give an occasional false positive | |
2020 | result, but in general it has been found fairly effective at detecting | |
2021 | this sort of problem in programs. | |
2022 | ||
2023 | The present implementation of this option only works for C programs. A | |
2024 | future implementation may also work for C++ programs. | |
2025 | ||
9c34dbbf ZW |
2026 | The C standard is worded confusingly, therefore there is some debate |
2027 | over the precise meaning of the sequence point rules in subtle cases. | |
2028 | Links to discussions of the problem, including proposed formal | |
2029 | definitions, may be found on our readings page, at | |
c5122d75 | 2030 | @w{@uref{http://gcc.gnu.org/readings.html}}. |
bb58bec5 | 2031 | |
74291a4b | 2032 | @item -Wreturn-type |
cd3bb277 | 2033 | @opindex Wreturn-type |
32c4c36c ML |
2034 | Warn whenever a function is defined with a return-type that defaults to |
2035 | @code{int}. Also warn about any @code{return} statement with no | |
02f52e19 | 2036 | return-value in a function whose return-type is not @code{void}. |
32c4c36c ML |
2037 | |
2038 | For C++, a function without return type always produces a diagnostic | |
767094dd | 2039 | message, even when @option{-Wno-return-type} is specified. The only |
32c4c36c | 2040 | exceptions are @samp{main} and functions defined in system headers. |
74291a4b MM |
2041 | |
2042 | @item -Wswitch | |
cd3bb277 | 2043 | @opindex Wswitch |
74291a4b MM |
2044 | Warn whenever a @code{switch} statement has an index of enumeral type |
2045 | and lacks a @code{case} for one or more of the named codes of that | |
2046 | enumeration. (The presence of a @code{default} label prevents this | |
2047 | warning.) @code{case} labels outside the enumeration range also | |
2048 | provoke warnings when this option is used. | |
2049 | ||
2050 | @item -Wtrigraphs | |
cd3bb277 | 2051 | @opindex Wtrigraphs |
f2ecb02d JM |
2052 | Warn if any trigraphs are encountered that might change the meaning of |
2053 | the program (trigraphs within comments are not warned about). | |
74291a4b | 2054 | |
078721e1 | 2055 | @item -Wunused-function |
cd3bb277 | 2056 | @opindex Wunused-function |
078721e1 AC |
2057 | Warn whenever a static function is declared but not defined or a |
2058 | non\-inline static function is unused. | |
74291a4b | 2059 | |
078721e1 | 2060 | @item -Wunused-label |
cd3bb277 | 2061 | @opindex Wunused-label |
078721e1 AC |
2062 | Warn whenever a label is declared but not used. |
2063 | ||
2064 | To suppress this warning use the @samp{unused} attribute | |
2065 | (@pxref{Variable Attributes}). | |
2066 | ||
2067 | @item -Wunused-parameter | |
cd3bb277 | 2068 | @opindex Wunused-parameter |
078721e1 AC |
2069 | Warn whenever a function parameter is unused aside from its declaration. |
2070 | ||
2071 | To suppress this warning use the @samp{unused} attribute | |
2072 | (@pxref{Variable Attributes}). | |
956d6950 | 2073 | |
078721e1 | 2074 | @item -Wunused-variable |
cd3bb277 | 2075 | @opindex Wunused-variable |
078721e1 AC |
2076 | Warn whenever a local variable or non-constant static variable is unused |
2077 | aside from its declaration | |
2078 | ||
2079 | To suppress this warning use the @samp{unused} attribute | |
74291a4b MM |
2080 | (@pxref{Variable Attributes}). |
2081 | ||
078721e1 | 2082 | @item -Wunused-value |
cd3bb277 | 2083 | @opindex Wunused-value |
078721e1 AC |
2084 | Warn whenever a statement computes a result that is explicitly not used. |
2085 | ||
2086 | To suppress this warning cast the expression to @samp{void}. | |
2087 | ||
2088 | @item -Wunused | |
cd3bb277 | 2089 | @opindex Wunused |
630d3d5a | 2090 | All all the above @option{-Wunused} options combined. |
078721e1 AC |
2091 | |
2092 | In order to get a warning about an unused function parameter, you must | |
b192711e | 2093 | either specify @samp{-W -Wunused} or separately specify |
630d3d5a | 2094 | @option{-Wunused-parameter}. |
078721e1 | 2095 | |
74291a4b | 2096 | @item -Wuninitialized |
cd3bb277 | 2097 | @opindex Wuninitialized |
c5c76735 JL |
2098 | Warn if an automatic variable is used without first being initialized or |
2099 | if a variable may be clobbered by a @code{setjmp} call. | |
74291a4b MM |
2100 | |
2101 | These warnings are possible only in optimizing compilation, | |
2102 | because they require data flow information that is computed only | |
630d3d5a | 2103 | when optimizing. If you don't specify @option{-O}, you simply won't |
74291a4b MM |
2104 | get these warnings. |
2105 | ||
2106 | These warnings occur only for variables that are candidates for | |
2107 | register allocation. Therefore, they do not occur for a variable that | |
2108 | is declared @code{volatile}, or whose address is taken, or whose size | |
2109 | is other than 1, 2, 4 or 8 bytes. Also, they do not occur for | |
2110 | structures, unions or arrays, even when they are in registers. | |
2111 | ||
2112 | Note that there may be no warning about a variable that is used only | |
2113 | to compute a value that itself is never used, because such | |
2114 | computations may be deleted by data flow analysis before the warnings | |
2115 | are printed. | |
2116 | ||
0c2d1a2a | 2117 | These warnings are made optional because GCC is not smart |
74291a4b MM |
2118 | enough to see all the reasons why the code might be correct |
2119 | despite appearing to have an error. Here is one example of how | |
2120 | this can happen: | |
2121 | ||
2122 | @smallexample | |
aee96fe9 | 2123 | @group |
74291a4b MM |
2124 | @{ |
2125 | int x; | |
2126 | switch (y) | |
2127 | @{ | |
2128 | case 1: x = 1; | |
2129 | break; | |
2130 | case 2: x = 4; | |
2131 | break; | |
2132 | case 3: x = 5; | |
2133 | @} | |
2134 | foo (x); | |
2135 | @} | |
aee96fe9 | 2136 | @end group |
74291a4b MM |
2137 | @end smallexample |
2138 | ||
2139 | @noindent | |
2140 | If the value of @code{y} is always 1, 2 or 3, then @code{x} is | |
0c2d1a2a | 2141 | always initialized, but GCC doesn't know this. Here is |
74291a4b MM |
2142 | another common case: |
2143 | ||
2144 | @smallexample | |
2145 | @{ | |
2146 | int save_y; | |
2147 | if (change_y) save_y = y, y = new_y; | |
2148 | @dots{} | |
2149 | if (change_y) y = save_y; | |
2150 | @} | |
2151 | @end smallexample | |
2152 | ||
2153 | @noindent | |
2154 | This has no bug because @code{save_y} is used only if it is set. | |
2155 | ||
20300b05 | 2156 | @cindex @code{longjmp} warnings |
b192711e | 2157 | This option also warns when a non-volatile automatic variable might be |
c5c76735 JL |
2158 | changed by a call to @code{longjmp}. These warnings as well are possible |
2159 | only in optimizing compilation. | |
20300b05 GK |
2160 | |
2161 | The compiler sees only the calls to @code{setjmp}. It cannot know | |
2162 | where @code{longjmp} will be called; in fact, a signal handler could | |
2163 | call it at any point in the code. As a result, you may get a warning | |
2164 | even when there is in fact no problem because @code{longjmp} cannot | |
2165 | in fact be called at the place which would cause a problem. | |
2166 | ||
74291a4b MM |
2167 | Some spurious warnings can be avoided if you declare all the functions |
2168 | you use that never return as @code{noreturn}. @xref{Function | |
2169 | Attributes}. | |
2170 | ||
aee96fe9 | 2171 | @item -Wreorder @r{(C++ only)} |
cd3bb277 | 2172 | @opindex Wreorder |
c5c76735 JL |
2173 | @cindex reordering, warning |
2174 | @cindex warning for reordering of member initializers | |
2175 | Warn when the order of member initializers given in the code does not | |
2176 | match the order in which they must be executed. For instance: | |
2177 | ||
d300e551 | 2178 | @item -Wunknown-pragmas |
cd3bb277 | 2179 | @opindex Wunknown-pragmas |
d300e551 NC |
2180 | @cindex warning for unknown pragmas |
2181 | @cindex unknown pragmas, warning | |
2182 | @cindex pragmas, warning of unknown | |
2183 | Warn when a #pragma directive is encountered which is not understood by | |
161d7b59 | 2184 | GCC@. If this command line option is used, warnings will even be issued |
d300e551 | 2185 | for unknown pragmas in system header files. This is not the case if |
630d3d5a | 2186 | the warnings were only enabled by the @option{-Wall} command line option. |
d300e551 | 2187 | |
74291a4b | 2188 | @item -Wall |
cd3bb277 | 2189 | @opindex Wall |
74291a4b MM |
2190 | All of the above @samp{-W} options combined. This enables all the |
2191 | warnings about constructions that some users consider questionable, and | |
2192 | that are easy to avoid (or modify to prevent the warning), even in | |
2193 | conjunction with macros. | |
317639a8 | 2194 | |
6c36d76b NB |
2195 | @item -Wdiv-by-zero |
2196 | @opindex Wno-div-by-zero | |
2197 | @opindex Wdiv-by-zero | |
2198 | Warn about compile-time integer division by zero. This is default. To | |
2199 | inhibit the warning messages, use @option{-Wno-div-by-zero}. Floating | |
2200 | point division by zero is not warned about, as it can be a legitimate | |
2201 | way of obtaining infinities and NaNs. | |
2202 | ||
2203 | @item -Wmultichar | |
2204 | @opindex Wno-multichar | |
2205 | @opindex Wmultichar | |
2206 | Warn if a multicharacter constant (@samp{'FOOF'}) is used. This is | |
2207 | default. To inhibit the warning messages, use @option{-Wno-multichar}. | |
2208 | Usually they indicate a typo in the user's code, as they have | |
2209 | implementation-defined values, and should not be used in portable code. | |
2210 | ||
317639a8 | 2211 | @item -Wsystem-headers |
cd3bb277 | 2212 | @opindex Wsystem-headers |
317639a8 BC |
2213 | @cindex warnings from system headers |
2214 | @cindex system headers, warnings from | |
2215 | Print warning messages for constructs found in system header files. | |
2216 | Warnings from system headers are normally suppressed, on the assumption | |
2217 | that they usually do not indicate real problems and would only make the | |
2218 | compiler output harder to read. Using this command line option tells | |
2219 | GCC to emit warnings from system headers as if they occurred in user | |
630d3d5a | 2220 | code. However, note that using @option{-Wall} in conjunction with this |
317639a8 | 2221 | option will @emph{not} warn about unknown pragmas in system |
630d3d5a | 2222 | headers---for that, @option{-Wunknown-pragmas} must also be used. |
74291a4b MM |
2223 | @end table |
2224 | ||
630d3d5a | 2225 | The following @option{-W@dots{}} options are not implied by @option{-Wall}. |
74291a4b MM |
2226 | Some of them warn about constructions that users generally do not |
2227 | consider questionable, but which occasionally you might wish to check | |
2228 | for; others warn about constructions that are necessary or hard to avoid | |
2229 | in some cases, and there is no simple way to modify the code to suppress | |
2230 | the warning. | |
2231 | ||
2642624b | 2232 | @table @gcctabopt |
74291a4b | 2233 | @item -W |
cd3bb277 | 2234 | @opindex W |
74291a4b MM |
2235 | Print extra warning messages for these events: |
2236 | ||
2237 | @itemize @bullet | |
74291a4b MM |
2238 | @item |
2239 | A function can return either with or without a value. (Falling | |
2240 | off the end of the function body is considered returning without | |
2241 | a value.) For example, this function would evoke such a | |
2242 | warning: | |
2243 | ||
2244 | @smallexample | |
2245 | @group | |
2246 | foo (a) | |
2247 | @{ | |
2248 | if (a > 0) | |
2249 | return a; | |
2250 | @} | |
2251 | @end group | |
2252 | @end smallexample | |
2253 | ||
2254 | @item | |
2255 | An expression-statement or the left-hand side of a comma expression | |
2256 | contains no side effects. | |
2257 | To suppress the warning, cast the unused expression to void. | |
2258 | For example, an expression such as @samp{x[i,j]} will cause a warning, | |
2259 | but @samp{x[(void)i,j]} will not. | |
2260 | ||
2261 | @item | |
2262 | An unsigned value is compared against zero with @samp{<} or @samp{<=}. | |
2263 | ||
2264 | @item | |
2265 | A comparison like @samp{x<=y<=z} appears; this is equivalent to | |
2266 | @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from | |
2267 | that of ordinary mathematical notation. | |
2268 | ||
2269 | @item | |
2270 | Storage-class specifiers like @code{static} are not the first things in | |
2271 | a declaration. According to the C Standard, this usage is obsolescent. | |
2272 | ||
e0c9fbb7 JM |
2273 | @item |
2274 | The return type of a function has a type qualifier such as @code{const}. | |
2275 | Such a type qualifier has no effect, since the value returned by a | |
2276 | function is not an lvalue. (But don't warn about the GNU extension of | |
2277 | @code{volatile void} return types. That extension will be warned about | |
630d3d5a | 2278 | if @option{-pedantic} is specified.) |
e0c9fbb7 | 2279 | |
74291a4b | 2280 | @item |
630d3d5a | 2281 | If @option{-Wall} or @option{-Wunused} is also specified, warn about unused |
74291a4b MM |
2282 | arguments. |
2283 | ||
e9a25f70 JL |
2284 | @item |
2285 | A comparison between signed and unsigned values could produce an | |
2286 | incorrect result when the signed value is converted to unsigned. | |
630d3d5a | 2287 | (But don't warn if @option{-Wno-sign-compare} is also specified.) |
e9a25f70 | 2288 | |
74291a4b MM |
2289 | @item |
2290 | An aggregate has a partly bracketed initializer. | |
2291 | For example, the following code would evoke such a warning, | |
2292 | because braces are missing around the initializer for @code{x.h}: | |
2293 | ||
2294 | @smallexample | |
2295 | struct s @{ int f, g; @}; | |
2296 | struct t @{ struct s h; int i; @}; | |
2297 | struct t x = @{ 1, 2, 3 @}; | |
2298 | @end smallexample | |
dbde0d5d BH |
2299 | |
2300 | @item | |
2301 | An aggregate has an initializer which does not initialize all members. | |
2302 | For example, the following code would cause such a warning, because | |
2303 | @code{x.h} would be implicitly initialized to zero: | |
2304 | ||
2305 | @smallexample | |
2306 | struct s @{ int f, g, h; @}; | |
2307 | struct s x = @{ 3, 4 @}; | |
2308 | @end smallexample | |
74291a4b MM |
2309 | @end itemize |
2310 | ||
f793a95e | 2311 | @item -Wfloat-equal |
cd3bb277 | 2312 | @opindex Wfloat-equal |
f793a95e JL |
2313 | Warn if floating point values are used in equality comparisons. |
2314 | ||
488d3985 GK |
2315 | The idea behind this is that sometimes it is convenient (for the |
2316 | programmer) to consider floating-point values as approximations to | |
2317 | infinitely precise real numbers. If you are doing this, then you need | |
2318 | to compute (by analysing the code, or in some other way) the maximum or | |
2319 | likely maximum error that the computation introduces, and allow for it | |
2320 | when performing comparisons (and when producing output, but that's a | |
2321 | different problem). In particular, instead of testing for equality, you | |
2322 | would check to see whether the two values have ranges that overlap; and | |
2323 | this is done with the relational operators, so equality comparisons are | |
2324 | probably mistaken. | |
2325 | ||
aee96fe9 | 2326 | @item -Wtraditional @r{(C only)} |
cd3bb277 | 2327 | @opindex Wtraditional |
74291a4b | 2328 | Warn about certain constructs that behave differently in traditional and |
161d7b59 | 2329 | ISO C@. Also warn about ISO C constructs that have no traditional C |
c8abc684 | 2330 | equivalent, and/or problematic constructs which should be avoided. |
74291a4b MM |
2331 | |
2332 | @itemize @bullet | |
2333 | @item | |
da312b55 NB |
2334 | Macro parameters that appear within string literals in the macro body. |
2335 | In traditional C macro replacement takes place within string literals, | |
161d7b59 | 2336 | but does not in ISO C@. |
da312b55 NB |
2337 | |
2338 | @item | |
2339 | In traditional C, some preprocessor directives did not exist. | |
2340 | Traditional preprocessors would only consider a line to be a directive | |
2341 | if the @samp{#} appeared in column 1 on the line. Therefore | |
630d3d5a | 2342 | @option{-Wtraditional} warns about directives that traditional C |
da312b55 NB |
2343 | understands but would ignore because the @samp{#} does not appear as the |
2344 | first character on the line. It also suggests you hide directives like | |
2345 | @samp{#pragma} not understood by traditional C by indenting them. Some | |
c21cd8b1 | 2346 | traditional implementations would not recognize @samp{#elif}, so it |
da312b55 NB |
2347 | suggests avoiding it altogether. |
2348 | ||
2349 | @item | |
2350 | A function-like macro that appears without arguments. | |
2351 | ||
2352 | @item | |
2353 | The unary plus operator. | |
2354 | ||
2355 | @item | |
c771326b JM |
2356 | The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point |
2357 | constant suffixes. (Traditional C does support the @samp{L} suffix on integer | |
da312b55 | 2358 | constants.) Note, these suffixes appear in macros defined in the system |
e979f9e8 | 2359 | headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. |
c8abc684 KG |
2360 | Use of these macros in user code might normally lead to spurious |
2361 | warnings, however gcc's integrated preprocessor has enough context to | |
2362 | avoid warning in these cases. | |
74291a4b MM |
2363 | |
2364 | @item | |
2365 | A function declared external in one block and then used after the end of | |
2366 | the block. | |
2367 | ||
2368 | @item | |
2369 | A @code{switch} statement has an operand of type @code{long}. | |
db838bb8 KG |
2370 | |
2371 | @item | |
2372 | A non-@code{static} function declaration follows a @code{static} one. | |
2373 | This construct is not accepted by some traditional C compilers. | |
48776cde KG |
2374 | |
2375 | @item | |
c1030c7c | 2376 | The ISO type of an integer constant has a different width or |
48776cde | 2377 | signedness from its traditional type. This warning is only issued if |
e979f9e8 | 2378 | the base of the constant is ten. I.e.@: hexadecimal or octal values, which |
48776cde | 2379 | typically represent bit patterns, are not warned about. |
bb66adca KG |
2380 | |
2381 | @item | |
c1030c7c | 2382 | Usage of ISO string concatenation is detected. |
7f094a94 | 2383 | |
895ea614 KG |
2384 | @item |
2385 | Initialization of automatic aggregates. | |
2386 | ||
2387 | @item | |
2388 | Identifier conflicts with labels. Traditional C lacks a separate | |
2389 | namespace for labels. | |
253b6b82 KG |
2390 | |
2391 | @item | |
2392 | Initialization of unions. If the initializer is zero, the warning is | |
2393 | omitted. This is done under the assumption that the zero initializer in | |
e979f9e8 | 2394 | user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing |
253b6b82 KG |
2395 | initializer warnings and relies on default initialization to zero in the |
2396 | traditional C case. | |
03829ad2 KG |
2397 | |
2398 | @item | |
3ed56f8a KG |
2399 | Conversions by prototypes between fixed/floating point values and vice |
2400 | versa. The absence of these prototypes when compiling with traditional | |
2401 | C would cause serious problems. This is a subset of the possible | |
630d3d5a | 2402 | conversion warnings, for the full set use @option{-Wconversion}. |
74291a4b MM |
2403 | @end itemize |
2404 | ||
861bb6c1 | 2405 | @item -Wundef |
cd3bb277 | 2406 | @opindex Wundef |
861bb6c1 JL |
2407 | Warn if an undefined identifier is evaluated in an @samp{#if} directive. |
2408 | ||
74291a4b | 2409 | @item -Wshadow |
cd3bb277 | 2410 | @opindex Wshadow |
d773df5a DB |
2411 | Warn whenever a local variable shadows another local variable, parameter or |
2412 | global variable or whenever a built-in function is shadowed. | |
74291a4b | 2413 | |
74291a4b | 2414 | @item -Wlarger-than-@var{len} |
cd3bb277 | 2415 | @opindex Wlarger-than |
74291a4b MM |
2416 | Warn whenever an object of larger than @var{len} bytes is defined. |
2417 | ||
2418 | @item -Wpointer-arith | |
cd3bb277 | 2419 | @opindex Wpointer-arith |
74291a4b MM |
2420 | Warn about anything that depends on the ``size of'' a function type or |
2421 | of @code{void}. GNU C assigns these types a size of 1, for | |
2422 | convenience in calculations with @code{void *} pointers and pointers | |
2423 | to functions. | |
2424 | ||
aee96fe9 | 2425 | @item -Wbad-function-cast @r{(C only)} |
cd3bb277 | 2426 | @opindex Wbad-function-cast |
74291a4b MM |
2427 | Warn whenever a function call is cast to a non-matching type. |
2428 | For example, warn if @code{int malloc()} is cast to @code{anything *}. | |
2429 | ||
2430 | @item -Wcast-qual | |
cd3bb277 | 2431 | @opindex Wcast-qual |
74291a4b MM |
2432 | Warn whenever a pointer is cast so as to remove a type qualifier from |
2433 | the target type. For example, warn if a @code{const char *} is cast | |
2434 | to an ordinary @code{char *}. | |
2435 | ||
2436 | @item -Wcast-align | |
cd3bb277 | 2437 | @opindex Wcast-align |
74291a4b MM |
2438 | Warn whenever a pointer is cast such that the required alignment of the |
2439 | target is increased. For example, warn if a @code{char *} is cast to | |
2440 | an @code{int *} on machines where integers can only be accessed at | |
2441 | two- or four-byte boundaries. | |
2442 | ||
2443 | @item -Wwrite-strings | |
cd3bb277 | 2444 | @opindex Wwrite-strings |
aee96fe9 JM |
2445 | When compiling C, give string constants the type @code{const |
2446 | char[@var{length}]} so that | |
74291a4b | 2447 | copying the address of one into a non-@code{const} @code{char *} |
aee96fe9 JM |
2448 | pointer will get a warning; when compiling C++, warn about the |
2449 | deprecated conversion from string constants to @code{char *}. | |
2450 | These warnings will help you find at | |
74291a4b MM |
2451 | compile time code that can try to write into a string constant, but |
2452 | only if you have been very careful about using @code{const} in | |
2453 | declarations and prototypes. Otherwise, it will just be a nuisance; | |
630d3d5a | 2454 | this is why we did not make @option{-Wall} request these warnings. |
74291a4b MM |
2455 | |
2456 | @item -Wconversion | |
cd3bb277 | 2457 | @opindex Wconversion |
74291a4b MM |
2458 | Warn if a prototype causes a type conversion that is different from what |
2459 | would happen to the same argument in the absence of a prototype. This | |
2460 | includes conversions of fixed point to floating and vice versa, and | |
2461 | conversions changing the width or signedness of a fixed point argument | |
2462 | except when the same as the default promotion. | |
2463 | ||
2464 | Also, warn if a negative integer constant expression is implicitly | |
2465 | converted to an unsigned type. For example, warn about the assignment | |
2466 | @code{x = -1} if @code{x} is unsigned. But do not warn about explicit | |
2467 | casts like @code{(unsigned) -1}. | |
2468 | ||
e9a25f70 | 2469 | @item -Wsign-compare |
cd3bb277 | 2470 | @opindex Wsign-compare |
e9a25f70 JL |
2471 | @cindex warning for comparison of signed and unsigned values |
2472 | @cindex comparison of signed and unsigned values, warning | |
2473 | @cindex signed and unsigned values, comparison warning | |
2474 | Warn when a comparison between signed and unsigned values could produce | |
2475 | an incorrect result when the signed value is converted to unsigned. | |
630d3d5a JM |
2476 | This warning is also enabled by @option{-W}; to get the other warnings |
2477 | of @option{-W} without this warning, use @samp{-W -Wno-sign-compare}. | |
e9a25f70 | 2478 | |
74291a4b | 2479 | @item -Waggregate-return |
cd3bb277 | 2480 | @opindex Waggregate-return |
74291a4b MM |
2481 | Warn if any functions that return structures or unions are defined or |
2482 | called. (In languages where you can return an array, this also elicits | |
2483 | a warning.) | |
2484 | ||
aee96fe9 | 2485 | @item -Wstrict-prototypes @r{(C only)} |
cd3bb277 | 2486 | @opindex Wstrict-prototypes |
74291a4b MM |
2487 | Warn if a function is declared or defined without specifying the |
2488 | argument types. (An old-style function definition is permitted without | |
2489 | a warning if preceded by a declaration which specifies the argument | |
2490 | types.) | |
2491 | ||
aee96fe9 | 2492 | @item -Wmissing-prototypes @r{(C only)} |
cd3bb277 | 2493 | @opindex Wmissing-prototypes |
74291a4b MM |
2494 | Warn if a global function is defined without a previous prototype |
2495 | declaration. This warning is issued even if the definition itself | |
2496 | provides a prototype. The aim is to detect global functions that fail | |
2497 | to be declared in header files. | |
2498 | ||
2499 | @item -Wmissing-declarations | |
cd3bb277 | 2500 | @opindex Wmissing-declarations |
74291a4b MM |
2501 | Warn if a global function is defined without a previous declaration. |
2502 | Do so even if the definition itself provides a prototype. | |
2503 | Use this option to detect global functions that are not declared in | |
2504 | header files. | |
2505 | ||
0ca3fb0a | 2506 | @item -Wmissing-noreturn |
cd3bb277 | 2507 | @opindex Wmissing-noreturn |
0ca3fb0a KG |
2508 | Warn about functions which might be candidates for attribute @code{noreturn}. |
2509 | Note these are only possible candidates, not absolute ones. Care should | |
2510 | be taken to manually verify functions actually do not ever return before | |
2511 | adding the @code{noreturn} attribute, otherwise subtle code generation | |
21c7361e AJ |
2512 | bugs could be introduced. You will not get a warning for @code{main} in |
2513 | hosted C environments. | |
0ca3fb0a | 2514 | |
74ff4629 | 2515 | @item -Wmissing-format-attribute |
cd3bb277 JM |
2516 | @opindex Wmissing-format-attribute |
2517 | @opindex Wformat | |
630d3d5a | 2518 | If @option{-Wformat} is enabled, also warn about functions which might be |
74ff4629 JM |
2519 | candidates for @code{format} attributes. Note these are only possible |
2520 | candidates, not absolute ones. GCC will guess that @code{format} | |
2521 | attributes might be appropriate for any function that calls a function | |
2522 | like @code{vprintf} or @code{vscanf}, but this might not always be the | |
2523 | case, and some functions for which @code{format} attributes are | |
2524 | appropriate may not be detected. This option has no effect unless | |
630d3d5a | 2525 | @option{-Wformat} is enabled (possibly by @option{-Wall}). |
74ff4629 | 2526 | |
e23bd218 IR |
2527 | @item -Wno-deprecated-declarations |
2528 | @opindex Wno-deprecated-declarations | |
2529 | Do not warn about uses of functions, variables, and types marked as | |
2530 | deprecated by using the @code{deprecated} attribute. | |
2531 | (@pxref{Function Attributes}, @pxref{Variable Attributes}, | |
2532 | @pxref{Type Attributes}.) | |
2533 | ||
3c12fcc2 | 2534 | @item -Wpacked |
cd3bb277 | 2535 | @opindex Wpacked |
3c12fcc2 | 2536 | Warn if a structure is given the packed attribute, but the packed |
02f52e19 | 2537 | attribute has no effect on the layout or size of the structure. |
3c12fcc2 GM |
2538 | Such structures may be mis-aligned for little benefit. For |
2539 | instance, in this code, the variable @code{f.x} in @code{struct bar} | |
2540 | will be misaligned even though @code{struct bar} does not itself | |
2541 | have the packed attribute: | |
2542 | ||
2543 | @smallexample | |
2544 | @group | |
2545 | struct foo @{ | |
2546 | int x; | |
2547 | char a, b, c, d; | |
2548 | @} __attribute__((packed)); | |
2549 | struct bar @{ | |
2550 | char z; | |
2551 | struct foo f; | |
2552 | @}; | |
2553 | @end group | |
2554 | @end smallexample | |
2555 | ||
2556 | @item -Wpadded | |
cd3bb277 | 2557 | @opindex Wpadded |
3c12fcc2 GM |
2558 | Warn if padding is included in a structure, either to align an element |
2559 | of the structure or to align the whole structure. Sometimes when this | |
2560 | happens it is possible to rearrange the fields of the structure to | |
2561 | reduce the padding and so make the structure smaller. | |
2562 | ||
74291a4b | 2563 | @item -Wredundant-decls |
cd3bb277 | 2564 | @opindex Wredundant-decls |
74291a4b MM |
2565 | Warn if anything is declared more than once in the same scope, even in |
2566 | cases where multiple declaration is valid and changes nothing. | |
2567 | ||
aee96fe9 | 2568 | @item -Wnested-externs @r{(C only)} |
cd3bb277 | 2569 | @opindex Wnested-externs |
252215a7 | 2570 | Warn if an @code{extern} declaration is encountered within a function. |
74291a4b | 2571 | |
312f6255 | 2572 | @item -Wunreachable-code |
cd3bb277 | 2573 | @opindex Wunreachable-code |
312f6255 GK |
2574 | Warn if the compiler detects that code will never be executed. |
2575 | ||
2576 | This option is intended to warn when the compiler detects that at | |
2577 | least a whole line of source code will never be executed, because | |
2578 | some condition is never satisfied or because it is after a | |
2579 | procedure that never returns. | |
2580 | ||
2581 | It is possible for this option to produce a warning even though there | |
2582 | are circumstances under which part of the affected line can be executed, | |
2583 | so care should be taken when removing apparently-unreachable code. | |
2584 | ||
2585 | For instance, when a function is inlined, a warning may mean that the | |
02f52e19 | 2586 | line is unreachable in only one inlined copy of the function. |
312f6255 | 2587 | |
630d3d5a | 2588 | This option is not made part of @option{-Wall} because in a debugging |
312f6255 GK |
2589 | version of a program there is often substantial code which checks |
2590 | correct functioning of the program and is, hopefully, unreachable | |
2591 | because the program does work. Another common use of unreachable | |
c21cd8b1 | 2592 | code is to provide behavior which is selectable at compile-time. |
312f6255 | 2593 | |
74291a4b | 2594 | @item -Winline |
cd3bb277 | 2595 | @opindex Winline |
c5c76735 | 2596 | Warn if a function can not be inlined and it was declared as inline. |
74291a4b | 2597 | |
795add94 | 2598 | @item -Wlong-long |
cd3bb277 JM |
2599 | @opindex Wlong-long |
2600 | @opindex Wno-long-long | |
795add94 | 2601 | Warn if @samp{long long} type is used. This is default. To inhibit |
630d3d5a JM |
2602 | the warning messages, use @option{-Wno-long-long}. Flags |
2603 | @option{-Wlong-long} and @option{-Wno-long-long} are taken into account | |
2604 | only when @option{-pedantic} flag is used. | |
795add94 | 2605 | |
18424ae1 | 2606 | @item -Wdisabled-optimization |
cd3bb277 | 2607 | @opindex Wdisabled-optimization |
18424ae1 BL |
2608 | Warn if a requested optimization pass is disabled. This warning does |
2609 | not generally indicate that there is anything wrong with your code; it | |
2610 | merely indicates that GCC's optimizers were unable to handle the code | |
2611 | effectively. Often, the problem is that your code is too big or too | |
2612 | complex; GCC will refuse to optimize programs when the optimization | |
2613 | itself is likely to take inordinate amounts of time. | |
2614 | ||
74291a4b | 2615 | @item -Werror |
cd3bb277 | 2616 | @opindex Werror |
74291a4b MM |
2617 | Make all warnings into errors. |
2618 | @end table | |
2619 | ||
2620 | @node Debugging Options | |
0c2d1a2a | 2621 | @section Options for Debugging Your Program or GCC |
74291a4b MM |
2622 | @cindex options, debugging |
2623 | @cindex debugging information options | |
2624 | ||
0c2d1a2a | 2625 | GCC has various special options that are used for debugging |
74291a4b MM |
2626 | either your program or GCC: |
2627 | ||
2642624b | 2628 | @table @gcctabopt |
74291a4b | 2629 | @item -g |
cd3bb277 | 2630 | @opindex g |
74291a4b | 2631 | Produce debugging information in the operating system's native format |
161d7b59 | 2632 | (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging |
74291a4b MM |
2633 | information. |
2634 | ||
630d3d5a | 2635 | On most systems that use stabs format, @option{-g} enables use of extra |
74291a4b MM |
2636 | debugging information that only GDB can use; this extra information |
2637 | makes debugging work better in GDB but will probably make other debuggers | |
2638 | crash or | |
2639 | refuse to read the program. If you want to control for certain whether | |
630d3d5a | 2640 | to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, |
5f98259a RK |
2641 | @option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, @option{-gdwarf-1}, |
2642 | or @option{-gvms} (see below). | |
74291a4b | 2643 | |
630d3d5a JM |
2644 | Unlike most other C compilers, GCC allows you to use @option{-g} with |
2645 | @option{-O}. The shortcuts taken by optimized code may occasionally | |
74291a4b MM |
2646 | produce surprising results: some variables you declared may not exist |
2647 | at all; flow of control may briefly move where you did not expect it; | |
2648 | some statements may not be executed because they compute constant | |
2649 | results or their values were already at hand; some statements may | |
2650 | execute in different places because they were moved out of loops. | |
2651 | ||
2652 | Nevertheless it proves possible to debug optimized output. This makes | |
2653 | it reasonable to use the optimizer for programs that might have bugs. | |
2654 | ||
0c2d1a2a | 2655 | The following options are useful when GCC is generated with the |
74291a4b MM |
2656 | capability for more than one debugging format. |
2657 | ||
2658 | @item -ggdb | |
cd3bb277 | 2659 | @opindex ggdb |
161d7b59 | 2660 | Produce debugging information for use by GDB@. This means to use the |
861bb6c1 JL |
2661 | most expressive format available (DWARF 2, stabs, or the native format |
2662 | if neither of those are supported), including GDB extensions if at all | |
2663 | possible. | |
74291a4b MM |
2664 | |
2665 | @item -gstabs | |
cd3bb277 | 2666 | @opindex gstabs |
74291a4b MM |
2667 | Produce debugging information in stabs format (if that is supported), |
2668 | without GDB extensions. This is the format used by DBX on most BSD | |
2669 | systems. On MIPS, Alpha and System V Release 4 systems this option | |
161d7b59 | 2670 | produces stabs debugging output which is not understood by DBX or SDB@. |
74291a4b MM |
2671 | On System V Release 4 systems this option requires the GNU assembler. |
2672 | ||
2673 | @item -gstabs+ | |
cd3bb277 | 2674 | @opindex gstabs+ |
74291a4b | 2675 | Produce debugging information in stabs format (if that is supported), |
161d7b59 | 2676 | using GNU extensions understood only by the GNU debugger (GDB)@. The |
74291a4b MM |
2677 | use of these extensions is likely to make other debuggers crash or |
2678 | refuse to read the program. | |
2679 | ||
2680 | @item -gcoff | |
cd3bb277 | 2681 | @opindex gcoff |
74291a4b MM |
2682 | Produce debugging information in COFF format (if that is supported). |
2683 | This is the format used by SDB on most System V systems prior to | |
2684 | System V Release 4. | |
2685 | ||
2686 | @item -gxcoff | |
cd3bb277 | 2687 | @opindex gxcoff |
74291a4b MM |
2688 | Produce debugging information in XCOFF format (if that is supported). |
2689 | This is the format used by the DBX debugger on IBM RS/6000 systems. | |
2690 | ||
2691 | @item -gxcoff+ | |
cd3bb277 | 2692 | @opindex gxcoff+ |
74291a4b | 2693 | Produce debugging information in XCOFF format (if that is supported), |
161d7b59 | 2694 | using GNU extensions understood only by the GNU debugger (GDB)@. The |
74291a4b MM |
2695 | use of these extensions is likely to make other debuggers crash or |
2696 | refuse to read the program, and may cause assemblers other than the GNU | |
2697 | assembler (GAS) to fail with an error. | |
2698 | ||
2699 | @item -gdwarf | |
cd3bb277 | 2700 | @opindex gdwarf |
861bb6c1 JL |
2701 | Produce debugging information in DWARF version 1 format (if that is |
2702 | supported). This is the format used by SDB on most System V Release 4 | |
2703 | systems. | |
74291a4b MM |
2704 | |
2705 | @item -gdwarf+ | |
cd3bb277 | 2706 | @opindex gdwarf+ |
861bb6c1 JL |
2707 | Produce debugging information in DWARF version 1 format (if that is |
2708 | supported), using GNU extensions understood only by the GNU debugger | |
161d7b59 | 2709 | (GDB)@. The use of these extensions is likely to make other debuggers |
861bb6c1 JL |
2710 | crash or refuse to read the program. |
2711 | ||
2712 | @item -gdwarf-2 | |
cd3bb277 | 2713 | @opindex gdwarf-2 |
861bb6c1 JL |
2714 | Produce debugging information in DWARF version 2 format (if that is |
2715 | supported). This is the format used by DBX on IRIX 6. | |
74291a4b | 2716 | |
5f98259a RK |
2717 | @item -gvms |
2718 | @opindex gvms | |
2719 | Produce debugging information in VMS debug format (if that is | |
2720 | supported). This is the format used by DEBUG on VMS systems. | |
2721 | ||
74291a4b MM |
2722 | @item -g@var{level} |
2723 | @itemx -ggdb@var{level} | |
2724 | @itemx -gstabs@var{level} | |
2725 | @itemx -gcoff@var{level} | |
2726 | @itemx -gxcoff@var{level} | |
2727 | @itemx -gdwarf@var{level} | |
861bb6c1 | 2728 | @itemx -gdwarf-2@var{level} |
5f98259a | 2729 | @itemx -gvms@var{level} |
74291a4b MM |
2730 | Request debugging information and also use @var{level} to specify how |
2731 | much information. The default level is 2. | |
2732 | ||
2733 | Level 1 produces minimal information, enough for making backtraces in | |
2734 | parts of the program that you don't plan to debug. This includes | |
2735 | descriptions of functions and external variables, but no information | |
2736 | about local variables and no line numbers. | |
2737 | ||
2738 | Level 3 includes extra information, such as all the macro definitions | |
2739 | present in the program. Some debuggers support macro expansion when | |
630d3d5a | 2740 | you use @option{-g3}. |
74291a4b MM |
2741 | |
2742 | @cindex @code{prof} | |
2743 | @item -p | |
cd3bb277 | 2744 | @opindex p |
74291a4b MM |
2745 | Generate extra code to write profile information suitable for the |
2746 | analysis program @code{prof}. You must use this option when compiling | |
2747 | the source files you want data about, and you must also use it when | |
2748 | linking. | |
2749 | ||
2750 | @cindex @code{gprof} | |
2751 | @item -pg | |
cd3bb277 | 2752 | @opindex pg |
74291a4b MM |
2753 | Generate extra code to write profile information suitable for the |
2754 | analysis program @code{gprof}. You must use this option when compiling | |
2755 | the source files you want data about, and you must also use it when | |
2756 | linking. | |
2757 | ||
2758 | @cindex @code{tcov} | |
2759 | @item -a | |
cd3bb277 | 2760 | @opindex a |
74291a4b MM |
2761 | Generate extra code to write profile information for basic blocks, which will |
2762 | record the number of times each basic block is executed, the basic block start | |
630d3d5a | 2763 | address, and the function name containing the basic block. If @option{-g} is |
74291a4b MM |
2764 | used, the line number and filename of the start of the basic block will also be |
2765 | recorded. If not overridden by the machine description, the default action is | |
2766 | to append to the text file @file{bb.out}. | |
2767 | ||
2768 | This data could be analyzed by a program like @code{tcov}. Note, | |
2769 | however, that the format of the data is not what @code{tcov} expects. | |
2770 | Eventually GNU @code{gprof} should be extended to process this data. | |
2771 | ||
898f531b | 2772 | @item -Q |
cd3bb277 | 2773 | @opindex Q |
898f531b JL |
2774 | Makes the compiler print out each function name as it is compiled, and |
2775 | print some statistics about each pass when it finishes. | |
2776 | ||
1f0c3120 | 2777 | @item -ftime-report |
cd3bb277 | 2778 | @opindex ftime-report |
1f0c3120 JM |
2779 | Makes the compiler print some statistics about the time consumed by each |
2780 | pass when it finishes. | |
2781 | ||
2782 | @item -fmem-report | |
cd3bb277 | 2783 | @opindex fmem-report |
1f0c3120 JM |
2784 | Makes the compiler print some statistics about permanent memory |
2785 | allocation when it finishes. | |
2786 | ||
861bb6c1 | 2787 | @item -fprofile-arcs |
cd3bb277 | 2788 | @opindex fprofile-arcs |
3de87bf2 JJ |
2789 | Instrument @dfn{arcs} during compilation to generate coverage data |
2790 | or for profile-directed block ordering. During execution the program | |
2791 | records how many times each branch is executed and how many times it is | |
2792 | taken. When the compiled program exits it saves this data to a file | |
2793 | called @file{@var{sourcename}.da} for each source file. | |
2794 | ||
2795 | For profile-directed block ordering, compile the program with | |
2796 | @option{-fprofile-arcs} plus optimization and code generation options, | |
2797 | generate the arc profile information by running the program on a | |
2798 | selected workload, and then compile the program again with the same | |
2799 | optimization and code generation options plus | |
630d3d5a | 2800 | @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that |
3de87bf2 JJ |
2801 | Control Optimization}). |
2802 | ||
2803 | The other use of @option{-fprofile-arcs} is for use with @code{gcov}, | |
2804 | when it is used with the @option{-ftest-coverage} option. GCC | |
2805 | supports two methods of determining code coverage: the options that | |
2806 | support @code{gcov}, and options @option{-a} and @option{-ax}, which | |
2807 | write information to text files. The options that support @code{gcov} | |
2808 | do not need to instrument every arc in the program, so a program compiled | |
2809 | with them runs faster than a program compiled with @option{-a}, which | |
2810 | adds instrumentation code to every basic block in the program. The | |
2811 | tradeoff: since @code{gcov} does not have execution counts for all | |
2812 | branches, it must start with the execution counts for the instrumented | |
2813 | branches, and then iterate over the program flow graph until the entire | |
2814 | graph has been solved. Hence, @code{gcov} runs a little more slowly than | |
2815 | a program which uses information from @option{-a} and @option{-ax}. | |
2816 | ||
2817 | With @option{-fprofile-arcs}, for each function of your program GCC | |
2818 | creates a program flow graph, then finds a spanning tree for the graph. | |
2819 | Only arcs that are not on the spanning tree have to be instrumented: the | |
2820 | compiler adds code to count the number of times that these arcs are | |
2821 | executed. When an arc is the only exit or only entrance to a block, the | |
2822 | instrumentation code can be added to the block; otherwise, a new basic | |
2823 | block must be created to hold the instrumentation code. | |
2824 | ||
2825 | This option makes it possible to estimate branch probabilities and to | |
2826 | calculate basic block execution counts. In general, basic block | |
2827 | execution counts as provided by @option{-a} do not give enough | |
2828 | information to estimate all branch probabilities. | |
861bb6c1 JL |
2829 | |
2830 | @need 2000 | |
2831 | @item -ftest-coverage | |
cd3bb277 | 2832 | @opindex ftest-coverage |
861bb6c1 | 2833 | Create data files for the @code{gcov} code-coverage utility |
0c2d1a2a | 2834 | (@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}). |
861bb6c1 JL |
2835 | The data file names begin with the name of your source file: |
2836 | ||
2642624b | 2837 | @table @gcctabopt |
861bb6c1 JL |
2838 | @item @var{sourcename}.bb |
2839 | A mapping from basic blocks to line numbers, which @code{gcov} uses to | |
2840 | associate basic block execution counts with line numbers. | |
2841 | ||
2842 | @item @var{sourcename}.bbg | |
2843 | A list of all arcs in the program flow graph. This allows @code{gcov} | |
2844 | to reconstruct the program flow graph, so that it can compute all basic | |
2845 | block and arc execution counts from the information in the | |
3de87bf2 | 2846 | @code{@var{sourcename}.da} file. |
861bb6c1 JL |
2847 | @end table |
2848 | ||
3de87bf2 JJ |
2849 | Use @option{-ftest-coverage} with @option{-fprofile-arcs}; the latter |
2850 | option adds instrumentation to the program, which then writes | |
2851 | execution counts to another data file: | |
2852 | ||
2853 | @table @gcctabopt | |
2854 | @item @var{sourcename}.da | |
2855 | Runtime arc execution counts, used in conjunction with the arc | |
2856 | information in the file @code{@var{sourcename}.bbg}. | |
2857 | @end table | |
2858 | ||
2859 | Coverage data will map better to the source files if | |
2860 | @option{-ftest-coverage} is used without optimization. | |
2861 | ||
74291a4b | 2862 | @item -d@var{letters} |
cd3bb277 | 2863 | @opindex d |
74291a4b MM |
2864 | Says to make debugging dumps during compilation at times specified by |
2865 | @var{letters}. This is used for debugging the compiler. The file names | |
375e2d5c | 2866 | for most of the dumps are made by appending a pass number and a word to |
02f52e19 | 2867 | the source file name (e.g. @file{foo.c.00.rtl} or @file{foo.c.01.sibling}). |
375e2d5c | 2868 | Here are the possible letters for use in @var{letters}, and their meanings: |
74291a4b MM |
2869 | |
2870 | @table @samp | |
375e2d5c | 2871 | @item A |
cd3bb277 | 2872 | @opindex dA |
375e2d5c | 2873 | Annotate the assembler output with miscellaneous debugging information. |
956d6950 | 2874 | @item b |
cd3bb277 | 2875 | @opindex db |
0b47e4c1 | 2876 | Dump after computing branch probabilities, to @file{@var{file}.14.bp}. |
48d9ade5 | 2877 | @item B |
cd3bb277 | 2878 | @opindex dB |
0b47e4c1 | 2879 | Dump after block reordering, to @file{@var{file}.28.bbro}. |
032713aa | 2880 | @item c |
cd3bb277 | 2881 | @opindex dc |
0b47e4c1 | 2882 | Dump after instruction combination, to the file @file{@var{file}.16.combine}. |
470fc13d | 2883 | @item C |
cd3bb277 | 2884 | @opindex dC |
0b47e4c1 | 2885 | Dump after the first if conversion, to the file @file{@var{file}.17.ce}. |
032713aa | 2886 | @item d |
cd3bb277 | 2887 | @opindex dd |
0b47e4c1 | 2888 | Dump after delayed branch scheduling, to @file{@var{file}.31.dbr}. |
032713aa | 2889 | @item D |
cd3bb277 | 2890 | @opindex dD |
f5963e61 JL |
2891 | Dump all macro definitions, at the end of preprocessing, in addition to |
2892 | normal output. | |
48d9ade5 | 2893 | @item e |
cd3bb277 | 2894 | @opindex de |
0826f1d8 | 2895 | Dump after SSA optimizations, to @file{@var{file}.04.ssa} and |
0b47e4c1 | 2896 | @file{@var{file}.07.ussa}. |
470fc13d | 2897 | @item E |
cd3bb277 | 2898 | @opindex dE |
0b47e4c1 | 2899 | Dump after the second if conversion, to @file{@var{file}.26.ce2}. |
74291a4b | 2900 | @item f |
cd3bb277 | 2901 | @opindex df |
0b47e4c1 | 2902 | Dump after life analysis, to @file{@var{file}.15.life}. |
48d9ade5 | 2903 | @item F |
cd3bb277 | 2904 | @opindex dF |
0b47e4c1 | 2905 | Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.09.addressof}. |
74291a4b | 2906 | @item g |
cd3bb277 | 2907 | @opindex dg |
0b47e4c1 | 2908 | Dump after global register allocation, to @file{@var{file}.21.greg}. |
0826f1d8 JL |
2909 | @item h |
2910 | @opindex dh | |
2911 | Dump after finalization of EH handling code, to @file{@var{file}.02.eh}. | |
2912 | @item o | |
cd3bb277 | 2913 | @opindex do |
9c34dbbf | 2914 | Dump after post-reload optimizations, to @file{@var{file}.22.postreload}. |
02f52e19 | 2915 | @item G |
cd3bb277 | 2916 | @opindex dG |
0b47e4c1 | 2917 | Dump after GCSE, to @file{@var{file}.10.gcse}. |
48d9ade5 | 2918 | @item i |
cd3bb277 | 2919 | @opindex di |
48d9ade5 | 2920 | Dump after sibling call optimizations, to @file{@var{file}.01.sibling}. |
032713aa | 2921 | @item j |
cd3bb277 | 2922 | @opindex dj |
0826f1d8 | 2923 | Dump after the first jump optimization, to @file{@var{file}.03.jump}. |
74291a4b | 2924 | @item k |
cd3bb277 | 2925 | @opindex dk |
0b47e4c1 | 2926 | Dump after conversion from registers to stack, to @file{@var{file}.32.stack}. |
032713aa | 2927 | @item l |
cd3bb277 | 2928 | @opindex dl |
0b47e4c1 | 2929 | Dump after local register allocation, to @file{@var{file}.20.lreg}. |
032713aa | 2930 | @item L |
cd3bb277 | 2931 | @opindex dL |
0b47e4c1 | 2932 | Dump after loop optimization, to @file{@var{file}.11.loop}. |
032713aa | 2933 | @item M |
cd3bb277 | 2934 | @opindex dM |
032713aa | 2935 | Dump after performing the machine dependent reorganisation pass, to |
0b47e4c1 | 2936 | @file{@var{file}.30.mach}. |
48d9ade5 | 2937 | @item n |
cd3bb277 | 2938 | @opindex dn |
0b47e4c1 | 2939 | Dump after register renumbering, to @file{@var{file}.25.rnreg}. |
032713aa | 2940 | @item N |
cd3bb277 | 2941 | @opindex dN |
0b47e4c1 | 2942 | Dump after the register move pass, to @file{@var{file}.18.regmove}. |
032713aa | 2943 | @item r |
cd3bb277 | 2944 | @opindex dr |
375e2d5c | 2945 | Dump after RTL generation, to @file{@var{file}.00.rtl}. |
032713aa | 2946 | @item R |
cd3bb277 | 2947 | @opindex dR |
9c34dbbf | 2948 | Dump after the second scheduling pass, to @file{@var{file}.27.sched2}. |
032713aa | 2949 | @item s |
cd3bb277 | 2950 | @opindex ds |
032713aa | 2951 | Dump after CSE (including the jump optimization that sometimes follows |
0b47e4c1 | 2952 | CSE), to @file{@var{file}.08.cse}. |
032713aa | 2953 | @item S |
cd3bb277 | 2954 | @opindex dS |
9c34dbbf | 2955 | Dump after the first scheduling pass, to @file{@var{file}.19.sched}. |
032713aa | 2956 | @item t |
cd3bb277 | 2957 | @opindex dt |
032713aa | 2958 | Dump after the second CSE pass (including the jump optimization that |
0b47e4c1 | 2959 | sometimes follows CSE), to @file{@var{file}.12.cse2}. |
48d9ade5 | 2960 | @item w |
cd3bb277 | 2961 | @opindex dw |
0b47e4c1 | 2962 | Dump after the second flow pass, to @file{@var{file}.23.flow2}. |
470fc13d | 2963 | @item X |
cd3bb277 | 2964 | @opindex dX |
9c34dbbf | 2965 | Dump after SSA dead code elimination, to @file{@var{file}.06.ssadce}. |
48d9ade5 | 2966 | @item z |
cd3bb277 | 2967 | @opindex dz |
0b47e4c1 | 2968 | Dump after the peephole pass, to @file{@var{file}.24.peephole2}. |
74291a4b | 2969 | @item a |
cd3bb277 | 2970 | @opindex da |
74291a4b MM |
2971 | Produce all the dumps listed above. |
2972 | @item m | |
cd3bb277 | 2973 | @opindex dm |
74291a4b MM |
2974 | Print statistics on memory usage, at the end of the run, to |
2975 | standard error. | |
2976 | @item p | |
cd3bb277 | 2977 | @opindex dp |
74291a4b | 2978 | Annotate the assembler output with a comment indicating which |
f20b5577 MM |
2979 | pattern and alternative was used. The length of each instruction is |
2980 | also printed. | |
2856c3e3 | 2981 | @item P |
cd3bb277 | 2982 | @opindex dP |
2856c3e3 | 2983 | Dump the RTL in the assembler output as a comment before each instruction. |
630d3d5a | 2984 | Also turns on @option{-dp} annotation. |
375e2d5c | 2985 | @item v |
cd3bb277 | 2986 | @opindex dv |
375e2d5c RH |
2987 | For each of the other indicated dump files (except for |
2988 | @file{@var{file}.00.rtl}), dump a representation of the control flow graph | |
b192711e | 2989 | suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}. |
62a1403d | 2990 | @item x |
cd3bb277 | 2991 | @opindex dx |
62a1403d AS |
2992 | Just generate RTL for a function instead of compiling it. Usually used |
2993 | with @samp{r}. | |
032713aa | 2994 | @item y |
cd3bb277 | 2995 | @opindex dy |
032713aa | 2996 | Dump debugging information during parsing, to standard error. |
74291a4b MM |
2997 | @end table |
2998 | ||
b707b450 | 2999 | @item -fdump-unnumbered |
cd3bb277 | 3000 | @opindex fdump-unnumbered |
695ac33f | 3001 | When doing debugging dumps (see @option{-d} option above), suppress instruction |
b707b450 | 3002 | numbers and line number note output. This makes it more feasible to |
b192711e | 3003 | use diff on debugging dumps for compiler invocations with different |
695ac33f | 3004 | options, in particular with and without @option{-g}. |
b707b450 | 3005 | |
aee96fe9 | 3006 | @item -fdump-class-hierarchy @r{(C++ only)} |
22367161 | 3007 | @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} |
cd3bb277 | 3008 | @opindex fdump-class-hierarchy |
e76b4820 | 3009 | Dump a representation of each class's hierarchy and virtual function |
767094dd | 3010 | table layout to a file. The file name is made by appending @file{.class} |
22367161 NS |
3011 | to the source file name. If the @samp{-@var{options}} form is used, |
3012 | @var{options} controls the details of the dump as described for the | |
3013 | @option{-fdump-tree} options. | |
3014 | ||
3015 | @item -fdump-tree-@var{switch} @r{(C++ only)} | |
3016 | @itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)} | |
3017 | @opindex fdump-tree | |
3018 | Control the dumping at various stages of processing the intermediate | |
3019 | language tree to a file. The file name is generated by appending a switch | |
3020 | specific suffix to the source file name. If the @samp{-@var{options}} | |
3021 | form is used, @var{options} is a list of @samp{-} separated options that | |
3022 | control the details of the dump. Not all options are applicable to all | |
3023 | dumps, those which are not meaningful will be ignored. The following | |
3024 | options are available | |
f71f87f9 | 3025 | |
e76b4820 | 3026 | @table @samp |
22367161 | 3027 | @item address |
767094dd | 3028 | Print the address of each node. Usually this is not meaningful as it |
22367161 NS |
3029 | changes according to the environment and source file. Its primary use |
3030 | is for tying up a dump file with a debug environment. | |
3031 | @item slim | |
3032 | Inhibit dumping of members of a scope or body of a function merely | |
3033 | because that scope has been reached. Only dump such items when they | |
3034 | are directly reachable by some other path. | |
3035 | @item all | |
3036 | Turn on all options. | |
e76b4820 NS |
3037 | @end table |
3038 | ||
3039 | The following tree dumps are possible: | |
3040 | @table @samp | |
3041 | @item original | |
3042 | Dump before any tree based optimization, to @file{@var{file}.original}. | |
3043 | @item optimized | |
3044 | Dump after all tree based optimization, to @file{@var{file}.optimized}. | |
6be77748 | 3045 | @item inlined |
9c34dbbf | 3046 | Dump after function inlining, to @file{@var{file}.inlined}. |
e76b4820 | 3047 | @end table |
9965d119 | 3048 | |
74291a4b | 3049 | @item -fpretend-float |
cd3bb277 | 3050 | @opindex fpretend-float |
74291a4b MM |
3051 | When running a cross-compiler, pretend that the target machine uses the |
3052 | same floating point format as the host machine. This causes incorrect | |
3053 | output of the actual floating constants, but the actual instruction | |
0c2d1a2a | 3054 | sequence will probably be the same as GCC would make when running on |
74291a4b MM |
3055 | the target machine. |
3056 | ||
3057 | @item -save-temps | |
cd3bb277 | 3058 | @opindex save-temps |
74291a4b MM |
3059 | Store the usual ``temporary'' intermediate files permanently; place them |
3060 | in the current directory and name them based on the source file. Thus, | |
3061 | compiling @file{foo.c} with @samp{-c -save-temps} would produce files | |
f2ecb02d JM |
3062 | @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a |
3063 | preprocessed @file{foo.i} output file even though the compiler now | |
3064 | normally uses an integrated preprocessor. | |
74291a4b | 3065 | |
03c41c05 | 3066 | @item -time |
cd3bb277 | 3067 | @opindex time |
03c41c05 | 3068 | Report the CPU time taken by each subprocess in the compilation |
f2ecb02d JM |
3069 | sequence. For C source files, this is the compiler proper and assembler |
3070 | (plus the linker if linking is done). The output looks like this: | |
03c41c05 ZW |
3071 | |
3072 | @smallexample | |
03c41c05 ZW |
3073 | # cc1 0.12 0.01 |
3074 | # as 0.00 0.01 | |
3075 | @end smallexample | |
3076 | ||
3077 | The first number on each line is the ``user time,'' that is time spent | |
3078 | executing the program itself. The second number is ``system time,'' | |
3079 | time spent executing operating system routines on behalf of the program. | |
3080 | Both numbers are in seconds. | |
3081 | ||
74291a4b | 3082 | @item -print-file-name=@var{library} |
cd3bb277 | 3083 | @opindex print-file-name |
74291a4b MM |
3084 | Print the full absolute name of the library file @var{library} that |
3085 | would be used when linking---and don't do anything else. With this | |
0c2d1a2a | 3086 | option, GCC does not compile or link anything; it just prints the |
74291a4b MM |
3087 | file name. |
3088 | ||
b1018de6 AO |
3089 | @item -print-multi-directory |
3090 | @opindex print-multi-directory | |
3091 | Print the directory name corresponding to the multilib selected by any | |
3092 | other switches present in the command line. This directory is supposed | |
3093 | to exist in @env{GCC_EXEC_PREFIX}. | |
3094 | ||
3095 | @item -print-multi-lib | |
3096 | @opindex print-multi-lib | |
3097 | Print the mapping from multilib directory names to compiler switches | |
3098 | that enable them. The directory name is separated from the switches by | |
3099 | @samp{;}, and each switch starts with an @samp{@@} instead of the | |
3100 | @samp{-}, without spaces between multiple switches. This is supposed to | |
3101 | ease shell-processing. | |
3102 | ||
74291a4b | 3103 | @item -print-prog-name=@var{program} |
cd3bb277 | 3104 | @opindex print-prog-name |
630d3d5a | 3105 | Like @option{-print-file-name}, but searches for a program such as @samp{cpp}. |
74291a4b MM |
3106 | |
3107 | @item -print-libgcc-file-name | |
cd3bb277 | 3108 | @opindex print-libgcc-file-name |
630d3d5a | 3109 | Same as @option{-print-file-name=libgcc.a}. |
74291a4b | 3110 | |
630d3d5a | 3111 | This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} |
74291a4b MM |
3112 | but you do want to link with @file{libgcc.a}. You can do |
3113 | ||
3114 | @example | |
3115 | gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` | |
3116 | @end example | |
3117 | ||
3118 | @item -print-search-dirs | |
cd3bb277 | 3119 | @opindex print-search-dirs |
74291a4b MM |
3120 | Print the name of the configured installation directory and a list of |
3121 | program and library directories gcc will search---and don't do anything else. | |
3122 | ||
3123 | This is useful when gcc prints the error message | |
3c0b7970 JM |
3124 | @samp{installation problem, cannot exec cpp0: No such file or directory}. |
3125 | To resolve this you either need to put @file{cpp0} and the other compiler | |
74291a4b | 3126 | components where gcc expects to find them, or you can set the environment |
bedc7537 | 3127 | variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. |
74291a4b MM |
3128 | Don't forget the trailing '/'. |
3129 | @xref{Environment Variables}. | |
1f0c3120 JM |
3130 | |
3131 | @item -dumpmachine | |
cd3bb277 | 3132 | @opindex dumpmachine |
1f0c3120 JM |
3133 | Print the compiler's target machine (for example, |
3134 | @samp{i686-pc-linux-gnu})---and don't do anything else. | |
3135 | ||
3136 | @item -dumpversion | |
cd3bb277 | 3137 | @opindex dumpversion |
1f0c3120 JM |
3138 | Print the compiler version (for example, @samp{3.0})---and don't do |
3139 | anything else. | |
3140 | ||
3141 | @item -dumpspecs | |
cd3bb277 | 3142 | @opindex dumpspecs |
1f0c3120 JM |
3143 | Print the compiler's built-in specs---and don't do anything else. (This |
3144 | is used when GCC itself is being built.) @xref{Spec Files}. | |
74291a4b MM |
3145 | @end table |
3146 | ||
3147 | @node Optimize Options | |
3148 | @section Options That Control Optimization | |
3149 | @cindex optimize options | |
3150 | @cindex options, optimization | |
3151 | ||
3152 | These options control various sorts of optimizations: | |
3153 | ||
2642624b | 3154 | @table @gcctabopt |
74291a4b MM |
3155 | @item -O |
3156 | @itemx -O1 | |
cd3bb277 JM |
3157 | @opindex O |
3158 | @opindex O1 | |
74291a4b MM |
3159 | Optimize. Optimizing compilation takes somewhat more time, and a lot |
3160 | more memory for a large function. | |
3161 | ||
630d3d5a | 3162 | Without @option{-O}, the compiler's goal is to reduce the cost of |
74291a4b MM |
3163 | compilation and to make debugging produce the expected results. |
3164 | Statements are independent: if you stop the program with a breakpoint | |
3165 | between statements, you can then assign a new value to any variable or | |
3166 | change the program counter to any other statement in the function and | |
3167 | get exactly the results you would expect from the source code. | |
3168 | ||
630d3d5a | 3169 | With @option{-O}, the compiler tries to reduce code size and execution |
9c34dbbf ZW |
3170 | time, without performing any optimizations that take a great deal of |
3171 | compilation time. | |
74291a4b MM |
3172 | |
3173 | @item -O2 | |
cd3bb277 | 3174 | @opindex O2 |
0c2d1a2a | 3175 | Optimize even more. GCC performs nearly all supported optimizations |
74291a4b | 3176 | that do not involve a space-speed tradeoff. The compiler does not |
630d3d5a JM |
3177 | perform loop unrolling or function inlining when you specify @option{-O2}. |
3178 | As compared to @option{-O}, this option increases both compilation time | |
74291a4b MM |
3179 | and the performance of the generated code. |
3180 | ||
630d3d5a | 3181 | @option{-O2} turns on all optional optimizations except for loop unrolling, |
2b2a8f1f | 3182 | function inlining, and register renaming. It also turns on the |
630d3d5a | 3183 | @option{-fforce-mem} option on all machines and frame pointer elimination |
2b2a8f1f | 3184 | on machines where doing so does not interfere with debugging. |
74291a4b | 3185 | |
081ca317 BL |
3186 | Please note the warning under @option{-fgcse} about |
3187 | invoking @option{-O2} on programs that use computed gotos. | |
3188 | ||
74291a4b | 3189 | @item -O3 |
cd3bb277 | 3190 | @opindex O3 |
630d3d5a JM |
3191 | Optimize yet more. @option{-O3} turns on all optimizations specified by |
3192 | @option{-O2} and also turns on the @option{-finline-functions} and | |
3193 | @option{-frename-registers} options. | |
74291a4b MM |
3194 | |
3195 | @item -O0 | |
cd3bb277 | 3196 | @opindex O0 |
74291a4b MM |
3197 | Do not optimize. |
3198 | ||
c6aded7c | 3199 | @item -Os |
cd3bb277 | 3200 | @opindex Os |
630d3d5a | 3201 | Optimize for size. @option{-Os} enables all @option{-O2} optimizations that |
c6aded7c AG |
3202 | do not typically increase code size. It also performs further |
3203 | optimizations designed to reduce code size. | |
3204 | ||
630d3d5a | 3205 | If you use multiple @option{-O} options, with or without level numbers, |
74291a4b MM |
3206 | the last such option is the one that is effective. |
3207 | @end table | |
3208 | ||
630d3d5a | 3209 | Options of the form @option{-f@var{flag}} specify machine-independent |
74291a4b | 3210 | flags. Most flags have both positive and negative forms; the negative |
630d3d5a | 3211 | form of @option{-ffoo} would be @option{-fno-foo}. In the table below, |
74291a4b MM |
3212 | only one of the forms is listed---the one which is not the default. |
3213 | You can figure out the other form by either removing @samp{no-} or | |
3214 | adding it. | |
3215 | ||
2642624b | 3216 | @table @gcctabopt |
74291a4b | 3217 | @item -ffloat-store |
cd3bb277 | 3218 | @opindex ffloat-store |
74291a4b MM |
3219 | Do not store floating point variables in registers, and inhibit other |
3220 | options that might change whether a floating point value is taken from a | |
3221 | register or memory. | |
3222 | ||
3223 | @cindex floating point precision | |
3224 | This option prevents undesirable excess precision on machines such as | |
3225 | the 68000 where the floating registers (of the 68881) keep more | |
3226 | precision than a @code{double} is supposed to have. Similarly for the | |
3227 | x86 architecture. For most programs, the excess precision does only | |
3228 | good, but a few programs rely on the precise definition of IEEE floating | |
630d3d5a | 3229 | point. Use @option{-ffloat-store} for such programs, after modifying |
6fd74494 | 3230 | them to store all pertinent intermediate computations into variables. |
74291a4b MM |
3231 | |
3232 | @item -fno-default-inline | |
cd3bb277 | 3233 | @opindex fno-default-inline |
74291a4b MM |
3234 | Do not make member functions inline by default merely because they are |
3235 | defined inside the class scope (C++ only). Otherwise, when you specify | |
630d3d5a | 3236 | @w{@option{-O}}, member functions defined inside class scope are compiled |
74291a4b MM |
3237 | inline by default; i.e., you don't need to add @samp{inline} in front of |
3238 | the member function name. | |
3239 | ||
3240 | @item -fno-defer-pop | |
cd3bb277 | 3241 | @opindex fno-defer-pop |
74291a4b MM |
3242 | Always pop the arguments to each function call as soon as that function |
3243 | returns. For machines which must pop arguments after a function call, | |
3244 | the compiler normally lets arguments accumulate on the stack for several | |
3245 | function calls and pops them all at once. | |
3246 | ||
3247 | @item -fforce-mem | |
cd3bb277 | 3248 | @opindex fforce-mem |
74291a4b MM |
3249 | Force memory operands to be copied into registers before doing |
3250 | arithmetic on them. This produces better code by making all memory | |
3251 | references potential common subexpressions. When they are not common | |
3252 | subexpressions, instruction combination should eliminate the separate | |
630d3d5a | 3253 | register-load. The @option{-O2} option turns on this option. |
74291a4b MM |
3254 | |
3255 | @item -fforce-addr | |
cd3bb277 | 3256 | @opindex fforce-addr |
74291a4b MM |
3257 | Force memory address constants to be copied into registers before |
3258 | doing arithmetic on them. This may produce better code just as | |
630d3d5a | 3259 | @option{-fforce-mem} may. |
74291a4b MM |
3260 | |
3261 | @item -fomit-frame-pointer | |
cd3bb277 | 3262 | @opindex fomit-frame-pointer |
74291a4b MM |
3263 | Don't keep the frame pointer in a register for functions that |
3264 | don't need one. This avoids the instructions to save, set up and | |
3265 | restore frame pointers; it also makes an extra register available | |
3266 | in many functions. @strong{It also makes debugging impossible on | |
3267 | some machines.} | |
3268 | ||
8aeea6e6 | 3269 | On some machines, such as the VAX, this flag has no effect, because |
74291a4b MM |
3270 | the standard calling sequence automatically handles the frame pointer |
3271 | and nothing is saved by pretending it doesn't exist. The | |
3272 | machine-description macro @code{FRAME_POINTER_REQUIRED} controls | |
3273 | whether a target machine supports this flag. @xref{Registers,,Register | |
b11cc610 | 3274 | Usage, gccint, GNU Compiler Collection (GCC) Internals}. |
74291a4b | 3275 | |
1aaef9c1 | 3276 | @item -foptimize-sibling-calls |
cd3bb277 | 3277 | @opindex foptimize-sibling-calls |
1aaef9c1 JH |
3278 | Optimize sibling and tail recursive calls. |
3279 | ||
91ce572a | 3280 | @item -ftrapv |
cd3bb277 | 3281 | @opindex ftrapv |
91ce572a CC |
3282 | This option generates traps for signed overflow on addition, subtraction, |
3283 | multiplication operations. | |
3284 | ||
74291a4b | 3285 | @item -fno-inline |
cd3bb277 | 3286 | @opindex fno-inline |
74291a4b MM |
3287 | Don't pay attention to the @code{inline} keyword. Normally this option |
3288 | is used to keep the compiler from expanding any functions inline. | |
3289 | Note that if you are not optimizing, no functions can be expanded inline. | |
3290 | ||
3291 | @item -finline-functions | |
cd3bb277 | 3292 | @opindex finline-functions |
74291a4b MM |
3293 | Integrate all simple functions into their callers. The compiler |
3294 | heuristically decides which functions are simple enough to be worth | |
3295 | integrating in this way. | |
3296 | ||
3297 | If all calls to a given function are integrated, and the function is | |
3298 | declared @code{static}, then the function is normally not output as | |
3299 | assembler code in its own right. | |
3300 | ||
efa3896a | 3301 | @item -finline-limit=@var{n} |
cd3bb277 | 3302 | @opindex finline-limit |
f9e814f1 TP |
3303 | By default, gcc limits the size of functions that can be inlined. This flag |
3304 | allows the control of this limit for functions that are explicitly marked as | |
02f52e19 AJ |
3305 | inline (ie marked with the inline keyword or defined within the class |
3306 | definition in c++). @var{n} is the size of functions that can be inlined in | |
f9e814f1 | 3307 | number of pseudo instructions (not counting parameter handling). The default |
93ee12c4 GP |
3308 | value of @var{n} is 600. |
3309 | Increasing this value can result in more inlined code at | |
f9e814f1 | 3310 | the cost of compilation time and memory consumption. Decreasing usually makes |
02f52e19 AJ |
3311 | the compilation faster and less code will be inlined (which presumably |
3312 | means slower programs). This option is particularly useful for programs that | |
aee96fe9 | 3313 | use inlining heavily such as those based on recursive templates with C++. |
f9e814f1 TP |
3314 | |
3315 | @emph{Note:} pseudo instruction represents, in this particular context, an | |
3316 | abstract measurement of function's size. In no way, it represents a count | |
3317 | of assembly instructions and as such its exact meaning might change from one | |
3318 | release to an another. | |
3319 | ||
74291a4b | 3320 | @item -fkeep-inline-functions |
cd3bb277 | 3321 | @opindex fkeep-inline-functions |
74291a4b MM |
3322 | Even if all calls to a given function are integrated, and the function |
3323 | is declared @code{static}, nevertheless output a separate run-time | |
3324 | callable version of the function. This switch does not affect | |
3325 | @code{extern inline} functions. | |
3326 | ||
3327 | @item -fkeep-static-consts | |
cd3bb277 | 3328 | @opindex fkeep-static-consts |
74291a4b MM |
3329 | Emit variables declared @code{static const} when optimization isn't turned |
3330 | on, even if the variables aren't referenced. | |
3331 | ||
0c2d1a2a | 3332 | GCC enables this option by default. If you want to force the compiler to |
74291a4b | 3333 | check if the variable was referenced, regardless of whether or not |
630d3d5a | 3334 | optimization is turned on, use the @option{-fno-keep-static-consts} option. |
74291a4b | 3335 | |
201556f0 JJ |
3336 | @item -fmerge-constants |
3337 | Attempt to merge identical constants (string constants and floating point | |
3338 | constants) accross compilation units. | |
3339 | ||
3340 | This option is default for optimized compilation if assembler and linker | |
c21cd8b1 | 3341 | support it. Use @option{-fno-merge-constants} to inhibit this behavior. |
201556f0 JJ |
3342 | |
3343 | @item -fmerge-all-constants | |
3344 | Attempt to merge identical constants and identical variables. | |
3345 | ||
3346 | This option implies @option{-fmerge-constants}. In addition to | |
3347 | @option{-fmerge-constants} this considers e.g. even constant initialized | |
3348 | arrays or initialized constant variables with integral or floating point | |
3349 | types. Languages like C or C++ require each non-automatic variable to | |
3350 | have distinct location, so using this option will result in non-conforming | |
c21cd8b1 | 3351 | behavior. |
201556f0 | 3352 | |
74291a4b | 3353 | @item -fno-function-cse |
cd3bb277 | 3354 | @opindex fno-function-cse |
74291a4b MM |
3355 | Do not put function addresses in registers; make each instruction that |
3356 | calls a constant function contain the function's address explicitly. | |
3357 | ||
3358 | This option results in less efficient code, but some strange hacks | |
3359 | that alter the assembler output may be confused by the optimizations | |
3360 | performed when this option is not used. | |
3361 | ||
3362 | @item -ffast-math | |
cd3bb277 | 3363 | @opindex ffast-math |
9c34dbbf ZW |
3364 | Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, and @* |
3365 | @option{-fno-trapping-math}. | |
de6c5979 | 3366 | |
630d3d5a | 3367 | This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. |
74291a4b | 3368 | |
630d3d5a | 3369 | This option should never be turned on by any @option{-O} option since |
74291a4b | 3370 | it can result in incorrect output for programs which depend on |
c1030c7c | 3371 | an exact implementation of IEEE or ISO rules/specifications for |
74291a4b | 3372 | math functions. |
9605da8a BL |
3373 | |
3374 | @item -fno-math-errno | |
cd3bb277 | 3375 | @opindex fno-math-errno |
9605da8a BL |
3376 | Do not set ERRNO after calling math functions that are executed |
3377 | with a single instruction, e.g., sqrt. A program that relies on | |
3378 | IEEE exceptions for math error handling may want to use this flag | |
3379 | for speed while maintaining IEEE arithmetic compatibility. | |
3380 | ||
630d3d5a | 3381 | This option should never be turned on by any @option{-O} option since |
de6c5979 BL |
3382 | it can result in incorrect output for programs which depend on |
3383 | an exact implementation of IEEE or ISO rules/specifications for | |
3384 | math functions. | |
3385 | ||
9c34dbbf | 3386 | The default is @option{-fmath-errno}. |
de6c5979 BL |
3387 | |
3388 | @item -funsafe-math-optimizations | |
cd3bb277 | 3389 | @opindex funsafe-math-optimizations |
de6c5979 BL |
3390 | Allow optimizations for floating-point arithmetic that (a) assume |
3391 | that arguments and results are valid and (b) may violate IEEE or | |
237b14f7 RH |
3392 | ANSI standards. When used at link-time, it may include libraries |
3393 | or startup files that change the default FPU control word or other | |
3394 | similar optimizations. | |
de6c5979 | 3395 | |
630d3d5a | 3396 | This option should never be turned on by any @option{-O} option since |
de6c5979 BL |
3397 | it can result in incorrect output for programs which depend on |
3398 | an exact implementation of IEEE or ISO rules/specifications for | |
3399 | math functions. | |
3400 | ||
9c34dbbf | 3401 | The default is @option{-fno-unsafe-math-optimizations}. |
de6c5979 BL |
3402 | |
3403 | @item -fno-trapping-math | |
cd3bb277 | 3404 | @opindex fno-trapping-math |
de6c5979 BL |
3405 | Compile code assuming that floating-point operations cannot generate |
3406 | user-visible traps. Setting this option may allow faster code | |
3407 | if one relies on ``non-stop'' IEEE arithmetic, for example. | |
3408 | ||
630d3d5a | 3409 | This option should never be turned on by any @option{-O} option since |
de6c5979 BL |
3410 | it can result in incorrect output for programs which depend on |
3411 | an exact implementation of IEEE or ISO rules/specifications for | |
3412 | math functions. | |
3413 | ||
9c34dbbf | 3414 | The default is @option{-ftrapping-math}. |
74291a4b MM |
3415 | @end table |
3416 | ||
630d3d5a JM |
3417 | The following options control specific optimizations. The @option{-O2} |
3418 | option turns on all of these optimizations except @option{-funroll-loops} | |
3419 | and @option{-funroll-all-loops}. On most machines, the @option{-O} option | |
3420 | turns on the @option{-fthread-jumps} and @option{-fdelayed-branch} options, | |
74291a4b MM |
3421 | but specific machines may handle it differently. |
3422 | ||
3423 | You can use the following flags in the rare cases when ``fine-tuning'' | |
3424 | of optimizations to be performed is desired. | |
3425 | ||
9c34dbbf ZW |
3426 | Not all of the optimizations performed by GCC have @option{-f} options |
3427 | to control them. | |
3428 | ||
ad919812 | 3429 | @table @gcctabopt |
74291a4b | 3430 | @item -fstrength-reduce |
cd3bb277 | 3431 | @opindex fstrength-reduce |
74291a4b MM |
3432 | Perform the optimizations of loop strength reduction and |
3433 | elimination of iteration variables. | |
3434 | ||
3435 | @item -fthread-jumps | |
cd3bb277 | 3436 | @opindex fthread-jumps |
74291a4b MM |
3437 | Perform optimizations where we check to see if a jump branches to a |
3438 | location where another comparison subsumed by the first is found. If | |
3439 | so, the first branch is redirected to either the destination of the | |
3440 | second branch or a point immediately following it, depending on whether | |
3441 | the condition is known to be true or false. | |
3442 | ||
3443 | @item -fcse-follow-jumps | |
cd3bb277 | 3444 | @opindex fcse-follow-jumps |
74291a4b MM |
3445 | In common subexpression elimination, scan through jump instructions |
3446 | when the target of the jump is not reached by any other path. For | |
3447 | example, when CSE encounters an @code{if} statement with an | |
3448 | @code{else} clause, CSE will follow the jump when the condition | |
3449 | tested is false. | |
3450 | ||
3451 | @item -fcse-skip-blocks | |
cd3bb277 | 3452 | @opindex fcse-skip-blocks |
630d3d5a | 3453 | This is similar to @option{-fcse-follow-jumps}, but causes CSE to |
74291a4b MM |
3454 | follow jumps which conditionally skip over blocks. When CSE |
3455 | encounters a simple @code{if} statement with no else clause, | |
630d3d5a | 3456 | @option{-fcse-skip-blocks} causes CSE to follow the jump around the |
74291a4b MM |
3457 | body of the @code{if}. |
3458 | ||
3459 | @item -frerun-cse-after-loop | |
cd3bb277 | 3460 | @opindex frerun-cse-after-loop |
74291a4b MM |
3461 | Re-run common subexpression elimination after loop optimizations has been |
3462 | performed. | |
3463 | ||
6d6d0fa0 | 3464 | @item -frerun-loop-opt |
cd3bb277 | 3465 | @opindex frerun-loop-opt |
6d6d0fa0 JL |
3466 | Run the loop optimizer twice. |
3467 | ||
7506f491 | 3468 | @item -fgcse |
cd3bb277 | 3469 | @opindex fgcse |
7506f491 DE |
3470 | Perform a global common subexpression elimination pass. |
3471 | This pass also performs global constant and copy propagation. | |
3472 | ||
081ca317 BL |
3473 | @emph{Note:} When compiling a program using computed gotos, a GCC |
3474 | extension, you may get better runtime performance if you disable | |
3475 | the global common subexpression elmination pass by adding | |
3476 | @option{-fno-gcse} to the command line. | |
3477 | ||
a13d4ebf | 3478 | @item -fgcse-lm |
cd3bb277 | 3479 | @opindex fgcse-lm |
695ac33f | 3480 | When @option{-fgcse-lm} is enabled, global common subexpression elimination will |
767094dd | 3481 | attempt to move loads which are only killed by stores into themselves. This |
a13d4ebf | 3482 | allows a loop containing a load/store sequence to be changed to a load outside |
02f52e19 | 3483 | the loop, and a copy/store within the loop. |
a13d4ebf AM |
3484 | |
3485 | @item -fgcse-sm | |
cd3bb277 | 3486 | @opindex fgcse-sm |
695ac33f | 3487 | When @option{-fgcse-sm} is enabled, A store motion pass is run after global common |
767094dd | 3488 | subexpression elimination. This pass will attempt to move stores out of loops. |
695ac33f | 3489 | When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence |
a13d4ebf AM |
3490 | can be changed to a load before the loop and a store after the loop. |
3491 | ||
b6d24183 | 3492 | @item -fdelete-null-pointer-checks |
cd3bb277 | 3493 | @opindex fdelete-null-pointer-checks |
9c34dbbf ZW |
3494 | Use global dataflow analysis to identify and eliminate useless checks |
3495 | for null pointers. The compiler assumes that dereferencing a null | |
3496 | pointer would have halted the program. If a pointer is checked after | |
3497 | it has already been dereferenced, it cannot be null. | |
3498 | ||
3499 | In some environments, this assumption is not true, and programs can | |
3500 | safely dereference null pointers. Use | |
3501 | @option{-fno-delete-null-pointer-checks} to disable this optimization | |
3502 | for programs which depend on that behavior. | |
b6d24183 | 3503 | |
74291a4b | 3504 | @item -fexpensive-optimizations |
cd3bb277 | 3505 | @opindex fexpensive-optimizations |
74291a4b MM |
3506 | Perform a number of minor optimizations that are relatively expensive. |
3507 | ||
639726ba | 3508 | @item -foptimize-register-move |
59d40964 | 3509 | @itemx -fregmove |
cd3bb277 JM |
3510 | @opindex foptimize-register-move |
3511 | @opindex fregmove | |
9ec36da5 JL |
3512 | Attempt to reassign register numbers in move instructions and as |
3513 | operands of other simple instructions in order to maximize the amount of | |
56159047 | 3514 | register tying. This is especially helpful on machines with two-operand |
630d3d5a | 3515 | instructions. GCC enables this optimization by default with @option{-O2} |
9ec36da5 JL |
3516 | or higher. |
3517 | ||
bedc7537 | 3518 | Note @option{-fregmove} and @option{-foptimize-register-move} are the same |
9ec36da5 JL |
3519 | optimization. |
3520 | ||
74291a4b | 3521 | @item -fdelayed-branch |
cd3bb277 | 3522 | @opindex fdelayed-branch |
74291a4b MM |
3523 | If supported for the target machine, attempt to reorder instructions |
3524 | to exploit instruction slots available after delayed branch | |
3525 | instructions. | |
3526 | ||
3527 | @item -fschedule-insns | |
cd3bb277 | 3528 | @opindex fschedule-insns |
74291a4b MM |
3529 | If supported for the target machine, attempt to reorder instructions to |
3530 | eliminate execution stalls due to required data being unavailable. This | |
3531 | helps machines that have slow floating point or memory load instructions | |
3532 | by allowing other instructions to be issued until the result of the load | |
3533 | or floating point instruction is required. | |
3534 | ||
3535 | @item -fschedule-insns2 | |
cd3bb277 | 3536 | @opindex fschedule-insns2 |
630d3d5a | 3537 | Similar to @option{-fschedule-insns}, but requests an additional pass of |
74291a4b MM |
3538 | instruction scheduling after register allocation has been done. This is |
3539 | especially useful on machines with a relatively small number of | |
3540 | registers and where memory load instructions take more than one cycle. | |
3541 | ||
3542 | @item -ffunction-sections | |
59d40964 | 3543 | @itemx -fdata-sections |
cd3bb277 JM |
3544 | @opindex ffunction-sections |
3545 | @opindex fdata-sections | |
7d0756fb CM |
3546 | Place each function or data item into its own section in the output |
3547 | file if the target supports arbitrary sections. The name of the | |
3548 | function or the name of the data item determines the section's name | |
3549 | in the output file. | |
74291a4b | 3550 | |
7d0756fb | 3551 | Use these options on systems where the linker can perform optimizations |
74291a4b MM |
3552 | to improve locality of reference in the instruction space. HPPA |
3553 | processors running HP-UX and Sparc processors running Solaris 2 have | |
3554 | linkers with such optimizations. Other systems using the ELF object format | |
3555 | as well as AIX may have these optimizations in the future. | |
3556 | ||
7d0756fb CM |
3557 | Only use these options when there are significant benefits from doing |
3558 | so. When you specify these options, the assembler and linker will | |
74291a4b MM |
3559 | create larger object and executable files and will also be slower. |
3560 | You will not be able to use @code{gprof} on all systems if you | |
3561 | specify this option and you may have problems with debugging if | |
630d3d5a | 3562 | you specify both this option and @option{-g}. |
74291a4b MM |
3563 | |
3564 | @item -fcaller-saves | |
cd3bb277 | 3565 | @opindex fcaller-saves |
74291a4b MM |
3566 | Enable values to be allocated in registers that will be clobbered by |
3567 | function calls, by emitting extra instructions to save and restore the | |
3568 | registers around such calls. Such allocation is done only when it | |
3569 | seems to result in better code than would otherwise be produced. | |
3570 | ||
81610a0d HPN |
3571 | This option is always enabled by default on certain machines, usually |
3572 | those which have no call-preserved registers to use instead. | |
3573 | ||
3574 | For all machines, optimization level 2 and higher enables this flag by | |
3575 | default. | |
74291a4b MM |
3576 | |
3577 | @item -funroll-loops | |
cd3bb277 | 3578 | @opindex funroll-loops |
9c34dbbf ZW |
3579 | Unroll loops whose number of iterations can be determined at compile |
3580 | time or upon entry to the loop. @option{-funroll-loops} implies both | |
3581 | @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}. This | |
3582 | option makes code larger, and may or may not make it run faster. | |
74291a4b MM |
3583 | |
3584 | @item -funroll-all-loops | |
cd3bb277 | 3585 | @opindex funroll-all-loops |
9c34dbbf ZW |
3586 | Unroll all loops, even if their number of iterations is uncertain when |
3587 | the loop is entered. This usually makes programs run more slowly. | |
3588 | @option{-funroll-all-loops} implies the same options as | |
3589 | @option{-funroll-loops}, | |
3590 | ||
0dd0e980 JH |
3591 | @item -fprefetch-loop-arrays |
3592 | @opindex fprefetch-loop-arrays | |
3593 | If supported by the target machine, generate instructions to prefetch | |
3594 | memory to improve the performance of loops that access large arrays. | |
74291a4b | 3595 | |
e5eb27e5 | 3596 | @item -fmove-all-movables |
cd3bb277 | 3597 | @opindex fmove-all-movables |
e5eb27e5 JL |
3598 | Forces all invariant computations in loops to be moved |
3599 | outside the loop. | |
3600 | ||
3601 | @item -freduce-all-givs | |
cd3bb277 | 3602 | @opindex freduce-all-givs |
e5eb27e5 JL |
3603 | Forces all general-induction variables in loops to be |
3604 | strength-reduced. | |
3605 | ||
3606 | @emph{Note:} When compiling programs written in Fortran, | |
630d3d5a | 3607 | @option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled |
e5eb27e5 JL |
3608 | by default when you use the optimizer. |
3609 | ||
3610 | These options may generate better or worse code; results are highly | |
3611 | dependent on the structure of loops within the source code. | |
3612 | ||
3613 | These two options are intended to be removed someday, once | |
3614 | they have helped determine the efficacy of various | |
3615 | approaches to improving loop optimizations. | |
3616 | ||
2642624b | 3617 | Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}}) |
e5eb27e5 JL |
3618 | know how use of these options affects |
3619 | the performance of your production code. | |
3620 | We're very interested in code that runs @emph{slower} | |
3621 | when these options are @emph{enabled}. | |
3622 | ||
74291a4b | 3623 | @item -fno-peephole |
6cfc0341 | 3624 | @itemx -fno-peephole2 |
cd3bb277 | 3625 | @opindex fno-peephole |
6cfc0341 RH |
3626 | @opindex fno-peephole2 |
3627 | Disable any machine-specific peephole optimizations. The difference | |
630d3d5a | 3628 | between @option{-fno-peephole} and @option{-fno-peephole2} is in how they |
6cfc0341 RH |
3629 | are implemented in the compiler; some targets use one, some use the |
3630 | other, a few use both. | |
861bb6c1 JL |
3631 | |
3632 | @item -fbranch-probabilities | |
cd3bb277 | 3633 | @opindex fbranch-probabilities |
630d3d5a | 3634 | After running a program compiled with @option{-fprofile-arcs} |
861bb6c1 | 3635 | (@pxref{Debugging Options,, Options for Debugging Your Program or |
bedc7537 | 3636 | @command{gcc}}), you can compile it a second time using |
630d3d5a | 3637 | @option{-fbranch-probabilities}, to improve optimizations based on |
3de87bf2 JJ |
3638 | the number of times each branch was taken. When the program |
3639 | compiled with @option{-fprofile-arcs} exits it saves arc execution | |
3640 | counts to a file called @file{@var{sourcename}.da} for each source | |
3641 | file The information in this data file is very dependent on the | |
3642 | structure of the generated code, so you must use the same source code | |
3643 | and the same optimization options for both compilations. | |
861bb6c1 | 3644 | |
630d3d5a | 3645 | With @option{-fbranch-probabilities}, GCC puts a @samp{REG_EXEC_COUNT} |
861bb6c1 JL |
3646 | note on the first instruction of each basic block, and a |
3647 | @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. | |
3648 | These can be used to improve optimization. Currently, they are only | |
3649 | used in one place: in @file{reorg.c}, instead of guessing which path a | |
3650 | branch is mostly to take, the @samp{REG_BR_PROB} values are used to | |
3651 | exactly determine which path is taken more often. | |
8c660648 | 3652 | |
454d0cc7 | 3653 | @item -fno-guess-branch-probability |
cd3bb277 | 3654 | @opindex fno-guess-branch-probability |
9c34dbbf ZW |
3655 | Do not guess branch probabilities using a randomized model. |
3656 | ||
3657 | Sometimes gcc will opt to use a randomized model to guess branch | |
3658 | probabilities, when none are available from either profiling feedback | |
3659 | (@option{-fprofile-arcs}) or @samp{__builtin_expect}. This means that | |
3660 | different runs of the compiler on the same program may produce different | |
3661 | object code. | |
3662 | ||
3663 | In a hard real-time system, people don't want different runs of the | |
3664 | compiler to produce code that has different behavior; minimizing | |
3665 | non-determinism is of paramount import. This switch allows users to | |
3666 | reduce non-determinism, possibly at the expense of inferior | |
3667 | optimization. | |
454d0cc7 | 3668 | |
41472af8 | 3669 | @item -fstrict-aliasing |
cd3bb277 | 3670 | @opindex fstrict-aliasing |
41472af8 MM |
3671 | Allows the compiler to assume the strictest aliasing rules applicable to |
3672 | the language being compiled. For C (and C++), this activates | |
3673 | optimizations based on the type of expressions. In particular, an | |
3674 | object of one type is assumed never to reside at the same address as an | |
3675 | object of a different type, unless the types are almost the same. For | |
3676 | example, an @code{unsigned int} can alias an @code{int}, but not a | |
3677 | @code{void*} or a @code{double}. A character type may alias any other | |
02f52e19 | 3678 | type. |
41472af8 MM |
3679 | |
3680 | Pay special attention to code like this: | |
3681 | @example | |
02f52e19 | 3682 | union a_union @{ |
41472af8 MM |
3683 | int i; |
3684 | double d; | |
3685 | @}; | |
3686 | ||
3687 | int f() @{ | |
3688 | a_union t; | |
3689 | t.d = 3.0; | |
3690 | return t.i; | |
3691 | @} | |
3692 | @end example | |
3693 | The practice of reading from a different union member than the one most | |
3694 | recently written to (called ``type-punning'') is common. Even with | |
630d3d5a | 3695 | @option{-fstrict-aliasing}, type-punning is allowed, provided the memory |
41472af8 MM |
3696 | is accessed through the union type. So, the code above will work as |
3697 | expected. However, this code might not: | |
3698 | @example | |
02f52e19 | 3699 | int f() @{ |
41472af8 MM |
3700 | a_union t; |
3701 | int* ip; | |
3702 | t.d = 3.0; | |
3703 | ip = &t.i; | |
3704 | return *ip; | |
3705 | @} | |
3706 | @end example | |
3707 | ||
41472af8 MM |
3708 | Every language that wishes to perform language-specific alias analysis |
3709 | should define a function that computes, given an @code{tree} | |
3710 | node, an alias set for the node. Nodes in different alias sets are not | |
3711 | allowed to alias. For an example, see the C front-end function | |
3712 | @code{c_get_alias_set}. | |
41472af8 | 3713 | |
efa3896a GK |
3714 | @item -falign-functions |
3715 | @itemx -falign-functions=@var{n} | |
cd3bb277 | 3716 | @opindex falign-functions |
efa3896a GK |
3717 | Align the start of functions to the next power-of-two greater than |
3718 | @var{n}, skipping up to @var{n} bytes. For instance, | |
630d3d5a JM |
3719 | @option{-falign-functions=32} aligns functions to the next 32-byte |
3720 | boundary, but @option{-falign-functions=24} would align to the next | |
efa3896a GK |
3721 | 32-byte boundary only if this can be done by skipping 23 bytes or less. |
3722 | ||
630d3d5a | 3723 | @option{-fno-align-functions} and @option{-falign-functions=1} are |
efa3896a GK |
3724 | equivalent and mean that functions will not be aligned. |
3725 | ||
3726 | Some assemblers only support this flag when @var{n} is a power of two; | |
3727 | in that case, it is rounded up. | |
3728 | ||
3729 | If @var{n} is not specified, use a machine-dependent default. | |
3730 | ||
3731 | @item -falign-labels | |
3732 | @itemx -falign-labels=@var{n} | |
cd3bb277 | 3733 | @opindex falign-labels |
efa3896a | 3734 | Align all branch targets to a power-of-two boundary, skipping up to |
630d3d5a | 3735 | @var{n} bytes like @option{-falign-functions}. This option can easily |
efa3896a GK |
3736 | make code slower, because it must insert dummy operations for when the |
3737 | branch target is reached in the usual flow of the code. | |
3738 | ||
630d3d5a | 3739 | If @option{-falign-loops} or @option{-falign-jumps} are applicable and |
efa3896a GK |
3740 | are greater than this value, then their values are used instead. |
3741 | ||
3742 | If @var{n} is not specified, use a machine-dependent default which is | |
3743 | very likely to be @samp{1}, meaning no alignment. | |
3744 | ||
3745 | @item -falign-loops | |
3746 | @itemx -falign-loops=@var{n} | |
cd3bb277 | 3747 | @opindex falign-loops |
efa3896a | 3748 | Align loops to a power-of-two boundary, skipping up to @var{n} bytes |
630d3d5a | 3749 | like @option{-falign-functions}. The hope is that the loop will be |
efa3896a GK |
3750 | executed many times, which will make up for any execution of the dummy |
3751 | operations. | |
3752 | ||
3753 | If @var{n} is not specified, use a machine-dependent default. | |
3754 | ||
3755 | @item -falign-jumps | |
3756 | @itemx -falign-jumps=@var{n} | |
cd3bb277 | 3757 | @opindex falign-jumps |
efa3896a GK |
3758 | Align branch targets to a power-of-two boundary, for branch targets |
3759 | where the targets can only be reached by jumping, skipping up to @var{n} | |
630d3d5a | 3760 | bytes like @option{-falign-functions}. In this case, no dummy operations |
efa3896a GK |
3761 | need be executed. |
3762 | ||
3763 | If @var{n} is not specified, use a machine-dependent default. | |
3764 | ||
4bae0b47 | 3765 | @item -fssa |
cd3bb277 | 3766 | @opindex fssa |
4bae0b47 AS |
3767 | Perform optimizations in static single assignment form. Each function's |
3768 | flow graph is translated into SSA form, optimizations are performed, and | |
90ecce3e | 3769 | the flow graph is translated back from SSA form. Users should not |
b53978a3 JO |
3770 | specify this option, since it is not yet ready for production use. |
3771 | ||
0b47e4c1 JL |
3772 | @item -fssa-ccp |
3773 | @opindex fssa-ccp | |
3774 | Perform Sparse Conditional Constant Propagation in SSA form. Requires | |
3775 | @option{-fssa}. Like @option{-fssa}, this is an experimental feature. | |
3776 | ||
62d285ff JL |
3777 | @item -fssa-dce |
3778 | @opindex fssa-dce | |
3779 | Perform aggressive dead-code elimination in SSA form. Requires @option{-fssa}. | |
3780 | Like @option{-fssa}, this is an experimental feature. | |
4bae0b47 | 3781 | |
46d3a873 | 3782 | @item -fsingle-precision-constant |
cd3bb277 | 3783 | @opindex fsingle-precision-constant |
46d3a873 CC |
3784 | Treat floating point constant as single precision constant instead of |
3785 | implicitly converting it to double precision constant. | |
3786 | ||
2b2a8f1f | 3787 | @item -frename-registers |
cd3bb277 | 3788 | @opindex frename-registers |
c771326b | 3789 | Attempt to avoid false dependencies in scheduled code by making use |
2b2a8f1f RH |
3790 | of registers left over after register allocation. This optimization |
3791 | will most benefit processors with lots of registers. It can, however, | |
3792 | make debugging impossible, since variables will no longer stay in | |
3793 | a ``home register''. | |
3af64fd6 | 3794 | |
8582c27b RH |
3795 | @item -fno-cprop-registers |
3796 | @opindex fno-cprop-registers | |
3797 | After register allocation and post-register allocation instruction splitting, | |
3798 | we perform a copy-propagation pass to try to reduce scheduling dependencies | |
3799 | and occasionally eliminate the copy. | |
3800 | ||
3af64fd6 | 3801 | @item --param @var{name}=@var{value} |
cd3bb277 | 3802 | @opindex param |
3af64fd6 MM |
3803 | In some places, GCC uses various constants to control the amount of |
3804 | optimization that is done. For example, GCC will not inline functions | |
3805 | that contain more that a certain number of instructions. You can | |
3806 | control some of these constants on the command-line using the | |
630d3d5a | 3807 | @option{--param} option. |
3af64fd6 | 3808 | |
4fe9b91c | 3809 | In each case, the @var{value} is an integer. The allowable choices for |
3af64fd6 MM |
3810 | @var{name} are given in the following table: |
3811 | ||
3812 | @table @gcctabopt | |
1c4c47db JO |
3813 | @item max-delay-slot-insn-search |
3814 | The maximum number of instructions to consider when looking for an | |
3815 | instruction to fill a delay slot. If more than this arbitrary number of | |
3816 | instructions is searched, the time savings from filling the delay slot | |
3817 | will be minimal so stop searching. Increasing values mean more | |
3818 | aggressive optimization, making the compile time increase with probably | |
3819 | small improvement in executable run time. | |
3820 | ||
3821 | @item max-delay-slot-live-search | |
3822 | When trying to fill delay slots, the maximum number of instructions to | |
3823 | consider when searching for a block with valid live register | |
3824 | information. Increasing this arbitrarily chosen value means more | |
3825 | aggressive optimization, increasing the compile time. This parameter | |
3826 | should be removed when the delay slot code is rewritten to maintain the | |
3827 | control-flow graph. | |
33d3b05b MM |
3828 | |
3829 | @item max-gcse-memory | |
3830 | The approximate maximum amount of memory that will be allocated in | |
3831 | order to perform the global common subexpression elimination | |
3832 | optimization. If more memory than specified is required, the | |
3833 | optimization will not be done. | |
3af64fd6 | 3834 | |
740f35a0 | 3835 | @item max-gcse-passes |
7dac2f89 | 3836 | The maximum number of passes of GCSE to run. |
740f35a0 | 3837 | |
4a121cc3 | 3838 | @item max-pending-list-length |
0c688a7d | 3839 | The maximum number of pending dependencies scheduling will allow |
4a121cc3 AM |
3840 | before flushing the current state and starting over. Large functions |
3841 | with few branches or calls can create excessively large lists which | |
3842 | needlessly consume memory and resources. | |
3843 | ||
1c4c47db JO |
3844 | @item max-inline-insns |
3845 | If an function contains more than this many instructions, it | |
3846 | will not be inlined. This option is precisely equivalent to | |
630d3d5a | 3847 | @option{-finline-limit}. |
1c4c47db JO |
3848 | |
3849 | @end table | |
74291a4b MM |
3850 | @end table |
3851 | ||
3852 | @node Preprocessor Options | |
3853 | @section Options Controlling the Preprocessor | |
3854 | @cindex preprocessor options | |
3855 | @cindex options, preprocessor | |
3856 | ||
3857 | These options control the C preprocessor, which is run on each C source | |
3858 | file before actual compilation. | |
3859 | ||
630d3d5a JM |
3860 | If you use the @option{-E} option, nothing is done except preprocessing. |
3861 | Some of these options make sense only together with @option{-E} because | |
74291a4b MM |
3862 | they cause the preprocessor output to be unsuitable for actual |
3863 | compilation. | |
3864 | ||
2642624b | 3865 | @table @gcctabopt |
74291a4b | 3866 | @item -include @var{file} |
cd3bb277 | 3867 | @opindex include |
74291a4b | 3868 | Process @var{file} as input before processing the regular input file. |
630d3d5a JM |
3869 | In effect, the contents of @var{file} are compiled first. Any @option{-D} |
3870 | and @option{-U} options on the command line are always processed before | |
3871 | @option{-include @var{file}}, regardless of the order in which they are | |
3872 | written. All the @option{-include} and @option{-imacros} options are | |
74291a4b MM |
3873 | processed in the order in which they are written. |
3874 | ||
3875 | @item -imacros @var{file} | |
cd3bb277 | 3876 | @opindex imacros |
74291a4b MM |
3877 | Process @var{file} as input, discarding the resulting output, before |
3878 | processing the regular input file. Because the output generated from | |
630d3d5a | 3879 | @var{file} is discarded, the only effect of @option{-imacros @var{file}} |
74291a4b | 3880 | is to make the macros defined in @var{file} available for use in the |
630d3d5a | 3881 | main input. All the @option{-include} and @option{-imacros} options are |
e582248c | 3882 | processed in the order in which they are written. |
74291a4b MM |
3883 | |
3884 | @item -idirafter @var{dir} | |
cd3bb277 | 3885 | @opindex idirafter |
74291a4b MM |
3886 | @cindex second include path |
3887 | Add the directory @var{dir} to the second include path. The directories | |
3888 | on the second include path are searched when a header file is not found | |
3889 | in any of the directories in the main include path (the one that | |
630d3d5a | 3890 | @option{-I} adds to). |
74291a4b MM |
3891 | |
3892 | @item -iprefix @var{prefix} | |
cd3bb277 | 3893 | @opindex iprefix |
630d3d5a | 3894 | Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix} |
74291a4b MM |
3895 | options. |
3896 | ||
3897 | @item -iwithprefix @var{dir} | |
cd3bb277 | 3898 | @opindex iwithprefix |
74291a4b MM |
3899 | Add a directory to the second include path. The directory's name is |
3900 | made by concatenating @var{prefix} and @var{dir}, where @var{prefix} was | |
630d3d5a | 3901 | specified previously with @option{-iprefix}. If you have not specified a |
74291a4b MM |
3902 | prefix yet, the directory containing the installed passes of the |
3903 | compiler is used as the default. | |
3904 | ||
3905 | @item -iwithprefixbefore @var{dir} | |
cd3bb277 | 3906 | @opindex iwithprefixbefore |
74291a4b MM |
3907 | Add a directory to the main include path. The directory's name is made |
3908 | by concatenating @var{prefix} and @var{dir}, as in the case of | |
630d3d5a | 3909 | @option{-iwithprefix}. |
74291a4b MM |
3910 | |
3911 | @item -isystem @var{dir} | |
cd3bb277 | 3912 | @opindex isystem |
74291a4b MM |
3913 | Add a directory to the beginning of the second include path, marking it |
3914 | as a system directory, so that it gets the same special treatment as | |
3915 | is applied to the standard system directories. | |
3916 | ||
3917 | @item -nostdinc | |
cd3bb277 | 3918 | @opindex nostdinc |
74291a4b | 3919 | Do not search the standard system directories for header files. Only |
630d3d5a | 3920 | the directories you have specified with @option{-I} options (and the |
74291a4b | 3921 | current directory, if appropriate) are searched. @xref{Directory |
630d3d5a | 3922 | Options}, for information on @option{-I}. |
74291a4b | 3923 | |
dfb5868d NS |
3924 | By using both @option{-nostdinc} and @option{-I-}, you can limit the include-file |
3925 | search path to only those directories you specify explicitly. | |
74291a4b | 3926 | |
e582248c | 3927 | @item -remap |
cd3bb277 | 3928 | @opindex remap |
e582248c NB |
3929 | When searching for a header file in a directory, remap file names if a |
3930 | file named @file{header.gcc} exists in that directory. This can be used | |
3931 | to work around limitations of file systems with file name restrictions. | |
3932 | The @file{header.gcc} file should contain a series of lines with two | |
3933 | tokens on each line: the first token is the name to map, and the second | |
3934 | token is the actual name to use. | |
3935 | ||
74291a4b | 3936 | @item -undef |
cd3bb277 | 3937 | @opindex undef |
74291a4b MM |
3938 | Do not predefine any nonstandard macros. (Including architecture flags). |
3939 | ||
3940 | @item -E | |
cd3bb277 | 3941 | @opindex E |
74291a4b MM |
3942 | Run only the C preprocessor. Preprocess all the C source files |
3943 | specified and output the results to standard output or to the | |
3944 | specified output file. | |
3945 | ||
3946 | @item -C | |
cd3bb277 | 3947 | @opindex C |
74291a4b | 3948 | Tell the preprocessor not to discard comments. Used with the |
630d3d5a | 3949 | @option{-E} option. |
74291a4b MM |
3950 | |
3951 | @item -P | |
cd3bb277 | 3952 | @opindex P |
74291a4b | 3953 | Tell the preprocessor not to generate @samp{#line} directives. |
630d3d5a | 3954 | Used with the @option{-E} option. |
74291a4b MM |
3955 | |
3956 | @cindex make | |
3957 | @cindex dependencies, make | |
3958 | @item -M | |
cd3bb277 | 3959 | @opindex M |
e582248c NB |
3960 | Instead of outputting the result of preprocessing, output a rule |
3961 | suitable for @code{make} describing the dependencies of the main source | |
3962 | file. The preprocessor outputs one @code{make} rule containing the | |
3963 | object file name for that source file, a colon, and the names of all the | |
48ce6bbb NS |
3964 | included files. Unless overridden explicitly, the object file name |
3965 | consists of the basename of the source file with any suffix replaced with | |
767094dd | 3966 | object file suffix. If there are many included files then the |
48ce6bbb | 3967 | rule is split into several lines using @samp{\}-newline. |
74291a4b | 3968 | |
630d3d5a | 3969 | @option{-M} implies @option{-E}. |
74291a4b | 3970 | |
e582248c | 3971 | @item -MM |
cd3bb277 | 3972 | @opindex MM |
630d3d5a | 3973 | Like @option{-M}, but mention only the files included with @samp{#include |
e582248c NB |
3974 | "@var{file}"}. System header files included with @samp{#include |
3975 | <@var{file}>} are omitted. | |
3976 | ||
7da723ef | 3977 | @item -MD |
cd3bb277 | 3978 | @opindex MD |
630d3d5a | 3979 | Like @option{-M} but the dependency information is written to a file |
7da723ef | 3980 | rather than stdout. @code{gcc} will use the same file name and |
695ac33f | 3981 | directory as the object file, but with the suffix @file{.d} instead. |
7da723ef | 3982 | |
630d3d5a JM |
3983 | This is in addition to compiling the main file as specified---@option{-MD} |
3984 | does not inhibit ordinary compilation the way @option{-M} does, | |
3985 | unless you also specify @option{-MG}. | |
7da723ef NB |
3986 | |
3987 | With Mach, you can use the utility @code{md} to merge multiple | |
3988 | dependency files into a single dependency file suitable for using with | |
3989 | the @samp{make} command. | |
3990 | ||
d396403a | 3991 | @item -MMD |
cd3bb277 | 3992 | @opindex MMD |
630d3d5a | 3993 | Like @option{-MD} except mention only user header files, not system |
7da723ef NB |
3994 | -header files. |
3995 | ||
e582248c | 3996 | @item -MF @var{file} |
cd3bb277 | 3997 | @opindex MF |
630d3d5a | 3998 | When used with @option{-M} or @option{-MM}, specifies a file to write the |
e582248c | 3999 | dependencies to. This allows the preprocessor to write the preprocessed |
630d3d5a | 4000 | file to stdout normally. If no @option{-MF} switch is given, CPP sends |
e582248c NB |
4001 | the rules to stdout and suppresses normal preprocessed output. |
4002 | ||
74291a4b | 4003 | Another way to specify output of a @code{make} rule is by setting |
bedc7537 | 4004 | the environment variable @env{DEPENDENCIES_OUTPUT} (@pxref{Environment |
74291a4b MM |
4005 | Variables}). |
4006 | ||
74291a4b | 4007 | @item -MG |
cd3bb277 | 4008 | @opindex MG |
630d3d5a | 4009 | When used with @option{-M} or @option{-MM}, @option{-MG} says to treat missing |
e582248c NB |
4010 | header files as generated files and assume they live in the same |
4011 | directory as the source file. It suppresses preprocessed output, as a | |
4012 | missing header file is ordinarily an error. | |
4013 | ||
4014 | This feature is used in automatic updating of makefiles. | |
4015 | ||
4016 | @item -MP | |
cd3bb277 | 4017 | @opindex MP |
e582248c NB |
4018 | This option instructs CPP to add a phony target for each dependency |
4019 | other than the main file, causing each to depend on nothing. These | |
4020 | dummy rules work around errors @code{make} gives if you remove header | |
4021 | files without updating the @code{Makefile} to match. | |
4022 | ||
4023 | This is typical output:- | |
4024 | ||
4025 | @smallexample | |
4026 | /tmp/test.o: /tmp/test.c /tmp/test.h | |
4027 | ||
4028 | /tmp/test.h: | |
4029 | @end smallexample | |
4030 | ||
4031 | @item -MQ @var{target} | |
4032 | @item -MT @var{target} | |
cd3bb277 JM |
4033 | @opindex MQ |
4034 | @opindex MT | |
e582248c NB |
4035 | By default CPP uses the main file name, including any path, and appends |
4036 | the object suffix, normally ``.o'', to it to obtain the name of the | |
630d3d5a | 4037 | target for dependency generation. With @option{-MT} you can specify a |
e582248c NB |
4038 | target yourself, overriding the default one. |
4039 | ||
4040 | If you want multiple targets, you can specify them as a single argument | |
630d3d5a | 4041 | to @option{-MT}, or use multiple @option{-MT} options. |
e582248c NB |
4042 | |
4043 | The targets you specify are output in the order they appear on the | |
630d3d5a JM |
4044 | command line. @option{-MQ} is identical to @option{-MT}, except that the |
4045 | target name is quoted for Make, but with @option{-MT} it isn't. For | |
4046 | example, @option{-MT '$(objpfx)foo.o'} gives | |
e582248c NB |
4047 | |
4048 | @smallexample | |
4049 | $(objpfx)foo.o: /tmp/foo.c | |
4050 | @end smallexample | |
4051 | ||
630d3d5a | 4052 | but @option{-MQ '$(objpfx)foo.o'} gives |
e582248c NB |
4053 | |
4054 | @smallexample | |
4055 | $$(objpfx)foo.o: /tmp/foo.c | |
4056 | @end smallexample | |
4057 | ||
4058 | The default target is automatically quoted, as if it were given with | |
630d3d5a | 4059 | @option{-MQ}. |
74291a4b MM |
4060 | |
4061 | @item -H | |
cd3bb277 | 4062 | @opindex H |
74291a4b MM |
4063 | Print the name of each header file used, in addition to other normal |
4064 | activities. | |
4065 | ||
4066 | @item -A@var{question}(@var{answer}) | |
cd3bb277 | 4067 | @opindex A |
74291a4b MM |
4068 | Assert the answer @var{answer} for @var{question}, in case it is tested |
4069 | with a preprocessing conditional such as @samp{#if | |
630d3d5a | 4070 | #@var{question}(@var{answer})}. @option{-A-} disables the standard |
74291a4b MM |
4071 | assertions that normally describe the target machine. |
4072 | ||
4073 | @item -D@var{macro} | |
cd3bb277 | 4074 | @opindex D |
74291a4b MM |
4075 | Define macro @var{macro} with the string @samp{1} as its definition. |
4076 | ||
4077 | @item -D@var{macro}=@var{defn} | |
630d3d5a JM |
4078 | Define macro @var{macro} as @var{defn}. All instances of @option{-D} on |
4079 | the command line are processed before any @option{-U} options. | |
74291a4b | 4080 | |
630d3d5a JM |
4081 | Any @option{-D} and @option{-U} options on the command line are processed in |
4082 | order, and always before @option{-imacros @var{file}}, regardless of the | |
e582248c NB |
4083 | order in which they are written. |
4084 | ||
74291a4b | 4085 | @item -U@var{macro} |
cd3bb277 | 4086 | @opindex U |
630d3d5a JM |
4087 | Undefine macro @var{macro}. @option{-U} options are evaluated after all |
4088 | @option{-D} options, but before any @option{-include} and @option{-imacros} | |
74291a4b MM |
4089 | options. |
4090 | ||
630d3d5a JM |
4091 | Any @option{-D} and @option{-U} options on the command line are processed in |
4092 | order, and always before @option{-imacros @var{file}}, regardless of the | |
e582248c NB |
4093 | order in which they are written. |
4094 | ||
74291a4b | 4095 | @item -dM |
cd3bb277 | 4096 | @opindex dM |
74291a4b | 4097 | Tell the preprocessor to output only a list of the macro definitions |
630d3d5a | 4098 | that are in effect at the end of preprocessing. Used with the @option{-E} |
74291a4b MM |
4099 | option. |
4100 | ||
4101 | @item -dD | |
cd3bb277 | 4102 | @opindex dD |
74291a4b MM |
4103 | Tell the preprocessing to pass all macro definitions into the output, in |
4104 | their proper sequence in the rest of the output. | |
4105 | ||
4106 | @item -dN | |
cd3bb277 | 4107 | @opindex dN |
630d3d5a | 4108 | Like @option{-dD} except that the macro arguments and contents are omitted. |
74291a4b MM |
4109 | Only @samp{#define @var{name}} is included in the output. |
4110 | ||
e582248c | 4111 | @item -dI |
cd3bb277 | 4112 | @opindex dI |
e582248c NB |
4113 | Output @samp{#include} directives in addition to the result of |
4114 | preprocessing. | |
4115 | ||
3bce8a01 NB |
4116 | @item -fpreprocessed |
4117 | @opindex fpreprocessed | |
4118 | Indicate to the preprocessor that the input file has already been | |
4119 | preprocessed. This suppresses things like macro expansion, trigraph | |
4120 | conversion, escaped newline splicing, and processing of most directives. | |
6d34c1c4 NB |
4121 | The preprocessor still recognizes and removes comments, so that you can |
4122 | pass a file preprocessed with @option{-C} to the compiler without | |
4123 | problems. In this mode the integrated preprocessor is little more than | |
4124 | a tokenizer for the front ends. | |
3bce8a01 | 4125 | |
630d3d5a | 4126 | @option{-fpreprocessed} is implicit if the input file has one of the |
6d34c1c4 NB |
4127 | extensions @samp{i}, @samp{ii} or @samp{mi}. These are the extensions |
4128 | that GCC uses for preprocessed files created by @option{-save-temps}. | |
3bce8a01 | 4129 | |
74291a4b | 4130 | @item -trigraphs |
cd3bb277 | 4131 | @opindex trigraphs |
e582248c NB |
4132 | Process ISO standard trigraph sequences. These are three-character |
4133 | sequences, all starting with @samp{??}, that are defined by ISO C to | |
4134 | stand for single characters. For example, @samp{??/} stands for | |
4135 | @samp{\}, so @samp{'??/n'} is a character constant for a newline. By | |
4136 | default, GCC ignores trigraphs, but in standard-conforming modes it | |
630d3d5a | 4137 | converts them. See the @option{-std} and @option{-ansi} options. |
e582248c NB |
4138 | |
4139 | The nine trigraph sequences are | |
4140 | @table @samp | |
4141 | @item ??( | |
aee96fe9 | 4142 | @expansion{} @samp{[} |
e582248c NB |
4143 | |
4144 | @item ??) | |
aee96fe9 | 4145 | @expansion{} @samp{]} |
e582248c NB |
4146 | |
4147 | @item ??< | |
aee96fe9 | 4148 | @expansion{} @samp{@{} |
e582248c NB |
4149 | |
4150 | @item ??> | |
aee96fe9 | 4151 | @expansion{} @samp{@}} |
e582248c NB |
4152 | |
4153 | @item ??= | |
aee96fe9 | 4154 | @expansion{} @samp{#} |
e582248c NB |
4155 | |
4156 | @item ??/ | |
aee96fe9 | 4157 | @expansion{} @samp{\} |
e582248c NB |
4158 | |
4159 | @item ??' | |
aee96fe9 | 4160 | @expansion{} @samp{^} |
e582248c NB |
4161 | |
4162 | @item ??! | |
aee96fe9 | 4163 | @expansion{} @samp{|} |
e582248c NB |
4164 | |
4165 | @item ??- | |
aee96fe9 | 4166 | @expansion{} @samp{~} |
e582248c NB |
4167 | |
4168 | @end table | |
4169 | ||
4170 | Trigraph support is not popular, so many compilers do not implement it | |
4171 | properly. Portable code should not rely on trigraphs being either | |
4172 | converted or ignored. | |
74291a4b | 4173 | |
aee96fe9 | 4174 | @item -Wp,@var{option} |
cd3bb277 | 4175 | @opindex Wp |
bedc7537 | 4176 | Pass @var{option} as an option to the preprocessor. If @var{option} |
74291a4b MM |
4177 | contains commas, it is split into multiple options at the commas. |
4178 | @end table | |
4179 | ||
4180 | @node Assembler Options | |
4181 | @section Passing Options to the Assembler | |
4182 | ||
4183 | @c prevent bad page break with this line | |
4184 | You can pass options to the assembler. | |
4185 | ||
2642624b | 4186 | @table @gcctabopt |
aee96fe9 | 4187 | @item -Wa,@var{option} |
cd3bb277 | 4188 | @opindex Wa |
74291a4b MM |
4189 | Pass @var{option} as an option to the assembler. If @var{option} |
4190 | contains commas, it is split into multiple options at the commas. | |
4191 | @end table | |
4192 | ||
4193 | @node Link Options | |
4194 | @section Options for Linking | |
4195 | @cindex link options | |
4196 | @cindex options, linking | |
4197 | ||
4198 | These options come into play when the compiler links object files into | |
4199 | an executable output file. They are meaningless if the compiler is | |
4200 | not doing a link step. | |
4201 | ||
2642624b | 4202 | @table @gcctabopt |
74291a4b MM |
4203 | @cindex file names |
4204 | @item @var{object-file-name} | |
4205 | A file name that does not end in a special recognized suffix is | |
4206 | considered to name an object file or library. (Object files are | |
4207 | distinguished from libraries by the linker according to the file | |
4208 | contents.) If linking is done, these object files are used as input | |
4209 | to the linker. | |
4210 | ||
4211 | @item -c | |
4212 | @itemx -S | |
4213 | @itemx -E | |
cd3bb277 JM |
4214 | @opindex c |
4215 | @opindex S | |
4216 | @opindex E | |
74291a4b MM |
4217 | If any of these options is used, then the linker is not run, and |
4218 | object file names should not be used as arguments. @xref{Overall | |
4219 | Options}. | |
4220 | ||
4221 | @cindex Libraries | |
4222 | @item -l@var{library} | |
4275c4c4 | 4223 | @itemx -l @var{library} |
cd3bb277 | 4224 | @opindex l |
4275c4c4 JS |
4225 | Search the library named @var{library} when linking. (The second |
4226 | alternative with the library as a separate argument is only for | |
4227 | POSIX compliance and is not recommended.) | |
74291a4b MM |
4228 | |
4229 | It makes a difference where in the command you write this option; the | |
4275c4c4 | 4230 | linker searches and processes libraries and object files in the order they |
74291a4b MM |
4231 | are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} |
4232 | after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers | |
4233 | to functions in @samp{z}, those functions may not be loaded. | |
4234 | ||
4235 | The linker searches a standard list of directories for the library, | |
4236 | which is actually a file named @file{lib@var{library}.a}. The linker | |
4237 | then uses this file as if it had been specified precisely by name. | |
4238 | ||
4239 | The directories searched include several standard system directories | |
630d3d5a | 4240 | plus any that you specify with @option{-L}. |
74291a4b MM |
4241 | |
4242 | Normally the files found this way are library files---archive files | |
4243 | whose members are object files. The linker handles an archive file by | |
4244 | scanning through it for members which define symbols that have so far | |
4245 | been referenced but not defined. But if the file that is found is an | |
4246 | ordinary object file, it is linked in the usual fashion. The only | |
630d3d5a JM |
4247 | difference between using an @option{-l} option and specifying a file name |
4248 | is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} | |
74291a4b MM |
4249 | and searches several directories. |
4250 | ||
4251 | @item -lobjc | |
cd3bb277 | 4252 | @opindex lobjc |
630d3d5a | 4253 | You need this special case of the @option{-l} option in order to |
2147b154 | 4254 | link an Objective-C program. |
74291a4b MM |
4255 | |
4256 | @item -nostartfiles | |
cd3bb277 | 4257 | @opindex nostartfiles |
74291a4b | 4258 | Do not use the standard system startup files when linking. |
bedc7537 NC |
4259 | The standard system libraries are used normally, unless @option{-nostdlib} |
4260 | or @option{-nodefaultlibs} is used. | |
74291a4b MM |
4261 | |
4262 | @item -nodefaultlibs | |
cd3bb277 | 4263 | @opindex nodefaultlibs |
74291a4b MM |
4264 | Do not use the standard system libraries when linking. |
4265 | Only the libraries you specify will be passed to the linker. | |
bedc7537 | 4266 | The standard startup files are used normally, unless @option{-nostartfiles} |
4754172c | 4267 | is used. The compiler may generate calls to memcmp, memset, and memcpy |
c1030c7c | 4268 | for System V (and ISO C) environments or to bcopy and bzero for |
4754172c CM |
4269 | BSD environments. These entries are usually resolved by entries in |
4270 | libc. These entry points should be supplied through some other | |
4271 | mechanism when this option is specified. | |
74291a4b MM |
4272 | |
4273 | @item -nostdlib | |
cd3bb277 | 4274 | @opindex nostdlib |
74291a4b MM |
4275 | Do not use the standard system startup files or libraries when linking. |
4276 | No startup files and only the libraries you specify will be passed to | |
767094dd | 4277 | the linker. The compiler may generate calls to memcmp, memset, and memcpy |
c1030c7c | 4278 | for System V (and ISO C) environments or to bcopy and bzero for |
4754172c CM |
4279 | BSD environments. These entries are usually resolved by entries in |
4280 | libc. These entry points should be supplied through some other | |
4281 | mechanism when this option is specified. | |
74291a4b | 4282 | |
630d3d5a JM |
4283 | @cindex @option{-lgcc}, use with @option{-nostdlib} |
4284 | @cindex @option{-nostdlib} and unresolved references | |
4285 | @cindex unresolved references and @option{-nostdlib} | |
4286 | @cindex @option{-lgcc}, use with @option{-nodefaultlibs} | |
4287 | @cindex @option{-nodefaultlibs} and unresolved references | |
4288 | @cindex unresolved references and @option{-nodefaultlibs} | |
4289 | One of the standard libraries bypassed by @option{-nostdlib} and | |
4290 | @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines | |
0c2d1a2a | 4291 | that GCC uses to overcome shortcomings of particular machines, or special |
74291a4b | 4292 | needs for some languages. |
b11cc610 JM |
4293 | (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler |
4294 | Collection (GCC) Internals}, | |
74291a4b | 4295 | for more discussion of @file{libgcc.a}.) |
74291a4b | 4296 | In most cases, you need @file{libgcc.a} even when you want to avoid |
630d3d5a JM |
4297 | other standard libraries. In other words, when you specify @option{-nostdlib} |
4298 | or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. | |
0c2d1a2a | 4299 | This ensures that you have no unresolved references to internal GCC |
74291a4b | 4300 | library subroutines. (For example, @samp{__main}, used to ensure C++ |
b11cc610 JM |
4301 | constructors will be called; @pxref{Collect2,,@code{collect2}, gccint, |
4302 | GNU Compiler Collection (GCC) Internals}.) | |
74291a4b MM |
4303 | |
4304 | @item -s | |
cd3bb277 | 4305 | @opindex s |
74291a4b MM |
4306 | Remove all symbol table and relocation information from the executable. |
4307 | ||
4308 | @item -static | |
cd3bb277 | 4309 | @opindex static |
74291a4b MM |
4310 | On systems that support dynamic linking, this prevents linking with the shared |
4311 | libraries. On other systems, this option has no effect. | |
4312 | ||
4313 | @item -shared | |
cd3bb277 | 4314 | @opindex shared |
74291a4b | 4315 | Produce a shared object which can then be linked with other objects to |
1d3b0e2c | 4316 | form an executable. Not all systems support this option. For predictable |
02f52e19 | 4317 | results, you must also specify the same set of options that were used to |
630d3d5a | 4318 | generate code (@option{-fpic}, @option{-fPIC}, or model suboptions) |
2642624b | 4319 | when you specify this option.@footnote{On some systems, @samp{gcc -shared} |
767094dd | 4320 | needs to build supplementary stub code for constructors to work. On |
2642624b | 4321 | multi-libbed systems, @samp{gcc -shared} must select the correct support |
1d3b0e2c | 4322 | libraries to link against. Failing to supply the correct flags may lead |
767094dd | 4323 | to subtle defects. Supplying them in cases where they are not necessary |
1d3b0e2c | 4324 | is innocuous.} |
74291a4b | 4325 | |
9db0819e RH |
4326 | @item -shared-libgcc |
4327 | @itemx -static-libgcc | |
cd3bb277 JM |
4328 | @opindex shared-libgcc |
4329 | @opindex static-libgcc | |
9db0819e RH |
4330 | On systems that provide @file{libgcc} as a shared library, these options |
4331 | force the use of either the shared or static version respectively. | |
4332 | If no shared version of @file{libgcc} was built when the compiler was | |
4333 | configured, these options have no effect. | |
4334 | ||
4335 | There are several situations in which an application should use the | |
4336 | shared @file{libgcc} instead of the static version. The most common | |
4337 | of these is when the application wishes to throw and catch exceptions | |
4338 | across different shared libraries. In that case, each of the libraries | |
4339 | as well as the application itself should use the shared @file{libgcc}. | |
4340 | ||
630d3d5a JM |
4341 | Therefore, whenever you specify the @option{-shared} option, the GCC |
4342 | driver automatically adds @option{-shared-libgcc}, unless you explicitly | |
4343 | specify @option{-static-libgcc}. The G++ driver automatically adds | |
4344 | @option{-shared-libgcc} when you build a main executable as well because | |
049f6ec9 MM |
4345 | for C++ programs that is typically the right thing to do. |
4346 | (Exception-handling will not work reliably otherwise.) | |
4347 | ||
4348 | However, when linking a main executable written in C, you must | |
630d3d5a | 4349 | explicitly say @option{-shared-libgcc} if you want to use the shared |
049f6ec9 | 4350 | @file{libgcc}. |
9db0819e | 4351 | |
74291a4b | 4352 | @item -symbolic |
cd3bb277 | 4353 | @opindex symbolic |
74291a4b MM |
4354 | Bind references to global symbols when building a shared object. Warn |
4355 | about any unresolved references (unless overridden by the link editor | |
4356 | option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support | |
4357 | this option. | |
4358 | ||
4359 | @item -Xlinker @var{option} | |
cd3bb277 | 4360 | @opindex Xlinker |
74291a4b | 4361 | Pass @var{option} as an option to the linker. You can use this to |
0c2d1a2a | 4362 | supply system-specific linker options which GCC does not know how to |
74291a4b MM |
4363 | recognize. |
4364 | ||
4365 | If you want to pass an option that takes an argument, you must use | |
630d3d5a JM |
4366 | @option{-Xlinker} twice, once for the option and once for the argument. |
4367 | For example, to pass @option{-assert definitions}, you must write | |
74291a4b | 4368 | @samp{-Xlinker -assert -Xlinker definitions}. It does not work to write |
630d3d5a | 4369 | @option{-Xlinker "-assert definitions"}, because this passes the entire |
74291a4b MM |
4370 | string as a single argument, which is not what the linker expects. |
4371 | ||
aee96fe9 | 4372 | @item -Wl,@var{option} |
cd3bb277 | 4373 | @opindex Wl |
74291a4b MM |
4374 | Pass @var{option} as an option to the linker. If @var{option} contains |
4375 | commas, it is split into multiple options at the commas. | |
4376 | ||
4377 | @item -u @var{symbol} | |
cd3bb277 | 4378 | @opindex u |
74291a4b | 4379 | Pretend the symbol @var{symbol} is undefined, to force linking of |
630d3d5a | 4380 | library modules to define it. You can use @option{-u} multiple times with |
74291a4b MM |
4381 | different symbols to force loading of additional library modules. |
4382 | @end table | |
4383 | ||
4384 | @node Directory Options | |
4385 | @section Options for Directory Search | |
4386 | @cindex directory options | |
4387 | @cindex options, directory search | |
4388 | @cindex search path | |
4389 | ||
4390 | These options specify directories to search for header files, for | |
4391 | libraries and for parts of the compiler: | |
4392 | ||
2642624b | 4393 | @table @gcctabopt |
74291a4b | 4394 | @item -I@var{dir} |
cd3bb277 | 4395 | @opindex I |
861bb6c1 JL |
4396 | Add the directory @var{dir} to the head of the list of directories to be |
4397 | searched for header files. This can be used to override a system header | |
4398 | file, substituting your own version, since these directories are | |
d0a5eb32 RK |
4399 | searched before the system header file directories. However, you should |
4400 | not use this option to add directories that contain vendor-supplied | |
767094dd | 4401 | system header files (use @option{-isystem} for that). If you use more than |
630d3d5a | 4402 | one @option{-I} option, the directories are scanned in left-to-right |
74291a4b MM |
4403 | order; the standard system directories come after. |
4404 | ||
dbead49c NS |
4405 | If a standard system include directory, or a directory specified with |
4406 | @option{-isystem}, is also specified with @option{-I}, it will be | |
4407 | searched only in the position requested by @option{-I}. Also, it will | |
4408 | not be considered a system include directory. If that directory really | |
4409 | does contain system headers, there is a good chance that they will | |
4410 | break. For instance, if GCC's installation procedure edited the headers | |
4411 | in @file{/usr/include} to fix bugs, @samp{-I/usr/include} will cause the | |
4412 | original, buggy headers to be found instead of the corrected ones. GCC | |
4413 | will issue a warning when a system include directory is hidden in this | |
4414 | way. | |
4415 | ||
74291a4b | 4416 | @item -I- |
cd3bb277 | 4417 | @opindex I- |
630d3d5a | 4418 | Any directories you specify with @option{-I} options before the @option{-I-} |
74291a4b MM |
4419 | option are searched only for the case of @samp{#include "@var{file}"}; |
4420 | they are not searched for @samp{#include <@var{file}>}. | |
4421 | ||
630d3d5a JM |
4422 | If additional directories are specified with @option{-I} options after |
4423 | the @option{-I-}, these directories are searched for all @samp{#include} | |
4424 | directives. (Ordinarily @emph{all} @option{-I} directories are used | |
74291a4b MM |
4425 | this way.) |
4426 | ||
630d3d5a | 4427 | In addition, the @option{-I-} option inhibits the use of the current |
74291a4b MM |
4428 | directory (where the current input file came from) as the first search |
4429 | directory for @samp{#include "@var{file}"}. There is no way to | |
630d3d5a | 4430 | override this effect of @option{-I-}. With @option{-I.} you can specify |
74291a4b MM |
4431 | searching the directory which was current when the compiler was |
4432 | invoked. That is not exactly the same as what the preprocessor does | |
4433 | by default, but it is often satisfactory. | |
4434 | ||
630d3d5a JM |
4435 | @option{-I-} does not inhibit the use of the standard system directories |
4436 | for header files. Thus, @option{-I-} and @option{-nostdinc} are | |
74291a4b MM |
4437 | independent. |
4438 | ||
4439 | @item -L@var{dir} | |
cd3bb277 | 4440 | @opindex L |
74291a4b | 4441 | Add directory @var{dir} to the list of directories to be searched |
630d3d5a | 4442 | for @option{-l}. |
74291a4b MM |
4443 | |
4444 | @item -B@var{prefix} | |
cd3bb277 | 4445 | @opindex B |
74291a4b MM |
4446 | This option specifies where to find the executables, libraries, |
4447 | include files, and data files of the compiler itself. | |
4448 | ||
4449 | The compiler driver program runs one or more of the subprograms | |
4450 | @file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries | |
4451 | @var{prefix} as a prefix for each program it tries to run, both with and | |
4452 | without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). | |
4453 | ||
4454 | For each subprogram to be run, the compiler driver first tries the | |
630d3d5a | 4455 | @option{-B} prefix, if any. If that name is not found, or if @option{-B} |
74291a4b MM |
4456 | was not specified, the driver tries two standard prefixes, which are |
4457 | @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}. If neither of | |
4458 | those results in a file name that is found, the unmodified program | |
4459 | name is searched for using the directories specified in your | |
bedc7537 | 4460 | @env{PATH} environment variable. |
74291a4b | 4461 | |
07804c3b NC |
4462 | The compiler will check to see if the path provided by the @option{-B} |
4463 | refers to a directory, and if necessary it will add a directory | |
4464 | separator character at the end of the path. | |
4465 | ||
630d3d5a | 4466 | @option{-B} prefixes that effectively specify directory names also apply |
74291a4b | 4467 | to libraries in the linker, because the compiler translates these |
630d3d5a | 4468 | options into @option{-L} options for the linker. They also apply to |
74291a4b | 4469 | includes files in the preprocessor, because the compiler translates these |
630d3d5a | 4470 | options into @option{-isystem} options for the preprocessor. In this case, |
74291a4b MM |
4471 | the compiler appends @samp{include} to the prefix. |
4472 | ||
4473 | The run-time support file @file{libgcc.a} can also be searched for using | |
630d3d5a | 4474 | the @option{-B} prefix, if needed. If it is not found there, the two |
74291a4b MM |
4475 | standard prefixes above are tried, and that is all. The file is left |
4476 | out of the link if it is not found by those means. | |
4477 | ||
630d3d5a | 4478 | Another way to specify a prefix much like the @option{-B} prefix is to use |
bedc7537 | 4479 | the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment |
74291a4b | 4480 | Variables}. |
861bb6c1 | 4481 | |
07804c3b | 4482 | As a special kludge, if the path provided by @option{-B} is |
bf4eebe0 NC |
4483 | @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to |
4484 | 9, then it will be replaced by @file{[dir/]include}. This is to help | |
7dac2f89 | 4485 | with boot-strapping the compiler. |
07804c3b | 4486 | |
861bb6c1 | 4487 | @item -specs=@var{file} |
cd3bb277 | 4488 | @opindex specs |
861bb6c1 JL |
4489 | Process @var{file} after the compiler reads in the standard @file{specs} |
4490 | file, in order to override the defaults that the @file{gcc} driver | |
4491 | program uses when determining what switches to pass to @file{cc1}, | |
4492 | @file{cc1plus}, @file{as}, @file{ld}, etc. More than one | |
630d3d5a | 4493 | @option{-specs=@var{file}} can be specified on the command line, and they |
861bb6c1 | 4494 | are processed in order, from left to right. |
74291a4b MM |
4495 | @end table |
4496 | ||
ee457005 JM |
4497 | @c man end |
4498 | ||
a743d340 NC |
4499 | @node Spec Files |
4500 | @section Specifying subprocesses and the switches to pass to them | |
4501 | @cindex Spec Files | |
bedc7537 | 4502 | @command{gcc} is a driver program. It performs its job by invoking a |
a743d340 NC |
4503 | sequence of other programs to do the work of compiling, assembling and |
4504 | linking. GCC interprets its command-line parameters and uses these to | |
4505 | deduce which programs it should invoke, and which command-line options | |
c21cd8b1 | 4506 | it ought to place on their command lines. This behavior is controlled |
a743d340 NC |
4507 | by @dfn{spec strings}. In most cases there is one spec string for each |
4508 | program that GCC can invoke, but a few programs have multiple spec | |
c21cd8b1 | 4509 | strings to control their behavior. The spec strings built into GCC can |
630d3d5a | 4510 | be overridden by using the @option{-specs=} command-line switch to specify |
a743d340 NC |
4511 | a spec file. |
4512 | ||
4513 | @dfn{Spec files} are plaintext files that are used to construct spec | |
4514 | strings. They consist of a sequence of directives separated by blank | |
4515 | lines. The type of directive is determined by the first non-whitespace | |
4516 | character on the line and it can be one of the following: | |
4517 | ||
4518 | @table @code | |
4519 | @item %@var{command} | |
4520 | Issues a @var{command} to the spec file processor. The commands that can | |
02f52e19 | 4521 | appear here are: |
a743d340 NC |
4522 | |
4523 | @table @code | |
4524 | @item %include <@var{file}> | |
4525 | @cindex %include | |
4526 | Search for @var{file} and insert its text at the current point in the | |
4527 | specs file. | |
4528 | ||
4529 | @item %include_noerr <@var{file}> | |
4530 | @cindex %include_noerr | |
4531 | Just like @samp{%include}, but do not generate an error message if the include | |
4532 | file cannot be found. | |
4533 | ||
4534 | @item %rename @var{old_name} @var{new_name} | |
4535 | @cindex %rename | |
4536 | Rename the spec string @var{old_name} to @var{new_name}. | |
4537 | ||
4538 | @end table | |
4539 | ||
4540 | @item *[@var{spec_name}]: | |
4541 | This tells the compiler to create, override or delete the named spec | |
4542 | string. All lines after this directive up to the next directive or | |
4543 | blank line are considered to be the text for the spec string. If this | |
4544 | results in an empty string then the spec will be deleted. (Or, if the | |
4545 | spec did not exist, then nothing will happened.) Otherwise, if the spec | |
4546 | does not currently exist a new spec will be created. If the spec does | |
4547 | exist then its contents will be overridden by the text of this | |
4548 | directive, unless the first character of that text is the @samp{+} | |
4549 | character, in which case the text will be appended to the spec. | |
4550 | ||
4551 | @item [@var{suffix}]: | |
4552 | Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive | |
4553 | and up to the next directive or blank line are considered to make up the | |
02f52e19 | 4554 | spec string for the indicated suffix. When the compiler encounters an |
a743d340 NC |
4555 | input file with the named suffix, it will processes the spec string in |
4556 | order to work out how to compile that file. For example: | |
4557 | ||
4558 | @smallexample | |
4559 | .ZZ: | |
4560 | z-compile -input %i | |
4561 | @end smallexample | |
4562 | ||
4563 | This says that any input file whose name ends in @samp{.ZZ} should be | |
4564 | passed to the program @samp{z-compile}, which should be invoked with the | |
630d3d5a | 4565 | command-line switch @option{-input} and with the result of performing the |
a743d340 NC |
4566 | @samp{%i} substitution. (See below.) |
4567 | ||
4568 | As an alternative to providing a spec string, the text that follows a | |
4569 | suffix directive can be one of the following: | |
4570 | ||
4571 | @table @code | |
4572 | @item @@@var{language} | |
4573 | This says that the suffix is an alias for a known @var{language}. This is | |
bedc7537 | 4574 | similar to using the @option{-x} command-line switch to GCC to specify a |
a743d340 NC |
4575 | language explicitly. For example: |
4576 | ||
4577 | @smallexample | |
4578 | .ZZ: | |
4579 | @@c++ | |
4580 | @end smallexample | |
4581 | ||
4582 | Says that .ZZ files are, in fact, C++ source files. | |
4583 | ||
4584 | @item #@var{name} | |
4585 | This causes an error messages saying: | |
4586 | ||
4587 | @smallexample | |
4588 | @var{name} compiler not installed on this system. | |
4589 | @end smallexample | |
4590 | @end table | |
4591 | ||
4592 | GCC already has an extensive list of suffixes built into it. | |
4593 | This directive will add an entry to the end of the list of suffixes, but | |
4594 | since the list is searched from the end backwards, it is effectively | |
4595 | possible to override earlier entries using this technique. | |
4596 | ||
4597 | @end table | |
4598 | ||
4599 | GCC has the following spec strings built into it. Spec files can | |
4600 | override these strings or create their own. Note that individual | |
02f52e19 | 4601 | targets can also add their own spec strings to this list. |
a743d340 NC |
4602 | |
4603 | @smallexample | |
4604 | asm Options to pass to the assembler | |
4605 | asm_final Options to pass to the assembler post-processor | |
4606 | cpp Options to pass to the C preprocessor | |
4607 | cc1 Options to pass to the C compiler | |
4608 | cc1plus Options to pass to the C++ compiler | |
4609 | endfile Object files to include at the end of the link | |
4610 | link Options to pass to the linker | |
4611 | lib Libraries to include on the command line to the linker | |
4612 | libgcc Decides which GCC support library to pass to the linker | |
4613 | linker Sets the name of the linker | |
4614 | predefines Defines to be passed to the C preprocessor | |
310668e8 JM |
4615 | signed_char Defines to pass to CPP to say whether @code{char} is signed |
4616 | by default | |
a743d340 NC |
4617 | startfile Object files to include at the start of the link |
4618 | @end smallexample | |
4619 | ||
4620 | Here is a small example of a spec file: | |
4621 | ||
4622 | @smallexample | |
4623 | %rename lib old_lib | |
4624 | ||
4625 | *lib: | |
4626 | --start-group -lgcc -lc -leval1 --end-group %(old_lib) | |
4627 | @end smallexample | |
4628 | ||
4629 | This example renames the spec called @samp{lib} to @samp{old_lib} and | |
4630 | then overrides the previous definition of @samp{lib} with a new one. | |
4631 | The new definition adds in some extra command-line options before | |
4632 | including the text of the old definition. | |
4633 | ||
4634 | @dfn{Spec strings} are a list of command-line options to be passed to their | |
4635 | corresponding program. In addition, the spec strings can contain | |
4636 | @samp{%}-prefixed sequences to substitute variable text or to | |
4637 | conditionally insert text into the command line. Using these constructs | |
4638 | it is possible to generate quite complex command lines. | |
4639 | ||
4640 | Here is a table of all defined @samp{%}-sequences for spec | |
4641 | strings. Note that spaces are not generated automatically around the | |
4642 | results of expanding these sequences. Therefore you can concatenate them | |
02f52e19 | 4643 | together or combine them with constant text in a single argument. |
a743d340 NC |
4644 | |
4645 | @table @code | |
4646 | @item %% | |
4647 | Substitute one @samp{%} into the program name or argument. | |
4648 | ||
4649 | @item %i | |
4650 | Substitute the name of the input file being processed. | |
4651 | ||
4652 | @item %b | |
4653 | Substitute the basename of the input file being processed. | |
4654 | This is the substring up to (and not including) the last period | |
4655 | and not including the directory. | |
4656 | ||
371e300b NC |
4657 | @item %B |
4658 | This is the same as @samp{%b}, but include the file suffix (text after | |
4659 | the last period). | |
4660 | ||
a743d340 NC |
4661 | @item %d |
4662 | Marks the argument containing or following the @samp{%d} as a | |
4663 | temporary file name, so that that file will be deleted if GCC exits | |
4664 | successfully. Unlike @samp{%g}, this contributes no text to the | |
02f52e19 | 4665 | argument. |
a743d340 NC |
4666 | |
4667 | @item %g@var{suffix} | |
4668 | Substitute a file name that has suffix @var{suffix} and is chosen | |
4669 | once per compilation, and mark the argument in the same way as | |
4670 | @samp{%d}. To reduce exposure to denial-of-service attacks, the file | |
02f52e19 | 4671 | name is now chosen in a way that is hard to predict even when previously |
695ac33f | 4672 | chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} |
a743d340 NC |
4673 | might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches |
4674 | the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is | |
4675 | treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} | |
4676 | was simply substituted with a file name chosen once per compilation, | |
4677 | without regard to any appended suffix (which was therefore treated | |
4678 | just like ordinary text), making such attacks more likely to succeed. | |
4679 | ||
4680 | @item %u@var{suffix} | |
4681 | Like @samp{%g}, but generates a new temporary file name even if | |
4682 | @samp{%u@var{suffix}} was already seen. | |
4683 | ||
4684 | @item %U@var{suffix} | |
4685 | Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a | |
4686 | new one if there is no such last file name. In the absence of any | |
4687 | @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share | |
695ac33f | 4688 | the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} |
a743d340 NC |
4689 | would involve the generation of two distinct file names, one |
4690 | for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was | |
4691 | simply substituted with a file name chosen for the previous @samp{%u}, | |
4692 | without regard to any appended suffix. | |
4693 | ||
371e300b | 4694 | @item %j@var{SUFFIX} |
aee96fe9 | 4695 | Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is |
371e300b NC |
4696 | writable, and if save-temps is off; otherwise, substitute the name |
4697 | of a temporary file, just like @samp{%u}. This temporary file is not | |
4698 | meant for communication between processes, but rather as a junk | |
4699 | disposal mechanism. | |
4700 | ||
4701 | @item %.@var{SUFFIX} | |
4702 | Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args | |
767094dd | 4703 | when it is subsequently output with @samp{%*}. @var{SUFFIX} is |
371e300b NC |
4704 | terminated by the next space or %. |
4705 | ||
a743d340 NC |
4706 | @item %w |
4707 | Marks the argument containing or following the @samp{%w} as the | |
4708 | designated output file of this compilation. This puts the argument | |
4709 | into the sequence of arguments that @samp{%o} will substitute later. | |
4710 | ||
4711 | @item %o | |
4712 | Substitutes the names of all the output files, with spaces | |
4713 | automatically placed around them. You should write spaces | |
4714 | around the @samp{%o} as well or the results are undefined. | |
4715 | @samp{%o} is for use in the specs for running the linker. | |
4716 | Input files whose names have no recognized suffix are not compiled | |
4717 | at all, but they are included among the output files, so they will | |
4718 | be linked. | |
4719 | ||
4720 | @item %O | |
4721 | Substitutes the suffix for object files. Note that this is | |
4722 | handled specially when it immediately follows @samp{%g, %u, or %U}, | |
4723 | because of the need for those to form complete file names. The | |
4724 | handling is such that @samp{%O} is treated exactly as if it had already | |
4725 | been substituted, except that @samp{%g, %u, and %U} do not currently | |
4726 | support additional @var{suffix} characters following @samp{%O} as they would | |
4727 | following, for example, @samp{.o}. | |
4728 | ||
4729 | @item %p | |
4730 | Substitutes the standard macro predefinitions for the | |
4731 | current target machine. Use this when running @code{cpp}. | |
4732 | ||
4733 | @item %P | |
4734 | Like @samp{%p}, but puts @samp{__} before and after the name of each | |
4735 | predefined macro, except for macros that start with @samp{__} or with | |
c1030c7c | 4736 | @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO |
161d7b59 | 4737 | C@. |
a743d340 NC |
4738 | |
4739 | @item %I | |
aee96fe9 | 4740 | Substitute a @option{-iprefix} option made from @env{GCC_EXEC_PREFIX}. |
a743d340 NC |
4741 | |
4742 | @item %s | |
4743 | Current argument is the name of a library or startup file of some sort. | |
4744 | Search for that file in a standard list of directories and substitute | |
02f52e19 | 4745 | the full name found. |
a743d340 NC |
4746 | |
4747 | @item %e@var{str} | |
4748 | Print @var{str} as an error message. @var{str} is terminated by a newline. | |
4749 | Use this when inconsistent options are detected. | |
4750 | ||
4751 | @item %| | |
4752 | Output @samp{-} if the input for the current command is coming from a pipe. | |
4753 | ||
4754 | @item %(@var{name}) | |
4755 | Substitute the contents of spec string @var{name} at this point. | |
4756 | ||
4757 | @item %[@var{name}] | |
630d3d5a | 4758 | Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments. |
a743d340 NC |
4759 | |
4760 | @item %x@{@var{option}@} | |
4761 | Accumulate an option for @samp{%X}. | |
4762 | ||
4763 | @item %X | |
630d3d5a | 4764 | Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} |
a743d340 NC |
4765 | spec string. |
4766 | ||
4767 | @item %Y | |
630d3d5a | 4768 | Output the accumulated assembler options specified by @option{-Wa}. |
a743d340 NC |
4769 | |
4770 | @item %Z | |
630d3d5a | 4771 | Output the accumulated preprocessor options specified by @option{-Wp}. |
a743d340 NC |
4772 | |
4773 | @item %v1 | |
161d7b59 | 4774 | Substitute the major version number of GCC@. |
a743d340 NC |
4775 | (For version 2.9.5, this is 2.) |
4776 | ||
4777 | @item %v2 | |
161d7b59 | 4778 | Substitute the minor version number of GCC@. |
a743d340 NC |
4779 | (For version 2.9.5, this is 9.) |
4780 | ||
371e300b | 4781 | @item %v3 |
161d7b59 | 4782 | Substitute the patch level number of GCC@. |
371e300b NC |
4783 | (For version 2.9.5, this is 5.) |
4784 | ||
a743d340 NC |
4785 | @item %a |
4786 | Process the @code{asm} spec. This is used to compute the | |
4787 | switches to be passed to the assembler. | |
4788 | ||
4789 | @item %A | |
4790 | Process the @code{asm_final} spec. This is a spec string for | |
4791 | passing switches to an assembler post-processor, if such a program is | |
4792 | needed. | |
4793 | ||
4794 | @item %l | |
4795 | Process the @code{link} spec. This is the spec for computing the | |
4796 | command line passed to the linker. Typically it will make use of the | |
4797 | @samp{%L %G %S %D and %E} sequences. | |
4798 | ||
4799 | @item %D | |
630d3d5a | 4800 | Dump out a @option{-L} option for each directory that GCC believes might |
a743d340 | 4801 | contain startup files. If the target supports multilibs then the |
02f52e19 | 4802 | current multilib directory will be prepended to each of these paths. |
a743d340 | 4803 | |
371e300b | 4804 | @item %M |
c771326b | 4805 | Output the multilib directory with directory separators replaced with |
695ac33f JM |
4806 | @samp{_}. If multilib directories are not set, or the multilib directory is |
4807 | @file{.} then this option emits nothing. | |
371e300b | 4808 | |
a743d340 NC |
4809 | @item %L |
4810 | Process the @code{lib} spec. This is a spec string for deciding which | |
02f52e19 | 4811 | libraries should be included on the command line to the linker. |
a743d340 NC |
4812 | |
4813 | @item %G | |
4814 | Process the @code{libgcc} spec. This is a spec string for deciding | |
02f52e19 | 4815 | which GCC support library should be included on the command line to the linker. |
a743d340 NC |
4816 | |
4817 | @item %S | |
4818 | Process the @code{startfile} spec. This is a spec for deciding which | |
4819 | object files should be the first ones passed to the linker. Typically | |
02f52e19 | 4820 | this might be a file named @file{crt0.o}. |
a743d340 NC |
4821 | |
4822 | @item %E | |
4823 | Process the @code{endfile} spec. This is a spec string that specifies | |
02f52e19 | 4824 | the last object files that will be passed to the linker. |
a743d340 NC |
4825 | |
4826 | @item %C | |
4827 | Process the @code{cpp} spec. This is used to construct the arguments | |
4828 | to be passed to the C preprocessor. | |
4829 | ||
4830 | @item %c | |
4831 | Process the @code{signed_char} spec. This is intended to be used | |
02f52e19 | 4832 | to tell cpp whether a char is signed. It typically has the definition: |
a743d340 NC |
4833 | @smallexample |
4834 | %@{funsigned-char:-D__CHAR_UNSIGNED__@} | |
4835 | @end smallexample | |
4836 | ||
4837 | @item %1 | |
4838 | Process the @code{cc1} spec. This is used to construct the options to be | |
4839 | passed to the actual C compiler (@samp{cc1}). | |
4840 | ||
4841 | @item %2 | |
4842 | Process the @code{cc1plus} spec. This is used to construct the options to be | |
4843 | passed to the actual C++ compiler (@samp{cc1plus}). | |
4844 | ||
4845 | @item %* | |
4846 | Substitute the variable part of a matched option. See below. | |
4847 | Note that each comma in the substituted string is replaced by | |
4848 | a single space. | |
4849 | ||
4850 | @item %@{@code{S}@} | |
161d7b59 | 4851 | Substitutes the @code{-S} switch, if that switch was given to GCC@. |
a743d340 NC |
4852 | If that switch was not specified, this substitutes nothing. Note that |
4853 | the leading dash is omitted when specifying this option, and it is | |
4854 | automatically inserted if the substitution is performed. Thus the spec | |
630d3d5a JM |
4855 | string @samp{%@{foo@}} would match the command-line option @option{-foo} |
4856 | and would output the command line option @option{-foo}. | |
a743d340 NC |
4857 | |
4858 | @item %W@{@code{S}@} | |
4859 | Like %@{@code{S}@} but mark last argument supplied within as a file to be | |
02f52e19 | 4860 | deleted on failure. |
a743d340 NC |
4861 | |
4862 | @item %@{@code{S}*@} | |
4863 | Substitutes all the switches specified to GCC whose names start | |
4864 | with @code{-S}, but which also take an argument. This is used for | |
695ac33f | 4865 | switches like @option{-o}, @option{-D}, @option{-I}, etc. |
630d3d5a | 4866 | GCC considers @option{-o foo} as being |
a743d340 | 4867 | one switch whose names starts with @samp{o}. %@{o*@} would substitute this |
02f52e19 | 4868 | text, including the space. Thus two arguments would be generated. |
a743d340 NC |
4869 | |
4870 | @item %@{^@code{S}*@} | |
4871 | Like %@{@code{S}*@}, but don't put a blank between a switch and its | |
4872 | argument. Thus %@{^o*@} would only generate one argument, not two. | |
4873 | ||
371e300b NC |
4874 | @item %@{@code{S}*&@code{T}*@} |
4875 | Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options | |
4876 | (the order of @code{S} and @code{T} in the spec is not significant). | |
4877 | There can be any number of ampersand-separated variables; for each the | |
4878 | wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. | |
4879 | ||
d630442f | 4880 | @item %@{<@code{S}@} |
695ac33f | 4881 | Remove all occurrences of @code{-S} from the command line. Note---this |
d630442f | 4882 | command is position dependent. @samp{%} commands in the spec string |
50c57e7b | 4883 | before this option will see @code{-S}, @samp{%} commands in the spec |
d630442f NC |
4884 | string after this option will not. |
4885 | ||
a743d340 NC |
4886 | @item %@{@code{S}*:@code{X}@} |
4887 | Substitutes @code{X} if one or more switches whose names start with | |
161d7b59 | 4888 | @code{-S} are specified to GCC@. Note that the tail part of the |
e979f9e8 | 4889 | @code{-S} option (i.e.@: the part matched by the @samp{*}) will be substituted |
02f52e19 | 4890 | for each occurrence of @samp{%*} within @code{X}. |
a743d340 NC |
4891 | |
4892 | @item %@{@code{S}:@code{X}@} | |
161d7b59 | 4893 | Substitutes @code{X}, but only if the @samp{-S} switch was given to GCC@. |
a743d340 NC |
4894 | |
4895 | @item %@{!@code{S}:@code{X}@} | |
161d7b59 | 4896 | Substitutes @code{X}, but only if the @samp{-S} switch was @emph{not} given to GCC@. |
a743d340 NC |
4897 | |
4898 | @item %@{|@code{S}:@code{X}@} | |
4899 | Like %@{@code{S}:@code{X}@}, but if no @code{S} switch, substitute @samp{-}. | |
4900 | ||
4901 | @item %@{|!@code{S}:@code{X}@} | |
4902 | Like %@{!@code{S}:@code{X}@}, but if there is an @code{S} switch, substitute @samp{-}. | |
4903 | ||
4904 | @item %@{.@code{S}:@code{X}@} | |
4905 | Substitutes @code{X}, but only if processing a file with suffix @code{S}. | |
4906 | ||
4907 | @item %@{!.@code{S}:@code{X}@} | |
4908 | Substitutes @code{X}, but only if @emph{not} processing a file with suffix @code{S}. | |
4909 | ||
4910 | @item %@{@code{S}|@code{P}:@code{X}@} | |
161d7b59 | 4911 | Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. This may be |
a743d340 NC |
4912 | combined with @samp{!} and @samp{.} sequences as well, although they |
4913 | have a stronger binding than the @samp{|}. For example a spec string | |
4914 | like this: | |
4915 | ||
4916 | @smallexample | |
4917 | %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} | |
4918 | @end smallexample | |
4919 | ||
4920 | will output the following command-line options from the following input | |
4921 | command-line options: | |
4922 | ||
4923 | @smallexample | |
4924 | fred.c -foo -baz | |
4925 | jim.d -bar -boggle | |
4926 | -d fred.c -foo -baz -boggle | |
4927 | -d jim.d -bar -baz -boggle | |
4928 | @end smallexample | |
4929 | ||
4930 | @end table | |
4931 | ||
4932 | The conditional text @code{X} in a %@{@code{S}:@code{X}@} or | |
4933 | %@{!@code{S}:@code{X}@} construct may contain other nested @samp{%} constructs | |
4934 | or spaces, or even newlines. They are processed as usual, as described | |
02f52e19 | 4935 | above. |
a743d340 | 4936 | |
695ac33f JM |
4937 | The @option{-O}, @option{-f}, @option{-m}, and @option{-W} |
4938 | switches are handled specifically in these | |
630d3d5a JM |
4939 | constructs. If another value of @option{-O} or the negated form of a @option{-f}, @option{-m}, or |
4940 | @option{-W} switch is found later in the command line, the earlier switch | |
a743d340 NC |
4941 | value is ignored, except with @{@code{S}*@} where @code{S} is just one |
4942 | letter, which passes all matching options. | |
4943 | ||
4944 | The character @samp{|} at the beginning of the predicate text is used to indicate | |
630d3d5a | 4945 | that a command should be piped to the following command, but only if @option{-pipe} |
a743d340 NC |
4946 | is specified. |
4947 | ||
4948 | It is built into GCC which switches take arguments and which do not. | |
4949 | (You might think it would be useful to generalize this to allow each | |
4950 | compiler's spec to say which switches take arguments. But this cannot | |
4951 | be done in a consistent fashion. GCC cannot even decide which input | |
4952 | files have been specified without knowing which switches take arguments, | |
4953 | and it must know which input files to compile in order to tell which | |
02f52e19 | 4954 | compilers to run). |
a743d340 | 4955 | |
630d3d5a | 4956 | GCC also knows implicitly that arguments starting in @option{-l} are to be |
a743d340 NC |
4957 | treated as compiler output files, and passed to the linker in their |
4958 | proper position among the other output files. | |
4959 | ||
ee457005 JM |
4960 | @c man begin OPTIONS |
4961 | ||
74291a4b MM |
4962 | @node Target Options |
4963 | @section Specifying Target Machine and Compiler Version | |
4964 | @cindex target options | |
4965 | @cindex cross compiling | |
4966 | @cindex specifying machine version | |
4967 | @cindex specifying compiler version and target machine | |
4968 | @cindex compiler version, specifying | |
4969 | @cindex target machine, specifying | |
4970 | ||
0c2d1a2a | 4971 | By default, GCC compiles code for the same type of machine that you |
74291a4b MM |
4972 | are using. However, it can also be installed as a cross-compiler, to |
4973 | compile for some other type of machine. In fact, several different | |
0c2d1a2a | 4974 | configurations of GCC, for different target machines, can be |
74291a4b | 4975 | installed side by side. Then you specify which one to use with the |
630d3d5a | 4976 | @option{-b} option. |
74291a4b | 4977 | |
0c2d1a2a | 4978 | In addition, older and newer versions of GCC can be installed side |
74291a4b MM |
4979 | by side. One of them (probably the newest) will be the default, but |
4980 | you may sometimes wish to use another. | |
4981 | ||
2642624b | 4982 | @table @gcctabopt |
74291a4b | 4983 | @item -b @var{machine} |
cd3bb277 | 4984 | @opindex b |
74291a4b | 4985 | The argument @var{machine} specifies the target machine for compilation. |
0c2d1a2a | 4986 | This is useful when you have installed GCC as a cross-compiler. |
74291a4b MM |
4987 | |
4988 | The value to use for @var{machine} is the same as was specified as the | |
0c2d1a2a | 4989 | machine type when configuring GCC as a cross-compiler. For |
74291a4b MM |
4990 | example, if a cross-compiler was configured with @samp{configure |
4991 | i386v}, meaning to compile for an 80386 running System V, then you | |
630d3d5a | 4992 | would specify @option{-b i386v} to run that cross compiler. |
74291a4b | 4993 | |
630d3d5a | 4994 | When you do not specify @option{-b}, it normally means to compile for |
74291a4b MM |
4995 | the same type of machine that you are using. |
4996 | ||
4997 | @item -V @var{version} | |
cd3bb277 | 4998 | @opindex V |
0c2d1a2a | 4999 | The argument @var{version} specifies which version of GCC to run. |
74291a4b | 5000 | This is useful when multiple versions are installed. For example, |
0c2d1a2a | 5001 | @var{version} might be @samp{2.0}, meaning to run GCC version 2.0. |
74291a4b | 5002 | |
630d3d5a | 5003 | The default version, when you do not specify @option{-V}, is the last |
0c2d1a2a | 5004 | version of GCC that you installed. |
74291a4b MM |
5005 | @end table |
5006 | ||
630d3d5a | 5007 | The @option{-b} and @option{-V} options actually work by controlling part of |
74291a4b | 5008 | the file name used for the executable files and libraries used for |
0c2d1a2a | 5009 | compilation. A given version of GCC, for a given target machine, is |
bd819a4a | 5010 | normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}. |
74291a4b | 5011 | |
630d3d5a | 5012 | Thus, sites can customize the effect of @option{-b} or @option{-V} either by |
74291a4b MM |
5013 | changing the names of these directories or adding alternate names (or |
5014 | symbolic links). If in directory @file{/usr/local/lib/gcc-lib/} the | |
630d3d5a JM |
5015 | file @file{80386} is a link to the file @file{i386v}, then @option{-b |
5016 | 80386} becomes an alias for @option{-b i386v}. | |
74291a4b | 5017 | |
630d3d5a | 5018 | In one respect, the @option{-b} or @option{-V} do not completely change |
bedc7537 | 5019 | to a different compiler: the top-level driver program @command{gcc} |
74291a4b MM |
5020 | that you originally invoked continues to run and invoke the other |
5021 | executables (preprocessor, compiler per se, assembler and linker) | |
5022 | that do the real work. However, since no real work is done in the | |
5023 | driver program, it usually does not matter that the driver program | |
8c7b74b9 JM |
5024 | in use is not the one for the specified target. It is common for the |
5025 | interface to the other executables to change incompatibly between | |
5026 | compiler versions, so unless the version specified is very close to that | |
630d3d5a JM |
5027 | of the driver (for example, @option{-V 3.0} with a driver program from GCC |
5028 | version 3.0.1), use of @option{-V} may not work; for example, using | |
5029 | @option{-V 2.95.2} will not work with a driver program from GCC 3.0. | |
74291a4b MM |
5030 | |
5031 | The only way that the driver program depends on the target machine is | |
5032 | in the parsing and handling of special machine-specific options. | |
5033 | However, this is controlled by a file which is found, along with the | |
5034 | other executables, in the directory for the specified version and | |
5035 | target machine. As a result, a single installed driver program adapts | |
8c7b74b9 JM |
5036 | to any specified target machine, and sufficiently similar compiler |
5037 | versions. | |
74291a4b MM |
5038 | |
5039 | The driver program executable does control one significant thing, | |
5040 | however: the default version and target machine. Therefore, you can | |
5041 | install different instances of the driver program, compiled for | |
5042 | different targets or versions, under different names. | |
5043 | ||
bedc7537 NC |
5044 | For example, if the driver for version 2.0 is installed as @command{ogcc} |
5045 | and that for version 2.1 is installed as @command{gcc}, then the command | |
5046 | @command{gcc} will use version 2.1 by default, while @command{ogcc} will use | |
74291a4b | 5047 | 2.0 by default. However, you can choose either version with either |
630d3d5a | 5048 | command with the @option{-V} option. |
74291a4b MM |
5049 | |
5050 | @node Submodel Options | |
5051 | @section Hardware Models and Configurations | |
5052 | @cindex submodel options | |
5053 | @cindex specifying hardware config | |
5054 | @cindex hardware models and configurations, specifying | |
5055 | @cindex machine dependent options | |
5056 | ||
630d3d5a | 5057 | Earlier we discussed the standard option @option{-b} which chooses among |
74291a4b | 5058 | different installed compilers for completely different target |
8aeea6e6 | 5059 | machines, such as VAX vs.@: 68000 vs.@: 80386. |
74291a4b MM |
5060 | |
5061 | In addition, each of these target machine types can have its own | |
5062 | special options, starting with @samp{-m}, to choose among various | |
5063 | hardware models or configurations---for example, 68010 vs 68020, | |
5064 | floating coprocessor or none. A single installed version of the | |
5065 | compiler can compile for any model or configuration, according to the | |
5066 | options specified. | |
5067 | ||
5068 | Some configurations of the compiler also support additional special | |
5069 | options, usually for compatibility with other compilers on the same | |
5070 | platform. | |
5071 | ||
74291a4b MM |
5072 | These options are defined by the macro @code{TARGET_SWITCHES} in the |
5073 | machine description. The default for the options is also defined by | |
5074 | that macro, which enables you to change the defaults. | |
74291a4b MM |
5075 | |
5076 | @menu | |
5077 | * M680x0 Options:: | |
2856c3e3 | 5078 | * M68hc1x Options:: |
74291a4b MM |
5079 | * VAX Options:: |
5080 | * SPARC Options:: | |
5081 | * Convex Options:: | |
5082 | * AMD29K Options:: | |
5083 | * ARM Options:: | |
ecff22ab | 5084 | * MN10200 Options:: |
6d6d0fa0 | 5085 | * MN10300 Options:: |
861bb6c1 | 5086 | * M32R/D Options:: |
74291a4b MM |
5087 | * M88K Options:: |
5088 | * RS/6000 and PowerPC Options:: | |
5089 | * RT Options:: | |
5090 | * MIPS Options:: | |
14f73b5a | 5091 | * i386 and x86-64 Options:: |
74291a4b MM |
5092 | * HPPA Options:: |
5093 | * Intel 960 Options:: | |
5094 | * DEC Alpha Options:: | |
d7c23cdc | 5095 | * DEC Alpha/VMS Options:: |
74291a4b MM |
5096 | * Clipper Options:: |
5097 | * H8/300 Options:: | |
5098 | * SH Options:: | |
5099 | * System V Options:: | |
282a61e6 | 5100 | * TMS320C3x/C4x Options:: |
f84271d9 | 5101 | * V850 Options:: |
56b2d7a7 | 5102 | * ARC Options:: |
83575957 | 5103 | * NS32K Options:: |
052a4b28 DC |
5104 | * AVR Options:: |
5105 | * MCore Options:: | |
df6194d4 | 5106 | * IA-64 Options:: |
e8ad90e5 | 5107 | * D30V Options:: |
91abf72d | 5108 | * S/390 and zSeries Options:: |
0b85d816 | 5109 | * CRIS Options:: |
bcf684c7 | 5110 | * MMIX Options:: |
9f85bca7 | 5111 | * PDP-11 Options:: |
74291a4b MM |
5112 | @end menu |
5113 | ||
5114 | @node M680x0 Options | |
5115 | @subsection M680x0 Options | |
5116 | @cindex M680x0 options | |
5117 | ||
5118 | These are the @samp{-m} options defined for the 68000 series. The default | |
5119 | values for these options depends on which style of 68000 was selected when | |
5120 | the compiler was configured; the defaults for the most common choices are | |
5121 | given below. | |
5122 | ||
2642624b | 5123 | @table @gcctabopt |
74291a4b MM |
5124 | @item -m68000 |
5125 | @itemx -mc68000 | |
cd3bb277 JM |
5126 | @opindex m68000 |
5127 | @opindex mc68000 | |
74291a4b MM |
5128 | Generate output for a 68000. This is the default |
5129 | when the compiler is configured for 68000-based systems. | |
5130 | ||
74cf1c6d RK |
5131 | Use this option for microcontrollers with a 68000 or EC000 core, |
5132 | including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. | |
5133 | ||
74291a4b MM |
5134 | @item -m68020 |
5135 | @itemx -mc68020 | |
cd3bb277 JM |
5136 | @opindex m68020 |
5137 | @opindex mc68020 | |
74291a4b MM |
5138 | Generate output for a 68020. This is the default |
5139 | when the compiler is configured for 68020-based systems. | |
5140 | ||
5141 | @item -m68881 | |
cd3bb277 | 5142 | @opindex m68881 |
74291a4b | 5143 | Generate output containing 68881 instructions for floating point. |
630d3d5a | 5144 | This is the default for most 68020 systems unless @option{--nfp} was |
74291a4b MM |
5145 | specified when the compiler was configured. |
5146 | ||
5147 | @item -m68030 | |
cd3bb277 | 5148 | @opindex m68030 |
74291a4b MM |
5149 | Generate output for a 68030. This is the default when the compiler is |
5150 | configured for 68030-based systems. | |
5151 | ||
5152 | @item -m68040 | |
cd3bb277 | 5153 | @opindex m68040 |
74291a4b MM |
5154 | Generate output for a 68040. This is the default when the compiler is |
5155 | configured for 68040-based systems. | |
5156 | ||
5157 | This option inhibits the use of 68881/68882 instructions that have to be | |
74cf1c6d RK |
5158 | emulated by software on the 68040. Use this option if your 68040 does not |
5159 | have code to emulate those instructions. | |
74291a4b MM |
5160 | |
5161 | @item -m68060 | |
cd3bb277 | 5162 | @opindex m68060 |
74291a4b MM |
5163 | Generate output for a 68060. This is the default when the compiler is |
5164 | configured for 68060-based systems. | |
5165 | ||
5166 | This option inhibits the use of 68020 and 68881/68882 instructions that | |
74cf1c6d RK |
5167 | have to be emulated by software on the 68060. Use this option if your 68060 |
5168 | does not have code to emulate those instructions. | |
5169 | ||
5170 | @item -mcpu32 | |
cd3bb277 | 5171 | @opindex mcpu32 |
767094dd | 5172 | Generate output for a CPU32. This is the default |
74cf1c6d RK |
5173 | when the compiler is configured for CPU32-based systems. |
5174 | ||
5175 | Use this option for microcontrollers with a | |
5176 | CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, | |
5177 | 68336, 68340, 68341, 68349 and 68360. | |
74291a4b MM |
5178 | |
5179 | @item -m5200 | |
cd3bb277 | 5180 | @opindex m5200 |
695ac33f | 5181 | Generate output for a 520X ``coldfire'' family cpu. This is the default |
74291a4b MM |
5182 | when the compiler is configured for 520X-based systems. |
5183 | ||
02f52e19 | 5184 | Use this option for microcontroller with a 5200 core, including |
74cf1c6d RK |
5185 | the MCF5202, MCF5203, MCF5204 and MCF5202. |
5186 | ||
74291a4b MM |
5187 | |
5188 | @item -m68020-40 | |
cd3bb277 | 5189 | @opindex m68020-40 |
74291a4b MM |
5190 | Generate output for a 68040, without using any of the new instructions. |
5191 | This results in code which can run relatively efficiently on either a | |
5192 | 68020/68881 or a 68030 or a 68040. The generated code does use the | |
5193 | 68881 instructions that are emulated on the 68040. | |
5194 | ||
861bb6c1 | 5195 | @item -m68020-60 |
cd3bb277 | 5196 | @opindex m68020-60 |
861bb6c1 JL |
5197 | Generate output for a 68060, without using any of the new instructions. |
5198 | This results in code which can run relatively efficiently on either a | |
5199 | 68020/68881 or a 68030 or a 68040. The generated code does use the | |
5200 | 68881 instructions that are emulated on the 68060. | |
5201 | ||
74291a4b | 5202 | @item -mfpa |
cd3bb277 | 5203 | @opindex mfpa |
74291a4b MM |
5204 | Generate output containing Sun FPA instructions for floating point. |
5205 | ||
5206 | @item -msoft-float | |
cd3bb277 | 5207 | @opindex msoft-float |
74291a4b MM |
5208 | Generate output containing library calls for floating point. |
5209 | @strong{Warning:} the requisite libraries are not available for all m68k | |
5210 | targets. Normally the facilities of the machine's usual C compiler are | |
5211 | used, but this can't be done directly in cross-compilation. You must | |
5212 | make your own arrangements to provide suitable library functions for | |
5213 | cross-compilation. The embedded targets @samp{m68k-*-aout} and | |
5214 | @samp{m68k-*-coff} do provide software floating point support. | |
5215 | ||
5216 | @item -mshort | |
cd3bb277 | 5217 | @opindex mshort |
74291a4b MM |
5218 | Consider type @code{int} to be 16 bits wide, like @code{short int}. |
5219 | ||
5220 | @item -mnobitfield | |
cd3bb277 | 5221 | @opindex mnobitfield |
630d3d5a JM |
5222 | Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} |
5223 | and @option{-m5200} options imply @w{@option{-mnobitfield}}. | |
74291a4b MM |
5224 | |
5225 | @item -mbitfield | |
cd3bb277 | 5226 | @opindex mbitfield |
630d3d5a JM |
5227 | Do use the bit-field instructions. The @option{-m68020} option implies |
5228 | @option{-mbitfield}. This is the default if you use a configuration | |
74291a4b MM |
5229 | designed for a 68020. |
5230 | ||
5231 | @item -mrtd | |
cd3bb277 | 5232 | @opindex mrtd |
74291a4b MM |
5233 | Use a different function-calling convention, in which functions |
5234 | that take a fixed number of arguments return with the @code{rtd} | |
5235 | instruction, which pops their arguments while returning. This | |
5236 | saves one instruction in the caller since there is no need to pop | |
5237 | the arguments there. | |
5238 | ||
5239 | This calling convention is incompatible with the one normally | |
5240 | used on Unix, so you cannot use it if you need to call libraries | |
5241 | compiled with the Unix compiler. | |
5242 | ||
5243 | Also, you must provide function prototypes for all functions that | |
5244 | take variable numbers of arguments (including @code{printf}); | |
5245 | otherwise incorrect code will be generated for calls to those | |
5246 | functions. | |
5247 | ||
5248 | In addition, seriously incorrect code will result if you call a | |
5249 | function with too many arguments. (Normally, extra arguments are | |
5250 | harmlessly ignored.) | |
5251 | ||
5252 | The @code{rtd} instruction is supported by the 68010, 68020, 68030, | |
74cf1c6d | 5253 | 68040, 68060 and CPU32 processors, but not by the 68000 or 5200. |
861bb6c1 JL |
5254 | |
5255 | @item -malign-int | |
5256 | @itemx -mno-align-int | |
cd3bb277 JM |
5257 | @opindex malign-int |
5258 | @opindex mno-align-int | |
02f52e19 | 5259 | Control whether GCC aligns @code{int}, @code{long}, @code{long long}, |
861bb6c1 | 5260 | @code{float}, @code{double}, and @code{long double} variables on a 32-bit |
630d3d5a | 5261 | boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). |
861bb6c1 JL |
5262 | Aligning variables on 32-bit boundaries produces code that runs somewhat |
5263 | faster on processors with 32-bit busses at the expense of more memory. | |
5264 | ||
630d3d5a | 5265 | @strong{Warning:} if you use the @option{-malign-int} switch, GCC will |
861bb6c1 JL |
5266 | align structures containing the above types differently than |
5267 | most published application binary interface specifications for the m68k. | |
5268 | ||
fb868474 | 5269 | @item -mpcrel |
cd3bb277 | 5270 | @opindex mpcrel |
fb868474 | 5271 | Use the pc-relative addressing mode of the 68000 directly, instead of |
695ac33f JM |
5272 | using a global offset table. At present, this option implies @option{-fpic}, |
5273 | allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is | |
5274 | not presently supported with @option{-mpcrel}, though this could be supported for | |
fb868474 DL |
5275 | 68020 and higher processors. |
5276 | ||
b71733d5 GM |
5277 | @item -mno-strict-align |
5278 | @itemx -mstrict-align | |
cd3bb277 JM |
5279 | @opindex mno-strict-align |
5280 | @opindex mstrict-align | |
b71733d5 GM |
5281 | Do not (do) assume that unaligned memory references will be handled by |
5282 | the system. | |
5283 | ||
74291a4b MM |
5284 | @end table |
5285 | ||
2856c3e3 SC |
5286 | @node M68hc1x Options |
5287 | @subsection M68hc1x Options | |
5288 | @cindex M68hc1x options | |
5289 | ||
5290 | These are the @samp{-m} options defined for the 68hc11 and 68hc12 | |
02f52e19 | 5291 | microcontrollers. The default values for these options depends on |
2856c3e3 SC |
5292 | which style of microcontroller was selected when the compiler was configured; |
5293 | the defaults for the most common choices are given below. | |
5294 | ||
2642624b | 5295 | @table @gcctabopt |
2856c3e3 SC |
5296 | @item -m6811 |
5297 | @itemx -m68hc11 | |
cd3bb277 JM |
5298 | @opindex m6811 |
5299 | @opindex m68hc11 | |
2856c3e3 SC |
5300 | Generate output for a 68HC11. This is the default |
5301 | when the compiler is configured for 68HC11-based systems. | |
5302 | ||
5303 | @item -m6812 | |
5304 | @itemx -m68hc12 | |
cd3bb277 JM |
5305 | @opindex m6812 |
5306 | @opindex m68hc12 | |
2856c3e3 SC |
5307 | Generate output for a 68HC12. This is the default |
5308 | when the compiler is configured for 68HC12-based systems. | |
5309 | ||
5310 | @item -mauto-incdec | |
cd3bb277 | 5311 | @opindex mauto-incdec |
2856c3e3 SC |
5312 | Enable the use of 68HC12 pre and post auto-increment and auto-decrement |
5313 | addressing modes. | |
5314 | ||
5315 | @item -mshort | |
cd3bb277 | 5316 | @opindex mshort |
2856c3e3 SC |
5317 | Consider type @code{int} to be 16 bits wide, like @code{short int}. |
5318 | ||
5319 | @item -msoft-reg-count=@var{count} | |
cd3bb277 | 5320 | @opindex msoft-reg-count |
2856c3e3 SC |
5321 | Specify the number of pseudo-soft registers which are used for the |
5322 | code generation. The maximum number is 32. Using more pseudo-soft | |
5323 | register may or may not result in better code depending on the program. | |
5324 | The default is 4 for 68HC11 and 2 for 68HC12. | |
5325 | ||
5326 | @end table | |
5327 | ||
74291a4b MM |
5328 | @node VAX Options |
5329 | @subsection VAX Options | |
5330 | @cindex VAX options | |
5331 | ||
8aeea6e6 | 5332 | These @samp{-m} options are defined for the VAX: |
74291a4b | 5333 | |
2642624b | 5334 | @table @gcctabopt |
74291a4b | 5335 | @item -munix |
cd3bb277 | 5336 | @opindex munix |
74291a4b | 5337 | Do not output certain jump instructions (@code{aobleq} and so on) |
8aeea6e6 | 5338 | that the Unix assembler for the VAX cannot handle across long |
74291a4b MM |
5339 | ranges. |
5340 | ||
5341 | @item -mgnu | |
cd3bb277 | 5342 | @opindex mgnu |
74291a4b MM |
5343 | Do output those jump instructions, on the assumption that you |
5344 | will assemble with the GNU assembler. | |
5345 | ||
5346 | @item -mg | |
cd3bb277 | 5347 | @opindex mg |
74291a4b MM |
5348 | Output code for g-format floating point numbers instead of d-format. |
5349 | @end table | |
5350 | ||
5351 | @node SPARC Options | |
5352 | @subsection SPARC Options | |
5353 | @cindex SPARC options | |
5354 | ||
5355 | These @samp{-m} switches are supported on the SPARC: | |
5356 | ||
2642624b | 5357 | @table @gcctabopt |
74291a4b MM |
5358 | @item -mno-app-regs |
5359 | @itemx -mapp-regs | |
cd3bb277 JM |
5360 | @opindex mno-app-regs |
5361 | @opindex mapp-regs | |
630d3d5a | 5362 | Specify @option{-mapp-regs} to generate output using the global registers |
74291a4b MM |
5363 | 2 through 4, which the SPARC SVR4 ABI reserves for applications. This |
5364 | is the default. | |
5365 | ||
5366 | To be fully SVR4 ABI compliant at the cost of some performance loss, | |
630d3d5a | 5367 | specify @option{-mno-app-regs}. You should compile libraries and system |
74291a4b MM |
5368 | software with this option. |
5369 | ||
5370 | @item -mfpu | |
5371 | @itemx -mhard-float | |
cd3bb277 JM |
5372 | @opindex mfpu |
5373 | @opindex mhard-float | |
74291a4b MM |
5374 | Generate output containing floating point instructions. This is the |
5375 | default. | |
5376 | ||
5377 | @item -mno-fpu | |
5378 | @itemx -msoft-float | |
cd3bb277 JM |
5379 | @opindex mno-fpu |
5380 | @opindex msoft-float | |
74291a4b MM |
5381 | Generate output containing library calls for floating point. |
5382 | @strong{Warning:} the requisite libraries are not available for all SPARC | |
5383 | targets. Normally the facilities of the machine's usual C compiler are | |
5384 | used, but this cannot be done directly in cross-compilation. You must make | |
5385 | your own arrangements to provide suitable library functions for | |
5386 | cross-compilation. The embedded targets @samp{sparc-*-aout} and | |
5387 | @samp{sparclite-*-*} do provide software floating point support. | |
5388 | ||
630d3d5a | 5389 | @option{-msoft-float} changes the calling convention in the output file; |
74291a4b MM |
5390 | therefore, it is only useful if you compile @emph{all} of a program with |
5391 | this option. In particular, you need to compile @file{libgcc.a}, the | |
630d3d5a | 5392 | library that comes with GCC, with @option{-msoft-float} in order for |
74291a4b MM |
5393 | this to work. |
5394 | ||
5395 | @item -mhard-quad-float | |
cd3bb277 | 5396 | @opindex mhard-quad-float |
74291a4b MM |
5397 | Generate output containing quad-word (long double) floating point |
5398 | instructions. | |
5399 | ||
5400 | @item -msoft-quad-float | |
cd3bb277 | 5401 | @opindex msoft-quad-float |
74291a4b MM |
5402 | Generate output containing library calls for quad-word (long double) |
5403 | floating point instructions. The functions called are those specified | |
161d7b59 | 5404 | in the SPARC ABI@. This is the default. |
74291a4b MM |
5405 | |
5406 | As of this writing, there are no sparc implementations that have hardware | |
5407 | support for the quad-word floating point instructions. They all invoke | |
5408 | a trap handler for one of these instructions, and then the trap handler | |
5409 | emulates the effect of the instruction. Because of the trap handler overhead, | |
5410 | this is much slower than calling the ABI library routines. Thus the | |
630d3d5a | 5411 | @option{-msoft-quad-float} option is the default. |
74291a4b MM |
5412 | |
5413 | @item -mno-epilogue | |
5414 | @itemx -mepilogue | |
cd3bb277 JM |
5415 | @opindex mno-epilogue |
5416 | @opindex mepilogue | |
630d3d5a | 5417 | With @option{-mepilogue} (the default), the compiler always emits code for |
74291a4b MM |
5418 | function exit at the end of each function. Any function exit in |
5419 | the middle of the function (such as a return statement in C) will | |
5420 | generate a jump to the exit code at the end of the function. | |
5421 | ||
630d3d5a | 5422 | With @option{-mno-epilogue}, the compiler tries to emit exit code inline |
74291a4b MM |
5423 | at every function exit. |
5424 | ||
5425 | @item -mno-flat | |
5426 | @itemx -mflat | |
cd3bb277 JM |
5427 | @opindex mno-flat |
5428 | @opindex mflat | |
630d3d5a | 5429 | With @option{-mflat}, the compiler does not generate save/restore instructions |
695ac33f | 5430 | and will use a ``flat'' or single register window calling convention. |
74291a4b MM |
5431 | This model uses %i7 as the frame pointer and is compatible with the normal |
5432 | register window model. Code from either may be intermixed. | |
aee96fe9 | 5433 | The local registers and the input registers (0--5) are still treated as |
695ac33f | 5434 | ``call saved'' registers and will be saved on the stack as necessary. |
74291a4b | 5435 | |
630d3d5a | 5436 | With @option{-mno-flat} (the default), the compiler emits save/restore |
74291a4b MM |
5437 | instructions (except for leaf functions) and is the normal mode of operation. |
5438 | ||
5439 | @item -mno-unaligned-doubles | |
5440 | @itemx -munaligned-doubles | |
cd3bb277 JM |
5441 | @opindex mno-unaligned-doubles |
5442 | @opindex munaligned-doubles | |
74291a4b MM |
5443 | Assume that doubles have 8 byte alignment. This is the default. |
5444 | ||
630d3d5a | 5445 | With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte |
74291a4b MM |
5446 | alignment only if they are contained in another type, or if they have an |
5447 | absolute address. Otherwise, it assumes they have 4 byte alignment. | |
5448 | Specifying this option avoids some rare compatibility problems with code | |
5449 | generated by other compilers. It is not the default because it results | |
5450 | in a performance loss, especially for floating point code. | |
5451 | ||
c219ddf7 BK |
5452 | @item -mno-faster-structs |
5453 | @itemx -mfaster-structs | |
cd3bb277 JM |
5454 | @opindex mno-faster-structs |
5455 | @opindex mfaster-structs | |
630d3d5a | 5456 | With @option{-mfaster-structs}, the compiler assumes that structures |
c219ddf7 BK |
5457 | should have 8 byte alignment. This enables the use of pairs of |
5458 | @code{ldd} and @code{std} instructions for copies in structure | |
5459 | assignment, in place of twice as many @code{ld} and @code{st} pairs. | |
5460 | However, the use of this changed alignment directly violates the Sparc | |
161d7b59 | 5461 | ABI@. Thus, it's intended only for use on targets where the developer |
c219ddf7 | 5462 | acknowledges that their resulting code will not be directly in line with |
161d7b59 | 5463 | the rules of the ABI@. |
c219ddf7 | 5464 | |
74291a4b MM |
5465 | @item -mv8 |
5466 | @itemx -msparclite | |
cd3bb277 JM |
5467 | @opindex mv8 |
5468 | @opindex msparclite | |
74291a4b MM |
5469 | These two options select variations on the SPARC architecture. |
5470 | ||
5471 | By default (unless specifically configured for the Fujitsu SPARClite), | |
5472 | GCC generates code for the v7 variant of the SPARC architecture. | |
5473 | ||
630d3d5a | 5474 | @option{-mv8} will give you SPARC v8 code. The only difference from v7 |
74291a4b MM |
5475 | code is that the compiler emits the integer multiply and integer |
5476 | divide instructions which exist in SPARC v8 but not in SPARC v7. | |
5477 | ||
630d3d5a | 5478 | @option{-msparclite} will give you SPARClite code. This adds the integer |
74291a4b MM |
5479 | multiply, integer divide step and scan (@code{ffs}) instructions which |
5480 | exist in SPARClite but not in SPARC v7. | |
5481 | ||
0c2d1a2a | 5482 | These options are deprecated and will be deleted in a future GCC release. |
630d3d5a | 5483 | They have been replaced with @option{-mcpu=xxx}. |
74291a4b MM |
5484 | |
5485 | @item -mcypress | |
5486 | @itemx -msupersparc | |
cd3bb277 JM |
5487 | @opindex mcypress |
5488 | @opindex msupersparc | |
c21cd8b1 | 5489 | These two options select the processor for which the code is optimized. |
74291a4b | 5490 | |
630d3d5a | 5491 | With @option{-mcypress} (the default), the compiler optimizes code for the |
74291a4b MM |
5492 | Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series. |
5493 | This is also appropriate for the older SparcStation 1, 2, IPX etc. | |
5494 | ||
630d3d5a | 5495 | With @option{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as |
767094dd | 5496 | used in the SparcStation 10, 1000 and 2000 series. This flag also enables use |
74291a4b MM |
5497 | of the full SPARC v8 instruction set. |
5498 | ||
0c2d1a2a | 5499 | These options are deprecated and will be deleted in a future GCC release. |
630d3d5a | 5500 | They have been replaced with @option{-mcpu=xxx}. |
74291a4b MM |
5501 | |
5502 | @item -mcpu=@var{cpu_type} | |
cd3bb277 | 5503 | @opindex mcpu |
c0498f43 DE |
5504 | Set the instruction set, register set, and instruction scheduling parameters |
5505 | for machine type @var{cpu_type}. Supported values for @var{cpu_type} are | |
5506 | @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite}, | |
ad6843d7 RH |
5507 | @samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934}, |
5508 | @samp{sparclet}, @samp{tsc701}, @samp{v9}, and @samp{ultrasparc}. | |
c0498f43 DE |
5509 | |
5510 | Default instruction scheduling parameters are used for values that select | |
5511 | an architecture and not an implementation. These are @samp{v7}, @samp{v8}, | |
5512 | @samp{sparclite}, @samp{sparclet}, @samp{v9}. | |
5513 | ||
5514 | Here is a list of each supported architecture and their supported | |
5515 | implementations. | |
5516 | ||
5517 | @smallexample | |
5518 | v7: cypress | |
ad6843d7 RH |
5519 | v8: supersparc, hypersparc |
5520 | sparclite: f930, f934, sparclite86x | |
c0498f43 DE |
5521 | sparclet: tsc701 |
5522 | v9: ultrasparc | |
5523 | @end smallexample | |
74291a4b MM |
5524 | |
5525 | @item -mtune=@var{cpu_type} | |
cd3bb277 | 5526 | @opindex mtune |
74291a4b | 5527 | Set the instruction scheduling parameters for machine type |
c0498f43 | 5528 | @var{cpu_type}, but do not set the instruction set or register set that the |
630d3d5a | 5529 | option @option{-mcpu=@var{cpu_type}} would. |
c0498f43 | 5530 | |
9c34dbbf ZW |
5531 | The same values for @option{-mcpu=@var{cpu_type}} can be used for |
5532 | @option{-mtune=@var{cpu_type}}, but the only useful values are those | |
5533 | that select a particular cpu implementation. Those are @samp{cypress}, | |
5534 | @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934}, | |
5535 | @samp{sparclite86x}, @samp{tsc701}, and @samp{ultrasparc}. | |
74291a4b MM |
5536 | |
5537 | @end table | |
5538 | ||
5539 | These @samp{-m} switches are supported in addition to the above | |
5540 | on the SPARCLET processor. | |
5541 | ||
2642624b | 5542 | @table @gcctabopt |
74291a4b | 5543 | @item -mlittle-endian |
cd3bb277 | 5544 | @opindex mlittle-endian |
74291a4b MM |
5545 | Generate code for a processor running in little-endian mode. |
5546 | ||
5547 | @item -mlive-g0 | |
cd3bb277 | 5548 | @opindex mlive-g0 |
74291a4b MM |
5549 | Treat register @code{%g0} as a normal register. |
5550 | GCC will continue to clobber it as necessary but will not assume | |
5551 | it always reads as 0. | |
5552 | ||
5553 | @item -mbroken-saverestore | |
cd3bb277 | 5554 | @opindex mbroken-saverestore |
74291a4b MM |
5555 | Generate code that does not use non-trivial forms of the @code{save} and |
5556 | @code{restore} instructions. Early versions of the SPARCLET processor do | |
5557 | not correctly handle @code{save} and @code{restore} instructions used with | |
5558 | arguments. They correctly handle them used without arguments. A @code{save} | |
5559 | instruction used without arguments increments the current window pointer | |
5560 | but does not allocate a new stack frame. It is assumed that the window | |
5561 | overflow trap handler will properly handle this case as will interrupt | |
5562 | handlers. | |
5563 | @end table | |
5564 | ||
5565 | These @samp{-m} switches are supported in addition to the above | |
02f52e19 | 5566 | on SPARC V9 processors in 64-bit environments. |
74291a4b | 5567 | |
2642624b | 5568 | @table @gcctabopt |
74291a4b | 5569 | @item -mlittle-endian |
cd3bb277 | 5570 | @opindex mlittle-endian |
74291a4b MM |
5571 | Generate code for a processor running in little-endian mode. |
5572 | ||
ded17aad DE |
5573 | @item -m32 |
5574 | @itemx -m64 | |
cd3bb277 JM |
5575 | @opindex m32 |
5576 | @opindex m64 | |
02f52e19 AJ |
5577 | Generate code for a 32-bit or 64-bit environment. |
5578 | The 32-bit environment sets int, long and pointer to 32 bits. | |
5579 | The 64-bit environment sets int to 32 bits and long and pointer | |
ded17aad DE |
5580 | to 64 bits. |
5581 | ||
5582 | @item -mcmodel=medlow | |
cd3bb277 | 5583 | @opindex mcmodel=medlow |
ded17aad DE |
5584 | Generate code for the Medium/Low code model: the program must be linked |
5585 | in the low 32 bits of the address space. Pointers are 64 bits. | |
5586 | Programs can be statically or dynamically linked. | |
5587 | ||
5588 | @item -mcmodel=medmid | |
cd3bb277 | 5589 | @opindex mcmodel=medmid |
ded17aad DE |
5590 | Generate code for the Medium/Middle code model: the program must be linked |
5591 | in the low 44 bits of the address space, the text segment must be less than | |
5592 | 2G bytes, and data segment must be within 2G of the text segment. | |
5593 | Pointers are 64 bits. | |
5594 | ||
5595 | @item -mcmodel=medany | |
cd3bb277 | 5596 | @opindex mcmodel=medany |
ded17aad DE |
5597 | Generate code for the Medium/Anywhere code model: the program may be linked |
5598 | anywhere in the address space, the text segment must be less than | |
5599 | 2G bytes, and data segment must be within 2G of the text segment. | |
5600 | Pointers are 64 bits. | |
5601 | ||
5602 | @item -mcmodel=embmedany | |
cd3bb277 | 5603 | @opindex mcmodel=embmedany |
ded17aad | 5604 | Generate code for the Medium/Anywhere code model for embedded systems: |
02f52e19 | 5605 | assume a 32-bit text and a 32-bit data segment, both starting anywhere |
ded17aad | 5606 | (determined at link time). Register %g4 points to the base of the |
02f52e19 | 5607 | data segment. Pointers are still 64 bits. |
ded17aad | 5608 | Programs are statically linked, PIC is not supported. |
74291a4b MM |
5609 | |
5610 | @item -mstack-bias | |
5611 | @itemx -mno-stack-bias | |
cd3bb277 JM |
5612 | @opindex mstack-bias |
5613 | @opindex mno-stack-bias | |
630d3d5a JM |
5614 | With @option{-mstack-bias}, GCC assumes that the stack pointer, and |
5615 | frame pointer if present, are offset by @minus{}2047 which must be added back | |
74291a4b MM |
5616 | when making stack frame references. |
5617 | Otherwise, assume no such offset is present. | |
5618 | @end table | |
5619 | ||
5620 | @node Convex Options | |
5621 | @subsection Convex Options | |
5622 | @cindex Convex options | |
5623 | ||
5624 | These @samp{-m} options are defined for Convex: | |
5625 | ||
2642624b | 5626 | @table @gcctabopt |
74291a4b | 5627 | @item -mc1 |
cd3bb277 | 5628 | @opindex mc1 |
74291a4b MM |
5629 | Generate output for C1. The code will run on any Convex machine. |
5630 | The preprocessor symbol @code{__convex__c1__} is defined. | |
5631 | ||
5632 | @item -mc2 | |
cd3bb277 | 5633 | @opindex mc2 |
74291a4b MM |
5634 | Generate output for C2. Uses instructions not available on C1. |
5635 | Scheduling and other optimizations are chosen for max performance on C2. | |
5636 | The preprocessor symbol @code{__convex_c2__} is defined. | |
5637 | ||
5638 | @item -mc32 | |
cd3bb277 | 5639 | @opindex mc32 |
74291a4b MM |
5640 | Generate output for C32xx. Uses instructions not available on C1. |
5641 | Scheduling and other optimizations are chosen for max performance on C32. | |
5642 | The preprocessor symbol @code{__convex_c32__} is defined. | |
5643 | ||
5644 | @item -mc34 | |
cd3bb277 | 5645 | @opindex mc34 |
74291a4b MM |
5646 | Generate output for C34xx. Uses instructions not available on C1. |
5647 | Scheduling and other optimizations are chosen for max performance on C34. | |
5648 | The preprocessor symbol @code{__convex_c34__} is defined. | |
5649 | ||
5650 | @item -mc38 | |
cd3bb277 | 5651 | @opindex mc38 |
74291a4b MM |
5652 | Generate output for C38xx. Uses instructions not available on C1. |
5653 | Scheduling and other optimizations are chosen for max performance on C38. | |
5654 | The preprocessor symbol @code{__convex_c38__} is defined. | |
5655 | ||
5656 | @item -margcount | |
cd3bb277 | 5657 | @opindex margcount |
74291a4b MM |
5658 | Generate code which puts an argument count in the word preceding each |
5659 | argument list. This is compatible with regular CC, and a few programs | |
5660 | may need the argument count word. GDB and other source-level debuggers | |
5661 | do not need it; this info is in the symbol table. | |
5662 | ||
5663 | @item -mnoargcount | |
cd3bb277 | 5664 | @opindex mnoargcount |
74291a4b MM |
5665 | Omit the argument count word. This is the default. |
5666 | ||
5667 | @item -mvolatile-cache | |
cd3bb277 | 5668 | @opindex mvolatile-cache |
74291a4b MM |
5669 | Allow volatile references to be cached. This is the default. |
5670 | ||
5671 | @item -mvolatile-nocache | |
cd3bb277 | 5672 | @opindex mvolatile-nocache |
74291a4b MM |
5673 | Volatile references bypass the data cache, going all the way to memory. |
5674 | This is only needed for multi-processor code that does not use standard | |
5675 | synchronization instructions. Making non-volatile references to volatile | |
5676 | locations will not necessarily work. | |
5677 | ||
5678 | @item -mlong32 | |
cd3bb277 | 5679 | @opindex mlong32 |
74291a4b MM |
5680 | Type long is 32 bits, the same as type int. This is the default. |
5681 | ||
5682 | @item -mlong64 | |
cd3bb277 | 5683 | @opindex mlong64 |
74291a4b MM |
5684 | Type long is 64 bits, the same as type long long. This option is useless, |
5685 | because no library support exists for it. | |
5686 | @end table | |
5687 | ||
5688 | @node AMD29K Options | |
5689 | @subsection AMD29K Options | |
5690 | @cindex AMD29K options | |
5691 | ||
5692 | These @samp{-m} options are defined for the AMD Am29000: | |
5693 | ||
2642624b | 5694 | @table @gcctabopt |
74291a4b | 5695 | @item -mdw |
cd3bb277 | 5696 | @opindex mdw |
74291a4b MM |
5697 | @cindex DW bit (29k) |
5698 | Generate code that assumes the @code{DW} bit is set, i.e., that byte and | |
5699 | halfword operations are directly supported by the hardware. This is the | |
5700 | default. | |
5701 | ||
5702 | @item -mndw | |
cd3bb277 | 5703 | @opindex mndw |
74291a4b MM |
5704 | Generate code that assumes the @code{DW} bit is not set. |
5705 | ||
5706 | @item -mbw | |
cd3bb277 | 5707 | @opindex mbw |
74291a4b MM |
5708 | @cindex byte writes (29k) |
5709 | Generate code that assumes the system supports byte and halfword write | |
5710 | operations. This is the default. | |
5711 | ||
5712 | @item -mnbw | |
cd3bb277 | 5713 | @opindex mnbw |
74291a4b | 5714 | Generate code that assumes the systems does not support byte and |
630d3d5a | 5715 | halfword write operations. @option{-mnbw} implies @option{-mndw}. |
74291a4b MM |
5716 | |
5717 | @item -msmall | |
cd3bb277 | 5718 | @opindex msmall |
74291a4b MM |
5719 | @cindex memory model (29k) |
5720 | Use a small memory model that assumes that all function addresses are | |
5721 | either within a single 256 KB segment or at an absolute address of less | |
5722 | than 256k. This allows the @code{call} instruction to be used instead | |
5723 | of a @code{const}, @code{consth}, @code{calli} sequence. | |
5724 | ||
5725 | @item -mnormal | |
cd3bb277 | 5726 | @opindex mnormal |
74291a4b MM |
5727 | Use the normal memory model: Generate @code{call} instructions only when |
5728 | calling functions in the same file and @code{calli} instructions | |
5729 | otherwise. This works if each file occupies less than 256 KB but allows | |
161d7b59 | 5730 | the entire executable to be larger than 256 KB@. This is the default. |
74291a4b MM |
5731 | |
5732 | @item -mlarge | |
cd3bb277 | 5733 | @opindex mlarge |
74291a4b MM |
5734 | Always use @code{calli} instructions. Specify this option if you expect |
5735 | a single file to compile into more than 256 KB of code. | |
5736 | ||
5737 | @item -m29050 | |
cd3bb277 | 5738 | @opindex m29050 |
74291a4b MM |
5739 | @cindex processor selection (29k) |
5740 | Generate code for the Am29050. | |
5741 | ||
5742 | @item -m29000 | |
cd3bb277 | 5743 | @opindex m29000 |
74291a4b MM |
5744 | Generate code for the Am29000. This is the default. |
5745 | ||
5746 | @item -mkernel-registers | |
cd3bb277 | 5747 | @opindex mkernel-registers |
74291a4b MM |
5748 | @cindex kernel and user registers (29k) |
5749 | Generate references to registers @code{gr64-gr95} instead of to | |
5750 | registers @code{gr96-gr127}. This option can be used when compiling | |
5751 | kernel code that wants a set of global registers disjoint from that used | |
5752 | by user-mode code. | |
5753 | ||
5754 | Note that when this option is used, register names in @samp{-f} flags | |
5755 | must use the normal, user-mode, names. | |
5756 | ||
5757 | @item -muser-registers | |
cd3bb277 | 5758 | @opindex muser-registers |
74291a4b MM |
5759 | Use the normal set of global registers, @code{gr96-gr127}. This is the |
5760 | default. | |
5761 | ||
5762 | @item -mstack-check | |
5763 | @itemx -mno-stack-check | |
cd3bb277 JM |
5764 | @opindex mstack-check |
5765 | @opindex mno-stack-check | |
74291a4b MM |
5766 | @cindex stack checks (29k) |
5767 | Insert (or do not insert) a call to @code{__msp_check} after each stack | |
5768 | adjustment. This is often used for kernel code. | |
5769 | ||
5770 | @item -mstorem-bug | |
5771 | @itemx -mno-storem-bug | |
cd3bb277 JM |
5772 | @opindex mstorem-bug |
5773 | @opindex mno-storem-bug | |
74291a4b | 5774 | @cindex storem bug (29k) |
630d3d5a | 5775 | @option{-mstorem-bug} handles 29k processors which cannot handle the |
74291a4b MM |
5776 | separation of a mtsrim insn and a storem instruction (most 29000 chips |
5777 | to date, but not the 29050). | |
5778 | ||
5779 | @item -mno-reuse-arg-regs | |
5780 | @itemx -mreuse-arg-regs | |
cd3bb277 JM |
5781 | @opindex mno-reuse-arg-regs |
5782 | @opindex mreuse-arg-regs | |
630d3d5a | 5783 | @option{-mno-reuse-arg-regs} tells the compiler to only use incoming argument |
74291a4b MM |
5784 | registers for copying out arguments. This helps detect calling a function |
5785 | with fewer arguments than it was declared with. | |
5786 | ||
861bb6c1 JL |
5787 | @item -mno-impure-text |
5788 | @itemx -mimpure-text | |
cd3bb277 JM |
5789 | @opindex mno-impure-text |
5790 | @opindex mimpure-text | |
630d3d5a JM |
5791 | @option{-mimpure-text}, used in addition to @option{-shared}, tells the compiler to |
5792 | not pass @option{-assert pure-text} to the linker when linking a shared object. | |
861bb6c1 | 5793 | |
74291a4b | 5794 | @item -msoft-float |
cd3bb277 | 5795 | @opindex msoft-float |
74291a4b | 5796 | Generate output containing library calls for floating point. |
161d7b59 | 5797 | @strong{Warning:} the requisite libraries are not part of GCC@. |
74291a4b MM |
5798 | Normally the facilities of the machine's usual C compiler are used, but |
5799 | this can't be done directly in cross-compilation. You must make your | |
5800 | own arrangements to provide suitable library functions for | |
5801 | cross-compilation. | |
4e8d7ddc JW |
5802 | |
5803 | @item -mno-multm | |
cd3bb277 | 5804 | @opindex mno-multm |
4e8d7ddc JW |
5805 | Do not generate multm or multmu instructions. This is useful for some embedded |
5806 | systems which do not have trap handlers for these instructions. | |
74291a4b MM |
5807 | @end table |
5808 | ||
5809 | @node ARM Options | |
5810 | @subsection ARM Options | |
5811 | @cindex ARM options | |
5812 | ||
5813 | These @samp{-m} options are defined for Advanced RISC Machines (ARM) | |
5814 | architectures: | |
5815 | ||
2642624b | 5816 | @table @gcctabopt |
74291a4b | 5817 | @item -mapcs-frame |
cd3bb277 | 5818 | @opindex mapcs-frame |
74291a4b MM |
5819 | Generate a stack frame that is compliant with the ARM Procedure Call |
5820 | Standard for all functions, even if this is not strictly necessary for | |
630d3d5a | 5821 | correct execution of the code. Specifying @option{-fomit-frame-pointer} |
157a620e | 5822 | with this option will cause the stack frames not to be generated for |
630d3d5a | 5823 | leaf functions. The default is @option{-mno-apcs-frame}. |
157a620e NC |
5824 | |
5825 | @item -mapcs | |
cd3bb277 | 5826 | @opindex mapcs |
630d3d5a | 5827 | This is a synonym for @option{-mapcs-frame}. |
74291a4b MM |
5828 | |
5829 | @item -mapcs-26 | |
cd3bb277 | 5830 | @opindex mapcs-26 |
74291a4b MM |
5831 | Generate code for a processor running with a 26-bit program counter, |
5832 | and conforming to the function calling standards for the APCS 26-bit | |
630d3d5a | 5833 | option. This option replaces the @option{-m2} and @option{-m3} options |
74291a4b MM |
5834 | of previous releases of the compiler. |
5835 | ||
5836 | @item -mapcs-32 | |
cd3bb277 | 5837 | @opindex mapcs-32 |
74291a4b MM |
5838 | Generate code for a processor running with a 32-bit program counter, |
5839 | and conforming to the function calling standards for the APCS 32-bit | |
630d3d5a | 5840 | option. This option replaces the @option{-m6} option of previous releases |
74291a4b MM |
5841 | of the compiler. |
5842 | ||
247f8561 PB |
5843 | @ignore |
5844 | @c not currently implemented | |
157a620e | 5845 | @item -mapcs-stack-check |
cd3bb277 | 5846 | @opindex mapcs-stack-check |
157a620e NC |
5847 | Generate code to check the amount of stack space available upon entry to |
5848 | every function (that actually uses some stack space). If there is | |
5849 | insufficient space available then either the function | |
5850 | @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be | |
5851 | called, depending upon the amount of stack space required. The run time | |
5852 | system is required to provide these functions. The default is | |
630d3d5a | 5853 | @option{-mno-apcs-stack-check}, since this produces smaller code. |
157a620e | 5854 | |
247f8561 | 5855 | @c not currently implemented |
157a620e | 5856 | @item -mapcs-float |
cd3bb277 | 5857 | @opindex mapcs-float |
157a620e | 5858 | Pass floating point arguments using the float point registers. This is |
161d7b59 | 5859 | one of the variants of the APCS@. This option is recommended if the |
157a620e NC |
5860 | target hardware has a floating point unit or if a lot of floating point |
5861 | arithmetic is going to be performed by the code. The default is | |
630d3d5a JM |
5862 | @option{-mno-apcs-float}, since integer only code is slightly increased in |
5863 | size if @option{-mapcs-float} is used. | |
157a620e | 5864 | |
247f8561 | 5865 | @c not currently implemented |
157a620e | 5866 | @item -mapcs-reentrant |
cd3bb277 | 5867 | @opindex mapcs-reentrant |
247f8561 | 5868 | Generate reentrant, position independent code. The default is |
630d3d5a | 5869 | @option{-mno-apcs-reentrant}. |
247f8561 | 5870 | @end ignore |
157a620e NC |
5871 | |
5872 | @item -mthumb-interwork | |
cd3bb277 | 5873 | @opindex mthumb-interwork |
247f8561 | 5874 | Generate code which supports calling between the ARM and Thumb |
157a620e NC |
5875 | instruction sets. Without this option the two instruction sets cannot |
5876 | be reliably used inside one program. The default is | |
630d3d5a JM |
5877 | @option{-mno-thumb-interwork}, since slightly larger code is generated |
5878 | when @option{-mthumb-interwork} is specified. | |
157a620e NC |
5879 | |
5880 | @item -mno-sched-prolog | |
cd3bb277 | 5881 | @opindex mno-sched-prolog |
157a620e NC |
5882 | Prevent the reordering of instructions in the function prolog, or the |
5883 | merging of those instruction with the instructions in the function's | |
ed0e6530 PB |
5884 | body. This means that all functions will start with a recognizable set |
5885 | of instructions (or in fact one of a choice from a small set of | |
157a620e NC |
5886 | different function prologues), and this information can be used to |
5887 | locate the start if functions inside an executable piece of code. The | |
630d3d5a | 5888 | default is @option{-msched-prolog}. |
157a620e | 5889 | |
74291a4b | 5890 | @item -mhard-float |
cd3bb277 | 5891 | @opindex mhard-float |
74291a4b MM |
5892 | Generate output containing floating point instructions. This is the |
5893 | default. | |
5894 | ||
5895 | @item -msoft-float | |
cd3bb277 | 5896 | @opindex msoft-float |
74291a4b MM |
5897 | Generate output containing library calls for floating point. |
5898 | @strong{Warning:} the requisite libraries are not available for all ARM | |
5899 | targets. Normally the facilities of the machine's usual C compiler are | |
5900 | used, but this cannot be done directly in cross-compilation. You must make | |
5901 | your own arrangements to provide suitable library functions for | |
5902 | cross-compilation. | |
5903 | ||
630d3d5a | 5904 | @option{-msoft-float} changes the calling convention in the output file; |
74291a4b MM |
5905 | therefore, it is only useful if you compile @emph{all} of a program with |
5906 | this option. In particular, you need to compile @file{libgcc.a}, the | |
630d3d5a | 5907 | library that comes with GCC, with @option{-msoft-float} in order for |
74291a4b MM |
5908 | this to work. |
5909 | ||
5910 | @item -mlittle-endian | |
cd3bb277 | 5911 | @opindex mlittle-endian |
74291a4b MM |
5912 | Generate code for a processor running in little-endian mode. This is |
5913 | the default for all standard configurations. | |
5914 | ||
5915 | @item -mbig-endian | |
cd3bb277 | 5916 | @opindex mbig-endian |
74291a4b MM |
5917 | Generate code for a processor running in big-endian mode; the default is |
5918 | to compile code for a little-endian processor. | |
5919 | ||
5920 | @item -mwords-little-endian | |
cd3bb277 | 5921 | @opindex mwords-little-endian |
74291a4b MM |
5922 | This option only applies when generating code for big-endian processors. |
5923 | Generate code for a little-endian word order but a big-endian byte | |
5924 | order. That is, a byte order of the form @samp{32107654}. Note: this | |
5925 | option should only be used if you require compatibility with code for | |
5926 | big-endian ARM processors generated by versions of the compiler prior to | |
5927 | 2.8. | |
5928 | ||
5f1e6755 | 5929 | @item -malignment-traps |
cd3bb277 | 5930 | @opindex malignment-traps |
5f1e6755 NC |
5931 | Generate code that will not trap if the MMU has alignment traps enabled. |
5932 | On ARM architectures prior to ARMv4, there were no instructions to | |
5933 | access half-word objects stored in memory. However, when reading from | |
5934 | memory a feature of the ARM architecture allows a word load to be used, | |
5935 | even if the address is unaligned, and the processor core will rotate the | |
5936 | data as it is being loaded. This option tells the compiler that such | |
5937 | misaligned accesses will cause a MMU trap and that it should instead | |
5938 | synthesise the access as a series of byte accesses. The compiler can | |
5939 | still use word accesses to load half-word data if it knows that the | |
5940 | address is aligned to a word boundary. | |
5941 | ||
5942 | This option is ignored when compiling for ARM architecture 4 or later, | |
5943 | since these processors have instructions to directly access half-word | |
02f52e19 AJ |
5944 | objects in memory. |
5945 | ||
5f1e6755 | 5946 | @item -mno-alignment-traps |
cd3bb277 | 5947 | @opindex mno-alignment-traps |
5f1e6755 NC |
5948 | Generate code that assumes that the MMU will not trap unaligned |
5949 | accesses. This produces better code when the target instruction set | |
e979f9e8 | 5950 | does not have half-word memory operations (i.e.@: implementations prior to |
02f52e19 | 5951 | ARMv4). |
5f1e6755 NC |
5952 | |
5953 | Note that you cannot use this option to access unaligned word objects, | |
5954 | since the processor will only fetch one 32-bit aligned object from | |
02f52e19 | 5955 | memory. |
5f1e6755 | 5956 | |
695ac33f | 5957 | The default setting for most targets is @option{-mno-alignment-traps}, since |
5f1e6755 | 5958 | this produces better code when there are no half-word memory |
02f52e19 | 5959 | instructions available. |
5f1e6755 | 5960 | |
74291a4b | 5961 | @item -mshort-load-bytes |
247f8561 | 5962 | @itemx -mno-short-load-words |
cd3bb277 JM |
5963 | @opindex mshort-load-bytes |
5964 | @opindex mno-short-load-words | |
630d3d5a | 5965 | These are deprecated aliases for @option{-malignment-traps}. |
74291a4b MM |
5966 | |
5967 | @item -mno-short-load-bytes | |
247f8561 | 5968 | @itemx -mshort-load-words |
cd3bb277 JM |
5969 | @opindex mno-short-load-bytes |
5970 | @opindex mshort-load-words | |
630d3d5a | 5971 | This are deprecated aliases for @option{-mno-alignment-traps}. |
157a620e | 5972 | |
74291a4b | 5973 | @item -mbsd |
cd3bb277 | 5974 | @opindex mbsd |
161d7b59 | 5975 | This option only applies to RISC iX@. Emulate the native BSD-mode |
630d3d5a | 5976 | compiler. This is the default if @option{-ansi} is not specified. |
74291a4b MM |
5977 | |
5978 | @item -mxopen | |
cd3bb277 | 5979 | @opindex mxopen |
161d7b59 | 5980 | This option only applies to RISC iX@. Emulate the native X/Open-mode |
74291a4b MM |
5981 | compiler. |
5982 | ||
5983 | @item -mno-symrename | |
cd3bb277 | 5984 | @opindex mno-symrename |
161d7b59 | 5985 | This option only applies to RISC iX@. Do not run the assembler |
74291a4b MM |
5986 | post-processor, @samp{symrename}, after code has been assembled. |
5987 | Normally it is necessary to modify some of the standard symbols in | |
5988 | preparation for linking with the RISC iX C library; this option | |
5989 | suppresses this pass. The post-processor is never run when the | |
5990 | compiler is built for cross-compilation. | |
157a620e | 5991 | |
cd3bb277 JM |
5992 | @item -mcpu=@var{name} |
5993 | @opindex mcpu | |
157a620e | 5994 | This specifies the name of the target ARM processor. GCC uses this name |
247f8561 | 5995 | to determine what kind of instructions it can emit when generating |
aee96fe9 JM |
5996 | assembly code. Permissible names are: @samp{arm2}, @samp{arm250}, |
5997 | @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, | |
5998 | @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, | |
5999 | @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, | |
6000 | @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, | |
6001 | @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8}, | |
6002 | @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, | |
6003 | @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, | |
6004 | @samp{arm920t}, @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, | |
6005 | @samp{arm1020t}, @samp{xscale}. | |
62b10bbc | 6006 | |
cd3bb277 JM |
6007 | @itemx -mtune=@var{name} |
6008 | @opindex mtune | |
630d3d5a | 6009 | This option is very similar to the @option{-mcpu=} option, except that |
62b10bbc NC |
6010 | instead of specifying the actual target processor type, and hence |
6011 | restricting which instructions can be used, it specifies that GCC should | |
6012 | tune the performance of the code as if the target were of the type | |
6013 | specified in this option, but still choosing the instructions that it | |
630d3d5a | 6014 | will generate based on the cpu specified by a @option{-mcpu=} option. |
247f8561 | 6015 | For some ARM implementations better performance can be obtained by using |
62b10bbc | 6016 | this option. |
157a620e | 6017 | |
cd3bb277 JM |
6018 | @item -march=@var{name} |
6019 | @opindex march | |
157a620e | 6020 | This specifies the name of the target ARM architecture. GCC uses this |
247f8561 | 6021 | name to determine what kind of instructions it can emit when generating |
157a620e | 6022 | assembly code. This option can be used in conjunction with or instead |
aee96fe9 JM |
6023 | of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, |
6024 | @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, | |
6025 | @samp{armv5}, @samp{armv5t}, @samp{armv5te}. | |
157a620e | 6026 | |
cd3bb277 JM |
6027 | @item -mfpe=@var{number} |
6028 | @itemx -mfp=@var{number} | |
6029 | @opindex mfpe | |
6030 | @opindex mfp | |
b192711e | 6031 | This specifies the version of the floating point emulation available on |
630d3d5a | 6032 | the target. Permissible values are 2 and 3. @option{-mfp=} is a synonym |
161d7b59 | 6033 | for @option{-mfpe=}, for compatibility with older versions of GCC@. |
157a620e | 6034 | |
cd3bb277 JM |
6035 | @item -mstructure-size-boundary=@var{n} |
6036 | @opindex mstructure-size-boundary | |
157a620e | 6037 | The size of all structures and unions will be rounded up to a multiple |
ed0e6530 | 6038 | of the number of bits set by this option. Permissible values are 8 and |
157a620e NC |
6039 | 32. The default value varies for different toolchains. For the COFF |
6040 | targeted toolchain the default value is 8. Specifying the larger number | |
ed0e6530 | 6041 | can produce faster, more efficient code, but can also increase the size |
157a620e NC |
6042 | of the program. The two values are potentially incompatible. Code |
6043 | compiled with one value cannot necessarily expect to work with code or | |
6044 | libraries compiled with the other value, if they exchange information | |
247f8561 | 6045 | using structures or unions. |
157a620e | 6046 | |
f5a1b0d2 | 6047 | @item -mabort-on-noreturn |
cd3bb277 | 6048 | @opindex mabort-on-noreturn |
247f8561 PB |
6049 | Generate a call to the function @code{abort} at the end of a |
6050 | @code{noreturn} function. It will be executed if the function tries to | |
6051 | return. | |
f5a1b0d2 | 6052 | |
c27ba912 DM |
6053 | @item -mlong-calls |
6054 | @itemx -mno-long-calls | |
cd3bb277 JM |
6055 | @opindex mlong-calls |
6056 | @opindex mno-long-calls | |
c27ba912 DM |
6057 | Tells the compiler to perform function calls by first loading the |
6058 | address of the function into a register and then performing a subroutine | |
6059 | call on this register. This switch is needed if the target function | |
6060 | will lie outside of the 64 megabyte addressing range of the offset based | |
02f52e19 | 6061 | version of subroutine call instruction. |
c27ba912 DM |
6062 | |
6063 | Even if this switch is enabled, not all function calls will be turned | |
6064 | into long calls. The heuristic is that static functions, functions | |
6065 | which have the @samp{short-call} attribute, functions that are inside | |
6066 | the scope of a @samp{#pragma no_long_calls} directive and functions whose | |
6067 | definitions have already been compiled within the current compilation | |
6068 | unit, will not be turned into long calls. The exception to this rule is | |
b192711e | 6069 | that weak function definitions, functions with the @samp{long-call} |
c27ba912 DM |
6070 | attribute or the @samp{section} attribute, and functions that are within |
6071 | the scope of a @samp{#pragma long_calls} directive, will always be | |
6072 | turned into long calls. | |
6073 | ||
6074 | This feature is not enabled by default. Specifying | |
c21cd8b1 | 6075 | @option{-mno-long-calls} will restore the default behavior, as will |
c27ba912 DM |
6076 | placing the function calls within the scope of a @samp{#pragma |
6077 | long_calls_off} directive. Note these switches have no effect on how | |
6078 | the compiler generates code to handle function calls via function | |
02f52e19 | 6079 | pointers. |
c27ba912 | 6080 | |
62b10bbc | 6081 | @item -mnop-fun-dllimport |
cd3bb277 | 6082 | @opindex mnop-fun-dllimport |
aee96fe9 | 6083 | Disable support for the @code{dllimport} attribute. |
62b10bbc | 6084 | |
ed0e6530 | 6085 | @item -msingle-pic-base |
cd3bb277 | 6086 | @opindex msingle-pic-base |
ed0e6530 PB |
6087 | Treat the register used for PIC addressing as read-only, rather than |
6088 | loading it in the prologue for each function. The run-time system is | |
c21cd8b1 | 6089 | responsible for initializing this register with an appropriate value |
ed0e6530 PB |
6090 | before execution begins. |
6091 | ||
cd3bb277 JM |
6092 | @item -mpic-register=@var{reg} |
6093 | @opindex mpic-register | |
ed0e6530 PB |
6094 | Specify the register to be used for PIC addressing. The default is R10 |
6095 | unless stack-checking is enabled, when R9 is used. | |
6096 | ||
247f8561 | 6097 | @item -mpoke-function-name |
cd3bb277 | 6098 | @opindex mpoke-function-name |
247f8561 PB |
6099 | Write the name of each function into the text section, directly |
6100 | preceding the function prologue. The generated code is similar to this: | |
74291a4b | 6101 | |
247f8561 PB |
6102 | @smallexample |
6103 | t0 | |
6104 | .ascii "arm_poke_function_name", 0 | |
6105 | .align | |
6106 | t1 | |
6107 | .word 0xff000000 + (t1 - t0) | |
6108 | arm_poke_function_name | |
6109 | mov ip, sp | |
6110 | stmfd sp!, @{fp, ip, lr, pc@} | |
6111 | sub fp, ip, #4 | |
6112 | @end smallexample | |
157a620e | 6113 | |
247f8561 PB |
6114 | When performing a stack backtrace, code can inspect the value of |
6115 | @code{pc} stored at @code{fp + 0}. If the trace function then looks at | |
6116 | location @code{pc - 12} and the top 8 bits are set, then we know that | |
6117 | there is a function name embedded immediately preceding this location | |
6118 | and has length @code{((pc[-3]) & 0xff000000)}. | |
157a620e | 6119 | |
247f8561 | 6120 | @item -mthumb |
cd3bb277 | 6121 | @opindex mthumb |
247f8561 PB |
6122 | Generate code for the 16-bit Thumb instruction set. The default is to |
6123 | use the 32-bit ARM instruction set. | |
157a620e NC |
6124 | |
6125 | @item -mtpcs-frame | |
cd3bb277 | 6126 | @opindex mtpcs-frame |
157a620e NC |
6127 | Generate a stack frame that is compliant with the Thumb Procedure Call |
6128 | Standard for all non-leaf functions. (A leaf function is one that does | |
630d3d5a | 6129 | not call any other functions.) The default is @option{-mno-tpcs-frame}. |
157a620e NC |
6130 | |
6131 | @item -mtpcs-leaf-frame | |
cd3bb277 | 6132 | @opindex mtpcs-leaf-frame |
157a620e NC |
6133 | Generate a stack frame that is compliant with the Thumb Procedure Call |
6134 | Standard for all leaf functions. (A leaf function is one that does | |
630d3d5a | 6135 | not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. |
62b10bbc NC |
6136 | |
6137 | @item -mcallee-super-interworking | |
cd3bb277 | 6138 | @opindex mcallee-super-interworking |
62b10bbc NC |
6139 | Gives all externally visible functions in the file being compiled an ARM |
6140 | instruction set header which switches to Thumb mode before executing the | |
6141 | rest of the function. This allows these functions to be called from | |
6142 | non-interworking code. | |
6143 | ||
6144 | @item -mcaller-super-interworking | |
cd3bb277 | 6145 | @opindex mcaller-super-interworking |
62b10bbc NC |
6146 | Allows calls via function pointers (including virtual functions) to |
6147 | execute correctly regardless of whether the target code has been | |
6148 | compiled for interworking or not. There is a small overhead in the cost | |
4bdc1ac7 PB |
6149 | of executing a function pointer if this option is enabled. |
6150 | ||
157a620e NC |
6151 | @end table |
6152 | ||
ecff22ab JL |
6153 | @node MN10200 Options |
6154 | @subsection MN10200 Options | |
6155 | @cindex MN10200 options | |
630d3d5a | 6156 | These @option{-m} options are defined for Matsushita MN10200 architectures: |
2642624b | 6157 | @table @gcctabopt |
ecff22ab JL |
6158 | |
6159 | @item -mrelax | |
cd3bb277 | 6160 | @opindex mrelax |
ecff22ab JL |
6161 | Indicate to the linker that it should perform a relaxation optimization pass |
6162 | to shorten branches, calls and absolute memory addresses. This option only | |
6163 | has an effect when used on the command line for the final link step. | |
6164 | ||
02f52e19 | 6165 | This option makes symbolic debugging impossible. |
ecff22ab | 6166 | @end table |
157a620e | 6167 | |
6d6d0fa0 JL |
6168 | @node MN10300 Options |
6169 | @subsection MN10300 Options | |
6170 | @cindex MN10300 options | |
630d3d5a | 6171 | These @option{-m} options are defined for Matsushita MN10300 architectures: |
6d6d0fa0 | 6172 | |
2642624b | 6173 | @table @gcctabopt |
6d6d0fa0 | 6174 | @item -mmult-bug |
cd3bb277 | 6175 | @opindex mmult-bug |
6d6d0fa0 JL |
6176 | Generate code to avoid bugs in the multiply instructions for the MN10300 |
6177 | processors. This is the default. | |
6178 | ||
6179 | @item -mno-mult-bug | |
cd3bb277 | 6180 | @opindex mno-mult-bug |
6d6d0fa0 JL |
6181 | Do not generate code to avoid bugs in the multiply instructions for the |
6182 | MN10300 processors. | |
ecff22ab | 6183 | |
705ac34f | 6184 | @item -mam33 |
cd3bb277 | 6185 | @opindex mam33 |
705ac34f JL |
6186 | Generate code which uses features specific to the AM33 processor. |
6187 | ||
6188 | @item -mno-am33 | |
cd3bb277 | 6189 | @opindex mno-am33 |
705ac34f JL |
6190 | Do not generate code which uses features specific to the AM33 processor. This |
6191 | is the default. | |
6192 | ||
c474f76b AO |
6193 | @item -mno-crt0 |
6194 | @opindex mno-crt0 | |
6195 | Do not link in the C run-time initialization object file. | |
6196 | ||
ecff22ab | 6197 | @item -mrelax |
cd3bb277 | 6198 | @opindex mrelax |
ecff22ab JL |
6199 | Indicate to the linker that it should perform a relaxation optimization pass |
6200 | to shorten branches, calls and absolute memory addresses. This option only | |
6201 | has an effect when used on the command line for the final link step. | |
6202 | ||
02f52e19 | 6203 | This option makes symbolic debugging impossible. |
6d6d0fa0 JL |
6204 | @end table |
6205 | ||
ecff22ab | 6206 | |
861bb6c1 JL |
6207 | @node M32R/D Options |
6208 | @subsection M32R/D Options | |
6209 | @cindex M32R/D options | |
6210 | ||
630d3d5a | 6211 | These @option{-m} options are defined for Mitsubishi M32R/D architectures: |
861bb6c1 | 6212 | |
2642624b | 6213 | @table @gcctabopt |
98180123 NC |
6214 | @item -m32rx |
6215 | @opindex m32rx | |
0bf93a51 | 6216 | Generate code for the M32R/X@. |
98180123 NC |
6217 | |
6218 | @item -m32r | |
6219 | @opindex m32r | |
0bf93a51 | 6220 | Generate code for the M32R@. This is the default. |
de41e41c | 6221 | |
861bb6c1 | 6222 | @item -mcode-model=small |
cd3bb277 | 6223 | @opindex mcode-model=small |
861bb6c1 JL |
6224 | Assume all objects live in the lower 16MB of memory (so that their addresses |
6225 | can be loaded with the @code{ld24} instruction), and assume all subroutines | |
6226 | are reachable with the @code{bl} instruction. | |
6227 | This is the default. | |
6228 | ||
6229 | The addressability of a particular object can be set with the | |
6230 | @code{model} attribute. | |
6231 | ||
6232 | @item -mcode-model=medium | |
cd3bb277 | 6233 | @opindex mcode-model=medium |
02f52e19 | 6234 | Assume objects may be anywhere in the 32-bit address space (the compiler |
861bb6c1 JL |
6235 | will generate @code{seth/add3} instructions to load their addresses), and |
6236 | assume all subroutines are reachable with the @code{bl} instruction. | |
6237 | ||
6238 | @item -mcode-model=large | |
cd3bb277 | 6239 | @opindex mcode-model=large |
02f52e19 | 6240 | Assume objects may be anywhere in the 32-bit address space (the compiler |
861bb6c1 JL |
6241 | will generate @code{seth/add3} instructions to load their addresses), and |
6242 | assume subroutines may not be reachable with the @code{bl} instruction | |
6243 | (the compiler will generate the much slower @code{seth/add3/jl} | |
6244 | instruction sequence). | |
6245 | ||
6246 | @item -msdata=none | |
cd3bb277 | 6247 | @opindex msdata=none |
861bb6c1 JL |
6248 | Disable use of the small data area. Variables will be put into |
6249 | one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the | |
6250 | @code{section} attribute has been specified). | |
6251 | This is the default. | |
6252 | ||
6253 | The small data area consists of sections @samp{.sdata} and @samp{.sbss}. | |
6254 | Objects may be explicitly put in the small data area with the | |
6255 | @code{section} attribute using one of these sections. | |
6256 | ||
6257 | @item -msdata=sdata | |
cd3bb277 | 6258 | @opindex msdata=sdata |
861bb6c1 JL |
6259 | Put small global and static data in the small data area, but do not |
6260 | generate special code to reference them. | |
6261 | ||
6262 | @item -msdata=use | |
cd3bb277 | 6263 | @opindex msdata=use |
861bb6c1 JL |
6264 | Put small global and static data in the small data area, and generate |
6265 | special instructions to reference them. | |
6266 | ||
6267 | @item -G @var{num} | |
cd3bb277 | 6268 | @opindex G |
861bb6c1 JL |
6269 | @cindex smaller data references |
6270 | Put global and static objects less than or equal to @var{num} bytes | |
6271 | into the small data or bss sections instead of the normal data or bss | |
6272 | sections. The default value of @var{num} is 8. | |
630d3d5a | 6273 | The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} |
861bb6c1 JL |
6274 | for this option to have any effect. |
6275 | ||
630d3d5a | 6276 | All modules should be compiled with the same @option{-G @var{num}} value. |
861bb6c1 | 6277 | Compiling with different values of @var{num} may or may not work; if it |
695ac33f | 6278 | doesn't the linker will give an error message---incorrect code will not be |
861bb6c1 JL |
6279 | generated. |
6280 | ||
6281 | @end table | |
6282 | ||
74291a4b MM |
6283 | @node M88K Options |
6284 | @subsection M88K Options | |
6285 | @cindex M88k options | |
6286 | ||
6287 | These @samp{-m} options are defined for Motorola 88k architectures: | |
6288 | ||
2642624b | 6289 | @table @gcctabopt |
74291a4b | 6290 | @item -m88000 |
cd3bb277 | 6291 | @opindex m88000 |
74291a4b MM |
6292 | Generate code that works well on both the m88100 and the |
6293 | m88110. | |
6294 | ||
6295 | @item -m88100 | |
cd3bb277 | 6296 | @opindex m88100 |
74291a4b MM |
6297 | Generate code that works best for the m88100, but that also |
6298 | runs on the m88110. | |
6299 | ||
6300 | @item -m88110 | |
cd3bb277 | 6301 | @opindex m88110 |
74291a4b MM |
6302 | Generate code that works best for the m88110, and may not run |
6303 | on the m88100. | |
6304 | ||
6305 | @item -mbig-pic | |
cd3bb277 | 6306 | @opindex mbig-pic |
74291a4b | 6307 | Obsolete option to be removed from the next revision. |
630d3d5a | 6308 | Use @option{-fPIC}. |
74291a4b MM |
6309 | |
6310 | @item -midentify-revision | |
cd3bb277 | 6311 | @opindex midentify-revision |
74291a4b MM |
6312 | @cindex identifying source, compiler (88k) |
6313 | Include an @code{ident} directive in the assembler output recording the | |
6314 | source file name, compiler name and version, timestamp, and compilation | |
6315 | flags used. | |
6316 | ||
6317 | @item -mno-underscores | |
cd3bb277 | 6318 | @opindex mno-underscores |
74291a4b MM |
6319 | @cindex underscores, avoiding (88k) |
6320 | In assembler output, emit symbol names without adding an underscore | |
6321 | character at the beginning of each name. The default is to use an | |
6322 | underscore as prefix on each name. | |
6323 | ||
6324 | @item -mocs-debug-info | |
6325 | @itemx -mno-ocs-debug-info | |
cd3bb277 JM |
6326 | @opindex mocs-debug-info |
6327 | @opindex mno-ocs-debug-info | |
74291a4b MM |
6328 | @cindex OCS (88k) |
6329 | @cindex debugging, 88k OCS | |
6330 | Include (or omit) additional debugging information (about registers used | |
6331 | in each stack frame) as specified in the 88open Object Compatibility | |
161d7b59 | 6332 | Standard, ``OCS''@. This extra information allows debugging of code that |
74291a4b MM |
6333 | has had the frame pointer eliminated. The default for DG/UX, SVr4, and |
6334 | Delta 88 SVr3.2 is to include this information; other 88k configurations | |
6335 | omit this information by default. | |
6336 | ||
6337 | @item -mocs-frame-position | |
cd3bb277 | 6338 | @opindex mocs-frame-position |
74291a4b MM |
6339 | @cindex register positions in frame (88k) |
6340 | When emitting COFF debugging information for automatic variables and | |
6341 | parameters stored on the stack, use the offset from the canonical frame | |
6342 | address, which is the stack pointer (register 31) on entry to the | |
6343 | function. The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use | |
630d3d5a JM |
6344 | @option{-mocs-frame-position}; other 88k configurations have the default |
6345 | @option{-mno-ocs-frame-position}. | |
74291a4b MM |
6346 | |
6347 | @item -mno-ocs-frame-position | |
cd3bb277 | 6348 | @opindex mno-ocs-frame-position |
74291a4b MM |
6349 | @cindex register positions in frame (88k) |
6350 | When emitting COFF debugging information for automatic variables and | |
6351 | parameters stored on the stack, use the offset from the frame pointer | |
6352 | register (register 30). When this option is in effect, the frame | |
6353 | pointer is not eliminated when debugging information is selected by the | |
6354 | -g switch. | |
6355 | ||
6356 | @item -moptimize-arg-area | |
cd3bb277 | 6357 | @opindex moptimize-arg-area |
74291a4b | 6358 | @cindex arguments in frame (88k) |
9c34dbbf ZW |
6359 | Save space by reorganizing the stack frame. This option generates code |
6360 | that does not agree with the 88open specifications, but uses less | |
6361 | memory. | |
6362 | ||
6363 | @itemx -mno-optimize-arg-area | |
6364 | @opindex mno-optimize-arg-area | |
6365 | Do not reorganize the stack frame to save space. This is the default. | |
6366 | The generated conforms to the specification, but uses more memory. | |
74291a4b MM |
6367 | |
6368 | @item -mshort-data-@var{num} | |
cd3bb277 | 6369 | @opindex mshort-data |
74291a4b MM |
6370 | @cindex smaller data references (88k) |
6371 | @cindex r0-relative references (88k) | |
6372 | Generate smaller data references by making them relative to @code{r0}, | |
6373 | which allows loading a value using a single instruction (rather than the | |
6374 | usual two). You control which data references are affected by | |
6375 | specifying @var{num} with this option. For example, if you specify | |
630d3d5a | 6376 | @option{-mshort-data-512}, then the data references affected are those |
74291a4b | 6377 | involving displacements of less than 512 bytes. |
630d3d5a | 6378 | @option{-mshort-data-@var{num}} is not effective for @var{num} greater |
74291a4b MM |
6379 | than 64k. |
6380 | ||
6381 | @item -mserialize-volatile | |
cd3bb277 | 6382 | @opindex mserialize-volatile |
74291a4b | 6383 | @itemx -mno-serialize-volatile |
cd3bb277 | 6384 | @opindex mno-serialize-volatile |
74291a4b MM |
6385 | @cindex sequential consistency on 88k |
6386 | Do, or don't, generate code to guarantee sequential consistency | |
6387 | of volatile memory references. By default, consistency is | |
6388 | guaranteed. | |
6389 | ||
6390 | The order of memory references made by the MC88110 processor does | |
6391 | not always match the order of the instructions requesting those | |
6392 | references. In particular, a load instruction may execute before | |
6393 | a preceding store instruction. Such reordering violates | |
6394 | sequential consistency of volatile memory references, when there | |
6395 | are multiple processors. When consistency must be guaranteed, | |
f0523f02 | 6396 | GCC generates special instructions, as needed, to force |
74291a4b MM |
6397 | execution in the proper order. |
6398 | ||
6399 | The MC88100 processor does not reorder memory references and so | |
f0523f02 JM |
6400 | always provides sequential consistency. However, by default, GCC |
6401 | generates the special instructions to guarantee consistency | |
630d3d5a | 6402 | even when you use @option{-m88100}, so that the code may be run on an |
74291a4b | 6403 | MC88110 processor. If you intend to run your code only on the |
630d3d5a | 6404 | MC88100 processor, you may use @option{-mno-serialize-volatile}. |
74291a4b MM |
6405 | |
6406 | The extra code generated to guarantee consistency may affect the | |
6407 | performance of your application. If you know that you can safely | |
630d3d5a | 6408 | forgo this guarantee, you may use @option{-mno-serialize-volatile}. |
74291a4b MM |
6409 | |
6410 | @item -msvr4 | |
6411 | @itemx -msvr3 | |
cd3bb277 JM |
6412 | @opindex msvr4 |
6413 | @opindex msvr3 | |
74291a4b MM |
6414 | @cindex assembler syntax, 88k |
6415 | @cindex SVr4 | |
630d3d5a | 6416 | Turn on (@option{-msvr4}) or off (@option{-msvr3}) compiler extensions |
74291a4b MM |
6417 | related to System V release 4 (SVr4). This controls the following: |
6418 | ||
6419 | @enumerate | |
6420 | @item | |
6421 | Which variant of the assembler syntax to emit. | |
6422 | @item | |
630d3d5a | 6423 | @option{-msvr4} makes the C preprocessor recognize @samp{#pragma weak} |
74291a4b MM |
6424 | that is used on System V release 4. |
6425 | @item | |
630d3d5a | 6426 | @option{-msvr4} makes GCC issue additional declaration directives used in |
74291a4b MM |
6427 | SVr4. |
6428 | @end enumerate | |
6429 | ||
630d3d5a | 6430 | @option{-msvr4} is the default for the m88k-motorola-sysv4 and |
767094dd | 6431 | m88k-dg-dgux m88k configurations. @option{-msvr3} is the default for all |
74291a4b MM |
6432 | other m88k configurations. |
6433 | ||
6434 | @item -mversion-03.00 | |
cd3bb277 | 6435 | @opindex mversion-03.00 |
74291a4b MM |
6436 | This option is obsolete, and is ignored. |
6437 | @c ??? which asm syntax better for GAS? option there too? | |
6438 | ||
6439 | @item -mno-check-zero-division | |
6440 | @itemx -mcheck-zero-division | |
cd3bb277 JM |
6441 | @opindex mno-check-zero-division |
6442 | @opindex mcheck-zero-division | |
74291a4b MM |
6443 | @cindex zero division on 88k |
6444 | Do, or don't, generate code to guarantee that integer division by | |
6445 | zero will be detected. By default, detection is guaranteed. | |
6446 | ||
6447 | Some models of the MC88100 processor fail to trap upon integer | |
6448 | division by zero under certain conditions. By default, when | |
f0523f02 | 6449 | compiling code that might be run on such a processor, GCC |
74291a4b MM |
6450 | generates code that explicitly checks for zero-valued divisors |
6451 | and traps with exception number 503 when one is detected. Use of | |
9c34dbbf | 6452 | @option{-mno-check-zero-division} suppresses such checking for code |
74291a4b MM |
6453 | generated to run on an MC88100 processor. |
6454 | ||
9c34dbbf ZW |
6455 | GCC assumes that the MC88110 processor correctly detects all instances |
6456 | of integer division by zero. When @option{-m88110} is specified, no | |
6457 | explicit checks for zero-valued divisors are generated, and both | |
6458 | @option{-mcheck-zero-division} and @option{-mno-check-zero-division} are | |
6459 | ignored. | |
74291a4b MM |
6460 | |
6461 | @item -muse-div-instruction | |
cd3bb277 | 6462 | @opindex muse-div-instruction |
74291a4b MM |
6463 | @cindex divide instruction, 88k |
6464 | Use the div instruction for signed integer division on the | |
6465 | MC88100 processor. By default, the div instruction is not used. | |
6466 | ||
6467 | On the MC88100 processor the signed integer division instruction | |
6468 | div) traps to the operating system on a negative operand. The | |
6469 | operating system transparently completes the operation, but at a | |
6470 | large cost in execution time. By default, when compiling code | |
f0523f02 | 6471 | that might be run on an MC88100 processor, GCC emulates signed |
74291a4b MM |
6472 | integer division using the unsigned integer division instruction |
6473 | divu), thereby avoiding the large penalty of a trap to the | |
6474 | operating system. Such emulation has its own, smaller, execution | |
6475 | cost in both time and space. To the extent that your code's | |
6476 | important signed integer division operations are performed on two | |
6477 | nonnegative operands, it may be desirable to use the div | |
6478 | instruction directly. | |
6479 | ||
6480 | On the MC88110 processor the div instruction (also known as the | |
6481 | divs instruction) processes negative operands without trapping to | |
630d3d5a JM |
6482 | the operating system. When @option{-m88110} is specified, |
6483 | @option{-muse-div-instruction} is ignored, and the div instruction is used | |
74291a4b MM |
6484 | for signed integer division. |
6485 | ||
630d3d5a | 6486 | Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined. In |
74291a4b | 6487 | particular, the behavior of such a division with and without |
630d3d5a | 6488 | @option{-muse-div-instruction} may differ. |
74291a4b MM |
6489 | |
6490 | @item -mtrap-large-shift | |
6491 | @itemx -mhandle-large-shift | |
cd3bb277 JM |
6492 | @opindex mtrap-large-shift |
6493 | @opindex mhandle-large-shift | |
74291a4b MM |
6494 | @cindex bit shift overflow (88k) |
6495 | @cindex large bit shifts (88k) | |
6496 | Include code to detect bit-shifts of more than 31 bits; respectively, | |
0c2d1a2a | 6497 | trap such shifts or emit code to handle them properly. By default GCC |
74291a4b MM |
6498 | makes no special provision for large bit shifts. |
6499 | ||
6500 | @item -mwarn-passed-structs | |
cd3bb277 | 6501 | @opindex mwarn-passed-structs |
74291a4b MM |
6502 | @cindex structure passing (88k) |
6503 | Warn when a function passes a struct as an argument or result. | |
6504 | Structure-passing conventions have changed during the evolution of the C | |
6505 | language, and are often the source of portability problems. By default, | |
0c2d1a2a | 6506 | GCC issues no such warning. |
74291a4b MM |
6507 | @end table |
6508 | ||
9c34dbbf ZW |
6509 | @c break page here to avoid unsightly interparagraph stretch. |
6510 | @c -zw, 2001-8-17 | |
6511 | @page | |
6512 | ||
74291a4b MM |
6513 | @node RS/6000 and PowerPC Options |
6514 | @subsection IBM RS/6000 and PowerPC Options | |
6515 | @cindex RS/6000 and PowerPC Options | |
6516 | @cindex IBM RS/6000 and PowerPC Options | |
6517 | ||
6518 | These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: | |
2642624b | 6519 | @table @gcctabopt |
74291a4b MM |
6520 | @item -mpower |
6521 | @itemx -mno-power | |
6522 | @itemx -mpower2 | |
6523 | @itemx -mno-power2 | |
6524 | @itemx -mpowerpc | |
6525 | @itemx -mno-powerpc | |
6526 | @itemx -mpowerpc-gpopt | |
6527 | @itemx -mno-powerpc-gpopt | |
6528 | @itemx -mpowerpc-gfxopt | |
6529 | @itemx -mno-powerpc-gfxopt | |
7fe90e7b DE |
6530 | @itemx -mpowerpc64 |
6531 | @itemx -mno-powerpc64 | |
cd3bb277 JM |
6532 | @opindex mpower |
6533 | @opindex mno-power | |
6534 | @opindex mpower2 | |
6535 | @opindex mno-power2 | |
6536 | @opindex mpowerpc | |
6537 | @opindex mno-powerpc | |
6538 | @opindex mpowerpc-gpopt | |
6539 | @opindex mno-powerpc-gpopt | |
6540 | @opindex mpowerpc-gfxopt | |
6541 | @opindex mno-powerpc-gfxopt | |
6542 | @opindex mpowerpc64 | |
6543 | @opindex mno-powerpc64 | |
0c2d1a2a | 6544 | GCC supports two related instruction set architectures for the |
161d7b59 | 6545 | RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those |
74291a4b MM |
6546 | instructions supported by the @samp{rios} chip set used in the original |
6547 | RS/6000 systems and the @dfn{PowerPC} instruction set is the | |
6548 | architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and | |
861bb6c1 | 6549 | the IBM 4xx microprocessors. |
74291a4b MM |
6550 | |
6551 | Neither architecture is a subset of the other. However there is a | |
6552 | large common subset of instructions supported by both. An MQ | |
6553 | register is included in processors supporting the POWER architecture. | |
6554 | ||
6555 | You use these options to specify which instructions are available on the | |
6556 | processor you are using. The default value of these options is | |
161d7b59 | 6557 | determined when configuring GCC@. Specifying the |
630d3d5a JM |
6558 | @option{-mcpu=@var{cpu_type}} overrides the specification of these |
6559 | options. We recommend you use the @option{-mcpu=@var{cpu_type}} option | |
74291a4b MM |
6560 | rather than the options listed above. |
6561 | ||
630d3d5a | 6562 | The @option{-mpower} option allows GCC to generate instructions that |
74291a4b | 6563 | are found only in the POWER architecture and to use the MQ register. |
630d3d5a | 6564 | Specifying @option{-mpower2} implies @option{-power} and also allows GCC |
74291a4b MM |
6565 | to generate instructions that are present in the POWER2 architecture but |
6566 | not the original POWER architecture. | |
6567 | ||
630d3d5a | 6568 | The @option{-mpowerpc} option allows GCC to generate instructions that |
74291a4b | 6569 | are found only in the 32-bit subset of the PowerPC architecture. |
630d3d5a | 6570 | Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows |
0c2d1a2a | 6571 | GCC to use the optional PowerPC architecture instructions in the |
74291a4b | 6572 | General Purpose group, including floating-point square root. Specifying |
630d3d5a | 6573 | @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to |
74291a4b MM |
6574 | use the optional PowerPC architecture instructions in the Graphics |
6575 | group, including floating-point select. | |
6576 | ||
630d3d5a | 6577 | The @option{-mpowerpc64} option allows GCC to generate the additional |
7fe90e7b | 6578 | 64-bit instructions that are found in the full PowerPC64 architecture |
0c2d1a2a | 6579 | and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to |
630d3d5a | 6580 | @option{-mno-powerpc64}. |
7fe90e7b | 6581 | |
630d3d5a | 6582 | If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC |
74291a4b MM |
6583 | will use only the instructions in the common subset of both |
6584 | architectures plus some special AIX common-mode calls, and will not use | |
630d3d5a | 6585 | the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc} |
0c2d1a2a | 6586 | permits GCC to use any instruction from either architecture and to |
74291a4b MM |
6587 | allow use of the MQ register; specify this for the Motorola MPC601. |
6588 | ||
6589 | @item -mnew-mnemonics | |
6590 | @itemx -mold-mnemonics | |
cd3bb277 JM |
6591 | @opindex mnew-mnemonics |
6592 | @opindex mold-mnemonics | |
9c34dbbf ZW |
6593 | Select which mnemonics to use in the generated assembler code. With |
6594 | @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for | |
6595 | the PowerPC architecture. With @option{-mold-mnemonics} it uses the | |
6596 | assembler mnemonics defined for the POWER architecture. Instructions | |
6597 | defined in only one architecture have only one mnemonic; GCC uses that | |
6598 | mnemonic irrespective of which of these options is specified. | |
74291a4b | 6599 | |
0c2d1a2a | 6600 | GCC defaults to the mnemonics appropriate for the architecture in |
630d3d5a | 6601 | use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the |
7fe90e7b | 6602 | value of these option. Unless you are building a cross-compiler, you |
630d3d5a JM |
6603 | should normally not specify either @option{-mnew-mnemonics} or |
6604 | @option{-mold-mnemonics}, but should instead accept the default. | |
74291a4b MM |
6605 | |
6606 | @item -mcpu=@var{cpu_type} | |
cd3bb277 | 6607 | @opindex mcpu |
74291a4b MM |
6608 | Set architecture type, register usage, choice of mnemonics, and |
6609 | instruction scheduling parameters for machine type @var{cpu_type}. | |
5f59ecb7 DE |
6610 | Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1}, |
6611 | @samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602}, | |
6612 | @samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, | |
ed947a96 DJ |
6613 | @samp{630}, @samp{740}, @samp{7400}, @samp{7450}, @samp{750}, |
6614 | @samp{power}, @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505}, | |
6615 | @samp{801}, @samp{821}, @samp{823}, and @samp{860} and @samp{common}. | |
9c34dbbf ZW |
6616 | |
6617 | @option{-mcpu=common} selects a completely generic processor. Code | |
6618 | generated under this option will run on any POWER or PowerPC processor. | |
6619 | GCC will use only the instructions in the common subset of both | |
6620 | architectures, and will not use the MQ register. GCC assumes a generic | |
74291a4b MM |
6621 | processor model for scheduling purposes. |
6622 | ||
9c34dbbf ZW |
6623 | @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and |
6624 | @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit | |
6625 | PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine | |
6626 | types, with an appropriate, generic processor model assumed for | |
6627 | scheduling purposes. | |
74291a4b | 6628 | |
9c34dbbf ZW |
6629 | The other options specify a specific processor. Code generated under |
6630 | those options will run best on that processor, and may not run at all on | |
6631 | others. | |
6632 | ||
6633 | The @option{-mcpu} options automatically enable or disable other | |
6634 | @option{-m} options as follows: | |
6635 | ||
6636 | @table @samp | |
6637 | @item common | |
6638 | @option{-mno-power}, @option{-mno-powerc} | |
6639 | ||
6640 | @item power | |
6641 | @itemx power2 | |
6642 | @itemx rios1 | |
6643 | @itemx rios2 | |
6644 | @itemx rsc | |
6645 | @option{-mpower}, @option{-mno-powerpc}, @option{-mno-new-mnemonics} | |
6646 | ||
6647 | @item powerpc | |
6648 | @itemx rs64a | |
6649 | @itemx 602 | |
6650 | @itemx 603 | |
6651 | @itemx 603e | |
6652 | @itemx 604 | |
6653 | @itemx 620 | |
6654 | @itemx 630 | |
6655 | @itemx 740 | |
ed947a96 DJ |
6656 | @itemx 7400 |
6657 | @itemx 7450 | |
9c34dbbf ZW |
6658 | @itemx 750 |
6659 | @itemx 505 | |
6660 | @option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics} | |
6661 | ||
6662 | @item 601 | |
6663 | @option{-mpower}, @option{-mpowerpc}, @option{-mnew-mnemonics} | |
6664 | ||
6665 | @item 403 | |
6666 | @itemx 821 | |
6667 | @itemx 860 | |
6668 | @option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}, @option{-msoft-float} | |
6669 | @end table | |
74291a4b MM |
6670 | |
6671 | @item -mtune=@var{cpu_type} | |
cd3bb277 | 6672 | @opindex mtune |
74291a4b | 6673 | Set the instruction scheduling parameters for machine type |
9c34dbbf ZW |
6674 | @var{cpu_type}, but do not set the architecture type, register usage, or |
6675 | choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same | |
6676 | values for @var{cpu_type} are used for @option{-mtune} as for | |
6677 | @option{-mcpu}. If both are specified, the code generated will use the | |
6678 | architecture, registers, and mnemonics set by @option{-mcpu}, but the | |
6679 | scheduling parameters set by @option{-mtune}. | |
74291a4b | 6680 | |
0ac081f6 AH |
6681 | @item -maltivec |
6682 | @itemx -mno-altivec | |
6683 | @opindex maltivec | |
6684 | @opindex mno-altivec | |
6685 | These switches enable or disable the use of built-in functions that | |
6686 | allow access to the AltiVec instruction set. You may also need to set | |
6687 | @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI | |
6688 | enhancements. | |
6689 | ||
74291a4b MM |
6690 | @item -mfull-toc |
6691 | @itemx -mno-fp-in-toc | |
6692 | @itemx -mno-sum-in-toc | |
6693 | @itemx -mminimal-toc | |
cd3bb277 JM |
6694 | @opindex mfull-toc |
6695 | @opindex mno-fp-in-toc | |
6696 | @opindex mno-sum-in-toc | |
6697 | @opindex mminimal-toc | |
74291a4b | 6698 | Modify generation of the TOC (Table Of Contents), which is created for |
630d3d5a | 6699 | every executable file. The @option{-mfull-toc} option is selected by |
0c2d1a2a JB |
6700 | default. In that case, GCC will allocate at least one TOC entry for |
6701 | each unique non-automatic variable reference in your program. GCC | |
161d7b59 JM |
6702 | will also place floating-point constants in the TOC@. However, only |
6703 | 16,384 entries are available in the TOC@. | |
74291a4b MM |
6704 | |
6705 | If you receive a linker error message that saying you have overflowed | |
6706 | the available TOC space, you can reduce the amount of TOC space used | |
630d3d5a JM |
6707 | with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. |
6708 | @option{-mno-fp-in-toc} prevents GCC from putting floating-point | |
6709 | constants in the TOC and @option{-mno-sum-in-toc} forces GCC to | |
74291a4b | 6710 | generate code to calculate the sum of an address and a constant at |
161d7b59 | 6711 | run-time instead of putting that sum into the TOC@. You may specify one |
0c2d1a2a | 6712 | or both of these options. Each causes GCC to produce very slightly |
74291a4b MM |
6713 | slower and larger code at the expense of conserving TOC space. |
6714 | ||
6715 | If you still run out of space in the TOC even when you specify both of | |
630d3d5a | 6716 | these options, specify @option{-mminimal-toc} instead. This option causes |
0c2d1a2a JB |
6717 | GCC to make only one TOC entry for every file. When you specify this |
6718 | option, GCC will produce code that is slower and larger but which | |
74291a4b | 6719 | uses extremely little TOC space. You may wish to use this option |
bd819a4a | 6720 | only on files that contain less frequently executed code. |
74291a4b | 6721 | |
fa06229f GK |
6722 | @item -maix64 |
6723 | @itemx -maix32 | |
cd3bb277 JM |
6724 | @opindex maix64 |
6725 | @opindex maix32 | |
fa06229f | 6726 | Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit |
7fe90e7b | 6727 | @code{long} type, and the infrastructure needed to support them. |
630d3d5a JM |
6728 | Specifying @option{-maix64} implies @option{-mpowerpc64} and |
6729 | @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and | |
6730 | implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. | |
7fe90e7b | 6731 | |
74291a4b MM |
6732 | @item -mxl-call |
6733 | @itemx -mno-xl-call | |
cd3bb277 JM |
6734 | @opindex mxl-call |
6735 | @opindex mno-xl-call | |
74291a4b MM |
6736 | On AIX, pass floating-point arguments to prototyped functions beyond the |
6737 | register save area (RSA) on the stack in addition to argument FPRs. The | |
6738 | AIX calling convention was extended but not initially documented to | |
6739 | handle an obscure K&R C case of calling a function that takes the | |
6740 | address of its arguments with fewer arguments than declared. AIX XL | |
7fe90e7b DE |
6741 | compilers access floating point arguments which do not fit in the |
6742 | RSA from the stack when a subroutine is compiled without | |
74291a4b MM |
6743 | optimization. Because always storing floating-point arguments on the |
6744 | stack is inefficient and rarely needed, this option is not enabled by | |
6745 | default and only is necessary when calling subroutines compiled by AIX | |
6746 | XL compilers without optimization. | |
6747 | ||
861bb6c1 | 6748 | @item -mpe |
cd3bb277 | 6749 | @opindex mpe |
161d7b59 | 6750 | Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an |
861bb6c1 JL |
6751 | application written to use message passing with special startup code to |
6752 | enable the application to run. The system must have PE installed in the | |
6753 | standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file | |
630d3d5a | 6754 | must be overridden with the @option{-specs=} option to specify the |
861bb6c1 | 6755 | appropriate directory location. The Parallel Environment does not |
0a379b7a | 6756 | support threads, so the @option{-mpe} option and the @option{-pthread} |
861bb6c1 JL |
6757 | option are incompatible. |
6758 | ||
74291a4b MM |
6759 | @item -msoft-float |
6760 | @itemx -mhard-float | |
cd3bb277 JM |
6761 | @opindex msoft-float |
6762 | @opindex mhard-float | |
74291a4b MM |
6763 | Generate code that does not use (uses) the floating-point register set. |
6764 | Software floating point emulation is provided if you use the | |
630d3d5a | 6765 | @option{-msoft-float} option, and pass the option to GCC when linking. |
74291a4b MM |
6766 | |
6767 | @item -mmultiple | |
6768 | @itemx -mno-multiple | |
cd3bb277 JM |
6769 | @opindex mmultiple |
6770 | @opindex mno-multiple | |
74291a4b MM |
6771 | Generate code that uses (does not use) the load multiple word |
6772 | instructions and the store multiple word instructions. These | |
6773 | instructions are generated by default on POWER systems, and not | |
630d3d5a | 6774 | generated on PowerPC systems. Do not use @option{-mmultiple} on little |
74291a4b | 6775 | endian PowerPC systems, since those instructions do not work when the |
bef84347 VM |
6776 | processor is in little endian mode. The exceptions are PPC740 and |
6777 | PPC750 which permit the instructions usage in little endian mode. | |
74291a4b MM |
6778 | |
6779 | @item -mstring | |
6780 | @itemx -mno-string | |
cd3bb277 JM |
6781 | @opindex mstring |
6782 | @opindex mno-string | |
bef84347 VM |
6783 | Generate code that uses (does not use) the load string instructions |
6784 | and the store string word instructions to save multiple registers and | |
6785 | do small block moves. These instructions are generated by default on | |
6786 | POWER systems, and not generated on PowerPC systems. Do not use | |
630d3d5a | 6787 | @option{-mstring} on little endian PowerPC systems, since those |
bef84347 VM |
6788 | instructions do not work when the processor is in little endian mode. |
6789 | The exceptions are PPC740 and PPC750 which permit the instructions | |
6790 | usage in little endian mode. | |
74291a4b | 6791 | |
861bb6c1 JL |
6792 | @item -mupdate |
6793 | @itemx -mno-update | |
cd3bb277 JM |
6794 | @opindex mupdate |
6795 | @opindex mno-update | |
861bb6c1 JL |
6796 | Generate code that uses (does not use) the load or store instructions |
6797 | that update the base register to the address of the calculated memory | |
6798 | location. These instructions are generated by default. If you use | |
630d3d5a | 6799 | @option{-mno-update}, there is a small window between the time that the |
861bb6c1 JL |
6800 | stack pointer is updated and the address of the previous frame is |
6801 | stored, which means code that walks the stack frame across interrupts or | |
6802 | signals may get corrupted data. | |
6803 | ||
6804 | @item -mfused-madd | |
6805 | @itemx -mno-fused-madd | |
cd3bb277 JM |
6806 | @opindex mfused-madd |
6807 | @opindex mno-fused-madd | |
861bb6c1 JL |
6808 | Generate code that uses (does not use) the floating point multiply and |
6809 | accumulate instructions. These instructions are generated by default if | |
6810 | hardware floating is used. | |
6811 | ||
74291a4b MM |
6812 | @item -mno-bit-align |
6813 | @itemx -mbit-align | |
cd3bb277 JM |
6814 | @opindex mno-bit-align |
6815 | @opindex mbit-align | |
74291a4b | 6816 | On System V.4 and embedded PowerPC systems do not (do) force structures |
c771326b JM |
6817 | and unions that contain bit-fields to be aligned to the base type of the |
6818 | bit-field. | |
74291a4b MM |
6819 | |
6820 | For example, by default a structure containing nothing but 8 | |
c771326b | 6821 | @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte |
630d3d5a | 6822 | boundary and have a size of 4 bytes. By using @option{-mno-bit-align}, |
74291a4b MM |
6823 | the structure would be aligned to a 1 byte boundary and be one byte in |
6824 | size. | |
6825 | ||
6826 | @item -mno-strict-align | |
6827 | @itemx -mstrict-align | |
cd3bb277 JM |
6828 | @opindex mno-strict-align |
6829 | @opindex mstrict-align | |
74291a4b MM |
6830 | On System V.4 and embedded PowerPC systems do not (do) assume that |
6831 | unaligned memory references will be handled by the system. | |
6832 | ||
6833 | @item -mrelocatable | |
6834 | @itemx -mno-relocatable | |
cd3bb277 JM |
6835 | @opindex mrelocatable |
6836 | @opindex mno-relocatable | |
74291a4b MM |
6837 | On embedded PowerPC systems generate code that allows (does not allow) |
6838 | the program to be relocated to a different address at runtime. If you | |
630d3d5a JM |
6839 | use @option{-mrelocatable} on any module, all objects linked together must |
6840 | be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}. | |
74291a4b MM |
6841 | |
6842 | @item -mrelocatable-lib | |
6843 | @itemx -mno-relocatable-lib | |
cd3bb277 JM |
6844 | @opindex mrelocatable-lib |
6845 | @opindex mno-relocatable-lib | |
74291a4b MM |
6846 | On embedded PowerPC systems generate code that allows (does not allow) |
6847 | the program to be relocated to a different address at runtime. Modules | |
630d3d5a JM |
6848 | compiled with @option{-mrelocatable-lib} can be linked with either modules |
6849 | compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or | |
6850 | with modules compiled with the @option{-mrelocatable} options. | |
74291a4b MM |
6851 | |
6852 | @item -mno-toc | |
6853 | @itemx -mtoc | |
cd3bb277 JM |
6854 | @opindex mno-toc |
6855 | @opindex mtoc | |
74291a4b MM |
6856 | On System V.4 and embedded PowerPC systems do not (do) assume that |
6857 | register 2 contains a pointer to a global area pointing to the addresses | |
6858 | used in the program. | |
6859 | ||
74291a4b MM |
6860 | @item -mlittle |
6861 | @itemx -mlittle-endian | |
cd3bb277 JM |
6862 | @opindex mlittle |
6863 | @opindex mlittle-endian | |
74291a4b | 6864 | On System V.4 and embedded PowerPC systems compile code for the |
630d3d5a JM |
6865 | processor in little endian mode. The @option{-mlittle-endian} option is |
6866 | the same as @option{-mlittle}. | |
74291a4b MM |
6867 | |
6868 | @item -mbig | |
6869 | @itemx -mbig-endian | |
cd3bb277 JM |
6870 | @opindex mbig |
6871 | @opindex mbig-endian | |
74291a4b | 6872 | On System V.4 and embedded PowerPC systems compile code for the |
630d3d5a JM |
6873 | processor in big endian mode. The @option{-mbig-endian} option is |
6874 | the same as @option{-mbig}. | |
74291a4b MM |
6875 | |
6876 | @item -mcall-sysv | |
cd3bb277 | 6877 | @opindex mcall-sysv |
74291a4b MM |
6878 | On System V.4 and embedded PowerPC systems compile code using calling |
6879 | conventions that adheres to the March 1995 draft of the System V | |
6880 | Application Binary Interface, PowerPC processor supplement. This is the | |
6881 | default unless you configured GCC using @samp{powerpc-*-eabiaix}. | |
6882 | ||
6883 | @item -mcall-sysv-eabi | |
cd3bb277 | 6884 | @opindex mcall-sysv-eabi |
630d3d5a | 6885 | Specify both @option{-mcall-sysv} and @option{-meabi} options. |
74291a4b MM |
6886 | |
6887 | @item -mcall-sysv-noeabi | |
cd3bb277 | 6888 | @opindex mcall-sysv-noeabi |
630d3d5a | 6889 | Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. |
74291a4b MM |
6890 | |
6891 | @item -mcall-aix | |
cd3bb277 | 6892 | @opindex mcall-aix |
74291a4b | 6893 | On System V.4 and embedded PowerPC systems compile code using calling |
161d7b59 | 6894 | conventions that are similar to those used on AIX@. This is the |
74291a4b MM |
6895 | default if you configured GCC using @samp{powerpc-*-eabiaix}. |
6896 | ||
6897 | @item -mcall-solaris | |
cd3bb277 | 6898 | @opindex mcall-solaris |
74291a4b MM |
6899 | On System V.4 and embedded PowerPC systems compile code for the Solaris |
6900 | operating system. | |
6901 | ||
6902 | @item -mcall-linux | |
cd3bb277 | 6903 | @opindex mcall-linux |
861bb6c1 JL |
6904 | On System V.4 and embedded PowerPC systems compile code for the |
6905 | Linux-based GNU system. | |
74291a4b | 6906 | |
48180d68 RM |
6907 | @item -mcall-gnu |
6908 | @opindex mcall-gnu | |
6909 | On System V.4 and embedded PowerPC systems compile code for the | |
6910 | Hurd-based GNU system. | |
6911 | ||
edf1b3f3 AC |
6912 | @item -mcall-netbsd |
6913 | @opindex mcall-netbsd | |
6914 | On System V.4 and embedded PowerPC systems compile code for the | |
6915 | NetBSD operating system. | |
6916 | ||
9904592e ZW |
6917 | @item -maix-struct-return |
6918 | @opindex maix-struct-return | |
6919 | Return all structures in memory (as specified by the AIX ABI)@. | |
6920 | ||
6921 | @item -msvr4-struct-return | |
6922 | @opindex msvr4-struct-return | |
6923 | Return structures smaller than 8 bytes in registers (as specified by the | |
6924 | SVR4 ABI)@. | |
6925 | ||
0ac081f6 AH |
6926 | @item -mabi=altivec |
6927 | @opindex mabi=altivec | |
6928 | Extend the current ABI with AltiVec ABI extensions. This does not | |
6929 | change the default ABI, instead it adds the AltiVec ABI extensions to | |
6930 | the current ABI@. | |
6931 | ||
74291a4b | 6932 | @item -mprototype |
e9a25f70 | 6933 | @itemx -mno-prototype |
cd3bb277 JM |
6934 | @opindex mprototype |
6935 | @opindex mno-prototype | |
74291a4b MM |
6936 | On System V.4 and embedded PowerPC systems assume that all calls to |
6937 | variable argument functions are properly prototyped. Otherwise, the | |
6938 | compiler must insert an instruction before every non prototyped call to | |
6939 | set or clear bit 6 of the condition code register (@var{CR}) to | |
6940 | indicate whether floating point values were passed in the floating point | |
6941 | registers in case the function takes a variable arguments. With | |
630d3d5a | 6942 | @option{-mprototype}, only calls to prototyped variable argument functions |
74291a4b MM |
6943 | will set or clear the bit. |
6944 | ||
6945 | @item -msim | |
cd3bb277 | 6946 | @opindex msim |
74291a4b MM |
6947 | On embedded PowerPC systems, assume that the startup module is called |
6948 | @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and | |
6949 | @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}. | |
6950 | configurations. | |
6951 | ||
6952 | @item -mmvme | |
cd3bb277 | 6953 | @opindex mmvme |
74291a4b | 6954 | On embedded PowerPC systems, assume that the startup module is called |
e9a25f70 JL |
6955 | @file{crt0.o} and the standard C libraries are @file{libmvme.a} and |
6956 | @file{libc.a}. | |
6957 | ||
6958 | @item -mads | |
cd3bb277 | 6959 | @opindex mads |
e9a25f70 JL |
6960 | On embedded PowerPC systems, assume that the startup module is called |
6961 | @file{crt0.o} and the standard C libraries are @file{libads.a} and | |
6962 | @file{libc.a}. | |
6963 | ||
6964 | @item -myellowknife | |
cd3bb277 | 6965 | @opindex myellowknife |
e9a25f70 JL |
6966 | On embedded PowerPC systems, assume that the startup module is called |
6967 | @file{crt0.o} and the standard C libraries are @file{libyk.a} and | |
74291a4b MM |
6968 | @file{libc.a}. |
6969 | ||
bff46771 | 6970 | @item -mvxworks |
cd3bb277 | 6971 | @opindex mvxworks |
bff46771 GK |
6972 | On System V.4 and embedded PowerPC systems, specify that you are |
6973 | compiling for a VxWorks system. | |
6974 | ||
74291a4b | 6975 | @item -memb |
cd3bb277 | 6976 | @opindex memb |
74291a4b MM |
6977 | On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags |
6978 | header to indicate that @samp{eabi} extended relocations are used. | |
6979 | ||
6980 | @item -meabi | |
6981 | @itemx -mno-eabi | |
cd3bb277 JM |
6982 | @opindex meabi |
6983 | @opindex mno-eabi | |
74291a4b MM |
6984 | On System V.4 and embedded PowerPC systems do (do not) adhere to the |
6985 | Embedded Applications Binary Interface (eabi) which is a set of | |
bedc7537 | 6986 | modifications to the System V.4 specifications. Selecting @option{-meabi} |
74291a4b MM |
6987 | means that the stack is aligned to an 8 byte boundary, a function |
6988 | @code{__eabi} is called to from @code{main} to set up the eabi | |
630d3d5a | 6989 | environment, and the @option{-msdata} option can use both @code{r2} and |
74291a4b | 6990 | @code{r13} to point to two separate small data areas. Selecting |
bedc7537 | 6991 | @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary, |
74291a4b | 6992 | do not call an initialization function from @code{main}, and the |
630d3d5a JM |
6993 | @option{-msdata} option will only use @code{r13} to point to a single |
6994 | small data area. The @option{-meabi} option is on by default if you | |
74291a4b MM |
6995 | configured GCC using one of the @samp{powerpc*-*-eabi*} options. |
6996 | ||
6997 | @item -msdata=eabi | |
cd3bb277 | 6998 | @opindex msdata=eabi |
74291a4b MM |
6999 | On System V.4 and embedded PowerPC systems, put small initialized |
7000 | @code{const} global and static data in the @samp{.sdata2} section, which | |
7001 | is pointed to by register @code{r2}. Put small initialized | |
7002 | non-@code{const} global and static data in the @samp{.sdata} section, | |
7003 | which is pointed to by register @code{r13}. Put small uninitialized | |
7004 | global and static data in the @samp{.sbss} section, which is adjacent to | |
630d3d5a JM |
7005 | the @samp{.sdata} section. The @option{-msdata=eabi} option is |
7006 | incompatible with the @option{-mrelocatable} option. The | |
7007 | @option{-msdata=eabi} option also sets the @option{-memb} option. | |
74291a4b MM |
7008 | |
7009 | @item -msdata=sysv | |
cd3bb277 | 7010 | @opindex msdata=sysv |
74291a4b MM |
7011 | On System V.4 and embedded PowerPC systems, put small global and static |
7012 | data in the @samp{.sdata} section, which is pointed to by register | |
7013 | @code{r13}. Put small uninitialized global and static data in the | |
7014 | @samp{.sbss} section, which is adjacent to the @samp{.sdata} section. | |
630d3d5a JM |
7015 | The @option{-msdata=sysv} option is incompatible with the |
7016 | @option{-mrelocatable} option. | |
74291a4b MM |
7017 | |
7018 | @item -msdata=default | |
7019 | @itemx -msdata | |
cd3bb277 JM |
7020 | @opindex msdata=default |
7021 | @opindex msdata | |
630d3d5a JM |
7022 | On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, |
7023 | compile code the same as @option{-msdata=eabi}, otherwise compile code the | |
7024 | same as @option{-msdata=sysv}. | |
74291a4b MM |
7025 | |
7026 | @item -msdata-data | |
cd3bb277 | 7027 | @opindex msdata-data |
74291a4b MM |
7028 | On System V.4 and embedded PowerPC systems, put small global and static |
7029 | data in the @samp{.sdata} section. Put small uninitialized global and | |
7030 | static data in the @samp{.sbss} section. Do not use register @code{r13} | |
7031 | to address small data however. This is the default behavior unless | |
630d3d5a | 7032 | other @option{-msdata} options are used. |
74291a4b MM |
7033 | |
7034 | @item -msdata=none | |
7035 | @itemx -mno-sdata | |
cd3bb277 JM |
7036 | @opindex msdata=none |
7037 | @opindex mno-sdata | |
74291a4b MM |
7038 | On embedded PowerPC systems, put all initialized global and static data |
7039 | in the @samp{.data} section, and all uninitialized data in the | |
7040 | @samp{.bss} section. | |
7041 | ||
7042 | @item -G @var{num} | |
cd3bb277 | 7043 | @opindex G |
74291a4b MM |
7044 | @cindex smaller data references (PowerPC) |
7045 | @cindex .sdata/.sdata2 references (PowerPC) | |
956d6950 | 7046 | On embedded PowerPC systems, put global and static items less than or |
74291a4b MM |
7047 | equal to @var{num} bytes into the small data or bss sections instead of |
7048 | the normal data or bss section. By default, @var{num} is 8. The | |
630d3d5a JM |
7049 | @option{-G @var{num}} switch is also passed to the linker. |
7050 | All modules should be compiled with the same @option{-G @var{num}} value. | |
74291a4b MM |
7051 | |
7052 | @item -mregnames | |
7053 | @itemx -mno-regnames | |
cd3bb277 JM |
7054 | @opindex mregnames |
7055 | @opindex mno-regnames | |
74291a4b MM |
7056 | On System V.4 and embedded PowerPC systems do (do not) emit register |
7057 | names in the assembly language output using symbolic forms. | |
f5a1b0d2 | 7058 | |
0a379b7a CR |
7059 | @item -pthread |
7060 | @opindex pthread | |
7061 | Adds support for multithreading with the @dfn{pthreads} library. | |
7062 | This option sets flags for both the preprocessor and linker. | |
7063 | ||
74291a4b | 7064 | @end table |
f5a1b0d2 | 7065 | |
74291a4b MM |
7066 | @node RT Options |
7067 | @subsection IBM RT Options | |
7068 | @cindex RT options | |
7069 | @cindex IBM RT options | |
7070 | ||
7071 | These @samp{-m} options are defined for the IBM RT PC: | |
7072 | ||
2642624b | 7073 | @table @gcctabopt |
74291a4b | 7074 | @item -min-line-mul |
cd3bb277 | 7075 | @opindex min-line-mul |
74291a4b MM |
7076 | Use an in-line code sequence for integer multiplies. This is the |
7077 | default. | |
7078 | ||
7079 | @item -mcall-lib-mul | |
cd3bb277 | 7080 | @opindex mcall-lib-mul |
74291a4b MM |
7081 | Call @code{lmul$$} for integer multiples. |
7082 | ||
7083 | @item -mfull-fp-blocks | |
cd3bb277 | 7084 | @opindex mfull-fp-blocks |
74291a4b | 7085 | Generate full-size floating point data blocks, including the minimum |
161d7b59 | 7086 | amount of scratch space recommended by IBM@. This is the default. |
74291a4b MM |
7087 | |
7088 | @item -mminimum-fp-blocks | |
cd3bb277 | 7089 | @opindex mminimum-fp-blocks |
74291a4b MM |
7090 | Do not include extra scratch space in floating point data blocks. This |
7091 | results in smaller code, but slower execution, since scratch space must | |
7092 | be allocated dynamically. | |
7093 | ||
7094 | @cindex @file{varargs.h} and RT PC | |
7095 | @cindex @file{stdarg.h} and RT PC | |
7096 | @item -mfp-arg-in-fpregs | |
cd3bb277 | 7097 | @opindex mfp-arg-in-fpregs |
74291a4b MM |
7098 | Use a calling sequence incompatible with the IBM calling convention in |
7099 | which floating point arguments are passed in floating point registers. | |
c771326b | 7100 | Note that @code{varargs.h} and @code{stdarg.h} will not work with |
74291a4b MM |
7101 | floating point operands if this option is specified. |
7102 | ||
7103 | @item -mfp-arg-in-gregs | |
cd3bb277 | 7104 | @opindex mfp-arg-in-gregs |
74291a4b MM |
7105 | Use the normal calling convention for floating point arguments. This is |
7106 | the default. | |
7107 | ||
7108 | @item -mhc-struct-return | |
cd3bb277 | 7109 | @opindex mhc-struct-return |
74291a4b MM |
7110 | Return structures of more than one word in memory, rather than in a |
7111 | register. This provides compatibility with the MetaWare HighC (hc) | |
630d3d5a | 7112 | compiler. Use the option @option{-fpcc-struct-return} for compatibility |
74291a4b MM |
7113 | with the Portable C Compiler (pcc). |
7114 | ||
7115 | @item -mnohc-struct-return | |
cd3bb277 | 7116 | @opindex mnohc-struct-return |
74291a4b MM |
7117 | Return some structures of more than one word in registers, when |
7118 | convenient. This is the default. For compatibility with the | |
630d3d5a JM |
7119 | IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the |
7120 | option @option{-mhc-struct-return}. | |
74291a4b MM |
7121 | @end table |
7122 | ||
7123 | @node MIPS Options | |
7124 | @subsection MIPS Options | |
7125 | @cindex MIPS options | |
7126 | ||
7127 | These @samp{-m} options are defined for the MIPS family of computers: | |
7128 | ||
2642624b | 7129 | @table @gcctabopt |
7dac2f89 EC |
7130 | |
7131 | @item -march=@var{cpu-type} | |
7132 | @opindex march | |
7133 | Assume the defaults for the machine type @var{cpu-type} when generating | |
7134 | instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000}, | |
7135 | @samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400}, | |
7136 | @samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000}, | |
7137 | and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000}, | |
7138 | @samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as | |
7139 | @samp{r2k} (or @samp{r2K}), @samp{r3k}, etc. | |
7140 | ||
7141 | @item -mtune=@var{cpu-type} | |
7142 | @opindex mtune | |
630d3d5a JM |
7143 | Assume the defaults for the machine type @var{cpu-type} when scheduling |
7144 | instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000}, | |
8b9243df JJ |
7145 | @samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400}, |
7146 | @samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000}, | |
7147 | and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000}, | |
7148 | @samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as | |
7149 | @samp{r2k} (or @samp{r2K}), @samp{r3k}, etc. While picking a specific | |
630d3d5a | 7150 | @var{cpu-type} will schedule things appropriately for that particular |
8b9243df | 7151 | chip, the compiler will not generate any code that does not meet level 1 |
630d3d5a JM |
7152 | of the MIPS ISA (instruction set architecture) without a @option{-mipsX} |
7153 | or @option{-mabi} switch being used. | |
74291a4b | 7154 | |
7dac2f89 EC |
7155 | @item -mcpu=@var{cpu-type} |
7156 | @opindex mcpu | |
7157 | This is identical to specifying both @option{-march} and @option{-mtune}. | |
7158 | ||
74291a4b | 7159 | @item -mips1 |
cd3bb277 | 7160 | @opindex mips1 |
161d7b59 | 7161 | Issue instructions from level 1 of the MIPS ISA@. This is the default. |
630d3d5a | 7162 | @samp{r3000} is the default @var{cpu-type} at this ISA level. |
74291a4b MM |
7163 | |
7164 | @item -mips2 | |
cd3bb277 | 7165 | @opindex mips2 |
74291a4b | 7166 | Issue instructions from level 2 of the MIPS ISA (branch likely, square |
630d3d5a | 7167 | root instructions). @samp{r6000} is the default @var{cpu-type} at this |
74291a4b MM |
7168 | ISA level. |
7169 | ||
7170 | @item -mips3 | |
cd3bb277 | 7171 | @opindex mips3 |
02f52e19 | 7172 | Issue instructions from level 3 of the MIPS ISA (64-bit instructions). |
630d3d5a | 7173 | @samp{r4000} is the default @var{cpu-type} at this ISA level. |
74291a4b | 7174 | |
3398f47f | 7175 | @item -mips4 |
cd3bb277 | 7176 | @opindex mips4 |
8b9243df JJ |
7177 | Issue instructions from level 4 of the MIPS ISA (conditional move, |
7178 | prefetch, enhanced FPU instructions). @samp{r8000} is the default | |
630d3d5a | 7179 | @var{cpu-type} at this ISA level. |
3398f47f | 7180 | |
74291a4b | 7181 | @item -mfp32 |
cd3bb277 | 7182 | @opindex mfp32 |
74291a4b MM |
7183 | Assume that 32 32-bit floating point registers are available. This is |
7184 | the default. | |
7185 | ||
7186 | @item -mfp64 | |
cd3bb277 | 7187 | @opindex mfp64 |
74291a4b | 7188 | Assume that 32 64-bit floating point registers are available. This is |
630d3d5a | 7189 | the default when the @option{-mips3} option is used. |
74291a4b | 7190 | |
13fac94a GK |
7191 | @item -mfused-madd |
7192 | @itemx -mno-fused-madd | |
7193 | @opindex mfused-madd | |
7194 | @opindex mno-fused-madd | |
7195 | Generate code that uses (does not use) the floating point multiply and | |
7196 | accumulate instructions, when they are available. These instructions | |
7197 | are generated by default if they are available, but this may be | |
7198 | undesirable if the extra precision causes problems or on certain chips | |
7199 | in the mode where denormals are rounded to zero where denormals | |
7200 | generated by multiply and accumulate instructions cause exceptions | |
7201 | anyway. | |
7202 | ||
74291a4b | 7203 | @item -mgp32 |
cd3bb277 | 7204 | @opindex mgp32 |
74291a4b MM |
7205 | Assume that 32 32-bit general purpose registers are available. This is |
7206 | the default. | |
7207 | ||
7208 | @item -mgp64 | |
cd3bb277 | 7209 | @opindex mgp64 |
74291a4b | 7210 | Assume that 32 64-bit general purpose registers are available. This is |
630d3d5a | 7211 | the default when the @option{-mips3} option is used. |
74291a4b MM |
7212 | |
7213 | @item -mint64 | |
cd3bb277 | 7214 | @opindex mint64 |
630d3d5a | 7215 | Force int and long types to be 64 bits wide. See @option{-mlong32} for an |
3ce1ba83 | 7216 | explanation of the default, and the width of pointers. |
74291a4b MM |
7217 | |
7218 | @item -mlong64 | |
cd3bb277 | 7219 | @opindex mlong64 |
630d3d5a | 7220 | Force long types to be 64 bits wide. See @option{-mlong32} for an |
3ce1ba83 | 7221 | explanation of the default, and the width of pointers. |
fb1bf66d | 7222 | |
3ce1ba83 | 7223 | @item -mlong32 |
cd3bb277 | 7224 | @opindex mlong32 |
3ce1ba83 GRK |
7225 | Force long, int, and pointer types to be 32 bits wide. |
7226 | ||
630d3d5a | 7227 | If none of @option{-mlong32}, @option{-mlong64}, or @option{-mint64} are set, |
b192711e | 7228 | the size of ints, longs, and pointers depends on the ABI and ISA chosen. |
630d3d5a JM |
7229 | For @option{-mabi=32}, and @option{-mabi=n32}, ints and longs are 32 bits |
7230 | wide. For @option{-mabi=64}, ints are 32 bits, and longs are 64 bits wide. | |
7231 | For @option{-mabi=eabi} and either @option{-mips1} or @option{-mips2}, ints | |
7232 | and longs are 32 bits wide. For @option{-mabi=eabi} and higher ISAs, ints | |
3ce1ba83 GRK |
7233 | are 32 bits, and longs are 64 bits wide. The width of pointer types is |
7234 | the smaller of the width of longs or the width of general purpose | |
161d7b59 | 7235 | registers (which in turn depends on the ISA)@. |
74291a4b | 7236 | |
62a1403d | 7237 | @item -mabi=32 |
8b9243df | 7238 | @itemx -mabi=o64 |
3398f47f MM |
7239 | @itemx -mabi=n32 |
7240 | @itemx -mabi=64 | |
7241 | @itemx -mabi=eabi | |
cd3bb277 JM |
7242 | @opindex mabi=32 |
7243 | @opindex mabi=o64 | |
7244 | @opindex mabi=n32 | |
7245 | @opindex mabi=64 | |
7246 | @opindex mabi=eabi | |
161d7b59 | 7247 | Generate code for the indicated ABI@. The default instruction level is |
630d3d5a JM |
7248 | @option{-mips1} for @samp{32}, @option{-mips3} for @samp{n32}, and |
7249 | @option{-mips4} otherwise. Conversely, with @option{-mips1} or | |
7250 | @option{-mips2}, the default ABI is @samp{32}; otherwise, the default ABI | |
8b9243df | 7251 | is @samp{64}. |
3398f47f | 7252 | |
74291a4b | 7253 | @item -mmips-as |
cd3bb277 | 7254 | @opindex mmips-as |
74291a4b MM |
7255 | Generate code for the MIPS assembler, and invoke @file{mips-tfile} to |
7256 | add normal debug information. This is the default for all | |
7257 | platforms except for the OSF/1 reference platform, using the OSF/rose | |
630d3d5a | 7258 | object format. If the either of the @option{-gstabs} or @option{-gstabs+} |
74291a4b | 7259 | switches are used, the @file{mips-tfile} program will encapsulate the |
161d7b59 | 7260 | stabs within MIPS ECOFF@. |
74291a4b MM |
7261 | |
7262 | @item -mgas | |
cd3bb277 | 7263 | @opindex mgas |
74291a4b | 7264 | Generate code for the GNU assembler. This is the default on the OSF/1 |
861bb6c1 | 7265 | reference platform, using the OSF/rose object format. Also, this is |
630d3d5a | 7266 | the default if the configure option @option{--with-gnu-as} is used. |
861bb6c1 JL |
7267 | |
7268 | @item -msplit-addresses | |
7269 | @itemx -mno-split-addresses | |
cd3bb277 JM |
7270 | @opindex msplit-addresses |
7271 | @opindex mno-split-addresses | |
861bb6c1 | 7272 | Generate code to load the high and low parts of address constants separately. |
aee96fe9 | 7273 | This allows GCC to optimize away redundant loads of the high order |
861bb6c1 JL |
7274 | bits of addresses. This optimization requires GNU as and GNU ld. |
7275 | This optimization is enabled by default for some embedded targets where | |
7276 | GNU as and GNU ld are standard. | |
74291a4b MM |
7277 | |
7278 | @item -mrnames | |
7279 | @itemx -mno-rnames | |
cd3bb277 JM |
7280 | @opindex mrnames |
7281 | @opindex mno-rnames | |
630d3d5a | 7282 | The @option{-mrnames} switch says to output code using the MIPS software |
74291a4b MM |
7283 | names for the registers, instead of the hardware names (ie, @var{a0} |
7284 | instead of @var{$4}). The only known assembler that supports this option | |
7285 | is the Algorithmics assembler. | |
7286 | ||
7287 | @item -mgpopt | |
7288 | @itemx -mno-gpopt | |
cd3bb277 JM |
7289 | @opindex mgpopt |
7290 | @opindex mno-gpopt | |
630d3d5a | 7291 | The @option{-mgpopt} switch says to write all of the data declarations |
74291a4b MM |
7292 | before the instructions in the text section, this allows the MIPS |
7293 | assembler to generate one word memory references instead of using two | |
7294 | words for short global or static data items. This is on by default if | |
7295 | optimization is selected. | |
7296 | ||
7297 | @item -mstats | |
7298 | @itemx -mno-stats | |
cd3bb277 JM |
7299 | @opindex mstats |
7300 | @opindex mno-stats | |
630d3d5a | 7301 | For each non-inline function processed, the @option{-mstats} switch |
74291a4b MM |
7302 | causes the compiler to emit one line to the standard error file to |
7303 | print statistics about the program (number of registers saved, stack | |
7304 | size, etc.). | |
7305 | ||
7306 | @item -mmemcpy | |
7307 | @itemx -mno-memcpy | |
cd3bb277 JM |
7308 | @opindex mmemcpy |
7309 | @opindex mno-memcpy | |
630d3d5a | 7310 | The @option{-mmemcpy} switch makes all block moves call the appropriate |
74291a4b MM |
7311 | string function (@samp{memcpy} or @samp{bcopy}) instead of possibly |
7312 | generating inline code. | |
7313 | ||
7314 | @item -mmips-tfile | |
7315 | @itemx -mno-mips-tfile | |
cd3bb277 JM |
7316 | @opindex mmips-tfile |
7317 | @opindex mno-mips-tfile | |
630d3d5a | 7318 | The @option{-mno-mips-tfile} switch causes the compiler not |
74291a4b MM |
7319 | postprocess the object file with the @file{mips-tfile} program, |
7320 | after the MIPS assembler has generated it to add debug support. If | |
7321 | @file{mips-tfile} is not run, then no local variables will be | |
7322 | available to the debugger. In addition, @file{stage2} and | |
7323 | @file{stage3} objects will have the temporary file names passed to the | |
7324 | assembler embedded in the object file, which means the objects will | |
630d3d5a | 7325 | not compare the same. The @option{-mno-mips-tfile} switch should only |
74291a4b MM |
7326 | be used when there are bugs in the @file{mips-tfile} program that |
7327 | prevents compilation. | |
7328 | ||
7329 | @item -msoft-float | |
cd3bb277 | 7330 | @opindex msoft-float |
74291a4b | 7331 | Generate output containing library calls for floating point. |
161d7b59 | 7332 | @strong{Warning:} the requisite libraries are not part of GCC@. |
74291a4b MM |
7333 | Normally the facilities of the machine's usual C compiler are used, but |
7334 | this can't be done directly in cross-compilation. You must make your | |
7335 | own arrangements to provide suitable library functions for | |
7336 | cross-compilation. | |
7337 | ||
7338 | @item -mhard-float | |
cd3bb277 | 7339 | @opindex mhard-float |
74291a4b MM |
7340 | Generate output containing floating point instructions. This is the |
7341 | default if you use the unmodified sources. | |
7342 | ||
7343 | @item -mabicalls | |
7344 | @itemx -mno-abicalls | |
cd3bb277 JM |
7345 | @opindex mabicalls |
7346 | @opindex mno-abicalls | |
74291a4b MM |
7347 | Emit (or do not emit) the pseudo operations @samp{.abicalls}, |
7348 | @samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for | |
7349 | position independent code. | |
7350 | ||
7351 | @item -mlong-calls | |
7352 | @itemx -mno-long-calls | |
cd3bb277 JM |
7353 | @opindex mlong-calls |
7354 | @opindex mno-long-calls | |
74291a4b MM |
7355 | Do all calls with the @samp{JALR} instruction, which requires |
7356 | loading up a function's address into a register before the call. | |
7357 | You need to use this switch, if you call outside of the current | |
7358 | 512 megabyte segment to functions that are not through pointers. | |
7359 | ||
7360 | @item -mhalf-pic | |
7361 | @itemx -mno-half-pic | |
cd3bb277 JM |
7362 | @opindex mhalf-pic |
7363 | @opindex mno-half-pic | |
74291a4b MM |
7364 | Put pointers to extern references into the data section and load them |
7365 | up, rather than put the references in the text section. | |
7366 | ||
7367 | @item -membedded-pic | |
7368 | @itemx -mno-embedded-pic | |
cd3bb277 JM |
7369 | @opindex membedded-pic |
7370 | @opindex mno-embedded-pic | |
69fa83cf JW |
7371 | Generate PIC code suitable for some embedded systems. All calls are |
7372 | made using PC relative address, and all data is addressed using the $gp | |
7373 | register. No more than 65536 bytes of global data may be used. This | |
7374 | requires GNU as and GNU ld which do most of the work. This currently | |
161d7b59 | 7375 | only works on targets which use ECOFF; it does not work with ELF@. |
74291a4b MM |
7376 | |
7377 | @item -membedded-data | |
7378 | @itemx -mno-embedded-data | |
cd3bb277 JM |
7379 | @opindex membedded-data |
7380 | @opindex mno-embedded-data | |
74291a4b MM |
7381 | Allocate variables to the read-only data section first if possible, then |
7382 | next in the small data section if possible, otherwise in data. This gives | |
7383 | slightly slower code than the default, but reduces the amount of RAM required | |
7384 | when executing, and thus may be preferred for some embedded systems. | |
7385 | ||
919509ce DN |
7386 | @item -muninit-const-in-rodata |
7387 | @itemx -mno-uninit-const-in-rodata | |
cd3bb277 JM |
7388 | @opindex muninit-const-in-rodata |
7389 | @opindex mno-uninit-const-in-rodata | |
695ac33f | 7390 | When used together with @option{-membedded-data}, it will always store uninitialized |
919509ce | 7391 | const variables in the read-only data section. |
02f52e19 | 7392 | |
74291a4b MM |
7393 | @item -msingle-float |
7394 | @itemx -mdouble-float | |
cd3bb277 JM |
7395 | @opindex msingle-float |
7396 | @opindex mdouble-float | |
630d3d5a | 7397 | The @option{-msingle-float} switch tells gcc to assume that the floating |
74291a4b | 7398 | point coprocessor only supports single precision operations, as on the |
630d3d5a | 7399 | @samp{r4650} chip. The @option{-mdouble-float} switch permits gcc to use |
74291a4b MM |
7400 | double precision operations. This is the default. |
7401 | ||
7402 | @item -mmad | |
7403 | @itemx -mno-mad | |
cd3bb277 JM |
7404 | @opindex mmad |
7405 | @opindex mno-mad | |
74291a4b MM |
7406 | Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions, |
7407 | as on the @samp{r4650} chip. | |
7408 | ||
7409 | @item -m4650 | |
cd3bb277 | 7410 | @opindex m4650 |
630d3d5a JM |
7411 | Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now, |
7412 | @option{-mcpu=r4650}. | |
74291a4b | 7413 | |
8b9243df JJ |
7414 | @item -mips16 |
7415 | @itemx -mno-mips16 | |
cd3bb277 JM |
7416 | @opindex mips16 |
7417 | @opindex mno-mips16 | |
8b9243df JJ |
7418 | Enable 16-bit instructions. |
7419 | ||
7420 | @item -mentry | |
cd3bb277 | 7421 | @opindex mentry |
8b9243df | 7422 | Use the entry and exit pseudo ops. This option can only be used with |
630d3d5a | 7423 | @option{-mips16}. |
8b9243df | 7424 | |
74291a4b | 7425 | @item -EL |
cd3bb277 | 7426 | @opindex EL |
74291a4b MM |
7427 | Compile code for the processor in little endian mode. |
7428 | The requisite libraries are assumed to exist. | |
7429 | ||
7430 | @item -EB | |
cd3bb277 | 7431 | @opindex EB |
74291a4b MM |
7432 | Compile code for the processor in big endian mode. |
7433 | The requisite libraries are assumed to exist. | |
7434 | ||
7435 | @item -G @var{num} | |
cd3bb277 | 7436 | @opindex G |
74291a4b MM |
7437 | @cindex smaller data references (MIPS) |
7438 | @cindex gp-relative references (MIPS) | |
7439 | Put global and static items less than or equal to @var{num} bytes into | |
7440 | the small data or bss sections instead of the normal data or bss | |
7441 | section. This allows the assembler to emit one word memory reference | |
7442 | instructions based on the global pointer (@var{gp} or @var{$28}), | |
7443 | instead of the normal two words used. By default, @var{num} is 8 when | |
7444 | the MIPS assembler is used, and 0 when the GNU assembler is used. The | |
630d3d5a JM |
7445 | @option{-G @var{num}} switch is also passed to the assembler and linker. |
7446 | All modules should be compiled with the same @option{-G @var{num}} | |
74291a4b MM |
7447 | value. |
7448 | ||
7449 | @item -nocpp | |
cd3bb277 | 7450 | @opindex nocpp |
9ec36da5 | 7451 | Tell the MIPS assembler to not run its preprocessor over user |
74291a4b | 7452 | assembler files (with a @samp{.s} suffix) when assembling them. |
63357d93 | 7453 | |
1e387156 | 7454 | @item -mfix7000 |
cd3bb277 | 7455 | @opindex mfix7000 |
1e387156 CM |
7456 | Pass an option to gas which will cause nops to be inserted if |
7457 | the read of the destination register of an mfhi or mflo instruction | |
7458 | occurs in the following two instructions. | |
7459 | ||
63357d93 | 7460 | @item -no-crt0 |
cd3bb277 | 7461 | @opindex no-crt0 |
63357d93 | 7462 | Do not include the default crt0. |
d490e8ad DD |
7463 | |
7464 | @item -mflush-func=@var{func} | |
7465 | @itemx -mno-flush-func | |
7466 | @opindex mflush-func | |
7467 | Specifies the function to call to flush the I and D caches, or to not | |
7468 | call any such function. If called, the function must take the same | |
7469 | arguments as the common @code{_flush_func()}, that is, the address of the | |
7470 | memory range for which the cache is being flushed, the size of the | |
7471 | memory range, and the number 3 (to flush both caches). The default | |
7472 | depends on the target gcc was configured for, but commonly is either | |
7473 | @samp{_flush_func} or @samp{__cpu_flush}. | |
74291a4b MM |
7474 | @end table |
7475 | ||
74291a4b MM |
7476 | These options are defined by the macro |
7477 | @code{TARGET_SWITCHES} in the machine description. The default for the | |
7478 | options is also defined by that macro, which enables you to change the | |
7479 | defaults. | |
74291a4b | 7480 | |
14f73b5a JH |
7481 | @node i386 and x86-64 Options |
7482 | @subsection Intel 386 and AMD x86-64 Options | |
74291a4b | 7483 | @cindex i386 Options |
14f73b5a | 7484 | @cindex x86-64 Options |
74291a4b | 7485 | @cindex Intel 386 Options |
14f73b5a | 7486 | @cindex AMD x86-64 Options |
74291a4b | 7487 | |
14f73b5a JH |
7488 | These @samp{-m} options are defined for the i386 and x86-64 family of |
7489 | computers: | |
74291a4b | 7490 | |
2642624b | 7491 | @table @gcctabopt |
630d3d5a | 7492 | @item -mcpu=@var{cpu-type} |
cd3bb277 | 7493 | @opindex mcpu |
0dd0e980 JH |
7494 | Tune to @var{cpu-type} everything applicable about the generated code, except |
7495 | for the ABI and the set of available instructions. The choices for | |
7496 | @var{cpu-type} are @samp{i386}, @samp{i486}, @samp{i586}, @samp{i686}, | |
7497 | @samp{pentium}, @samp{pentium-mmx}, @samp{pentiumpro}, @samp{pentium2}, | |
7498 | @samp{pentium3}, @samp{pentium4}, @samp{k6}, @samp{k6-2}, @samp{k6-3}, | |
7499 | @samp{athlon}, @samp{athlon-tbird}, @samp{athlon-4}, @samp{athlon-xp} | |
7500 | and @samp{athlon-mp}. | |
6f670fde | 7501 | |
630d3d5a | 7502 | While picking a specific @var{cpu-type} will schedule things appropriately |
6f670fde | 7503 | for that particular chip, the compiler will not generate any code that |
630d3d5a | 7504 | does not run on the i386 without the @option{-march=@var{cpu-type}} option |
7001ee2d | 7505 | being used. @samp{i586} is equivalent to @samp{pentium} and @samp{i686} |
6ca3ad1b | 7506 | is equivalent to @samp{pentiumpro}. @samp{k6} and @samp{athlon} are the |
b4e89e2d | 7507 | AMD chips as opposed to the Intel ones. |
a9f3e1a4 | 7508 | |
630d3d5a | 7509 | @item -march=@var{cpu-type} |
cd3bb277 | 7510 | @opindex march |
630d3d5a JM |
7511 | Generate instructions for the machine type @var{cpu-type}. The choices |
7512 | for @var{cpu-type} are the same as for @option{-mcpu}. Moreover, | |
7513 | specifying @option{-march=@var{cpu-type}} implies @option{-mcpu=@var{cpu-type}}. | |
a9f3e1a4 JL |
7514 | |
7515 | @item -m386 | |
7516 | @itemx -m486 | |
7517 | @itemx -mpentium | |
7518 | @itemx -mpentiumpro | |
cd3bb277 JM |
7519 | @opindex m386 |
7520 | @opindex m486 | |
7521 | @opindex mpentium | |
7522 | @opindex mpentiumpro | |
9c34dbbf ZW |
7523 | These options are synonyms for @option{-mcpu=i386}, @option{-mcpu=i486}, |
7524 | @option{-mcpu=pentium}, and @option{-mcpu=pentiumpro} respectively. | |
7525 | These synonyms are deprecated. | |
74291a4b | 7526 | |
965f5423 JH |
7527 | @item -mfpmath=@var{unit} |
7528 | @opindex march | |
7529 | generate floating point arithmetics for selected unit @var{unit}. the choices | |
7530 | for @var{unit} are: | |
7531 | ||
7532 | @table @samp | |
7533 | @item 387 | |
7534 | Use the standard 387 floating point coprocessor present majority of chips and | |
7535 | emulated otherwise. Code compiled with this option will run almost everywhere. | |
7536 | The temporary results are computed in 80bit precesion instead of precision | |
7537 | specified by the type resulting in slightly different results compared to most | |
7538 | of other chips. See @option{-ffloat-store} for more detailed description. | |
7539 | ||
7540 | This is the default choice for i386 compiler. | |
7541 | ||
7542 | @item sse | |
7543 | Use scalar floating point instructions present in the SSE instruction set. | |
7544 | This instruction set is supported by Pentium3 and newer chips, in the AMD line | |
7545 | by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE | |
7546 | instruction set supports only single precision arithmetics, thus the double and | |
7547 | extended precision arithmetics is still done using 387. Later version, present | |
7548 | only in Pentium4 and the future AMD x86-64 chips supports double precision | |
7549 | arithmetics too. | |
7550 | ||
7551 | For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or | |
7552 | @option{-msse2} switches to enable SSE extensions and make this option | |
7553 | effective. For x86-64 compiler, these extensions are enabled by default. | |
7554 | ||
7555 | The resulting code should be considerably faster in majority of cases and avoid | |
7556 | the numerical instability problems of 387 code, but may break some existing | |
7557 | code that expects temporaries to be 80bit. | |
7558 | ||
7559 | This is the default choice for x86-64 compiler. | |
7560 | ||
7561 | @item sse,387 | |
7562 | Attempt to utilize both instruction sets at once. This effectivly double the | |
7563 | amount of available registers and on chips with separate execution units for | |
7564 | 387 and SSE the execution resources too. Use this option with care, as it is | |
7565 | still experimental, because gcc register allocator does not model separate | |
7566 | functional units well resulting in instable performance. | |
7567 | @end table | |
7568 | ||
c93e80a5 JH |
7569 | @item -masm=@var{dialect} |
7570 | @opindex masm=@var{dialect} | |
7571 | Output asm instructions using selected @var{dialect}. Supported choices are | |
7572 | @samp{intel} or @samp{att} (the default one). | |
04e149ab | 7573 | |
74291a4b MM |
7574 | @item -mieee-fp |
7575 | @itemx -mno-ieee-fp | |
cd3bb277 JM |
7576 | @opindex mieee-fp |
7577 | @opindex mno-ieee-fp | |
74291a4b MM |
7578 | Control whether or not the compiler uses IEEE floating point |
7579 | comparisons. These handle correctly the case where the result of a | |
7580 | comparison is unordered. | |
7581 | ||
7582 | @item -msoft-float | |
cd3bb277 | 7583 | @opindex msoft-float |
74291a4b | 7584 | Generate output containing library calls for floating point. |
161d7b59 | 7585 | @strong{Warning:} the requisite libraries are not part of GCC@. |
74291a4b MM |
7586 | Normally the facilities of the machine's usual C compiler are used, but |
7587 | this can't be done directly in cross-compilation. You must make your | |
7588 | own arrangements to provide suitable library functions for | |
7589 | cross-compilation. | |
7590 | ||
7591 | On machines where a function returns floating point results in the 80387 | |
7592 | register stack, some floating point opcodes may be emitted even if | |
630d3d5a | 7593 | @option{-msoft-float} is used. |
74291a4b MM |
7594 | |
7595 | @item -mno-fp-ret-in-387 | |
cd3bb277 | 7596 | @opindex mno-fp-ret-in-387 |
74291a4b MM |
7597 | Do not use the FPU registers for return values of functions. |
7598 | ||
7599 | The usual calling convention has functions return values of types | |
7600 | @code{float} and @code{double} in an FPU register, even if there | |
161d7b59 JM |
7601 | is no FPU@. The idea is that the operating system should emulate |
7602 | an FPU@. | |
74291a4b | 7603 | |
630d3d5a | 7604 | The option @option{-mno-fp-ret-in-387} causes such values to be returned |
74291a4b MM |
7605 | in ordinary CPU registers instead. |
7606 | ||
7607 | @item -mno-fancy-math-387 | |
cd3bb277 | 7608 | @opindex mno-fancy-math-387 |
74291a4b MM |
7609 | Some 387 emulators do not support the @code{sin}, @code{cos} and |
7610 | @code{sqrt} instructions for the 387. Specify this option to avoid | |
161d7b59 | 7611 | generating those instructions. This option is the default on FreeBSD@. |
74291a4b | 7612 | As of revision 2.6.1, these instructions are not generated unless you |
630d3d5a | 7613 | also use the @option{-funsafe-math-optimizations} switch. |
74291a4b MM |
7614 | |
7615 | @item -malign-double | |
7616 | @itemx -mno-align-double | |
cd3bb277 JM |
7617 | @opindex malign-double |
7618 | @opindex mno-align-double | |
0c2d1a2a | 7619 | Control whether GCC aligns @code{double}, @code{long double}, and |
74291a4b MM |
7620 | @code{long long} variables on a two word boundary or a one word |
7621 | boundary. Aligning @code{double} variables on a two word boundary will | |
7622 | produce code that runs somewhat faster on a @samp{Pentium} at the | |
7623 | expense of more memory. | |
7624 | ||
2b589241 | 7625 | @item -m128bit-long-double |
cd3bb277 | 7626 | @opindex m128bit-long-double |
2b589241 JH |
7627 | Control the size of @code{long double} type. i386 application binary interface |
7628 | specify the size to be 12 bytes, while modern architectures (Pentium and newer) | |
c771326b | 7629 | prefer @code{long double} aligned to 8 or 16 byte boundary. This is |
2b589241 JH |
7630 | impossible to reach with 12 byte long doubles in the array accesses. |
7631 | ||
630d3d5a | 7632 | @strong{Warning:} if you use the @option{-m128bit-long-double} switch, the |
2b589241 JH |
7633 | structures and arrays containing @code{long double} will change their size as |
7634 | well as function calling convention for function taking @code{long double} | |
02f52e19 | 7635 | will be modified. |
2b589241 JH |
7636 | |
7637 | @item -m96bit-long-double | |
cd3bb277 | 7638 | @opindex m96bit-long-double |
0a75e5c3 | 7639 | Set the size of @code{long double} to 96 bits as required by the i386 |
2b589241 | 7640 | application binary interface. This is the default. |
74291a4b MM |
7641 | |
7642 | @item -msvr3-shlib | |
7643 | @itemx -mno-svr3-shlib | |
cd3bb277 JM |
7644 | @opindex msvr3-shlib |
7645 | @opindex mno-svr3-shlib | |
9c34dbbf ZW |
7646 | Control whether GCC places uninitialized local variables into the |
7647 | @code{bss} or @code{data} segments. @option{-msvr3-shlib} places them | |
7648 | into @code{bss}. These options are meaningful only on System V Release 3. | |
74291a4b | 7649 | |
74291a4b | 7650 | @item -mrtd |
cd3bb277 | 7651 | @opindex mrtd |
74291a4b MM |
7652 | Use a different function-calling convention, in which functions that |
7653 | take a fixed number of arguments return with the @code{ret} @var{num} | |
7654 | instruction, which pops their arguments while returning. This saves one | |
7655 | instruction in the caller since there is no need to pop the arguments | |
7656 | there. | |
7657 | ||
7658 | You can specify that an individual function is called with this calling | |
7659 | sequence with the function attribute @samp{stdcall}. You can also | |
630d3d5a | 7660 | override the @option{-mrtd} option by using the function attribute |
0b433de6 | 7661 | @samp{cdecl}. @xref{Function Attributes}. |
74291a4b MM |
7662 | |
7663 | @strong{Warning:} this calling convention is incompatible with the one | |
7664 | normally used on Unix, so you cannot use it if you need to call | |
7665 | libraries compiled with the Unix compiler. | |
7666 | ||
7667 | Also, you must provide function prototypes for all functions that | |
7668 | take variable numbers of arguments (including @code{printf}); | |
7669 | otherwise incorrect code will be generated for calls to those | |
7670 | functions. | |
7671 | ||
7672 | In addition, seriously incorrect code will result if you call a | |
7673 | function with too many arguments. (Normally, extra arguments are | |
7674 | harmlessly ignored.) | |
7675 | ||
74291a4b | 7676 | @item -mregparm=@var{num} |
cd3bb277 | 7677 | @opindex mregparm |
74291a4b MM |
7678 | Control how many registers are used to pass integer arguments. By |
7679 | default, no registers are used to pass arguments, and at most 3 | |
7680 | registers can be used. You can control this behavior for a specific | |
0b433de6 JL |
7681 | function by using the function attribute @samp{regparm}. |
7682 | @xref{Function Attributes}. | |
74291a4b MM |
7683 | |
7684 | @strong{Warning:} if you use this switch, and | |
7685 | @var{num} is nonzero, then you must build all modules with the same | |
7686 | value, including any libraries. This includes the system libraries and | |
7687 | startup modules. | |
7688 | ||
3af4bd89 | 7689 | @item -mpreferred-stack-boundary=@var{num} |
cd3bb277 | 7690 | @opindex mpreferred-stack-boundary |
3af4bd89 | 7691 | Attempt to keep the stack boundary aligned to a 2 raised to @var{num} |
630d3d5a | 7692 | byte boundary. If @option{-mpreferred-stack-boundary} is not specified, |
fbb83b43 AO |
7693 | the default is 4 (16 bytes or 128 bits), except when optimizing for code |
7694 | size (@option{-Os}), in which case the default is the minimum correct | |
7695 | alignment (4 bytes for x86, and 8 bytes for x86-64). | |
3af4bd89 | 7696 | |
fbb83b43 AO |
7697 | On Pentium and PentiumPro, @code{double} and @code{long double} values |
7698 | should be aligned to an 8 byte boundary (see @option{-malign-double}) or | |
7699 | suffer significant run time performance penalties. On Pentium III, the | |
b192711e | 7700 | Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar |
3af4bd89 JH |
7701 | penalties if it is not 16 byte aligned. |
7702 | ||
7703 | To ensure proper alignment of this values on the stack, the stack boundary | |
02f52e19 | 7704 | must be as aligned as that required by any value stored on the stack. |
3af4bd89 JH |
7705 | Further, every function must be generated such that it keeps the stack |
7706 | aligned. Thus calling a function compiled with a higher preferred | |
7707 | stack boundary from a function compiled with a lower preferred stack | |
7708 | boundary will most likely misalign the stack. It is recommended that | |
7709 | libraries that use callbacks always use the default setting. | |
7710 | ||
fbb83b43 AO |
7711 | This extra alignment does consume extra stack space, and generally |
7712 | increases code size. Code that is sensitive to stack space usage, such | |
7713 | as embedded systems and operating system kernels, may want to reduce the | |
7714 | preferred alignment to @option{-mpreferred-stack-boundary=2}. | |
f22a97d2 | 7715 | |
1255c85c BS |
7716 | @item -mmmx |
7717 | @itemx -mno-mmx | |
7718 | @item -msse | |
7719 | @itemx -mno-sse | |
965f5423 JH |
7720 | @item -msse2 |
7721 | @itemx -mno-sse2 | |
1255c85c BS |
7722 | @item -m3dnow |
7723 | @itemx -mno-3dnow | |
7724 | @opindex mmmx | |
7725 | @opindex mno-mmx | |
7726 | @opindex msse | |
7727 | @opindex mno-sse | |
7728 | @opindex m3dnow | |
7729 | @opindex mno-3dnow | |
7730 | These switches enable or disable the use of built-in functions that allow | |
7731 | direct access to the MMX, SSE and 3Dnow extensions of the instruction set. | |
7732 | ||
80ebf43e | 7733 | The following machine modes are available for use with MMX built-in functions |
1255c85c BS |
7734 | (@pxref{Vector Extensions}): @code{V2SI} for a vector of two 32 bit integers, |
7735 | @code{V4HI} for a vector of four 16 bit integers, and @code{V8QI} for a | |
80ebf43e BS |
7736 | vector of eight 8 bit integers. Some of the built-in functions operate on |
7737 | MMX registers as a whole 64 bit entity, these use @code{DI} as their mode. | |
1255c85c BS |
7738 | |
7739 | If 3Dnow extensions are enabled, @code{V2SF} is used as a mode for a vector | |
7740 | of two 32 bit floating point values. | |
7741 | ||
7742 | If SSE extensions are enabled, @code{V4SF} is used for a vector of four 32 bit | |
7743 | floating point values. Some instructions use a vector of four 32 bit | |
7744 | integers, these use @code{V4SI}. Finally, some instructions operate on an | |
7745 | entire vector register, interpreting it as a 128 bit integer, these use mode | |
7746 | @code{TI}. | |
7747 | ||
7cbe9bb7 RH |
7748 | The following built-in functions are made available by @option{-mmmx}. |
7749 | All of them generate the machine instruction that is part of the name. | |
1255c85c | 7750 | |
7cbe9bb7 RH |
7751 | @example |
7752 | v8qi __builtin_ia32_paddb (v8qi, v8qi) | |
7753 | v4hi __builtin_ia32_paddw (v4hi, v4hi) | |
7754 | v2si __builtin_ia32_paddd (v2si, v2si) | |
7755 | v8qi __builtin_ia32_psubb (v8qi, v8qi) | |
7756 | v4hi __builtin_ia32_psubw (v4hi, v4hi) | |
7757 | v2si __builtin_ia32_psubd (v2si, v2si) | |
7758 | v8qi __builtin_ia32_paddsb (v8qi, v8qi) | |
7759 | v4hi __builtin_ia32_paddsw (v4hi, v4hi) | |
7760 | v8qi __builtin_ia32_psubsb (v8qi, v8qi) | |
7761 | v4hi __builtin_ia32_psubsw (v4hi, v4hi) | |
7762 | v8qi __builtin_ia32_paddusb (v8qi, v8qi) | |
7763 | v4hi __builtin_ia32_paddusw (v4hi, v4hi) | |
7764 | v8qi __builtin_ia32_psubusb (v8qi, v8qi) | |
7765 | v4hi __builtin_ia32_psubusw (v4hi, v4hi) | |
7766 | v4hi __builtin_ia32_pmullw (v4hi, v4hi) | |
7767 | v4hi __builtin_ia32_pmulhw (v4hi, v4hi) | |
7768 | di __builtin_ia32_pand (di, di) | |
7769 | di __builtin_ia32_pandn (di,di) | |
7770 | di __builtin_ia32_por (di, di) | |
7771 | di __builtin_ia32_pxor (di, di) | |
7772 | v8qi __builtin_ia32_pcmpeqb (v8qi, v8qi) | |
7773 | v4hi __builtin_ia32_pcmpeqw (v4hi, v4hi) | |
7774 | v2si __builtin_ia32_pcmpeqd (v2si, v2si) | |
7775 | v8qi __builtin_ia32_pcmpgtb (v8qi, v8qi) | |
7776 | v4hi __builtin_ia32_pcmpgtw (v4hi, v4hi) | |
7777 | v2si __builtin_ia32_pcmpgtd (v2si, v2si) | |
7778 | v8qi __builtin_ia32_punpckhbw (v8qi, v8qi) | |
7779 | v4hi __builtin_ia32_punpckhwd (v4hi, v4hi) | |
7780 | v2si __builtin_ia32_punpckhdq (v2si, v2si) | |
7781 | v8qi __builtin_ia32_punpcklbw (v8qi, v8qi) | |
7782 | v4hi __builtin_ia32_punpcklwd (v4hi, v4hi) | |
7783 | v2si __builtin_ia32_punpckldq (v2si, v2si) | |
7784 | v8qi __builtin_ia32_packsswb (v4hi, v4hi) | |
7785 | v4hi __builtin_ia32_packssdw (v2si, v2si) | |
7786 | v8qi __builtin_ia32_packuswb (v4hi, v4hi) | |
7787 | @end example | |
1255c85c | 7788 | |
7cbe9bb7 RH |
7789 | The following built-in functions are made available either with |
7790 | @option{-msse}, or with a combination of @option{-m3dnow} and | |
7791 | @option{-march=athlon}. All of them generate the machine | |
7792 | instruction that is part of the name. | |
7793 | ||
7794 | @example | |
7795 | v4hi __builtin_ia32_pmulhuw (v4hi, v4hi) | |
7796 | v8qi __builtin_ia32_pavgb (v8qi, v8qi) | |
7797 | v4hi __builtin_ia32_pavgw (v4hi, v4hi) | |
7798 | v4hi __builtin_ia32_psadbw (v8qi, v8qi) | |
7799 | v8qi __builtin_ia32_pmaxub (v8qi, v8qi) | |
7800 | v4hi __builtin_ia32_pmaxsw (v4hi, v4hi) | |
7801 | v8qi __builtin_ia32_pminub (v8qi, v8qi) | |
7802 | v4hi __builtin_ia32_pminsw (v4hi, v4hi) | |
7803 | int __builtin_ia32_pextrw (v4hi, int) | |
7804 | v4hi __builtin_ia32_pinsrw (v4hi, int, int) | |
7805 | int __builtin_ia32_pmovmskb (v8qi) | |
7806 | void __builtin_ia32_maskmovq (v8qi, v8qi, char *) | |
7807 | void __builtin_ia32_movntq (di *, di) | |
7808 | void __builtin_ia32_sfence (void) | |
7809 | @end example | |
1255c85c | 7810 | |
7cbe9bb7 RH |
7811 | The following built-in functions are available when @option{-msse} is used. |
7812 | All of them generate the machine instruction that is part of the name. | |
1255c85c | 7813 | |
7cbe9bb7 RH |
7814 | @example |
7815 | int __builtin_ia32_comieq (v4sf, v4sf) | |
7816 | int __builtin_ia32_comineq (v4sf, v4sf) | |
7817 | int __builtin_ia32_comilt (v4sf, v4sf) | |
7818 | int __builtin_ia32_comile (v4sf, v4sf) | |
7819 | int __builtin_ia32_comigt (v4sf, v4sf) | |
7820 | int __builtin_ia32_comige (v4sf, v4sf) | |
7821 | int __builtin_ia32_ucomieq (v4sf, v4sf) | |
7822 | int __builtin_ia32_ucomineq (v4sf, v4sf) | |
7823 | int __builtin_ia32_ucomilt (v4sf, v4sf) | |
7824 | int __builtin_ia32_ucomile (v4sf, v4sf) | |
7825 | int __builtin_ia32_ucomigt (v4sf, v4sf) | |
7826 | int __builtin_ia32_ucomige (v4sf, v4sf) | |
7827 | v4sf __builtin_ia32_addps (v4sf, v4sf) | |
7828 | v4sf __builtin_ia32_subps (v4sf, v4sf) | |
7829 | v4sf __builtin_ia32_mulps (v4sf, v4sf) | |
7830 | v4sf __builtin_ia32_divps (v4sf, v4sf) | |
7831 | v4sf __builtin_ia32_addss (v4sf, v4sf) | |
7832 | v4sf __builtin_ia32_subss (v4sf, v4sf) | |
7833 | v4sf __builtin_ia32_mulss (v4sf, v4sf) | |
7834 | v4sf __builtin_ia32_divss (v4sf, v4sf) | |
7835 | v4si __builtin_ia32_cmpeqps (v4sf, v4sf) | |
7836 | v4si __builtin_ia32_cmpltps (v4sf, v4sf) | |
7837 | v4si __builtin_ia32_cmpleps (v4sf, v4sf) | |
7838 | v4si __builtin_ia32_cmpgtps (v4sf, v4sf) | |
7839 | v4si __builtin_ia32_cmpgeps (v4sf, v4sf) | |
7840 | v4si __builtin_ia32_cmpunordps (v4sf, v4sf) | |
7841 | v4si __builtin_ia32_cmpneqps (v4sf, v4sf) | |
7842 | v4si __builtin_ia32_cmpnltps (v4sf, v4sf) | |
7843 | v4si __builtin_ia32_cmpnleps (v4sf, v4sf) | |
7844 | v4si __builtin_ia32_cmpngtps (v4sf, v4sf) | |
7845 | v4si __builtin_ia32_cmpngeps (v4sf, v4sf) | |
7846 | v4si __builtin_ia32_cmpordps (v4sf, v4sf) | |
7847 | v4si __builtin_ia32_cmpeqss (v4sf, v4sf) | |
7848 | v4si __builtin_ia32_cmpltss (v4sf, v4sf) | |
7849 | v4si __builtin_ia32_cmpless (v4sf, v4sf) | |
7850 | v4si __builtin_ia32_cmpgtss (v4sf, v4sf) | |
7851 | v4si __builtin_ia32_cmpgess (v4sf, v4sf) | |
7852 | v4si __builtin_ia32_cmpunordss (v4sf, v4sf) | |
7853 | v4si __builtin_ia32_cmpneqss (v4sf, v4sf) | |
7854 | v4si __builtin_ia32_cmpnlts (v4sf, v4sf) | |
7855 | v4si __builtin_ia32_cmpnless (v4sf, v4sf) | |
7856 | v4si __builtin_ia32_cmpngtss (v4sf, v4sf) | |
7857 | v4si __builtin_ia32_cmpngess (v4sf, v4sf) | |
7858 | v4si __builtin_ia32_cmpordss (v4sf, v4sf) | |
7859 | v4sf __builtin_ia32_maxps (v4sf, v4sf) | |
7860 | v4sf __builtin_ia32_maxss (v4sf, v4sf) | |
7861 | v4sf __builtin_ia32_minps (v4sf, v4sf) | |
7862 | v4sf __builtin_ia32_minss (v4sf, v4sf) | |
7863 | v4sf __builtin_ia32_andps (v4sf, v4sf) | |
7864 | v4sf __builtin_ia32_andnps (v4sf, v4sf) | |
7865 | v4sf __builtin_ia32_orps (v4sf, v4sf) | |
7866 | v4sf __builtin_ia32_xorps (v4sf, v4sf) | |
7867 | v4sf __builtin_ia32_movss (v4sf, v4sf) | |
7868 | v4sf __builtin_ia32_movhlps (v4sf, v4sf) | |
7869 | v4sf __builtin_ia32_movlhps (v4sf, v4sf) | |
7870 | v4sf __builtin_ia32_unpckhps (v4sf, v4sf) | |
7871 | v4sf __builtin_ia32_unpcklps (v4sf, v4sf) | |
7872 | v4sf __builtin_ia32_cvtpi2ps (v4sf, v2si) | |
7873 | v4sf __builtin_ia32_cvtsi2ss (v4sf, int) | |
7874 | v2si __builtin_ia32_cvtps2pi (v4sf) | |
7875 | int __builtin_ia32_cvtss2si (v4sf) | |
7876 | v2si __builtin_ia32_cvttps2pi (v4sf) | |
7877 | int __builtin_ia32_cvttss2si (v4sf) | |
7878 | v4sf __builtin_ia32_rcpps (v4sf) | |
7879 | v4sf __builtin_ia32_rsqrtps (v4sf) | |
7880 | v4sf __builtin_ia32_sqrtps (v4sf) | |
7881 | v4sf __builtin_ia32_rcpss (v4sf) | |
7882 | v4sf __builtin_ia32_rsqrtss (v4sf) | |
7883 | v4sf __builtin_ia32_sqrtss (v4sf) | |
7884 | v4sf __builtin_ia32_shufps (v4sf, v4sf, int) | |
7885 | void __builtin_ia32_movntps (float *, v4sf) | |
7886 | int __builtin_ia32_movmskps (v4sf) | |
7887 | @end example | |
1255c85c | 7888 | |
80ebf43e | 7889 | The following built-in functions are available when @option{-msse} is used. |
1255c85c BS |
7890 | |
7891 | @table @code | |
acb0aa65 | 7892 | @item v4sf __builtin_ia32_loadaps (float *) |
1255c85c | 7893 | Generates the @code{movaps} machine instruction as a load from memory. |
acb0aa65 | 7894 | @item void __builtin_ia32_storeaps (float *, v4sf) |
1255c85c | 7895 | Generates the @code{movaps} machine instruction as a store to memory. |
acb0aa65 | 7896 | @item v4sf __builtin_ia32_loadups (float *) |
1255c85c | 7897 | Generates the @code{movups} machine instruction as a load from memory. |
acb0aa65 | 7898 | @item void __builtin_ia32_storeups (float *, v4sf) |
1255c85c | 7899 | Generates the @code{movups} machine instruction as a store to memory. |
acb0aa65 | 7900 | @item v4sf __builtin_ia32_loadsss (float *) |
1255c85c | 7901 | Generates the @code{movss} machine instruction as a load from memory. |
acb0aa65 | 7902 | @item void __builtin_ia32_storess (float *, v4sf) |
1255c85c | 7903 | Generates the @code{movss} machine instruction as a store to memory. |
acb0aa65 | 7904 | @item v4sf __builtin_ia32_loadhps (v4sf, v2si *) |
1255c85c | 7905 | Generates the @code{movhps} machine instruction as a load from memory. |
acb0aa65 | 7906 | @item v4sf __builtin_ia32_loadlps (v4sf, v2si *) |
1255c85c | 7907 | Generates the @code{movlps} machine instruction as a load from memory |
acb0aa65 | 7908 | @item void __builtin_ia32_storehps (v4sf, v2si *) |
1255c85c | 7909 | Generates the @code{movhps} machine instruction as a store to memory. |
acb0aa65 | 7910 | @item void __builtin_ia32_storelps (v4sf, v2si *) |
1255c85c | 7911 | Generates the @code{movlps} machine instruction as a store to memory. |
7cbe9bb7 | 7912 | @end table |
1255c85c | 7913 | |
7cbe9bb7 RH |
7914 | The following built-in functions are available when @option{-m3dnow} is used. |
7915 | All of them generate the machine instruction that is part of the name. | |
1255c85c | 7916 | |
7cbe9bb7 RH |
7917 | @example |
7918 | void __builtin_ia32_femms (void) | |
7919 | v8qi __builtin_ia32_pavgusb (v8qi, v8qi) | |
7920 | v2si __builtin_ia32_pf2id (v2sf) | |
7921 | v2sf __builtin_ia32_pfacc (v2sf, v2sf) | |
7922 | v2sf __builtin_ia32_pfadd (v2sf, v2sf) | |
7923 | v2si __builtin_ia32_pfcmpeq (v2sf, v2sf) | |
7924 | v2si __builtin_ia32_pfcmpge (v2sf, v2sf) | |
7925 | v2si __builtin_ia32_pfcmpgt (v2sf, v2sf) | |
7926 | v2sf __builtin_ia32_pfmax (v2sf, v2sf) | |
7927 | v2sf __builtin_ia32_pfmin (v2sf, v2sf) | |
7928 | v2sf __builtin_ia32_pfmul (v2sf, v2sf) | |
7929 | v2sf __builtin_ia32_pfrcp (v2sf) | |
7930 | v2sf __builtin_ia32_pfrcpit1 (v2sf, v2sf) | |
7931 | v2sf __builtin_ia32_pfrcpit2 (v2sf, v2sf) | |
7932 | v2sf __builtin_ia32_pfrsqrt (v2sf) | |
7933 | v2sf __builtin_ia32_pfrsqrtit1 (v2sf, v2sf) | |
7934 | v2sf __builtin_ia32_pfsub (v2sf, v2sf) | |
7935 | v2sf __builtin_ia32_pfsubr (v2sf, v2sf) | |
7936 | v2sf __builtin_ia32_pi2fd (v2si) | |
7937 | v4hi __builtin_ia32_pmulhrw (v4hi, v4hi) | |
7938 | @end example | |
7939 | ||
7940 | The following built-in functions are available when both @option{-m3dnow} | |
7941 | and @option{-march=athlon} are used. All of them generate the machine | |
7942 | instruction that is part of the name. | |
7943 | ||
7944 | @example | |
7945 | v2si __builtin_ia32_pf2iw (v2sf) | |
7946 | v2sf __builtin_ia32_pfnacc (v2sf, v2sf) | |
7947 | v2sf __builtin_ia32_pfpnacc (v2sf, v2sf) | |
7948 | v2sf __builtin_ia32_pi2fw (v2si) | |
7949 | v2sf __builtin_ia32_pswapdsf (v2sf) | |
7950 | v2si __builtin_ia32_pswapdsi (v2si) | |
7951 | @end example | |
1255c85c | 7952 | |
f73ad30e | 7953 | @item -mpush-args |
a7939b1d | 7954 | @itemx -mno-push-args |
cd3bb277 | 7955 | @opindex mpush-args |
a7939b1d | 7956 | @opindex mno-push-args |
767094dd | 7957 | Use PUSH operations to store outgoing parameters. This method is shorter |
f73ad30e | 7958 | and usually equally fast as method using SUB/MOV operations and is enabled |
767094dd | 7959 | by default. In some cases disabling it may improve performance because of |
f73ad30e JH |
7960 | improved scheduling and reduced dependencies. |
7961 | ||
7962 | @item -maccumulate-outgoing-args | |
cd3bb277 | 7963 | @opindex maccumulate-outgoing-args |
f73ad30e | 7964 | If enabled, the maximum amount of space required for outgoing arguments will be |
a7939b1d | 7965 | computed in the function prologue. This is faster on most modern CPUs |
b192711e | 7966 | because of reduced dependencies, improved scheduling and reduced stack usage |
f73ad30e | 7967 | when preferred stack boundary is not equal to 2. The drawback is a notable |
767094dd | 7968 | increase in code size. This switch implies @option{-mno-push-args}. |
f73ad30e | 7969 | |
f22a97d2 | 7970 | @item -mthreads |
cd3bb277 | 7971 | @opindex mthreads |
767094dd | 7972 | Support thread-safe exception handling on @samp{Mingw32}. Code that relies |
02f52e19 | 7973 | on thread-safe exception handling must compile and link all code with the |
767094dd | 7974 | @option{-mthreads} option. When compiling, @option{-mthreads} defines |
630d3d5a JM |
7975 | @option{-D_MT}; when linking, it links in a special thread helper library |
7976 | @option{-lmingwthrd} which cleans up per thread exception handling data. | |
79f05c19 JH |
7977 | |
7978 | @item -mno-align-stringops | |
cd3bb277 | 7979 | @opindex mno-align-stringops |
767094dd | 7980 | Do not align destination of inlined string operations. This switch reduces |
79f05c19 JH |
7981 | code size and improves performance in case the destination is already aligned, |
7982 | but gcc don't know about it. | |
7983 | ||
7984 | @item -minline-all-stringops | |
cd3bb277 | 7985 | @opindex minline-all-stringops |
79f05c19 | 7986 | By default GCC inlines string operations only when destination is known to be |
767094dd | 7987 | aligned at least to 4 byte boundary. This enables more inlining, increase code |
79f05c19 JH |
7988 | size, but may improve performance of code that depends on fast memcpy, strlen |
7989 | and memset for short lengths. | |
762e166b AJ |
7990 | |
7991 | @item -momit-leaf-frame-pointer | |
cd3bb277 | 7992 | @opindex momit-leaf-frame-pointer |
762e166b AJ |
7993 | Don't keep the frame pointer in a register for leaf functions. This |
7994 | avoids the instructions to save, set up and restore frame pointers and | |
7995 | makes an extra register available in leaf functions. The option | |
630d3d5a | 7996 | @option{-fomit-frame-pointer} removes the frame pointer for all functions |
762e166b | 7997 | which might make debugging harder. |
3af4bd89 JH |
7998 | @end table |
7999 | ||
14f73b5a JH |
8000 | These @samp{-m} switches are supported in addition to the above |
8001 | on AMD x86-64 processors in 64-bit environments. | |
8002 | ||
8003 | @table @gcctabopt | |
8004 | @item -m32 | |
8005 | @itemx -m64 | |
8006 | @opindex m32 | |
8007 | @opindex m64 | |
8008 | Generate code for a 32-bit or 64-bit environment. | |
8009 | The 32-bit environment sets int, long and pointer to 32 bits and | |
8010 | generates code that runs on any i386 system. | |
8011 | The 64-bit environment sets int to 32 bits and long and pointer | |
8012 | to 64 bits and generates code for AMD's x86-64 architecture. | |
8013 | ||
8014 | @item -mno-red-zone | |
8015 | @opindex no-red-zone | |
8016 | Do not use a so called red zone for x86-64 code. The red zone is mandated | |
8017 | by the x86-64 ABI, it is a 128-byte area beyond the location of the | |
8018 | stack pointer that will not be modified by signal or interrupt handlers | |
8019 | and therefore can be used for temporary data without adjusting the stack | |
8020 | pointer. The flag @option{-mno-red-zone} disables this red zone. | |
8021 | @end table | |
8022 | ||
74291a4b MM |
8023 | @node HPPA Options |
8024 | @subsection HPPA Options | |
8025 | @cindex HPPA Options | |
8026 | ||
8027 | These @samp{-m} options are defined for the HPPA family of computers: | |
8028 | ||
2642624b | 8029 | @table @gcctabopt |
630d3d5a | 8030 | @item -march=@var{architecture-type} |
cd3bb277 | 8031 | @opindex march |
ea3bfbfe | 8032 | Generate code for the specified architecture. The choices for |
630d3d5a | 8033 | @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA |
ea3bfbfe JQ |
8034 | 1.1, and @samp{2.0} for PA 2.0 processors. Refer to |
8035 | @file{/usr/lib/sched.models} on an HP-UX system to determine the proper | |
8036 | architecture option for your machine. Code compiled for lower numbered | |
8037 | architectures will run on higher numbered architectures, but not the | |
8038 | other way around. | |
8039 | ||
8040 | PA 2.0 support currently requires gas snapshot 19990413 or later. The | |
8041 | next release of binutils (current is 2.9.1) will probably contain PA 2.0 | |
02f52e19 | 8042 | support. |
74291a4b | 8043 | |
ea3bfbfe | 8044 | @item -mpa-risc-1-0 |
62a1403d AS |
8045 | @itemx -mpa-risc-1-1 |
8046 | @itemx -mpa-risc-2-0 | |
cd3bb277 JM |
8047 | @opindex mpa-risc-1-0 |
8048 | @opindex mpa-risc-1-1 | |
8049 | @opindex mpa-risc-2-0 | |
695ac33f | 8050 | Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. |
74291a4b | 8051 | |
861bb6c1 | 8052 | @item -mbig-switch |
cd3bb277 | 8053 | @opindex mbig-switch |
861bb6c1 JL |
8054 | Generate code suitable for big switch tables. Use this option only if |
8055 | the assembler/linker complain about out of range branches within a switch | |
8056 | table. | |
8057 | ||
74291a4b | 8058 | @item -mjump-in-delay |
cd3bb277 | 8059 | @opindex mjump-in-delay |
74291a4b MM |
8060 | Fill delay slots of function calls with unconditional jump instructions |
8061 | by modifying the return pointer for the function call to be the target | |
8062 | of the conditional jump. | |
8063 | ||
8064 | @item -mdisable-fpregs | |
cd3bb277 | 8065 | @opindex mdisable-fpregs |
74291a4b MM |
8066 | Prevent floating point registers from being used in any manner. This is |
8067 | necessary for compiling kernels which perform lazy context switching of | |
8068 | floating point registers. If you use this option and attempt to perform | |
8069 | floating point operations, the compiler will abort. | |
8070 | ||
8071 | @item -mdisable-indexing | |
cd3bb277 | 8072 | @opindex mdisable-indexing |
74291a4b | 8073 | Prevent the compiler from using indexing address modes. This avoids some |
161d7b59 | 8074 | rather obscure problems when compiling MIG generated code under MACH@. |
74291a4b MM |
8075 | |
8076 | @item -mno-space-regs | |
cd3bb277 | 8077 | @opindex mno-space-regs |
74291a4b MM |
8078 | Generate code that assumes the target has no space registers. This allows |
8079 | GCC to generate faster indirect calls and use unscaled index address modes. | |
8080 | ||
8081 | Such code is suitable for level 0 PA systems and kernels. | |
8082 | ||
8083 | @item -mfast-indirect-calls | |
cd3bb277 | 8084 | @opindex mfast-indirect-calls |
74291a4b MM |
8085 | Generate code that assumes calls never cross space boundaries. This |
8086 | allows GCC to emit code which performs faster indirect calls. | |
8087 | ||
b192711e | 8088 | This option will not work in the presence of shared libraries or nested |
74291a4b MM |
8089 | functions. |
8090 | ||
74291a4b | 8091 | @item -mlong-load-store |
cd3bb277 | 8092 | @opindex mlong-load-store |
74291a4b MM |
8093 | Generate 3-instruction load and store sequences as sometimes required by |
8094 | the HP-UX 10 linker. This is equivalent to the @samp{+k} option to | |
8095 | the HP compilers. | |
8096 | ||
8097 | @item -mportable-runtime | |
cd3bb277 | 8098 | @opindex mportable-runtime |
74291a4b MM |
8099 | Use the portable calling conventions proposed by HP for ELF systems. |
8100 | ||
8101 | @item -mgas | |
cd3bb277 | 8102 | @opindex mgas |
74291a4b MM |
8103 | Enable the use of assembler directives only GAS understands. |
8104 | ||
630d3d5a | 8105 | @item -mschedule=@var{cpu-type} |
cd3bb277 | 8106 | @opindex mschedule |
74291a4b | 8107 | Schedule code according to the constraints for the machine type |
630d3d5a | 8108 | @var{cpu-type}. The choices for @var{cpu-type} are @samp{700} |
02f52e19 | 8109 | @samp{7100}, @samp{7100LC}, @samp{7200}, and @samp{8000}. Refer to |
732135bf JL |
8110 | @file{/usr/lib/sched.models} on an HP-UX system to determine the |
8111 | proper scheduling option for your machine. | |
74291a4b MM |
8112 | |
8113 | @item -mlinker-opt | |
cd3bb277 | 8114 | @opindex mlinker-opt |
74291a4b MM |
8115 | Enable the optimization pass in the HPUX linker. Note this makes symbolic |
8116 | debugging impossible. It also triggers a bug in the HPUX 8 and HPUX 9 linkers | |
8117 | in which they give bogus error messages when linking some programs. | |
8118 | ||
8119 | @item -msoft-float | |
cd3bb277 | 8120 | @opindex msoft-float |
74291a4b MM |
8121 | Generate output containing library calls for floating point. |
8122 | @strong{Warning:} the requisite libraries are not available for all HPPA | |
8123 | targets. Normally the facilities of the machine's usual C compiler are | |
8124 | used, but this cannot be done directly in cross-compilation. You must make | |
8125 | your own arrangements to provide suitable library functions for | |
8126 | cross-compilation. The embedded target @samp{hppa1.1-*-pro} | |
8127 | does provide software floating point support. | |
8128 | ||
630d3d5a | 8129 | @option{-msoft-float} changes the calling convention in the output file; |
74291a4b MM |
8130 | therefore, it is only useful if you compile @emph{all} of a program with |
8131 | this option. In particular, you need to compile @file{libgcc.a}, the | |
630d3d5a | 8132 | library that comes with GCC, with @option{-msoft-float} in order for |
74291a4b MM |
8133 | this to work. |
8134 | @end table | |
8135 | ||
8136 | @node Intel 960 Options | |
8137 | @subsection Intel 960 Options | |
8138 | ||
8139 | These @samp{-m} options are defined for the Intel 960 implementations: | |
8140 | ||
2642624b | 8141 | @table @gcctabopt |
cd3bb277 JM |
8142 | @item -m@var{cpu-type} |
8143 | @opindex mka | |
8144 | @opindex mkb | |
8145 | @opindex mmc | |
8146 | @opindex mca | |
8147 | @opindex mcf | |
8148 | @opindex msa | |
8149 | @opindex msb | |
8150 | Assume the defaults for the machine type @var{cpu-type} for some of | |
74291a4b | 8151 | the other options, including instruction scheduling, floating point |
cd3bb277 | 8152 | support, and addressing modes. The choices for @var{cpu-type} are |
74291a4b MM |
8153 | @samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf}, |
8154 | @samp{sa}, and @samp{sb}. | |
8155 | The default is | |
8156 | @samp{kb}. | |
8157 | ||
8158 | @item -mnumerics | |
8159 | @itemx -msoft-float | |
cd3bb277 JM |
8160 | @opindex mnumerics |
8161 | @opindex msoft-float | |
630d3d5a JM |
8162 | The @option{-mnumerics} option indicates that the processor does support |
8163 | floating-point instructions. The @option{-msoft-float} option indicates | |
74291a4b MM |
8164 | that floating-point support should not be assumed. |
8165 | ||
8166 | @item -mleaf-procedures | |
8167 | @itemx -mno-leaf-procedures | |
cd3bb277 JM |
8168 | @opindex mleaf-procedures |
8169 | @opindex mno-leaf-procedures | |
74291a4b MM |
8170 | Do (or do not) attempt to alter leaf procedures to be callable with the |
8171 | @code{bal} instruction as well as @code{call}. This will result in more | |
8172 | efficient code for explicit calls when the @code{bal} instruction can be | |
8173 | substituted by the assembler or linker, but less efficient code in other | |
8174 | cases, such as calls via function pointers, or using a linker that doesn't | |
8175 | support this optimization. | |
8176 | ||
8177 | @item -mtail-call | |
8178 | @itemx -mno-tail-call | |
cd3bb277 JM |
8179 | @opindex mtail-call |
8180 | @opindex mno-tail-call | |
74291a4b MM |
8181 | Do (or do not) make additional attempts (beyond those of the |
8182 | machine-independent portions of the compiler) to optimize tail-recursive | |
8183 | calls into branches. You may not want to do this because the detection of | |
8184 | cases where this is not valid is not totally complete. The default is | |
630d3d5a | 8185 | @option{-mno-tail-call}. |
74291a4b MM |
8186 | |
8187 | @item -mcomplex-addr | |
8188 | @itemx -mno-complex-addr | |
cd3bb277 JM |
8189 | @opindex mcomplex-addr |
8190 | @opindex mno-complex-addr | |
74291a4b MM |
8191 | Assume (or do not assume) that the use of a complex addressing mode is a |
8192 | win on this implementation of the i960. Complex addressing modes may not | |
8193 | be worthwhile on the K-series, but they definitely are on the C-series. | |
630d3d5a | 8194 | The default is currently @option{-mcomplex-addr} for all processors except |
161d7b59 | 8195 | the CB and CC@. |
74291a4b MM |
8196 | |
8197 | @item -mcode-align | |
8198 | @itemx -mno-code-align | |
cd3bb277 JM |
8199 | @opindex mcode-align |
8200 | @opindex mno-code-align | |
74291a4b MM |
8201 | Align code to 8-byte boundaries for faster fetching (or don't bother). |
8202 | Currently turned on by default for C-series implementations only. | |
8203 | ||
8204 | @ignore | |
8205 | @item -mclean-linkage | |
8206 | @itemx -mno-clean-linkage | |
cd3bb277 JM |
8207 | @opindex mclean-linkage |
8208 | @opindex mno-clean-linkage | |
74291a4b MM |
8209 | These options are not fully implemented. |
8210 | @end ignore | |
8211 | ||
8212 | @item -mic-compat | |
8213 | @itemx -mic2.0-compat | |
8214 | @itemx -mic3.0-compat | |
cd3bb277 JM |
8215 | @opindex mic-compat |
8216 | @opindex mic2.0-compat | |
8217 | @opindex mic3.0-compat | |
74291a4b MM |
8218 | Enable compatibility with iC960 v2.0 or v3.0. |
8219 | ||
8220 | @item -masm-compat | |
8221 | @itemx -mintel-asm | |
cd3bb277 JM |
8222 | @opindex masm-compat |
8223 | @opindex mintel-asm | |
74291a4b MM |
8224 | Enable compatibility with the iC960 assembler. |
8225 | ||
8226 | @item -mstrict-align | |
8227 | @itemx -mno-strict-align | |
cd3bb277 JM |
8228 | @opindex mstrict-align |
8229 | @opindex mno-strict-align | |
74291a4b MM |
8230 | Do not permit (do permit) unaligned accesses. |
8231 | ||
8232 | @item -mold-align | |
cd3bb277 | 8233 | @opindex mold-align |
74291a4b | 8234 | Enable structure-alignment compatibility with Intel's gcc release version |
630d3d5a | 8235 | 1.3 (based on gcc 1.37). This option implies @option{-mstrict-align}. |
eaa4b44c VM |
8236 | |
8237 | @item -mlong-double-64 | |
cd3bb277 | 8238 | @opindex mlong-double-64 |
eaa4b44c VM |
8239 | Implement type @samp{long double} as 64-bit floating point numbers. |
8240 | Without the option @samp{long double} is implemented by 80-bit | |
8241 | floating point numbers. The only reason we have it because there is | |
8242 | no 128-bit @samp{long double} support in @samp{fp-bit.c} yet. So it | |
8243 | is only useful for people using soft-float targets. Otherwise, we | |
8244 | should recommend against use of it. | |
8245 | ||
74291a4b MM |
8246 | @end table |
8247 | ||
8248 | @node DEC Alpha Options | |
8249 | @subsection DEC Alpha Options | |
8250 | ||
8251 | These @samp{-m} options are defined for the DEC Alpha implementations: | |
8252 | ||
2642624b | 8253 | @table @gcctabopt |
74291a4b MM |
8254 | @item -mno-soft-float |
8255 | @itemx -msoft-float | |
cd3bb277 JM |
8256 | @opindex mno-soft-float |
8257 | @opindex msoft-float | |
74291a4b | 8258 | Use (do not use) the hardware floating-point instructions for |
bedc7537 | 8259 | floating-point operations. When @option{-msoft-float} is specified, |
7857f134 | 8260 | functions in @file{libgcc.a} will be used to perform floating-point |
74291a4b MM |
8261 | operations. Unless they are replaced by routines that emulate the |
8262 | floating-point operations, or compiled in such a way as to call such | |
8263 | emulations routines, these routines will issue floating-point | |
8264 | operations. If you are compiling for an Alpha without floating-point | |
8265 | operations, you must ensure that the library is built so as not to call | |
8266 | them. | |
8267 | ||
8268 | Note that Alpha implementations without floating-point operations are | |
8269 | required to have floating-point registers. | |
8270 | ||
8271 | @item -mfp-reg | |
8272 | @itemx -mno-fp-regs | |
cd3bb277 JM |
8273 | @opindex mfp-reg |
8274 | @opindex mno-fp-regs | |
74291a4b | 8275 | Generate code that uses (does not use) the floating-point register set. |
bedc7537 | 8276 | @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point |
74291a4b MM |
8277 | register set is not used, floating point operands are passed in integer |
8278 | registers as if they were integers and floating-point results are passed | |
58605ba0 RH |
8279 | in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, |
8280 | so any function with a floating-point argument or return value called by code | |
bedc7537 | 8281 | compiled with @option{-mno-fp-regs} must also be compiled with that |
74291a4b MM |
8282 | option. |
8283 | ||
8284 | A typical use of this option is building a kernel that does not use, | |
8285 | and hence need not save and restore, any floating-point registers. | |
8286 | ||
8287 | @item -mieee | |
cd3bb277 | 8288 | @opindex mieee |
74291a4b MM |
8289 | The Alpha architecture implements floating-point hardware optimized for |
8290 | maximum performance. It is mostly compliant with the IEEE floating | |
8291 | point standard. However, for full compliance, software assistance is | |
8292 | required. This option generates code fully IEEE compliant code | |
630d3d5a | 8293 | @emph{except} that the @var{inexact-flag} is not maintained (see below). |
9c34dbbf ZW |
8294 | If this option is turned on, the preprocessor macro @code{_IEEE_FP} is |
8295 | defined during compilation. The resulting code is less efficient but is | |
8296 | able to correctly support denormalized numbers and exceptional IEEE | |
8297 | values such as not-a-number and plus/minus infinity. Other Alpha | |
8298 | compilers call this option @option{-ieee_with_no_inexact}. | |
74291a4b MM |
8299 | |
8300 | @item -mieee-with-inexact | |
cd3bb277 | 8301 | @opindex mieee-with-inexact |
9c34dbbf ZW |
8302 | This is like @option{-mieee} except the generated code also maintains |
8303 | the IEEE @var{inexact-flag}. Turning on this option causes the | |
8304 | generated code to implement fully-compliant IEEE math. In addition to | |
8305 | @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor | |
8306 | macro. On some Alpha implementations the resulting code may execute | |
8307 | significantly slower than the code generated by default. Since there is | |
8308 | very little code that depends on the @var{inexact-flag}, you should | |
74291a4b | 8309 | normally not specify this option. Other Alpha compilers call this |
630d3d5a | 8310 | option @option{-ieee_with_inexact}. |
74291a4b | 8311 | |
630d3d5a | 8312 | @item -mfp-trap-mode=@var{trap-mode} |
cd3bb277 | 8313 | @opindex mfp-trap-mode |
74291a4b | 8314 | This option controls what floating-point related traps are enabled. |
630d3d5a | 8315 | Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. |
74291a4b MM |
8316 | The trap mode can be set to one of four values: |
8317 | ||
8318 | @table @samp | |
8319 | @item n | |
8320 | This is the default (normal) setting. The only traps that are enabled | |
8321 | are the ones that cannot be disabled in software (e.g., division by zero | |
8322 | trap). | |
8323 | ||
8324 | @item u | |
8325 | In addition to the traps enabled by @samp{n}, underflow traps are enabled | |
8326 | as well. | |
8327 | ||
8328 | @item su | |
8329 | Like @samp{su}, but the instructions are marked to be safe for software | |
8330 | completion (see Alpha architecture manual for details). | |
8331 | ||
8332 | @item sui | |
8333 | Like @samp{su}, but inexact traps are enabled as well. | |
8334 | @end table | |
8335 | ||
630d3d5a | 8336 | @item -mfp-rounding-mode=@var{rounding-mode} |
cd3bb277 | 8337 | @opindex mfp-rounding-mode |
74291a4b | 8338 | Selects the IEEE rounding mode. Other Alpha compilers call this option |
630d3d5a | 8339 | @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one |
74291a4b MM |
8340 | of: |
8341 | ||
8342 | @table @samp | |
8343 | @item n | |
8344 | Normal IEEE rounding mode. Floating point numbers are rounded towards | |
8345 | the nearest machine number or towards the even machine number in case | |
8346 | of a tie. | |
8347 | ||
8348 | @item m | |
8349 | Round towards minus infinity. | |
8350 | ||
8351 | @item c | |
8352 | Chopped rounding mode. Floating point numbers are rounded towards zero. | |
8353 | ||
8354 | @item d | |
8355 | Dynamic rounding mode. A field in the floating point control register | |
8356 | (@var{fpcr}, see Alpha architecture reference manual) controls the | |
8357 | rounding mode in effect. The C library initializes this register for | |
8358 | rounding towards plus infinity. Thus, unless your program modifies the | |
ec4b2ecb CB |
8359 | @var{fpcr}, @samp{d} corresponds to round towards plus infinity. |
8360 | @end table | |
74291a4b | 8361 | |
630d3d5a | 8362 | @item -mtrap-precision=@var{trap-precision} |
cd3bb277 | 8363 | @opindex mtrap-precision |
74291a4b MM |
8364 | In the Alpha architecture, floating point traps are imprecise. This |
8365 | means without software assistance it is impossible to recover from a | |
8366 | floating trap and program execution normally needs to be terminated. | |
0c2d1a2a | 8367 | GCC can generate code that can assist operating system trap handlers |
74291a4b MM |
8368 | in determining the exact location that caused a floating point trap. |
8369 | Depending on the requirements of an application, different levels of | |
8370 | precisions can be selected: | |
8371 | ||
8372 | @table @samp | |
8373 | @item p | |
8374 | Program precision. This option is the default and means a trap handler | |
8375 | can only identify which program caused a floating point exception. | |
8376 | ||
8377 | @item f | |
8378 | Function precision. The trap handler can determine the function that | |
8379 | caused a floating point exception. | |
8380 | ||
8381 | @item i | |
8382 | Instruction precision. The trap handler can determine the exact | |
8383 | instruction that caused a floating point exception. | |
8384 | @end table | |
8385 | ||
8386 | Other Alpha compilers provide the equivalent options called | |
630d3d5a | 8387 | @option{-scope_safe} and @option{-resumption_safe}. |
74291a4b MM |
8388 | |
8389 | @item -mieee-conformant | |
cd3bb277 | 8390 | @opindex mieee-conformant |
74291a4b | 8391 | This option marks the generated code as IEEE conformant. You must not |
630d3d5a JM |
8392 | use this option unless you also specify @option{-mtrap-precision=i} and either |
8393 | @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect | |
74291a4b MM |
8394 | is to emit the line @samp{.eflag 48} in the function prologue of the |
8395 | generated assembly file. Under DEC Unix, this has the effect that | |
8396 | IEEE-conformant math library routines will be linked in. | |
8397 | ||
8398 | @item -mbuild-constants | |
cd3bb277 | 8399 | @opindex mbuild-constants |
0c2d1a2a | 8400 | Normally GCC examines a 32- or 64-bit integer constant to |
74291a4b MM |
8401 | see if it can construct it from smaller constants in two or three |
8402 | instructions. If it cannot, it will output the constant as a literal and | |
956d6950 | 8403 | generate code to load it from the data segment at runtime. |
74291a4b | 8404 | |
0c2d1a2a | 8405 | Use this option to require GCC to construct @emph{all} integer constants |
74291a4b MM |
8406 | using code, even if it takes more instructions (the maximum is six). |
8407 | ||
8408 | You would typically use this option to build a shared library dynamic | |
8409 | loader. Itself a shared library, it must relocate itself in memory | |
8410 | before it can find the variables and constants in its own data segment. | |
956d6950 JL |
8411 | |
8412 | @item -malpha-as | |
8413 | @itemx -mgas | |
cd3bb277 JM |
8414 | @opindex malpha-as |
8415 | @opindex mgas | |
956d6950 | 8416 | Select whether to generate code to be assembled by the vendor-supplied |
630d3d5a | 8417 | assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}. |
956d6950 JL |
8418 | |
8419 | @item -mbwx | |
8420 | @itemx -mno-bwx | |
8421 | @itemx -mcix | |
8422 | @itemx -mno-cix | |
58605ba0 RH |
8423 | @itemx -mfix |
8424 | @itemx -mno-fix | |
956d6950 JL |
8425 | @itemx -mmax |
8426 | @itemx -mno-max | |
cd3bb277 JM |
8427 | @opindex mbwx |
8428 | @opindex mno-bwx | |
8429 | @opindex mcix | |
8430 | @opindex mno-cix | |
58605ba0 RH |
8431 | @opindex mfix |
8432 | @opindex mno-fix | |
cd3bb277 JM |
8433 | @opindex mmax |
8434 | @opindex mno-max | |
0c2d1a2a | 8435 | Indicate whether GCC should generate code to use the optional BWX, |
58605ba0 RH |
8436 | CIX, FIX and MAX instruction sets. The default is to use the instruction |
8437 | sets supported by the CPU type specified via @option{-mcpu=} option or that | |
0c2d1a2a | 8438 | of the CPU on which GCC was built if none was specified. |
956d6950 | 8439 | |
58605ba0 RH |
8440 | @item -mfloat-vax |
8441 | @itemx -mfloat-ieee | |
8442 | @opindex mfloat-vax | |
8443 | @opindex mfloat-ieee | |
8444 | Generate code that uses (does not use) VAX F and G floating point | |
8445 | arithmetic instead of IEEE single and double precision. | |
8446 | ||
8447 | @item -mexplicit-relocs | |
8448 | @itemx -mno-explicit-relocs | |
8449 | @opindex mexplicit-relocs | |
8450 | @opindex mno-explicit-relocs | |
8451 | Older Alpha assemblers provided no way to generate symbol relocations | |
8452 | except via assembler macros. Use of these macros does not allow | |
8453 | optimial instruction scheduling. GNU binutils as of version 2.12 | |
8454 | supports a new syntax that allows the compiler to explicitly mark | |
8455 | which relocations should apply to which instructions. This option | |
8456 | is mostly useful for debugging, as GCC detects the capabilities of | |
8457 | the assembler when it is built and sets the default accordingly. | |
8458 | ||
8459 | @item -msmall-data | |
8460 | @itemx -mlarge-data | |
8461 | @opindex msmall-data | |
8462 | @opindex mlarge-data | |
8463 | When @option{-mexplicit-relocs} is in effect, static data is | |
8464 | accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} | |
8465 | is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} | |
8466 | (the @code{.sdata} and @code{.sbss} sections) and are accessed via | |
8467 | 16-bit relocations off of the @code{$gp} register. This limits the | |
8468 | size of the small data area to 64KB, but allows the variables to be | |
8469 | directly accessed via a single instruction. | |
8470 | ||
8471 | The default is @option{-mlarge-data}. With this option the data area | |
8472 | is limited to just below 2GB. Programs that require more than 2GB of | |
8473 | data must use @code{malloc} or @code{mmap} to allocate the data in the | |
8474 | heap instead of in the program's data segment. | |
8475 | ||
8476 | When generating code for shared libraries, @option{-fpic} implies | |
8477 | @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. | |
8478 | ||
956d6950 | 8479 | @item -mcpu=@var{cpu_type} |
cd3bb277 | 8480 | @opindex mcpu |
58605ba0 RH |
8481 | Set the instruction set and instruction scheduling parameters for |
8482 | machine type @var{cpu_type}. You can specify either the @samp{EV} | |
8483 | style name or the corresponding chip number. GCC supports scheduling | |
8484 | parameters for the EV4, EV5 and EV6 family of processors and will | |
8485 | choose the default values for the instruction set from the processor | |
8486 | you specify. If you do not specify a processor type, GCC will default | |
8487 | to the processor on which the compiler was built. | |
956d6950 JL |
8488 | |
8489 | Supported values for @var{cpu_type} are | |
8490 | ||
8491 | @table @samp | |
8492 | @item ev4 | |
58605ba0 | 8493 | @item ev45 |
956d6950 JL |
8494 | @itemx 21064 |
8495 | Schedules as an EV4 and has no instruction set extensions. | |
8496 | ||
8497 | @item ev5 | |
8498 | @itemx 21164 | |
8499 | Schedules as an EV5 and has no instruction set extensions. | |
8500 | ||
8501 | @item ev56 | |
8502 | @itemx 21164a | |
8503 | Schedules as an EV5 and supports the BWX extension. | |
8504 | ||
8505 | @item pca56 | |
4f69985c | 8506 | @itemx 21164pc |
956d6950 JL |
8507 | @itemx 21164PC |
8508 | Schedules as an EV5 and supports the BWX and MAX extensions. | |
8509 | ||
8510 | @item ev6 | |
8511 | @itemx 21264 | |
58605ba0 RH |
8512 | Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. |
8513 | ||
8514 | @item ev67 | |
8515 | @item 21264a | |
8516 | Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. | |
4f69985c RH |
8517 | @end table |
8518 | ||
58605ba0 RH |
8519 | @item -mtune=@var{cpu_type} |
8520 | @opindex mtune | |
8521 | Set only the instruction scheduling parameters for machine type | |
8522 | @var{cpu_type}. The instruction set is not changed. | |
8523 | ||
4f69985c | 8524 | @item -mmemory-latency=@var{time} |
cd3bb277 | 8525 | @opindex mmemory-latency |
4f69985c RH |
8526 | Sets the latency the scheduler should assume for typical memory |
8527 | references as seen by the application. This number is highly | |
b192711e | 8528 | dependent on the memory access patterns used by the application |
4f69985c RH |
8529 | and the size of the external cache on the machine. |
8530 | ||
8531 | Valid options for @var{time} are | |
8532 | ||
8533 | @table @samp | |
8534 | @item @var{number} | |
8535 | A decimal number representing clock cycles. | |
8536 | ||
8537 | @item L1 | |
8538 | @itemx L2 | |
8539 | @itemx L3 | |
8540 | @itemx main | |
8541 | The compiler contains estimates of the number of clock cycles for | |
8542 | ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches | |
8543 | (also called Dcache, Scache, and Bcache), as well as to main memory. | |
8544 | Note that L3 is only valid for EV5. | |
8545 | ||
956d6950 | 8546 | @end table |
74291a4b MM |
8547 | @end table |
8548 | ||
d7c23cdc DR |
8549 | @node DEC Alpha/VMS Options |
8550 | @subsection DEC Alpha/VMS Options | |
8551 | ||
8552 | These @samp{-m} options are defined for the DEC Alpha/VMS implementations: | |
8553 | ||
8554 | @table @gcctabopt | |
8555 | @item -mvms-return-codes | |
8556 | @opindex mvms-return-codes | |
bf6cfc5e RK |
8557 | Return VMS condition codes from main. The default is to return POSIX |
8558 | style condition (e.g.@ error) codes. | |
d7c23cdc DR |
8559 | @end table |
8560 | ||
74291a4b MM |
8561 | @node Clipper Options |
8562 | @subsection Clipper Options | |
8563 | ||
8564 | These @samp{-m} options are defined for the Clipper implementations: | |
8565 | ||
2642624b | 8566 | @table @gcctabopt |
74291a4b | 8567 | @item -mc300 |
cd3bb277 | 8568 | @opindex mc300 |
767094dd | 8569 | Produce code for a C300 Clipper processor. This is the default. |
74291a4b | 8570 | |
62a1403d | 8571 | @item -mc400 |
cd3bb277 | 8572 | @opindex mc400 |
9c34dbbf ZW |
8573 | Produce code for a C400 Clipper processor, i.e.@: use floating point |
8574 | registers f8--f15. | |
74291a4b MM |
8575 | @end table |
8576 | ||
8577 | @node H8/300 Options | |
8578 | @subsection H8/300 Options | |
8579 | ||
8580 | These @samp{-m} options are defined for the H8/300 implementations: | |
8581 | ||
2642624b | 8582 | @table @gcctabopt |
74291a4b | 8583 | @item -mrelax |
cd3bb277 | 8584 | @opindex mrelax |
74291a4b | 8585 | Shorten some address references at link time, when possible; uses the |
630d3d5a | 8586 | linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, |
74291a4b MM |
8587 | ld.info, Using ld}, for a fuller description. |
8588 | ||
8589 | @item -mh | |
cd3bb277 | 8590 | @opindex mh |
161d7b59 | 8591 | Generate code for the H8/300H@. |
74291a4b | 8592 | |
dcb9d1f0 | 8593 | @item -ms |
cd3bb277 | 8594 | @opindex ms |
161d7b59 | 8595 | Generate code for the H8/S@. |
dcb9d1f0 | 8596 | |
17f0f8fa | 8597 | @item -ms2600 |
cd3bb277 | 8598 | @opindex ms2600 |
695ac33f | 8599 | Generate code for the H8/S2600. This switch must be used with @option{-ms}. |
17f0f8fa | 8600 | |
74291a4b | 8601 | @item -mint32 |
cd3bb277 | 8602 | @opindex mint32 |
74291a4b MM |
8603 | Make @code{int} data 32 bits by default. |
8604 | ||
8605 | @item -malign-300 | |
cd3bb277 | 8606 | @opindex malign-300 |
2c54abce KH |
8607 | On the H8/300H and H8/S, use the same alignment rules as for the H8/300. |
8608 | The default for the H8/300H and H8/S is to align longs and floats on 4 | |
8609 | byte boundaries. | |
630d3d5a | 8610 | @option{-malign-300} causes them to be aligned on 2 byte boundaries. |
2c54abce | 8611 | This option has no effect on the H8/300. |
74291a4b MM |
8612 | @end table |
8613 | ||
8614 | @node SH Options | |
8615 | @subsection SH Options | |
8616 | ||
8617 | These @samp{-m} options are defined for the SH implementations: | |
8618 | ||
2642624b | 8619 | @table @gcctabopt |
74291a4b | 8620 | @item -m1 |
cd3bb277 | 8621 | @opindex m1 |
74291a4b MM |
8622 | Generate code for the SH1. |
8623 | ||
8624 | @item -m2 | |
cd3bb277 | 8625 | @opindex m2 |
74291a4b MM |
8626 | Generate code for the SH2. |
8627 | ||
8628 | @item -m3 | |
cd3bb277 | 8629 | @opindex m3 |
74291a4b MM |
8630 | Generate code for the SH3. |
8631 | ||
8632 | @item -m3e | |
cd3bb277 | 8633 | @opindex m3e |
74291a4b MM |
8634 | Generate code for the SH3e. |
8635 | ||
3cadd778 | 8636 | @item -m4-nofpu |
cd3bb277 | 8637 | @opindex m4-nofpu |
3cadd778 AO |
8638 | Generate code for the SH4 without a floating-point unit. |
8639 | ||
8640 | @item -m4-single-only | |
cd3bb277 | 8641 | @opindex m4-single-only |
3cadd778 | 8642 | Generate code for the SH4 with a floating-point unit that only |
c771326b | 8643 | supports single-precision arithmetic. |
3cadd778 AO |
8644 | |
8645 | @item -m4-single | |
cd3bb277 | 8646 | @opindex m4-single |
3cadd778 AO |
8647 | Generate code for the SH4 assuming the floating-point unit is in |
8648 | single-precision mode by default. | |
8649 | ||
8650 | @item -m4 | |
cd3bb277 | 8651 | @opindex m4 |
3cadd778 AO |
8652 | Generate code for the SH4. |
8653 | ||
74291a4b | 8654 | @item -mb |
cd3bb277 | 8655 | @opindex mb |
74291a4b MM |
8656 | Compile code for the processor in big endian mode. |
8657 | ||
8658 | @item -ml | |
cd3bb277 | 8659 | @opindex ml |
74291a4b MM |
8660 | Compile code for the processor in little endian mode. |
8661 | ||
3d5a0820 | 8662 | @item -mdalign |
cd3bb277 | 8663 | @opindex mdalign |
02f52e19 | 8664 | Align doubles at 64-bit boundaries. Note that this changes the calling |
3d5a0820 | 8665 | conventions, and thus some functions from the standard C library will |
695ac33f | 8666 | not work unless you recompile it first with @option{-mdalign}. |
3d5a0820 | 8667 | |
74291a4b | 8668 | @item -mrelax |
cd3bb277 | 8669 | @opindex mrelax |
74291a4b | 8670 | Shorten some address references at link time, when possible; uses the |
630d3d5a | 8671 | linker option @option{-relax}. |
3cadd778 AO |
8672 | |
8673 | @item -mbigtable | |
cd3bb277 | 8674 | @opindex mbigtable |
3cadd778 AO |
8675 | Use 32-bit offsets in @code{switch} tables. The default is to use |
8676 | 16-bit offsets. | |
8677 | ||
8678 | @item -mfmovd | |
cd3bb277 | 8679 | @opindex mfmovd |
3cadd778 AO |
8680 | Enable the use of the instruction @code{fmovd}. |
8681 | ||
8682 | @item -mhitachi | |
cd3bb277 | 8683 | @opindex mhitachi |
3cadd778 AO |
8684 | Comply with the calling conventions defined by Hitachi. |
8685 | ||
8686 | @item -mnomacsave | |
cd3bb277 | 8687 | @opindex mnomacsave |
3cadd778 | 8688 | Mark the @code{MAC} register as call-clobbered, even if |
bedc7537 | 8689 | @option{-mhitachi} is given. |
3cadd778 | 8690 | |
c474f76b AO |
8691 | @item -mieee |
8692 | @opindex mieee | |
8693 | Increase IEEE-compliance of floating-point code. | |
8694 | ||
3cadd778 | 8695 | @item -misize |
cd3bb277 | 8696 | @opindex misize |
3cadd778 AO |
8697 | Dump instruction size and location in the assembly code. |
8698 | ||
8699 | @item -mpadstruct | |
cd3bb277 | 8700 | @opindex mpadstruct |
3cadd778 | 8701 | This option is deprecated. It pads structures to multiple of 4 bytes, |
161d7b59 | 8702 | which is incompatible with the SH ABI@. |
3cadd778 AO |
8703 | |
8704 | @item -mspace | |
cd3bb277 | 8705 | @opindex mspace |
bedc7537 | 8706 | Optimize for space instead of speed. Implied by @option{-Os}. |
1a66cd67 AO |
8707 | |
8708 | @item -mprefergot | |
cd3bb277 | 8709 | @opindex mprefergot |
1a66cd67 AO |
8710 | When generating position-independent code, emit function calls using |
8711 | the Global Offset Table instead of the Procedure Linkage Table. | |
93ca1662 NY |
8712 | |
8713 | @item -musermode | |
cd3bb277 | 8714 | @opindex musermode |
93ca1662 NY |
8715 | Generate a library function call to invalidate instruction cache |
8716 | entries, after fixing up a trampoline. This library function call | |
8717 | doesn't assume it can write to the whole memory address space. This | |
8718 | is the default when the target is @code{sh-*-linux*}. | |
74291a4b MM |
8719 | @end table |
8720 | ||
8721 | @node System V Options | |
8722 | @subsection Options for System V | |
8723 | ||
8724 | These additional options are available on System V Release 4 for | |
8725 | compatibility with other compilers on those systems: | |
8726 | ||
2642624b | 8727 | @table @gcctabopt |
74291a4b | 8728 | @item -G |
cd3bb277 | 8729 | @opindex G |
74291a4b | 8730 | Create a shared object. |
630d3d5a | 8731 | It is recommended that @option{-symbolic} or @option{-shared} be used instead. |
74291a4b MM |
8732 | |
8733 | @item -Qy | |
cd3bb277 | 8734 | @opindex Qy |
74291a4b MM |
8735 | Identify the versions of each tool used by the compiler, in a |
8736 | @code{.ident} assembler directive in the output. | |
8737 | ||
8738 | @item -Qn | |
cd3bb277 | 8739 | @opindex Qn |
74291a4b MM |
8740 | Refrain from adding @code{.ident} directives to the output file (this is |
8741 | the default). | |
8742 | ||
aee96fe9 | 8743 | @item -YP,@var{dirs} |
cd3bb277 | 8744 | @opindex YP |
74291a4b | 8745 | Search the directories @var{dirs}, and no others, for libraries |
630d3d5a | 8746 | specified with @option{-l}. |
74291a4b | 8747 | |
aee96fe9 | 8748 | @item -Ym,@var{dir} |
cd3bb277 | 8749 | @opindex Ym |
bedc7537 | 8750 | Look in the directory @var{dir} to find the M4 preprocessor. |
74291a4b MM |
8751 | The assembler uses this option. |
8752 | @c This is supposed to go with a -Yd for predefined M4 macro files, but | |
8753 | @c the generic assembler that comes with Solaris takes just -Ym. | |
8754 | @end table | |
8755 | ||
282a61e6 MH |
8756 | @node TMS320C3x/C4x Options |
8757 | @subsection TMS320C3x/C4x Options | |
8758 | @cindex TMS320C3x/C4x Options | |
8759 | ||
8760 | These @samp{-m} options are defined for TMS320C3x/C4x implementations: | |
8761 | ||
2642624b | 8762 | @table @gcctabopt |
282a61e6 MH |
8763 | |
8764 | @item -mcpu=@var{cpu_type} | |
cd3bb277 | 8765 | @opindex mcpu |
282a61e6 MH |
8766 | Set the instruction set, register set, and instruction scheduling |
8767 | parameters for machine type @var{cpu_type}. Supported values for | |
8768 | @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and | |
8769 | @samp{c44}. The default is @samp{c40} to generate code for the | |
8770 | TMS320C40. | |
8771 | ||
8772 | @item -mbig-memory | |
8773 | @item -mbig | |
8774 | @itemx -msmall-memory | |
8775 | @itemx -msmall | |
cd3bb277 JM |
8776 | @opindex mbig-memory |
8777 | @opindex mbig | |
8778 | @opindex msmall-memory | |
8779 | @opindex msmall | |
282a61e6 MH |
8780 | Generates code for the big or small memory model. The small memory |
8781 | model assumed that all data fits into one 64K word page. At run-time | |
8782 | the data page (DP) register must be set to point to the 64K page | |
8783 | containing the .bss and .data program sections. The big memory model is | |
8784 | the default and requires reloading of the DP register for every direct | |
8785 | memory access. | |
8786 | ||
8787 | @item -mbk | |
8788 | @itemx -mno-bk | |
cd3bb277 JM |
8789 | @opindex mbk |
8790 | @opindex mno-bk | |
282a61e6 | 8791 | Allow (disallow) allocation of general integer operands into the block |
161d7b59 | 8792 | count register BK@. |
282a61e6 MH |
8793 | |
8794 | @item -mdb | |
8795 | @itemx -mno-db | |
cd3bb277 JM |
8796 | @opindex mdb |
8797 | @opindex mno-db | |
282a61e6 MH |
8798 | Enable (disable) generation of code using decrement and branch, |
8799 | DBcond(D), instructions. This is enabled by default for the C4x. To be | |
8800 | on the safe side, this is disabled for the C3x, since the maximum | |
aee96fe9 JM |
8801 | iteration count on the C3x is @math{2^23 + 1} (but who iterates loops more than |
8802 | @math{2^23} times on the C3x?). Note that GCC will try to reverse a loop so | |
282a61e6 MH |
8803 | that it can utilise the decrement and branch instruction, but will give |
8804 | up if there is more than one memory reference in the loop. Thus a loop | |
8805 | where the loop counter is decremented can generate slightly more | |
8806 | efficient code, in cases where the RPTB instruction cannot be utilised. | |
8807 | ||
8808 | @item -mdp-isr-reload | |
8809 | @itemx -mparanoid | |
cd3bb277 JM |
8810 | @opindex mdp-isr-reload |
8811 | @opindex mparanoid | |
282a61e6 MH |
8812 | Force the DP register to be saved on entry to an interrupt service |
8813 | routine (ISR), reloaded to point to the data section, and restored on | |
161d7b59 | 8814 | exit from the ISR@. This should not be required unless someone has |
282a61e6 MH |
8815 | violated the small memory model by modifying the DP register, say within |
8816 | an object library. | |
8817 | ||
8818 | @item -mmpyi | |
8819 | @itemx -mno-mpyi | |
cd3bb277 JM |
8820 | @opindex mmpyi |
8821 | @opindex mno-mpyi | |
282a61e6 MH |
8822 | For the C3x use the 24-bit MPYI instruction for integer multiplies |
8823 | instead of a library call to guarantee 32-bit results. Note that if one | |
8824 | of the operands is a constant, then the multiplication will be performed | |
695ac33f | 8825 | using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x, |
282a61e6 MH |
8826 | then squaring operations are performed inline instead of a library call. |
8827 | ||
8828 | @item -mfast-fix | |
8829 | @itemx -mno-fast-fix | |
cd3bb277 JM |
8830 | @opindex mfast-fix |
8831 | @opindex mno-fast-fix | |
282a61e6 MH |
8832 | The C3x/C4x FIX instruction to convert a floating point value to an |
8833 | integer value chooses the nearest integer less than or equal to the | |
8834 | floating point value rather than to the nearest integer. Thus if the | |
8835 | floating point number is negative, the result will be incorrectly | |
8836 | truncated an additional code is necessary to detect and correct this | |
8837 | case. This option can be used to disable generation of the additional | |
8838 | code required to correct the result. | |
8839 | ||
8840 | @item -mrptb | |
8841 | @itemx -mno-rptb | |
cd3bb277 JM |
8842 | @opindex mrptb |
8843 | @opindex mno-rptb | |
282a61e6 MH |
8844 | Enable (disable) generation of repeat block sequences using the RPTB |
8845 | instruction for zero overhead looping. The RPTB construct is only used | |
8846 | for innermost loops that do not call functions or jump across the loop | |
8847 | boundaries. There is no advantage having nested RPTB loops due to the | |
8848 | overhead required to save and restore the RC, RS, and RE registers. | |
695ac33f | 8849 | This is enabled by default with @option{-O2}. |
282a61e6 MH |
8850 | |
8851 | @item -mrpts=@var{count} | |
8852 | @itemx -mno-rpts | |
cd3bb277 JM |
8853 | @opindex mrpts |
8854 | @opindex mno-rpts | |
282a61e6 | 8855 | Enable (disable) the use of the single instruction repeat instruction |
161d7b59 | 8856 | RPTS@. If a repeat block contains a single instruction, and the loop |
282a61e6 | 8857 | count can be guaranteed to be less than the value @var{count}, GCC will |
161d7b59 | 8858 | emit a RPTS instruction instead of a RPTB@. If no value is specified, |
282a61e6 MH |
8859 | then a RPTS will be emitted even if the loop count cannot be determined |
8860 | at compile time. Note that the repeated instruction following RPTS does | |
8861 | not have to be reloaded from memory each iteration, thus freeing up the | |
b192711e | 8862 | CPU buses for operands. However, since interrupts are blocked by this |
282a61e6 MH |
8863 | instruction, it is disabled by default. |
8864 | ||
8865 | @item -mloop-unsigned | |
8866 | @itemx -mno-loop-unsigned | |
cd3bb277 JM |
8867 | @opindex mloop-unsigned |
8868 | @opindex mno-loop-unsigned | |
282a61e6 | 8869 | The maximum iteration count when using RPTS and RPTB (and DB on the C40) |
aee96fe9 | 8870 | is @math{2^31 + 1} since these instructions test if the iteration count is |
282a61e6 | 8871 | negative to terminate the loop. If the iteration count is unsigned |
aee96fe9 | 8872 | there is a possibility than the @math{2^31 + 1} maximum iteration count may be |
282a61e6 MH |
8873 | exceeded. This switch allows an unsigned iteration count. |
8874 | ||
8875 | @item -mti | |
cd3bb277 | 8876 | @opindex mti |
282a61e6 MH |
8877 | Try to emit an assembler syntax that the TI assembler (asm30) is happy |
8878 | with. This also enforces compatibility with the API employed by the TI | |
8879 | C3x C compiler. For example, long doubles are passed as structures | |
8880 | rather than in floating point registers. | |
8881 | ||
8882 | @item -mregparm | |
8883 | @itemx -mmemparm | |
cd3bb277 JM |
8884 | @opindex mregparm |
8885 | @opindex mmemparm | |
282a61e6 MH |
8886 | Generate code that uses registers (stack) for passing arguments to functions. |
8887 | By default, arguments are passed in registers where possible rather | |
8888 | than by pushing arguments on to the stack. | |
8889 | ||
8890 | @item -mparallel-insns | |
8891 | @itemx -mno-parallel-insns | |
cd3bb277 JM |
8892 | @opindex mparallel-insns |
8893 | @opindex mno-parallel-insns | |
282a61e6 | 8894 | Allow the generation of parallel instructions. This is enabled by |
695ac33f | 8895 | default with @option{-O2}. |
282a61e6 MH |
8896 | |
8897 | @item -mparallel-mpy | |
8898 | @itemx -mno-parallel-mpy | |
cd3bb277 JM |
8899 | @opindex mparallel-mpy |
8900 | @opindex mno-parallel-mpy | |
282a61e6 | 8901 | Allow the generation of MPY||ADD and MPY||SUB parallel instructions, |
695ac33f | 8902 | provided @option{-mparallel-insns} is also specified. These instructions have |
282a61e6 MH |
8903 | tight register constraints which can pessimize the code generation |
8904 | of large functions. | |
8905 | ||
8906 | @end table | |
8907 | ||
f84271d9 JL |
8908 | @node V850 Options |
8909 | @subsection V850 Options | |
8910 | @cindex V850 Options | |
8911 | ||
8912 | These @samp{-m} options are defined for V850 implementations: | |
8913 | ||
2642624b | 8914 | @table @gcctabopt |
f84271d9 JL |
8915 | @item -mlong-calls |
8916 | @itemx -mno-long-calls | |
cd3bb277 JM |
8917 | @opindex mlong-calls |
8918 | @opindex mno-long-calls | |
f84271d9 JL |
8919 | Treat all calls as being far away (near). If calls are assumed to be |
8920 | far away, the compiler will always load the functions address up into a | |
8921 | register, and call indirect through the pointer. | |
8922 | ||
8923 | @item -mno-ep | |
bd762873 | 8924 | @itemx -mep |
cd3bb277 JM |
8925 | @opindex mno-ep |
8926 | @opindex mep | |
f84271d9 JL |
8927 | Do not optimize (do optimize) basic blocks that use the same index |
8928 | pointer 4 or more times to copy pointer into the @code{ep} register, and | |
630d3d5a | 8929 | use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} |
f84271d9 JL |
8930 | option is on by default if you optimize. |
8931 | ||
8932 | @item -mno-prolog-function | |
8933 | @itemx -mprolog-function | |
cd3bb277 JM |
8934 | @opindex mno-prolog-function |
8935 | @opindex mprolog-function | |
f84271d9 JL |
8936 | Do not use (do use) external functions to save and restore registers at |
8937 | the prolog and epilog of a function. The external functions are slower, | |
8938 | but use less code space if more than one function saves the same number | |
630d3d5a | 8939 | of registers. The @option{-mprolog-function} option is on by default if |
f84271d9 JL |
8940 | you optimize. |
8941 | ||
8942 | @item -mspace | |
cd3bb277 | 8943 | @opindex mspace |
f84271d9 | 8944 | Try to make the code as small as possible. At present, this just turns |
630d3d5a | 8945 | on the @option{-mep} and @option{-mprolog-function} options. |
f84271d9 JL |
8946 | |
8947 | @item -mtda=@var{n} | |
cd3bb277 | 8948 | @opindex mtda |
f84271d9 JL |
8949 | Put static or global variables whose size is @var{n} bytes or less into |
8950 | the tiny data area that register @code{ep} points to. The tiny data | |
8951 | area can hold up to 256 bytes in total (128 bytes for byte references). | |
8952 | ||
8953 | @item -msda=@var{n} | |
cd3bb277 | 8954 | @opindex msda |
f84271d9 JL |
8955 | Put static or global variables whose size is @var{n} bytes or less into |
8956 | the small data area that register @code{gp} points to. The small data | |
8957 | area can hold up to 64 kilobytes. | |
8958 | ||
8959 | @item -mzda=@var{n} | |
cd3bb277 | 8960 | @opindex mzda |
f84271d9 JL |
8961 | Put static or global variables whose size is @var{n} bytes or less into |
8962 | the first 32 kilobytes of memory. | |
02f52e19 | 8963 | |
48f0be1b | 8964 | @item -mv850 |
cd3bb277 | 8965 | @opindex mv850 |
48f0be1b SC |
8966 | Specify that the target processor is the V850. |
8967 | ||
e9a25f70 | 8968 | @item -mbig-switch |
cd3bb277 | 8969 | @opindex mbig-switch |
e9a25f70 JL |
8970 | Generate code suitable for big switch tables. Use this option only if |
8971 | the assembler/linker complain about out of range branches within a switch | |
8972 | table. | |
f84271d9 JL |
8973 | @end table |
8974 | ||
56b2d7a7 JL |
8975 | @node ARC Options |
8976 | @subsection ARC Options | |
8977 | @cindex ARC Options | |
8978 | ||
8979 | These options are defined for ARC implementations: | |
8980 | ||
2642624b | 8981 | @table @gcctabopt |
56b2d7a7 | 8982 | @item -EL |
cd3bb277 | 8983 | @opindex EL |
56b2d7a7 JL |
8984 | Compile code for little endian mode. This is the default. |
8985 | ||
8986 | @item -EB | |
cd3bb277 | 8987 | @opindex EB |
56b2d7a7 JL |
8988 | Compile code for big endian mode. |
8989 | ||
8990 | @item -mmangle-cpu | |
cd3bb277 | 8991 | @opindex mmangle-cpu |
56b2d7a7 JL |
8992 | Prepend the name of the cpu to all public symbol names. |
8993 | In multiple-processor systems, there are many ARC variants with different | |
8994 | instruction and register set characteristics. This flag prevents code | |
8995 | compiled for one cpu to be linked with code compiled for another. | |
695ac33f | 8996 | No facility exists for handling variants that are ``almost identical''. |
56b2d7a7 JL |
8997 | This is an all or nothing option. |
8998 | ||
8999 | @item -mcpu=@var{cpu} | |
cd3bb277 | 9000 | @opindex mcpu |
56b2d7a7 JL |
9001 | Compile code for ARC variant @var{cpu}. |
9002 | Which variants are supported depend on the configuration. | |
630d3d5a | 9003 | All variants support @option{-mcpu=base}, this is the default. |
56b2d7a7 | 9004 | |
630d3d5a JM |
9005 | @item -mtext=@var{text-section} |
9006 | @itemx -mdata=@var{data-section} | |
9007 | @itemx -mrodata=@var{readonly-data-section} | |
cd3bb277 JM |
9008 | @opindex mtext |
9009 | @opindex mdata | |
9010 | @opindex mrodata | |
630d3d5a JM |
9011 | Put functions, data, and readonly data in @var{text-section}, |
9012 | @var{data-section}, and @var{readonly-data-section} respectively | |
56b2d7a7 | 9013 | by default. This can be overridden with the @code{section} attribute. |
0b433de6 | 9014 | @xref{Variable Attributes}. |
56b2d7a7 JL |
9015 | |
9016 | @end table | |
9017 | ||
83575957 ID |
9018 | @node NS32K Options |
9019 | @subsection NS32K Options | |
9020 | @cindex NS32K options | |
9021 | ||
9022 | These are the @samp{-m} options defined for the 32000 series. The default | |
9023 | values for these options depends on which style of 32000 was selected when | |
9024 | the compiler was configured; the defaults for the most common choices are | |
9025 | given below. | |
9026 | ||
2642624b | 9027 | @table @gcctabopt |
83575957 ID |
9028 | @item -m32032 |
9029 | @itemx -m32032 | |
cd3bb277 JM |
9030 | @opindex m32032 |
9031 | @opindex m32032 | |
83575957 ID |
9032 | Generate output for a 32032. This is the default |
9033 | when the compiler is configured for 32032 and 32016 based systems. | |
9034 | ||
9035 | @item -m32332 | |
9036 | @itemx -m32332 | |
cd3bb277 JM |
9037 | @opindex m32332 |
9038 | @opindex m32332 | |
83575957 ID |
9039 | Generate output for a 32332. This is the default |
9040 | when the compiler is configured for 32332-based systems. | |
9041 | ||
9042 | @item -m32532 | |
9043 | @itemx -m32532 | |
cd3bb277 JM |
9044 | @opindex m32532 |
9045 | @opindex m32532 | |
83575957 ID |
9046 | Generate output for a 32532. This is the default |
9047 | when the compiler is configured for 32532-based systems. | |
9048 | ||
9049 | @item -m32081 | |
cd3bb277 | 9050 | @opindex m32081 |
83575957 ID |
9051 | Generate output containing 32081 instructions for floating point. |
9052 | This is the default for all systems. | |
9053 | ||
9054 | @item -m32381 | |
cd3bb277 | 9055 | @opindex m32381 |
83575957 | 9056 | Generate output containing 32381 instructions for floating point. This |
767094dd JM |
9057 | also implies @option{-m32081}. The 32381 is only compatible with the 32332 |
9058 | and 32532 cpus. This is the default for the pc532-netbsd configuration. | |
83575957 ID |
9059 | |
9060 | @item -mmulti-add | |
cd3bb277 | 9061 | @opindex mmulti-add |
83575957 | 9062 | Try and generate multiply-add floating point instructions @code{polyF} |
767094dd | 9063 | and @code{dotF}. This option is only available if the @option{-m32381} |
14976c58 | 9064 | option is in effect. Using these instructions requires changes to |
83575957 ID |
9065 | register allocation which generally has a negative impact on |
9066 | performance. This option should only be enabled when compiling code | |
9067 | particularly likely to make heavy use of multiply-add instructions. | |
9068 | ||
9069 | @item -mnomulti-add | |
cd3bb277 | 9070 | @opindex mnomulti-add |
83575957 | 9071 | Do not try and generate multiply-add floating point instructions |
767094dd | 9072 | @code{polyF} and @code{dotF}. This is the default on all platforms. |
83575957 ID |
9073 | |
9074 | @item -msoft-float | |
cd3bb277 | 9075 | @opindex msoft-float |
83575957 ID |
9076 | Generate output containing library calls for floating point. |
9077 | @strong{Warning:} the requisite libraries may not be available. | |
9078 | ||
9079 | @item -mnobitfield | |
cd3bb277 | 9080 | @opindex mnobitfield |
767094dd JM |
9081 | Do not use the bit-field instructions. On some machines it is faster to |
9082 | use shifting and masking operations. This is the default for the pc532. | |
83575957 ID |
9083 | |
9084 | @item -mbitfield | |
cd3bb277 | 9085 | @opindex mbitfield |
767094dd | 9086 | Do use the bit-field instructions. This is the default for all platforms |
83575957 ID |
9087 | except the pc532. |
9088 | ||
9089 | @item -mrtd | |
cd3bb277 | 9090 | @opindex mrtd |
83575957 ID |
9091 | Use a different function-calling convention, in which functions |
9092 | that take a fixed number of arguments return pop their | |
9093 | arguments on return with the @code{ret} instruction. | |
9094 | ||
9095 | This calling convention is incompatible with the one normally | |
9096 | used on Unix, so you cannot use it if you need to call libraries | |
9097 | compiled with the Unix compiler. | |
9098 | ||
9099 | Also, you must provide function prototypes for all functions that | |
9100 | take variable numbers of arguments (including @code{printf}); | |
9101 | otherwise incorrect code will be generated for calls to those | |
9102 | functions. | |
9103 | ||
9104 | In addition, seriously incorrect code will result if you call a | |
9105 | function with too many arguments. (Normally, extra arguments are | |
9106 | harmlessly ignored.) | |
9107 | ||
9108 | This option takes its name from the 680x0 @code{rtd} instruction. | |
9109 | ||
9110 | ||
9111 | @item -mregparam | |
cd3bb277 | 9112 | @opindex mregparam |
83575957 ID |
9113 | Use a different function-calling convention where the first two arguments |
9114 | are passed in registers. | |
9115 | ||
9116 | This calling convention is incompatible with the one normally | |
9117 | used on Unix, so you cannot use it if you need to call libraries | |
9118 | compiled with the Unix compiler. | |
9119 | ||
9120 | @item -mnoregparam | |
cd3bb277 | 9121 | @opindex mnoregparam |
767094dd | 9122 | Do not pass any arguments in registers. This is the default for all |
83575957 ID |
9123 | targets. |
9124 | ||
9125 | @item -msb | |
cd3bb277 | 9126 | @opindex msb |
83575957 | 9127 | It is OK to use the sb as an index register which is always loaded with |
767094dd | 9128 | zero. This is the default for the pc532-netbsd target. |
83575957 ID |
9129 | |
9130 | @item -mnosb | |
cd3bb277 | 9131 | @opindex mnosb |
83575957 | 9132 | The sb register is not available for use or has not been initialized to |
767094dd JM |
9133 | zero by the run time system. This is the default for all targets except |
9134 | the pc532-netbsd. It is also implied whenever @option{-mhimem} or | |
630d3d5a | 9135 | @option{-fpic} is set. |
83575957 ID |
9136 | |
9137 | @item -mhimem | |
cd3bb277 | 9138 | @opindex mhimem |
161d7b59 | 9139 | Many ns32000 series addressing modes use displacements of up to 512MB@. |
83575957 | 9140 | If an address is above 512MB then displacements from zero can not be used. |
161d7b59 | 9141 | This option causes code to be generated which can be loaded above 512MB@. |
83575957 ID |
9142 | This may be useful for operating systems or ROM code. |
9143 | ||
9144 | @item -mnohimem | |
cd3bb277 | 9145 | @opindex mnohimem |
83575957 ID |
9146 | Assume code will be loaded in the first 512MB of virtual address space. |
9147 | This is the default for all platforms. | |
9148 | ||
9149 | ||
9150 | @end table | |
9151 | ||
052a4b28 DC |
9152 | @node AVR Options |
9153 | @subsection AVR Options | |
9154 | @cindex AVR Options | |
9155 | ||
9156 | These options are defined for AVR implementations: | |
9157 | ||
2642624b | 9158 | @table @gcctabopt |
052a4b28 | 9159 | @item -mmcu=@var{mcu} |
cd3bb277 | 9160 | @opindex mmcu |
3a69a7d5 MM |
9161 | Specify ATMEL AVR instruction set or MCU type. |
9162 | ||
9163 | Instruction set avr1 is for the minimal AVR core, not supported by the C | |
9164 | compiler, only for assembler programs (MCU types: at90s1200, attiny10, | |
9165 | attiny11, attiny12, attiny15, attiny28). | |
9166 | ||
9167 | Instruction set avr2 (default) is for the classic AVR core with up to | |
9168 | 8K program memory space (MCU types: at90s2313, at90s2323, attiny22, | |
9169 | at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, | |
9170 | at90c8534, at90s8535). | |
9171 | ||
9172 | Instruction set avr3 is for the classic AVR core with up to 128K program | |
c7f3e0b0 | 9173 | memory space (MCU types: atmega103, atmega603, at43usb320, at76c711). |
3a69a7d5 MM |
9174 | |
9175 | Instruction set avr4 is for the enhanced AVR core with up to 8K program | |
c7f3e0b0 | 9176 | memory space (MCU types: atmega8, atmega83, atmega85). |
3a69a7d5 MM |
9177 | |
9178 | Instruction set avr5 is for the enhanced AVR core with up to 128K program | |
c7f3e0b0 MM |
9179 | memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323, |
9180 | atmega64, atmega128, at43usb355, at94k). | |
052a4b28 DC |
9181 | |
9182 | @item -msize | |
cd3bb277 | 9183 | @opindex msize |
3a69a7d5 | 9184 | Output instruction sizes to the asm file. |
052a4b28 DC |
9185 | |
9186 | @item -minit-stack=@var{N} | |
cd3bb277 | 9187 | @opindex minit-stack |
3a69a7d5 | 9188 | Specify the initial stack address, which may be a symbol or numeric value, |
aee96fe9 | 9189 | @samp{__stack} is the default. |
052a4b28 DC |
9190 | |
9191 | @item -mno-interrupts | |
cd3bb277 | 9192 | @opindex mno-interrupts |
052a4b28 DC |
9193 | Generated code is not compatible with hardware interrupts. |
9194 | Code size will be smaller. | |
9195 | ||
9196 | @item -mcall-prologues | |
cd3bb277 | 9197 | @opindex mcall-prologues |
052a4b28 | 9198 | Functions prologues/epilogues expanded as call to appropriate |
767094dd | 9199 | subroutines. Code size will be smaller. |
3a69a7d5 MM |
9200 | |
9201 | @item -mno-tablejump | |
cd3bb277 | 9202 | @opindex mno-tablejump |
3a69a7d5 MM |
9203 | Do not generate tablejump insns which sometimes increase code size. |
9204 | ||
9205 | @item -mtiny-stack | |
cd3bb277 | 9206 | @opindex mtiny-stack |
3a69a7d5 | 9207 | Change only the low 8 bits of the stack pointer. |
052a4b28 DC |
9208 | @end table |
9209 | ||
789a3090 NC |
9210 | @node MCore Options |
9211 | @subsection MCore Options | |
9212 | @cindex MCore options | |
9213 | ||
9214 | These are the @samp{-m} options defined for the Motorola M*Core | |
02f52e19 | 9215 | processors. |
789a3090 | 9216 | |
2642624b | 9217 | @table @gcctabopt |
789a3090 NC |
9218 | |
9219 | @item -mhardlit | |
9220 | @itemx -mhardlit | |
9221 | @itemx -mno-hardlit | |
cd3bb277 JM |
9222 | @opindex mhardlit |
9223 | @opindex mhardlit | |
9224 | @opindex mno-hardlit | |
789a3090 NC |
9225 | Inline constants into the code stream if it can be done in two |
9226 | instructions or less. | |
9227 | ||
9228 | @item -mdiv | |
9229 | @itemx -mdiv | |
9230 | @itemx -mno-div | |
cd3bb277 JM |
9231 | @opindex mdiv |
9232 | @opindex mdiv | |
9233 | @opindex mno-div | |
789a3090 NC |
9234 | Use the divide instruction. (Enabled by default). |
9235 | ||
9236 | @item -mrelax-immediate | |
9237 | @itemx -mrelax-immediate | |
9238 | @itemx -mno-relax-immediate | |
cd3bb277 JM |
9239 | @opindex mrelax-immediate |
9240 | @opindex mrelax-immediate | |
9241 | @opindex mno-relax-immediate | |
b192711e | 9242 | Allow arbitrary sized immediates in bit operations. |
789a3090 NC |
9243 | |
9244 | @item -mwide-bitfields | |
9245 | @itemx -mwide-bitfields | |
9246 | @itemx -mno-wide-bitfields | |
cd3bb277 JM |
9247 | @opindex mwide-bitfields |
9248 | @opindex mwide-bitfields | |
9249 | @opindex mno-wide-bitfields | |
c771326b | 9250 | Always treat bit-fields as int-sized. |
789a3090 NC |
9251 | |
9252 | @item -m4byte-functions | |
9253 | @itemx -m4byte-functions | |
9254 | @itemx -mno-4byte-functions | |
cd3bb277 JM |
9255 | @opindex m4byte-functions |
9256 | @opindex m4byte-functions | |
9257 | @opindex mno-4byte-functions | |
b192711e | 9258 | Force all functions to be aligned to a four byte boundary. |
789a3090 NC |
9259 | |
9260 | @item -mcallgraph-data | |
9261 | @itemx -mcallgraph-data | |
9262 | @itemx -mno-callgraph-data | |
cd3bb277 JM |
9263 | @opindex mcallgraph-data |
9264 | @opindex mcallgraph-data | |
9265 | @opindex mno-callgraph-data | |
789a3090 NC |
9266 | Emit callgraph information. |
9267 | ||
9268 | @item -mslow-bytes | |
9269 | @itemx -mslow-bytes | |
9270 | @itemx -mno-slow-bytes | |
cd3bb277 JM |
9271 | @opindex mslow-bytes |
9272 | @opindex mslow-bytes | |
9273 | @opindex mno-slow-bytes | |
789a3090 NC |
9274 | Prefer word access when reading byte quantities. |
9275 | ||
9276 | @item -mlittle-endian | |
9277 | @itemx -mlittle-endian | |
9278 | @itemx -mbig-endian | |
cd3bb277 JM |
9279 | @opindex mlittle-endian |
9280 | @opindex mlittle-endian | |
9281 | @opindex mbig-endian | |
b192711e | 9282 | Generate code for a little endian target. |
789a3090 NC |
9283 | |
9284 | @item -m210 | |
9285 | @itemx -m210 | |
9286 | @itemx -m340 | |
cd3bb277 JM |
9287 | @opindex m210 |
9288 | @opindex m210 | |
9289 | @opindex m340 | |
789a3090 | 9290 | Generate code for the 210 processor. |
789a3090 | 9291 | @end table |
83575957 | 9292 | |
df6194d4 JW |
9293 | @node IA-64 Options |
9294 | @subsection IA-64 Options | |
9295 | @cindex IA-64 Options | |
9296 | ||
9297 | These are the @samp{-m} options defined for the Intel IA-64 architecture. | |
9298 | ||
9299 | @table @gcctabopt | |
9300 | @item -mbig-endian | |
cd3bb277 | 9301 | @opindex mbig-endian |
161d7b59 | 9302 | Generate code for a big endian target. This is the default for HPUX@. |
df6194d4 JW |
9303 | |
9304 | @item -mlittle-endian | |
cd3bb277 | 9305 | @opindex mlittle-endian |
df6194d4 JW |
9306 | Generate code for a little endian target. This is the default for AIX5 |
9307 | and Linux. | |
9308 | ||
9309 | @item -mgnu-as | |
9310 | @itemx -mno-gnu-as | |
cd3bb277 JM |
9311 | @opindex mgnu-as |
9312 | @opindex mno-gnu-as | |
15d3a111 | 9313 | Generate (or don't) code for the GNU assembler. This is the default. |
630d3d5a | 9314 | @c Also, this is the default if the configure option @option{--with-gnu-as} |
15d3a111 | 9315 | @c is used. |
df6194d4 JW |
9316 | |
9317 | @item -mgnu-ld | |
9318 | @itemx -mno-gnu-ld | |
cd3bb277 JM |
9319 | @opindex mgnu-ld |
9320 | @opindex mno-gnu-ld | |
15d3a111 | 9321 | Generate (or don't) code for the GNU linker. This is the default. |
630d3d5a | 9322 | @c Also, this is the default if the configure option @option{--with-gnu-ld} |
15d3a111 | 9323 | @c is used. |
df6194d4 JW |
9324 | |
9325 | @item -mno-pic | |
cd3bb277 | 9326 | @opindex mno-pic |
15d3a111 | 9327 | Generate code that does not use a global pointer register. The result |
161d7b59 | 9328 | is not position independent code, and violates the IA-64 ABI@. |
df6194d4 JW |
9329 | |
9330 | @item -mvolatile-asm-stop | |
9331 | @itemx -mno-volatile-asm-stop | |
cd3bb277 JM |
9332 | @opindex mvolatile-asm-stop |
9333 | @opindex mno-volatile-asm-stop | |
15d3a111 JW |
9334 | Generate (or don't) a stop bit immediately before and after volatile asm |
9335 | statements. | |
df6194d4 JW |
9336 | |
9337 | @item -mb-step | |
cd3bb277 | 9338 | @opindex mb-step |
df6194d4 JW |
9339 | Generate code that works around Itanium B step errata. |
9340 | ||
9341 | @item -mregister-names | |
9342 | @itemx -mno-register-names | |
cd3bb277 JM |
9343 | @opindex mregister-names |
9344 | @opindex mno-register-names | |
15d3a111 JW |
9345 | Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for |
9346 | the stacked registers. This may make assembler output more readable. | |
df6194d4 JW |
9347 | |
9348 | @item -mno-sdata | |
9349 | @itemx -msdata | |
cd3bb277 JM |
9350 | @opindex mno-sdata |
9351 | @opindex msdata | |
15d3a111 JW |
9352 | Disable (or enable) optimizations that use the small data section. This may |
9353 | be useful for working around optimizer bugs. | |
df6194d4 JW |
9354 | |
9355 | @item -mconstant-gp | |
cd3bb277 | 9356 | @opindex mconstant-gp |
df6194d4 JW |
9357 | Generate code that uses a single constant global pointer value. This is |
9358 | useful when compiling kernel code. | |
9359 | ||
9360 | @item -mauto-pic | |
cd3bb277 | 9361 | @opindex mauto-pic |
630d3d5a | 9362 | Generate code that is self-relocatable. This implies @option{-mconstant-gp}. |
df6194d4 JW |
9363 | This is useful when compiling firmware code. |
9364 | ||
9365 | @item -minline-divide-min-latency | |
cd3bb277 | 9366 | @opindex minline-divide-min-latency |
df6194d4 JW |
9367 | Generate code for inline divides using the minimum latency algorithm. |
9368 | ||
9369 | @item -minline-divide-max-throughput | |
cd3bb277 | 9370 | @opindex minline-divide-max-throughput |
df6194d4 JW |
9371 | Generate code for inline divides using the maximum throughput algorithm. |
9372 | ||
9373 | @item -mno-dwarf2-asm | |
9374 | @itemx -mdwarf2-asm | |
cd3bb277 JM |
9375 | @opindex mno-dwarf2-asm |
9376 | @opindex mdwarf2-asm | |
15d3a111 JW |
9377 | Don't (or do) generate assembler code for the DWARF2 line number debugging |
9378 | info. This may be useful when not using the GNU assembler. | |
df6194d4 | 9379 | |
630d3d5a | 9380 | @item -mfixed-range=@var{register-range} |
cd3bb277 | 9381 | @opindex mfixed-range |
df6194d4 JW |
9382 | Generate code treating the given register range as fixed registers. |
9383 | A fixed register is one that the register allocator can not use. This is | |
9384 | useful when compiling kernel code. A register range is specified as | |
9385 | two registers separated by a dash. Multiple register ranges can be | |
9386 | specified separated by a comma. | |
9387 | @end table | |
9388 | ||
e8ad90e5 MM |
9389 | @node D30V Options |
9390 | @subsection D30V Options | |
9391 | @cindex D30V Options | |
9392 | ||
9393 | These @samp{-m} options are defined for D30V implementations: | |
9394 | ||
2642624b | 9395 | @table @gcctabopt |
e8ad90e5 | 9396 | @item -mextmem |
cd3bb277 | 9397 | @opindex mextmem |
e8ad90e5 MM |
9398 | Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings}, |
9399 | @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external | |
9400 | memory, which starts at location @code{0x80000000}. | |
9401 | ||
9402 | @item -mextmemory | |
cd3bb277 | 9403 | @opindex mextmemory |
630d3d5a | 9404 | Same as the @option{-mextmem} switch. |
e8ad90e5 MM |
9405 | |
9406 | @item -monchip | |
cd3bb277 | 9407 | @opindex monchip |
e8ad90e5 MM |
9408 | Link the @samp{.text} section into onchip text memory, which starts at |
9409 | location @code{0x0}. Also link @samp{.data}, @samp{.bss}, | |
9410 | @samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections | |
9411 | into onchip data memory, which starts at location @code{0x20000000}. | |
9412 | ||
9413 | @item -mno-asm-optimize | |
9414 | @itemx -masm-optimize | |
cd3bb277 JM |
9415 | @opindex mno-asm-optimize |
9416 | @opindex masm-optimize | |
630d3d5a JM |
9417 | Disable (enable) passing @option{-O} to the assembler when optimizing. |
9418 | The assembler uses the @option{-O} option to automatically parallelize | |
e8ad90e5 MM |
9419 | adjacent short instructions where possible. |
9420 | ||
9421 | @item -mbranch-cost=@var{n} | |
cd3bb277 | 9422 | @opindex mbranch-cost |
e8ad90e5 MM |
9423 | Increase the internal costs of branches to @var{n}. Higher costs means |
9424 | that the compiler will issue more instructions to avoid doing a branch. | |
9425 | The default is 2. | |
9426 | ||
9427 | @item -mcond-exec=@var{n} | |
cd3bb277 | 9428 | @opindex mcond-exec |
e8ad90e5 MM |
9429 | Specify the maximum number of conditionally executed instructions that |
9430 | replace a branch. The default is 4. | |
9431 | @end table | |
56b2d7a7 | 9432 | |
91abf72d HP |
9433 | @node S/390 and zSeries Options |
9434 | @subsection S/390 and zSeries Options | |
9435 | @cindex S/390 and zSeries Options | |
9436 | ||
9437 | These are the @samp{-m} options defined for the S/390 and zSeries architecture. | |
9438 | ||
9439 | @table @gcctabopt | |
9440 | @item -mhard-float | |
9441 | @itemx -msoft-float | |
9442 | @opindex mhard-float | |
9443 | @opindex msoft-float | |
9444 | Use (do not use) the hardware floating-point instructions and registers | |
9445 | for floating-point operations. When @option{-msoft-float} is specified, | |
9446 | functions in @file{libgcc.a} will be used to perform floating-point | |
9447 | operations. When @option{-mhard-float} is specified, the compiler | |
9448 | generates IEEE floating-point instructions. This is the default. | |
9449 | ||
9450 | @item -mbackchain | |
9451 | @itemx -mno-backchain | |
9452 | @opindex mbackchain | |
9453 | @opindex mno-backchain | |
9454 | Generate (or do not generate) code which maintains an explicit | |
9455 | backchain within the stack frame that points to the caller's frame. | |
9456 | This is currently needed to allow debugging. The default is to | |
9457 | generate the backchain. | |
9458 | ||
9459 | @item -msmall-exec | |
9460 | @itemx -mno-small-exec | |
9461 | @opindex msmall-exec | |
9462 | @opindex mno-small-exec | |
9463 | Generate (or do not generate) code using the @code{bras} instruction | |
9464 | to do subroutine calls. | |
9465 | This only works reliably if the total executable size does not | |
9466 | exceed 64k. The default is to use the @code{basr} instruction instead, | |
9467 | which does not have this limitation. | |
9468 | ||
9469 | @item -m64 | |
9470 | @itemx -m31 | |
9471 | @opindex m64 | |
9472 | @opindex m31 | |
9473 | When @option{-m31} is specified, generate code compliant to the | |
9474 | Linux for S/390 ABI@. When @option{-m64} is specified, generate | |
9475 | code compliant to the Linux for zSeries ABI@. This allows GCC in | |
9476 | particular to generate 64-bit instructions. For the @samp{s390} | |
9477 | targets, the default is @option{-m31}, while the @samp{s390x} | |
9478 | targets default to @option{-m64}. | |
9479 | ||
9480 | @item -mmvcle | |
9481 | @itemx -mno-mvcle | |
9482 | @opindex mmvcle | |
9483 | @opindex mno-mvcle | |
9484 | Generate (or do not generate) code using the @code{mvcle} instruction | |
9485 | to perform block moves. When @option{-mno-mvcle} is specifed, | |
9486 | use a @code{mvc} loop instead. This is the default. | |
9487 | ||
9488 | @item -mdebug | |
9489 | @itemx -mno-debug | |
9490 | @opindex mdebug | |
9491 | @opindex mno-debug | |
9492 | Print (or do not print) additional debug information when compiling. | |
9493 | The default is to not print debug information. | |
9494 | ||
9495 | @end table | |
9496 | ||
0b85d816 HPN |
9497 | @node CRIS Options |
9498 | @subsection CRIS Options | |
9499 | @cindex CRIS Options | |
9500 | ||
9501 | These options are defined specifically for the CRIS ports. | |
9502 | ||
9503 | @table @gcctabopt | |
9504 | @item -march=@var{architecture-type} | |
9505 | @itemx -mcpu=@var{architecture-type} | |
9506 | @opindex march | |
9507 | @opindex mcpu | |
9508 | Generate code for the specified architecture. The choices for | |
9509 | @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for | |
9510 | respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX. | |
9511 | Default is @samp{v0} except for cris-axis-linux-gnu, where the default is | |
9512 | @samp{v10}. | |
9513 | ||
9514 | @item -mtune=@var{architecture-type} | |
9515 | @opindex mtune | |
9516 | Tune to @var{architecture-type} everything applicable about the generated | |
9517 | code, except for the ABI and the set of available instructions. The | |
9518 | choices for @var{architecture-type} are the same as for | |
9519 | @option{-march=@var{architecture-type}}. | |
9520 | ||
9521 | @item -mmax-stack-frame=@var{n} | |
9522 | @opindex mmax-stack-frame | |
9523 | Warn when the stack frame of a function exceeds @var{n} bytes. | |
9524 | ||
9525 | @item -melinux-stacksize=@var{n} | |
9526 | @opindex melinux-stacksize | |
9527 | Only available with the @samp{cris-axis-aout} target. Arranges for | |
9528 | indications in the program to the kernel loader that the stack of the | |
9529 | program should be set to @var{n} bytes. | |
9530 | ||
9531 | @item -metrax4 | |
9532 | @itemx -metrax100 | |
9533 | @opindex metrax4 | |
9534 | @opindex metrax100 | |
9535 | The options @option{-metrax4} and @option{-metrax100} are synonyms for | |
9536 | @option{-march=v3} and @option{-march=v8} respectively. | |
9537 | ||
9538 | @item -mpdebug | |
9539 | @opindex mpdebug | |
9540 | Enable CRIS-specific verbose debug-related information in the assembly | |
9541 | code. This option also has the effect to turn off the @samp{#NO_APP} | |
9542 | formatted-code indicator to the assembler at the beginning of the | |
9543 | assembly file. | |
9544 | ||
9545 | @item -mcc-init | |
9546 | @opindex mcc-init | |
9547 | Do not use condition-code results from previous instruction; always emit | |
9548 | compare and test instructions before use of condition codes. | |
9549 | ||
9550 | @item -mno-side-effects | |
9551 | @opindex mno-side-effects | |
9552 | Do not emit instructions with side-effects in addressing modes other than | |
9553 | post-increment. | |
9554 | ||
9555 | @item -mstack-align | |
9556 | @itemx -mno-stack-align | |
9557 | @itemx -mdata-align | |
9558 | @itemx -mno-data-align | |
9559 | @itemx -mconst-align | |
9560 | @itemx -mno-const-align | |
9561 | @opindex mstack-align | |
9562 | @opindex mno-stack-align | |
9563 | @opindex mdata-align | |
9564 | @opindex mno-data-align | |
9565 | @opindex mconst-align | |
9566 | @opindex mno-const-align | |
9567 | These options (no-options) arranges (eliminate arrangements) for the | |
9568 | stack-frame, individual data and constants to be aligned for the maximum | |
9569 | single data access size for the chosen CPU model. The default is to | |
9570 | arrange for 32-bit alignment. ABI details such as structure layout are | |
9571 | not affected by these options. | |
9572 | ||
9573 | @item -m32-bit | |
9574 | @itemx -m16-bit | |
9575 | @itemx -m8-bit | |
9576 | @opindex m32-bit | |
9577 | @opindex m16-bit | |
9578 | @opindex m8-bit | |
9579 | Similar to the stack- data- and const-align options above, these options | |
9580 | arrange for stack-frame, writable data and constants to all be 32-bit, | |
9581 | 16-bit or 8-bit aligned. The default is 32-bit alignment. | |
9582 | ||
9583 | @item -mno-prologue-epilogue | |
9584 | @itemx -mprologue-epilogue | |
9585 | @opindex mno-prologue-epilogue | |
9586 | @opindex mprologue-epilogue | |
9587 | With @option{-mno-prologue-epilogue}, the normal function prologue and | |
9588 | epilogue that sets up the stack-frame are omitted and no return | |
9589 | instructions or return sequences are generated in the code. Use this | |
9590 | option only together with visual inspection of the compiled code: no | |
9591 | warnings or errors are generated when call-saved registers must be saved, | |
9592 | or storage for local variable needs to be allocated. | |
9593 | ||
9594 | @item -mno-gotplt | |
9595 | @itemx -mgotplt | |
9596 | @opindex mno-gotplt | |
9597 | @opindex mgotplt | |
9598 | With @option{-fpic} and @option{-fPIC}, don't generate (do generate) | |
9599 | instruction sequences that load addresses for functions from the PLT part | |
9600 | of the GOT rather than (traditional on other architectures) calls to the | |
9601 | PLT. The default is @option{-mgotplt}. | |
9602 | ||
9603 | @item -maout | |
9604 | @opindex maout | |
9605 | Legacy no-op option only recognized with the cris-axis-aout target. | |
9606 | ||
9607 | @item -melf | |
9608 | @opindex melf | |
9609 | Legacy no-op option only recognized with the cris-axis-elf and | |
9610 | cris-axis-linux-gnu targets. | |
9611 | ||
9612 | @item -melinux | |
9613 | @opindex melinux | |
9614 | Only recognized with the cris-axis-aout target, where it selects a | |
9615 | GNU/linux-like multilib, include files and instruction set for | |
9616 | @option{-march=v8}. | |
9617 | ||
9618 | @item -mlinux | |
9619 | @opindex mlinux | |
9620 | Legacy no-op option only recognized with the cris-axis-linux-gnu target. | |
9621 | ||
9622 | @item -sim | |
9623 | @opindex sim | |
9624 | This option, recognized for the cris-axis-aout and cris-axis-elf arranges | |
9625 | to link with input-output functions from a simulator library. Code, | |
9626 | initialized data and zero-initialized data are allocated consecutively. | |
9627 | ||
9628 | @item -sim2 | |
9629 | @opindex sim2 | |
9630 | Like @option{-sim}, but pass linker options to locate initialized data at | |
9631 | 0x40000000 and zero-initialized data at 0x80000000. | |
9632 | @end table | |
9633 | ||
bcf684c7 HPN |
9634 | @node MMIX Options |
9635 | @subsection MMIX Options | |
9636 | @cindex MMIX Options | |
9637 | ||
9638 | These options are defined for the MMIX: | |
9639 | ||
5d22c1a5 | 9640 | @table @gcctabopt |
bcf684c7 HPN |
9641 | @item -mlibfuncs |
9642 | @itemx -mno-libfuncs | |
5d22c1a5 JM |
9643 | @opindex mlibfuncs |
9644 | @opindex mno-libfuncs | |
bcf684c7 HPN |
9645 | Specify that intrinsic library functions are being compiled, passing all |
9646 | values in registers, no matter the size. | |
9647 | ||
9648 | @item -mepsilon | |
9649 | @itemx -mno-epsilon | |
5d22c1a5 JM |
9650 | @opindex mepsilon |
9651 | @opindex mno-epsilon | |
bcf684c7 HPN |
9652 | Generate floating-point comparison instructions that compare with respect |
9653 | to the @code{rE} epsilon register. | |
9654 | ||
9655 | @item -mabi=mmixware | |
9656 | @itemx -mabi=gnu | |
5d22c1a5 JM |
9657 | @opindex mabi-mmixware |
9658 | @opindex mabi=gnu | |
bcf684c7 HPN |
9659 | Generate code that passes function parameters and return values that (in |
9660 | the called function) are seen as registers @code{$0} and up, as opposed to | |
9661 | the GNU ABI which uses global registers @code{$231} and up. | |
9662 | ||
9663 | @item -mzero-extend | |
3e0f61ac | 9664 | @itemx -mno-zero-extend |
5d22c1a5 JM |
9665 | @opindex mzero-extend |
9666 | @opindex mno-zero-extend | |
bcf684c7 HPN |
9667 | When reading data from memory in sizes shorter than 64 bits, use (do not |
9668 | use) zero-extending load instructions by default, rather than | |
9669 | sign-extending ones. | |
9670 | ||
9671 | @item -mknuthdiv | |
9672 | @itemx -mno-knuthdiv | |
5d22c1a5 JM |
9673 | @opindex mknuthdiv |
9674 | @opindex mno-knuthdiv | |
bcf684c7 HPN |
9675 | Make the result of a division yielding a remainder have the same sign as |
9676 | the divisor. With the default, @option{-mno-knuthdiv}, the sign of the | |
7fba3293 HPN |
9677 | remainder follows the sign of the dividend. Both methods are |
9678 | arithmetically valid, the latter being almost exclusively used. | |
bcf684c7 HPN |
9679 | |
9680 | @item -mtoplevel-symbols | |
9681 | @itemx -mno-toplevel-symbols | |
5d22c1a5 JM |
9682 | @opindex mtoplevel-symbols |
9683 | @opindex mno-toplevel-symbols | |
7fba3293 | 9684 | Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly |
bcf684c7 HPN |
9685 | code can be used with the @code{PREFIX} assembly directive. |
9686 | ||
9687 | @item -melf | |
5d22c1a5 | 9688 | @opindex melf |
7fba3293 | 9689 | Generate an executable in the ELF format, rather than the default |
bcf684c7 | 9690 | @samp{mmo} format used by the @command{mmix} simulator. |
3e0f61ac HPN |
9691 | |
9692 | @item -mbranch-predict | |
9693 | @itemx -mno-branch-predict | |
5d22c1a5 JM |
9694 | @opindex mbranch-predict |
9695 | @opindex mno-branch-predict | |
3e0f61ac HPN |
9696 | Use (do not use) the probable-branch instructions, when static branch |
9697 | prediction indicates a probable branch. | |
9698 | ||
9699 | @item -mreg-stack-fill-bug-workaround | |
9700 | @itemx -mno-reg-stack-fill-bug-workaround | |
5d22c1a5 JM |
9701 | @opindex mreg-stack-fill-bug-workaround |
9702 | @opindex mno-reg-stack-fill-bug-workaround | |
3e0f61ac HPN |
9703 | Work around (do not work around) an inconsistency in the circular |
9704 | register stack mechanism in the @command{mmix} simulator, which | |
9705 | causes entries in the register stack to not be flushed to memory if | |
9706 | the instruction causing the fill-up is @code{PUSHJ} or @code{PUSHGO}. | |
bcf684c7 HPN |
9707 | @end table |
9708 | ||
9f85bca7 JM |
9709 | @node PDP-11 Options |
9710 | @subsection PDP-11 Options | |
9711 | @cindex PDP-11 Options | |
9712 | ||
9713 | These options are defined for the PDP-11: | |
9714 | ||
9715 | @table @gcctabopt | |
9716 | @item -mfpu | |
9717 | @opindex mfpu | |
9718 | Use hardware FPP floating point. This is the default. (FIS floating | |
9719 | point on the PDP-11/40 is not supported.) | |
9720 | ||
9721 | @item -msoft-float | |
9722 | @opindex msoft-float | |
9723 | Do not use hardware floating point. | |
9724 | ||
9725 | @item -mac0 | |
9726 | @opindex mac0 | |
9727 | Return floating-point results in ac0 (fr0 in Unix assembler syntax). | |
9728 | ||
9729 | @item -mno-ac0 | |
9730 | @opindex mno-ac0 | |
9731 | Return floating-point results in memory. This is the default. | |
9732 | ||
9733 | @item -m40 | |
9734 | @opindex m40 | |
9735 | Generate code for a PDP-11/40. | |
9736 | ||
9737 | @item -m45 | |
9738 | @opindex m45 | |
9739 | Generate code for a PDP-11/45. This is the default. | |
9740 | ||
9741 | @item -m10 | |
9742 | @opindex m10 | |
9743 | Generate code for a PDP-11/10. | |
9744 | ||
9745 | @item -mbcopy-builtin | |
9746 | @opindex bcopy-builtin | |
9747 | Use inline @code{movstrhi} patterns for copying memory. This is the | |
9748 | default. | |
9749 | ||
9750 | @item -mbcopy | |
9751 | @opindex mbcopy | |
9752 | Do not use inline @code{movstrhi} patterns for copying memory. | |
9753 | ||
9754 | @item -mint16 | |
9755 | @itemx -mno-int32 | |
9756 | @opindex mint16 | |
9757 | @opindex mno-int32 | |
9758 | Use 16-bit @code{int}. This is the default. | |
9759 | ||
9760 | @item -mint32 | |
9761 | @itemx -mno-int16 | |
9762 | @opindex mint32 | |
9763 | @opindex mno-int16 | |
9764 | Use 32-bit @code{int}. | |
9765 | ||
9766 | @item -mfloat64 | |
9767 | @itemx -mno-float32 | |
9768 | @opindex mfloat64 | |
9769 | @opindex mno-float32 | |
9770 | Use 64-bit @code{float}. This is the default. | |
9771 | ||
9772 | @item -mfloat32 | |
9773 | @item -mno-float64 | |
9774 | @opindex mfloat32 | |
9775 | @opindex mno-float64 | |
9776 | Use 32-bit @code{float}. | |
9777 | ||
9778 | @item -mabshi | |
9779 | @opindex mabshi | |
9780 | Use @code{abshi2} pattern. This is the default. | |
9781 | ||
9782 | @item -mno-abshi | |
9783 | @opindex mno-abshi | |
9784 | Do not use @code{abshi2} pattern. | |
9785 | ||
9786 | @item -mbranch-expensive | |
9787 | @opindex mbranch-expensive | |
9788 | Pretend that branches are expensive. This is for experimenting with | |
9789 | code generation only. | |
9790 | ||
9791 | @item -mbranch-cheap | |
9792 | @opindex mbranch-cheap | |
9793 | Do not pretend that branches are expensive. This is the default. | |
9794 | ||
9795 | @item -msplit | |
9796 | @opindex msplit | |
9797 | Generate code for a system with split I&D. | |
9798 | ||
9799 | @item -mno-split | |
9800 | @opindex mno-split | |
9801 | Generate code for a system without split I&D. This is the default. | |
9802 | ||
9803 | @item -munix-asm | |
9804 | @opindex munix-asm | |
9805 | Use Unix assembler syntax. This is the default when configured for | |
9806 | @samp{pdp11-*-bsd}. | |
9807 | ||
9808 | @item -mdec-asm | |
9809 | @opindex mdec-asm | |
9810 | Use DEC assembler syntax. This is the default when configured for any | |
9811 | PDP-11 target other than @samp{pdp11-*-bsd}. | |
9812 | @end table | |
9813 | ||
74291a4b MM |
9814 | @node Code Gen Options |
9815 | @section Options for Code Generation Conventions | |
9816 | @cindex code generation conventions | |
9817 | @cindex options, code generation | |
9818 | @cindex run-time options | |
9819 | ||
9820 | These machine-independent options control the interface conventions | |
9821 | used in code generation. | |
9822 | ||
9823 | Most of them have both positive and negative forms; the negative form | |
630d3d5a | 9824 | of @option{-ffoo} would be @option{-fno-foo}. In the table below, only |
74291a4b MM |
9825 | one of the forms is listed---the one which is not the default. You |
9826 | can figure out the other form by either removing @samp{no-} or adding | |
9827 | it. | |
9828 | ||
2642624b | 9829 | @table @gcctabopt |
956d6950 | 9830 | @item -fexceptions |
cd3bb277 | 9831 | @opindex fexceptions |
767094dd | 9832 | Enable exception handling. Generates extra code needed to propagate |
f0523f02 | 9833 | exceptions. For some targets, this implies GCC will generate frame |
c5c76735 JL |
9834 | unwind information for all functions, which can produce significant data |
9835 | size overhead, although it does not affect execution. If you do not | |
f0523f02 | 9836 | specify this option, GCC will enable it by default for languages like |
90ecce3e | 9837 | C++ which normally require exception handling, and disable it for |
c5c76735 JL |
9838 | languages like C that do not normally require it. However, you may need |
9839 | to enable this option when compiling C code that needs to interoperate | |
9840 | properly with exception handlers written in C++. You may also wish to | |
9841 | disable this option if you are compiling older C++ programs that don't | |
9842 | use exception handling. | |
956d6950 | 9843 | |
6cfc0341 RH |
9844 | @item -fnon-call-exceptions |
9845 | @opindex fnon-call-exceptions | |
9846 | Generate code that allows trapping instructions to throw exceptions. | |
9847 | Note that this requires platform-specific runtime support that does | |
9848 | not exist everywhere. Moreover, it only allows @emph{trapping} | |
e979f9e8 | 9849 | instructions to throw exceptions, i.e.@: memory references or floating |
6cfc0341 RH |
9850 | point instructions. It does not allow exceptions to be thrown from |
9851 | arbitrary signal handlers such as @code{SIGALRM}. | |
9852 | ||
14a774a9 | 9853 | @item -funwind-tables |
cd3bb277 | 9854 | @opindex funwind-tables |
bedc7537 | 9855 | Similar to @option{-fexceptions}, except that it will just generate any needed |
14a774a9 RK |
9856 | static data, but will not affect the generated code in any other way. |
9857 | You will normally not enable this option; instead, a language processor | |
9858 | that needs this handling would enable it on your behalf. | |
9859 | ||
b932f770 JH |
9860 | @item -fasynchronous-unwind-tables |
9861 | @opindex funwind-tables | |
9862 | Generate unwind table in dwarf2 format, if supported by target machine. The | |
9863 | table is exact at each instruction boundary, so it can be used for stack | |
9864 | unwinding from asynchronous events (such as debugger or garbage collector). | |
9865 | ||
74291a4b | 9866 | @item -fpcc-struct-return |
cd3bb277 | 9867 | @opindex fpcc-struct-return |
74291a4b MM |
9868 | Return ``short'' @code{struct} and @code{union} values in memory like |
9869 | longer ones, rather than in registers. This convention is less | |
9870 | efficient, but it has the advantage of allowing intercallability between | |
0c2d1a2a | 9871 | GCC-compiled files and files compiled with other compilers. |
74291a4b MM |
9872 | |
9873 | The precise convention for returning structures in memory depends | |
9874 | on the target configuration macros. | |
9875 | ||
9876 | Short structures and unions are those whose size and alignment match | |
9877 | that of some integer type. | |
9878 | ||
9879 | @item -freg-struct-return | |
cd3bb277 | 9880 | @opindex freg-struct-return |
9c34dbbf ZW |
9881 | Return @code{struct} and @code{union} values in registers when possible. |
9882 | This is more efficient for small structures than | |
9883 | @option{-fpcc-struct-return}. | |
74291a4b | 9884 | |
9c34dbbf | 9885 | If you specify neither @option{-fpcc-struct-return} nor |
630d3d5a | 9886 | @option{-freg-struct-return}, GCC defaults to whichever convention is |
0c2d1a2a | 9887 | standard for the target. If there is no standard convention, GCC |
9c34dbbf ZW |
9888 | defaults to @option{-fpcc-struct-return}, except on targets where GCC is |
9889 | the principal compiler. In those cases, we can choose the standard, and | |
9890 | we chose the more efficient register return alternative. | |
74291a4b MM |
9891 | |
9892 | @item -fshort-enums | |
cd3bb277 | 9893 | @opindex fshort-enums |
74291a4b MM |
9894 | Allocate to an @code{enum} type only as many bytes as it needs for the |
9895 | declared range of possible values. Specifically, the @code{enum} type | |
9896 | will be equivalent to the smallest integer type which has enough room. | |
9897 | ||
9898 | @item -fshort-double | |
cd3bb277 | 9899 | @opindex fshort-double |
74291a4b MM |
9900 | Use the same size for @code{double} as for @code{float}. |
9901 | ||
9902 | @item -fshared-data | |
cd3bb277 | 9903 | @opindex fshared-data |
74291a4b MM |
9904 | Requests that the data and non-@code{const} variables of this |
9905 | compilation be shared data rather than private data. The distinction | |
9906 | makes sense only on certain operating systems, where shared data is | |
9907 | shared between processes running the same program, while private data | |
9908 | exists in one copy per process. | |
9909 | ||
9910 | @item -fno-common | |
cd3bb277 | 9911 | @opindex fno-common |
90ecce3e | 9912 | In C, allocate even uninitialized global variables in the data section of the |
74291a4b MM |
9913 | object file, rather than generating them as common blocks. This has the |
9914 | effect that if the same variable is declared (without @code{extern}) in | |
9915 | two different compilations, you will get an error when you link them. | |
9916 | The only reason this might be useful is if you wish to verify that the | |
9917 | program will work on other systems which always work this way. | |
9918 | ||
9919 | @item -fno-ident | |
cd3bb277 | 9920 | @opindex fno-ident |
74291a4b MM |
9921 | Ignore the @samp{#ident} directive. |
9922 | ||
9923 | @item -fno-gnu-linker | |
cd3bb277 | 9924 | @opindex fno-gnu-linker |
74291a4b MM |
9925 | Do not output global initializations (such as C++ constructors and |
9926 | destructors) in the form used by the GNU linker (on systems where the GNU | |
9927 | linker is the standard method of handling them). Use this option when | |
9928 | you want to use a non-GNU linker, which also requires using the | |
bedc7537 NC |
9929 | @command{collect2} program to make sure the system linker includes |
9930 | constructors and destructors. (@command{collect2} is included in the GCC | |
9931 | distribution.) For systems which @emph{must} use @command{collect2}, the | |
9932 | compiler driver @command{gcc} is configured to do this automatically. | |
74291a4b MM |
9933 | |
9934 | @item -finhibit-size-directive | |
cd3bb277 | 9935 | @opindex finhibit-size-directive |
74291a4b MM |
9936 | Don't output a @code{.size} assembler directive, or anything else that |
9937 | would cause trouble if the function is split in the middle, and the | |
9938 | two halves are placed at locations far apart in memory. This option is | |
9939 | used when compiling @file{crtstuff.c}; you should not need to use it | |
9940 | for anything else. | |
9941 | ||
9942 | @item -fverbose-asm | |
cd3bb277 | 9943 | @opindex fverbose-asm |
74291a4b MM |
9944 | Put extra commentary information in the generated assembly code to |
9945 | make it more readable. This option is generally only of use to those | |
9946 | who actually need to read the generated assembly code (perhaps while | |
9947 | debugging the compiler itself). | |
9948 | ||
630d3d5a | 9949 | @option{-fno-verbose-asm}, the default, causes the |
74291a4b MM |
9950 | extra information to be omitted and is useful when comparing two assembler |
9951 | files. | |
9952 | ||
9953 | @item -fvolatile | |
cd3bb277 | 9954 | @opindex fvolatile |
74291a4b MM |
9955 | Consider all memory references through pointers to be volatile. |
9956 | ||
9957 | @item -fvolatile-global | |
cd3bb277 | 9958 | @opindex fvolatile-global |
74291a4b | 9959 | Consider all memory references to extern and global data items to |
0c2d1a2a | 9960 | be volatile. GCC does not consider static data items to be volatile |
ab87f8c8 JL |
9961 | because of this switch. |
9962 | ||
9963 | @item -fvolatile-static | |
cd3bb277 | 9964 | @opindex fvolatile-static |
ab87f8c8 | 9965 | Consider all memory references to static data to be volatile. |
74291a4b MM |
9966 | |
9967 | @item -fpic | |
cd3bb277 | 9968 | @opindex fpic |
74291a4b MM |
9969 | @cindex global offset table |
9970 | @cindex PIC | |
9971 | Generate position-independent code (PIC) suitable for use in a shared | |
9972 | library, if supported for the target machine. Such code accesses all | |
161d7b59 | 9973 | constant addresses through a global offset table (GOT)@. The dynamic |
861bb6c1 | 9974 | loader resolves the GOT entries when the program starts (the dynamic |
0c2d1a2a | 9975 | loader is not part of GCC; it is part of the operating system). If |
861bb6c1 JL |
9976 | the GOT size for the linked executable exceeds a machine-specific |
9977 | maximum size, you get an error message from the linker indicating that | |
630d3d5a | 9978 | @option{-fpic} does not work; in that case, recompile with @option{-fPIC} |
861bb6c1 JL |
9979 | instead. (These maximums are 16k on the m88k, 8k on the Sparc, and 32k |
9980 | on the m68k and RS/6000. The 386 has no such limit.) | |
74291a4b MM |
9981 | |
9982 | Position-independent code requires special support, and therefore works | |
0c2d1a2a | 9983 | only on certain machines. For the 386, GCC supports PIC for System V |
74291a4b MM |
9984 | but not for the Sun 386i. Code generated for the IBM RS/6000 is always |
9985 | position-independent. | |
9986 | ||
74291a4b | 9987 | @item -fPIC |
cd3bb277 | 9988 | @opindex fPIC |
74291a4b MM |
9989 | If supported for the target machine, emit position-independent code, |
9990 | suitable for dynamic linking and avoiding any limit on the size of the | |
9991 | global offset table. This option makes a difference on the m68k, m88k, | |
9992 | and the Sparc. | |
9993 | ||
9994 | Position-independent code requires special support, and therefore works | |
9995 | only on certain machines. | |
9996 | ||
9997 | @item -ffixed-@var{reg} | |
cd3bb277 | 9998 | @opindex ffixed |
74291a4b MM |
9999 | Treat the register named @var{reg} as a fixed register; generated code |
10000 | should never refer to it (except perhaps as a stack pointer, frame | |
10001 | pointer or in some other fixed role). | |
10002 | ||
10003 | @var{reg} must be the name of a register. The register names accepted | |
10004 | are machine-specific and are defined in the @code{REGISTER_NAMES} | |
10005 | macro in the machine description macro file. | |
10006 | ||
10007 | This flag does not have a negative form, because it specifies a | |
10008 | three-way choice. | |
10009 | ||
10010 | @item -fcall-used-@var{reg} | |
cd3bb277 | 10011 | @opindex fcall-used |
956d6950 | 10012 | Treat the register named @var{reg} as an allocable register that is |
74291a4b MM |
10013 | clobbered by function calls. It may be allocated for temporaries or |
10014 | variables that do not live across a call. Functions compiled this way | |
10015 | will not save and restore the register @var{reg}. | |
10016 | ||
cb2fdc84 GRK |
10017 | It is an error to used this flag with the frame pointer or stack pointer. |
10018 | Use of this flag for other registers that have fixed pervasive roles in | |
10019 | the machine's execution model will produce disastrous results. | |
74291a4b MM |
10020 | |
10021 | This flag does not have a negative form, because it specifies a | |
10022 | three-way choice. | |
10023 | ||
10024 | @item -fcall-saved-@var{reg} | |
cd3bb277 | 10025 | @opindex fcall-saved |
956d6950 | 10026 | Treat the register named @var{reg} as an allocable register saved by |
74291a4b MM |
10027 | functions. It may be allocated even for temporaries or variables that |
10028 | live across a call. Functions compiled this way will save and restore | |
10029 | the register @var{reg} if they use it. | |
10030 | ||
cb2fdc84 GRK |
10031 | It is an error to used this flag with the frame pointer or stack pointer. |
10032 | Use of this flag for other registers that have fixed pervasive roles in | |
10033 | the machine's execution model will produce disastrous results. | |
74291a4b MM |
10034 | |
10035 | A different sort of disaster will result from the use of this flag for | |
10036 | a register in which function values may be returned. | |
10037 | ||
10038 | This flag does not have a negative form, because it specifies a | |
10039 | three-way choice. | |
10040 | ||
10041 | @item -fpack-struct | |
cd3bb277 | 10042 | @opindex fpack-struct |
74291a4b MM |
10043 | Pack all structure members together without holes. Usually you would |
10044 | not want to use this option, since it makes the code suboptimal, and | |
10045 | the offsets of structure members won't agree with system libraries. | |
10046 | ||
07417085 | 10047 | @item -finstrument-functions |
cd3bb277 | 10048 | @opindex finstrument-functions |
07417085 KR |
10049 | Generate instrumentation calls for entry and exit to functions. Just |
10050 | after function entry and just before function exit, the following | |
10051 | profiling functions will be called with the address of the current | |
10052 | function and its call site. (On some platforms, | |
10053 | @code{__builtin_return_address} does not work beyond the current | |
10054 | function, so the call site information may not be available to the | |
10055 | profiling functions otherwise.) | |
10056 | ||
10057 | @example | |
310668e8 JM |
10058 | void __cyg_profile_func_enter (void *this_fn, |
10059 | void *call_site); | |
10060 | void __cyg_profile_func_exit (void *this_fn, | |
10061 | void *call_site); | |
07417085 KR |
10062 | @end example |
10063 | ||
10064 | The first argument is the address of the start of the current function, | |
10065 | which may be looked up exactly in the symbol table. | |
10066 | ||
10067 | This instrumentation is also done for functions expanded inline in other | |
10068 | functions. The profiling calls will indicate where, conceptually, the | |
10069 | inline function is entered and exited. This means that addressable | |
10070 | versions of such functions must be available. If all your uses of a | |
10071 | function are expanded inline, this may mean an additional expansion of | |
10072 | code size. If you use @samp{extern inline} in your C code, an | |
10073 | addressable version of such functions must be provided. (This is | |
10074 | normally the case anyways, but if you get lucky and the optimizer always | |
10075 | expands the functions inline, you might have gotten away without | |
10076 | providing static copies.) | |
10077 | ||
10078 | A function may be given the attribute @code{no_instrument_function}, in | |
10079 | which case this instrumentation will not be done. This can be used, for | |
10080 | example, for the profiling functions listed above, high-priority | |
10081 | interrupt routines, and any functions from which the profiling functions | |
10082 | cannot safely be called (perhaps signal handlers, if the profiling | |
10083 | routines generate output or allocate memory). | |
10084 | ||
861bb6c1 | 10085 | @item -fstack-check |
cd3bb277 | 10086 | @opindex fstack-check |
861bb6c1 JL |
10087 | Generate code to verify that you do not go beyond the boundary of the |
10088 | stack. You should specify this flag if you are running in an | |
10089 | environment with multiple threads, but only rarely need to specify it in | |
10090 | a single-threaded environment since stack overflow is automatically | |
10091 | detected on nearly all systems if there is only one stack. | |
10092 | ||
a157febd GK |
10093 | Note that this switch does not actually cause checking to be done; the |
10094 | operating system must do that. The switch causes generation of code | |
10095 | to ensure that the operating system sees the stack being extended. | |
10096 | ||
10097 | @item -fstack-limit-register=@var{reg} | |
10098 | @itemx -fstack-limit-symbol=@var{sym} | |
10099 | @itemx -fno-stack-limit | |
cd3bb277 JM |
10100 | @opindex fstack-limit-register |
10101 | @opindex fstack-limit-symbol | |
10102 | @opindex fno-stack-limit | |
a157febd GK |
10103 | Generate code to ensure that the stack does not grow beyond a certain value, |
10104 | either the value of a register or the address of a symbol. If the stack | |
10105 | would grow beyond the value, a signal is raised. For most targets, | |
10106 | the signal is raised before the stack overruns the boundary, so | |
10107 | it is possible to catch the signal without taking special precautions. | |
10108 | ||
9c34dbbf ZW |
10109 | For instance, if the stack starts at absolute address @samp{0x80000000} |
10110 | and grows downwards, you can use the flags | |
10111 | @option{-fstack-limit-symbol=__stack_limit} and | |
10112 | @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit | |
10113 | of 128KB@. Note that this may only work with the GNU linker. | |
a157febd | 10114 | |
e5eb27e5 JL |
10115 | @cindex aliasing of parameters |
10116 | @cindex parameters, aliased | |
10117 | @item -fargument-alias | |
04afd9d6 JL |
10118 | @itemx -fargument-noalias |
10119 | @itemx -fargument-noalias-global | |
cd3bb277 JM |
10120 | @opindex fargument-alias |
10121 | @opindex fargument-noalias | |
10122 | @opindex fargument-noalias-global | |
e5eb27e5 JL |
10123 | Specify the possible relationships among parameters and between |
10124 | parameters and global data. | |
10125 | ||
630d3d5a | 10126 | @option{-fargument-alias} specifies that arguments (parameters) may |
9c34dbbf | 10127 | alias each other and may alias global storage.@* |
630d3d5a | 10128 | @option{-fargument-noalias} specifies that arguments do not alias |
9c34dbbf | 10129 | each other, but may alias global storage.@* |
630d3d5a | 10130 | @option{-fargument-noalias-global} specifies that arguments do not |
e5eb27e5 JL |
10131 | alias each other and do not alias global storage. |
10132 | ||
10133 | Each language will automatically use whatever option is required by | |
10134 | the language standard. You should not need to use these options yourself. | |
19283265 RH |
10135 | |
10136 | @item -fleading-underscore | |
cd3bb277 | 10137 | @opindex fleading-underscore |
695ac33f | 10138 | This option and its counterpart, @option{-fno-leading-underscore}, forcibly |
19283265 RH |
10139 | change the way C symbols are represented in the object file. One use |
10140 | is to help link with legacy assembly code. | |
10141 | ||
10142 | Be warned that you should know what you are doing when invoking this | |
10143 | option, and that not all targets provide complete support for it. | |
74291a4b MM |
10144 | @end table |
10145 | ||
ee457005 JM |
10146 | @c man end |
10147 | ||
74291a4b | 10148 | @node Environment Variables |
0c2d1a2a | 10149 | @section Environment Variables Affecting GCC |
74291a4b MM |
10150 | @cindex environment variables |
10151 | ||
ee457005 JM |
10152 | @c man begin ENVIRONMENT |
10153 | ||
0c2d1a2a JB |
10154 | This section describes several environment variables that affect how GCC |
10155 | operates. Some of them work by specifying directories or prefixes to use | |
767094dd | 10156 | when searching for various kinds of files. Some are used to specify other |
46103ab4 | 10157 | aspects of the compilation environment. |
74291a4b | 10158 | |
74291a4b | 10159 | Note that you can also specify places to search using options such as |
630d3d5a | 10160 | @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These |
74291a4b | 10161 | take precedence over places specified using environment variables, which |
161d7b59 | 10162 | in turn take precedence over those specified by the configuration of GCC@. |
b11cc610 JM |
10163 | @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, |
10164 | GNU Compiler Collection (GCC) Internals}. | |
74291a4b | 10165 | |
bedc7537 | 10166 | @table @env |
ab87f8c8 JL |
10167 | @item LANG |
10168 | @itemx LC_CTYPE | |
10169 | @c @itemx LC_COLLATE | |
10170 | @itemx LC_MESSAGES | |
10171 | @c @itemx LC_MONETARY | |
10172 | @c @itemx LC_NUMERIC | |
10173 | @c @itemx LC_TIME | |
10174 | @itemx LC_ALL | |
10175 | @findex LANG | |
10176 | @findex LC_CTYPE | |
10177 | @c @findex LC_COLLATE | |
10178 | @findex LC_MESSAGES | |
10179 | @c @findex LC_MONETARY | |
10180 | @c @findex LC_NUMERIC | |
10181 | @c @findex LC_TIME | |
10182 | @findex LC_ALL | |
10183 | @cindex locale | |
0c2d1a2a JB |
10184 | These environment variables control the way that GCC uses |
10185 | localization information that allow GCC to work with different | |
10186 | national conventions. GCC inspects the locale categories | |
bedc7537 | 10187 | @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do |
ab87f8c8 JL |
10188 | so. These locale categories can be set to any value supported by your |
10189 | installation. A typical value is @samp{en_UK} for English in the United | |
10190 | Kingdom. | |
10191 | ||
bedc7537 | 10192 | The @env{LC_CTYPE} environment variable specifies character |
0c2d1a2a | 10193 | classification. GCC uses it to determine the character boundaries in |
ab87f8c8 JL |
10194 | a string; this is needed for some multibyte encodings that contain quote |
10195 | and escape characters that would otherwise be interpreted as a string | |
10196 | end or escape. | |
10197 | ||
bedc7537 | 10198 | The @env{LC_MESSAGES} environment variable specifies the language to |
ab87f8c8 JL |
10199 | use in diagnostic messages. |
10200 | ||
bedc7537 NC |
10201 | If the @env{LC_ALL} environment variable is set, it overrides the value |
10202 | of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} | |
10203 | and @env{LC_MESSAGES} default to the value of the @env{LANG} | |
0c2d1a2a | 10204 | environment variable. If none of these variables are set, GCC |
ab87f8c8 JL |
10205 | defaults to traditional C English behavior. |
10206 | ||
74291a4b MM |
10207 | @item TMPDIR |
10208 | @findex TMPDIR | |
bedc7537 | 10209 | If @env{TMPDIR} is set, it specifies the directory to use for temporary |
0c2d1a2a | 10210 | files. GCC uses temporary files to hold the output of one stage of |
74291a4b MM |
10211 | compilation which is to be used as input to the next stage: for example, |
10212 | the output of the preprocessor, which is the input to the compiler | |
10213 | proper. | |
10214 | ||
10215 | @item GCC_EXEC_PREFIX | |
10216 | @findex GCC_EXEC_PREFIX | |
bedc7537 | 10217 | If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the |
74291a4b MM |
10218 | names of the subprograms executed by the compiler. No slash is added |
10219 | when this prefix is combined with the name of a subprogram, but you can | |
10220 | specify a prefix that ends with a slash if you wish. | |
10221 | ||
f0523f02 | 10222 | If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out |
0deb20df TT |
10223 | an appropriate prefix to use based on the pathname it was invoked with. |
10224 | ||
0c2d1a2a | 10225 | If GCC cannot find the subprogram using the specified prefix, it |
74291a4b MM |
10226 | tries looking in the usual places for the subprogram. |
10227 | ||
bedc7537 | 10228 | The default value of @env{GCC_EXEC_PREFIX} is |
74291a4b MM |
10229 | @file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value |
10230 | of @code{prefix} when you ran the @file{configure} script. | |
10231 | ||
630d3d5a | 10232 | Other prefixes specified with @option{-B} take precedence over this prefix. |
74291a4b MM |
10233 | |
10234 | This prefix is also used for finding files such as @file{crt0.o} that are | |
10235 | used for linking. | |
10236 | ||
10237 | In addition, the prefix is used in an unusual way in finding the | |
10238 | directories to search for header files. For each of the standard | |
10239 | directories whose name normally begins with @samp{/usr/local/lib/gcc-lib} | |
bedc7537 | 10240 | (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries |
74291a4b | 10241 | replacing that beginning with the specified prefix to produce an |
630d3d5a | 10242 | alternate directory name. Thus, with @option{-Bfoo/}, GCC will search |
74291a4b MM |
10243 | @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}. |
10244 | These alternate directories are searched first; the standard directories | |
10245 | come next. | |
10246 | ||
10247 | @item COMPILER_PATH | |
10248 | @findex COMPILER_PATH | |
bedc7537 NC |
10249 | The value of @env{COMPILER_PATH} is a colon-separated list of |
10250 | directories, much like @env{PATH}. GCC tries the directories thus | |
74291a4b | 10251 | specified when searching for subprograms, if it can't find the |
bedc7537 | 10252 | subprograms using @env{GCC_EXEC_PREFIX}. |
74291a4b MM |
10253 | |
10254 | @item LIBRARY_PATH | |
10255 | @findex LIBRARY_PATH | |
bedc7537 NC |
10256 | The value of @env{LIBRARY_PATH} is a colon-separated list of |
10257 | directories, much like @env{PATH}. When configured as a native compiler, | |
0c2d1a2a | 10258 | GCC tries the directories thus specified when searching for special |
bedc7537 | 10259 | linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking |
0c2d1a2a | 10260 | using GCC also uses these directories when searching for ordinary |
630d3d5a JM |
10261 | libraries for the @option{-l} option (but directories specified with |
10262 | @option{-L} come first). | |
74291a4b MM |
10263 | |
10264 | @item C_INCLUDE_PATH | |
10265 | @itemx CPLUS_INCLUDE_PATH | |
10266 | @itemx OBJC_INCLUDE_PATH | |
10267 | @findex C_INCLUDE_PATH | |
10268 | @findex CPLUS_INCLUDE_PATH | |
10269 | @findex OBJC_INCLUDE_PATH | |
10270 | @c @itemx OBJCPLUS_INCLUDE_PATH | |
10271 | These environment variables pertain to particular languages. Each | |
10272 | variable's value is a colon-separated list of directories, much like | |
bedc7537 | 10273 | @env{PATH}. When GCC searches for header files, it tries the |
74291a4b | 10274 | directories listed in the variable for the language you are using, after |
630d3d5a | 10275 | the directories specified with @option{-I} but before the standard header |
74291a4b MM |
10276 | file directories. |
10277 | ||
10278 | @item DEPENDENCIES_OUTPUT | |
10279 | @findex DEPENDENCIES_OUTPUT | |
10280 | @cindex dependencies for make as output | |
10281 | If this variable is set, its value specifies how to output dependencies | |
10282 | for Make based on the header files processed by the compiler. This | |
630d3d5a | 10283 | output looks much like the output from the @option{-M} option |
74291a4b MM |
10284 | (@pxref{Preprocessor Options}), but it goes to a separate file, and is |
10285 | in addition to the usual results of compilation. | |
10286 | ||
bedc7537 | 10287 | The value of @env{DEPENDENCIES_OUTPUT} can be just a file name, in |
74291a4b MM |
10288 | which case the Make rules are written to that file, guessing the target |
10289 | name from the source file name. Or the value can have the form | |
10290 | @samp{@var{file} @var{target}}, in which case the rules are written to | |
10291 | file @var{file} using @var{target} as the target name. | |
56f48ce9 DB |
10292 | |
10293 | @item LANG | |
10294 | @findex LANG | |
10295 | @cindex locale definition | |
767094dd | 10296 | This variable is used to pass locale information to the compiler. One way in |
56f48ce9 DB |
10297 | which this information is used is to determine the character set to be used |
10298 | when character literals, string literals and comments are parsed in C and C++. | |
10299 | When the compiler is configured to allow multibyte characters, | |
bedc7537 | 10300 | the following values for @env{LANG} are recognized: |
56f48ce9 | 10301 | |
2642624b | 10302 | @table @samp |
56f48ce9 DB |
10303 | @item C-JIS |
10304 | Recognize JIS characters. | |
10305 | @item C-SJIS | |
10306 | Recognize SJIS characters. | |
10307 | @item C-EUCJP | |
10308 | Recognize EUCJP characters. | |
10309 | @end table | |
10310 | ||
bedc7537 | 10311 | If @env{LANG} is not defined, or if it has some other value, then the |
56f48ce9 DB |
10312 | compiler will use mblen and mbtowc as defined by the default locale to |
10313 | recognize and translate multibyte characters. | |
74291a4b MM |
10314 | @end table |
10315 | ||
9d86bffc JM |
10316 | @c man end |
10317 | ||
74291a4b MM |
10318 | @node Running Protoize |
10319 | @section Running Protoize | |
10320 | ||
161d7b59 | 10321 | The program @code{protoize} is an optional part of GCC@. You can use |
c1030c7c | 10322 | it to add prototypes to a program, thus converting the program to ISO |
74291a4b MM |
10323 | C in one respect. The companion program @code{unprotoize} does the |
10324 | reverse: it removes argument types from any prototypes that are found. | |
10325 | ||
10326 | When you run these programs, you must specify a set of source files as | |
10327 | command line arguments. The conversion programs start out by compiling | |
10328 | these files to see what functions they define. The information gathered | |
10329 | about a file @var{foo} is saved in a file named @file{@var{foo}.X}. | |
10330 | ||
10331 | After scanning comes actual conversion. The specified files are all | |
10332 | eligible to be converted; any files they include (whether sources or | |
10333 | just headers) are eligible as well. | |
10334 | ||
10335 | But not all the eligible files are converted. By default, | |
10336 | @code{protoize} and @code{unprotoize} convert only source and header | |
10337 | files in the current directory. You can specify additional directories | |
630d3d5a | 10338 | whose files should be converted with the @option{-d @var{directory}} |
74291a4b | 10339 | option. You can also specify particular files to exclude with the |
630d3d5a | 10340 | @option{-x @var{file}} option. A file is converted if it is eligible, its |
74291a4b MM |
10341 | directory name matches one of the specified directory names, and its |
10342 | name within the directory has not been excluded. | |
10343 | ||
10344 | Basic conversion with @code{protoize} consists of rewriting most | |
10345 | function definitions and function declarations to specify the types of | |
10346 | the arguments. The only ones not rewritten are those for varargs | |
10347 | functions. | |
10348 | ||
10349 | @code{protoize} optionally inserts prototype declarations at the | |
10350 | beginning of the source file, to make them available for any calls that | |
10351 | precede the function's definition. Or it can insert prototype | |
10352 | declarations with block scope in the blocks where undeclared functions | |
10353 | are called. | |
10354 | ||
10355 | Basic conversion with @code{unprotoize} consists of rewriting most | |
10356 | function declarations to remove any argument types, and rewriting | |
c1030c7c | 10357 | function definitions to the old-style pre-ISO form. |
74291a4b MM |
10358 | |
10359 | Both conversion programs print a warning for any function declaration or | |
10360 | definition that they can't convert. You can suppress these warnings | |
630d3d5a | 10361 | with @option{-q}. |
74291a4b MM |
10362 | |
10363 | The output from @code{protoize} or @code{unprotoize} replaces the | |
10364 | original source file. The original file is renamed to a name ending | |
02f52e19 | 10365 | with @samp{.save} (for DOS, the saved filename ends in @samp{.sav} |
a7db8bbb MK |
10366 | without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav} |
10367 | for DOS) file already exists, then the source file is simply discarded. | |
74291a4b | 10368 | |
0c2d1a2a | 10369 | @code{protoize} and @code{unprotoize} both depend on GCC itself to |
74291a4b | 10370 | scan the program and collect information about the functions it uses. |
0c2d1a2a | 10371 | So neither of these programs will work until GCC is installed. |
74291a4b MM |
10372 | |
10373 | Here is a table of the options you can use with @code{protoize} and | |
10374 | @code{unprotoize}. Each option works with both programs unless | |
10375 | otherwise stated. | |
10376 | ||
10377 | @table @code | |
10378 | @item -B @var{directory} | |
10379 | Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the | |
10380 | usual directory (normally @file{/usr/local/lib}). This file contains | |
10381 | prototype information about standard system functions. This option | |
10382 | applies only to @code{protoize}. | |
10383 | ||
10384 | @item -c @var{compilation-options} | |
10385 | Use @var{compilation-options} as the options when running @code{gcc} to | |
630d3d5a | 10386 | produce the @samp{.X} files. The special option @option{-aux-info} is |
74291a4b MM |
10387 | always passed in addition, to tell @code{gcc} to write a @samp{.X} file. |
10388 | ||
10389 | Note that the compilation options must be given as a single argument to | |
10390 | @code{protoize} or @code{unprotoize}. If you want to specify several | |
10391 | @code{gcc} options, you must quote the entire set of compilation options | |
10392 | to make them a single word in the shell. | |
10393 | ||
10394 | There are certain @code{gcc} arguments that you cannot use, because they | |
630d3d5a JM |
10395 | would produce the wrong kind of output. These include @option{-g}, |
10396 | @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in | |
74291a4b MM |
10397 | the @var{compilation-options}, they are ignored. |
10398 | ||
10399 | @item -C | |
a7db8bbb | 10400 | Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file |
02f52e19 | 10401 | systems) instead of @samp{.c}. This is convenient if you are converting |
ee77eda5 | 10402 | a C program to C++. This option applies only to @code{protoize}. |
74291a4b MM |
10403 | |
10404 | @item -g | |
10405 | Add explicit global declarations. This means inserting explicit | |
10406 | declarations at the beginning of each source file for each function | |
10407 | that is called in the file and was not declared. These declarations | |
10408 | precede the first function definition that contains a call to an | |
10409 | undeclared function. This option applies only to @code{protoize}. | |
10410 | ||
10411 | @item -i @var{string} | |
10412 | Indent old-style parameter declarations with the string @var{string}. | |
10413 | This option applies only to @code{protoize}. | |
10414 | ||
10415 | @code{unprotoize} converts prototyped function definitions to old-style | |
10416 | function definitions, where the arguments are declared between the | |
10417 | argument list and the initial @samp{@{}. By default, @code{unprotoize} | |
10418 | uses five spaces as the indentation. If you want to indent with just | |
630d3d5a | 10419 | one space instead, use @option{-i " "}. |
74291a4b MM |
10420 | |
10421 | @item -k | |
10422 | Keep the @samp{.X} files. Normally, they are deleted after conversion | |
10423 | is finished. | |
10424 | ||
10425 | @item -l | |
630d3d5a | 10426 | Add explicit local declarations. @code{protoize} with @option{-l} inserts |
74291a4b MM |
10427 | a prototype declaration for each function in each block which calls the |
10428 | function without any declaration. This option applies only to | |
10429 | @code{protoize}. | |
10430 | ||
10431 | @item -n | |
10432 | Make no real changes. This mode just prints information about the conversions | |
630d3d5a | 10433 | that would have been done without @option{-n}. |
74291a4b MM |
10434 | |
10435 | @item -N | |
10436 | Make no @samp{.save} files. The original files are simply deleted. | |
10437 | Use this option with caution. | |
10438 | ||
10439 | @item -p @var{program} | |
10440 | Use the program @var{program} as the compiler. Normally, the name | |
10441 | @file{gcc} is used. | |
10442 | ||
10443 | @item -q | |
10444 | Work quietly. Most warnings are suppressed. | |
10445 | ||
10446 | @item -v | |
630d3d5a | 10447 | Print the version number, just like @option{-v} for @code{gcc}. |
74291a4b MM |
10448 | @end table |
10449 | ||
10450 | If you need special compiler options to compile one of your program's | |
10451 | source files, then you should generate that file's @samp{.X} file | |
10452 | specially, by running @code{gcc} on that source file with the | |
630d3d5a | 10453 | appropriate options and the option @option{-aux-info}. Then run |
74291a4b MM |
10454 | @code{protoize} on the entire set of files. @code{protoize} will use |
10455 | the existing @samp{.X} file because it is newer than the source file. | |
10456 | For example: | |
10457 | ||
10458 | @example | |
b1018de6 | 10459 | gcc -Dfoo=bar file1.c -aux-info file1.X |
74291a4b MM |
10460 | protoize *.c |
10461 | @end example | |
10462 | ||
10463 | @noindent | |
10464 | You need to include the special files along with the rest in the | |
10465 | @code{protoize} command, even though their @samp{.X} files already | |
10466 | exist, because otherwise they won't get converted. | |
10467 | ||
10468 | @xref{Protoize Caveats}, for more information on how to use | |
10469 | @code{protoize} successfully. |