]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/invoke.texi
* Check in merge from gcc2. See ChangeLog.11 and ChangeLog.12
[thirdparty/gcc.git] / gcc / invoke.texi
1 @c Copyright (C) 1988,89,92,93,94,95,96,97,1998 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @node Invoking GCC
6 @chapter GNU CC Command Options
7 @cindex GNU CC command options
8 @cindex command options
9 @cindex options, GNU CC command
10
11 When you invoke GNU CC, it normally does preprocessing, compilation,
12 assembly and linking. The ``overall options'' allow you to stop this
13 process at an intermediate stage. For example, the @samp{-c} option
14 says not to run the linker. Then the output consists of object files
15 output by the assembler.
16
17 Other options are passed on to one stage of processing. Some options
18 control the preprocessor and others the compiler itself. Yet other
19 options control the assembler and linker; most of these are not
20 documented here, since you rarely need to use any of them.
21
22 @cindex C compilation options
23 Most of the command line options that you can use with GNU CC are useful
24 for C programs; when an option is only useful with another language
25 (usually C++), the explanation says so explicitly. If the description
26 for a particular option does not mention a source language, you can use
27 that option with all supported languages.
28
29 @cindex C++ compilation options
30 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
31 options for compiling C++ programs.
32
33 @cindex grouping options
34 @cindex options, grouping
35 The @code{gcc} program accepts options and file names as operands. Many
36 options have multiletter names; therefore multiple single-letter options
37 may @emph{not} be grouped: @samp{-dr} is very different from @w{@samp{-d
38 -r}}.
39
40 @cindex order of options
41 @cindex options, order
42 You can mix options and other arguments. For the most part, the order
43 you use doesn't matter. Order does matter when you use several options
44 of the same kind; for example, if you specify @samp{-L} more than once,
45 the directories are searched in the order specified.
46
47 Many options have long names starting with @samp{-f} or with
48 @samp{-W}---for example, @samp{-fforce-mem},
49 @samp{-fstrength-reduce}, @samp{-Wformat} and so on. Most of
50 these have both positive and negative forms; the negative form of
51 @samp{-ffoo} would be @samp{-fno-foo}. This manual documents
52 only one of these two forms, whichever one is not the default.
53
54 @menu
55 * Option Summary:: Brief list of all options, without explanations.
56 * Overall Options:: Controlling the kind of output:
57 an executable, object files, assembler files,
58 or preprocessed source.
59 * Invoking G++:: Compiling C++ programs.
60 * C Dialect Options:: Controlling the variant of C language compiled.
61 * C++ Dialect Options:: Variations on C++.
62 * Warning Options:: How picky should the compiler be?
63 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
64 * Optimize Options:: How much optimization?
65 * Preprocessor Options:: Controlling header files and macro definitions.
66 Also, getting dependency information for Make.
67 * Assembler Options:: Passing options to the assembler.
68 * Link Options:: Specifying libraries and so on.
69 * Directory Options:: Where to find header files and libraries.
70 Where to find the compiler executable files.
71 * Target Options:: Running a cross-compiler, or an old version of GNU CC.
72 * Submodel Options:: Specifying minor hardware or convention variations,
73 such as 68010 vs 68020.
74 * Code Gen Options:: Specifying conventions for function calls, data layout
75 and register usage.
76 * Environment Variables:: Env vars that affect GNU CC.
77 * Running Protoize:: Automatically adding or removing function prototypes.
78 @end menu
79
80 @node Option Summary
81 @section Option Summary
82
83 Here is a summary of all the options, grouped by type. Explanations are
84 in the following sections.
85
86 @table @emph
87 @item Overall Options
88 @xref{Overall Options,,Options Controlling the Kind of Output}.
89 @smallexample
90 -c -S -E -o @var{file} -pipe -v -x @var{language}
91 @end smallexample
92
93 @item C Language Options
94 @xref{C Dialect Options,,Options Controlling C Dialect}.
95 @smallexample
96 -ansi -fallow-single-precision -fcond-mismatch -fno-asm
97 -fno-builtin -ffreestanding -fhosted -fsigned-bitfields -fsigned-char
98 -funsigned-bitfields -funsigned-char -fwritable-strings
99 -traditional -traditional-cpp -trigraphs
100 @end smallexample
101
102 @item C++ Language Options
103 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
104 @smallexample
105 -fall-virtual -fdollars-in-identifiers -felide-constructors
106 -fenum-int-equiv -fexternal-templates -ffor-scope
107 -fno-for-scope -fhandle-signatures -fmemoize-lookups
108 -fname-mangling-version-@var{n} -fno-default-inline
109 -fno-gnu-keywords -fnonnull-objects -fguiding-decls
110 -foperator-names -fstrict-prototype -fthis-is-variable
111 -ftemplate-depth-@var{n} -nostdinc++ -traditional +e@var{n}
112 @end smallexample
113
114 @item Warning Options
115 @xref{Warning Options,,Options to Request or Suppress Warnings}.
116 @smallexample
117 -fsyntax-only -pedantic -pedantic-errors
118 -w -W -Wall -Waggregate-return -Wbad-function-cast
119 -Wcast-align -Wcast-qual -Wchar-subscript -Wcomment
120 -Wconversion -Werror -Wformat
121 -Wid-clash-@var{len} -Wimplicit -Wimplicit-int
122 -Wimplicit-function-declarations -Wimport -Winline
123 -Wlarger-than-@var{len} -Wmain -Wmissing-declarations
124 -Wmissing-prototypes -Wnested-externs -Wno-import
125 -Wold-style-cast -Woverloaded-virtual -Wparentheses
126 -Wpointer-arith -Wredundant-decls -Wreorder -Wreturn-type
127 -Wshadow -Wsign-compare -Wstrict-prototypes -Wswitch
128 -Wsynth -Wtemplate-debugging -Wtraditional -Wtrigraphs
129 -Wundef -Wuninitialized -Wunused -Wwrite-strings
130 -Wunknown-pragmas
131 @end smallexample
132
133 @item Debugging Options
134 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
135 @smallexample
136 -a -ax -d@var{letters} -fpretend-float
137 -fprofile-arcs -ftest-coverage
138 -g -g@var{level} -gcoff -gdwarf -gdwarf-1 -gdwarf-1+ -gdwarf-2
139 -ggdb -gstabs -gstabs+ -gxcoff -gxcoff+
140 -p -pg -print-file-name=@var{library} -print-libgcc-file-name
141 -print-prog-name=@var{program} -print-search-dirs -save-temps
142 @end smallexample
143
144 @item Optimization Options
145 @xref{Optimize Options,,Options that Control Optimization}.
146 @smallexample
147 -fbranch-probabilities
148 -fcaller-saves -fcse-follow-jumps -fcse-skip-blocks
149 -fdelayed-branch -fexpensive-optimizations
150 -ffast-math -ffloat-store -fforce-addr -fforce-mem
151 -ffunction-sections -finline-functions
152 -fkeep-inline-functions -fno-default-inline
153 -fno-defer-pop -fno-function-cse
154 -fno-inline -fno-peephole -fomit-frame-pointer -fregmove
155 -frerun-cse-after-loop -frerun-loop-opt -fschedule-insns
156 -fschedule-insns2 -fstrength-reduce -fthread-jumps
157 -funroll-all-loops -funroll-loops
158 -fmove-all-movables -freduce-all-givs
159 -O -O0 -O1 -O2 -O3 -Os
160 @end smallexample
161
162 @item Preprocessor Options
163 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
164 @smallexample
165 -A@var{question}(@var{answer}) -C -dD -dM -dN
166 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H
167 -idirafter @var{dir}
168 -include @var{file} -imacros @var{file}
169 -iprefix @var{file} -iwithprefix @var{dir}
170 -iwithprefixbefore @var{dir} -isystem @var{dir}
171 -M -MD -MM -MMD -MG -nostdinc -P -trigraphs
172 -undef -U@var{macro} -Wp,@var{option}
173 @end smallexample
174
175 @item Assembler Option
176 @xref{Assembler Options,,Passing Options to the Assembler}.
177 @smallexample
178 -Wa,@var{option}
179 @end smallexample
180
181 @item Linker Options
182 @xref{Link Options,,Options for Linking}.
183 @smallexample
184 @var{object-file-name} -l@var{library}
185 -nostartfiles -nodefaultlibs -nostdlib
186 -s -static -shared -symbolic
187 -Wl,@var{option} -Xlinker @var{option}
188 -u @var{symbol}
189 @end smallexample
190
191 @item Directory Options
192 @xref{Directory Options,,Options for Directory Search}.
193 @smallexample
194 -B@var{prefix} -I@var{dir} -I- -L@var{dir} -specs=@var{file}
195 @end smallexample
196
197 @item Target Options
198 @c I wrote this xref this way to avoid overfull hbox. -- rms
199 @xref{Target Options}.
200 @smallexample
201 -b @var{machine} -V @var{version}
202 @end smallexample
203
204 @item Machine Dependent Options
205 @xref{Submodel Options,,Hardware Models and Configurations}.
206 @smallexample
207 @emph{M680x0 Options}
208 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040
209 -m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020
210 -mfpa -mnobitfield -mrtd -mshort -msoft-float
211 -malign-int
212
213 @emph{VAX Options}
214 -mg -mgnu -munix
215
216 @emph{SPARC Options}
217 -mcpu=@var{cpu type}
218 -mtune=@var{cpu type}
219 -mcmodel=@var{code model}
220 -malign-jumps=@var{num} -malign-loops=@var{num}
221 -malign-functions=@var{num}
222 -m32 -m64
223 -mapp-regs -mbroken-saverestore -mcypress -mepilogue
224 -mflat -mfpu -mhard-float -mhard-quad-float
225 -mimpure-text -mlive-g0 -mno-app-regs -mno-epilogue
226 -mno-flat -mno-fpu -mno-impure-text
227 -mno-stack-bias -mno-unaligned-doubles
228 -msoft-float -msoft-quad-float -msparclite -mstack-bias
229 -msupersparc -munaligned-doubles -mv8
230
231 @emph{Convex Options}
232 -mc1 -mc2 -mc32 -mc34 -mc38
233 -margcount -mnoargcount
234 -mlong32 -mlong64
235 -mvolatile-cache -mvolatile-nocache
236
237 @emph{AMD29K Options}
238 -m29000 -m29050 -mbw -mnbw -mdw -mndw
239 -mlarge -mnormal -msmall
240 -mkernel-registers -mno-reuse-arg-regs
241 -mno-stack-check -mno-storem-bug
242 -mreuse-arg-regs -msoft-float -mstack-check
243 -mstorem-bug -muser-registers
244
245 @emph{ARM Options}
246 -mapcs-frame -mno-apcs-frame
247 -mapcs-26 -mapcs-32
248 -mapcs-stack-check -mno-apcs-stack-check
249 -mapcs-float -mno-apcs-float
250 -mapcs-reentrant -mno-apcs-reentrant
251 -msched-prolog -mno-sched-prolog
252 -mlittle-endian -mbig-endian -mwords-little-endian
253 -mshort-load-bytes -mno-short-load-bytes -mshort-load-words -mno-short-load-words
254 -msoft-float -mhard-float -mfpe
255 -mthumb-interwork -mno-thumb-interwork
256 -mcpu= -march= -mfpe=
257 -mstructure-size-boundary=
258 -mbsd -mxopen -mno-symrename
259
260 @emph{Thumb Options}
261 -mtpcs-frame -mno-tpcs-frame
262 -mtpcs-leaf-frame -mno-tpcs-leaf-frame
263 -mlittle-endian -mbig-endian
264 -mthumb-interwork -mno-thumb-interwork
265 -mstructure-size-boundary=
266
267 @emph{MN10300 Options}
268 -mmult-bug
269 -mno-mult-bug
270
271 @emph{M32R/D Options}
272 -mcode-model=@var{model type} -msdata=@var{sdata type}
273 -G @var{num}
274
275 @emph{M88K Options}
276 -m88000 -m88100 -m88110 -mbig-pic
277 -mcheck-zero-division -mhandle-large-shift
278 -midentify-revision -mno-check-zero-division
279 -mno-ocs-debug-info -mno-ocs-frame-position
280 -mno-optimize-arg-area -mno-serialize-volatile
281 -mno-underscores -mocs-debug-info
282 -mocs-frame-position -moptimize-arg-area
283 -mserialize-volatile -mshort-data-@var{num} -msvr3
284 -msvr4 -mtrap-large-shift -muse-div-instruction
285 -mversion-03.00 -mwarn-passed-structs
286
287 @emph{RS/6000 and PowerPC Options}
288 -mcpu=@var{cpu type}
289 -mtune=@var{cpu type}
290 -mpower -mno-power -mpower2 -mno-power2
291 -mpowerpc -mno-powerpc
292 -mpowerpc-gpopt -mno-powerpc-gpopt
293 -mpowerpc-gfxopt -mno-powerpc-gfxopt
294 -mnew-mnemonics -mno-new-mnemonics
295 -mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc
296 -mxl-call -mno-xl-call -mthreads -mpe
297 -msoft-float -mhard-float -mmultiple -mno-multiple
298 -mstring -mno-string -mupdate -mno-update
299 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
300 -mstrict-align -mno-strict-align -mrelocatable
301 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib
302 -mtoc -mno-toc -mtraceback -mno-traceback
303 -mlittle -mlittle-endian -mbig -mbig-endian
304 -mcall-aix -mcall-sysv -mprototype -mno-prototype
305 -msim -mmvme -mads -myellowknife -memb
306 -msdata -msdata=@var{opt} -G @var{num}
307
308 @emph{RT Options}
309 -mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs
310 -mfull-fp-blocks -mhc-struct-return -min-line-mul
311 -mminimum-fp-blocks -mnohc-struct-return
312
313 @emph{MIPS Options}
314 -mabicalls -mcpu=@var{cpu type} -membedded-data
315 -membedded-pic -mfp32 -mfp64 -mgas -mgp32 -mgp64
316 -mgpopt -mhalf-pic -mhard-float -mint64 -mips1
317 -mips2 -mips3 -mlong64 -mlong-calls -mmemcpy
318 -mmips-as -mmips-tfile -mno-abicalls
319 -mno-embedded-data -mno-embedded-pic
320 -mno-gpopt -mno-long-calls
321 -mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats
322 -mrnames -msoft-float
323 -m4650 -msingle-float -mmad
324 -mstats -EL -EB -G @var{num} -nocpp
325
326 @emph{i386 Options}
327 -mcpu=@var{cpu type}
328 -march=@var{cpu type}
329 -mieee-fp -mno-fancy-math-387
330 -mno-fp-ret-in-387 -msoft-float -msvr3-shlib
331 -mno-wide-multiply -mrtd -malign-double
332 -mreg-alloc=@var{list} -mregparm=@var{num}
333 -malign-jumps=@var{num} -malign-loops=@var{num}
334 -malign-functions=@var{num}
335
336 @emph{HPPA Options}
337 -mbig-switch -mdisable-fpregs -mdisable-indexing
338 -mfast-indirect-calls -mgas -mjump-in-delay
339 -mlong-load-store -mno-big-switch -mno-disable-fpregs
340 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
341 -mno-jump-in-delay -mno-long-load-store
342 -mno-portable-runtime -mno-soft-float -mno-space
343 -mno-space-regs -msoft-float -mpa-risc-1-0
344 -mpa-risc-1-1 -mportable-runtime
345 -mschedule=@var{list} -mspace -mspace-regs
346
347 @emph{Intel 960 Options}
348 -m@var{cpu type} -masm-compat -mclean-linkage
349 -mcode-align -mcomplex-addr -mleaf-procedures
350 -mic-compat -mic2.0-compat -mic3.0-compat
351 -mintel-asm -mno-clean-linkage -mno-code-align
352 -mno-complex-addr -mno-leaf-procedures
353 -mno-old-align -mno-strict-align -mno-tail-call
354 -mnumerics -mold-align -msoft-float -mstrict-align
355 -mtail-call
356
357 @emph{DEC Alpha Options}
358 -mfp-regs -mno-fp-regs -mno-soft-float -msoft-float
359 -malpha-as -mgas
360 -mieee -mieee-with-inexact -mieee-conformant
361 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode}
362 -mtrap-precision=@var{mode} -mbuild-constants
363 -mcpu=@var{cpu type}
364 -mbwx -mno-bwx -mcix -mno-cix -mmax -mno-max
365 -mmemory-latency=@var{time}
366
367 @emph{Clipper Options}
368 -mc300 -mc400
369
370 @emph{H8/300 Options}
371 -mrelax -mh -ms -mint32 -malign-300
372
373 @emph{SH Options}
374 -m1 -m2 -m3 -m3e -mb -ml -mrelax
375
376 @emph{System V Options}
377 -Qy -Qn -YP,@var{paths} -Ym,@var{dir}
378
379 @emph{V850 Options}
380 -mlong-calls -mno-long-calls -mep -mno-ep
381 -mprolog-function -mno-prolog-function -mspace
382 -mtda=@var{n} -msda=@var{n} -mzda=@var{n}
383 -mv850 -mbig-switch
384 @end smallexample
385
386 @item Code Generation Options
387 @xref{Code Gen Options,,Options for Code Generation Conventions}.
388 @smallexample
389 -fcall-saved-@var{reg} -fcall-used-@var{reg}
390 -fexceptions -ffixed-@var{reg} -finhibit-size-directive
391 -fcheck-memory-usage -fprefix-function-name
392 -fno-common -fno-ident -fno-gnu-linker
393 -fpcc-struct-return -fpic -fPIC
394 -freg-struct-return -fshared-data -fshort-enums
395 -fshort-double -fvolatile -fvolatile-global
396 -fverbose-asm -fpack-struct -fstack-check +e0 +e1
397 -fargument-alias -fargument-noalias
398 -fargument-noalias-global
399 @end smallexample
400 @end table
401
402 @menu
403 * Overall Options:: Controlling the kind of output:
404 an executable, object files, assembler files,
405 or preprocessed source.
406 * C Dialect Options:: Controlling the variant of C language compiled.
407 * C++ Dialect Options:: Variations on C++.
408 * Warning Options:: How picky should the compiler be?
409 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
410 * Optimize Options:: How much optimization?
411 * Preprocessor Options:: Controlling header files and macro definitions.
412 Also, getting dependency information for Make.
413 * Assembler Options:: Passing options to the assembler.
414 * Link Options:: Specifying libraries and so on.
415 * Directory Options:: Where to find header files and libraries.
416 Where to find the compiler executable files.
417 * Target Options:: Running a cross-compiler, or an old version of GNU CC.
418 @end menu
419
420 @node Overall Options
421 @section Options Controlling the Kind of Output
422
423 Compilation can involve up to four stages: preprocessing, compilation
424 proper, assembly and linking, always in that order. The first three
425 stages apply to an individual source file, and end by producing an
426 object file; linking combines all the object files (those newly
427 compiled, and those specified as input) into an executable file.
428
429 @cindex file name suffix
430 For any given input file, the file name suffix determines what kind of
431 compilation is done:
432
433 @table @code
434 @item @var{file}.c
435 C source code which must be preprocessed.
436
437 @item @var{file}.i
438 C source code which should not be preprocessed.
439
440 @item @var{file}.ii
441 C++ source code which should not be preprocessed.
442
443 @item @var{file}.m
444 Objective-C source code. Note that you must link with the library
445 @file{libobjc.a} to make an Objective-C program work.
446
447 @item @var{file}.h
448 C header file (not to be compiled or linked).
449
450 @item @var{file}.cc
451 @itemx @var{file}.cxx
452 @itemx @var{file}.cpp
453 @itemx @var{file}.C
454 C++ source code which must be preprocessed. Note that in @samp{.cxx},
455 the last two letters must both be literally @samp{x}. Likewise,
456 @samp{.C} refers to a literal capital C.
457
458 @item @var{file}.s
459 Assembler code.
460
461 @item @var{file}.S
462 Assembler code which must be preprocessed.
463
464 @item @var{other}
465 An object file to be fed straight into linking.
466 Any file name with no recognized suffix is treated this way.
467 @end table
468
469 You can specify the input language explicitly with the @samp{-x} option:
470
471 @table @code
472 @item -x @var{language}
473 Specify explicitly the @var{language} for the following input files
474 (rather than letting the compiler choose a default based on the file
475 name suffix). This option applies to all following input files until
476 the next @samp{-x} option. Possible values for @var{language} are:
477 @example
478 c objective-c c++
479 c-header cpp-output c++-cpp-output
480 assembler assembler-with-cpp
481 @end example
482
483 @item -x none
484 Turn off any specification of a language, so that subsequent files are
485 handled according to their file name suffixes (as they are if @samp{-x}
486 has not been used at all).
487 @end table
488
489 If you only want some of the stages of compilation, you can use
490 @samp{-x} (or filename suffixes) to tell @code{gcc} where to start, and
491 one of the options @samp{-c}, @samp{-S}, or @samp{-E} to say where
492 @code{gcc} is to stop. Note that some combinations (for example,
493 @samp{-x cpp-output -E} instruct @code{gcc} to do nothing at all.
494
495 @table @code
496 @item -c
497 Compile or assemble the source files, but do not link. The linking
498 stage simply is not done. The ultimate output is in the form of an
499 object file for each source file.
500
501 By default, the object file name for a source file is made by replacing
502 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
503
504 Unrecognized input files, not requiring compilation or assembly, are
505 ignored.
506
507 @item -S
508 Stop after the stage of compilation proper; do not assemble. The output
509 is in the form of an assembler code file for each non-assembler input
510 file specified.
511
512 By default, the assembler file name for a source file is made by
513 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
514
515 Input files that don't require compilation are ignored.
516
517 @item -E
518 Stop after the preprocessing stage; do not run the compiler proper. The
519 output is in the form of preprocessed source code, which is sent to the
520 standard output.
521
522 Input files which don't require preprocessing are ignored.
523
524 @cindex output file option
525 @item -o @var{file}
526 Place output in file @var{file}. This applies regardless to whatever
527 sort of output is being produced, whether it be an executable file,
528 an object file, an assembler file or preprocessed C code.
529
530 Since only one output file can be specified, it does not make sense to
531 use @samp{-o} when compiling more than one input file, unless you are
532 producing an executable file as output.
533
534 If @samp{-o} is not specified, the default is to put an executable file
535 in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
536 @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
537 all preprocessed C source on standard output.@refill
538
539 @item -v
540 Print (on standard error output) the commands executed to run the stages
541 of compilation. Also print the version number of the compiler driver
542 program and of the preprocessor and the compiler proper.
543
544 @item -pipe
545 Use pipes rather than temporary files for communication between the
546 various stages of compilation. This fails to work on some systems where
547 the assembler is unable to read from a pipe; but the GNU assembler has
548 no trouble.
549 @end table
550
551 @node Invoking G++
552 @section Compiling C++ Programs
553
554 @cindex suffixes for C++ source
555 @cindex C++ source file suffixes
556 C++ source files conventionally use one of the suffixes @samp{.C},
557 @samp{.cc}, @samp{cpp}, or @samp{.cxx}; preprocessed C++ files use the
558 suffix @samp{.ii}. GNU CC recognizes files with these names and
559 compiles them as C++ programs even if you call the compiler the same way
560 as for compiling C programs (usually with the name @code{gcc}).
561
562 @findex g++
563 @findex c++
564 However, C++ programs often require class libraries as well as a
565 compiler that understands the C++ language---and under some
566 circumstances, you might want to compile programs from standard input,
567 or otherwise without a suffix that flags them as C++ programs.
568 @code{g++} is a program that calls GNU CC with the default language
569 set to C++, and automatically specifies linking against the C++
570 library.
571 @cindex @code{g++ 1.@var{xx}}
572 @cindex @code{g++}, separate compiler
573 @cindex @code{g++} older version
574 @footnote{Prior to release 2 of the compiler,
575 there was a separate @code{g++} compiler. That version was based on GNU
576 CC, but not integrated with it. Versions of @code{g++} with a
577 @samp{1.@var{xx}} version number---for example, @code{g++} version 1.37
578 or 1.42---are much less reliable than the versions integrated with GCC
579 2. Moreover, combining G++ @samp{1.@var{xx}} with a version 2 GCC will
580 simply not work.} On many systems, the script @code{g++} is also
581 installed with the name @code{c++}.
582
583 @cindex invoking @code{g++}
584 When you compile C++ programs, you may specify many of the same
585 command-line options that you use for compiling programs in any
586 language; or command-line options meaningful for C and related
587 languages; or options that are meaningful only for C++ programs.
588 @xref{C Dialect Options,,Options Controlling C Dialect}, for
589 explanations of options for languages related to C.
590 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
591 explanations of options that are meaningful only for C++ programs.
592
593 @node C Dialect Options
594 @section Options Controlling C Dialect
595 @cindex dialect options
596 @cindex language dialect options
597 @cindex options, dialect
598
599 The following options control the dialect of C (or languages derived
600 from C, such as C++ and Objective C) that the compiler accepts:
601
602 @table @code
603 @cindex ANSI support
604 @item -ansi
605 Support all ANSI standard C programs.
606
607 This turns off certain features of GNU C that are incompatible with ANSI
608 C, such as the @code{asm}, @code{inline} and @code{typeof} keywords, and
609 predefined macros such as @code{unix} and @code{vax} that identify the
610 type of system you are using. It also enables the undesirable and
611 rarely used ANSI trigraph feature, and it disables recognition of C++
612 style @samp{//} comments.
613
614 The alternate keywords @code{__asm__}, @code{__extension__},
615 @code{__inline__} and @code{__typeof__} continue to work despite
616 @samp{-ansi}. You would not want to use them in an ANSI C program, of
617 course, but it is useful to put them in header files that might be included
618 in compilations done with @samp{-ansi}. Alternate predefined macros
619 such as @code{__unix__} and @code{__vax__} are also available, with or
620 without @samp{-ansi}.
621
622 The @samp{-ansi} option does not cause non-ANSI programs to be
623 rejected gratuitously. For that, @samp{-pedantic} is required in
624 addition to @samp{-ansi}. @xref{Warning Options}.
625
626 The macro @code{__STRICT_ANSI__} is predefined when the @samp{-ansi}
627 option is used. Some header files may notice this macro and refrain
628 from declaring certain functions or defining certain macros that the
629 ANSI standard doesn't call for; this is to avoid interfering with any
630 programs that might use these names for other things.
631
632 The functions @code{alloca}, @code{abort}, @code{exit}, and
633 @code{_exit} are not builtin functions when @samp{-ansi} is used.
634
635 @item -fno-asm
636 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
637 keyword, so that code can use these words as identifiers. You can use
638 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
639 instead. @samp{-ansi} implies @samp{-fno-asm}.
640
641 In C++, this switch only affects the @code{typeof} keyword, since
642 @code{asm} and @code{inline} are standard keywords. You may want to
643 use the @samp{-fno-gnu-keywords} flag instead, as it also disables the
644 other, C++-specific, extension keywords such as @code{headof}.
645
646 @item -fno-builtin
647 @cindex builtin functions
648 @findex abort
649 @findex abs
650 @findex alloca
651 @findex cos
652 @findex exit
653 @findex fabs
654 @findex ffs
655 @findex labs
656 @findex memcmp
657 @findex memcpy
658 @findex sin
659 @findex sqrt
660 @findex strcmp
661 @findex strcpy
662 @findex strlen
663 Don't recognize builtin functions that do not begin with two leading
664 underscores. Currently, the functions affected include @code{abort},
665 @code{abs}, @code{alloca}, @code{cos}, @code{exit}, @code{fabs},
666 @code{ffs}, @code{labs}, @code{memcmp}, @code{memcpy}, @code{sin},
667 @code{sqrt}, @code{strcmp}, @code{strcpy}, and @code{strlen}.
668
669 GCC normally generates special code to handle certain builtin functions
670 more efficiently; for instance, calls to @code{alloca} may become single
671 instructions that adjust the stack directly, and calls to @code{memcpy}
672 may become inline copy loops. The resulting code is often both smaller
673 and faster, but since the function calls no longer appear as such, you
674 cannot set a breakpoint on those calls, nor can you change the behavior
675 of the functions by linking with a different library.
676
677 The @samp{-ansi} option prevents @code{alloca} and @code{ffs} from being
678 builtin functions, since these functions do not have an ANSI standard
679 meaning.
680
681 @item -fhosted
682 @cindex hosted environment
683
684 Assert that compilation takes place in a hosted environment. This implies
685 @samp{-fbuiltin}. A hosted environment is one in which the
686 entire standard library is available, and in which @code{main} has a return
687 type of @code{int}. Examples are nearly everything except a kernel.
688 This is equivalent to @samp{-fno-freestanding}.
689
690 @item -ffreestanding
691 @cindex hosted environment
692
693 Assert that compilation takes place in a freestanding environment. This
694 implies @samp{-fno-builtin}. A freestanding environment
695 is one in which the standard library may not exist, and program startup may
696 not necessarily be at @code{main}. The most obvious example is an OS kernel.
697 This is equivalent to @samp{-fno-hosted}.
698
699 @item -trigraphs
700 Support ANSI C trigraphs. You don't want to know about this
701 brain-damage. The @samp{-ansi} option implies @samp{-trigraphs}.
702
703 @cindex traditional C language
704 @cindex C language, traditional
705 @item -traditional
706 Attempt to support some aspects of traditional C compilers.
707 Specifically:
708
709 @itemize @bullet
710 @item
711 All @code{extern} declarations take effect globally even if they
712 are written inside of a function definition. This includes implicit
713 declarations of functions.
714
715 @item
716 The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
717 and @code{volatile} are not recognized. (You can still use the
718 alternative keywords such as @code{__typeof__}, @code{__inline__}, and
719 so on.)
720
721 @item
722 Comparisons between pointers and integers are always allowed.
723
724 @item
725 Integer types @code{unsigned short} and @code{unsigned char} promote
726 to @code{unsigned int}.
727
728 @item
729 Out-of-range floating point literals are not an error.
730
731 @item
732 Certain constructs which ANSI regards as a single invalid preprocessing
733 number, such as @samp{0xe-0xd}, are treated as expressions instead.
734
735 @item
736 String ``constants'' are not necessarily constant; they are stored in
737 writable space, and identical looking constants are allocated
738 separately. (This is the same as the effect of
739 @samp{-fwritable-strings}.)
740
741 @cindex @code{longjmp} and automatic variables
742 @item
743 All automatic variables not declared @code{register} are preserved by
744 @code{longjmp}. Ordinarily, GNU C follows ANSI C: automatic variables
745 not declared @code{volatile} may be clobbered.
746
747 @item
748 @kindex \x
749 @kindex \a
750 @cindex escape sequences, traditional
751 The character escape sequences @samp{\x} and @samp{\a} evaluate as the
752 literal characters @samp{x} and @samp{a} respectively. Without
753 @w{@samp{-traditional}}, @samp{\x} is a prefix for the hexadecimal
754 representation of a character, and @samp{\a} produces a bell.
755
756 @item
757 In C++ programs, assignment to @code{this} is permitted with
758 @samp{-traditional}. (The option @samp{-fthis-is-variable} also has
759 this effect.)
760 @end itemize
761
762 You may wish to use @samp{-fno-builtin} as well as @samp{-traditional}
763 if your program uses names that are normally GNU C builtin functions for
764 other purposes of its own.
765
766 You cannot use @samp{-traditional} if you include any header files that
767 rely on ANSI C features. Some vendors are starting to ship systems with
768 ANSI C header files and you cannot use @samp{-traditional} on such
769 systems to compile files that include any system headers.
770
771 The @samp{-traditional} option also enables @samp{-traditional-cpp},
772 which is described next.
773
774 @item -traditional-cpp
775 Attempt to support some aspects of traditional C preprocessors.
776 Specifically:
777
778 @itemize @bullet
779 @item
780 Comments convert to nothing at all, rather than to a space. This allows
781 traditional token concatenation.
782
783 @item
784 In a preprocessing directive, the @samp{#} symbol must appear as the first
785 character of a line.
786
787 @item
788 Macro arguments are recognized within string constants in a macro
789 definition (and their values are stringified, though without additional
790 quote marks, when they appear in such a context). The preprocessor
791 always considers a string constant to end at a newline.
792
793 @item
794 @cindex detecting @w{@samp{-traditional}}
795 The predefined macro @code{__STDC__} is not defined when you use
796 @samp{-traditional}, but @code{__GNUC__} is (since the GNU extensions
797 which @code{__GNUC__} indicates are not affected by
798 @samp{-traditional}). If you need to write header files that work
799 differently depending on whether @samp{-traditional} is in use, by
800 testing both of these predefined macros you can distinguish four
801 situations: GNU C, traditional GNU C, other ANSI C compilers, and other
802 old C compilers. The predefined macro @code{__STDC_VERSION__} is also
803 not defined when you use @samp{-traditional}. @xref{Standard
804 Predefined,,Standard Predefined Macros,cpp.info,The C Preprocessor},
805 for more discussion of these and other predefined macros.
806
807 @item
808 @cindex string constants vs newline
809 @cindex newline vs string constants
810 The preprocessor considers a string constant to end at a newline (unless
811 the newline is escaped with @samp{\}). (Without @w{@samp{-traditional}},
812 string constants can contain the newline character as typed.)
813 @end itemize
814
815 @item -fcond-mismatch
816 Allow conditional expressions with mismatched types in the second and
817 third arguments. The value of such an expression is void.
818
819 @item -funsigned-char
820 Let the type @code{char} be unsigned, like @code{unsigned char}.
821
822 Each kind of machine has a default for what @code{char} should
823 be. It is either like @code{unsigned char} by default or like
824 @code{signed char} by default.
825
826 Ideally, a portable program should always use @code{signed char} or
827 @code{unsigned char} when it depends on the signedness of an object.
828 But many programs have been written to use plain @code{char} and
829 expect it to be signed, or expect it to be unsigned, depending on the
830 machines they were written for. This option, and its inverse, let you
831 make such a program work with the opposite default.
832
833 The type @code{char} is always a distinct type from each of
834 @code{signed char} or @code{unsigned char}, even though its behavior
835 is always just like one of those two.
836
837 @item -fsigned-char
838 Let the type @code{char} be signed, like @code{signed char}.
839
840 Note that this is equivalent to @samp{-fno-unsigned-char}, which is
841 the negative form of @samp{-funsigned-char}. Likewise, the option
842 @samp{-fno-signed-char} is equivalent to @samp{-funsigned-char}.
843
844 You may wish to use @samp{-fno-builtin} as well as @samp{-traditional}
845 if your program uses names that are normally GNU C builtin functions for
846 other purposes of its own.
847
848 You cannot use @samp{-traditional} if you include any header files that
849 rely on ANSI C features. Some vendors are starting to ship systems with
850 ANSI C header files and you cannot use @samp{-traditional} on such
851 systems to compile files that include any system headers.
852
853 @item -fsigned-bitfields
854 @itemx -funsigned-bitfields
855 @itemx -fno-signed-bitfields
856 @itemx -fno-unsigned-bitfields
857 These options control whether a bitfield is signed or unsigned, when the
858 declaration does not use either @code{signed} or @code{unsigned}. By
859 default, such a bitfield is signed, because this is consistent: the
860 basic integer types such as @code{int} are signed types.
861
862 However, when @samp{-traditional} is used, bitfields are all unsigned
863 no matter what.
864
865 @item -fwritable-strings
866 Store string constants in the writable data segment and don't uniquize
867 them. This is for compatibility with old programs which assume they can
868 write into string constants. The option @samp{-traditional} also has
869 this effect.
870
871 Writing into string constants is a very bad idea; ``constants'' should
872 be constant.
873
874 @item -fallow-single-precision
875 Do not promote single precision math operations to double precision,
876 even when compiling with @samp{-traditional}.
877
878 Traditional K&R C promotes all floating point operations to double
879 precision, regardless of the sizes of the operands. On the
880 architecture for which you are compiling, single precision may be faster
881 than double precision. If you must use @samp{-traditional}, but want
882 to use single precision operations when the operands are single
883 precision, use this option. This option has no effect when compiling
884 with ANSI or GNU C conventions (the default).
885
886 @end table
887
888 @node C++ Dialect Options
889 @section Options Controlling C++ Dialect
890
891 @cindex compiler options, C++
892 @cindex C++ options, command line
893 @cindex options, C++
894 This section describes the command-line options that are only meaningful
895 for C++ programs; but you can also use most of the GNU compiler options
896 regardless of what language your program is in. For example, you
897 might compile a file @code{firstClass.C} like this:
898
899 @example
900 g++ -g -felide-constructors -O -c firstClass.C
901 @end example
902
903 @noindent
904 In this example, only @samp{-felide-constructors} is an option meant
905 only for C++ programs; you can use the other options with any
906 language supported by GNU CC.
907
908 Here is a list of options that are @emph{only} for compiling C++ programs:
909
910 @table @code
911 @item -fno-access-control
912 Turn off all access checking. This switch is mainly useful for working
913 around bugs in the access control code.
914
915 @item -fall-virtual
916 Treat all possible member functions as virtual, implicitly.
917 All member functions (except for constructor functions and @code{new} or
918 @code{delete} member operators) are treated as virtual functions of the
919 class where they appear.
920
921 This does not mean that all calls to these member functions will be made
922 through the internal table of virtual functions. Under some
923 circumstances, the compiler can determine that a call to a given virtual
924 function can be made directly; in these cases the calls are direct in
925 any case.
926
927 @item -fcheck-new
928 Check that the pointer returned by @code{operator new} is non-null
929 before attempting to modify the storage allocated. The current Working
930 Paper requires that @code{operator new} never return a null pointer, so
931 this check is normally unnecessary.
932
933 @item -fconserve-space
934 Put uninitialized or runtime-initialized global variables into the
935 common segment, as C does. This saves space in the executable at the
936 cost of not diagnosing duplicate definitions. If you compile with this
937 flag and your program mysteriously crashes after @code{main()} has
938 completed, you may have an object that is being destroyed twice because
939 two definitions were merged.
940
941 @item -fdollars-in-identifiers
942 Accept @samp{$} in identifiers. You can also explicitly prohibit use of
943 @samp{$} with the option @samp{-fno-dollars-in-identifiers}. (GNU C allows
944 @samp{$} by default on most target systems, but there are a few exceptions.)
945 Traditional C allowed the character @samp{$} to form part of
946 identifiers. However, ANSI C and C++ forbid @samp{$} in identifiers.
947
948 @item -fenum-int-equiv
949 Anachronistically permit implicit conversion of @code{int} to
950 enumeration types. Current C++ allows conversion of @code{enum} to
951 @code{int}, but not the other way around.
952
953 @item -fexternal-templates
954 Cause template instantiations to obey @samp{#pragma interface} and
955 @samp{implementation}; template instances are emitted or not according
956 to the location of the template definition. @xref{Template
957 Instantiation}, for more information.
958
959 This option is deprecated.
960
961 @item -falt-external-templates
962 Similar to -fexternal-templates, but template instances are emitted or
963 not according to the place where they are first instantiated.
964 @xref{Template Instantiation}, for more information.
965
966 This option is deprecated.
967
968 @item -ffor-scope
969 @itemx -fno-for-scope
970 If -ffor-scope is specified, the scope of variables declared in
971 a @i{for-init-statement} is limited to the @samp{for} loop itself,
972 as specified by the draft C++ standard.
973 If -fno-for-scope is specified, the scope of variables declared in
974 a @i{for-init-statement} extends to the end of the enclosing scope,
975 as was the case in old versions of gcc, and other (traditional)
976 implementations of C++.
977
978 The default if neither flag is given to follow the standard,
979 but to allow and give a warning for old-style code that would
980 otherwise be invalid, or have different behavior.
981
982 @item -fno-gnu-keywords
983 Do not recognize @code{classof}, @code{headof}, @code{signature},
984 @code{sigof} or @code{typeof} as a keyword, so that code can use these
985 words as identifiers. You can use the keywords @code{__classof__},
986 @code{__headof__}, @code{__signature__}, @code{__sigof__}, and
987 @code{__typeof__} instead. @samp{-ansi} implies
988 @samp{-fno-gnu-keywords}.
989
990 @item -fguiding-decls
991 Treat a function declaration with the same type as a potential function
992 template instantiation as though it declares that instantiation, not a
993 normal function. If a definition is given for the function later in the
994 translation unit (or another translation unit if the target supports
995 weak symbols), that definition will be used; otherwise the template will
996 be instantiated. This behavior reflects the C++ language prior to
997 September 1996, when guiding declarations were removed.
998
999 This option implies @samp{-fname-mangling-version-0}, and will not work
1000 with other name mangling versions.
1001
1002 @item -fno-implicit-templates
1003 Never emit code for templates which are instantiated implicitly (i.e. by
1004 use); only emit code for explicit instantiations. @xref{Template
1005 Instantiation}, for more information.
1006
1007 @item -fhandle-signatures
1008 Recognize the @code{signature} and @code{sigof} keywords for specifying
1009 abstract types. The default (@samp{-fno-handle-signatures}) is not to
1010 recognize them. @xref{C++ Signatures, Type Abstraction using
1011 Signatures}.
1012
1013 @item -fhuge-objects
1014 Support virtual function calls for objects that exceed the size
1015 representable by a @samp{short int}. Users should not use this flag by
1016 default; if you need to use it, the compiler will tell you so. If you
1017 compile any of your code with this flag, you must compile @emph{all} of
1018 your code with this flag (including the C++ library, if you use it).
1019
1020 This flag is not useful when compiling with -fvtable-thunks.
1021
1022 @item -fno-implement-inlines
1023 To save space, do not emit out-of-line copies of inline functions
1024 controlled by @samp{#pragma implementation}. This will cause linker
1025 errors if these functions are not inlined everywhere they are called.
1026
1027 @item -fmemoize-lookups
1028 @itemx -fsave-memoized
1029 Use heuristics to compile faster. These heuristics are not enabled by
1030 default, since they are only effective for certain input files. Other
1031 input files compile more slowly.
1032
1033 The first time the compiler must build a call to a member function (or
1034 reference to a data member), it must (1) determine whether the class
1035 implements member functions of that name; (2) resolve which member
1036 function to call (which involves figuring out what sorts of type
1037 conversions need to be made); and (3) check the visibility of the member
1038 function to the caller. All of this adds up to slower compilation.
1039 Normally, the second time a call is made to that member function (or
1040 reference to that data member), it must go through the same lengthy
1041 process again. This means that code like this:
1042
1043 @smallexample
1044 cout << "This " << p << " has " << n << " legs.\n";
1045 @end smallexample
1046
1047 @noindent
1048 makes six passes through all three steps. By using a software cache, a
1049 ``hit'' significantly reduces this cost. Unfortunately, using the cache
1050 introduces another layer of mechanisms which must be implemented, and so
1051 incurs its own overhead. @samp{-fmemoize-lookups} enables the software
1052 cache.
1053
1054 Because access privileges (visibility) to members and member functions
1055 may differ from one function context to the next, G++ may need to flush
1056 the cache. With the @samp{-fmemoize-lookups} flag, the cache is flushed
1057 after every function that is compiled. The @samp{-fsave-memoized} flag
1058 enables the same software cache, but when the compiler determines that
1059 the context of the last function compiled would yield the same access
1060 privileges of the next function to compile, it preserves the cache.
1061 This is most helpful when defining many member functions for the same
1062 class: with the exception of member functions which are friends of other
1063 classes, each member function has exactly the same access privileges as
1064 every other, and the cache need not be flushed.
1065
1066 The code that implements these flags has rotted; you should probably
1067 avoid using them.
1068
1069 @item -fstrict-prototype
1070 Within an @samp{extern "C"} linkage specification, treat a function
1071 declaration with no arguments, such as @samp{int foo ();}, as declaring
1072 the function to take no arguments. Normally, such a declaration means
1073 that the function @code{foo} can take any combination of arguments, as
1074 in C. @samp{-pedantic} implies @samp{-fstrict-prototype} unless
1075 overridden with @samp{-fno-strict-prototype}.
1076
1077 This flag no longer affects declarations with C++ linkage.
1078
1079 @item -fname-mangling-version-@var{n}
1080 Control the way in which names are mangled. Version 0 is compatible
1081 with versions of g++ before 2.8. Version 1 is the default. Version 1
1082 will allow correct mangling of function templates. For example,
1083 version 0 mangling does not mangle foo<int, double> and foo<int, char>
1084 given this declaration:
1085
1086 @example
1087 template <class T, class U> void foo(T t);
1088 @end example
1089
1090 @item -fno-nonnull-objects
1091 Don't assume that a reference is initialized to refer to a valid object.
1092 Although the current C++ Working Paper prohibits null references, some
1093 old code may rely on them, and you can use @samp{-fno-nonnull-objects}
1094 to turn on checking.
1095
1096 At the moment, the compiler only does this checking for conversions to
1097 virtual base classes.
1098
1099 @item -foperator-names
1100 Recognize the operator name keywords @code{and}, @code{bitand},
1101 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1102 synonyms for the symbols they refer to. @samp{-ansi} implies
1103 @samp{-foperator-names}.
1104
1105 @item -frepo
1106 Enable automatic template instantiation. This option also implies
1107 @samp{-fno-implicit-templates}. @xref{Template Instantiation}, for more
1108 information.
1109
1110 @item -fsquangle
1111 @itemx -fno-squangle
1112 @samp{-fsquangle} will enable a compressed form of name mangling for
1113 identifiers. In particular, it helps to shorten very long names by recognizing
1114 types and class names which occur more than once, replacing them with special
1115 short ID codes. This option also requires any C++ libraries being used to
1116 be compiled with this option as well. The compiler has this disabled (the
1117 equivalent of @samp{-fno-squangle}) by default.
1118
1119 @item -fthis-is-variable
1120 Permit assignment to @code{this}. The incorporation of user-defined
1121 free store management into C++ has made assignment to @samp{this} an
1122 anachronism. Therefore, by default it is invalid to assign to
1123 @code{this} within a class member function; that is, GNU C++ treats
1124 @samp{this} in a member function of class @code{X} as a non-lvalue of
1125 type @samp{X *}. However, for backwards compatibility, you can make it
1126 valid with @samp{-fthis-is-variable}.
1127
1128 @item -fvtable-thunks
1129 Use @samp{thunks} to implement the virtual function dispatch table
1130 (@samp{vtable}). The traditional (cfront-style) approach to
1131 implementing vtables was to store a pointer to the function and two
1132 offsets for adjusting the @samp{this} pointer at the call site. Newer
1133 implementations store a single pointer to a @samp{thunk} function which
1134 does any necessary adjustment and then calls the target function.
1135
1136 This option also enables a heuristic for controlling emission of
1137 vtables; if a class has any non-inline virtual functions, the vtable
1138 will be emitted in the translation unit containing the first one of
1139 those.
1140
1141 @item -ftemplate-depth-@var{n}
1142 Set the maximum instantiation depth for template classes to @var{n}.
1143 A limit on the template instantiation depth is needed to detect
1144 endless recursions during template class instantiation. ANSI/ISO C++
1145 conforming programs must not rely on a maximum depth greater than 17.
1146
1147 @item -nostdinc++
1148 Do not search for header files in the standard directories specific to
1149 C++, but do still search the other standard directories. (This option
1150 is used when building the C++ library.)
1151
1152 @item -traditional
1153 For C++ programs (in addition to the effects that apply to both C and
1154 C++), this has the same effect as @samp{-fthis-is-variable}.
1155 @xref{C Dialect Options,, Options Controlling C Dialect}.
1156 @end table
1157
1158 In addition, these optimization, warning, and code generation options
1159 have meanings only for C++ programs:
1160
1161 @table @code
1162 @item -fno-default-inline
1163 Do not assume @samp{inline} for functions defined inside a class scope.
1164 @xref{Optimize Options,,Options That Control Optimization}.
1165
1166 @item -Wold-style-cast
1167 @itemx -Woverloaded-virtual
1168 @itemx -Wtemplate-debugging
1169 Warnings that apply only to C++ programs. @xref{Warning
1170 Options,,Options to Request or Suppress Warnings}.
1171
1172 @item -Weffc++
1173 Warn about violation of some style rules from Effective C++ by Scott Myers.
1174
1175 @item +e@var{n}
1176 Control how virtual function definitions are used, in a fashion
1177 compatible with @code{cfront} 1.x. @xref{Code Gen Options,,Options for
1178 Code Generation Conventions}.
1179 @end table
1180
1181 @node Warning Options
1182 @section Options to Request or Suppress Warnings
1183 @cindex options to control warnings
1184 @cindex warning messages
1185 @cindex messages, warning
1186 @cindex suppressing warnings
1187
1188 Warnings are diagnostic messages that report constructions which
1189 are not inherently erroneous but which are risky or suggest there
1190 may have been an error.
1191
1192 You can request many specific warnings with options beginning @samp{-W},
1193 for example @samp{-Wimplicit} to request warnings on implicit
1194 declarations. Each of these specific warning options also has a
1195 negative form beginning @samp{-Wno-} to turn off warnings;
1196 for example, @samp{-Wno-implicit}. This manual lists only one of the
1197 two forms, whichever is not the default.
1198
1199 These options control the amount and kinds of warnings produced by GNU
1200 CC:
1201
1202 @table @code
1203 @cindex syntax checking
1204 @item -fsyntax-only
1205 Check the code for syntax errors, but don't do anything beyond that.
1206
1207 @item -pedantic
1208 Issue all the warnings demanded by strict ANSI C and ISO C++;
1209 reject all programs that use forbidden extensions.
1210
1211 Valid ANSI C and ISO C++ programs should compile properly with or without
1212 this option (though a rare few will require @samp{-ansi}). However,
1213 without this option, certain GNU extensions and traditional C and C++
1214 features are supported as well. With this option, they are rejected.
1215
1216 @samp{-pedantic} does not cause warning messages for use of the
1217 alternate keywords whose names begin and end with @samp{__}. Pedantic
1218 warnings are also disabled in the expression that follows
1219 @code{__extension__}. However, only system header files should use
1220 these escape routes; application programs should avoid them.
1221 @xref{Alternate Keywords}.
1222
1223 This option is not intended to be @i{useful}; it exists only to satisfy
1224 pedants who would otherwise claim that GNU CC fails to support the ANSI
1225 standard.
1226
1227 Some users try to use @samp{-pedantic} to check programs for strict ANSI
1228 C conformance. They soon find that it does not do quite what they want:
1229 it finds some non-ANSI practices, but not all---only those for which
1230 ANSI C @emph{requires} a diagnostic.
1231
1232 A feature to report any failure to conform to ANSI C might be useful in
1233 some instances, but would require considerable additional work and would
1234 be quite different from @samp{-pedantic}. We recommend, rather, that
1235 users take advantage of the extensions of GNU C and disregard the
1236 limitations of other compilers. Aside from certain supercomputers and
1237 obsolete small machines, there is less and less reason ever to use any
1238 other C compiler other than for bootstrapping GNU CC.
1239
1240 @item -pedantic-errors
1241 Like @samp{-pedantic}, except that errors are produced rather than
1242 warnings.
1243
1244 @item -w
1245 Inhibit all warning messages.
1246
1247 @item -Wno-import
1248 Inhibit warning messages about the use of @samp{#import}.
1249
1250 @item -Wchar-subscripts
1251 Warn if an array subscript has type @code{char}. This is a common cause
1252 of error, as programmers often forget that this type is signed on some
1253 machines.
1254
1255 @item -Wcomment
1256 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
1257 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
1258
1259 @item -Wformat
1260 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
1261 the arguments supplied have types appropriate to the format string
1262 specified.
1263
1264 @item -Wimplicit-int
1265 Warn when a declaration does not specify a type.
1266
1267 @item -Wimplicit-function-declarations
1268 Warn whenever a function is used before being declared.
1269
1270 @item -Wimplicit
1271 Same as @samp{-Wimplicit-int} and @samp{-Wimplicit-function-}@*
1272 @samp{declaration}.
1273
1274 @item -Wmain
1275 Warn if the type of @samp{main} is suspicious. @samp{main} should be a
1276 function with external linkage, returning int, taking either zero
1277 arguments, two, or three arguments of appropriate types.
1278
1279 @item -Wparentheses
1280 Warn if parentheses are omitted in certain contexts, such
1281 as when there is an assignment in a context where a truth value
1282 is expected, or when operators are nested whose precedence people
1283 often get confused about.
1284
1285 Also warn about constructions where there may be confusion to which
1286 @code{if} statement an @code{else} branch belongs. Here is an example of
1287 such a case:
1288
1289 @smallexample
1290 @{
1291 if (a)
1292 if (b)
1293 foo ();
1294 else
1295 bar ();
1296 @}
1297 @end smallexample
1298
1299 In C, every @code{else} branch belongs to the innermost possible @code{if}
1300 statement, which in this example is @code{if (b)}. This is often not
1301 what the programmer expected, as illustrated in the above example by
1302 indentation the programmer chose. When there is the potential for this
1303 confusion, GNU C will issue a warning when this flag is specified.
1304 To eliminate the warning, add explicit braces around the innermost
1305 @code{if} statement so there is no way the @code{else} could belong to
1306 the enclosing @code{if}. The resulting code would look like this:
1307
1308 @smallexample
1309 @{
1310 if (a)
1311 @{
1312 if (b)
1313 foo ();
1314 else
1315 bar ();
1316 @}
1317 @}
1318 @end smallexample
1319
1320 @item -Wreturn-type
1321 Warn whenever a function is defined with a return-type that defaults
1322 to @code{int}. Also warn about any @code{return} statement with no
1323 return-value in a function whose return-type is not @code{void}.
1324
1325 @item -Wswitch
1326 Warn whenever a @code{switch} statement has an index of enumeral type
1327 and lacks a @code{case} for one or more of the named codes of that
1328 enumeration. (The presence of a @code{default} label prevents this
1329 warning.) @code{case} labels outside the enumeration range also
1330 provoke warnings when this option is used.
1331
1332 @item -Wtrigraphs
1333 Warn if any trigraphs are encountered (assuming they are enabled).
1334
1335 @item -Wunused
1336 Warn whenever a variable is unused aside from its declaration,
1337 whenever a function is declared static but never defined, whenever a
1338 label is declared but not used, and whenever a statement computes a
1339 result that is explicitly not used.
1340
1341 In order to get a warning about an unused function parameter, you must
1342 specify both @samp{-W} and @samp{-Wunused}.
1343
1344 To suppress this warning for an expression, simply cast it to void. For
1345 unused variables and parameters, use the @samp{unused} attribute
1346 (@pxref{Variable Attributes}).
1347
1348 @item -Wuninitialized
1349 An automatic variable is used without first being initialized.
1350
1351 These warnings are possible only in optimizing compilation,
1352 because they require data flow information that is computed only
1353 when optimizing. If you don't specify @samp{-O}, you simply won't
1354 get these warnings.
1355
1356 These warnings occur only for variables that are candidates for
1357 register allocation. Therefore, they do not occur for a variable that
1358 is declared @code{volatile}, or whose address is taken, or whose size
1359 is other than 1, 2, 4 or 8 bytes. Also, they do not occur for
1360 structures, unions or arrays, even when they are in registers.
1361
1362 Note that there may be no warning about a variable that is used only
1363 to compute a value that itself is never used, because such
1364 computations may be deleted by data flow analysis before the warnings
1365 are printed.
1366
1367 These warnings are made optional because GNU CC is not smart
1368 enough to see all the reasons why the code might be correct
1369 despite appearing to have an error. Here is one example of how
1370 this can happen:
1371
1372 @smallexample
1373 @{
1374 int x;
1375 switch (y)
1376 @{
1377 case 1: x = 1;
1378 break;
1379 case 2: x = 4;
1380 break;
1381 case 3: x = 5;
1382 @}
1383 foo (x);
1384 @}
1385 @end smallexample
1386
1387 @noindent
1388 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
1389 always initialized, but GNU CC doesn't know this. Here is
1390 another common case:
1391
1392 @smallexample
1393 @{
1394 int save_y;
1395 if (change_y) save_y = y, y = new_y;
1396 @dots{}
1397 if (change_y) y = save_y;
1398 @}
1399 @end smallexample
1400
1401 @noindent
1402 This has no bug because @code{save_y} is used only if it is set.
1403
1404 Some spurious warnings can be avoided if you declare all the functions
1405 you use that never return as @code{noreturn}. @xref{Function
1406 Attributes}.
1407
1408 @item -Wreorder (C++ only)
1409 @cindex reordering, warning
1410 @cindex warning for reordering of member initializers
1411 Warn when the order of member initializers given in the code does not
1412 match the order in which they must be executed. For instance:
1413
1414 @smallexample
1415 struct A @{
1416 int i;
1417 int j;
1418 A(): j (0), i (1) @{ @}
1419 @};
1420 @end smallexample
1421
1422 Here the compiler will warn that the member initializers for @samp{i}
1423 and @samp{j} will be rearranged to match the declaration order of the
1424 members.
1425
1426 @item -Wtemplate-debugging
1427 @cindex template debugging
1428 When using templates in a C++ program, warn if debugging is not yet
1429 fully available (C++ only).
1430
1431 @item -Wunknown-pragmas
1432 @cindex warning for unknown pragmas
1433 @cindex unknown pragmas, warning
1434 @cindex pragmas, warning of unknown
1435 Warn when a #pragma directive is encountered which is not understood by
1436 GCC. If this command line option is used, warnings will even be issued
1437 for unknown pragmas in system header files. This is not the case if
1438 the warnings were only enabled by the @samp{-Wall} command line option.
1439
1440 @item -Wall
1441 All of the above @samp{-W} options combined. This enables all the
1442 warnings about constructions that some users consider questionable, and
1443 that are easy to avoid (or modify to prevent the warning), even in
1444 conjunction with macros.
1445 @end table
1446
1447 The following @samp{-W@dots{}} options are not implied by @samp{-Wall}.
1448 Some of them warn about constructions that users generally do not
1449 consider questionable, but which occasionally you might wish to check
1450 for; others warn about constructions that are necessary or hard to avoid
1451 in some cases, and there is no simple way to modify the code to suppress
1452 the warning.
1453
1454 @table @code
1455 @item -W
1456 Print extra warning messages for these events:
1457
1458 @itemize @bullet
1459 @cindex @code{longjmp} warnings
1460 @item
1461 A nonvolatile automatic variable might be changed by a call to
1462 @code{longjmp}. These warnings as well are possible only in
1463 optimizing compilation.
1464
1465 The compiler sees only the calls to @code{setjmp}. It cannot know
1466 where @code{longjmp} will be called; in fact, a signal handler could
1467 call it at any point in the code. As a result, you may get a warning
1468 even when there is in fact no problem because @code{longjmp} cannot
1469 in fact be called at the place which would cause a problem.
1470
1471 @item
1472 A function can return either with or without a value. (Falling
1473 off the end of the function body is considered returning without
1474 a value.) For example, this function would evoke such a
1475 warning:
1476
1477 @smallexample
1478 @group
1479 foo (a)
1480 @{
1481 if (a > 0)
1482 return a;
1483 @}
1484 @end group
1485 @end smallexample
1486
1487 @item
1488 An expression-statement or the left-hand side of a comma expression
1489 contains no side effects.
1490 To suppress the warning, cast the unused expression to void.
1491 For example, an expression such as @samp{x[i,j]} will cause a warning,
1492 but @samp{x[(void)i,j]} will not.
1493
1494 @item
1495 An unsigned value is compared against zero with @samp{<} or @samp{<=}.
1496
1497 @item
1498 A comparison like @samp{x<=y<=z} appears; this is equivalent to
1499 @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
1500 that of ordinary mathematical notation.
1501
1502 @item
1503 Storage-class specifiers like @code{static} are not the first things in
1504 a declaration. According to the C Standard, this usage is obsolescent.
1505
1506 @item
1507 If @samp{-Wall} or @samp{-Wunused} is also specified, warn about unused
1508 arguments.
1509
1510 @item
1511 A comparison between signed and unsigned values could produce an
1512 incorrect result when the signed value is converted to unsigned.
1513 (But don't warn if @samp{-Wno-sign-compare} is also specified.)
1514
1515 @item
1516 An aggregate has a partly bracketed initializer.
1517 For example, the following code would evoke such a warning,
1518 because braces are missing around the initializer for @code{x.h}:
1519
1520 @smallexample
1521 struct s @{ int f, g; @};
1522 struct t @{ struct s h; int i; @};
1523 struct t x = @{ 1, 2, 3 @};
1524 @end smallexample
1525 @end itemize
1526
1527 @item -Wtraditional
1528 Warn about certain constructs that behave differently in traditional and
1529 ANSI C.
1530
1531 @itemize @bullet
1532 @item
1533 Macro arguments occurring within string constants in the macro body.
1534 These would substitute the argument in traditional C, but are part of
1535 the constant in ANSI C.
1536
1537 @item
1538 A function declared external in one block and then used after the end of
1539 the block.
1540
1541 @item
1542 A @code{switch} statement has an operand of type @code{long}.
1543 @end itemize
1544
1545 @item -Wundef
1546 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
1547
1548 @item -Wshadow
1549 Warn whenever a local variable shadows another local variable.
1550
1551 @item -Wid-clash-@var{len}
1552 Warn whenever two distinct identifiers match in the first @var{len}
1553 characters. This may help you prepare a program that will compile
1554 with certain obsolete, brain-damaged compilers.
1555
1556 @item -Wlarger-than-@var{len}
1557 Warn whenever an object of larger than @var{len} bytes is defined.
1558
1559 @item -Wpointer-arith
1560 Warn about anything that depends on the ``size of'' a function type or
1561 of @code{void}. GNU C assigns these types a size of 1, for
1562 convenience in calculations with @code{void *} pointers and pointers
1563 to functions.
1564
1565 @item -Wbad-function-cast
1566 Warn whenever a function call is cast to a non-matching type.
1567 For example, warn if @code{int malloc()} is cast to @code{anything *}.
1568
1569 @item -Wcast-qual
1570 Warn whenever a pointer is cast so as to remove a type qualifier from
1571 the target type. For example, warn if a @code{const char *} is cast
1572 to an ordinary @code{char *}.
1573
1574 @item -Wcast-align
1575 Warn whenever a pointer is cast such that the required alignment of the
1576 target is increased. For example, warn if a @code{char *} is cast to
1577 an @code{int *} on machines where integers can only be accessed at
1578 two- or four-byte boundaries.
1579
1580 @item -Wwrite-strings
1581 Give string constants the type @code{const char[@var{length}]} so that
1582 copying the address of one into a non-@code{const} @code{char *}
1583 pointer will get a warning. These warnings will help you find at
1584 compile time code that can try to write into a string constant, but
1585 only if you have been very careful about using @code{const} in
1586 declarations and prototypes. Otherwise, it will just be a nuisance;
1587 this is why we did not make @samp{-Wall} request these warnings.
1588
1589 @item -Wconversion
1590 Warn if a prototype causes a type conversion that is different from what
1591 would happen to the same argument in the absence of a prototype. This
1592 includes conversions of fixed point to floating and vice versa, and
1593 conversions changing the width or signedness of a fixed point argument
1594 except when the same as the default promotion.
1595
1596 Also, warn if a negative integer constant expression is implicitly
1597 converted to an unsigned type. For example, warn about the assignment
1598 @code{x = -1} if @code{x} is unsigned. But do not warn about explicit
1599 casts like @code{(unsigned) -1}.
1600
1601 @item -Wsign-compare
1602 @cindex warning for comparison of signed and unsigned values
1603 @cindex comparison of signed and unsigned values, warning
1604 @cindex signed and unsigned values, comparison warning
1605 Warn when a comparison between signed and unsigned values could produce
1606 an incorrect result when the signed value is converted to unsigned.
1607 This warning is also enabled by @samp{-W}; to get the other warnings
1608 of @samp{-W} without this warning, use @samp{-W -Wno-sign-compare}.
1609
1610 @item -Waggregate-return
1611 Warn if any functions that return structures or unions are defined or
1612 called. (In languages where you can return an array, this also elicits
1613 a warning.)
1614
1615 @item -Wstrict-prototypes
1616 Warn if a function is declared or defined without specifying the
1617 argument types. (An old-style function definition is permitted without
1618 a warning if preceded by a declaration which specifies the argument
1619 types.)
1620
1621 @item -Wmissing-prototypes
1622 Warn if a global function is defined without a previous prototype
1623 declaration. This warning is issued even if the definition itself
1624 provides a prototype. The aim is to detect global functions that fail
1625 to be declared in header files.
1626
1627 @item -Wmissing-declarations
1628 Warn if a global function is defined without a previous declaration.
1629 Do so even if the definition itself provides a prototype.
1630 Use this option to detect global functions that are not declared in
1631 header files.
1632
1633 @item -Wredundant-decls
1634 Warn if anything is declared more than once in the same scope, even in
1635 cases where multiple declaration is valid and changes nothing.
1636
1637 @item -Wnested-externs
1638 Warn if an @code{extern} declaration is encountered within an function.
1639
1640 @item -Winline
1641 Warn if a function can not be inlined, and either it was declared as inline,
1642 or else the @samp{-finline-functions} option was given.
1643
1644 @item -Wold-style-cast
1645 Warn if an old-style (C-style) cast is used within a program.
1646
1647 @item -Woverloaded-virtual
1648 @cindex overloaded virtual fn, warning
1649 @cindex warning for overloaded virtual fn
1650 Warn when a derived class function declaration may be an error in
1651 defining a virtual function (C++ only). In a derived class, the
1652 definitions of virtual functions must match the type signature of a
1653 virtual function declared in the base class. With this option, the
1654 compiler warns when you define a function with the same name as a
1655 virtual function, but with a type signature that does not match any
1656 declarations from the base class.
1657
1658 @item -Wsynth (C++ only)
1659 @cindex warning for synthesized methods
1660 @cindex synthesized methods, warning
1661 Warn when g++'s synthesis behavior does not match that of cfront. For
1662 instance:
1663
1664 @smallexample
1665 struct A @{
1666 operator int ();
1667 A& operator = (int);
1668 @};
1669
1670 main ()
1671 @{
1672 A a,b;
1673 a = b;
1674 @}
1675 @end smallexample
1676
1677 In this example, g++ will synthesize a default @samp{A& operator =
1678 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1679
1680 @item -Werror
1681 Make all warnings into errors.
1682 @end table
1683
1684 @node Debugging Options
1685 @section Options for Debugging Your Program or GNU CC
1686 @cindex options, debugging
1687 @cindex debugging information options
1688
1689 GNU CC has various special options that are used for debugging
1690 either your program or GCC:
1691
1692 @table @code
1693 @item -g
1694 Produce debugging information in the operating system's native format
1695 (stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging
1696 information.
1697
1698 On most systems that use stabs format, @samp{-g} enables use of extra
1699 debugging information that only GDB can use; this extra information
1700 makes debugging work better in GDB but will probably make other debuggers
1701 crash or
1702 refuse to read the program. If you want to control for certain whether
1703 to generate the extra information, use @samp{-gstabs+}, @samp{-gstabs},
1704 @samp{-gxcoff+}, @samp{-gxcoff}, @samp{-gdwarf-1+}, or @samp{-gdwarf-1}
1705 (see below).
1706
1707 Unlike most other C compilers, GNU CC allows you to use @samp{-g} with
1708 @samp{-O}. The shortcuts taken by optimized code may occasionally
1709 produce surprising results: some variables you declared may not exist
1710 at all; flow of control may briefly move where you did not expect it;
1711 some statements may not be executed because they compute constant
1712 results or their values were already at hand; some statements may
1713 execute in different places because they were moved out of loops.
1714
1715 Nevertheless it proves possible to debug optimized output. This makes
1716 it reasonable to use the optimizer for programs that might have bugs.
1717
1718 The following options are useful when GNU CC is generated with the
1719 capability for more than one debugging format.
1720
1721 @item -ggdb
1722 Produce debugging information for use by GDB. This means to use the
1723 most expressive format available (DWARF 2, stabs, or the native format
1724 if neither of those are supported), including GDB extensions if at all
1725 possible.
1726
1727 @item -gstabs
1728 Produce debugging information in stabs format (if that is supported),
1729 without GDB extensions. This is the format used by DBX on most BSD
1730 systems. On MIPS, Alpha and System V Release 4 systems this option
1731 produces stabs debugging output which is not understood by DBX or SDB.
1732 On System V Release 4 systems this option requires the GNU assembler.
1733
1734 @item -gstabs+
1735 Produce debugging information in stabs format (if that is supported),
1736 using GNU extensions understood only by the GNU debugger (GDB). The
1737 use of these extensions is likely to make other debuggers crash or
1738 refuse to read the program.
1739
1740 @item -gcoff
1741 Produce debugging information in COFF format (if that is supported).
1742 This is the format used by SDB on most System V systems prior to
1743 System V Release 4.
1744
1745 @item -gxcoff
1746 Produce debugging information in XCOFF format (if that is supported).
1747 This is the format used by the DBX debugger on IBM RS/6000 systems.
1748
1749 @item -gxcoff+
1750 Produce debugging information in XCOFF format (if that is supported),
1751 using GNU extensions understood only by the GNU debugger (GDB). The
1752 use of these extensions is likely to make other debuggers crash or
1753 refuse to read the program, and may cause assemblers other than the GNU
1754 assembler (GAS) to fail with an error.
1755
1756 @item -gdwarf
1757 Produce debugging information in DWARF version 1 format (if that is
1758 supported). This is the format used by SDB on most System V Release 4
1759 systems.
1760
1761 @item -gdwarf+
1762 Produce debugging information in DWARF version 1 format (if that is
1763 supported), using GNU extensions understood only by the GNU debugger
1764 (GDB). The use of these extensions is likely to make other debuggers
1765 crash or refuse to read the program.
1766
1767 @item -gdwarf-2
1768 Produce debugging information in DWARF version 2 format (if that is
1769 supported). This is the format used by DBX on IRIX 6.
1770
1771 @item -g@var{level}
1772 @itemx -ggdb@var{level}
1773 @itemx -gstabs@var{level}
1774 @itemx -gcoff@var{level}
1775 @itemx -gxcoff@var{level}
1776 @itemx -gdwarf@var{level}
1777 @itemx -gdwarf-2@var{level}
1778 Request debugging information and also use @var{level} to specify how
1779 much information. The default level is 2.
1780
1781 Level 1 produces minimal information, enough for making backtraces in
1782 parts of the program that you don't plan to debug. This includes
1783 descriptions of functions and external variables, but no information
1784 about local variables and no line numbers.
1785
1786 Level 3 includes extra information, such as all the macro definitions
1787 present in the program. Some debuggers support macro expansion when
1788 you use @samp{-g3}.
1789
1790 @cindex @code{prof}
1791 @item -p
1792 Generate extra code to write profile information suitable for the
1793 analysis program @code{prof}. You must use this option when compiling
1794 the source files you want data about, and you must also use it when
1795 linking.
1796
1797 @cindex @code{gprof}
1798 @item -pg
1799 Generate extra code to write profile information suitable for the
1800 analysis program @code{gprof}. You must use this option when compiling
1801 the source files you want data about, and you must also use it when
1802 linking.
1803
1804 @cindex @code{tcov}
1805 @item -a
1806 Generate extra code to write profile information for basic blocks, which will
1807 record the number of times each basic block is executed, the basic block start
1808 address, and the function name containing the basic block. If @samp{-g} is
1809 used, the line number and filename of the start of the basic block will also be
1810 recorded. If not overridden by the machine description, the default action is
1811 to append to the text file @file{bb.out}.
1812
1813 This data could be analyzed by a program like @code{tcov}. Note,
1814 however, that the format of the data is not what @code{tcov} expects.
1815 Eventually GNU @code{gprof} should be extended to process this data.
1816
1817 @item -Q
1818 Makes the compiler print out each function name as it is compiled, and
1819 print some statistics about each pass when it finishes.
1820
1821 @item -ax
1822 Generate extra code to profile basic blocks. Your executable will
1823 produce output that is a superset of that produced when @samp{-a} is
1824 used. Additional output is the source and target address of the basic
1825 blocks where a jump takes place, the number of times a jump is executed,
1826 and (optionally) the complete sequence of basic blocks being executed.
1827 The output is appended to file @file{bb.out}.
1828
1829 You can examine different profiling aspects without recompilation. Your
1830 executable will read a list of function names from file @file{bb.in}.
1831 Profiling starts when a function on the list is entered and stops when
1832 that invocation is exited. To exclude a function from profiling, prefix
1833 its name with `-'. If a function name is not unique, you can
1834 disambiguate it by writing it in the form
1835 @samp{/path/filename.d:functionname}. Your executable will write the
1836 available paths and filenames in file @file{bb.out}.
1837
1838 Several function names have a special meaning:
1839 @table @code
1840 @item __bb_jumps__
1841 Write source, target and frequency of jumps to file @file{bb.out}.
1842 @item __bb_hidecall__
1843 Exclude function calls from frequency count.
1844 @item __bb_showret__
1845 Include function returns in frequency count.
1846 @item __bb_trace__
1847 Write the sequence of basic blocks executed to file @file{bbtrace.gz}.
1848 The file will be compressed using the program @samp{gzip}, which must
1849 exist in your @code{PATH}. On systems without the @samp{popen}
1850 function, the file will be named @file{bbtrace} and will not be
1851 compressed. @strong{Profiling for even a few seconds on these systems
1852 will produce a very large file.} Note: @code{__bb_hidecall__} and
1853 @code{__bb_showret__} will not affect the sequence written to
1854 @file{bbtrace.gz}.
1855 @end table
1856
1857 Here's a short example using different profiling parameters
1858 in file @file{bb.in}. Assume function @code{foo} consists of basic blocks
1859 1 and 2 and is called twice from block 3 of function @code{main}. After
1860 the calls, block 3 transfers control to block 4 of @code{main}.
1861
1862 With @code{__bb_trace__} and @code{main} contained in file @file{bb.in},
1863 the following sequence of blocks is written to file @file{bbtrace.gz}:
1864 0 3 1 2 1 2 4. The return from block 2 to block 3 is not shown, because
1865 the return is to a point inside the block and not to the top. The
1866 block address 0 always indicates, that control is transferred
1867 to the trace from somewhere outside the observed functions. With
1868 @samp{-foo} added to @file{bb.in}, the blocks of function
1869 @code{foo} are removed from the trace, so only 0 3 4 remains.
1870
1871 With @code{__bb_jumps__} and @code{main} contained in file @file{bb.in},
1872 jump frequencies will be written to file @file{bb.out}. The
1873 frequencies are obtained by constructing a trace of blocks
1874 and incrementing a counter for every neighbouring pair of blocks
1875 in the trace. The trace 0 3 1 2 1 2 4 displays the following
1876 frequencies:
1877
1878 @example
1879 Jump from block 0x0 to block 0x3 executed 1 time(s)
1880 Jump from block 0x3 to block 0x1 executed 1 time(s)
1881 Jump from block 0x1 to block 0x2 executed 2 time(s)
1882 Jump from block 0x2 to block 0x1 executed 1 time(s)
1883 Jump from block 0x2 to block 0x4 executed 1 time(s)
1884 @end example
1885
1886 With @code{__bb_hidecall__}, control transfer due to call instructions
1887 is removed from the trace, that is the trace is cut into three parts: 0
1888 3 4, 0 1 2 and 0 1 2. With @code{__bb_showret__}, control transfer due
1889 to return instructions is added to the trace. The trace becomes: 0 3 1
1890 2 3 1 2 3 4. Note, that this trace is not the same, as the sequence
1891 written to @file{bbtrace.gz}. It is solely used for counting jump
1892 frequencies.
1893
1894 @item -fprofile-arcs
1895 Instrument @dfn{arcs} during compilation. For each function of your
1896 program, GNU CC creates a program flow graph, then finds a spanning tree
1897 for the graph. Only arcs that are not on the spanning tree have to be
1898 instrumented: the compiler adds code to count the number of times that these
1899 arcs are executed. When an arc is the only exit or only entrance to a
1900 block, the instrumentation code can be added to the block; otherwise, a
1901 new basic block must be created to hold the instrumentation code.
1902
1903 Since not every arc in the program must be instrumented, programs
1904 compiled with this option run faster than programs compiled with
1905 @samp{-a}, which adds instrumentation code to every basic block in the
1906 program. The tradeoff: since @code{gcov} does not have
1907 execution counts for all branches, it must start with the execution
1908 counts for the instrumented branches, and then iterate over the program
1909 flow graph until the entire graph has been solved. Hence, @code{gcov}
1910 runs a little more slowly than a program which uses information from
1911 @samp{-a}.
1912
1913 @samp{-fprofile-arcs} also makes it possible to estimate branch
1914 probabilities, and to calculate basic block execution counts. In
1915 general, basic block execution counts do not give enough information to
1916 estimate all branch probabilities. When the compiled program exits, it
1917 saves the arc execution counts to a file called
1918 @file{@var{sourcename}.da}. Use the compiler option
1919 @samp{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
1920 Control Optimization}) when recompiling, to optimize using estimated
1921 branch probabilities.
1922
1923 @need 2000
1924 @item -ftest-coverage
1925 Create data files for the @code{gcov} code-coverage utility
1926 (@pxref{Gcov,, @code{gcov}: a GNU CC Test Coverage Program}).
1927 The data file names begin with the name of your source file:
1928
1929 @table @code
1930 @item @var{sourcename}.bb
1931 A mapping from basic blocks to line numbers, which @code{gcov} uses to
1932 associate basic block execution counts with line numbers.
1933
1934 @item @var{sourcename}.bbg
1935 A list of all arcs in the program flow graph. This allows @code{gcov}
1936 to reconstruct the program flow graph, so that it can compute all basic
1937 block and arc execution counts from the information in the
1938 @code{@var{sourcename}.da} file (this last file is the output from
1939 @samp{-fprofile-arcs}).
1940 @end table
1941
1942 @item -Q
1943 Makes the compiler print out each function name as it is compiled, and
1944 print some statistics about each pass when it finishes.
1945
1946 @item -d@var{letters}
1947 Says to make debugging dumps during compilation at times specified by
1948 @var{letters}. This is used for debugging the compiler. The file names
1949 for most of the dumps are made by appending a word to the source file
1950 name (e.g. @file{foo.c.rtl} or @file{foo.c.jump}). Here are the
1951 possible letters for use in @var{letters}, and their meanings:
1952
1953 @table @samp
1954 @item b
1955 Dump after computing branch probabilities, to @file{@var{file}.bp}.
1956 @item c
1957 Dump after instruction combination, to the file @file{@var{file}.combine}.
1958 @item d
1959 Dump after delayed branch scheduling, to @file{@var{file}.dbr}.
1960 @item D
1961 Dump after purging ADDRESSOF, to @file{@var{file}.addressof}.
1962 @item f
1963 Dump after flow analysis, to @file{@var{file}.flow}.
1964 @item g
1965 Dump after global register allocation, to @file{@var{file}.greg}.
1966 @item j
1967 Dump after first jump optimization, to @file{@var{file}.jump}.
1968 @item J
1969 Dump after last jump optimization, to @file{@var{file}.jump2}.
1970 @item k
1971 Dump after conversion from registers to stack, to @file{@var{file}.stack}.
1972 @item l
1973 Dump after local register allocation, to @file{@var{file}.lreg}.
1974 @item L
1975 Dump after loop optimization, to @file{@var{file}.loop}.
1976 @item M
1977 Dump after performing the machine dependent reorganisation pass, to
1978 @file{@var{file}.mach}.
1979 @item N
1980 Dump after the register move pass, to @file{@var{file}.regmove}.
1981 @item r
1982 Dump after RTL generation, to @file{@var{file}.rtl}.
1983 @item R
1984 Dump after the second instruction scheduling pass, to @file{@var{file}.sched2}.
1985 @item s
1986 Dump after CSE (including the jump optimization that sometimes follows
1987 CSE), to @file{@var{file}.cse}.
1988 @item S
1989 Dump after the first instruction scheduling pass, to @file{@var{file}.sched}.
1990 @item t
1991 Dump after the second CSE pass (including the jump optimization that
1992 sometimes follows CSE), to @file{@var{file}.cse2}.
1993 @item x
1994 Just generate RTL for a function instead of compiling it. Usually used
1995 with @samp{r}.
1996 @item a
1997 Produce all the dumps listed above.
1998 @item m
1999 Print statistics on memory usage, at the end of the run, to
2000 standard error.
2001 @item p
2002 Annotate the assembler output with a comment indicating which
2003 pattern and alternative was used.
2004 @item y
2005 Dump debugging information during parsing, to standard error.
2006 @item A
2007 Annotate the assembler output with miscellaneous debugging information.
2008 @end table
2009
2010 @item -fpretend-float
2011 When running a cross-compiler, pretend that the target machine uses the
2012 same floating point format as the host machine. This causes incorrect
2013 output of the actual floating constants, but the actual instruction
2014 sequence will probably be the same as GNU CC would make when running on
2015 the target machine.
2016
2017 @item -save-temps
2018 Store the usual ``temporary'' intermediate files permanently; place them
2019 in the current directory and name them based on the source file. Thus,
2020 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
2021 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.
2022
2023 @item -print-file-name=@var{library}
2024 Print the full absolute name of the library file @var{library} that
2025 would be used when linking---and don't do anything else. With this
2026 option, GNU CC does not compile or link anything; it just prints the
2027 file name.
2028
2029 @item -print-prog-name=@var{program}
2030 Like @samp{-print-file-name}, but searches for a program such as @samp{cpp}.
2031
2032 @item -print-libgcc-file-name
2033 Same as @samp{-print-file-name=libgcc.a}.
2034
2035 This is useful when you use @samp{-nostdlib} or @samp{-nodefaultlibs}
2036 but you do want to link with @file{libgcc.a}. You can do
2037
2038 @example
2039 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
2040 @end example
2041
2042 @item -print-search-dirs
2043 Print the name of the configured installation directory and a list of
2044 program and library directories gcc will search---and don't do anything else.
2045
2046 This is useful when gcc prints the error message
2047 @samp{installation problem, cannot exec cpp: No such file or directory}.
2048 To resolve this you either need to put @file{cpp} and the other compiler
2049 components where gcc expects to find them, or you can set the environment
2050 variable @code{GCC_EXEC_PREFIX} to the directory where you installed them.
2051 Don't forget the trailing '/'.
2052 @xref{Environment Variables}.
2053 @end table
2054
2055 @node Optimize Options
2056 @section Options That Control Optimization
2057 @cindex optimize options
2058 @cindex options, optimization
2059
2060 These options control various sorts of optimizations:
2061
2062 @table @code
2063 @item -O
2064 @itemx -O1
2065 Optimize. Optimizing compilation takes somewhat more time, and a lot
2066 more memory for a large function.
2067
2068 Without @samp{-O}, the compiler's goal is to reduce the cost of
2069 compilation and to make debugging produce the expected results.
2070 Statements are independent: if you stop the program with a breakpoint
2071 between statements, you can then assign a new value to any variable or
2072 change the program counter to any other statement in the function and
2073 get exactly the results you would expect from the source code.
2074
2075 Without @samp{-O}, the compiler only allocates variables declared
2076 @code{register} in registers. The resulting compiled code is a little
2077 worse than produced by PCC without @samp{-O}.
2078
2079 With @samp{-O}, the compiler tries to reduce code size and execution
2080 time.
2081
2082 When you specify @samp{-O}, the compiler turns on @samp{-fthread-jumps}
2083 and @samp{-fdefer-pop} on all machines. The compiler turns on
2084 @samp{-fdelayed-branch} on machines that have delay slots, and
2085 @samp{-fomit-frame-pointer} on machines that can support debugging even
2086 without a frame pointer. On some machines the compiler also turns
2087 on other flags.@refill
2088
2089 @item -O2
2090 Optimize even more. GNU CC performs nearly all supported optimizations
2091 that do not involve a space-speed tradeoff. The compiler does not
2092 perform loop unrolling or function inlining when you specify @samp{-O2}.
2093 As compared to @samp{-O}, this option increases both compilation time
2094 and the performance of the generated code.
2095
2096 @samp{-O2} turns on all optional optimizations except for loop unrolling
2097 and function inlining. It also turns on the @samp{-fforce-mem} option
2098 on all machines and frame pointer elimination on machines where doing so
2099 does not interfere with debugging.
2100
2101 @item -O3
2102 Optimize yet more. @samp{-O3} turns on all optimizations specified by
2103 @samp{-O2} and also turns on the @samp{inline-functions} option.
2104
2105 @item -O0
2106 Do not optimize.
2107
2108 @item -Os
2109 Optimize for size. @samp{-Os} enables all @samp{-O2} optimizations that
2110 do not typically increase code size. It also performs further
2111 optimizations designed to reduce code size.
2112
2113 If you use multiple @samp{-O} options, with or without level numbers,
2114 the last such option is the one that is effective.
2115 @end table
2116
2117 Options of the form @samp{-f@var{flag}} specify machine-independent
2118 flags. Most flags have both positive and negative forms; the negative
2119 form of @samp{-ffoo} would be @samp{-fno-foo}. In the table below,
2120 only one of the forms is listed---the one which is not the default.
2121 You can figure out the other form by either removing @samp{no-} or
2122 adding it.
2123
2124 @table @code
2125 @item -ffloat-store
2126 Do not store floating point variables in registers, and inhibit other
2127 options that might change whether a floating point value is taken from a
2128 register or memory.
2129
2130 @cindex floating point precision
2131 This option prevents undesirable excess precision on machines such as
2132 the 68000 where the floating registers (of the 68881) keep more
2133 precision than a @code{double} is supposed to have. Similarly for the
2134 x86 architecture. For most programs, the excess precision does only
2135 good, but a few programs rely on the precise definition of IEEE floating
2136 point. Use @samp{-ffloat-store} for such programs.
2137
2138 @item -fno-default-inline
2139 Do not make member functions inline by default merely because they are
2140 defined inside the class scope (C++ only). Otherwise, when you specify
2141 @w{@samp{-O}}, member functions defined inside class scope are compiled
2142 inline by default; i.e., you don't need to add @samp{inline} in front of
2143 the member function name.
2144
2145 @item -fno-defer-pop
2146 Always pop the arguments to each function call as soon as that function
2147 returns. For machines which must pop arguments after a function call,
2148 the compiler normally lets arguments accumulate on the stack for several
2149 function calls and pops them all at once.
2150
2151 @item -fforce-mem
2152 Force memory operands to be copied into registers before doing
2153 arithmetic on them. This produces better code by making all memory
2154 references potential common subexpressions. When they are not common
2155 subexpressions, instruction combination should eliminate the separate
2156 register-load. The @samp{-O2} option turns on this option.
2157
2158 @item -fforce-addr
2159 Force memory address constants to be copied into registers before
2160 doing arithmetic on them. This may produce better code just as
2161 @samp{-fforce-mem} may.
2162
2163 @item -fomit-frame-pointer
2164 Don't keep the frame pointer in a register for functions that
2165 don't need one. This avoids the instructions to save, set up and
2166 restore frame pointers; it also makes an extra register available
2167 in many functions. @strong{It also makes debugging impossible on
2168 some machines.}
2169
2170 @ifset INTERNALS
2171 On some machines, such as the Vax, this flag has no effect, because
2172 the standard calling sequence automatically handles the frame pointer
2173 and nothing is saved by pretending it doesn't exist. The
2174 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
2175 whether a target machine supports this flag. @xref{Registers}.@refill
2176 @end ifset
2177 @ifclear INTERNALS
2178 On some machines, such as the Vax, this flag has no effect, because
2179 the standard calling sequence automatically handles the frame pointer
2180 and nothing is saved by pretending it doesn't exist. The
2181 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
2182 whether a target machine supports this flag. @xref{Registers,,Register
2183 Usage, gcc.info, Using and Porting GCC}.@refill
2184 @end ifclear
2185
2186 @item -fno-inline
2187 Don't pay attention to the @code{inline} keyword. Normally this option
2188 is used to keep the compiler from expanding any functions inline.
2189 Note that if you are not optimizing, no functions can be expanded inline.
2190
2191 @item -finline-functions
2192 Integrate all simple functions into their callers. The compiler
2193 heuristically decides which functions are simple enough to be worth
2194 integrating in this way.
2195
2196 If all calls to a given function are integrated, and the function is
2197 declared @code{static}, then the function is normally not output as
2198 assembler code in its own right.
2199
2200 @item -fkeep-inline-functions
2201 Even if all calls to a given function are integrated, and the function
2202 is declared @code{static}, nevertheless output a separate run-time
2203 callable version of the function. This switch does not affect
2204 @code{extern inline} functions.
2205
2206 @item -fkeep-static-consts
2207 Emit variables declared @code{static const} when optimization isn't turned
2208 on, even if the variables aren't referenced.
2209
2210 GNU CC enables this option by default. If you want to force the compiler to
2211 check if the variable was referenced, regardless of whether or not
2212 optimization is turned on, use the @samp{-fno-keep-static-consts} option.
2213
2214 @item -fno-function-cse
2215 Do not put function addresses in registers; make each instruction that
2216 calls a constant function contain the function's address explicitly.
2217
2218 This option results in less efficient code, but some strange hacks
2219 that alter the assembler output may be confused by the optimizations
2220 performed when this option is not used.
2221
2222 @item -ffast-math
2223 This option allows GCC to violate some ANSI or IEEE rules and/or
2224 specifications in the interest of optimizing code for speed. For
2225 example, it allows the compiler to assume arguments to the @code{sqrt}
2226 function are non-negative numbers and that no floating-point values
2227 are NaNs.
2228
2229 This option should never be turned on by any @samp{-O} option since
2230 it can result in incorrect output for programs which depend on
2231 an exact implementation of IEEE or ANSI rules/specifications for
2232 math functions.
2233 @end table
2234
2235 @c following causes underfulls.. they don't look great, but we deal.
2236 @c --mew 26jan93
2237 The following options control specific optimizations. The @samp{-O2}
2238 option turns on all of these optimizations except @samp{-funroll-loops}
2239 and @samp{-funroll-all-loops}. On most machines, the @samp{-O} option
2240 turns on the @samp{-fthread-jumps} and @samp{-fdelayed-branch} options,
2241 but specific machines may handle it differently.
2242
2243 You can use the following flags in the rare cases when ``fine-tuning''
2244 of optimizations to be performed is desired.
2245
2246 @table @code
2247 @item -fstrength-reduce
2248 Perform the optimizations of loop strength reduction and
2249 elimination of iteration variables.
2250
2251 @item -fthread-jumps
2252 Perform optimizations where we check to see if a jump branches to a
2253 location where another comparison subsumed by the first is found. If
2254 so, the first branch is redirected to either the destination of the
2255 second branch or a point immediately following it, depending on whether
2256 the condition is known to be true or false.
2257
2258 @item -fcse-follow-jumps
2259 In common subexpression elimination, scan through jump instructions
2260 when the target of the jump is not reached by any other path. For
2261 example, when CSE encounters an @code{if} statement with an
2262 @code{else} clause, CSE will follow the jump when the condition
2263 tested is false.
2264
2265 @item -fcse-skip-blocks
2266 This is similar to @samp{-fcse-follow-jumps}, but causes CSE to
2267 follow jumps which conditionally skip over blocks. When CSE
2268 encounters a simple @code{if} statement with no else clause,
2269 @samp{-fcse-skip-blocks} causes CSE to follow the jump around the
2270 body of the @code{if}.
2271
2272 @item -frerun-cse-after-loop
2273 Re-run common subexpression elimination after loop optimizations has been
2274 performed.
2275
2276 @item -frerun-loop-opt
2277 Run the loop optimizer twice.
2278
2279 @item -fexpensive-optimizations
2280 Perform a number of minor optimizations that are relatively expensive.
2281
2282 @item -fdelayed-branch
2283 If supported for the target machine, attempt to reorder instructions
2284 to exploit instruction slots available after delayed branch
2285 instructions.
2286
2287 @item -fschedule-insns
2288 If supported for the target machine, attempt to reorder instructions to
2289 eliminate execution stalls due to required data being unavailable. This
2290 helps machines that have slow floating point or memory load instructions
2291 by allowing other instructions to be issued until the result of the load
2292 or floating point instruction is required.
2293
2294 @item -fschedule-insns2
2295 Similar to @samp{-fschedule-insns}, but requests an additional pass of
2296 instruction scheduling after register allocation has been done. This is
2297 especially useful on machines with a relatively small number of
2298 registers and where memory load instructions take more than one cycle.
2299
2300 @item -ffunction-sections
2301 Place each function into its own section in the output file if the
2302 target supports arbitrary sections. The function's name determines
2303 the section's name in the output file.
2304
2305 Use this option on systems where the linker can perform optimizations
2306 to improve locality of reference in the instruction space. HPPA
2307 processors running HP-UX and Sparc processors running Solaris 2 have
2308 linkers with such optimizations. Other systems using the ELF object format
2309 as well as AIX may have these optimizations in the future.
2310
2311 Only use this option when there are significant benefits from doing
2312 so. When you specify this option, the assembler and linker will
2313 create larger object and executable files and will also be slower.
2314 You will not be able to use @code{gprof} on all systems if you
2315 specify this option and you may have problems with debugging if
2316 you specify both this option and @samp{-g}.
2317
2318 @item -fcaller-saves
2319 Enable values to be allocated in registers that will be clobbered by
2320 function calls, by emitting extra instructions to save and restore the
2321 registers around such calls. Such allocation is done only when it
2322 seems to result in better code than would otherwise be produced.
2323
2324 This option is enabled by default on certain machines, usually those
2325 which have no call-preserved registers to use instead.
2326
2327 @item -funroll-loops
2328 Perform the optimization of loop unrolling. This is only done for loops
2329 whose number of iterations can be determined at compile time or run time.
2330 @samp{-funroll-loop} implies both @samp{-fstrength-reduce} and
2331 @samp{-frerun-cse-after-loop}.
2332
2333 @item -funroll-all-loops
2334 Perform the optimization of loop unrolling. This is done for all loops
2335 and usually makes programs run more slowly. @samp{-funroll-all-loops}
2336 implies @samp{-fstrength-reduce} as well as @samp{-frerun-cse-after-loop}.
2337
2338 @item -fmove-all-movables
2339 Forces all invariant computations in loops to be moved
2340 outside the loop.
2341
2342 @item -freduce-all-givs
2343 Forces all general-induction variables in loops to be
2344 strength-reduced.
2345
2346 @emph{Note:} When compiling programs written in Fortran,
2347 @samp{-fmove-all-moveables} and @samp{-freduce-all-givs} are enabled
2348 by default when you use the optimizer.
2349
2350 These options may generate better or worse code; results are highly
2351 dependent on the structure of loops within the source code.
2352
2353 These two options are intended to be removed someday, once
2354 they have helped determine the efficacy of various
2355 approaches to improving loop optimizations.
2356
2357 Please let us (@code{egcs@@cygnus.com} and @code{fortran@@gnu.org})
2358 know how use of these options affects
2359 the performance of your production code.
2360 We're very interested in code that runs @emph{slower}
2361 when these options are @emph{enabled}.
2362
2363 @item -fno-peephole
2364 Disable any machine-specific peephole optimizations.
2365
2366 @item -fbranch-probabilities
2367 After running a program compiled with @samp{-fprofile-arcs}
2368 (@pxref{Debugging Options,, Options for Debugging Your Program or
2369 @code{gcc}}), you can compile it a second time using
2370 @samp{-fbranch-probabilities}, to improve optimizations based on
2371 guessing the path a branch might take.
2372
2373 @ifset INTERNALS
2374 With @samp{-fbranch-probabilities}, GCC puts a @samp{REG_EXEC_COUNT}
2375 note on the first instruction of each basic block, and a
2376 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
2377 These can be used to improve optimization. Currently, they are only
2378 used in one place: in @file{reorg.c}, instead of guessing which path a
2379 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
2380 exactly determine which path is taken more often.
2381 @end ifset
2382
2383 @item -fregmove
2384 Some machines only support 2 operands per instruction. On such
2385 machines, GNU CC might have to do extra copies. The @samp{-fregmove}
2386 option overrides the default for the machine to do the copy before
2387 register allocation.
2388 @end table
2389
2390 @node Preprocessor Options
2391 @section Options Controlling the Preprocessor
2392 @cindex preprocessor options
2393 @cindex options, preprocessor
2394
2395 These options control the C preprocessor, which is run on each C source
2396 file before actual compilation.
2397
2398 If you use the @samp{-E} option, nothing is done except preprocessing.
2399 Some of these options make sense only together with @samp{-E} because
2400 they cause the preprocessor output to be unsuitable for actual
2401 compilation.
2402
2403 @table @code
2404 @item -include @var{file}
2405 Process @var{file} as input before processing the regular input file.
2406 In effect, the contents of @var{file} are compiled first. Any @samp{-D}
2407 and @samp{-U} options on the command line are always processed before
2408 @samp{-include @var{file}}, regardless of the order in which they are
2409 written. All the @samp{-include} and @samp{-imacros} options are
2410 processed in the order in which they are written.
2411
2412 @item -imacros @var{file}
2413 Process @var{file} as input, discarding the resulting output, before
2414 processing the regular input file. Because the output generated from
2415 @var{file} is discarded, the only effect of @samp{-imacros @var{file}}
2416 is to make the macros defined in @var{file} available for use in the
2417 main input.
2418
2419 Any @samp{-D} and @samp{-U} options on the command line are always
2420 processed before @samp{-imacros @var{file}}, regardless of the order in
2421 which they are written. All the @samp{-include} and @samp{-imacros}
2422 options are processed in the order in which they are written.
2423
2424 @item -idirafter @var{dir}
2425 @cindex second include path
2426 Add the directory @var{dir} to the second include path. The directories
2427 on the second include path are searched when a header file is not found
2428 in any of the directories in the main include path (the one that
2429 @samp{-I} adds to).
2430
2431 @item -iprefix @var{prefix}
2432 Specify @var{prefix} as the prefix for subsequent @samp{-iwithprefix}
2433 options.
2434
2435 @item -iwithprefix @var{dir}
2436 Add a directory to the second include path. The directory's name is
2437 made by concatenating @var{prefix} and @var{dir}, where @var{prefix} was
2438 specified previously with @samp{-iprefix}. If you have not specified a
2439 prefix yet, the directory containing the installed passes of the
2440 compiler is used as the default.
2441
2442 @item -iwithprefixbefore @var{dir}
2443 Add a directory to the main include path. The directory's name is made
2444 by concatenating @var{prefix} and @var{dir}, as in the case of
2445 @samp{-iwithprefix}.
2446
2447 @item -isystem @var{dir}
2448 Add a directory to the beginning of the second include path, marking it
2449 as a system directory, so that it gets the same special treatment as
2450 is applied to the standard system directories.
2451
2452 @item -nostdinc
2453 Do not search the standard system directories for header files. Only
2454 the directories you have specified with @samp{-I} options (and the
2455 current directory, if appropriate) are searched. @xref{Directory
2456 Options}, for information on @samp{-I}.
2457
2458 By using both @samp{-nostdinc} and @samp{-I-}, you can limit the include-file
2459 search path to only those directories you specify explicitly.
2460
2461 @item -undef
2462 Do not predefine any nonstandard macros. (Including architecture flags).
2463
2464 @item -E
2465 Run only the C preprocessor. Preprocess all the C source files
2466 specified and output the results to standard output or to the
2467 specified output file.
2468
2469 @item -C
2470 Tell the preprocessor not to discard comments. Used with the
2471 @samp{-E} option.
2472
2473 @item -P
2474 Tell the preprocessor not to generate @samp{#line} directives.
2475 Used with the @samp{-E} option.
2476
2477 @cindex make
2478 @cindex dependencies, make
2479 @item -M
2480 Tell the preprocessor to output a rule suitable for @code{make}
2481 describing the dependencies of each object file. For each source file,
2482 the preprocessor outputs one @code{make}-rule whose target is the object
2483 file name for that source file and whose dependencies are all the
2484 @code{#include} header files it uses. This rule may be a single line or
2485 may be continued with @samp{\}-newline if it is long. The list of rules
2486 is printed on standard output instead of the preprocessed C program.
2487
2488 @samp{-M} implies @samp{-E}.
2489
2490 Another way to specify output of a @code{make} rule is by setting
2491 the environment variable @code{DEPENDENCIES_OUTPUT} (@pxref{Environment
2492 Variables}).
2493
2494 @item -MM
2495 Like @samp{-M} but the output mentions only the user header files
2496 included with @samp{#include "@var{file}"}. System header files
2497 included with @samp{#include <@var{file}>} are omitted.
2498
2499 @item -MD
2500 Like @samp{-M} but the dependency information is written to a file made by
2501 replacing ".c" with ".d" at the end of the input file names.
2502 This is in addition to compiling the file as specified---@samp{-MD} does
2503 not inhibit ordinary compilation the way @samp{-M} does.
2504
2505 In Mach, you can use the utility @code{md} to merge multiple dependency
2506 files into a single dependency file suitable for using with the @samp{make}
2507 command.
2508
2509 @item -MMD
2510 Like @samp{-MD} except mention only user header files, not system
2511 header files.
2512
2513 @item -MG
2514 Treat missing header files as generated files and assume they live in the
2515 same directory as the source file. If you specify @samp{-MG}, you
2516 must also specify either @samp{-M} or @samp{-MM}. @samp{-MG} is not
2517 supported with @samp{-MD} or @samp{-MMD}.
2518
2519 @item -H
2520 Print the name of each header file used, in addition to other normal
2521 activities.
2522
2523 @item -A@var{question}(@var{answer})
2524 Assert the answer @var{answer} for @var{question}, in case it is tested
2525 with a preprocessing conditional such as @samp{#if
2526 #@var{question}(@var{answer})}. @samp{-A-} disables the standard
2527 assertions that normally describe the target machine.
2528
2529 @item -D@var{macro}
2530 Define macro @var{macro} with the string @samp{1} as its definition.
2531
2532 @item -D@var{macro}=@var{defn}
2533 Define macro @var{macro} as @var{defn}. All instances of @samp{-D} on
2534 the command line are processed before any @samp{-U} options.
2535
2536 @item -U@var{macro}
2537 Undefine macro @var{macro}. @samp{-U} options are evaluated after all
2538 @samp{-D} options, but before any @samp{-include} and @samp{-imacros}
2539 options.
2540
2541 @item -dM
2542 Tell the preprocessor to output only a list of the macro definitions
2543 that are in effect at the end of preprocessing. Used with the @samp{-E}
2544 option.
2545
2546 @item -dD
2547 Tell the preprocessing to pass all macro definitions into the output, in
2548 their proper sequence in the rest of the output.
2549
2550 @item -dN
2551 Like @samp{-dD} except that the macro arguments and contents are omitted.
2552 Only @samp{#define @var{name}} is included in the output.
2553
2554 @item -trigraphs
2555 Support ANSI C trigraphs. The @samp{-ansi} option also has this effect.
2556
2557 @item -Wp,@var{option}
2558 Pass @var{option} as an option to the preprocessor. If @var{option}
2559 contains commas, it is split into multiple options at the commas.
2560 @end table
2561
2562 @node Assembler Options
2563 @section Passing Options to the Assembler
2564
2565 @c prevent bad page break with this line
2566 You can pass options to the assembler.
2567
2568 @table @code
2569 @item -Wa,@var{option}
2570 Pass @var{option} as an option to the assembler. If @var{option}
2571 contains commas, it is split into multiple options at the commas.
2572 @end table
2573
2574 @node Link Options
2575 @section Options for Linking
2576 @cindex link options
2577 @cindex options, linking
2578
2579 These options come into play when the compiler links object files into
2580 an executable output file. They are meaningless if the compiler is
2581 not doing a link step.
2582
2583 @table @code
2584 @cindex file names
2585 @item @var{object-file-name}
2586 A file name that does not end in a special recognized suffix is
2587 considered to name an object file or library. (Object files are
2588 distinguished from libraries by the linker according to the file
2589 contents.) If linking is done, these object files are used as input
2590 to the linker.
2591
2592 @item -c
2593 @itemx -S
2594 @itemx -E
2595 If any of these options is used, then the linker is not run, and
2596 object file names should not be used as arguments. @xref{Overall
2597 Options}.
2598
2599 @cindex Libraries
2600 @item -l@var{library}
2601 Search the library named @var{library} when linking.
2602
2603 It makes a difference where in the command you write this option; the
2604 linker searches processes libraries and object files in the order they
2605 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
2606 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
2607 to functions in @samp{z}, those functions may not be loaded.
2608
2609 The linker searches a standard list of directories for the library,
2610 which is actually a file named @file{lib@var{library}.a}. The linker
2611 then uses this file as if it had been specified precisely by name.
2612
2613 The directories searched include several standard system directories
2614 plus any that you specify with @samp{-L}.
2615
2616 Normally the files found this way are library files---archive files
2617 whose members are object files. The linker handles an archive file by
2618 scanning through it for members which define symbols that have so far
2619 been referenced but not defined. But if the file that is found is an
2620 ordinary object file, it is linked in the usual fashion. The only
2621 difference between using an @samp{-l} option and specifying a file name
2622 is that @samp{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
2623 and searches several directories.
2624
2625 @item -lobjc
2626 You need this special case of the @samp{-l} option in order to
2627 link an Objective C program.
2628
2629 @item -nostartfiles
2630 Do not use the standard system startup files when linking.
2631 The standard system libraries are used normally, unless @code{-nostdlib}
2632 or @code{-nodefaultlibs} is used.
2633
2634 @item -nodefaultlibs
2635 Do not use the standard system libraries when linking.
2636 Only the libraries you specify will be passed to the linker.
2637 The standard startup files are used normally, unless @code{-nostartfiles}
2638 is used.
2639
2640 @item -nostdlib
2641 Do not use the standard system startup files or libraries when linking.
2642 No startup files and only the libraries you specify will be passed to
2643 the linker.
2644
2645 @cindex @code{-lgcc}, use with @code{-nostdlib}
2646 @cindex @code{-nostdlib} and unresolved references
2647 @cindex unresolved references and @code{-nostdlib}
2648 @cindex @code{-lgcc}, use with @code{-nodefaultlibs}
2649 @cindex @code{-nodefaultlibs} and unresolved references
2650 @cindex unresolved references and @code{-nodefaultlibs}
2651 One of the standard libraries bypassed by @samp{-nostdlib} and
2652 @samp{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
2653 that GNU CC uses to overcome shortcomings of particular machines, or special
2654 needs for some languages.
2655 @ifset INTERNALS
2656 (@xref{Interface,,Interfacing to GNU CC Output}, for more discussion of
2657 @file{libgcc.a}.)
2658 @end ifset
2659 @ifclear INTERNALS
2660 (@xref{Interface,,Interfacing to GNU CC Output,gcc.info,Porting GNU CC},
2661 for more discussion of @file{libgcc.a}.)
2662 @end ifclear
2663 In most cases, you need @file{libgcc.a} even when you want to avoid
2664 other standard libraries. In other words, when you specify @samp{-nostdlib}
2665 or @samp{-nodefaultlibs} you should usually specify @samp{-lgcc} as well.
2666 This ensures that you have no unresolved references to internal GNU CC
2667 library subroutines. (For example, @samp{__main}, used to ensure C++
2668 constructors will be called; @pxref{Collect2,,@code{collect2}}.)
2669
2670 @item -s
2671 Remove all symbol table and relocation information from the executable.
2672
2673 @item -static
2674 On systems that support dynamic linking, this prevents linking with the shared
2675 libraries. On other systems, this option has no effect.
2676
2677 @item -shared
2678 Produce a shared object which can then be linked with other objects to
2679 form an executable. Not all systems support this option. You must
2680 also specify @samp{-fpic} or @samp{-fPIC} on some systems when
2681 you specify this option.
2682
2683 @item -symbolic
2684 Bind references to global symbols when building a shared object. Warn
2685 about any unresolved references (unless overridden by the link editor
2686 option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
2687 this option.
2688
2689 @item -Xlinker @var{option}
2690 Pass @var{option} as an option to the linker. You can use this to
2691 supply system-specific linker options which GNU CC does not know how to
2692 recognize.
2693
2694 If you want to pass an option that takes an argument, you must use
2695 @samp{-Xlinker} twice, once for the option and once for the argument.
2696 For example, to pass @samp{-assert definitions}, you must write
2697 @samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
2698 @samp{-Xlinker "-assert definitions"}, because this passes the entire
2699 string as a single argument, which is not what the linker expects.
2700
2701 @item -Wl,@var{option}
2702 Pass @var{option} as an option to the linker. If @var{option} contains
2703 commas, it is split into multiple options at the commas.
2704
2705 @item -u @var{symbol}
2706 Pretend the symbol @var{symbol} is undefined, to force linking of
2707 library modules to define it. You can use @samp{-u} multiple times with
2708 different symbols to force loading of additional library modules.
2709 @end table
2710
2711 @node Directory Options
2712 @section Options for Directory Search
2713 @cindex directory options
2714 @cindex options, directory search
2715 @cindex search path
2716
2717 These options specify directories to search for header files, for
2718 libraries and for parts of the compiler:
2719
2720 @table @code
2721 @item -I@var{dir}
2722 Add the directory @var{dir} to the head of the list of directories to be
2723 searched for header files. This can be used to override a system header
2724 file, substituting your own version, since these directories are
2725 searched before the system header file directories. If you use more
2726 than one @samp{-I} option, the directories are scanned in left-to-right
2727 order; the standard system directories come after.
2728
2729 @item -I-
2730 Any directories you specify with @samp{-I} options before the @samp{-I-}
2731 option are searched only for the case of @samp{#include "@var{file}"};
2732 they are not searched for @samp{#include <@var{file}>}.
2733
2734 If additional directories are specified with @samp{-I} options after
2735 the @samp{-I-}, these directories are searched for all @samp{#include}
2736 directives. (Ordinarily @emph{all} @samp{-I} directories are used
2737 this way.)
2738
2739 In addition, the @samp{-I-} option inhibits the use of the current
2740 directory (where the current input file came from) as the first search
2741 directory for @samp{#include "@var{file}"}. There is no way to
2742 override this effect of @samp{-I-}. With @samp{-I.} you can specify
2743 searching the directory which was current when the compiler was
2744 invoked. That is not exactly the same as what the preprocessor does
2745 by default, but it is often satisfactory.
2746
2747 @samp{-I-} does not inhibit the use of the standard system directories
2748 for header files. Thus, @samp{-I-} and @samp{-nostdinc} are
2749 independent.
2750
2751 @item -L@var{dir}
2752 Add directory @var{dir} to the list of directories to be searched
2753 for @samp{-l}.
2754
2755 @item -B@var{prefix}
2756 This option specifies where to find the executables, libraries,
2757 include files, and data files of the compiler itself.
2758
2759 The compiler driver program runs one or more of the subprograms
2760 @file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
2761 @var{prefix} as a prefix for each program it tries to run, both with and
2762 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
2763
2764 For each subprogram to be run, the compiler driver first tries the
2765 @samp{-B} prefix, if any. If that name is not found, or if @samp{-B}
2766 was not specified, the driver tries two standard prefixes, which are
2767 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}. If neither of
2768 those results in a file name that is found, the unmodified program
2769 name is searched for using the directories specified in your
2770 @samp{PATH} environment variable.
2771
2772 @samp{-B} prefixes that effectively specify directory names also apply
2773 to libraries in the linker, because the compiler translates these
2774 options into @samp{-L} options for the linker. They also apply to
2775 includes files in the preprocessor, because the compiler translates these
2776 options into @samp{-isystem} options for the preprocessor. In this case,
2777 the compiler appends @samp{include} to the prefix.
2778
2779 The run-time support file @file{libgcc.a} can also be searched for using
2780 the @samp{-B} prefix, if needed. If it is not found there, the two
2781 standard prefixes above are tried, and that is all. The file is left
2782 out of the link if it is not found by those means.
2783
2784 Another way to specify a prefix much like the @samp{-B} prefix is to use
2785 the environment variable @code{GCC_EXEC_PREFIX}. @xref{Environment
2786 Variables}.
2787
2788 @item -specs=@var{file}
2789 Process @var{file} after the compiler reads in the standard @file{specs}
2790 file, in order to override the defaults that the @file{gcc} driver
2791 program uses when determining what switches to pass to @file{cc1},
2792 @file{cc1plus}, @file{as}, @file{ld}, etc. More than one
2793 @samp{-specs=}@var{file} can be specified on the command line, and they
2794 are processed in order, from left to right.
2795 @end table
2796
2797 @node Target Options
2798 @section Specifying Target Machine and Compiler Version
2799 @cindex target options
2800 @cindex cross compiling
2801 @cindex specifying machine version
2802 @cindex specifying compiler version and target machine
2803 @cindex compiler version, specifying
2804 @cindex target machine, specifying
2805
2806 By default, GNU CC compiles code for the same type of machine that you
2807 are using. However, it can also be installed as a cross-compiler, to
2808 compile for some other type of machine. In fact, several different
2809 configurations of GNU CC, for different target machines, can be
2810 installed side by side. Then you specify which one to use with the
2811 @samp{-b} option.
2812
2813 In addition, older and newer versions of GNU CC can be installed side
2814 by side. One of them (probably the newest) will be the default, but
2815 you may sometimes wish to use another.
2816
2817 @table @code
2818 @item -b @var{machine}
2819 The argument @var{machine} specifies the target machine for compilation.
2820 This is useful when you have installed GNU CC as a cross-compiler.
2821
2822 The value to use for @var{machine} is the same as was specified as the
2823 machine type when configuring GNU CC as a cross-compiler. For
2824 example, if a cross-compiler was configured with @samp{configure
2825 i386v}, meaning to compile for an 80386 running System V, then you
2826 would specify @samp{-b i386v} to run that cross compiler.
2827
2828 When you do not specify @samp{-b}, it normally means to compile for
2829 the same type of machine that you are using.
2830
2831 @item -V @var{version}
2832 The argument @var{version} specifies which version of GNU CC to run.
2833 This is useful when multiple versions are installed. For example,
2834 @var{version} might be @samp{2.0}, meaning to run GNU CC version 2.0.
2835
2836 The default version, when you do not specify @samp{-V}, is the last
2837 version of GNU CC that you installed.
2838 @end table
2839
2840 The @samp{-b} and @samp{-V} options actually work by controlling part of
2841 the file name used for the executable files and libraries used for
2842 compilation. A given version of GNU CC, for a given target machine, is
2843 normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}.@refill
2844
2845 Thus, sites can customize the effect of @samp{-b} or @samp{-V} either by
2846 changing the names of these directories or adding alternate names (or
2847 symbolic links). If in directory @file{/usr/local/lib/gcc-lib/} the
2848 file @file{80386} is a link to the file @file{i386v}, then @samp{-b
2849 80386} becomes an alias for @samp{-b i386v}.
2850
2851 In one respect, the @samp{-b} or @samp{-V} do not completely change
2852 to a different compiler: the top-level driver program @code{gcc}
2853 that you originally invoked continues to run and invoke the other
2854 executables (preprocessor, compiler per se, assembler and linker)
2855 that do the real work. However, since no real work is done in the
2856 driver program, it usually does not matter that the driver program
2857 in use is not the one for the specified target and version.
2858
2859 The only way that the driver program depends on the target machine is
2860 in the parsing and handling of special machine-specific options.
2861 However, this is controlled by a file which is found, along with the
2862 other executables, in the directory for the specified version and
2863 target machine. As a result, a single installed driver program adapts
2864 to any specified target machine and compiler version.
2865
2866 The driver program executable does control one significant thing,
2867 however: the default version and target machine. Therefore, you can
2868 install different instances of the driver program, compiled for
2869 different targets or versions, under different names.
2870
2871 For example, if the driver for version 2.0 is installed as @code{ogcc}
2872 and that for version 2.1 is installed as @code{gcc}, then the command
2873 @code{gcc} will use version 2.1 by default, while @code{ogcc} will use
2874 2.0 by default. However, you can choose either version with either
2875 command with the @samp{-V} option.
2876
2877 @node Submodel Options
2878 @section Hardware Models and Configurations
2879 @cindex submodel options
2880 @cindex specifying hardware config
2881 @cindex hardware models and configurations, specifying
2882 @cindex machine dependent options
2883
2884 Earlier we discussed the standard option @samp{-b} which chooses among
2885 different installed compilers for completely different target
2886 machines, such as Vax vs. 68000 vs. 80386.
2887
2888 In addition, each of these target machine types can have its own
2889 special options, starting with @samp{-m}, to choose among various
2890 hardware models or configurations---for example, 68010 vs 68020,
2891 floating coprocessor or none. A single installed version of the
2892 compiler can compile for any model or configuration, according to the
2893 options specified.
2894
2895 Some configurations of the compiler also support additional special
2896 options, usually for compatibility with other compilers on the same
2897 platform.
2898
2899 @ifset INTERNALS
2900 These options are defined by the macro @code{TARGET_SWITCHES} in the
2901 machine description. The default for the options is also defined by
2902 that macro, which enables you to change the defaults.
2903 @end ifset
2904
2905 @menu
2906 * M680x0 Options::
2907 * VAX Options::
2908 * SPARC Options::
2909 * Convex Options::
2910 * AMD29K Options::
2911 * ARM Options::
2912 * Thumb Options::
2913 * MN10300 Options::
2914 * M32R/D Options::
2915 * M88K Options::
2916 * RS/6000 and PowerPC Options::
2917 * RT Options::
2918 * MIPS Options::
2919 * i386 Options::
2920 * HPPA Options::
2921 * Intel 960 Options::
2922 * DEC Alpha Options::
2923 * Clipper Options::
2924 * H8/300 Options::
2925 * SH Options::
2926 * System V Options::
2927 * V850 Options::
2928 @end menu
2929
2930 @node M680x0 Options
2931 @subsection M680x0 Options
2932 @cindex M680x0 options
2933
2934 These are the @samp{-m} options defined for the 68000 series. The default
2935 values for these options depends on which style of 68000 was selected when
2936 the compiler was configured; the defaults for the most common choices are
2937 given below.
2938
2939 @table @code
2940 @item -m68000
2941 @itemx -mc68000
2942 Generate output for a 68000. This is the default
2943 when the compiler is configured for 68000-based systems.
2944
2945 Use this option for microcontrollers with a 68000 or EC000 core,
2946 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
2947
2948 @item -m68020
2949 @itemx -mc68020
2950 Generate output for a 68020. This is the default
2951 when the compiler is configured for 68020-based systems.
2952
2953 @item -m68881
2954 Generate output containing 68881 instructions for floating point.
2955 This is the default for most 68020 systems unless @samp{-nfp} was
2956 specified when the compiler was configured.
2957
2958 @item -m68030
2959 Generate output for a 68030. This is the default when the compiler is
2960 configured for 68030-based systems.
2961
2962 @item -m68040
2963 Generate output for a 68040. This is the default when the compiler is
2964 configured for 68040-based systems.
2965
2966 This option inhibits the use of 68881/68882 instructions that have to be
2967 emulated by software on the 68040. Use this option if your 68040 does not
2968 have code to emulate those instructions.
2969
2970 @item -m68060
2971 Generate output for a 68060. This is the default when the compiler is
2972 configured for 68060-based systems.
2973
2974 This option inhibits the use of 68020 and 68881/68882 instructions that
2975 have to be emulated by software on the 68060. Use this option if your 68060
2976 does not have code to emulate those instructions.
2977
2978 @item -mcpu32
2979 Generate output for a CPU32. This is the default
2980 when the compiler is configured for CPU32-based systems.
2981
2982 Use this option for microcontrollers with a
2983 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
2984 68336, 68340, 68341, 68349 and 68360.
2985
2986 @item -m5200
2987 Generate output for a 520X "coldfire" family cpu. This is the default
2988 when the compiler is configured for 520X-based systems.
2989
2990 Use this option for microcontroller with a 5200 core, including
2991 the MCF5202, MCF5203, MCF5204 and MCF5202.
2992
2993
2994 @item -m68020-40
2995 Generate output for a 68040, without using any of the new instructions.
2996 This results in code which can run relatively efficiently on either a
2997 68020/68881 or a 68030 or a 68040. The generated code does use the
2998 68881 instructions that are emulated on the 68040.
2999
3000 @item -m68020-60
3001 Generate output for a 68060, without using any of the new instructions.
3002 This results in code which can run relatively efficiently on either a
3003 68020/68881 or a 68030 or a 68040. The generated code does use the
3004 68881 instructions that are emulated on the 68060.
3005
3006 @item -mfpa
3007 Generate output containing Sun FPA instructions for floating point.
3008
3009 @item -msoft-float
3010 Generate output containing library calls for floating point.
3011 @strong{Warning:} the requisite libraries are not available for all m68k
3012 targets. Normally the facilities of the machine's usual C compiler are
3013 used, but this can't be done directly in cross-compilation. You must
3014 make your own arrangements to provide suitable library functions for
3015 cross-compilation. The embedded targets @samp{m68k-*-aout} and
3016 @samp{m68k-*-coff} do provide software floating point support.
3017
3018 @item -mshort
3019 Consider type @code{int} to be 16 bits wide, like @code{short int}.
3020
3021 @item -mnobitfield
3022 Do not use the bit-field instructions. The @samp{-m68000}, @samp{-mcpu32}
3023 and @samp{-m5200} options imply @w{@samp{-mnobitfield}}.
3024
3025 @item -mbitfield
3026 Do use the bit-field instructions. The @samp{-m68020} option implies
3027 @samp{-mbitfield}. This is the default if you use a configuration
3028 designed for a 68020.
3029
3030 @item -mrtd
3031 Use a different function-calling convention, in which functions
3032 that take a fixed number of arguments return with the @code{rtd}
3033 instruction, which pops their arguments while returning. This
3034 saves one instruction in the caller since there is no need to pop
3035 the arguments there.
3036
3037 This calling convention is incompatible with the one normally
3038 used on Unix, so you cannot use it if you need to call libraries
3039 compiled with the Unix compiler.
3040
3041 Also, you must provide function prototypes for all functions that
3042 take variable numbers of arguments (including @code{printf});
3043 otherwise incorrect code will be generated for calls to those
3044 functions.
3045
3046 In addition, seriously incorrect code will result if you call a
3047 function with too many arguments. (Normally, extra arguments are
3048 harmlessly ignored.)
3049
3050 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
3051 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
3052
3053 @item -malign-int
3054 @itemx -mno-align-int
3055 Control whether GNU CC aligns @code{int}, @code{long}, @code{long long},
3056 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
3057 boundary (@samp{-malign-int}) or a 16-bit boundary (@samp{-mno-align-int}).
3058 Aligning variables on 32-bit boundaries produces code that runs somewhat
3059 faster on processors with 32-bit busses at the expense of more memory.
3060
3061 @strong{Warning:} if you use the @samp{-malign-int} switch, GNU CC will
3062 align structures containing the above types differently than
3063 most published application binary interface specifications for the m68k.
3064
3065 @end table
3066
3067 @node VAX Options
3068 @subsection VAX Options
3069 @cindex VAX options
3070
3071 These @samp{-m} options are defined for the Vax:
3072
3073 @table @code
3074 @item -munix
3075 Do not output certain jump instructions (@code{aobleq} and so on)
3076 that the Unix assembler for the Vax cannot handle across long
3077 ranges.
3078
3079 @item -mgnu
3080 Do output those jump instructions, on the assumption that you
3081 will assemble with the GNU assembler.
3082
3083 @item -mg
3084 Output code for g-format floating point numbers instead of d-format.
3085 @end table
3086
3087 @node SPARC Options
3088 @subsection SPARC Options
3089 @cindex SPARC options
3090
3091 These @samp{-m} switches are supported on the SPARC:
3092
3093 @table @code
3094 @item -mno-app-regs
3095 @itemx -mapp-regs
3096 Specify @samp{-mapp-regs} to generate output using the global registers
3097 2 through 4, which the SPARC SVR4 ABI reserves for applications. This
3098 is the default.
3099
3100 To be fully SVR4 ABI compliant at the cost of some performance loss,
3101 specify @samp{-mno-app-regs}. You should compile libraries and system
3102 software with this option.
3103
3104 @item -mfpu
3105 @itemx -mhard-float
3106 Generate output containing floating point instructions. This is the
3107 default.
3108
3109 @item -mno-fpu
3110 @itemx -msoft-float
3111 Generate output containing library calls for floating point.
3112 @strong{Warning:} the requisite libraries are not available for all SPARC
3113 targets. Normally the facilities of the machine's usual C compiler are
3114 used, but this cannot be done directly in cross-compilation. You must make
3115 your own arrangements to provide suitable library functions for
3116 cross-compilation. The embedded targets @samp{sparc-*-aout} and
3117 @samp{sparclite-*-*} do provide software floating point support.
3118
3119 @samp{-msoft-float} changes the calling convention in the output file;
3120 therefore, it is only useful if you compile @emph{all} of a program with
3121 this option. In particular, you need to compile @file{libgcc.a}, the
3122 library that comes with GNU CC, with @samp{-msoft-float} in order for
3123 this to work.
3124
3125 @item -mhard-quad-float
3126 Generate output containing quad-word (long double) floating point
3127 instructions.
3128
3129 @item -msoft-quad-float
3130 Generate output containing library calls for quad-word (long double)
3131 floating point instructions. The functions called are those specified
3132 in the SPARC ABI. This is the default.
3133
3134 As of this writing, there are no sparc implementations that have hardware
3135 support for the quad-word floating point instructions. They all invoke
3136 a trap handler for one of these instructions, and then the trap handler
3137 emulates the effect of the instruction. Because of the trap handler overhead,
3138 this is much slower than calling the ABI library routines. Thus the
3139 @samp{-msoft-quad-float} option is the default.
3140
3141 @item -mno-epilogue
3142 @itemx -mepilogue
3143 With @samp{-mepilogue} (the default), the compiler always emits code for
3144 function exit at the end of each function. Any function exit in
3145 the middle of the function (such as a return statement in C) will
3146 generate a jump to the exit code at the end of the function.
3147
3148 With @samp{-mno-epilogue}, the compiler tries to emit exit code inline
3149 at every function exit.
3150
3151 @item -mno-flat
3152 @itemx -mflat
3153 With @samp{-mflat}, the compiler does not generate save/restore instructions
3154 and will use a "flat" or single register window calling convention.
3155 This model uses %i7 as the frame pointer and is compatible with the normal
3156 register window model. Code from either may be intermixed.
3157 The local registers and the input registers (0-5) are still treated as
3158 "call saved" registers and will be saved on the stack as necessary.
3159
3160 With @samp{-mno-flat} (the default), the compiler emits save/restore
3161 instructions (except for leaf functions) and is the normal mode of operation.
3162
3163 @item -mno-unaligned-doubles
3164 @itemx -munaligned-doubles
3165 Assume that doubles have 8 byte alignment. This is the default.
3166
3167 With @samp{-munaligned-doubles}, GNU CC assumes that doubles have 8 byte
3168 alignment only if they are contained in another type, or if they have an
3169 absolute address. Otherwise, it assumes they have 4 byte alignment.
3170 Specifying this option avoids some rare compatibility problems with code
3171 generated by other compilers. It is not the default because it results
3172 in a performance loss, especially for floating point code.
3173
3174 @item -mv8
3175 @itemx -msparclite
3176 These two options select variations on the SPARC architecture.
3177
3178 By default (unless specifically configured for the Fujitsu SPARClite),
3179 GCC generates code for the v7 variant of the SPARC architecture.
3180
3181 @samp{-mv8} will give you SPARC v8 code. The only difference from v7
3182 code is that the compiler emits the integer multiply and integer
3183 divide instructions which exist in SPARC v8 but not in SPARC v7.
3184
3185 @samp{-msparclite} will give you SPARClite code. This adds the integer
3186 multiply, integer divide step and scan (@code{ffs}) instructions which
3187 exist in SPARClite but not in SPARC v7.
3188
3189 These options are deprecated and will be deleted in GNU CC 2.9.
3190 They have been replaced with @samp{-mcpu=xxx}.
3191
3192 @item -mcypress
3193 @itemx -msupersparc
3194 These two options select the processor for which the code is optimised.
3195
3196 With @samp{-mcypress} (the default), the compiler optimizes code for the
3197 Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series.
3198 This is also appropriate for the older SparcStation 1, 2, IPX etc.
3199
3200 With @samp{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as
3201 used in the SparcStation 10, 1000 and 2000 series. This flag also enables use
3202 of the full SPARC v8 instruction set.
3203
3204 These options are deprecated and will be deleted in GNU CC 2.9.
3205 They have been replaced with @samp{-mcpu=xxx}.
3206
3207 @item -mcpu=@var{cpu_type}
3208 Set the instruction set, register set, and instruction scheduling parameters
3209 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
3210 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
3211 @samp{f930}, @samp{f934}, @samp{sparclet}, @samp{tsc701}, @samp{v9}, and
3212 @samp{ultrasparc}.
3213
3214 Default instruction scheduling parameters are used for values that select
3215 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
3216 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
3217
3218 Here is a list of each supported architecture and their supported
3219 implementations.
3220
3221 @smallexample
3222 v7: cypress
3223 v8: supersparc
3224 sparclite: f930, f934
3225 sparclet: tsc701
3226 v9: ultrasparc
3227 @end smallexample
3228
3229 @item -mtune=@var{cpu_type}
3230 Set the instruction scheduling parameters for machine type
3231 @var{cpu_type}, but do not set the instruction set or register set that the
3232 option @samp{-mcpu=}@var{cpu_type} would.
3233
3234 The same values for @samp{-mcpu=}@var{cpu_type} are used for
3235 @samp{-mtune=}@*@var{cpu_type}, though the only useful values are those that
3236 select a particular cpu implementation: @samp{cypress}, @samp{supersparc},
3237 @samp{f930}, @samp{f934}, @samp{tsc701}, @samp{ultrasparc}.
3238
3239 @item -malign-loops=@var{num}
3240 Align loops to a 2 raised to a @var{num} byte boundary. If
3241 @samp{-malign-loops} is not specified, the default is 2.
3242
3243 @item -malign-jumps=@var{num}
3244 Align instructions that are only jumped to to a 2 raised to a @var{num}
3245 byte boundary. If @samp{-malign-jumps} is not specified, the default is 2.
3246
3247 @item -malign-functions=@var{num}
3248 Align the start of functions to a 2 raised to @var{num} byte boundary.
3249 If @samp{-malign-functions} is not specified, the default is 2 if compiling
3250 for 32 bit sparc, and 5 if compiling for 64 bit sparc.
3251
3252 @end table
3253
3254 These @samp{-m} switches are supported in addition to the above
3255 on the SPARCLET processor.
3256
3257 @table @code
3258 @item -mlittle-endian
3259 Generate code for a processor running in little-endian mode.
3260
3261 @item -mlive-g0
3262 Treat register @code{%g0} as a normal register.
3263 GCC will continue to clobber it as necessary but will not assume
3264 it always reads as 0.
3265
3266 @item -mbroken-saverestore
3267 Generate code that does not use non-trivial forms of the @code{save} and
3268 @code{restore} instructions. Early versions of the SPARCLET processor do
3269 not correctly handle @code{save} and @code{restore} instructions used with
3270 arguments. They correctly handle them used without arguments. A @code{save}
3271 instruction used without arguments increments the current window pointer
3272 but does not allocate a new stack frame. It is assumed that the window
3273 overflow trap handler will properly handle this case as will interrupt
3274 handlers.
3275 @end table
3276
3277 These @samp{-m} switches are supported in addition to the above
3278 on SPARC V9 processors in 64 bit environments.
3279
3280 @table @code
3281 @item -mlittle-endian
3282 Generate code for a processor running in little-endian mode.
3283
3284 @item -m32
3285 @itemx -m64
3286 Generate code for a 32 bit or 64 bit environment.
3287 The 32 bit environment sets int, long and pointer to 32 bits.
3288 The 64 bit environment sets int to 32 bits and long and pointer
3289 to 64 bits.
3290
3291 @item -mcmodel=medlow
3292 Generate code for the Medium/Low code model: the program must be linked
3293 in the low 32 bits of the address space. Pointers are 64 bits.
3294 Programs can be statically or dynamically linked.
3295
3296 @item -mcmodel=medmid
3297 Generate code for the Medium/Middle code model: the program must be linked
3298 in the low 44 bits of the address space, the text segment must be less than
3299 2G bytes, and data segment must be within 2G of the text segment.
3300 Pointers are 64 bits.
3301
3302 @item -mcmodel=medany
3303 Generate code for the Medium/Anywhere code model: the program may be linked
3304 anywhere in the address space, the text segment must be less than
3305 2G bytes, and data segment must be within 2G of the text segment.
3306 Pointers are 64 bits.
3307
3308 @item -mcmodel=embmedany
3309 Generate code for the Medium/Anywhere code model for embedded systems:
3310 assume a 32 bit text and a 32 bit data segment, both starting anywhere
3311 (determined at link time). Register %g4 points to the base of the
3312 data segment. Pointers still 64 bits.
3313 Programs are statically linked, PIC is not supported.
3314
3315 @item -mstack-bias
3316 @itemx -mno-stack-bias
3317 With @samp{-mstack-bias}, GNU CC assumes that the stack pointer, and
3318 frame pointer if present, are offset by -2047 which must be added back
3319 when making stack frame references.
3320 Otherwise, assume no such offset is present.
3321 @end table
3322
3323 @node Convex Options
3324 @subsection Convex Options
3325 @cindex Convex options
3326
3327 These @samp{-m} options are defined for Convex:
3328
3329 @table @code
3330 @item -mc1
3331 Generate output for C1. The code will run on any Convex machine.
3332 The preprocessor symbol @code{__convex__c1__} is defined.
3333
3334 @item -mc2
3335 Generate output for C2. Uses instructions not available on C1.
3336 Scheduling and other optimizations are chosen for max performance on C2.
3337 The preprocessor symbol @code{__convex_c2__} is defined.
3338
3339 @item -mc32
3340 Generate output for C32xx. Uses instructions not available on C1.
3341 Scheduling and other optimizations are chosen for max performance on C32.
3342 The preprocessor symbol @code{__convex_c32__} is defined.
3343
3344 @item -mc34
3345 Generate output for C34xx. Uses instructions not available on C1.
3346 Scheduling and other optimizations are chosen for max performance on C34.
3347 The preprocessor symbol @code{__convex_c34__} is defined.
3348
3349 @item -mc38
3350 Generate output for C38xx. Uses instructions not available on C1.
3351 Scheduling and other optimizations are chosen for max performance on C38.
3352 The preprocessor symbol @code{__convex_c38__} is defined.
3353
3354 @item -margcount
3355 Generate code which puts an argument count in the word preceding each
3356 argument list. This is compatible with regular CC, and a few programs
3357 may need the argument count word. GDB and other source-level debuggers
3358 do not need it; this info is in the symbol table.
3359
3360 @item -mnoargcount
3361 Omit the argument count word. This is the default.
3362
3363 @item -mvolatile-cache
3364 Allow volatile references to be cached. This is the default.
3365
3366 @item -mvolatile-nocache
3367 Volatile references bypass the data cache, going all the way to memory.
3368 This is only needed for multi-processor code that does not use standard
3369 synchronization instructions. Making non-volatile references to volatile
3370 locations will not necessarily work.
3371
3372 @item -mlong32
3373 Type long is 32 bits, the same as type int. This is the default.
3374
3375 @item -mlong64
3376 Type long is 64 bits, the same as type long long. This option is useless,
3377 because no library support exists for it.
3378 @end table
3379
3380 @node AMD29K Options
3381 @subsection AMD29K Options
3382 @cindex AMD29K options
3383
3384 These @samp{-m} options are defined for the AMD Am29000:
3385
3386 @table @code
3387 @item -mdw
3388 @kindex -mdw
3389 @cindex DW bit (29k)
3390 Generate code that assumes the @code{DW} bit is set, i.e., that byte and
3391 halfword operations are directly supported by the hardware. This is the
3392 default.
3393
3394 @item -mndw
3395 @kindex -mndw
3396 Generate code that assumes the @code{DW} bit is not set.
3397
3398 @item -mbw
3399 @kindex -mbw
3400 @cindex byte writes (29k)
3401 Generate code that assumes the system supports byte and halfword write
3402 operations. This is the default.
3403
3404 @item -mnbw
3405 @kindex -mnbw
3406 Generate code that assumes the systems does not support byte and
3407 halfword write operations. @samp{-mnbw} implies @samp{-mndw}.
3408
3409 @item -msmall
3410 @kindex -msmall
3411 @cindex memory model (29k)
3412 Use a small memory model that assumes that all function addresses are
3413 either within a single 256 KB segment or at an absolute address of less
3414 than 256k. This allows the @code{call} instruction to be used instead
3415 of a @code{const}, @code{consth}, @code{calli} sequence.
3416
3417 @item -mnormal
3418 @kindex -mnormal
3419 Use the normal memory model: Generate @code{call} instructions only when
3420 calling functions in the same file and @code{calli} instructions
3421 otherwise. This works if each file occupies less than 256 KB but allows
3422 the entire executable to be larger than 256 KB. This is the default.
3423
3424 @item -mlarge
3425 Always use @code{calli} instructions. Specify this option if you expect
3426 a single file to compile into more than 256 KB of code.
3427
3428 @item -m29050
3429 @kindex -m29050
3430 @cindex processor selection (29k)
3431 Generate code for the Am29050.
3432
3433 @item -m29000
3434 @kindex -m29000
3435 Generate code for the Am29000. This is the default.
3436
3437 @item -mkernel-registers
3438 @kindex -mkernel-registers
3439 @cindex kernel and user registers (29k)
3440 Generate references to registers @code{gr64-gr95} instead of to
3441 registers @code{gr96-gr127}. This option can be used when compiling
3442 kernel code that wants a set of global registers disjoint from that used
3443 by user-mode code.
3444
3445 Note that when this option is used, register names in @samp{-f} flags
3446 must use the normal, user-mode, names.
3447
3448 @item -muser-registers
3449 @kindex -muser-registers
3450 Use the normal set of global registers, @code{gr96-gr127}. This is the
3451 default.
3452
3453 @item -mstack-check
3454 @itemx -mno-stack-check
3455 @kindex -mstack-check
3456 @cindex stack checks (29k)
3457 Insert (or do not insert) a call to @code{__msp_check} after each stack
3458 adjustment. This is often used for kernel code.
3459
3460 @item -mstorem-bug
3461 @itemx -mno-storem-bug
3462 @kindex -mstorem-bug
3463 @cindex storem bug (29k)
3464 @samp{-mstorem-bug} handles 29k processors which cannot handle the
3465 separation of a mtsrim insn and a storem instruction (most 29000 chips
3466 to date, but not the 29050).
3467
3468 @item -mno-reuse-arg-regs
3469 @itemx -mreuse-arg-regs
3470 @kindex -mreuse-arg-regs
3471 @samp{-mno-reuse-arg-regs} tells the compiler to only use incoming argument
3472 registers for copying out arguments. This helps detect calling a function
3473 with fewer arguments than it was declared with.
3474
3475 @item -mno-impure-text
3476 @itemx -mimpure-text
3477 @kindex -mimpure-text
3478 @samp{-mimpure-text}, used in addition to @samp{-shared}, tells the compiler to
3479 not pass @samp{-assert pure-text} to the linker when linking a shared object.
3480
3481 @item -msoft-float
3482 @kindex -msoft-float
3483 Generate output containing library calls for floating point.
3484 @strong{Warning:} the requisite libraries are not part of GNU CC.
3485 Normally the facilities of the machine's usual C compiler are used, but
3486 this can't be done directly in cross-compilation. You must make your
3487 own arrangements to provide suitable library functions for
3488 cross-compilation.
3489 @end table
3490
3491 @node ARM Options
3492 @subsection ARM Options
3493 @cindex ARM options
3494
3495 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
3496 architectures:
3497
3498 @table @code
3499 @item -mapcs-frame
3500 @kindex -mapcs-frame
3501 Generate a stack frame that is compliant with the ARM Procedure Call
3502 Standard for all functions, even if this is not strictly necessary for
3503 correct execution of the code. Specifying @samp{-fomit-frame-pointer}
3504 with this option will cause the stack frames not to be generated for
3505 leaf functions. The default is @samp{-mno-apcs-frame}.
3506
3507 @item -mapcs
3508 @kindex -mapcs
3509 This is a synonym for @samp{-mapcs-frame}.
3510
3511 @item -mapcs-26
3512 @kindex -mapcs-26
3513 Generate code for a processor running with a 26-bit program counter,
3514 and conforming to the function calling standards for the APCS 26-bit
3515 option. This option replaces the @samp{-m2} and @samp{-m3} options
3516 of previous releases of the compiler.
3517
3518 @item -mapcs-32
3519 @kindex -mapcs-32
3520 Generate code for a processor running with a 32-bit program counter,
3521 and conforming to the function calling standards for the APCS 32-bit
3522 option. This option replaces the @samp{-m6} option of previous releases
3523 of the compiler.
3524
3525 @item -mapcs-stack-check
3526 @kindex -mapcs-stack-check
3527 @kindex -mno-apcs-stack-check
3528 Generate code to check the amount of stack space available upon entry to
3529 every function (that actually uses some stack space). If there is
3530 insufficient space available then either the function
3531 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
3532 called, depending upon the amount of stack space required. The run time
3533 system is required to provide these functions. The default is
3534 @samp{-mno-apcs-stack-check}, since this produces smaller code.
3535
3536 @item -mapcs-float
3537 @kindex -mapcs-float
3538 @kindex -mno-apcs-float
3539 Pass floating point arguments using the float point registers. This is
3540 one of the variants of the APCS. This option is reccommended if the
3541 target hardware has a floating point unit or if a lot of floating point
3542 arithmetic is going to be performed by the code. The default is
3543 @samp{-mno-apcs-float}, since integer only code is slightly increased in
3544 size if @samp{-mapcs-float} is used.
3545
3546 @item -mapcs-reentrant
3547 @kindex -mapcs-reentrant
3548 @kindex -mno-apcs-reentrant
3549 Generate reentrant, position independent code. This is the equivalent
3550 to specifying the @samp{-fpic} option. The default is
3551 @samp{-mno-apcs-reentrant}.
3552
3553 @item -mthumb-interwork
3554 @kindex -mthumb-interwork
3555 @kindex -mno-thumb-interwork
3556 Generate code which supports calling between the ARM and THUMB
3557 instruction sets. Without this option the two instruction sets cannot
3558 be reliably used inside one program. The default is
3559 @samp{-mno-thumb-interwork}, since slightly larger code is generated
3560 when @samp{-mthumb-interwork} is specified.
3561
3562 @item -mno-sched-prolog
3563 @kindex -mno-sched-prolog
3564 @kindex -msched-prolog
3565 Prevent the reordering of instructions in the function prolog, or the
3566 merging of those instruction with the instructions in the function's
3567 body. This means that all functions will start with a recognisable set
3568 of instructions (or in fact one of a chioce from a small set of
3569 different function prologues), and this information can be used to
3570 locate the start if functions inside an executable piece of code. The
3571 default is @samp{-msched-prolog}.
3572
3573 @item -mhard-float
3574 Generate output containing floating point instructions. This is the
3575 default.
3576
3577 @item -msoft-float
3578 Generate output containing library calls for floating point.
3579 @strong{Warning:} the requisite libraries are not available for all ARM
3580 targets. Normally the facilities of the machine's usual C compiler are
3581 used, but this cannot be done directly in cross-compilation. You must make
3582 your own arrangements to provide suitable library functions for
3583 cross-compilation.
3584
3585 @samp{-msoft-float} changes the calling convention in the output file;
3586 therefore, it is only useful if you compile @emph{all} of a program with
3587 this option. In particular, you need to compile @file{libgcc.a}, the
3588 library that comes with GNU CC, with @samp{-msoft-float} in order for
3589 this to work.
3590
3591 @item -mlittle-endian
3592 Generate code for a processor running in little-endian mode. This is
3593 the default for all standard configurations.
3594
3595 @item -mbig-endian
3596 Generate code for a processor running in big-endian mode; the default is
3597 to compile code for a little-endian processor.
3598
3599 @item -mwords-little-endian
3600 This option only applies when generating code for big-endian processors.
3601 Generate code for a little-endian word order but a big-endian byte
3602 order. That is, a byte order of the form @samp{32107654}. Note: this
3603 option should only be used if you require compatibility with code for
3604 big-endian ARM processors generated by versions of the compiler prior to
3605 2.8.
3606
3607 @item -mshort-load-bytes
3608 @kindex -mshort-load-bytes
3609 Do not try to load half-words (eg @samp{short}s) by loading a word from
3610 an unaligned address. For some targets the MMU is configured to trap
3611 unaligned loads; use this option to generate code that is safe in these
3612 environments.
3613
3614 @item -mno-short-load-bytes
3615 @kindex -mno-short-load-bytes
3616 Use unaligned word loads to load half-words (eg @samp{short}s). This
3617 option produces more efficient code, but the MMU is sometimes configured
3618 to trap these instructions.
3619
3620 @item -mshort-load-words
3621 @kindex -mshort-load-words
3622 This is a synonym for the @samp{-mno-short-load-bytes}.
3623
3624 @item -mno-short-load-words
3625 @kindex -mno-short-load-words
3626 This is a synonym for the @samp{-mshort-load-bytes}.
3627
3628 @item -mbsd
3629 @kindex -mbsd
3630 This option only applies to RISC iX. Emulate the native BSD-mode
3631 compiler. This is the default if @samp{-ansi} is not specified.
3632
3633 @item -mxopen
3634 @kindex -mxopen
3635 This option only applies to RISC iX. Emulate the native X/Open-mode
3636 compiler.
3637
3638 @item -mno-symrename
3639 @kindex -mno-symrename
3640 This option only applies to RISC iX. Do not run the assembler
3641 post-processor, @samp{symrename}, after code has been assembled.
3642 Normally it is necessary to modify some of the standard symbols in
3643 preparation for linking with the RISC iX C library; this option
3644 suppresses this pass. The post-processor is never run when the
3645 compiler is built for cross-compilation.
3646
3647 @item -mcpu=<name>
3648 @kindex -mcpu=
3649 This specifies the name of the target ARM processor. GCC uses this name
3650 to determine what kind of instructions it can use when generating
3651 assembly code. Permissable names are: arm2, arm250, arm3, arm6, arm60,
3652 arm600, arm610, arm620, arm7, arm7m, arm7d, arm7dm, arm7di, arm7dmi,
3653 arm70, arm700, arm700i, arm710, arm710c, arm7100, arm7500, arm7500fe,
3654 arm7tdmi, arm8, strongarm, strongarm110
3655
3656 @item -march=<name>
3657 @kindex -march=
3658 This specifies the name of the target ARM architecture. GCC uses this
3659 name to determine what kind of instructions it can use when generating
3660 assembly code. This option can be used in conjunction with or instead
3661 of the @samp{-mcpu=} option. Permissable names are: armv2, armv2a,
3662 armv3, armv3m, armv4, armv4t
3663
3664 @item -mfpe=<number>
3665 @kindex -mfpe=
3666 This specifes the version of the floating point emulation available on
3667 the target. Permissable values are 2 and 3.
3668
3669 @item -mstructure-size-boundary=<n>
3670 @kindex -mstructure-size-boundary
3671 The size of all structures and unions will be rounded up to a multiple
3672 of the number of bits set by this option. Permissable values are 8 and
3673 32. The default value varies for different toolchains. For the COFF
3674 targeted toolchain the default value is 8. Specifying the larger number
3675 can produced faster, more efficient code, but can also increase the size
3676 of the program. The two values are potentially incompatible. Code
3677 compiled with one value cannot necessarily expect to work with code or
3678 libraries compiled with the other value, if they exchange information
3679 using structures or unions. Programmers are encouraged to use the 32
3680 value as future versions of the toolchain may default to this value.
3681
3682 @end table
3683
3684 @node Thumb Options
3685 @subsection Thumb Options
3686 @cindex Thumb Options
3687
3688 @table @code
3689
3690 @item -mthumb-interwork
3691 @kindex -mthumb-interwork
3692 @kindex -mno-thumb-interwork
3693 Generate code which supports calling between the THUMB and ARM
3694 instruction sets. Without this option the two instruction sets cannot
3695 be reliably used inside one program. The default is
3696 @samp{-mno-thumb-interwork}, since slightly smaller code is generated
3697 with this option.
3698
3699 @item -mtpcs-frame
3700 @kindex -mtpcs-frame
3701 @kindex -mno-tpcs-frame
3702 Generate a stack frame that is compliant with the Thumb Procedure Call
3703 Standard for all non-leaf functions. (A leaf function is one that does
3704 not call any other functions). The default is @samp{-mno-apcs-frame}.
3705
3706 @item -mtpcs-leaf-frame
3707 @kindex -mtpcs-leaf-frame
3708 @kindex -mno-tpcs-leaf-frame
3709 Generate a stack frame that is compliant with the Thumb Procedure Call
3710 Standard for all leaf functions. (A leaf function is one that does
3711 not call any other functions). The default is @samp{-mno-apcs-leaf-frame}.
3712
3713 @item -mlittle-endian
3714 @kindex -mlittle-endian
3715 Generate code for a processor running in little-endian mode. This is
3716 the default for all standard configurations.
3717
3718 @item -mbig-endian
3719 @kindex -mbig-endian
3720 Generate code for a processor running in big-endian mode.
3721
3722 @item -mstructure-size-boundary=<n>
3723 @kindex -mstructure-size-boundary
3724 The size of all structures and unions will be rounded up to a multiple
3725 of the number of bits set by this option. Permissable values are 8 and
3726 32. The default value varies for different toolchains. For the COFF
3727 targeted toolchain the default value is 8. Specifying the larger number
3728 can produced faster, more efficient code, but can also increase the size
3729 of the program. The two values are potentially incompatible. Code
3730 compiled with one value cannot necessarily expect to work with code or
3731 libraries compiled with the other value, if they exchange information
3732 using structures or unions. Programmers are encouraged to use the 32
3733 value as future versions of the toolchain may default to this value.
3734
3735 @end table
3736
3737
3738 @node MN10300 Options
3739 @subsection MN10300 Options
3740 @cindex MN10300 options
3741 These @samp{-m} options are defined for Matsushita MN10300 architectures:
3742
3743 @table @code
3744 @item -mmult-bug
3745 Generate code to avoid bugs in the multiply instructions for the MN10300
3746 processors. This is the default.
3747
3748 @item -mno-mult-bug
3749 Do not generate code to avoid bugs in the multiply instructions for the
3750 MN10300 processors.
3751 @end table
3752
3753 @node M32R/D Options
3754 @subsection M32R/D Options
3755 @cindex M32R/D options
3756
3757 These @samp{-m} options are defined for Mitsubishi M32R/D architectures:
3758
3759 @table @code
3760 @item -mcode-model=small
3761 Assume all objects live in the lower 16MB of memory (so that their addresses
3762 can be loaded with the @code{ld24} instruction), and assume all subroutines
3763 are reachable with the @code{bl} instruction.
3764 This is the default.
3765
3766 The addressability of a particular object can be set with the
3767 @code{model} attribute.
3768
3769 @item -mcode-model=medium
3770 Assume objects may be anywhere in the 32 bit address space (the compiler
3771 will generate @code{seth/add3} instructions to load their addresses), and
3772 assume all subroutines are reachable with the @code{bl} instruction.
3773
3774 @item -mcode-model=large
3775 Assume objects may be anywhere in the 32 bit address space (the compiler
3776 will generate @code{seth/add3} instructions to load their addresses), and
3777 assume subroutines may not be reachable with the @code{bl} instruction
3778 (the compiler will generate the much slower @code{seth/add3/jl}
3779 instruction sequence).
3780
3781 @item -msdata=none
3782 Disable use of the small data area. Variables will be put into
3783 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
3784 @code{section} attribute has been specified).
3785 This is the default.
3786
3787 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
3788 Objects may be explicitly put in the small data area with the
3789 @code{section} attribute using one of these sections.
3790
3791 @item -msdata=sdata
3792 Put small global and static data in the small data area, but do not
3793 generate special code to reference them.
3794
3795 @item -msdata=use
3796 Put small global and static data in the small data area, and generate
3797 special instructions to reference them.
3798
3799 @item -G @var{num}
3800 @cindex smaller data references
3801 Put global and static objects less than or equal to @var{num} bytes
3802 into the small data or bss sections instead of the normal data or bss
3803 sections. The default value of @var{num} is 8.
3804 The @samp{-msdata} option must be set to one of @samp{sdata} or @samp{use}
3805 for this option to have any effect.
3806
3807 All modules should be compiled with the same @samp{-G @var{num}} value.
3808 Compiling with different values of @var{num} may or may not work; if it
3809 doesn't the linker will give an error message - incorrect code will not be
3810 generated.
3811
3812 @end table
3813
3814 @node M88K Options
3815 @subsection M88K Options
3816 @cindex M88k options
3817
3818 These @samp{-m} options are defined for Motorola 88k architectures:
3819
3820 @table @code
3821 @item -m88000
3822 @kindex -m88000
3823 Generate code that works well on both the m88100 and the
3824 m88110.
3825
3826 @item -m88100
3827 @kindex -m88100
3828 Generate code that works best for the m88100, but that also
3829 runs on the m88110.
3830
3831 @item -m88110
3832 @kindex -m88110
3833 Generate code that works best for the m88110, and may not run
3834 on the m88100.
3835
3836 @item -mbig-pic
3837 @kindex -mbig-pic
3838 Obsolete option to be removed from the next revision.
3839 Use @samp{-fPIC}.
3840
3841 @item -midentify-revision
3842 @kindex -midentify-revision
3843 @kindex ident
3844 @cindex identifying source, compiler (88k)
3845 Include an @code{ident} directive in the assembler output recording the
3846 source file name, compiler name and version, timestamp, and compilation
3847 flags used.
3848
3849 @item -mno-underscores
3850 @kindex -mno-underscores
3851 @cindex underscores, avoiding (88k)
3852 In assembler output, emit symbol names without adding an underscore
3853 character at the beginning of each name. The default is to use an
3854 underscore as prefix on each name.
3855
3856 @item -mocs-debug-info
3857 @itemx -mno-ocs-debug-info
3858 @kindex -mocs-debug-info
3859 @kindex -mno-ocs-debug-info
3860 @cindex OCS (88k)
3861 @cindex debugging, 88k OCS
3862 Include (or omit) additional debugging information (about registers used
3863 in each stack frame) as specified in the 88open Object Compatibility
3864 Standard, ``OCS''. This extra information allows debugging of code that
3865 has had the frame pointer eliminated. The default for DG/UX, SVr4, and
3866 Delta 88 SVr3.2 is to include this information; other 88k configurations
3867 omit this information by default.
3868
3869 @item -mocs-frame-position
3870 @kindex -mocs-frame-position
3871 @cindex register positions in frame (88k)
3872 When emitting COFF debugging information for automatic variables and
3873 parameters stored on the stack, use the offset from the canonical frame
3874 address, which is the stack pointer (register 31) on entry to the
3875 function. The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use
3876 @samp{-mocs-frame-position}; other 88k configurations have the default
3877 @samp{-mno-ocs-frame-position}.
3878
3879 @item -mno-ocs-frame-position
3880 @kindex -mno-ocs-frame-position
3881 @cindex register positions in frame (88k)
3882 When emitting COFF debugging information for automatic variables and
3883 parameters stored on the stack, use the offset from the frame pointer
3884 register (register 30). When this option is in effect, the frame
3885 pointer is not eliminated when debugging information is selected by the
3886 -g switch.
3887
3888 @item -moptimize-arg-area
3889 @itemx -mno-optimize-arg-area
3890 @kindex -moptimize-arg-area
3891 @kindex -mno-optimize-arg-area
3892 @cindex arguments in frame (88k)
3893 Control how function arguments are stored in stack frames.
3894 @samp{-moptimize-arg-area} saves space by optimizing them, but this
3895 conflicts with the 88open specifications. The opposite alternative,
3896 @samp{-mno-optimize-arg-area}, agrees with 88open standards. By default
3897 GNU CC does not optimize the argument area.
3898
3899 @item -mshort-data-@var{num}
3900 @kindex -mshort-data-@var{num}
3901 @cindex smaller data references (88k)
3902 @cindex r0-relative references (88k)
3903 Generate smaller data references by making them relative to @code{r0},
3904 which allows loading a value using a single instruction (rather than the
3905 usual two). You control which data references are affected by
3906 specifying @var{num} with this option. For example, if you specify
3907 @samp{-mshort-data-512}, then the data references affected are those
3908 involving displacements of less than 512 bytes.
3909 @samp{-mshort-data-@var{num}} is not effective for @var{num} greater
3910 than 64k.
3911
3912 @item -mserialize-volatile
3913 @kindex -mserialize-volatile
3914 @itemx -mno-serialize-volatile
3915 @kindex -mno-serialize-volatile
3916 @cindex sequential consistency on 88k
3917 Do, or don't, generate code to guarantee sequential consistency
3918 of volatile memory references. By default, consistency is
3919 guaranteed.
3920
3921 The order of memory references made by the MC88110 processor does
3922 not always match the order of the instructions requesting those
3923 references. In particular, a load instruction may execute before
3924 a preceding store instruction. Such reordering violates
3925 sequential consistency of volatile memory references, when there
3926 are multiple processors. When consistency must be guaranteed,
3927 GNU C generates special instructions, as needed, to force
3928 execution in the proper order.
3929
3930 The MC88100 processor does not reorder memory references and so
3931 always provides sequential consistency. However, by default, GNU
3932 C generates the special instructions to guarantee consistency
3933 even when you use @samp{-m88100}, so that the code may be run on an
3934 MC88110 processor. If you intend to run your code only on the
3935 MC88100 processor, you may use @samp{-mno-serialize-volatile}.
3936
3937 The extra code generated to guarantee consistency may affect the
3938 performance of your application. If you know that you can safely
3939 forgo this guarantee, you may use @samp{-mno-serialize-volatile}.
3940
3941 @item -msvr4
3942 @itemx -msvr3
3943 @kindex -msvr4
3944 @kindex -msvr3
3945 @cindex assembler syntax, 88k
3946 @cindex SVr4
3947 Turn on (@samp{-msvr4}) or off (@samp{-msvr3}) compiler extensions
3948 related to System V release 4 (SVr4). This controls the following:
3949
3950 @enumerate
3951 @item
3952 Which variant of the assembler syntax to emit.
3953 @item
3954 @samp{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
3955 that is used on System V release 4.
3956 @item
3957 @samp{-msvr4} makes GNU CC issue additional declaration directives used in
3958 SVr4.
3959 @end enumerate
3960
3961 @samp{-msvr4} is the default for the m88k-motorola-sysv4 and
3962 m88k-dg-dgux m88k configurations. @samp{-msvr3} is the default for all
3963 other m88k configurations.
3964
3965 @item -mversion-03.00
3966 @kindex -mversion-03.00
3967 This option is obsolete, and is ignored.
3968 @c ??? which asm syntax better for GAS? option there too?
3969
3970 @item -mno-check-zero-division
3971 @itemx -mcheck-zero-division
3972 @kindex -mno-check-zero-division
3973 @kindex -mcheck-zero-division
3974 @cindex zero division on 88k
3975 Do, or don't, generate code to guarantee that integer division by
3976 zero will be detected. By default, detection is guaranteed.
3977
3978 Some models of the MC88100 processor fail to trap upon integer
3979 division by zero under certain conditions. By default, when
3980 compiling code that might be run on such a processor, GNU C
3981 generates code that explicitly checks for zero-valued divisors
3982 and traps with exception number 503 when one is detected. Use of
3983 mno-check-zero-division suppresses such checking for code
3984 generated to run on an MC88100 processor.
3985
3986 GNU C assumes that the MC88110 processor correctly detects all
3987 instances of integer division by zero. When @samp{-m88110} is
3988 specified, both @samp{-mcheck-zero-division} and
3989 @samp{-mno-check-zero-division} are ignored, and no explicit checks for
3990 zero-valued divisors are generated.
3991
3992 @item -muse-div-instruction
3993 @kindex -muse-div-instruction
3994 @cindex divide instruction, 88k
3995 Use the div instruction for signed integer division on the
3996 MC88100 processor. By default, the div instruction is not used.
3997
3998 On the MC88100 processor the signed integer division instruction
3999 div) traps to the operating system on a negative operand. The
4000 operating system transparently completes the operation, but at a
4001 large cost in execution time. By default, when compiling code
4002 that might be run on an MC88100 processor, GNU C emulates signed
4003 integer division using the unsigned integer division instruction
4004 divu), thereby avoiding the large penalty of a trap to the
4005 operating system. Such emulation has its own, smaller, execution
4006 cost in both time and space. To the extent that your code's
4007 important signed integer division operations are performed on two
4008 nonnegative operands, it may be desirable to use the div
4009 instruction directly.
4010
4011 On the MC88110 processor the div instruction (also known as the
4012 divs instruction) processes negative operands without trapping to
4013 the operating system. When @samp{-m88110} is specified,
4014 @samp{-muse-div-instruction} is ignored, and the div instruction is used
4015 for signed integer division.
4016
4017 Note that the result of dividing INT_MIN by -1 is undefined. In
4018 particular, the behavior of such a division with and without
4019 @samp{-muse-div-instruction} may differ.
4020
4021 @item -mtrap-large-shift
4022 @itemx -mhandle-large-shift
4023 @kindex -mtrap-large-shift
4024 @kindex -mhandle-large-shift
4025 @cindex bit shift overflow (88k)
4026 @cindex large bit shifts (88k)
4027 Include code to detect bit-shifts of more than 31 bits; respectively,
4028 trap such shifts or emit code to handle them properly. By default GNU CC
4029 makes no special provision for large bit shifts.
4030
4031 @item -mwarn-passed-structs
4032 @kindex -mwarn-passed-structs
4033 @cindex structure passing (88k)
4034 Warn when a function passes a struct as an argument or result.
4035 Structure-passing conventions have changed during the evolution of the C
4036 language, and are often the source of portability problems. By default,
4037 GNU CC issues no such warning.
4038 @end table
4039
4040 @node RS/6000 and PowerPC Options
4041 @subsection IBM RS/6000 and PowerPC Options
4042 @cindex RS/6000 and PowerPC Options
4043 @cindex IBM RS/6000 and PowerPC Options
4044
4045 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
4046 @table @code
4047 @item -mpower
4048 @itemx -mno-power
4049 @itemx -mpower2
4050 @itemx -mno-power2
4051 @itemx -mpowerpc
4052 @itemx -mno-powerpc
4053 @itemx -mpowerpc-gpopt
4054 @itemx -mno-powerpc-gpopt
4055 @itemx -mpowerpc-gfxopt
4056 @itemx -mno-powerpc-gfxopt
4057 @kindex -mpower
4058 @kindex -mpower2
4059 @kindex -mpowerpc
4060 @kindex -mpowerpc-gpopt
4061 @kindex -mpowerpc-gfxopt
4062 GNU CC supports two related instruction set architectures for the
4063 RS/6000 and PowerPC. The @dfn{POWER} instruction set are those
4064 instructions supported by the @samp{rios} chip set used in the original
4065 RS/6000 systems and the @dfn{PowerPC} instruction set is the
4066 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
4067 the IBM 4xx microprocessors.
4068
4069 Neither architecture is a subset of the other. However there is a
4070 large common subset of instructions supported by both. An MQ
4071 register is included in processors supporting the POWER architecture.
4072
4073 You use these options to specify which instructions are available on the
4074 processor you are using. The default value of these options is
4075 determined when configuring GNU CC. Specifying the
4076 @samp{-mcpu=@var{cpu_type}} overrides the specification of these
4077 options. We recommend you use the @samp{-mcpu=@var{cpu_type}} option
4078 rather than the options listed above.
4079
4080 The @samp{-mpower} option allows GNU CC to generate instructions that
4081 are found only in the POWER architecture and to use the MQ register.
4082 Specifying @samp{-mpower2} implies @samp{-power} and also allows GNU CC
4083 to generate instructions that are present in the POWER2 architecture but
4084 not the original POWER architecture.
4085
4086 The @samp{-mpowerpc} option allows GNU CC to generate instructions that
4087 are found only in the 32-bit subset of the PowerPC architecture.
4088 Specifying @samp{-mpowerpc-gpopt} implies @samp{-mpowerpc} and also allows
4089 GNU CC to use the optional PowerPC architecture instructions in the
4090 General Purpose group, including floating-point square root. Specifying
4091 @samp{-mpowerpc-gfxopt} implies @samp{-mpowerpc} and also allows GNU CC to
4092 use the optional PowerPC architecture instructions in the Graphics
4093 group, including floating-point select.
4094
4095 If you specify both @samp{-mno-power} and @samp{-mno-powerpc}, GNU CC
4096 will use only the instructions in the common subset of both
4097 architectures plus some special AIX common-mode calls, and will not use
4098 the MQ register. Specifying both @samp{-mpower} and @samp{-mpowerpc}
4099 permits GNU CC to use any instruction from either architecture and to
4100 allow use of the MQ register; specify this for the Motorola MPC601.
4101
4102 @item -mnew-mnemonics
4103 @itemx -mold-mnemonics
4104 @kindex -mnew-mnemonics
4105 @kindex -mold-mnemonics
4106 Select which mnemonics to use in the generated assembler code.
4107 @samp{-mnew-mnemonics} requests output that uses the assembler mnemonics
4108 defined for the PowerPC architecture, while @samp{-mold-mnemonics}
4109 requests the assembler mnemonics defined for the POWER architecture.
4110 Instructions defined in only one architecture have only one mnemonic;
4111 GNU CC uses that mnemonic irrespective of which of these options is
4112 specified.
4113
4114 PowerPC assemblers support both the old and new mnemonics, as will later
4115 POWER assemblers. Current POWER assemblers only support the old
4116 mnemonics. Specify @samp{-mnew-mnemonics} if you have an assembler that
4117 supports them, otherwise specify @samp{-mold-mnemonics}.
4118
4119 The default value of these options depends on how GNU CC was configured.
4120 Specifying @samp{-mcpu=@var{cpu_type}} sometimes overrides the value of
4121 these option. Unless you are building a cross-compiler, you should
4122 normally not specify either @samp{-mnew-mnemonics} or
4123 @samp{-mold-mnemonics}, but should instead accept the default.
4124
4125 @item -mcpu=@var{cpu_type}
4126 Set architecture type, register usage, choice of mnemonics, and
4127 instruction scheduling parameters for machine type @var{cpu_type}.
4128 Supported values for @var{cpu_type} are @samp{rs6000}, @samp{rios1},
4129 @samp{rios2}, @samp{rsc}, @samp{601}, @samp{602}, @samp{603},
4130 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{power},
4131 @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505}, @samp{801},
4132 @samp{821}, @samp{823}, and @samp{860} and @samp{common}.
4133 @samp{-mcpu=power}, @samp{-mcpu=power2}, and @samp{-mcpu=powerpc}
4134 specify generic POWER, POWER2 and pure PowerPC (i.e., not MPC601)
4135 architecture machine types, with an appropriate, generic processor model
4136 assumed for scheduling purposes.@refill
4137
4138 @c overfull hbox here --bob 22 jul96
4139 @c original text between ignore ... end ignore
4140 @ignore
4141 Specifying any of the @samp{-mcpu=rios1}, @samp{-mcpu=rios2},
4142 @samp{-mcpu=rsc}, @samp{-mcpu=power}, or @samp{-mcpu=power2} options
4143 enables the @samp{-mpower} option and disables the @samp{-mpowerpc}
4144 option; @samp{-mcpu=601} enables both the @samp{-mpower} and
4145 @samp{-mpowerpc} options; all of @samp{-mcpu=602}, @samp{-mcpu=603},
4146 @samp{-mcpu=603e}, @samp{-mcpu=604}, @samp{-mcpu=604e},
4147 @samp{-mcpu=620}, @samp{-mcpu=403}, @samp{-mcpu=505}, @samp{-mcpu=801},
4148 @samp{-mcpu=821}, @samp{-mcpu=823}, @samp{-mcpu=860} and
4149 @samp{-mcpu=powerpc} enable the @samp{-mpowerpc} option and disable the
4150 @samp{-mpower} option; @samp{-mcpu=common} disables both the
4151 @samp{-mpower} and @samp{-mpowerpc} options.@refill
4152 @end ignore
4153 @c changed paragraph
4154 Specifying any of the following options:
4155 @samp{-mcpu=rios1}, @samp{-mcpu=rios2}, @samp{-mcpu=rsc},
4156 @samp{-mcpu=power}, or @samp{-mcpu=power2}
4157 enables the @samp{-mpower} option and disables the @samp{-mpowerpc} option;
4158 @samp{-mcpu=601} enables both the @samp{-mpower} and @samp{-mpowerpc} options.
4159 All of @samp{-mcpu=602}, @samp{-mcpu=603}, @samp{-mcpu=603e},
4160 @samp{-mcpu=604}, @samp{-mcpu=620},
4161 enable the @samp{-mpowerpc} option and disable the @samp{-mpower} option.
4162 Exactly similarly, all of @samp{-mcpu=403},
4163 @samp{-mcpu=505}, @samp{-mcpu=821}, @samp{-mcpu=860} and @samp{-mcpu=powerpc}
4164 enable the @samp{-mpowerpc} option and disable the @samp{-mpower} option.
4165 @samp{-mcpu=common} disables both the
4166 @samp{-mpower} and @samp{-mpowerpc} options.@refill
4167 @c end changes to prevent overfull hboxes
4168
4169 AIX versions 4 or greater selects @samp{-mcpu=common} by default, so
4170 that code will operate on all members of the RS/6000 and PowerPC
4171 families. In that case, GNU CC will use only the instructions in the
4172 common subset of both architectures plus some special AIX common-mode
4173 calls, and will not use the MQ register. GNU CC assumes a generic
4174 processor model for scheduling purposes.
4175
4176 Specifying any of the options @samp{-mcpu=rios1}, @samp{-mcpu=rios2},
4177 @samp{-mcpu=rsc}, @samp{-mcpu=power}, or @samp{-mcpu=power2} also
4178 disables the @samp{new-mnemonics} option. Specifying @samp{-mcpu=601},
4179 @samp{-mcpu=602}, @samp{-mcpu=603}, @samp{-mcpu=603e}, @samp{-mcpu=604},
4180 @samp{620}, @samp{403}, or @samp{-mcpu=powerpc} also enables the
4181 @samp{new-mnemonics} option.@refill
4182
4183 Specifying @samp{-mcpu=403}, @samp{-mcpu=821}, or @samp{-mcpu=860} also
4184 enables the @samp{-msoft-float} option.
4185
4186 @item -mtune=@var{cpu_type}
4187 Set the instruction scheduling parameters for machine type
4188 @var{cpu_type}, but do not set the architecture type, register usage,
4189 choice of mnemonics like @samp{-mcpu=}@var{cpu_type} would. The same
4190 values for @var{cpu_type} are used for @samp{-mtune=}@var{cpu_type} as
4191 for @samp{-mcpu=}@var{cpu_type}. The @samp{-mtune=}@var{cpu_type}
4192 option overrides the @samp{-mcpu=}@var{cpu_type} option in terms of
4193 instruction scheduling parameters.
4194
4195 @item -mfull-toc
4196 @itemx -mno-fp-in-toc
4197 @itemx -mno-sum-in-toc
4198 @itemx -mminimal-toc
4199 Modify generation of the TOC (Table Of Contents), which is created for
4200 every executable file. The @samp{-mfull-toc} option is selected by
4201 default. In that case, GNU CC will allocate at least one TOC entry for
4202 each unique non-automatic variable reference in your program. GNU CC
4203 will also place floating-point constants in the TOC. However, only
4204 16,384 entries are available in the TOC.
4205
4206 If you receive a linker error message that saying you have overflowed
4207 the available TOC space, you can reduce the amount of TOC space used
4208 with the @samp{-mno-fp-in-toc} and @samp{-mno-sum-in-toc} options.
4209 @samp{-mno-fp-in-toc} prevents GNU CC from putting floating-point
4210 constants in the TOC and @samp{-mno-sum-in-toc} forces GNU CC to
4211 generate code to calculate the sum of an address and a constant at
4212 run-time instead of putting that sum into the TOC. You may specify one
4213 or both of these options. Each causes GNU CC to produce very slightly
4214 slower and larger code at the expense of conserving TOC space.
4215
4216 If you still run out of space in the TOC even when you specify both of
4217 these options, specify @samp{-mminimal-toc} instead. This option causes
4218 GNU CC to make only one TOC entry for every file. When you specify this
4219 option, GNU CC will produce code that is slower and larger but which
4220 uses extremely little TOC space. You may wish to use this option
4221 only on files that contain less frequently executed code. @refill
4222
4223 @item -mxl-call
4224 @itemx -mno-xl-call
4225 On AIX, pass floating-point arguments to prototyped functions beyond the
4226 register save area (RSA) on the stack in addition to argument FPRs. The
4227 AIX calling convention was extended but not initially documented to
4228 handle an obscure K&R C case of calling a function that takes the
4229 address of its arguments with fewer arguments than declared. AIX XL
4230 compilers assume that floating point arguments which do not fit in the
4231 RSA are on the stack when they compile a subroutine without
4232 optimization. Because always storing floating-point arguments on the
4233 stack is inefficient and rarely needed, this option is not enabled by
4234 default and only is necessary when calling subroutines compiled by AIX
4235 XL compilers without optimization.
4236
4237 @item -mthreads
4238 Support @dfn{AIX Threads}. Link an application written to use
4239 @dfn{pthreads} with special libraries and startup code to enable the
4240 application to run.
4241
4242 @item -mpe
4243 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE). Link an
4244 application written to use message passing with special startup code to
4245 enable the application to run. The system must have PE installed in the
4246 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
4247 must be overridden with the @samp{-specs=} option to specify the
4248 appropriate directory location. The Parallel Environment does not
4249 support threads, so the @samp{-mpe} option and the @samp{-mthreads}
4250 option are incompatible.
4251
4252 @item -msoft-float
4253 @itemx -mhard-float
4254 Generate code that does not use (uses) the floating-point register set.
4255 Software floating point emulation is provided if you use the
4256 @samp{-msoft-float} option, and pass the option to GNU CC when linking.
4257
4258 @item -mmultiple
4259 @itemx -mno-multiple
4260 Generate code that uses (does not use) the load multiple word
4261 instructions and the store multiple word instructions. These
4262 instructions are generated by default on POWER systems, and not
4263 generated on PowerPC systems. Do not use @samp{-mmultiple} on little
4264 endian PowerPC systems, since those instructions do not work when the
4265 processor is in little endian mode.
4266
4267 @item -mstring
4268 @itemx -mno-string
4269 Generate code that uses (does not use) the load string instructions and the
4270 store string word instructions to save multiple registers and do small block
4271 moves. These instructions are generated by default on POWER systems, and not
4272 generated on PowerPC systems. Do not use @samp{-mstring} on little endian
4273 PowerPC systems, since those instructions do not work when the processor is in
4274 little endian mode.
4275
4276 @item -mupdate
4277 @itemx -mno-update
4278 Generate code that uses (does not use) the load or store instructions
4279 that update the base register to the address of the calculated memory
4280 location. These instructions are generated by default. If you use
4281 @samp{-mno-update}, there is a small window between the time that the
4282 stack pointer is updated and the address of the previous frame is
4283 stored, which means code that walks the stack frame across interrupts or
4284 signals may get corrupted data.
4285
4286 @item -mfused-madd
4287 @itemx -mno-fused-madd
4288 Generate code that uses (does not use) the floating point multiply and
4289 accumulate instructions. These instructions are generated by default if
4290 hardware floating is used.
4291
4292 @item -mno-bit-align
4293 @itemx -mbit-align
4294 On System V.4 and embedded PowerPC systems do not (do) force structures
4295 and unions that contain bit fields to be aligned to the base type of the
4296 bit field.
4297
4298 For example, by default a structure containing nothing but 8
4299 @code{unsigned} bitfields of length 1 would be aligned to a 4 byte
4300 boundary and have a size of 4 bytes. By using @samp{-mno-bit-align},
4301 the structure would be aligned to a 1 byte boundary and be one byte in
4302 size.
4303
4304 @item -mno-strict-align
4305 @itemx -mstrict-align
4306 On System V.4 and embedded PowerPC systems do not (do) assume that
4307 unaligned memory references will be handled by the system.
4308
4309 @item -mrelocatable
4310 @itemx -mno-relocatable
4311 On embedded PowerPC systems generate code that allows (does not allow)
4312 the program to be relocated to a different address at runtime. If you
4313 use @samp{-mrelocatable} on any module, all objects linked together must
4314 be compiled with @samp{-mrelocatable} or @samp{-mrelocatable-lib}.
4315
4316 @item -mrelocatable-lib
4317 @itemx -mno-relocatable-lib
4318 On embedded PowerPC systems generate code that allows (does not allow)
4319 the program to be relocated to a different address at runtime. Modules
4320 compiled with @samp{-mrelocatable-lib} can be linked with either modules
4321 compiled without @samp{-mrelocatable} and @samp{-mrelocatable-lib} or
4322 with modules compiled with the @samp{-mrelocatable} options.
4323
4324 @item -mno-toc
4325 @itemx -mtoc
4326 On System V.4 and embedded PowerPC systems do not (do) assume that
4327 register 2 contains a pointer to a global area pointing to the addresses
4328 used in the program.
4329
4330 @item -mno-traceback
4331 @itemx -mtraceback
4332 On embedded PowerPC systems do not (do) generate a traceback tag before
4333 the start of the function. This tag can be used by the debugger to
4334 identify where the start of a function is.
4335
4336 @item -mlittle
4337 @itemx -mlittle-endian
4338 On System V.4 and embedded PowerPC systems compile code for the
4339 processor in little endian mode. The @samp{-mlittle-endian} option is
4340 the same as @samp{-mlittle}.
4341
4342 @item -mbig
4343 @itemx -mbig-endian
4344 On System V.4 and embedded PowerPC systems compile code for the
4345 processor in big endian mode. The @samp{-mbig-endian} option is
4346 the same as @samp{-mbig}.
4347
4348 @item -mcall-sysv
4349 On System V.4 and embedded PowerPC systems compile code using calling
4350 conventions that adheres to the March 1995 draft of the System V
4351 Application Binary Interface, PowerPC processor supplement. This is the
4352 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
4353
4354 @item -mcall-sysv-eabi
4355 Specify both @samp{-mcall-sysv} and @samp{-meabi} options.
4356
4357 @item -mcall-sysv-noeabi
4358 Specify both @samp{-mcall-sysv} and @samp{-mno-eabi} options.
4359
4360 @item -mcall-aix
4361 On System V.4 and embedded PowerPC systems compile code using calling
4362 conventions that are similar to those used on AIX. This is the
4363 default if you configured GCC using @samp{powerpc-*-eabiaix}.
4364
4365 @item -mcall-solaris
4366 On System V.4 and embedded PowerPC systems compile code for the Solaris
4367 operating system.
4368
4369 @item -mcall-linux
4370 On System V.4 and embedded PowerPC systems compile code for the
4371 Linux-based GNU system.
4372
4373 @item -mprototype
4374 @itemx -mno-prototype
4375 On System V.4 and embedded PowerPC systems assume that all calls to
4376 variable argument functions are properly prototyped. Otherwise, the
4377 compiler must insert an instruction before every non prototyped call to
4378 set or clear bit 6 of the condition code register (@var{CR}) to
4379 indicate whether floating point values were passed in the floating point
4380 registers in case the function takes a variable arguments. With
4381 @samp{-mprototype}, only calls to prototyped variable argument functions
4382 will set or clear the bit.
4383
4384 @item -msim
4385 On embedded PowerPC systems, assume that the startup module is called
4386 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
4387 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}.
4388 configurations.
4389
4390 @item -mmvme
4391 On embedded PowerPC systems, assume that the startup module is called
4392 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
4393 @file{libc.a}.
4394
4395 @item -mads
4396 On embedded PowerPC systems, assume that the startup module is called
4397 @file{crt0.o} and the standard C libraries are @file{libads.a} and
4398 @file{libc.a}.
4399
4400 @item -myellowknife
4401 On embedded PowerPC systems, assume that the startup module is called
4402 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
4403 @file{libc.a}.
4404
4405 @item -memb
4406 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
4407 header to indicate that @samp{eabi} extended relocations are used.
4408
4409 @item -meabi
4410 @itemx -mno-eabi
4411 On System V.4 and embedded PowerPC systems do (do not) adhere to the
4412 Embedded Applications Binary Interface (eabi) which is a set of
4413 modifications to the System V.4 specifications. Selecting @code{-meabi}
4414 means that the stack is aligned to an 8 byte boundary, a function
4415 @code{__eabi} is called to from @code{main} to set up the eabi
4416 environment, and the @samp{-msdata} option can use both @code{r2} and
4417 @code{r13} to point to two separate small data areas. Selecting
4418 @code{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
4419 do not call an initialization function from @code{main}, and the
4420 @samp{-msdata} option will only use @code{r13} to point to a single
4421 small data area. The @samp{-meabi} option is on by default if you
4422 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
4423
4424 @item -msdata=eabi
4425 On System V.4 and embedded PowerPC systems, put small initialized
4426 @code{const} global and static data in the @samp{.sdata2} section, which
4427 is pointed to by register @code{r2}. Put small initialized
4428 non-@code{const} global and static data in the @samp{.sdata} section,
4429 which is pointed to by register @code{r13}. Put small uninitialized
4430 global and static data in the @samp{.sbss} section, which is adjacent to
4431 the @samp{.sdata} section. The @samp{-msdata=eabi} option is
4432 incompatible with the @samp{-mrelocatable} option. The
4433 @samp{-msdata=eabi} option also sets the @samp{-memb} option.
4434
4435 @item -msdata=sysv
4436 On System V.4 and embedded PowerPC systems, put small global and static
4437 data in the @samp{.sdata} section, which is pointed to by register
4438 @code{r13}. Put small uninitialized global and static data in the
4439 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
4440 The @samp{-msdata=sysv} option is incompatible with the
4441 @samp{-mrelocatable} option.
4442
4443 @item -msdata=default
4444 @itemx -msdata
4445 On System V.4 and embedded PowerPC systems, if @samp{-meabi} is used,
4446 compile code the same as @samp{-msdata=eabi}, otherwise compile code the
4447 same as @samp{-msdata=sysv}.
4448
4449 @item -msdata-data
4450 On System V.4 and embedded PowerPC systems, put small global and static
4451 data in the @samp{.sdata} section. Put small uninitialized global and
4452 static data in the @samp{.sbss} section. Do not use register @code{r13}
4453 to address small data however. This is the default behavior unless
4454 other @samp{-msdata} options are used.
4455
4456 @item -msdata=none
4457 @itemx -mno-sdata
4458 On embedded PowerPC systems, put all initialized global and static data
4459 in the @samp{.data} section, and all uninitialized data in the
4460 @samp{.bss} section.
4461
4462 @item -G @var{num}
4463 @cindex smaller data references (PowerPC)
4464 @cindex .sdata/.sdata2 references (PowerPC)
4465 On embedded PowerPC systems, put global and static items less than or
4466 equal to @var{num} bytes into the small data or bss sections instead of
4467 the normal data or bss section. By default, @var{num} is 8. The
4468 @samp{-G @var{num}} switch is also passed to the linker.
4469 All modules should be compiled with the same @samp{-G @var{num}} value.
4470
4471 @item -mregnames
4472 @itemx -mno-regnames
4473 On System V.4 and embedded PowerPC systems do (do not) emit register
4474 names in the assembly language output using symbolic forms.
4475 @end table
4476 @node RT Options
4477 @subsection IBM RT Options
4478 @cindex RT options
4479 @cindex IBM RT options
4480
4481 These @samp{-m} options are defined for the IBM RT PC:
4482
4483 @table @code
4484 @item -min-line-mul
4485 Use an in-line code sequence for integer multiplies. This is the
4486 default.
4487
4488 @item -mcall-lib-mul
4489 Call @code{lmul$$} for integer multiples.
4490
4491 @item -mfull-fp-blocks
4492 Generate full-size floating point data blocks, including the minimum
4493 amount of scratch space recommended by IBM. This is the default.
4494
4495 @item -mminimum-fp-blocks
4496 Do not include extra scratch space in floating point data blocks. This
4497 results in smaller code, but slower execution, since scratch space must
4498 be allocated dynamically.
4499
4500 @cindex @file{varargs.h} and RT PC
4501 @cindex @file{stdarg.h} and RT PC
4502 @item -mfp-arg-in-fpregs
4503 Use a calling sequence incompatible with the IBM calling convention in
4504 which floating point arguments are passed in floating point registers.
4505 Note that @code{varargs.h} and @code{stdargs.h} will not work with
4506 floating point operands if this option is specified.
4507
4508 @item -mfp-arg-in-gregs
4509 Use the normal calling convention for floating point arguments. This is
4510 the default.
4511
4512 @item -mhc-struct-return
4513 Return structures of more than one word in memory, rather than in a
4514 register. This provides compatibility with the MetaWare HighC (hc)
4515 compiler. Use the option @samp{-fpcc-struct-return} for compatibility
4516 with the Portable C Compiler (pcc).
4517
4518 @item -mnohc-struct-return
4519 Return some structures of more than one word in registers, when
4520 convenient. This is the default. For compatibility with the
4521 IBM-supplied compilers, use the option @samp{-fpcc-struct-return} or the
4522 option @samp{-mhc-struct-return}.
4523 @end table
4524
4525 @node MIPS Options
4526 @subsection MIPS Options
4527 @cindex MIPS options
4528
4529 These @samp{-m} options are defined for the MIPS family of computers:
4530
4531 @table @code
4532 @item -mcpu=@var{cpu type}
4533 Assume the defaults for the machine type @var{cpu type} when scheduling
4534 instructions. The choices for @var{cpu type} are @samp{r2000}, @samp{r3000},
4535 @samp{r4000}, @samp{r4400}, @samp{r4600}, and @samp{r6000}. While picking a
4536 specific @var{cpu type} will schedule things appropriately for that
4537 particular chip, the compiler will not generate any code that does not
4538 meet level 1 of the MIPS ISA (instruction set architecture) without
4539 the @samp{-mips2} or @samp{-mips3} switches being used.
4540
4541 @item -mips1
4542 Issue instructions from level 1 of the MIPS ISA. This is the default.
4543 @samp{r3000} is the default @var{cpu type} at this ISA level.
4544
4545 @item -mips2
4546 Issue instructions from level 2 of the MIPS ISA (branch likely, square
4547 root instructions). @samp{r6000} is the default @var{cpu type} at this
4548 ISA level.
4549
4550 @item -mips3
4551 Issue instructions from level 3 of the MIPS ISA (64 bit instructions).
4552 @samp{r4000} is the default @var{cpu type} at this ISA level.
4553 This option does not change the sizes of any of the C data types.
4554
4555 @item -mfp32
4556 Assume that 32 32-bit floating point registers are available. This is
4557 the default.
4558
4559 @item -mfp64
4560 Assume that 32 64-bit floating point registers are available. This is
4561 the default when the @samp{-mips3} option is used.
4562
4563 @item -mgp32
4564 Assume that 32 32-bit general purpose registers are available. This is
4565 the default.
4566
4567 @item -mgp64
4568 Assume that 32 64-bit general purpose registers are available. This is
4569 the default when the @samp{-mips3} option is used.
4570
4571 @item -mint64
4572 Types long, int, and pointer are 64 bits. This works only if @samp{-mips3}
4573 is also specified.
4574
4575 @item -mlong64
4576 Types long and pointer are 64 bits, and type int is 32 bits.
4577 This works only if @samp{-mips3} is also specified.
4578
4579 @item -mmips-as
4580 Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
4581 add normal debug information. This is the default for all
4582 platforms except for the OSF/1 reference platform, using the OSF/rose
4583 object format. If the either of the @samp{-gstabs} or @samp{-gstabs+}
4584 switches are used, the @file{mips-tfile} program will encapsulate the
4585 stabs within MIPS ECOFF.
4586
4587 @item -mgas
4588 Generate code for the GNU assembler. This is the default on the OSF/1
4589 reference platform, using the OSF/rose object format. Also, this is
4590 the default if the configure option @samp{--with-gnu-as} is used.
4591
4592 @item -msplit-addresses
4593 @itemx -mno-split-addresses
4594 Generate code to load the high and low parts of address constants separately.
4595 This allows @code{gcc} to optimize away redundant loads of the high order
4596 bits of addresses. This optimization requires GNU as and GNU ld.
4597 This optimization is enabled by default for some embedded targets where
4598 GNU as and GNU ld are standard.
4599
4600 @item -mrnames
4601 @itemx -mno-rnames
4602 The @samp{-mrnames} switch says to output code using the MIPS software
4603 names for the registers, instead of the hardware names (ie, @var{a0}
4604 instead of @var{$4}). The only known assembler that supports this option
4605 is the Algorithmics assembler.
4606
4607 @item -mgpopt
4608 @itemx -mno-gpopt
4609 The @samp{-mgpopt} switch says to write all of the data declarations
4610 before the instructions in the text section, this allows the MIPS
4611 assembler to generate one word memory references instead of using two
4612 words for short global or static data items. This is on by default if
4613 optimization is selected.
4614
4615 @item -mstats
4616 @itemx -mno-stats
4617 For each non-inline function processed, the @samp{-mstats} switch
4618 causes the compiler to emit one line to the standard error file to
4619 print statistics about the program (number of registers saved, stack
4620 size, etc.).
4621
4622 @item -mmemcpy
4623 @itemx -mno-memcpy
4624 The @samp{-mmemcpy} switch makes all block moves call the appropriate
4625 string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
4626 generating inline code.
4627
4628 @item -mmips-tfile
4629 @itemx -mno-mips-tfile
4630 The @samp{-mno-mips-tfile} switch causes the compiler not
4631 postprocess the object file with the @file{mips-tfile} program,
4632 after the MIPS assembler has generated it to add debug support. If
4633 @file{mips-tfile} is not run, then no local variables will be
4634 available to the debugger. In addition, @file{stage2} and
4635 @file{stage3} objects will have the temporary file names passed to the
4636 assembler embedded in the object file, which means the objects will
4637 not compare the same. The @samp{-mno-mips-tfile} switch should only
4638 be used when there are bugs in the @file{mips-tfile} program that
4639 prevents compilation.
4640
4641 @item -msoft-float
4642 Generate output containing library calls for floating point.
4643 @strong{Warning:} the requisite libraries are not part of GNU CC.
4644 Normally the facilities of the machine's usual C compiler are used, but
4645 this can't be done directly in cross-compilation. You must make your
4646 own arrangements to provide suitable library functions for
4647 cross-compilation.
4648
4649 @item -mhard-float
4650 Generate output containing floating point instructions. This is the
4651 default if you use the unmodified sources.
4652
4653 @item -mabicalls
4654 @itemx -mno-abicalls
4655 Emit (or do not emit) the pseudo operations @samp{.abicalls},
4656 @samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
4657 position independent code.
4658
4659 @item -mlong-calls
4660 @itemx -mno-long-calls
4661 Do all calls with the @samp{JALR} instruction, which requires
4662 loading up a function's address into a register before the call.
4663 You need to use this switch, if you call outside of the current
4664 512 megabyte segment to functions that are not through pointers.
4665
4666 @item -mhalf-pic
4667 @itemx -mno-half-pic
4668 Put pointers to extern references into the data section and load them
4669 up, rather than put the references in the text section.
4670
4671 @item -membedded-pic
4672 @itemx -mno-embedded-pic
4673 Generate PIC code suitable for some embedded systems. All calls are made
4674 using PC relative address, and all data is addressed using the $gp register.
4675 This requires GNU as and GNU ld which do most of the work.
4676
4677 @item -membedded-data
4678 @itemx -mno-embedded-data
4679 Allocate variables to the read-only data section first if possible, then
4680 next in the small data section if possible, otherwise in data. This gives
4681 slightly slower code than the default, but reduces the amount of RAM required
4682 when executing, and thus may be preferred for some embedded systems.
4683
4684 @item -msingle-float
4685 @itemx -mdouble-float
4686 The @samp{-msingle-float} switch tells gcc to assume that the floating
4687 point coprocessor only supports single precision operations, as on the
4688 @samp{r4650} chip. The @samp{-mdouble-float} switch permits gcc to use
4689 double precision operations. This is the default.
4690
4691 @item -mmad
4692 @itemx -mno-mad
4693 Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
4694 as on the @samp{r4650} chip.
4695
4696 @item -m4650
4697 Turns on @samp{-msingle-float}, @samp{-mmad}, and, at least for now,
4698 @samp{-mcpu=r4650}.
4699
4700 @item -EL
4701 Compile code for the processor in little endian mode.
4702 The requisite libraries are assumed to exist.
4703
4704 @item -EB
4705 Compile code for the processor in big endian mode.
4706 The requisite libraries are assumed to exist.
4707
4708 @item -G @var{num}
4709 @cindex smaller data references (MIPS)
4710 @cindex gp-relative references (MIPS)
4711 Put global and static items less than or equal to @var{num} bytes into
4712 the small data or bss sections instead of the normal data or bss
4713 section. This allows the assembler to emit one word memory reference
4714 instructions based on the global pointer (@var{gp} or @var{$28}),
4715 instead of the normal two words used. By default, @var{num} is 8 when
4716 the MIPS assembler is used, and 0 when the GNU assembler is used. The
4717 @samp{-G @var{num}} switch is also passed to the assembler and linker.
4718 All modules should be compiled with the same @samp{-G @var{num}}
4719 value.
4720
4721 @item -nocpp
4722 Tell the MIPS assembler to not run it's preprocessor over user
4723 assembler files (with a @samp{.s} suffix) when assembling them.
4724 @end table
4725
4726 @ifset INTERNALS
4727 These options are defined by the macro
4728 @code{TARGET_SWITCHES} in the machine description. The default for the
4729 options is also defined by that macro, which enables you to change the
4730 defaults.
4731 @end ifset
4732
4733 @node i386 Options
4734 @subsection Intel 386 Options
4735 @cindex i386 Options
4736 @cindex Intel 386 Options
4737
4738 These @samp{-m} options are defined for the i386 family of computers:
4739
4740 @table @code
4741 @item -mcpu=@var{cpu type}
4742 Assume the defaults for the machine type @var{cpu type} when scheduling
4743 instructions. The choices for @var{cpu type} are: @samp{i386},
4744 @samp{i486}, @samp{i586} (@samp{pentium}), @samp{pentium}, @samp{i686}
4745 (@samp{pentiumpro}) and @samp{pentiumpro}. While picking a specific
4746 @var{cpu type} will schedule things appropriately for that particular
4747 chip, the compiler will not generate any code that does not run on the
4748 i386 without the @samp{-march=@var{cpu type}} option being used.
4749
4750 @item -march=@var{cpu type}
4751 Generate instructions for the machine type @var{cpu type}. The choices
4752 for @var{cpu type} are: @samp{i386}, @samp{i486}, @samp{pentium}, and
4753 @samp{pentiumpro}. Specifying @samp{-march=@var{cpu type}} implies
4754 @samp{-mcpu=@var{cpu type}}.
4755
4756 @item -m386
4757 @itemx -m486
4758 @itemx -mpentium
4759 @itemx -mpentiumpro
4760 Synonyms for -mcpu=i386, -mcpu=i486, -mcpu=pentium, and -mcpu=pentiumpro
4761 respectively.
4762
4763 @item -mieee-fp
4764 @itemx -mno-ieee-fp
4765 Control whether or not the compiler uses IEEE floating point
4766 comparisons. These handle correctly the case where the result of a
4767 comparison is unordered.
4768
4769 @item -msoft-float
4770 Generate output containing library calls for floating point.
4771 @strong{Warning:} the requisite libraries are not part of GNU CC.
4772 Normally the facilities of the machine's usual C compiler are used, but
4773 this can't be done directly in cross-compilation. You must make your
4774 own arrangements to provide suitable library functions for
4775 cross-compilation.
4776
4777 On machines where a function returns floating point results in the 80387
4778 register stack, some floating point opcodes may be emitted even if
4779 @samp{-msoft-float} is used.
4780
4781 @item -mno-fp-ret-in-387
4782 Do not use the FPU registers for return values of functions.
4783
4784 The usual calling convention has functions return values of types
4785 @code{float} and @code{double} in an FPU register, even if there
4786 is no FPU. The idea is that the operating system should emulate
4787 an FPU.
4788
4789 The option @samp{-mno-fp-ret-in-387} causes such values to be returned
4790 in ordinary CPU registers instead.
4791
4792 @item -mno-fancy-math-387
4793 Some 387 emulators do not support the @code{sin}, @code{cos} and
4794 @code{sqrt} instructions for the 387. Specify this option to avoid
4795 generating those instructions. This option is the default on FreeBSD.
4796 As of revision 2.6.1, these instructions are not generated unless you
4797 also use the @samp{-ffast-math} switch.
4798
4799 @item -malign-double
4800 @itemx -mno-align-double
4801 Control whether GNU CC aligns @code{double}, @code{long double}, and
4802 @code{long long} variables on a two word boundary or a one word
4803 boundary. Aligning @code{double} variables on a two word boundary will
4804 produce code that runs somewhat faster on a @samp{Pentium} at the
4805 expense of more memory.
4806
4807 @strong{Warning:} if you use the @samp{-malign-double} switch,
4808 structures containing the above types will be aligned differently than
4809 the published application binary interface specifications for the 386.
4810
4811 @item -msvr3-shlib
4812 @itemx -mno-svr3-shlib
4813 Control whether GNU CC places uninitialized locals into @code{bss} or
4814 @code{data}. @samp{-msvr3-shlib} places these locals into @code{bss}.
4815 These options are meaningful only on System V Release 3.
4816
4817 @item -mno-wide-multiply
4818 @itemx -mwide-multiply
4819 Control whether GNU CC uses the @code{mul} and @code{imul} that produce
4820 64 bit results in @code{eax:edx} from 32 bit operands to do @code{long
4821 long} multiplies and 32-bit division by constants.
4822
4823 @item -mrtd
4824 Use a different function-calling convention, in which functions that
4825 take a fixed number of arguments return with the @code{ret} @var{num}
4826 instruction, which pops their arguments while returning. This saves one
4827 instruction in the caller since there is no need to pop the arguments
4828 there.
4829
4830 You can specify that an individual function is called with this calling
4831 sequence with the function attribute @samp{stdcall}. You can also
4832 override the @samp{-mrtd} option by using the function attribute
4833 @samp{cdecl}. @xref{Function Attributes}
4834
4835 @strong{Warning:} this calling convention is incompatible with the one
4836 normally used on Unix, so you cannot use it if you need to call
4837 libraries compiled with the Unix compiler.
4838
4839 Also, you must provide function prototypes for all functions that
4840 take variable numbers of arguments (including @code{printf});
4841 otherwise incorrect code will be generated for calls to those
4842 functions.
4843
4844 In addition, seriously incorrect code will result if you call a
4845 function with too many arguments. (Normally, extra arguments are
4846 harmlessly ignored.)
4847
4848 @item -mreg-alloc=@var{regs}
4849 Control the default allocation order of integer registers. The
4850 string @var{regs} is a series of letters specifying a register. The
4851 supported letters are: @code{a} allocate EAX; @code{b} allocate EBX;
4852 @code{c} allocate ECX; @code{d} allocate EDX; @code{S} allocate ESI;
4853 @code{D} allocate EDI; @code{B} allocate EBP.
4854
4855 @item -mregparm=@var{num}
4856 Control how many registers are used to pass integer arguments. By
4857 default, no registers are used to pass arguments, and at most 3
4858 registers can be used. You can control this behavior for a specific
4859 function by using the function attribute @samp{regparm}. @xref{Function Attributes}
4860
4861 @strong{Warning:} if you use this switch, and
4862 @var{num} is nonzero, then you must build all modules with the same
4863 value, including any libraries. This includes the system libraries and
4864 startup modules.
4865
4866 @item -malign-loops=@var{num}
4867 Align loops to a 2 raised to a @var{num} byte boundary. If
4868 @samp{-malign-loops} is not specified, the default is 2.
4869
4870 @item -malign-jumps=@var{num}
4871 Align instructions that are only jumped to to a 2 raised to a @var{num}
4872 byte boundary. If @samp{-malign-jumps} is not specified, the default is
4873 2 if optimizing for a 386, and 4 if optimizing for a 486.
4874
4875 @item -malign-functions=@var{num}
4876 Align the start of functions to a 2 raised to @var{num} byte boundary.
4877 If @samp{-malign-functions} is not specified, the default is 2 if optimizing
4878 for a 386, and 4 if optimizing for a 486.
4879 @end table
4880
4881 @node HPPA Options
4882 @subsection HPPA Options
4883 @cindex HPPA Options
4884
4885 These @samp{-m} options are defined for the HPPA family of computers:
4886
4887 @table @code
4888 @item -mpa-risc-1-0
4889 Generate code for a PA 1.0 processor.
4890
4891 @item -mpa-risc-1-1
4892 Generate code for a PA 1.1 processor.
4893
4894 @item -mbig-switch
4895 Generate code suitable for big switch tables. Use this option only if
4896 the assembler/linker complain about out of range branches within a switch
4897 table.
4898
4899 @item -mjump-in-delay
4900 Fill delay slots of function calls with unconditional jump instructions
4901 by modifying the return pointer for the function call to be the target
4902 of the conditional jump.
4903
4904 @item -mdisable-fpregs
4905 Prevent floating point registers from being used in any manner. This is
4906 necessary for compiling kernels which perform lazy context switching of
4907 floating point registers. If you use this option and attempt to perform
4908 floating point operations, the compiler will abort.
4909
4910 @item -mdisable-indexing
4911 Prevent the compiler from using indexing address modes. This avoids some
4912 rather obscure problems when compiling MIG generated code under MACH.
4913
4914 @item -mno-space-regs
4915 Generate code that assumes the target has no space registers. This allows
4916 GCC to generate faster indirect calls and use unscaled index address modes.
4917
4918 Such code is suitable for level 0 PA systems and kernels.
4919
4920 @item -mfast-indirect-calls
4921 Generate code that assumes calls never cross space boundaries. This
4922 allows GCC to emit code which performs faster indirect calls.
4923
4924 This option will not work in the presense of shared libraries or nested
4925 functions.
4926
4927 @item -mspace
4928 Optimize for space rather than execution time. Currently this only
4929 enables out of line function prologues and epilogues. This option is
4930 incompatible with PIC code generation and profiling.
4931
4932 @item -mlong-load-store
4933 Generate 3-instruction load and store sequences as sometimes required by
4934 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
4935 the HP compilers.
4936
4937 @item -mportable-runtime
4938 Use the portable calling conventions proposed by HP for ELF systems.
4939
4940 @item -mgas
4941 Enable the use of assembler directives only GAS understands.
4942
4943 @item -mschedule=@var{cpu type}
4944 Schedule code according to the constraints for the machine type
4945 @var{cpu type}. The choices for @var{cpu type} are @samp{700} for
4946 7@var{n}0 machines, @samp{7100} for 7@var{n}5 machines, and @samp{7100LC}
4947 for 7@var{n}2 machines. @samp{7100} is the default for @var{cpu type}.
4948
4949 Note the @samp{7100LC} scheduling information is incomplete and using
4950 @samp{7100LC} often leads to bad schedules. For now it's probably best
4951 to use @samp{7100} instead of @samp{7100LC} for the 7@var{n}2 machines.
4952
4953 @item -mlinker-opt
4954 Enable the optimization pass in the HPUX linker. Note this makes symbolic
4955 debugging impossible. It also triggers a bug in the HPUX 8 and HPUX 9 linkers
4956 in which they give bogus error messages when linking some programs.
4957
4958 @item -msoft-float
4959 Generate output containing library calls for floating point.
4960 @strong{Warning:} the requisite libraries are not available for all HPPA
4961 targets. Normally the facilities of the machine's usual C compiler are
4962 used, but this cannot be done directly in cross-compilation. You must make
4963 your own arrangements to provide suitable library functions for
4964 cross-compilation. The embedded target @samp{hppa1.1-*-pro}
4965 does provide software floating point support.
4966
4967 @samp{-msoft-float} changes the calling convention in the output file;
4968 therefore, it is only useful if you compile @emph{all} of a program with
4969 this option. In particular, you need to compile @file{libgcc.a}, the
4970 library that comes with GNU CC, with @samp{-msoft-float} in order for
4971 this to work.
4972 @end table
4973
4974 @node Intel 960 Options
4975 @subsection Intel 960 Options
4976
4977 These @samp{-m} options are defined for the Intel 960 implementations:
4978
4979 @table @code
4980 @item -m@var{cpu type}
4981 Assume the defaults for the machine type @var{cpu type} for some of
4982 the other options, including instruction scheduling, floating point
4983 support, and addressing modes. The choices for @var{cpu type} are
4984 @samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
4985 @samp{sa}, and @samp{sb}.
4986 The default is
4987 @samp{kb}.
4988
4989 @item -mnumerics
4990 @itemx -msoft-float
4991 The @samp{-mnumerics} option indicates that the processor does support
4992 floating-point instructions. The @samp{-msoft-float} option indicates
4993 that floating-point support should not be assumed.
4994
4995 @item -mleaf-procedures
4996 @itemx -mno-leaf-procedures
4997 Do (or do not) attempt to alter leaf procedures to be callable with the
4998 @code{bal} instruction as well as @code{call}. This will result in more
4999 efficient code for explicit calls when the @code{bal} instruction can be
5000 substituted by the assembler or linker, but less efficient code in other
5001 cases, such as calls via function pointers, or using a linker that doesn't
5002 support this optimization.
5003
5004 @item -mtail-call
5005 @itemx -mno-tail-call
5006 Do (or do not) make additional attempts (beyond those of the
5007 machine-independent portions of the compiler) to optimize tail-recursive
5008 calls into branches. You may not want to do this because the detection of
5009 cases where this is not valid is not totally complete. The default is
5010 @samp{-mno-tail-call}.
5011
5012 @item -mcomplex-addr
5013 @itemx -mno-complex-addr
5014 Assume (or do not assume) that the use of a complex addressing mode is a
5015 win on this implementation of the i960. Complex addressing modes may not
5016 be worthwhile on the K-series, but they definitely are on the C-series.
5017 The default is currently @samp{-mcomplex-addr} for all processors except
5018 the CB and CC.
5019
5020 @item -mcode-align
5021 @itemx -mno-code-align
5022 Align code to 8-byte boundaries for faster fetching (or don't bother).
5023 Currently turned on by default for C-series implementations only.
5024
5025 @ignore
5026 @item -mclean-linkage
5027 @itemx -mno-clean-linkage
5028 These options are not fully implemented.
5029 @end ignore
5030
5031 @item -mic-compat
5032 @itemx -mic2.0-compat
5033 @itemx -mic3.0-compat
5034 Enable compatibility with iC960 v2.0 or v3.0.
5035
5036 @item -masm-compat
5037 @itemx -mintel-asm
5038 Enable compatibility with the iC960 assembler.
5039
5040 @item -mstrict-align
5041 @itemx -mno-strict-align
5042 Do not permit (do permit) unaligned accesses.
5043
5044 @item -mold-align
5045 Enable structure-alignment compatibility with Intel's gcc release version
5046 1.3 (based on gcc 1.37). This option implies @samp{-mstrict-align}.
5047 @end table
5048
5049 @node DEC Alpha Options
5050 @subsection DEC Alpha Options
5051
5052 These @samp{-m} options are defined for the DEC Alpha implementations:
5053
5054 @table @code
5055 @item -mno-soft-float
5056 @itemx -msoft-float
5057 Use (do not use) the hardware floating-point instructions for
5058 floating-point operations. When @code{-msoft-float} is specified,
5059 functions in @file{libgcc1.c} will be used to perform floating-point
5060 operations. Unless they are replaced by routines that emulate the
5061 floating-point operations, or compiled in such a way as to call such
5062 emulations routines, these routines will issue floating-point
5063 operations. If you are compiling for an Alpha without floating-point
5064 operations, you must ensure that the library is built so as not to call
5065 them.
5066
5067 Note that Alpha implementations without floating-point operations are
5068 required to have floating-point registers.
5069
5070 @item -mfp-reg
5071 @itemx -mno-fp-regs
5072 Generate code that uses (does not use) the floating-point register set.
5073 @code{-mno-fp-regs} implies @code{-msoft-float}. If the floating-point
5074 register set is not used, floating point operands are passed in integer
5075 registers as if they were integers and floating-point results are passed
5076 in $0 instead of $f0. This is a non-standard calling sequence, so any
5077 function with a floating-point argument or return value called by code
5078 compiled with @code{-mno-fp-regs} must also be compiled with that
5079 option.
5080
5081 A typical use of this option is building a kernel that does not use,
5082 and hence need not save and restore, any floating-point registers.
5083
5084 @item -mieee
5085 The Alpha architecture implements floating-point hardware optimized for
5086 maximum performance. It is mostly compliant with the IEEE floating
5087 point standard. However, for full compliance, software assistance is
5088 required. This option generates code fully IEEE compliant code
5089 @emph{except} that the @var{inexact flag} is not maintained (see below).
5090 If this option is turned on, the CPP macro @code{_IEEE_FP} is defined
5091 during compilation. The option is a shorthand for: @samp{-D_IEEE_FP
5092 -mfp-trap-mode=su -mtrap-precision=i -mieee-conformant}. The resulting
5093 code is less efficient but is able to correctly support denormalized
5094 numbers and exceptional IEEE values such as not-a-number and plus/minus
5095 infinity. Other Alpha compilers call this option
5096 @code{-ieee_with_no_inexact}.
5097
5098 @item -mieee-with-inexact
5099 @c overfull hbox here --bob 22 jul96
5100 @c original text between ignore ... end ignore
5101 @ignore
5102 This is like @samp{-mieee} except the generated code also maintains the
5103 IEEE @var{inexact flag}. Turning on this option causes the generated
5104 code to implement fully-compliant IEEE math. The option is a shorthand
5105 for @samp{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus @samp{-mieee-conformant},
5106 @samp{-mfp-trap-mode=sui}, and @samp{-mtrap-precision=i}. On some Alpha
5107 implementations the resulting code may execute significantly slower than
5108 the code generated by default. Since there is very little code that
5109 depends on the @var{inexact flag}, you should normally not specify this
5110 option. Other Alpha compilers call this option
5111 @samp{-ieee_with_inexact}.
5112 @end ignore
5113 @c changed paragraph
5114 This is like @samp{-mieee} except the generated code also maintains the
5115 IEEE @var{inexact flag}. Turning on this option causes the generated
5116 code to implement fully-compliant IEEE math. The option is a shorthand
5117 for @samp{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus the three following:
5118 @samp{-mieee-conformant},
5119 @samp{-mfp-trap-mode=sui},
5120 and @samp{-mtrap-precision=i}.
5121 On some Alpha implementations the resulting code may execute
5122 significantly slower than the code generated by default. Since there
5123 is very little code that depends on the @var{inexact flag}, you should
5124 normally not specify this option. Other Alpha compilers call this
5125 option @samp{-ieee_with_inexact}.
5126 @c end changes to prevent overfull hboxes
5127
5128 @item -mfp-trap-mode=@var{trap mode}
5129 This option controls what floating-point related traps are enabled.
5130 Other Alpha compilers call this option @samp{-fptm }@var{trap mode}.
5131 The trap mode can be set to one of four values:
5132
5133 @table @samp
5134 @item n
5135 This is the default (normal) setting. The only traps that are enabled
5136 are the ones that cannot be disabled in software (e.g., division by zero
5137 trap).
5138
5139 @item u
5140 In addition to the traps enabled by @samp{n}, underflow traps are enabled
5141 as well.
5142
5143 @item su
5144 Like @samp{su}, but the instructions are marked to be safe for software
5145 completion (see Alpha architecture manual for details).
5146
5147 @item sui
5148 Like @samp{su}, but inexact traps are enabled as well.
5149 @end table
5150
5151 @item -mfp-rounding-mode=@var{rounding mode}
5152 Selects the IEEE rounding mode. Other Alpha compilers call this option
5153 @samp{-fprm }@var{rounding mode}. The @var{rounding mode} can be one
5154 of:
5155
5156 @table @samp
5157 @item n
5158 Normal IEEE rounding mode. Floating point numbers are rounded towards
5159 the nearest machine number or towards the even machine number in case
5160 of a tie.
5161
5162 @item m
5163 Round towards minus infinity.
5164
5165 @item c
5166 Chopped rounding mode. Floating point numbers are rounded towards zero.
5167
5168 @item d
5169 Dynamic rounding mode. A field in the floating point control register
5170 (@var{fpcr}, see Alpha architecture reference manual) controls the
5171 rounding mode in effect. The C library initializes this register for
5172 rounding towards plus infinity. Thus, unless your program modifies the
5173 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.@end table
5174
5175 @item -mtrap-precision=@var{trap precision}
5176 In the Alpha architecture, floating point traps are imprecise. This
5177 means without software assistance it is impossible to recover from a
5178 floating trap and program execution normally needs to be terminated.
5179 GNU CC can generate code that can assist operating system trap handlers
5180 in determining the exact location that caused a floating point trap.
5181 Depending on the requirements of an application, different levels of
5182 precisions can be selected:
5183
5184 @table @samp
5185 @item p
5186 Program precision. This option is the default and means a trap handler
5187 can only identify which program caused a floating point exception.
5188
5189 @item f
5190 Function precision. The trap handler can determine the function that
5191 caused a floating point exception.
5192
5193 @item i
5194 Instruction precision. The trap handler can determine the exact
5195 instruction that caused a floating point exception.
5196 @end table
5197
5198 Other Alpha compilers provide the equivalent options called
5199 @samp{-scope_safe} and @samp{-resumption_safe}.
5200
5201 @item -mieee-conformant
5202 This option marks the generated code as IEEE conformant. You must not
5203 use this option unless you also specify @samp{-mtrap-precision=i} and either
5204 @samp{-mfp-trap-mode=su} or @samp{-mfp-trap-mode=sui}. Its only effect
5205 is to emit the line @samp{.eflag 48} in the function prologue of the
5206 generated assembly file. Under DEC Unix, this has the effect that
5207 IEEE-conformant math library routines will be linked in.
5208
5209 @item -mbuild-constants
5210 Normally GNU CC examines a 32- or 64-bit integer constant to
5211 see if it can construct it from smaller constants in two or three
5212 instructions. If it cannot, it will output the constant as a literal and
5213 generate code to load it from the data segment at runtime.
5214
5215 Use this option to require GNU CC to construct @emph{all} integer constants
5216 using code, even if it takes more instructions (the maximum is six).
5217
5218 You would typically use this option to build a shared library dynamic
5219 loader. Itself a shared library, it must relocate itself in memory
5220 before it can find the variables and constants in its own data segment.
5221
5222 @item -malpha-as
5223 @itemx -mgas
5224 Select whether to generate code to be assembled by the vendor-supplied
5225 assembler (@samp{-malpha-as}) or by the GNU assembler @samp{-mgas}.
5226
5227 @item -mbwx
5228 @itemx -mno-bwx
5229 @itemx -mcix
5230 @itemx -mno-cix
5231 @itemx -mmax
5232 @itemx -mno-max
5233 Indicate whether GNU CC should generate code to use the optional BWX,
5234 CIX, and MAX instruction sets. The default is to use the instruction sets
5235 supported by the CPU type specified via @samp{-mcpu=} option or that
5236 of the CPU on which GNU CC was built if none was specified.
5237
5238 @item -mcpu=@var{cpu_type}
5239 Set the instruction set, register set, and instruction scheduling
5240 parameters for machine type @var{cpu_type}. You can specify either the
5241 @samp{EV} style name or the corresponding chip number. GNU CC
5242 supports scheduling parameters for the EV4 and EV5 family of processors
5243 and will choose the default values for the instruction set from
5244 the processor you specify. If you do not specify a processor type,
5245 GNU CC will default to the processor on which the compiler was built.
5246
5247 Supported values for @var{cpu_type} are
5248
5249 @table @samp
5250 @item ev4
5251 @itemx 21064
5252 Schedules as an EV4 and has no instruction set extensions.
5253
5254 @item ev5
5255 @itemx 21164
5256 Schedules as an EV5 and has no instruction set extensions.
5257
5258 @item ev56
5259 @itemx 21164a
5260 Schedules as an EV5 and supports the BWX extension.
5261
5262 @item pca56
5263 @itemx 21164pc
5264 @itemx 21164PC
5265 Schedules as an EV5 and supports the BWX and MAX extensions.
5266
5267 @item ev6
5268 @itemx 21264
5269 Schedules as an EV5 (until Digital releases the scheduling parameters
5270 for the EV6) and supports the BWX, CIX, and MAX extensions.
5271 @end table
5272
5273 @item -mmemory-latency=@var{time}
5274 Sets the latency the scheduler should assume for typical memory
5275 references as seen by the application. This number is highly
5276 dependant on the memory access patterns used by the application
5277 and the size of the external cache on the machine.
5278
5279 Valid options for @var{time} are
5280
5281 @table @samp
5282 @item @var{number}
5283 A decimal number representing clock cycles.
5284
5285 @item L1
5286 @itemx L2
5287 @itemx L3
5288 @itemx main
5289 The compiler contains estimates of the number of clock cycles for
5290 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
5291 (also called Dcache, Scache, and Bcache), as well as to main memory.
5292 Note that L3 is only valid for EV5.
5293
5294 @end table
5295 @end table
5296
5297 @node Clipper Options
5298 @subsection Clipper Options
5299
5300 These @samp{-m} options are defined for the Clipper implementations:
5301
5302 @table @code
5303 @item -mc300
5304 Produce code for a C300 Clipper processor. This is the default.
5305
5306 @itemx -mc400
5307 Produce code for a C400 Clipper processor i.e. use floating point
5308 registers f8..f15.
5309 @end table
5310
5311 @node H8/300 Options
5312 @subsection H8/300 Options
5313
5314 These @samp{-m} options are defined for the H8/300 implementations:
5315
5316 @table @code
5317 @item -mrelax
5318 Shorten some address references at link time, when possible; uses the
5319 linker option @samp{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
5320 ld.info, Using ld}, for a fuller description.
5321
5322 @item -mh
5323 Generate code for the H8/300H.
5324
5325 @item -ms
5326 Generate code for the H8/S.
5327
5328 @item -mint32
5329 Make @code{int} data 32 bits by default.
5330
5331 @item -malign-300
5332 On the h8/300h, use the same alignment rules as for the h8/300.
5333 The default for the h8/300h is to align longs and floats on 4 byte boundaries.
5334 @samp{-malign-300} causes them to be aligned on 2 byte boundaries.
5335 This option has no effect on the h8/300.
5336 @end table
5337
5338 @node SH Options
5339 @subsection SH Options
5340
5341 These @samp{-m} options are defined for the SH implementations:
5342
5343 @table @code
5344 @item -m1
5345 Generate code for the SH1.
5346
5347 @item -m2
5348 Generate code for the SH2.
5349
5350 @item -m3
5351 Generate code for the SH3.
5352
5353 @item -m3e
5354 Generate code for the SH3e.
5355
5356 @item -mb
5357 Compile code for the processor in big endian mode.
5358
5359 @item -ml
5360 Compile code for the processor in little endian mode.
5361
5362 @item -mrelax
5363 Shorten some address references at link time, when possible; uses the
5364 linker option @samp{-relax}.
5365 @end table
5366
5367 @node System V Options
5368 @subsection Options for System V
5369
5370 These additional options are available on System V Release 4 for
5371 compatibility with other compilers on those systems:
5372
5373 @table @code
5374 @item -G
5375 Create a shared object.
5376 It is recommended that @samp{-symbolic} or @samp{-shared} be used instead.
5377
5378 @item -Qy
5379 Identify the versions of each tool used by the compiler, in a
5380 @code{.ident} assembler directive in the output.
5381
5382 @item -Qn
5383 Refrain from adding @code{.ident} directives to the output file (this is
5384 the default).
5385
5386 @item -YP,@var{dirs}
5387 Search the directories @var{dirs}, and no others, for libraries
5388 specified with @samp{-l}.
5389
5390 @item -Ym,@var{dir}
5391 Look in the directory @var{dir} to find the M4 preprocessor.
5392 The assembler uses this option.
5393 @c This is supposed to go with a -Yd for predefined M4 macro files, but
5394 @c the generic assembler that comes with Solaris takes just -Ym.
5395 @end table
5396
5397 @node V850 Options
5398 @subsection V850 Options
5399 @cindex V850 Options
5400
5401 These @samp{-m} options are defined for V850 implementations:
5402
5403 @table @code
5404 @item -mlong-calls
5405 @itemx -mno-long-calls
5406 Treat all calls as being far away (near). If calls are assumed to be
5407 far away, the compiler will always load the functions address up into a
5408 register, and call indirect through the pointer.
5409
5410 @item -mno-ep
5411 @itemx -mep
5412 Do not optimize (do optimize) basic blocks that use the same index
5413 pointer 4 or more times to copy pointer into the @code{ep} register, and
5414 use the shorter @code{sld} and @code{sst} instructions. The @samp{-mep}
5415 option is on by default if you optimize.
5416
5417 @item -mno-prolog-function
5418 @itemx -mprolog-function
5419 Do not use (do use) external functions to save and restore registers at
5420 the prolog and epilog of a function. The external functions are slower,
5421 but use less code space if more than one function saves the same number
5422 of registers. The @samp{-mprolog-function} option is on by default if
5423 you optimize.
5424
5425 @item -mspace
5426 Try to make the code as small as possible. At present, this just turns
5427 on the @samp{-mep} and @samp{-mprolog-function} options.
5428
5429 @item -mtda=@var{n}
5430 Put static or global variables whose size is @var{n} bytes or less into
5431 the tiny data area that register @code{ep} points to. The tiny data
5432 area can hold up to 256 bytes in total (128 bytes for byte references).
5433
5434 @item -msda=@var{n}
5435 Put static or global variables whose size is @var{n} bytes or less into
5436 the small data area that register @code{gp} points to. The small data
5437 area can hold up to 64 kilobytes.
5438
5439 @item -mzda=@var{n}
5440 Put static or global variables whose size is @var{n} bytes or less into
5441 the first 32 kilobytes of memory.
5442
5443 @item -mv850
5444 Specify that the target processor is the V850.
5445
5446 @item -mbig-switch
5447 Generate code suitable for big switch tables. Use this option only if
5448 the assembler/linker complain about out of range branches within a switch
5449 table.
5450 @end table
5451
5452 @node Code Gen Options
5453 @section Options for Code Generation Conventions
5454 @cindex code generation conventions
5455 @cindex options, code generation
5456 @cindex run-time options
5457
5458 These machine-independent options control the interface conventions
5459 used in code generation.
5460
5461 Most of them have both positive and negative forms; the negative form
5462 of @samp{-ffoo} would be @samp{-fno-foo}. In the table below, only
5463 one of the forms is listed---the one which is not the default. You
5464 can figure out the other form by either removing @samp{no-} or adding
5465 it.
5466
5467 @table @code
5468 @item -fexceptions
5469 Enable exception handling, and generate extra code needed to propagate
5470 exceptions. If you do not specify this option, GNU CC enables it by
5471 default for languages like C++ that normally require exception handling,
5472 and disabled for languages like C that do not normally require it.
5473 However, when compiling C code that needs to interoperate properly with
5474 exception handlers written in C++, you may need to enable this option.
5475 You may also wish to disable this option is you are compiling older C++
5476 programs that don't use exception handling.
5477
5478 @item -fpcc-struct-return
5479 Return ``short'' @code{struct} and @code{union} values in memory like
5480 longer ones, rather than in registers. This convention is less
5481 efficient, but it has the advantage of allowing intercallability between
5482 GNU CC-compiled files and files compiled with other compilers.
5483
5484 The precise convention for returning structures in memory depends
5485 on the target configuration macros.
5486
5487 Short structures and unions are those whose size and alignment match
5488 that of some integer type.
5489
5490 @item -freg-struct-return
5491 Use the convention that @code{struct} and @code{union} values are
5492 returned in registers when possible. This is more efficient for small
5493 structures than @samp{-fpcc-struct-return}.
5494
5495 If you specify neither @samp{-fpcc-struct-return} nor its contrary
5496 @samp{-freg-struct-return}, GNU CC defaults to whichever convention is
5497 standard for the target. If there is no standard convention, GNU CC
5498 defaults to @samp{-fpcc-struct-return}, except on targets where GNU CC
5499 is the principal compiler. In those cases, we can choose the standard,
5500 and we chose the more efficient register return alternative.
5501
5502 @item -fshort-enums
5503 Allocate to an @code{enum} type only as many bytes as it needs for the
5504 declared range of possible values. Specifically, the @code{enum} type
5505 will be equivalent to the smallest integer type which has enough room.
5506
5507 @item -fshort-double
5508 Use the same size for @code{double} as for @code{float}.
5509
5510 @item -fshared-data
5511 Requests that the data and non-@code{const} variables of this
5512 compilation be shared data rather than private data. The distinction
5513 makes sense only on certain operating systems, where shared data is
5514 shared between processes running the same program, while private data
5515 exists in one copy per process.
5516
5517 @item -fno-common
5518 Allocate even uninitialized global variables in the bss section of the
5519 object file, rather than generating them as common blocks. This has the
5520 effect that if the same variable is declared (without @code{extern}) in
5521 two different compilations, you will get an error when you link them.
5522 The only reason this might be useful is if you wish to verify that the
5523 program will work on other systems which always work this way.
5524
5525 @item -fno-ident
5526 Ignore the @samp{#ident} directive.
5527
5528 @item -fno-gnu-linker
5529 Do not output global initializations (such as C++ constructors and
5530 destructors) in the form used by the GNU linker (on systems where the GNU
5531 linker is the standard method of handling them). Use this option when
5532 you want to use a non-GNU linker, which also requires using the
5533 @code{collect2} program to make sure the system linker includes
5534 constructors and destructors. (@code{collect2} is included in the GNU CC
5535 distribution.) For systems which @emph{must} use @code{collect2}, the
5536 compiler driver @code{gcc} is configured to do this automatically.
5537
5538 @item -finhibit-size-directive
5539 Don't output a @code{.size} assembler directive, or anything else that
5540 would cause trouble if the function is split in the middle, and the
5541 two halves are placed at locations far apart in memory. This option is
5542 used when compiling @file{crtstuff.c}; you should not need to use it
5543 for anything else.
5544
5545 @item -fverbose-asm
5546 Put extra commentary information in the generated assembly code to
5547 make it more readable. This option is generally only of use to those
5548 who actually need to read the generated assembly code (perhaps while
5549 debugging the compiler itself).
5550
5551 @samp{-fno-verbose-asm}, the default, causes the
5552 extra information to be omitted and is useful when comparing two assembler
5553 files.
5554
5555 @item -fvolatile
5556 Consider all memory references through pointers to be volatile.
5557
5558 @item -fvolatile-global
5559 Consider all memory references to extern and global data items to
5560 be volatile.
5561
5562 @item -fpic
5563 @cindex global offset table
5564 @cindex PIC
5565 Generate position-independent code (PIC) suitable for use in a shared
5566 library, if supported for the target machine. Such code accesses all
5567 constant addresses through a global offset table (GOT). The dynamic
5568 loader resolves the GOT entries when the program starts (the dynamic
5569 loader is not part of GNU CC; it is part of the operating system). If
5570 the GOT size for the linked executable exceeds a machine-specific
5571 maximum size, you get an error message from the linker indicating that
5572 @samp{-fpic} does not work; in that case, recompile with @samp{-fPIC}
5573 instead. (These maximums are 16k on the m88k, 8k on the Sparc, and 32k
5574 on the m68k and RS/6000. The 386 has no such limit.)
5575
5576 Position-independent code requires special support, and therefore works
5577 only on certain machines. For the 386, GNU CC supports PIC for System V
5578 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
5579 position-independent.
5580
5581 @item -fPIC
5582 If supported for the target machine, emit position-independent code,
5583 suitable for dynamic linking and avoiding any limit on the size of the
5584 global offset table. This option makes a difference on the m68k, m88k,
5585 and the Sparc.
5586
5587 Position-independent code requires special support, and therefore works
5588 only on certain machines.
5589
5590 @item -ffixed-@var{reg}
5591 Treat the register named @var{reg} as a fixed register; generated code
5592 should never refer to it (except perhaps as a stack pointer, frame
5593 pointer or in some other fixed role).
5594
5595 @var{reg} must be the name of a register. The register names accepted
5596 are machine-specific and are defined in the @code{REGISTER_NAMES}
5597 macro in the machine description macro file.
5598
5599 This flag does not have a negative form, because it specifies a
5600 three-way choice.
5601
5602 @item -fcall-used-@var{reg}
5603 Treat the register named @var{reg} as an allocable register that is
5604 clobbered by function calls. It may be allocated for temporaries or
5605 variables that do not live across a call. Functions compiled this way
5606 will not save and restore the register @var{reg}.
5607
5608 Use of this flag for a register that has a fixed pervasive role in the
5609 machine's execution model, such as the stack pointer or frame pointer,
5610 will produce disastrous results.
5611
5612 This flag does not have a negative form, because it specifies a
5613 three-way choice.
5614
5615 @item -fcall-saved-@var{reg}
5616 Treat the register named @var{reg} as an allocable register saved by
5617 functions. It may be allocated even for temporaries or variables that
5618 live across a call. Functions compiled this way will save and restore
5619 the register @var{reg} if they use it.
5620
5621 Use of this flag for a register that has a fixed pervasive role in the
5622 machine's execution model, such as the stack pointer or frame pointer,
5623 will produce disastrous results.
5624
5625 A different sort of disaster will result from the use of this flag for
5626 a register in which function values may be returned.
5627
5628 This flag does not have a negative form, because it specifies a
5629 three-way choice.
5630
5631 @item -fpack-struct
5632 Pack all structure members together without holes. Usually you would
5633 not want to use this option, since it makes the code suboptimal, and
5634 the offsets of structure members won't agree with system libraries.
5635
5636 @item -fcheck-memory-usage
5637 Generate extra code to check each memory access. GNU CC will generate
5638 code that is suitable for a detector of bad memory accesses such as
5639 @file{Checker}. If you specify this option, you can not use the
5640 @code{asm} or @code{__asm__} keywords.
5641
5642 You must also specify this option when you compile functions you call that
5643 have side effects. If you do not, you may get erroneous messages from
5644 the detector. Normally, you should compile all your code with this option.
5645 If you use functions from a library that have side-effects (such as
5646 @code{read}), you may not be able to recompile the library and
5647 specify this option. In that case, you can enable the
5648 @samp{-fprefix-function-name} option, which requests GNU CC to encapsulate
5649 your code and make other functions look as if they were compiled with
5650 @samp{-fcheck-memory-usage}. This is done by calling ``stubs'',
5651 which are provided by the detector. If you cannot find or build
5652 stubs for every function you call, you may have to specify
5653 @samp{-fcheck-memory-usage} without @samp{-fprefix-function-name}.
5654
5655 @item -fprefix-function-name
5656 Request GNU CC to add a prefix to the symbols generated for function names.
5657 GNU CC adds a prefix to the names of functions defined as well as
5658 functions called. Code compiled with this option and code compiled
5659 without the option can't be linked together, unless or stubs are used.
5660
5661 If you compile the following code with @samp{-fprefix-function-name}
5662 @example
5663 extern void bar (int);
5664 void
5665 foo (int a)
5666 @{
5667 return bar (a + 5);
5668
5669 @}
5670 @end example
5671
5672 @noindent
5673 GNU CC will compile the code as if it was written:
5674 @example
5675 extern void prefix_bar (int);
5676 void
5677 prefix_foo (int a)
5678 @{
5679 return prefix_bar (a + 5);
5680 @}
5681 @end example
5682 This option is designed to be used with @samp{-fcheck-memory-usage}.
5683
5684 @item -fstack-check
5685 Generate code to verify that you do not go beyond the boundary of the
5686 stack. You should specify this flag if you are running in an
5687 environment with multiple threads, but only rarely need to specify it in
5688 a single-threaded environment since stack overflow is automatically
5689 detected on nearly all systems if there is only one stack.
5690
5691 @item -fexceptions
5692 Enable exception handling. For some targets, this implies
5693 generation of frame unwind information for all functions, which can produce
5694 significant data size overhead, though it does not affect execution.
5695
5696 This option is on by default for languages that support exception
5697 handling (such as C++), and off for those that don't (such as C).
5698
5699 @item +e0
5700 @itemx +e1
5701 Control whether virtual function definitions in classes are used to
5702 generate code, or only to define interfaces for their callers. (C++
5703 only).
5704
5705 These options are provided for compatibility with @code{cfront} 1.x
5706 usage; the recommended alternative GNU C++ usage is in flux. @xref{C++
5707 Interface,,Declarations and Definitions in One Header}.
5708
5709 With @samp{+e0}, virtual function definitions in classes are declared
5710 @code{extern}; the declaration is used only as an interface
5711 specification, not to generate code for the virtual functions (in this
5712 compilation).
5713
5714 With @samp{+e1}, G++ actually generates the code implementing virtual
5715 functions defined in the code, and makes them publicly visible.
5716
5717 @cindex aliasing of parameters
5718 @cindex parameters, aliased
5719 @item -fargument-alias
5720 @itemx -fargument-noalias
5721 @itemx -fargument-noalias-global
5722 Specify the possible relationships among parameters and between
5723 parameters and global data.
5724
5725 @samp{-fargument-alias} specifies that arguments (parameters) may
5726 alias each other and may alias global storage.
5727 @samp{-fargument-noalias} specifies that arguments do not alias
5728 each other, but may alias global storage.
5729 @samp{-fargument-noalias-global} specifies that arguments do not
5730 alias each other and do not alias global storage.
5731
5732 Each language will automatically use whatever option is required by
5733 the language standard. You should not need to use these options yourself.
5734 @end table
5735
5736 @node Environment Variables
5737 @section Environment Variables Affecting GNU CC
5738 @cindex environment variables
5739
5740 This section describes several environment variables that affect how GNU
5741 CC operates. They work by specifying directories or prefixes to use
5742 when searching for various kinds of files.
5743
5744 @ifclear INTERNALS
5745 Note that you can also specify places to search using options such as
5746 @samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}). These
5747 take precedence over places specified using environment variables, which
5748 in turn take precedence over those specified by the configuration of GNU
5749 CC.
5750 @end ifclear
5751 @ifset INTERNALS
5752 Note that you can also specify places to search using options such as
5753 @samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}). These
5754 take precedence over places specified using environment variables, which
5755 in turn take precedence over those specified by the configuration of GNU
5756 CC. @xref{Driver}.
5757 @end ifset
5758
5759 @table @code
5760 @item TMPDIR
5761 @findex TMPDIR
5762 If @code{TMPDIR} is set, it specifies the directory to use for temporary
5763 files. GNU CC uses temporary files to hold the output of one stage of
5764 compilation which is to be used as input to the next stage: for example,
5765 the output of the preprocessor, which is the input to the compiler
5766 proper.
5767
5768 @item GCC_EXEC_PREFIX
5769 @findex GCC_EXEC_PREFIX
5770 If @code{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
5771 names of the subprograms executed by the compiler. No slash is added
5772 when this prefix is combined with the name of a subprogram, but you can
5773 specify a prefix that ends with a slash if you wish.
5774
5775 If GNU CC cannot find the subprogram using the specified prefix, it
5776 tries looking in the usual places for the subprogram.
5777
5778 The default value of @code{GCC_EXEC_PREFIX} is
5779 @file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value
5780 of @code{prefix} when you ran the @file{configure} script.
5781
5782 Other prefixes specified with @samp{-B} take precedence over this prefix.
5783
5784 This prefix is also used for finding files such as @file{crt0.o} that are
5785 used for linking.
5786
5787 In addition, the prefix is used in an unusual way in finding the
5788 directories to search for header files. For each of the standard
5789 directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
5790 (more precisely, with the value of @code{GCC_INCLUDE_DIR}), GNU CC tries
5791 replacing that beginning with the specified prefix to produce an
5792 alternate directory name. Thus, with @samp{-Bfoo/}, GNU CC will search
5793 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
5794 These alternate directories are searched first; the standard directories
5795 come next.
5796
5797 @item COMPILER_PATH
5798 @findex COMPILER_PATH
5799 The value of @code{COMPILER_PATH} is a colon-separated list of
5800 directories, much like @code{PATH}. GNU CC tries the directories thus
5801 specified when searching for subprograms, if it can't find the
5802 subprograms using @code{GCC_EXEC_PREFIX}.
5803
5804 @item LIBRARY_PATH
5805 @findex LIBRARY_PATH
5806 The value of @code{LIBRARY_PATH} is a colon-separated list of
5807 directories, much like @code{PATH}. When configured as a native compiler,
5808 GNU CC tries the directories thus specified when searching for special
5809 linker files, if it can't find them using @code{GCC_EXEC_PREFIX}. Linking
5810 using GNU CC also uses these directories when searching for ordinary
5811 libraries for the @samp{-l} option (but directories specified with
5812 @samp{-L} come first).
5813
5814 @item C_INCLUDE_PATH
5815 @itemx CPLUS_INCLUDE_PATH
5816 @itemx OBJC_INCLUDE_PATH
5817 @findex C_INCLUDE_PATH
5818 @findex CPLUS_INCLUDE_PATH
5819 @findex OBJC_INCLUDE_PATH
5820 @c @itemx OBJCPLUS_INCLUDE_PATH
5821 These environment variables pertain to particular languages. Each
5822 variable's value is a colon-separated list of directories, much like
5823 @code{PATH}. When GNU CC searches for header files, it tries the
5824 directories listed in the variable for the language you are using, after
5825 the directories specified with @samp{-I} but before the standard header
5826 file directories.
5827
5828 @item DEPENDENCIES_OUTPUT
5829 @findex DEPENDENCIES_OUTPUT
5830 @cindex dependencies for make as output
5831 If this variable is set, its value specifies how to output dependencies
5832 for Make based on the header files processed by the compiler. This
5833 output looks much like the output from the @samp{-M} option
5834 (@pxref{Preprocessor Options}), but it goes to a separate file, and is
5835 in addition to the usual results of compilation.
5836
5837 The value of @code{DEPENDENCIES_OUTPUT} can be just a file name, in
5838 which case the Make rules are written to that file, guessing the target
5839 name from the source file name. Or the value can have the form
5840 @samp{@var{file} @var{target}}, in which case the rules are written to
5841 file @var{file} using @var{target} as the target name.
5842 @end table
5843
5844 @node Running Protoize
5845 @section Running Protoize
5846
5847 The program @code{protoize} is an optional part of GNU C. You can use
5848 it to add prototypes to a program, thus converting the program to ANSI
5849 C in one respect. The companion program @code{unprotoize} does the
5850 reverse: it removes argument types from any prototypes that are found.
5851
5852 When you run these programs, you must specify a set of source files as
5853 command line arguments. The conversion programs start out by compiling
5854 these files to see what functions they define. The information gathered
5855 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
5856
5857 After scanning comes actual conversion. The specified files are all
5858 eligible to be converted; any files they include (whether sources or
5859 just headers) are eligible as well.
5860
5861 But not all the eligible files are converted. By default,
5862 @code{protoize} and @code{unprotoize} convert only source and header
5863 files in the current directory. You can specify additional directories
5864 whose files should be converted with the @samp{-d @var{directory}}
5865 option. You can also specify particular files to exclude with the
5866 @samp{-x @var{file}} option. A file is converted if it is eligible, its
5867 directory name matches one of the specified directory names, and its
5868 name within the directory has not been excluded.
5869
5870 Basic conversion with @code{protoize} consists of rewriting most
5871 function definitions and function declarations to specify the types of
5872 the arguments. The only ones not rewritten are those for varargs
5873 functions.
5874
5875 @code{protoize} optionally inserts prototype declarations at the
5876 beginning of the source file, to make them available for any calls that
5877 precede the function's definition. Or it can insert prototype
5878 declarations with block scope in the blocks where undeclared functions
5879 are called.
5880
5881 Basic conversion with @code{unprotoize} consists of rewriting most
5882 function declarations to remove any argument types, and rewriting
5883 function definitions to the old-style pre-ANSI form.
5884
5885 Both conversion programs print a warning for any function declaration or
5886 definition that they can't convert. You can suppress these warnings
5887 with @samp{-q}.
5888
5889 The output from @code{protoize} or @code{unprotoize} replaces the
5890 original source file. The original file is renamed to a name ending
5891 with @samp{.save}. If the @samp{.save} file already exists, then
5892 the source file is simply discarded.
5893
5894 @code{protoize} and @code{unprotoize} both depend on GNU CC itself to
5895 scan the program and collect information about the functions it uses.
5896 So neither of these programs will work until GNU CC is installed.
5897
5898 Here is a table of the options you can use with @code{protoize} and
5899 @code{unprotoize}. Each option works with both programs unless
5900 otherwise stated.
5901
5902 @table @code
5903 @item -B @var{directory}
5904 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
5905 usual directory (normally @file{/usr/local/lib}). This file contains
5906 prototype information about standard system functions. This option
5907 applies only to @code{protoize}.
5908
5909 @item -c @var{compilation-options}
5910 Use @var{compilation-options} as the options when running @code{gcc} to
5911 produce the @samp{.X} files. The special option @samp{-aux-info} is
5912 always passed in addition, to tell @code{gcc} to write a @samp{.X} file.
5913
5914 Note that the compilation options must be given as a single argument to
5915 @code{protoize} or @code{unprotoize}. If you want to specify several
5916 @code{gcc} options, you must quote the entire set of compilation options
5917 to make them a single word in the shell.
5918
5919 There are certain @code{gcc} arguments that you cannot use, because they
5920 would produce the wrong kind of output. These include @samp{-g},
5921 @samp{-O}, @samp{-c}, @samp{-S}, and @samp{-o} If you include these in
5922 the @var{compilation-options}, they are ignored.
5923
5924 @item -C
5925 Rename files to end in @samp{.C} instead of @samp{.c}.
5926 This is convenient if you are converting a C program to C++.
5927 This option applies only to @code{protoize}.
5928
5929 @item -g
5930 Add explicit global declarations. This means inserting explicit
5931 declarations at the beginning of each source file for each function
5932 that is called in the file and was not declared. These declarations
5933 precede the first function definition that contains a call to an
5934 undeclared function. This option applies only to @code{protoize}.
5935
5936 @item -i @var{string}
5937 Indent old-style parameter declarations with the string @var{string}.
5938 This option applies only to @code{protoize}.
5939
5940 @code{unprotoize} converts prototyped function definitions to old-style
5941 function definitions, where the arguments are declared between the
5942 argument list and the initial @samp{@{}. By default, @code{unprotoize}
5943 uses five spaces as the indentation. If you want to indent with just
5944 one space instead, use @samp{-i " "}.
5945
5946 @item -k
5947 Keep the @samp{.X} files. Normally, they are deleted after conversion
5948 is finished.
5949
5950 @item -l
5951 Add explicit local declarations. @code{protoize} with @samp{-l} inserts
5952 a prototype declaration for each function in each block which calls the
5953 function without any declaration. This option applies only to
5954 @code{protoize}.
5955
5956 @item -n
5957 Make no real changes. This mode just prints information about the conversions
5958 that would have been done without @samp{-n}.
5959
5960 @item -N
5961 Make no @samp{.save} files. The original files are simply deleted.
5962 Use this option with caution.
5963
5964 @item -p @var{program}
5965 Use the program @var{program} as the compiler. Normally, the name
5966 @file{gcc} is used.
5967
5968 @item -q
5969 Work quietly. Most warnings are suppressed.
5970
5971 @item -v
5972 Print the version number, just like @samp{-v} for @code{gcc}.
5973 @end table
5974
5975 If you need special compiler options to compile one of your program's
5976 source files, then you should generate that file's @samp{.X} file
5977 specially, by running @code{gcc} on that source file with the
5978 appropriate options and the option @samp{-aux-info}. Then run
5979 @code{protoize} on the entire set of files. @code{protoize} will use
5980 the existing @samp{.X} file because it is newer than the source file.
5981 For example:
5982
5983 @example
5984 gcc -Dfoo=bar file1.c -aux-info
5985 protoize *.c
5986 @end example
5987
5988 @noindent
5989 You need to include the special files along with the rest in the
5990 @code{protoize} command, even though their @samp{.X} files already
5991 exist, because otherwise they won't get converted.
5992
5993 @xref{Protoize Caveats}, for more information on how to use
5994 @code{protoize} successfully.
5995