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