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