invoke.texi revision 102780
1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2@c 2000, 2001, 2002 Free Software Foundation, Inc. 3@c This is part of the GCC manual. 4@c For copying conditions, see the file gcc.texi. 5 6@ignore 7@c man begin COPYRIGHT 8Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 91998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. 10 11Permission is granted to copy, distribute and/or modify this document 12under the terms of the GNU Free Documentation License, Version 1.1 or 13any later version published by the Free Software Foundation; with the 14Invariant Sections being ``GNU General Public License'' and ``Funding 15Free Software'', the Front-Cover texts being (a) (see below), and with 16the Back-Cover Texts being (b) (see below). A copy of the license is 17included in the gfdl(7) man page. 18 19(a) The FSF's Front-Cover Text is: 20 21 A GNU Manual 22 23(b) The FSF's Back-Cover Text is: 24 25 You have freedom to copy and modify this GNU Manual, like GNU 26 software. Copies published by the Free Software Foundation raise 27 funds for GNU development. 28@c man end 29@c Set file name and title for the man page. 30@setfilename gcc 31@settitle GNU project C and C++ compiler 32@c man begin SYNOPSIS 33gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}] 34 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}] 35 [@option{-W}@var{warn}@dots{}] [@option{-pedantic}] 36 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}] 37 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] 38 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}] 39 [@option{-o} @var{outfile}] @var{infile}@dots{} 40 41Only the most useful options are listed here; see below for the 42remainder. @samp{g++} accepts mostly the same options as @samp{gcc}. 43@c man end 44@c man begin SEEALSO 45gpl(7), gfdl(7), fsf-funding(7), 46cpp(1), gcov(1), g77(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) 47and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as}, 48@file{ld}, @file{binutils} and @file{gdb}. 49@c man end 50@c man begin BUGS 51For instructions on reporting bugs, see 52@w{@uref{http://gcc.gnu.org/bugs.html}}. Use of the @command{gccbug} 53script to report bugs is recommended. 54@c man end 55@c man begin AUTHOR 56See the Info entry for @command{gcc}, or 57@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}}, 58for contributors to GCC@. 59@c man end 60@end ignore 61 62@node Invoking GCC 63@chapter GCC Command Options 64@cindex GCC command options 65@cindex command options 66@cindex options, GCC command 67 68@c man begin DESCRIPTION 69 70When you invoke GCC, it normally does preprocessing, compilation, 71assembly and linking. The ``overall options'' allow you to stop this 72process at an intermediate stage. For example, the @option{-c} option 73says not to run the linker. Then the output consists of object files 74output by the assembler. 75 76Other options are passed on to one stage of processing. Some options 77control the preprocessor and others the compiler itself. Yet other 78options control the assembler and linker; most of these are not 79documented here, since you rarely need to use any of them. 80 81@cindex C compilation options 82Most of the command line options that you can use with GCC are useful 83for C programs; when an option is only useful with another language 84(usually C++), the explanation says so explicitly. If the description 85for a particular option does not mention a source language, you can use 86that option with all supported languages. 87 88@cindex C++ compilation options 89@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special 90options for compiling C++ programs. 91 92@cindex grouping options 93@cindex options, grouping 94The @command{gcc} program accepts options and file names as operands. Many 95options have multi-letter names; therefore multiple single-letter options 96may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d 97-r}}. 98 99@cindex order of options 100@cindex options, order 101You can mix options and other arguments. For the most part, the order 102you use doesn't matter. Order does matter when you use several options 103of the same kind; for example, if you specify @option{-L} more than once, 104the directories are searched in the order specified. 105 106Many options have long names starting with @samp{-f} or with 107@samp{-W}---for example, @option{-fforce-mem}, 108@option{-fstrength-reduce}, @option{-Wformat} and so on. Most of 109these have both positive and negative forms; the negative form of 110@option{-ffoo} would be @option{-fno-foo}. This manual documents 111only one of these two forms, whichever one is not the default. 112 113@c man end 114 115@xref{Option Index}, for an index to GCC's options. 116 117@menu 118* Option Summary:: Brief list of all options, without explanations. 119* Overall Options:: Controlling the kind of output: 120 an executable, object files, assembler files, 121 or preprocessed source. 122* Invoking G++:: Compiling C++ programs. 123* C Dialect Options:: Controlling the variant of C language compiled. 124* C++ Dialect Options:: Variations on C++. 125* Objective-C Dialect Options:: Variations on Objective-C. 126* Language Independent Options:: Controlling how diagnostics should be 127 formatted. 128* Warning Options:: How picky should the compiler be? 129* Debugging Options:: Symbol tables, measurements, and debugging dumps. 130* Optimize Options:: How much optimization? 131* Preprocessor Options:: Controlling header files and macro definitions. 132 Also, getting dependency information for Make. 133* Assembler Options:: Passing options to the assembler. 134* Link Options:: Specifying libraries and so on. 135* Directory Options:: Where to find header files and libraries. 136 Where to find the compiler executable files. 137* Spec Files:: How to pass switches to sub-processes. 138* Target Options:: Running a cross-compiler, or an old version of GCC. 139* Submodel Options:: Specifying minor hardware or convention variations, 140 such as 68010 vs 68020. 141* Code Gen Options:: Specifying conventions for function calls, data layout 142 and register usage. 143* Environment Variables:: Env vars that affect GCC. 144* Running Protoize:: Automatically adding or removing function prototypes. 145@end menu 146 147@c man begin OPTIONS 148 149@node Option Summary 150@section Option Summary 151 152Here is a summary of all the options, grouped by type. Explanations are 153in the following sections. 154 155@table @emph 156@item Overall Options 157@xref{Overall Options,,Options Controlling the Kind of Output}. 158@gccoptlist{ 159-c -S -E -o @var{file} -pipe -pass-exit-codes -x @var{language} @gol 160-v -### --target-help --help} 161 162@item C Language Options 163@xref{C Dialect Options,,Options Controlling C Dialect}. 164@gccoptlist{ 165-ansi -std=@var{standard} -aux-info @var{filename} @gol 166-fno-asm -fno-builtin -fno-builtin-@var{function} @gol 167-fhosted -ffreestanding @gol 168-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol 169-fallow-single-precision -fcond-mismatch @gol 170-fsigned-bitfields -fsigned-char @gol 171-funsigned-bitfields -funsigned-char @gol 172-fwritable-strings -fshort-wchar} 173 174@item C++ Language Options 175@xref{C++ Dialect Options,,Options Controlling C++ Dialect}. 176@gccoptlist{ 177-fno-access-control -fcheck-new -fconserve-space @gol 178-fno-const-strings -fdollars-in-identifiers @gol 179-fno-elide-constructors @gol 180-fno-enforce-eh-specs -fexternal-templates @gol 181-falt-external-templates @gol 182-ffor-scope -fno-for-scope -fno-gnu-keywords @gol 183-fno-implicit-templates @gol 184-fno-implicit-inline-templates @gol 185-fno-implement-inlines -fms-extensions @gol 186-fno-nonansi-builtins -fno-operator-names @gol 187-fno-optional-diags -fpermissive @gol 188-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol 189-fuse-cxa-atexit -fvtable-gc -fno-weak -nostdinc++ @gol 190-fno-default-inline -Wabi -Wctor-dtor-privacy @gol 191-Wnon-virtual-dtor -Wreorder @gol 192-Weffc++ -Wno-deprecated @gol 193-Wno-non-template-friend -Wold-style-cast @gol 194-Woverloaded-virtual -Wno-pmf-conversions @gol 195-Wsign-promo -Wsynth} 196 197@item Objective-C Language Options 198@xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}. 199@gccoptlist{ 200-fconstant-string-class=@var{class-name} @gol 201-fgnu-runtime -fnext-runtime -gen-decls @gol 202-Wno-protocol -Wselector} 203 204@item Language Independent Options 205@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. 206@gccoptlist{ 207-fmessage-length=@var{n} @gol 208-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}} 209 210@item Warning Options 211@xref{Warning Options,,Options to Request or Suppress Warnings}. 212@gccoptlist{ 213-fsyntax-only -pedantic -pedantic-errors @gol 214-w -W -Wall -Waggregate-return @gol 215-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol 216-Wconversion -Wno-deprecated-declarations @gol 217-Wdisabled-optimization -Wdiv-by-zero -Werror @gol 218-Wfloat-equal -Wformat -Wformat=2 @gol 219-Wformat-nonliteral -Wformat-security @gol 220-Wimplicit -Wimplicit-int @gol 221-Wimplicit-function-declaration @gol 222-Werror-implicit-function-declaration @gol 223-Wimport -Winline @gol 224-Wlarger-than-@var{len} -Wlong-long @gol 225-Wmain -Wmissing-braces -Wmissing-declarations @gol 226-Wmissing-format-attribute -Wmissing-noreturn @gol 227-Wmultichar -Wno-format-extra-args -Wno-format-y2k @gol 228-Wno-import -Wpacked -Wpadded @gol 229-Wparentheses -Wpointer-arith -Wredundant-decls @gol 230-Wreturn-type -Wsequence-point -Wshadow @gol 231-Wsign-compare -Wswitch -Wsystem-headers @gol 232-Wtrigraphs -Wundef -Wuninitialized @gol 233-Wunknown-pragmas -Wunreachable-code @gol 234-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol 235-Wunused-value -Wunused-variable -Wwrite-strings} 236 237@item C-only Warning Options 238@gccoptlist{ 239-Wbad-function-cast -Wmissing-prototypes -Wnested-externs @gol 240-Wstrict-prototypes -Wtraditional} 241 242@item Debugging Options 243@xref{Debugging Options,,Options for Debugging Your Program or GCC}. 244@gccoptlist{ 245-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 246-fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol 247-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol 248-fdump-tree-original@r{[}-@var{n}@r{]} -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol 249-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol 250-fmem-report -fpretend-float @gol 251-fprofile-arcs -ftest-coverage -ftime-report @gol 252-g -g@var{level} -gcoff -gdwarf -gdwarf-1 -gdwarf-1+ -gdwarf-2 @gol 253-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol 254-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol 255-print-multi-directory -print-multi-lib @gol 256-print-prog-name=@var{program} -print-search-dirs -Q @gol 257-save-temps -time} 258 259@item Optimization Options 260@xref{Optimize Options,,Options that Control Optimization}. 261@gccoptlist{ 262-falign-functions=@var{n} -falign-jumps=@var{n} @gol 263-falign-labels=@var{n} -falign-loops=@var{n} @gol 264-fbranch-probabilities -fcaller-saves -fcprop-registers @gol 265-fcse-follow-jumps -fcse-skip-blocks -fdata-sections @gol 266-fdelayed-branch -fdelete-null-pointer-checks @gol 267-fexpensive-optimizations -ffast-math -ffloat-store @gol 268-fforce-addr -fforce-mem -ffunction-sections @gol 269-fgcse -fgcse-lm -fgcse-sm @gol 270-finline-functions -finline-limit=@var{n} -fkeep-inline-functions @gol 271-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol 272-fmove-all-movables -fno-default-inline -fno-defer-pop @gol 273-fno-function-cse -fno-guess-branch-probability @gol 274-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol 275-funsafe-math-optimizations -fno-trapping-math @gol 276-fomit-frame-pointer -foptimize-register-move @gol 277-foptimize-sibling-calls -fprefetch-loop-arrays @gol 278-freduce-all-givs -fregmove -frename-registers @gol 279-frerun-cse-after-loop -frerun-loop-opt @gol 280-fschedule-insns -fschedule-insns2 @gol 281-fsingle-precision-constant -fssa -fssa-ccp -fssa-dce @gol 282-fstrength-reduce -fstrict-aliasing -fthread-jumps -ftrapv @gol 283-funroll-all-loops -funroll-loops @gol 284--param @var{name}=@var{value} 285-O -O0 -O1 -O2 -O3 -Os} 286 287@item Preprocessor Options 288@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 289@gccoptlist{ 290-$ -A@var{question}=@var{answer} -A-@var{question}@r{[}=@var{answer}@r{]} @gol 291-C -dD -dI -dM -dN @gol 292-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol 293-idirafter @var{dir} @gol 294-include @var{file} -imacros @var{file} @gol 295-iprefix @var{file} -iwithprefix @var{dir} @gol 296-iwithprefixbefore @var{dir} -isystem @var{dir} @gol 297-M -MM -MF -MG -MP -MQ -MT -nostdinc -P -remap @gol 298-trigraphs -undef -U@var{macro} -Wp,@var{option}} 299 300@item Assembler Option 301@xref{Assembler Options,,Passing Options to the Assembler}. 302@gccoptlist{ 303-Wa,@var{option}} 304 305@item Linker Options 306@xref{Link Options,,Options for Linking}. 307@gccoptlist{ 308@var{object-file-name} -l@var{library} @gol 309-nostartfiles -nodefaultlibs -nostdlib @gol 310-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol 311-Wl,@var{option} -Xlinker @var{option} @gol 312-u @var{symbol}} 313 314@item Directory Options 315@xref{Directory Options,,Options for Directory Search}. 316@gccoptlist{ 317-B@var{prefix} -I@var{dir} -I- -L@var{dir} -specs=@var{file}} 318 319@item Target Options 320@c I wrote this xref this way to avoid overfull hbox. -- rms 321@xref{Target Options}. 322@gccoptlist{ 323-b @var{machine} -V @var{version}} 324 325@item Machine Dependent Options 326@xref{Submodel Options,,Hardware Models and Configurations}. 327 328@emph{M680x0 Options} 329@gccoptlist{ 330-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 331-m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol 332-mfpa -mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol 333-malign-int -mstrict-align} 334 335@emph{M68hc1x Options} 336@gccoptlist{ 337-m6811 -m6812 -m68hc11 -m68hc12 @gol 338-mauto-incdec -mshort -msoft-reg-count=@var{count}} 339 340@emph{VAX Options} 341@gccoptlist{ 342-mg -mgnu -munix} 343 344@emph{SPARC Options} 345@gccoptlist{ 346-mcpu=@var{cpu-type} @gol 347-mtune=@var{cpu-type} @gol 348-mcmodel=@var{code-model} @gol 349-m32 -m64 @gol 350-mapp-regs -mbroken-saverestore -mcypress @gol 351-mfaster-structs -mflat @gol 352-mfpu -mhard-float -mhard-quad-float @gol 353-mimpure-text -mlive-g0 -mno-app-regs @gol 354-mno-faster-structs -mno-flat -mno-fpu @gol 355-mno-impure-text -mno-stack-bias -mno-unaligned-doubles @gol 356-msoft-float -msoft-quad-float -msparclite -mstack-bias @gol 357-msupersparc -munaligned-doubles -mv8} 358 359@emph{Convex Options} 360@gccoptlist{ 361-mc1 -mc2 -mc32 -mc34 -mc38 @gol 362-margcount -mnoargcount @gol 363-mlong32 -mlong64 @gol 364-mvolatile-cache -mvolatile-nocache} 365 366@emph{AMD29K Options} 367@gccoptlist{ 368-m29000 -m29050 -mbw -mnbw -mdw -mndw @gol 369-mlarge -mnormal -msmall @gol 370-mkernel-registers -mno-reuse-arg-regs @gol 371-mno-stack-check -mno-storem-bug @gol 372-mreuse-arg-regs -msoft-float -mstack-check @gol 373-mstorem-bug -muser-registers} 374 375@emph{ARM Options} 376@gccoptlist{ 377-mapcs-frame -mno-apcs-frame @gol 378-mapcs-26 -mapcs-32 @gol 379-mapcs-stack-check -mno-apcs-stack-check @gol 380-mapcs-float -mno-apcs-float @gol 381-mapcs-reentrant -mno-apcs-reentrant @gol 382-msched-prolog -mno-sched-prolog @gol 383-mlittle-endian -mbig-endian -mwords-little-endian @gol 384-malignment-traps -mno-alignment-traps @gol 385-msoft-float -mhard-float -mfpe @gol 386-mthumb-interwork -mno-thumb-interwork @gol 387-mcpu=@var{name} -march=@var{name} -mfpe=@var{name} @gol 388-mstructure-size-boundary=@var{n} @gol 389-mbsd -mxopen -mno-symrename @gol 390-mabort-on-noreturn @gol 391-mlong-calls -mno-long-calls @gol 392-msingle-pic-base -mno-single-pic-base @gol 393-mpic-register=@var{reg} @gol 394-mnop-fun-dllimport @gol 395-mpoke-function-name @gol 396-mthumb -marm @gol 397-mtpcs-frame -mtpcs-leaf-frame @gol 398-mcaller-super-interworking -mcallee-super-interworking } 399 400@emph{MN10200 Options} 401@gccoptlist{ 402-mrelax} 403 404@emph{MN10300 Options} 405@gccoptlist{ 406-mmult-bug -mno-mult-bug @gol 407-mam33 -mno-am33 @gol 408-mno-crt0 -mrelax} 409 410@emph{M32R/D Options} 411@gccoptlist{ 412-m32rx -m32r -mcode-model=@var{model-type} -msdata=@var{sdata-type} @gol 413-G @var{num}} 414 415@emph{M88K Options} 416@gccoptlist{ 417-m88000 -m88100 -m88110 -mbig-pic @gol 418-mcheck-zero-division -mhandle-large-shift @gol 419-midentify-revision -mno-check-zero-division @gol 420-mno-ocs-debug-info -mno-ocs-frame-position @gol 421-mno-optimize-arg-area -mno-serialize-volatile @gol 422-mno-underscores -mocs-debug-info @gol 423-mocs-frame-position -moptimize-arg-area @gol 424-mserialize-volatile -mshort-data-@var{num} -msvr3 @gol 425-msvr4 -mtrap-large-shift -muse-div-instruction @gol 426-mversion-03.00 -mwarn-passed-structs} 427 428@emph{RS/6000 and PowerPC Options} 429@gccoptlist{ 430-mcpu=@var{cpu-type} @gol 431-mtune=@var{cpu-type} @gol 432-mpower -mno-power -mpower2 -mno-power2 @gol 433-mpowerpc -mpowerpc64 -mno-powerpc @gol 434-maltivec -mno-altivec @gol 435-mpowerpc-gpopt -mno-powerpc-gpopt @gol 436-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 437-mnew-mnemonics -mold-mnemonics @gol 438-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 439-m64 -m32 -mxl-call -mno-xl-call -mpe @gol 440-msoft-float -mhard-float -mmultiple -mno-multiple @gol 441-mstring -mno-string -mupdate -mno-update @gol 442-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 443-mstrict-align -mno-strict-align -mrelocatable @gol 444-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 445-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 446-mcall-aix -mcall-sysv -mcall-netbsd @gol 447-maix-struct-return -msvr4-struct-return 448-mabi=altivec -mabi=no-altivec @gol 449-mprototype -mno-prototype @gol 450-msim -mmvme -mads -myellowknife -memb -msdata @gol 451-msdata=@var{opt} -mvxworks -G @var{num} -pthread} 452 453@emph{RT Options} 454@gccoptlist{ 455-mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs @gol 456-mfull-fp-blocks -mhc-struct-return -min-line-mul @gol 457-mminimum-fp-blocks -mnohc-struct-return} 458 459@emph{MIPS Options} 460@gccoptlist{ 461-mabicalls -march=@var{cpu-type} -mtune=@var{cpu=type} @gol 462-mcpu=@var{cpu-type} -membedded-data -muninit-const-in-rodata @gol 463-membedded-pic -mfp32 -mfp64 -mfused-madd -mno-fused-madd @gol 464-mgas -mgp32 -mgp64 @gol 465-mgpopt -mhalf-pic -mhard-float -mint64 -mips1 @gol 466-mips2 -mips3 -mips4 -mlong64 -mlong32 -mlong-calls -mmemcpy @gol 467-mmips-as -mmips-tfile -mno-abicalls @gol 468-mno-embedded-data -mno-uninit-const-in-rodata @gol 469-mno-embedded-pic -mno-gpopt -mno-long-calls @gol 470-mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats @gol 471-mrnames -msoft-float @gol 472-m4650 -msingle-float -mmad @gol 473-mstats -EL -EB -G @var{num} -nocpp @gol 474-mabi=32 -mabi=n32 -mabi=64 -mabi=eabi @gol 475-mfix7000 -mno-crt0 -mflush-func=@var{func} -mno-flush-func} 476 477@emph{i386 and x86-64 Options} 478@gccoptlist{ 479-mcpu=@var{cpu-type} -march=@var{cpu-type} -mfpmath=@var{unit} @gol 480-masm=@var{dialect} -mno-fancy-math-387 @gol 481-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol 482-mno-wide-multiply -mrtd -malign-double @gol 483-mpreferred-stack-boundary=@var{num} @gol 484-mmmx -msse -msse2 -msse-math -m3dnow @gol 485-mthreads -mno-align-stringops -minline-all-stringops @gol 486-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 487-m96bit-long-double -mregparm=@var{num} -momit-leaf-frame-pointer @gol 488-mno-red-zone@gol 489-mcmodel=@var{code-model} @gol 490-m32 -m64} 491 492@emph{HPPA Options} 493@gccoptlist{ 494-march=@var{architecture-type} @gol 495-mbig-switch -mdisable-fpregs -mdisable-indexing @gol 496-mfast-indirect-calls -mgas -mjump-in-delay @gol 497-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol 498-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 499-mno-jump-in-delay -mno-long-load-store @gol 500-mno-portable-runtime -mno-soft-float @gol 501-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 502-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 503-mschedule=@var{cpu-type} -mspace-regs} 504 505@emph{Intel 960 Options} 506@gccoptlist{ 507-m@var{cpu-type} -masm-compat -mclean-linkage @gol 508-mcode-align -mcomplex-addr -mleaf-procedures @gol 509-mic-compat -mic2.0-compat -mic3.0-compat @gol 510-mintel-asm -mno-clean-linkage -mno-code-align @gol 511-mno-complex-addr -mno-leaf-procedures @gol 512-mno-old-align -mno-strict-align -mno-tail-call @gol 513-mnumerics -mold-align -msoft-float -mstrict-align @gol 514-mtail-call} 515 516@emph{DEC Alpha Options} 517@gccoptlist{ 518-mno-fp-regs -msoft-float -malpha-as -mgas @gol 519-mieee -mieee-with-inexact -mieee-conformant @gol 520-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 521-mtrap-precision=@var{mode} -mbuild-constants @gol 522-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 523-mbwx -mmax -mfix -mcix @gol 524-mfloat-vax -mfloat-ieee @gol 525-mexplicit-relocs -msmall-data -mlarge-data @gol 526-mmemory-latency=@var{time}} 527 528@emph{DEC Alpha/VMS Options} 529@gccoptlist{ 530-mvms-return-codes} 531 532@emph{Clipper Options} 533@gccoptlist{ 534-mc300 -mc400} 535 536@emph{H8/300 Options} 537@gccoptlist{ 538-mrelax -mh -ms -mint32 -malign-300} 539 540@emph{SH Options} 541@gccoptlist{ 542-m1 -m2 -m3 -m3e @gol 543-m4-nofpu -m4-single-only -m4-single -m4 @gol 544-m5-64media -m5-64media-nofpu @gol 545-m5-32media -m5-32media-nofpu @gol 546-m5-compact -m5-compact-nofpu @gol 547-mb -ml -mdalign -mrelax @gol 548-mbigtable -mfmovd -mhitachi -mnomacsave @gol 549-mieee -misize -mpadstruct -mspace @gol 550-mprefergot -musermode} 551 552@emph{System V Options} 553@gccoptlist{ 554-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 555 556@emph{ARC Options} 557@gccoptlist{ 558-EB -EL @gol 559-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol 560-mdata=@var{data-section} -mrodata=@var{readonly-data-section}} 561 562@emph{TMS320C3x/C4x Options} 563@gccoptlist{ 564-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol 565-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol 566-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol 567-mparallel-insns -mparallel-mpy -mpreserve-float} 568 569@emph{V850 Options} 570@gccoptlist{ 571-mlong-calls -mno-long-calls -mep -mno-ep @gol 572-mprolog-function -mno-prolog-function -mspace @gol 573-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 574-mv850 -mbig-switch} 575 576@emph{NS32K Options} 577@gccoptlist{ 578-m32032 -m32332 -m32532 -m32081 -m32381 @gol 579-mmult-add -mnomult-add -msoft-float -mrtd -mnortd @gol 580-mregparam -mnoregparam -msb -mnosb @gol 581-mbitfield -mnobitfield -mhimem -mnohimem} 582 583@emph{AVR Options} 584@gccoptlist{ 585-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol 586-mcall-prologues -mno-tablejump -mtiny-stack} 587 588@emph{MCore Options} 589@gccoptlist{ 590-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 591-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 592-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 593-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 594-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 595 596@emph{MMIX Options} 597@gccoptlist{ 598-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 599-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 600-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 601-mno-base-addresses} 602 603@emph{IA-64 Options} 604@gccoptlist{ 605-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 606-mvolatile-asm-stop -mb-step -mregister-names -mno-sdata @gol 607-mconstant-gp -mauto-pic -minline-divide-min-latency @gol 608-minline-divide-max-throughput -mno-dwarf2-asm @gol 609-mfixed-range=@var{register-range}} 610 611@emph{D30V Options} 612@gccoptlist{ 613-mextmem -mextmemory -monchip -mno-asm-optimize -masm-optimize @gol 614-mbranch-cost=@var{n} -mcond-exec=@var{n}} 615 616@emph{S/390 and zSeries Options} 617@gccoptlist{ 618-mhard-float -msoft-float -mbackchain -mno-backchain @gol 619-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 620-m64 -m31 -mdebug -mno-debug} 621 622@emph{CRIS Options} 623@gccoptlist{ 624-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 625-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 626-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 627-mstack-align -mdata-align -mconst-align @gol 628-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 629-melf -maout -melinux -mlinux -sim -sim2} 630 631@emph{PDP-11 Options} 632@gccoptlist{ 633-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 634-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 635-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 636-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 637-mbranch-expensive -mbranch-cheap @gol 638-msplit -mno-split -munix-asm -mdec-asm} 639 640@emph{Xstormy16 Options} 641@gccoptlist{ 642-msim} 643 644@emph{Xtensa Options} 645@gccoptlist{ 646-mbig-endian -mlittle-endian @gol 647-mdensity -mno-density @gol 648-mmac16 -mno-mac16 @gol 649-mmul16 -mno-mul16 @gol 650-mmul32 -mno-mul32 @gol 651-mnsa -mno-nsa @gol 652-mminmax -mno-minmax @gol 653-msext -mno-sext @gol 654-mbooleans -mno-booleans @gol 655-mhard-float -msoft-float @gol 656-mfused-madd -mno-fused-madd @gol 657-mserialize-volatile -mno-serialize-volatile @gol 658-mtext-section-literals -mno-text-section-literals @gol 659-mtarget-align -mno-target-align @gol 660-mlongcalls -mno-longcalls} 661 662@item Code Generation Options 663@xref{Code Gen Options,,Options for Code Generation Conventions}. 664@gccoptlist{ 665-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 666-ffixed-@var{reg} -fexceptions @gol 667-fnon-call-exceptions -funwind-tables @gol 668-fasynchronous-unwind-tables @gol 669-finhibit-size-directive -finstrument-functions @gol 670-fno-common -fno-ident -fno-gnu-linker @gol 671-fpcc-struct-return -fpic -fPIC @gol 672-freg-struct-return -fshared-data -fshort-enums @gol 673-fshort-double -fvolatile @gol 674-fvolatile-global -fvolatile-static @gol 675-fverbose-asm -fpack-struct -fstack-check @gol 676-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 677-fargument-alias -fargument-noalias @gol 678-fargument-noalias-global -fleading-underscore} 679@end table 680 681@menu 682* Overall Options:: Controlling the kind of output: 683 an executable, object files, assembler files, 684 or preprocessed source. 685* C Dialect Options:: Controlling the variant of C language compiled. 686* C++ Dialect Options:: Variations on C++. 687* Objective-C Dialect Options:: Variations on Objective-C. 688* Language Independent Options:: Controlling how diagnostics should be 689 formatted. 690* Warning Options:: How picky should the compiler be? 691* Debugging Options:: Symbol tables, measurements, and debugging dumps. 692* Optimize Options:: How much optimization? 693* Preprocessor Options:: Controlling header files and macro definitions. 694 Also, getting dependency information for Make. 695* Assembler Options:: Passing options to the assembler. 696* Link Options:: Specifying libraries and so on. 697* Directory Options:: Where to find header files and libraries. 698 Where to find the compiler executable files. 699* Spec Files:: How to pass switches to sub-processes. 700* Target Options:: Running a cross-compiler, or an old version of GCC. 701@end menu 702 703@node Overall Options 704@section Options Controlling the Kind of Output 705 706Compilation can involve up to four stages: preprocessing, compilation 707proper, assembly and linking, always in that order. The first three 708stages apply to an individual source file, and end by producing an 709object file; linking combines all the object files (those newly 710compiled, and those specified as input) into an executable file. 711 712@cindex file name suffix 713For any given input file, the file name suffix determines what kind of 714compilation is done: 715 716@table @gcctabopt 717@item @var{file}.c 718C source code which must be preprocessed. 719 720@item @var{file}.i 721C source code which should not be preprocessed. 722 723@item @var{file}.ii 724C++ source code which should not be preprocessed. 725 726@item @var{file}.m 727Objective-C source code. Note that you must link with the library 728@file{libobjc.a} to make an Objective-C program work. 729 730@item @var{file}.mi 731Objective-C source code which should not be preprocessed. 732 733@item @var{file}.h 734C header file (not to be compiled or linked). 735 736@item @var{file}.cc 737@itemx @var{file}.cp 738@itemx @var{file}.cxx 739@itemx @var{file}.cpp 740@itemx @var{file}.c++ 741@itemx @var{file}.C 742C++ source code which must be preprocessed. Note that in @samp{.cxx}, 743the last two letters must both be literally @samp{x}. Likewise, 744@samp{.C} refers to a literal capital C@. 745 746@item @var{file}.f 747@itemx @var{file}.for 748@itemx @var{file}.FOR 749Fortran source code which should not be preprocessed. 750 751@item @var{file}.F 752@itemx @var{file}.fpp 753@itemx @var{file}.FPP 754Fortran source code which must be preprocessed (with the traditional 755preprocessor). 756 757@item @var{file}.r 758Fortran source code which must be preprocessed with a RATFOR 759preprocessor (not included with GCC)@. 760 761@xref{Overall Options,,Options Controlling the Kind of Output, g77, 762Using and Porting GNU Fortran}, for more details of the handling of 763Fortran input files. 764 765@c FIXME: Descriptions of Java file types. 766@c @var{file}.java 767@c @var{file}.class 768@c @var{file}.zip 769@c @var{file}.jar 770 771@item @var{file}.ads 772Ada source code file which contains a library unit declaration (a 773declaration of a package, subprogram, or generic, or a generic 774instantiation), or a library unit renaming declaration (a package, 775generic, or subprogram renaming declaration). Such files are also 776called @dfn{specs}. 777 778@itemx @var{file}.adb 779Ada source code file containing a library unit body (a subprogram or 780package body). Such files are also called @dfn{bodies}. 781 782@c GCC also knows about some suffixes for languages not yet included: 783@c Pascal: 784@c @var{file}.p 785@c @var{file}.pas 786 787@item @var{file}.s 788Assembler code. 789 790@item @var{file}.S 791Assembler code which must be preprocessed. 792 793@item @var{other} 794An object file to be fed straight into linking. 795Any file name with no recognized suffix is treated this way. 796@end table 797 798@opindex x 799You can specify the input language explicitly with the @option{-x} option: 800 801@table @gcctabopt 802@item -x @var{language} 803Specify explicitly the @var{language} for the following input files 804(rather than letting the compiler choose a default based on the file 805name suffix). This option applies to all following input files until 806the next @option{-x} option. Possible values for @var{language} are: 807@example 808c c-header cpp-output 809c++ c++-cpp-output 810objective-c objc-cpp-output 811assembler assembler-with-cpp 812ada 813f77 f77-cpp-input ratfor 814java 815@end example 816 817@item -x none 818Turn off any specification of a language, so that subsequent files are 819handled according to their file name suffixes (as they are if @option{-x} 820has not been used at all). 821 822@item -pass-exit-codes 823@opindex pass-exit-codes 824Normally the @command{gcc} program will exit with the code of 1 if any 825phase of the compiler returns a non-success return code. If you specify 826@option{-pass-exit-codes}, the @command{gcc} program will instead return with 827numerically highest error produced by any phase that returned an error 828indication. 829@end table 830 831If you only want some of the stages of compilation, you can use 832@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 833one of the options @option{-c}, @option{-S}, or @option{-E} to say where 834@command{gcc} is to stop. Note that some combinations (for example, 835@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 836 837@table @gcctabopt 838@item -c 839@opindex c 840Compile or assemble the source files, but do not link. The linking 841stage simply is not done. The ultimate output is in the form of an 842object file for each source file. 843 844By default, the object file name for a source file is made by replacing 845the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 846 847Unrecognized input files, not requiring compilation or assembly, are 848ignored. 849 850@item -S 851@opindex S 852Stop after the stage of compilation proper; do not assemble. The output 853is in the form of an assembler code file for each non-assembler input 854file specified. 855 856By default, the assembler file name for a source file is made by 857replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 858 859Input files that don't require compilation are ignored. 860 861@item -E 862@opindex E 863Stop after the preprocessing stage; do not run the compiler proper. The 864output is in the form of preprocessed source code, which is sent to the 865standard output. 866 867Input files which don't require preprocessing are ignored. 868 869@cindex output file option 870@item -o @var{file} 871@opindex o 872Place output in file @var{file}. This applies regardless to whatever 873sort of output is being produced, whether it be an executable file, 874an object file, an assembler file or preprocessed C code. 875 876Since only one output file can be specified, it does not make sense to 877use @option{-o} when compiling more than one input file, unless you are 878producing an executable file as output. 879 880If @option{-o} is not specified, the default is to put an executable file 881in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in 882@file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and 883all preprocessed C source on standard output. 884 885@item -v 886@opindex v 887Print (on standard error output) the commands executed to run the stages 888of compilation. Also print the version number of the compiler driver 889program and of the preprocessor and the compiler proper. 890 891@item -### 892@opindex ### 893Like @option{-v} except the commands are not executed and all command 894arguments are quoted. This is useful for shell scripts to capture the 895driver-generated command lines. 896 897@item -pipe 898@opindex pipe 899Use pipes rather than temporary files for communication between the 900various stages of compilation. This fails to work on some systems where 901the assembler is unable to read from a pipe; but the GNU assembler has 902no trouble. 903 904@item --help 905@opindex help 906Print (on the standard output) a description of the command line options 907understood by @command{gcc}. If the @option{-v} option is also specified 908then @option{--help} will also be passed on to the various processes 909invoked by @command{gcc}, so that they can display the command line options 910they accept. If the @option{-W} option is also specified then command 911line options which have no documentation associated with them will also 912be displayed. 913 914@item --target-help 915@opindex target-help 916Print (on the standard output) a description of target specific command 917line options for each tool. 918@end table 919 920@node Invoking G++ 921@section Compiling C++ Programs 922 923@cindex suffixes for C++ source 924@cindex C++ source file suffixes 925C++ source files conventionally use one of the suffixes @samp{.C}, 926@samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx}; 927preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 928files with these names and compiles them as C++ programs even if you 929call the compiler the same way as for compiling C programs (usually with 930the name @command{gcc}). 931 932@findex g++ 933@findex c++ 934However, C++ programs often require class libraries as well as a 935compiler that understands the C++ language---and under some 936circumstances, you might want to compile programs from standard input, 937or otherwise without a suffix that flags them as C++ programs. 938@command{g++} is a program that calls GCC with the default language 939set to C++, and automatically specifies linking against the C++ 940library. On many systems, @command{g++} is also 941installed with the name @command{c++}. 942 943@cindex invoking @command{g++} 944When you compile C++ programs, you may specify many of the same 945command-line options that you use for compiling programs in any 946language; or command-line options meaningful for C and related 947languages; or options that are meaningful only for C++ programs. 948@xref{C Dialect Options,,Options Controlling C Dialect}, for 949explanations of options for languages related to C@. 950@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 951explanations of options that are meaningful only for C++ programs. 952 953@node C Dialect Options 954@section Options Controlling C Dialect 955@cindex dialect options 956@cindex language dialect options 957@cindex options, dialect 958 959The following options control the dialect of C (or languages derived 960from C, such as C++ and Objective-C) that the compiler accepts: 961 962@table @gcctabopt 963@cindex ANSI support 964@cindex ISO support 965@item -ansi 966@opindex ansi 967In C mode, support all ISO C89 programs. In C++ mode, 968remove GNU extensions that conflict with ISO C++. 969 970This turns off certain features of GCC that are incompatible with ISO 971C89 (when compiling C code), or of standard C++ (when compiling C++ code), 972such as the @code{asm} and @code{typeof} keywords, and 973predefined macros such as @code{unix} and @code{vax} that identify the 974type of system you are using. It also enables the undesirable and 975rarely used ISO trigraph feature. For the C compiler, 976it disables recognition of C++ style @samp{//} comments as well as 977the @code{inline} keyword. 978 979The alternate keywords @code{__asm__}, @code{__extension__}, 980@code{__inline__} and @code{__typeof__} continue to work despite 981@option{-ansi}. You would not want to use them in an ISO C program, of 982course, but it is useful to put them in header files that might be included 983in compilations done with @option{-ansi}. Alternate predefined macros 984such as @code{__unix__} and @code{__vax__} are also available, with or 985without @option{-ansi}. 986 987The @option{-ansi} option does not cause non-ISO programs to be 988rejected gratuitously. For that, @option{-pedantic} is required in 989addition to @option{-ansi}. @xref{Warning Options}. 990 991The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 992option is used. Some header files may notice this macro and refrain 993from declaring certain functions or defining certain macros that the 994ISO standard doesn't call for; this is to avoid interfering with any 995programs that might use these names for other things. 996 997Functions which would normally be built in but do not have semantics 998defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 999functions with @option{-ansi} is used. @xref{Other Builtins,,Other 1000built-in functions provided by GCC}, for details of the functions 1001affected. 1002 1003@item -std= 1004@opindex std 1005Determine the language standard. This option is currently only 1006supported when compiling C@. A value for this option must be provided; 1007possible values are 1008 1009@table @samp 1010@item c89 1011@itemx iso9899:1990 1012ISO C89 (same as @option{-ansi}). 1013 1014@item iso9899:199409 1015ISO C89 as modified in amendment 1. 1016 1017@item c99 1018@itemx c9x 1019@itemx iso9899:1999 1020@itemx iso9899:199x 1021ISO C99. Note that this standard is not yet fully supported; see 1022@w{@uref{http://gcc.gnu.org/gcc-3.1/c99status.html}} for more information. The 1023names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1024 1025@item gnu89 1026Default, ISO C89 plus GNU extensions (including some C99 features). 1027 1028@item gnu99 1029@item gnu9x 1030ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, 1031this will become the default. The name @samp{gnu9x} is deprecated. 1032 1033@end table 1034 1035Even when this option is not specified, you can still use some of the 1036features of newer standards in so far as they do not conflict with 1037previous C standards. For example, you may use @code{__restrict__} even 1038when @option{-std=c99} is not specified. 1039 1040The @option{-std} options specifying some version of ISO C have the same 1041effects as @option{-ansi}, except that features that were not in ISO C89 1042but are in the specified version (for example, @samp{//} comments and 1043the @code{inline} keyword in ISO C99) are not disabled. 1044 1045@xref{Standards,,Language Standards Supported by GCC}, for details of 1046these standard versions. 1047 1048@item -aux-info @var{filename} 1049@opindex aux-info 1050Output to the given filename prototyped declarations for all functions 1051declared and/or defined in a translation unit, including those in header 1052files. This option is silently ignored in any language other than C@. 1053 1054Besides declarations, the file indicates, in comments, the origin of 1055each declaration (source file and line), whether the declaration was 1056implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 1057@samp{O} for old, respectively, in the first character after the line 1058number and the colon), and whether it came from a declaration or a 1059definition (@samp{C} or @samp{F}, respectively, in the following 1060character). In the case of function definitions, a K&R-style list of 1061arguments followed by their declarations is also provided, inside 1062comments, after the declaration. 1063 1064@item -fno-asm 1065@opindex fno-asm 1066Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 1067keyword, so that code can use these words as identifiers. You can use 1068the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 1069instead. @option{-ansi} implies @option{-fno-asm}. 1070 1071In C++, this switch only affects the @code{typeof} keyword, since 1072@code{asm} and @code{inline} are standard keywords. You may want to 1073use the @option{-fno-gnu-keywords} flag instead, which has the same 1074effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 1075switch only affects the @code{asm} and @code{typeof} keywords, since 1076@code{inline} is a standard keyword in ISO C99. 1077 1078@item -fno-builtin 1079@itemx -fno-builtin-@var{function} @r{(C and Objective-C only)} 1080@opindex fno-builtin 1081@cindex built-in functions 1082Don't recognize built-in functions that do not begin with 1083@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 1084functions provided by GCC}, for details of the functions affected, 1085including those which are not built-in functions when @option{-ansi} or 1086@option{-std} options for strict ISO C conformance are used because they 1087do not have an ISO standard meaning. 1088 1089GCC normally generates special code to handle certain built-in functions 1090more efficiently; for instance, calls to @code{alloca} may become single 1091instructions that adjust the stack directly, and calls to @code{memcpy} 1092may become inline copy loops. The resulting code is often both smaller 1093and faster, but since the function calls no longer appear as such, you 1094cannot set a breakpoint on those calls, nor can you change the behavior 1095of the functions by linking with a different library. 1096 1097In C++, @option{-fno-builtin} is always in effect. The @option{-fbuiltin} 1098option has no effect. Therefore, in C++, the only way to get the 1099optimization benefits of built-in functions is to call the function 1100using the @samp{__builtin_} prefix. The GNU C++ Standard Library uses 1101built-in functions to implement many functions (like 1102@code{std::strchr}), so that you automatically get efficient code. 1103 1104With the @option{-fno-builtin-@var{function}} option, not available 1105when compiling C++, only the built-in function @var{function} is 1106disabled. @var{function} must not begin with @samp{__builtin_}. If a 1107function is named this is not built-in in this version of GCC, this 1108option is ignored. There is no corresponding 1109@option{-fbuiltin-@var{function}} option; if you wish to enable 1110built-in functions selectively when using @option{-fno-builtin} or 1111@option{-ffreestanding}, you may define macros such as: 1112 1113@smallexample 1114#define abs(n) __builtin_abs ((n)) 1115#define strcpy(d, s) __builtin_strcpy ((d), (s)) 1116@end smallexample 1117 1118@item -fhosted 1119@opindex fhosted 1120@cindex hosted environment 1121 1122Assert that compilation takes place in a hosted environment. This implies 1123@option{-fbuiltin}. A hosted environment is one in which the 1124entire standard library is available, and in which @code{main} has a return 1125type of @code{int}. Examples are nearly everything except a kernel. 1126This is equivalent to @option{-fno-freestanding}. 1127 1128@item -ffreestanding 1129@opindex ffreestanding 1130@cindex hosted environment 1131 1132Assert that compilation takes place in a freestanding environment. This 1133implies @option{-fno-builtin}. A freestanding environment 1134is one in which the standard library may not exist, and program startup may 1135not necessarily be at @code{main}. The most obvious example is an OS kernel. 1136This is equivalent to @option{-fno-hosted}. 1137 1138@xref{Standards,,Language Standards Supported by GCC}, for details of 1139freestanding and hosted environments. 1140 1141@item -trigraphs 1142@opindex trigraphs 1143Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} 1144options for strict ISO C conformance) implies @option{-trigraphs}. 1145 1146@item -no-integrated-cpp 1147@opindex no-integrated-cpp 1148Invoke the external cpp during compilation. The default is to use the 1149integrated cpp (internal cpp). This option also allows a 1150user-supplied cpp via the @option{-B} option. This flag is applicable 1151in both C and C++ modes. 1152 1153We do not guarantee to retain this option in future, and we may change 1154its semantics. 1155 1156@cindex traditional C language 1157@cindex C language, traditional 1158@item -traditional 1159@opindex traditional 1160Attempt to support some aspects of traditional C compilers. 1161Specifically: 1162 1163@itemize @bullet 1164@item 1165All @code{extern} declarations take effect globally even if they 1166are written inside of a function definition. This includes implicit 1167declarations of functions. 1168 1169@item 1170The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const} 1171and @code{volatile} are not recognized. (You can still use the 1172alternative keywords such as @code{__typeof__}, @code{__inline__}, and 1173so on.) 1174 1175@item 1176Comparisons between pointers and integers are always allowed. 1177 1178@item 1179Integer types @code{unsigned short} and @code{unsigned char} promote 1180to @code{unsigned int}. 1181 1182@item 1183Out-of-range floating point literals are not an error. 1184 1185@item 1186Certain constructs which ISO regards as a single invalid preprocessing 1187number, such as @samp{0xe-0xd}, are treated as expressions instead. 1188 1189@item 1190String ``constants'' are not necessarily constant; they are stored in 1191writable space, and identical looking constants are allocated 1192separately. (This is the same as the effect of 1193@option{-fwritable-strings}.) 1194 1195@cindex @code{longjmp} and automatic variables 1196@item 1197All automatic variables not declared @code{register} are preserved by 1198@code{longjmp}. Ordinarily, GNU C follows ISO C: automatic variables 1199not declared @code{volatile} may be clobbered. 1200 1201@item 1202@cindex @samp{\x} 1203@cindex @samp{\a} 1204@cindex escape sequences, traditional 1205The character escape sequences @samp{\x} and @samp{\a} evaluate as the 1206literal characters @samp{x} and @samp{a} respectively. Without 1207@w{@option{-traditional}}, @samp{\x} is a prefix for the hexadecimal 1208representation of a character, and @samp{\a} produces a bell. 1209@end itemize 1210 1211This option is deprecated and may be removed. 1212 1213You may wish to use @option{-fno-builtin} as well as @option{-traditional} 1214if your program uses names that are normally GNU C built-in functions for 1215other purposes of its own. 1216 1217You cannot use @option{-traditional} if you include any header files that 1218rely on ISO C features. Some vendors are starting to ship systems with 1219ISO C header files and you cannot use @option{-traditional} on such 1220systems to compile files that include any system headers. 1221 1222The @option{-traditional} option also enables @option{-traditional-cpp}. 1223 1224@item -traditional-cpp 1225@opindex traditional-cpp 1226Attempt to support some aspects of traditional C preprocessors. 1227See the GNU CPP manual for details. 1228 1229@item -fcond-mismatch 1230@opindex fcond-mismatch 1231Allow conditional expressions with mismatched types in the second and 1232third arguments. The value of such an expression is void. This option 1233is not supported for C++. 1234 1235@item -funsigned-char 1236@opindex funsigned-char 1237Let the type @code{char} be unsigned, like @code{unsigned char}. 1238 1239Each kind of machine has a default for what @code{char} should 1240be. It is either like @code{unsigned char} by default or like 1241@code{signed char} by default. 1242 1243Ideally, a portable program should always use @code{signed char} or 1244@code{unsigned char} when it depends on the signedness of an object. 1245But many programs have been written to use plain @code{char} and 1246expect it to be signed, or expect it to be unsigned, depending on the 1247machines they were written for. This option, and its inverse, let you 1248make such a program work with the opposite default. 1249 1250The type @code{char} is always a distinct type from each of 1251@code{signed char} or @code{unsigned char}, even though its behavior 1252is always just like one of those two. 1253 1254@item -fsigned-char 1255@opindex fsigned-char 1256Let the type @code{char} be signed, like @code{signed char}. 1257 1258Note that this is equivalent to @option{-fno-unsigned-char}, which is 1259the negative form of @option{-funsigned-char}. Likewise, the option 1260@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 1261 1262@item -fsigned-bitfields 1263@itemx -funsigned-bitfields 1264@itemx -fno-signed-bitfields 1265@itemx -fno-unsigned-bitfields 1266@opindex fsigned-bitfields 1267@opindex funsigned-bitfields 1268@opindex fno-signed-bitfields 1269@opindex fno-unsigned-bitfields 1270These options control whether a bit-field is signed or unsigned, when the 1271declaration does not use either @code{signed} or @code{unsigned}. By 1272default, such a bit-field is signed, because this is consistent: the 1273basic integer types such as @code{int} are signed types. 1274 1275However, when @option{-traditional} is used, bit-fields are all unsigned 1276no matter what. 1277 1278@item -fwritable-strings 1279@opindex fwritable-strings 1280Store string constants in the writable data segment and don't uniquize 1281them. This is for compatibility with old programs which assume they can 1282write into string constants. The option @option{-traditional} also has 1283this effect. 1284 1285Writing into string constants is a very bad idea; ``constants'' should 1286be constant. 1287 1288@item -fallow-single-precision 1289@opindex fallow-single-precision 1290Do not promote single precision math operations to double precision, 1291even when compiling with @option{-traditional}. 1292 1293Traditional K&R C promotes all floating point operations to double 1294precision, regardless of the sizes of the operands. On the 1295architecture for which you are compiling, single precision may be faster 1296than double precision. If you must use @option{-traditional}, but want 1297to use single precision operations when the operands are single 1298precision, use this option. This option has no effect when compiling 1299with ISO or GNU C conventions (the default). 1300 1301@item -fshort-wchar 1302@opindex fshort-wchar 1303Override the underlying type for @samp{wchar_t} to be @samp{short 1304unsigned int} instead of the default for the target. This option is 1305useful for building programs to run under WINE@. 1306@end table 1307 1308@node C++ Dialect Options 1309@section Options Controlling C++ Dialect 1310 1311@cindex compiler options, C++ 1312@cindex C++ options, command line 1313@cindex options, C++ 1314This section describes the command-line options that are only meaningful 1315for C++ programs; but you can also use most of the GNU compiler options 1316regardless of what language your program is in. For example, you 1317might compile a file @code{firstClass.C} like this: 1318 1319@example 1320g++ -g -frepo -O -c firstClass.C 1321@end example 1322 1323@noindent 1324In this example, only @option{-frepo} is an option meant 1325only for C++ programs; you can use the other options with any 1326language supported by GCC@. 1327 1328Here is a list of options that are @emph{only} for compiling C++ programs: 1329 1330@table @gcctabopt 1331@item -fno-access-control 1332@opindex fno-access-control 1333Turn off all access checking. This switch is mainly useful for working 1334around bugs in the access control code. 1335 1336@item -fcheck-new 1337@opindex fcheck-new 1338Check that the pointer returned by @code{operator new} is non-null 1339before attempting to modify the storage allocated. The current Working 1340Paper requires that @code{operator new} never return a null pointer, so 1341this check is normally unnecessary. 1342 1343An alternative to using this option is to specify that your 1344@code{operator new} does not throw any exceptions; if you declare it 1345@samp{throw()}, G++ will check the return value. See also @samp{new 1346(nothrow)}. 1347 1348@item -fconserve-space 1349@opindex fconserve-space 1350Put uninitialized or runtime-initialized global variables into the 1351common segment, as C does. This saves space in the executable at the 1352cost of not diagnosing duplicate definitions. If you compile with this 1353flag and your program mysteriously crashes after @code{main()} has 1354completed, you may have an object that is being destroyed twice because 1355two definitions were merged. 1356 1357This option is no longer useful on most targets, now that support has 1358been added for putting variables into BSS without making them common. 1359 1360@item -fno-const-strings 1361@opindex fno-const-strings 1362Give string constants type @code{char *} instead of type @code{const 1363char *}. By default, G++ uses type @code{const char *} as required by 1364the standard. Even if you use @option{-fno-const-strings}, you cannot 1365actually modify the value of a string constant, unless you also use 1366@option{-fwritable-strings}. 1367 1368This option might be removed in a future release of G++. For maximum 1369portability, you should structure your code so that it works with 1370string constants that have type @code{const char *}. 1371 1372@item -fdollars-in-identifiers 1373@opindex fdollars-in-identifiers 1374Accept @samp{$} in identifiers. You can also explicitly prohibit use of 1375@samp{$} with the option @option{-fno-dollars-in-identifiers}. (GNU C allows 1376@samp{$} by default on most target systems, but there are a few exceptions.) 1377Traditional C allowed the character @samp{$} to form part of 1378identifiers. However, ISO C and C++ forbid @samp{$} in identifiers. 1379 1380@item -fno-elide-constructors 1381@opindex fno-elide-constructors 1382The C++ standard allows an implementation to omit creating a temporary 1383which is only used to initialize another object of the same type. 1384Specifying this option disables that optimization, and forces G++ to 1385call the copy constructor in all cases. 1386 1387@item -fno-enforce-eh-specs 1388@opindex fno-enforce-eh-specs 1389Don't check for violation of exception specifications at runtime. This 1390option violates the C++ standard, but may be useful for reducing code 1391size in production builds, much like defining @samp{NDEBUG}. The compiler 1392will still optimize based on the exception specifications. 1393 1394@item -fexternal-templates 1395@opindex fexternal-templates 1396 1397Cause @samp{#pragma interface} and @samp{implementation} to apply to 1398template instantiation; template instances are emitted or not according 1399to the location of the template definition. @xref{Template 1400Instantiation}, for more information. 1401 1402This option is deprecated. 1403 1404@item -falt-external-templates 1405@opindex falt-external-templates 1406Similar to @option{-fexternal-templates}, but template instances are 1407emitted or not according to the place where they are first instantiated. 1408@xref{Template Instantiation}, for more information. 1409 1410This option is deprecated. 1411 1412@item -ffor-scope 1413@itemx -fno-for-scope 1414@opindex ffor-scope 1415@opindex fno-for-scope 1416If @option{-ffor-scope} is specified, the scope of variables declared in 1417a @i{for-init-statement} is limited to the @samp{for} loop itself, 1418as specified by the C++ standard. 1419If @option{-fno-for-scope} is specified, the scope of variables declared in 1420a @i{for-init-statement} extends to the end of the enclosing scope, 1421as was the case in old versions of G++, and other (traditional) 1422implementations of C++. 1423 1424The default if neither flag is given to follow the standard, 1425but to allow and give a warning for old-style code that would 1426otherwise be invalid, or have different behavior. 1427 1428@item -fno-gnu-keywords 1429@opindex fno-gnu-keywords 1430Do not recognize @code{typeof} as a keyword, so that code can use this 1431word as an identifier. You can use the keyword @code{__typeof__} instead. 1432@option{-ansi} implies @option{-fno-gnu-keywords}. 1433 1434@item -fno-implicit-templates 1435@opindex fno-implicit-templates 1436Never emit code for non-inline templates which are instantiated 1437implicitly (i.e.@: by use); only emit code for explicit instantiations. 1438@xref{Template Instantiation}, for more information. 1439 1440@item -fno-implicit-inline-templates 1441@opindex fno-implicit-inline-templates 1442Don't emit code for implicit instantiations of inline templates, either. 1443The default is to handle inlines differently so that compiles with and 1444without optimization will need the same set of explicit instantiations. 1445 1446@item -fno-implement-inlines 1447@opindex fno-implement-inlines 1448To save space, do not emit out-of-line copies of inline functions 1449controlled by @samp{#pragma implementation}. This will cause linker 1450errors if these functions are not inlined everywhere they are called. 1451 1452@item -fms-extensions 1453@opindex fms-extensions 1454Disable pedantic warnings about constructs used in MFC, such as implicit 1455int and getting a pointer to member function via non-standard syntax. 1456 1457@item -fno-nonansi-builtins 1458@opindex fno-nonansi-builtins 1459Disable built-in declarations of functions that are not mandated by 1460ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 1461@code{index}, @code{bzero}, @code{conjf}, and other related functions. 1462 1463@item -fno-operator-names 1464@opindex fno-operator-names 1465Do not treat the operator name keywords @code{and}, @code{bitand}, 1466@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 1467synonyms as keywords. 1468 1469@item -fno-optional-diags 1470@opindex fno-optional-diags 1471Disable diagnostics that the standard says a compiler does not need to 1472issue. Currently, the only such diagnostic issued by G++ is the one for 1473a name having multiple meanings within a class. 1474 1475@item -fpermissive 1476@opindex fpermissive 1477Downgrade messages about nonconformant code from errors to warnings. By 1478default, G++ effectively sets @option{-pedantic-errors} without 1479@option{-pedantic}; this option reverses that. This behavior and this 1480option are superseded by @option{-pedantic}, which works as it does for GNU C@. 1481 1482@item -frepo 1483@opindex frepo 1484Enable automatic template instantiation at link time. This option also 1485implies @option{-fno-implicit-templates}. @xref{Template 1486Instantiation}, for more information. 1487 1488@item -fno-rtti 1489@opindex fno-rtti 1490Disable generation of information about every class with virtual 1491functions for use by the C++ runtime type identification features 1492(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts 1493of the language, you can save some space by using this flag. Note that 1494exception handling uses the same information, but it will generate it as 1495needed. 1496 1497@item -fstats 1498@opindex fstats 1499Emit statistics about front-end processing at the end of the compilation. 1500This information is generally only useful to the G++ development team. 1501 1502@item -ftemplate-depth-@var{n} 1503@opindex ftemplate-depth 1504Set the maximum instantiation depth for template classes to @var{n}. 1505A limit on the template instantiation depth is needed to detect 1506endless recursions during template class instantiation. ANSI/ISO C++ 1507conforming programs must not rely on a maximum depth greater than 17. 1508 1509@item -fuse-cxa-atexit 1510@opindex fuse-cxa-atexit 1511Register destructors for objects with static storage duration with the 1512@code{__cxa_atexit} function rather than the @code{atexit} function. 1513This option is required for fully standards-compliant handling of static 1514destructors, but will only work if your C library supports 1515@code{__cxa_atexit}. 1516 1517@item -fvtable-gc 1518@opindex fvtable-gc 1519Emit special relocations for vtables and virtual function references 1520so that the linker can identify unused virtual functions and zero out 1521vtable slots that refer to them. This is most useful with 1522@option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to 1523also discard the functions themselves. 1524 1525This optimization requires GNU as and GNU ld. Not all systems support 1526this option. @option{-Wl,--gc-sections} is ignored without @option{-static}. 1527 1528@item -fno-weak 1529@opindex fno-weak 1530Do not use weak symbol support, even if it is provided by the linker. 1531By default, G++ will use weak symbols if they are available. This 1532option exists only for testing, and should not be used by end-users; 1533it will result in inferior code and has no benefits. This option may 1534be removed in a future release of G++. 1535 1536@item -nostdinc++ 1537@opindex nostdinc++ 1538Do not search for header files in the standard directories specific to 1539C++, but do still search the other standard directories. (This option 1540is used when building the C++ library.) 1541@end table 1542 1543In addition, these optimization, warning, and code generation options 1544have meanings only for C++ programs: 1545 1546@table @gcctabopt 1547@item -fno-default-inline 1548@opindex fno-default-inline 1549Do not assume @samp{inline} for functions defined inside a class scope. 1550@xref{Optimize Options,,Options That Control Optimization}. Note that these 1551functions will have linkage like inline functions; they just won't be 1552inlined by default. 1553 1554@item -Wabi @r{(C++ only)} 1555@opindex Wabi 1556Warn when G++ generates code that is probably not compatible with the 1557vendor-neutral C++ ABI. Although an effort has been made to warn about 1558all such cases, there are probably some cases that are not warned about, 1559even though G++ is generating incompatible code. There may also be 1560cases where warnings are emitted even though the code that is generated 1561will be compatible. 1562 1563You should rewrite your code to avoid these warnings if you are 1564concerned about the fact that code generated by G++ may not be binary 1565compatible with code generated by other compilers. 1566 1567The known incompatibilites at this point include: 1568 1569@itemize @bullet 1570 1571@item 1572Incorrect handling of tail-padding for bit-fields. G++ may attempt to 1573pack data into the same byte as a base class. For example: 1574 1575@smallexample 1576struct A @{ virtual void f(); int f1 : 1; @}; 1577struct B : public A @{ int f2 : 1; @}; 1578@end smallexample 1579 1580@noindent 1581In this case, G++ will place @code{B::f2} into the same byte 1582as@code{A::f1}; other compilers will not. You can avoid this problem 1583by explicitly padding @code{A} so that its size is a multiple of the 1584byte size on your platform; that will cause G++ and other compilers to 1585layout @code{B} identically. 1586 1587@item 1588Incorrect handling of tail-padding for virtual bases. G++ does not use 1589tail padding when laying out virtual bases. For example: 1590 1591@smallexample 1592struct A @{ virtual void f(); char c1; @}; 1593struct B @{ B(); char c2; @}; 1594struct C : public A, public virtual B @{@}; 1595@end smallexample 1596 1597@noindent 1598In this case, G++ will not place @code{B} into the tail-padding for 1599@code{A}; other compilers will. You can avoid this problem by 1600explicitly padding @code{A} so that its size is a multiple of its 1601alignment (ignoring virtual base classes); that will cause G++ and other 1602compilers to layout @code{C} identically. 1603 1604@end itemize 1605 1606@item -Wctor-dtor-privacy @r{(C++ only)} 1607@opindex Wctor-dtor-privacy 1608Warn when a class seems unusable, because all the constructors or 1609destructors in a class are private and the class has no friends or 1610public static member functions. 1611 1612@item -Wnon-virtual-dtor @r{(C++ only)} 1613@opindex Wnon-virtual-dtor 1614Warn when a class declares a non-virtual destructor that should probably 1615be virtual, because it looks like the class will be used polymorphically. 1616 1617@item -Wreorder @r{(C++ only)} 1618@opindex Wreorder 1619@cindex reordering, warning 1620@cindex warning for reordering of member initializers 1621Warn when the order of member initializers given in the code does not 1622match the order in which they must be executed. For instance: 1623 1624@smallexample 1625struct A @{ 1626 int i; 1627 int j; 1628 A(): j (0), i (1) @{ @} 1629@}; 1630@end smallexample 1631 1632Here the compiler will warn that the member initializers for @samp{i} 1633and @samp{j} will be rearranged to match the declaration order of the 1634members. 1635@end table 1636 1637The following @option{-W@dots{}} options are not affected by @option{-Wall}. 1638 1639@table @gcctabopt 1640@item -Weffc++ @r{(C++ only)} 1641@opindex Weffc++ 1642Warn about violations of the following style guidelines from Scott Meyers' 1643@cite{Effective C++} book: 1644 1645@itemize @bullet 1646@item 1647Item 11: Define a copy constructor and an assignment operator for classes 1648with dynamically allocated memory. 1649 1650@item 1651Item 12: Prefer initialization to assignment in constructors. 1652 1653@item 1654Item 14: Make destructors virtual in base classes. 1655 1656@item 1657Item 15: Have @code{operator=} return a reference to @code{*this}. 1658 1659@item 1660Item 23: Don't try to return a reference when you must return an object. 1661 1662@end itemize 1663 1664and about violations of the following style guidelines from Scott Meyers' 1665@cite{More Effective C++} book: 1666 1667@itemize @bullet 1668@item 1669Item 6: Distinguish between prefix and postfix forms of increment and 1670decrement operators. 1671 1672@item 1673Item 7: Never overload @code{&&}, @code{||}, or @code{,}. 1674 1675@end itemize 1676 1677If you use this option, you should be aware that the standard library 1678headers do not obey all of these guidelines; you can use @samp{grep -v} 1679to filter out those warnings. 1680 1681@item -Wno-deprecated @r{(C++ only)} 1682@opindex Wno-deprecated 1683Do not warn about usage of deprecated features. @xref{Deprecated Features}. 1684 1685@item -Wno-non-template-friend @r{(C++ only)} 1686@opindex Wno-non-template-friend 1687Disable warnings when non-templatized friend functions are declared 1688within a template. With the advent of explicit template specification 1689support in G++, if the name of the friend is an unqualified-id (i.e., 1690@samp{friend foo(int)}), the C++ language specification demands that the 1691friend declare or define an ordinary, nontemplate function. (Section 169214.5.3). Before G++ implemented explicit specification, unqualified-ids 1693could be interpreted as a particular specialization of a templatized 1694function. Because this non-conforming behavior is no longer the default 1695behavior for G++, @option{-Wnon-template-friend} allows the compiler to 1696check existing code for potential trouble spots, and is on by default. 1697This new compiler behavior can be turned off with 1698@option{-Wno-non-template-friend} which keeps the conformant compiler code 1699but disables the helpful warning. 1700 1701@item -Wold-style-cast @r{(C++ only)} 1702@opindex Wold-style-cast 1703Warn if an old-style (C-style) cast to a non-void type is used within 1704a C++ program. The new-style casts (@samp{static_cast}, 1705@samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to 1706unintended effects, and much easier to grep for. 1707 1708@item -Woverloaded-virtual @r{(C++ only)} 1709@opindex Woverloaded-virtual 1710@cindex overloaded virtual fn, warning 1711@cindex warning for overloaded virtual fn 1712Warn when a function declaration hides virtual functions from a 1713base class. For example, in: 1714 1715@smallexample 1716struct A @{ 1717 virtual void f(); 1718@}; 1719 1720struct B: public A @{ 1721 void f(int); 1722@}; 1723@end smallexample 1724 1725the @code{A} class version of @code{f} is hidden in @code{B}, and code 1726like this: 1727 1728@smallexample 1729B* b; 1730b->f(); 1731@end smallexample 1732 1733will fail to compile. 1734 1735@item -Wno-pmf-conversions @r{(C++ only)} 1736@opindex Wno-pmf-conversions 1737Disable the diagnostic for converting a bound pointer to member function 1738to a plain pointer. 1739 1740@item -Wsign-promo @r{(C++ only)} 1741@opindex Wsign-promo 1742Warn when overload resolution chooses a promotion from unsigned or 1743enumeral type to a signed type over a conversion to an unsigned type of 1744the same size. Previous versions of G++ would try to preserve 1745unsignedness, but the standard mandates the current behavior. 1746 1747@item -Wsynth @r{(C++ only)} 1748@opindex Wsynth 1749@cindex warning for synthesized methods 1750@cindex synthesized methods, warning 1751Warn when G++'s synthesis behavior does not match that of cfront. For 1752instance: 1753 1754@smallexample 1755struct A @{ 1756 operator int (); 1757 A& operator = (int); 1758@}; 1759 1760main () 1761@{ 1762 A a,b; 1763 a = b; 1764@} 1765@end smallexample 1766 1767In this example, G++ will synthesize a default @samp{A& operator = 1768(const A&);}, while cfront will use the user-defined @samp{operator =}. 1769@end table 1770 1771@node Objective-C Dialect Options 1772@section Options Controlling Objective-C Dialect 1773 1774@cindex compiler options, Objective-C 1775@cindex Objective-C options, command line 1776@cindex options, Objective-C 1777This section describes the command-line options that are only meaningful 1778for Objective-C programs; but you can also use most of the GNU compiler 1779options regardless of what language your program is in. For example, 1780you might compile a file @code{some_class.m} like this: 1781 1782@example 1783gcc -g -fgnu-runtime -O -c some_class.m 1784@end example 1785 1786@noindent 1787In this example, only @option{-fgnu-runtime} is an option meant only for 1788Objective-C programs; you can use the other options with any language 1789supported by GCC@. 1790 1791Here is a list of options that are @emph{only} for compiling Objective-C 1792programs: 1793 1794@table @gcctabopt 1795@item -fconstant-string-class=@var{class-name} 1796@opindex fconstant-string-class 1797Use @var{class-name} as the name of the class to instantiate for each 1798literal string specified with the syntax @code{@@"@dots{}"}. The default 1799class name is @code{NXConstantString}. 1800 1801@item -fgnu-runtime 1802@opindex fgnu-runtime 1803Generate object code compatible with the standard GNU Objective-C 1804runtime. This is the default for most types of systems. 1805 1806@item -fnext-runtime 1807@opindex fnext-runtime 1808Generate output compatible with the NeXT runtime. This is the default 1809for NeXT-based systems, including Darwin and Mac OS X@. 1810 1811@item -gen-decls 1812@opindex gen-decls 1813Dump interface declarations for all classes seen in the source file to a 1814file named @file{@var{sourcename}.decl}. 1815 1816@item -Wno-protocol 1817@opindex Wno-protocol 1818Do not warn if methods required by a protocol are not implemented 1819in the class adopting it. 1820 1821@item -Wselector 1822@opindex Wselector 1823Warn if a selector has multiple methods of different types defined. 1824 1825@c not documented because only avail via -Wp 1826@c @item -print-objc-runtime-info 1827 1828@end table 1829 1830@node Language Independent Options 1831@section Options to Control Diagnostic Messages Formatting 1832@cindex options to control diagnostics formatting 1833@cindex diagnostic messages 1834@cindex message formatting 1835 1836Traditionally, diagnostic messages have been formatted irrespective of 1837the output device's aspect (e.g.@: its width, @dots{}). The options described 1838below can be used to control the diagnostic messages formatting 1839algorithm, e.g.@: how many characters per line, how often source location 1840information should be reported. Right now, only the C++ front end can 1841honor these options. However it is expected, in the near future, that 1842the remaining front ends would be able to digest them correctly. 1843 1844@table @gcctabopt 1845@item -fmessage-length=@var{n} 1846@opindex fmessage-length 1847Try to format error messages so that they fit on lines of about @var{n} 1848characters. The default is 72 characters for @command{g++} and 0 for the rest of 1849the front ends supported by GCC@. If @var{n} is zero, then no 1850line-wrapping will be done; each error message will appear on a single 1851line. 1852 1853@opindex fdiagnostics-show-location 1854@item -fdiagnostics-show-location=once 1855Only meaningful in line-wrapping mode. Instructs the diagnostic messages 1856reporter to emit @emph{once} source location information; that is, in 1857case the message is too long to fit on a single physical line and has to 1858be wrapped, the source location won't be emitted (as prefix) again, 1859over and over, in subsequent continuation lines. This is the default 1860behavior. 1861 1862@item -fdiagnostics-show-location=every-line 1863Only meaningful in line-wrapping mode. Instructs the diagnostic 1864messages reporter to emit the same source location information (as 1865prefix) for physical lines that result from the process of breaking 1866a message which is too long to fit on a single line. 1867 1868@end table 1869 1870@node Warning Options 1871@section Options to Request or Suppress Warnings 1872@cindex options to control warnings 1873@cindex warning messages 1874@cindex messages, warning 1875@cindex suppressing warnings 1876 1877Warnings are diagnostic messages that report constructions which 1878are not inherently erroneous but which are risky or suggest there 1879may have been an error. 1880 1881You can request many specific warnings with options beginning @samp{-W}, 1882for example @option{-Wimplicit} to request warnings on implicit 1883declarations. Each of these specific warning options also has a 1884negative form beginning @samp{-Wno-} to turn off warnings; 1885for example, @option{-Wno-implicit}. This manual lists only one of the 1886two forms, whichever is not the default. 1887 1888The following options control the amount and kinds of warnings produced 1889by GCC; for further, language-specific options also refer to 1890@ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}. 1891 1892@table @gcctabopt 1893@cindex syntax checking 1894@item -fsyntax-only 1895@opindex fsyntax-only 1896Check the code for syntax errors, but don't do anything beyond that. 1897 1898@item -pedantic 1899@opindex pedantic 1900Issue all the warnings demanded by strict ISO C and ISO C++; 1901reject all programs that use forbidden extensions, and some other 1902programs that do not follow ISO C and ISO C++. For ISO C, follows the 1903version of the ISO C standard specified by any @option{-std} option used. 1904 1905Valid ISO C and ISO C++ programs should compile properly with or without 1906this option (though a rare few will require @option{-ansi} or a 1907@option{-std} option specifying the required version of ISO C)@. However, 1908without this option, certain GNU extensions and traditional C and C++ 1909features are supported as well. With this option, they are rejected. 1910 1911@option{-pedantic} does not cause warning messages for use of the 1912alternate keywords whose names begin and end with @samp{__}. Pedantic 1913warnings are also disabled in the expression that follows 1914@code{__extension__}. However, only system header files should use 1915these escape routes; application programs should avoid them. 1916@xref{Alternate Keywords}. 1917 1918Some users try to use @option{-pedantic} to check programs for strict ISO 1919C conformance. They soon find that it does not do quite what they want: 1920it finds some non-ISO practices, but not all---only those for which 1921ISO C @emph{requires} a diagnostic, and some others for which 1922diagnostics have been added. 1923 1924A feature to report any failure to conform to ISO C might be useful in 1925some instances, but would require considerable additional work and would 1926be quite different from @option{-pedantic}. We don't have plans to 1927support such a feature in the near future. 1928 1929Where the standard specified with @option{-std} represents a GNU 1930extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a 1931corresponding @dfn{base standard}, the version of ISO C on which the GNU 1932extended dialect is based. Warnings from @option{-pedantic} are given 1933where they are required by the base standard. (It would not make sense 1934for such warnings to be given only for features not in the specified GNU 1935C dialect, since by definition the GNU dialects of C include all 1936features the compiler supports with the given option, and there would be 1937nothing to warn about.) 1938 1939@item -pedantic-errors 1940@opindex pedantic-errors 1941Like @option{-pedantic}, except that errors are produced rather than 1942warnings. 1943 1944@item -w 1945@opindex w 1946Inhibit all warning messages. 1947 1948@item -Wno-import 1949@opindex Wno-import 1950Inhibit warning messages about the use of @samp{#import}. 1951 1952@item -Wchar-subscripts 1953@opindex Wchar-subscripts 1954Warn if an array subscript has type @code{char}. This is a common cause 1955of error, as programmers often forget that this type is signed on some 1956machines. 1957 1958@item -Wcomment 1959@opindex Wcomment 1960Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 1961comment, or whenever a Backslash-Newline appears in a @samp{//} comment. 1962 1963@item -Wformat 1964@opindex Wformat 1965Check calls to @code{printf} and @code{scanf}, etc., to make sure that 1966the arguments supplied have types appropriate to the format string 1967specified, and that the conversions specified in the format string make 1968sense. This includes standard functions, and others specified by format 1969attributes (@pxref{Function Attributes}), in the @code{printf}, 1970@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 1971not in the C standard) families. 1972 1973The formats are checked against the format features supported by GNU 1974libc version 2.2. These include all ISO C89 and C99 features, as well 1975as features from the Single Unix Specification and some BSD and GNU 1976extensions. Other library implementations may not support all these 1977features; GCC does not support warning about features that go beyond a 1978particular library's limitations. However, if @option{-pedantic} is used 1979with @option{-Wformat}, warnings will be given about format features not 1980in the selected standard version (but not for @code{strfmon} formats, 1981since those are not in any version of the C standard). @xref{C Dialect 1982Options,,Options Controlling C Dialect}. 1983 1984@option{-Wformat} is included in @option{-Wall}. For more control over some 1985aspects of format checking, the options @option{-Wno-format-y2k}, 1986@option{-Wno-format-extra-args}, @option{-Wformat-nonliteral}, 1987@option{-Wformat-security} and @option{-Wformat=2} are available, but are 1988not included in @option{-Wall}. 1989 1990@item -Wno-format-y2k 1991@opindex Wno-format-y2k 1992If @option{-Wformat} is specified, do not warn about @code{strftime} 1993formats which may yield only a two-digit year. 1994 1995@item -Wno-format-extra-args 1996@opindex Wno-format-extra-args 1997If @option{-Wformat} is specified, do not warn about excess arguments to a 1998@code{printf} or @code{scanf} format function. The C standard specifies 1999that such arguments are ignored. 2000 2001Where the unused arguments lie between used arguments that are 2002specified with @samp{$} operand number specifications, normally 2003warnings are still given, since the implementation could not know what 2004type to pass to @code{va_arg} to skip the unused arguments. However, 2005in the case of @code{scanf} formats, this option will suppress the 2006warning if the unused arguments are all pointers, since the Single 2007Unix Specification says that such unused arguments are allowed. 2008 2009@item -Wformat-nonliteral 2010@opindex Wformat-nonliteral 2011If @option{-Wformat} is specified, also warn if the format string is not a 2012string literal and so cannot be checked, unless the format function 2013takes its format arguments as a @code{va_list}. 2014 2015@item -Wformat-security 2016@opindex Wformat-security 2017If @option{-Wformat} is specified, also warn about uses of format 2018functions that represent possible security problems. At present, this 2019warns about calls to @code{printf} and @code{scanf} functions where the 2020format string is not a string literal and there are no format arguments, 2021as in @code{printf (foo);}. This may be a security hole if the format 2022string came from untrusted input and contains @samp{%n}. (This is 2023currently a subset of what @option{-Wformat-nonliteral} warns about, but 2024in future warnings may be added to @option{-Wformat-security} that are not 2025included in @option{-Wformat-nonliteral}.) 2026 2027@item -Wformat=2 2028@opindex Wformat=2 2029Enable @option{-Wformat} plus format checks not included in 2030@option{-Wformat}. Currently equivalent to @samp{-Wformat 2031-Wformat-nonliteral -Wformat-security}. 2032 2033@item -Wimplicit-int 2034@opindex Wimplicit-int 2035Warn when a declaration does not specify a type. 2036 2037@item -Wimplicit-function-declaration 2038@itemx -Werror-implicit-function-declaration 2039@opindex Wimplicit-function-declaration 2040@opindex Werror-implicit-function-declaration 2041Give a warning (or error) whenever a function is used before being 2042declared. 2043 2044@item -Wimplicit 2045@opindex Wimplicit 2046Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 2047 2048@item -Wmain 2049@opindex Wmain 2050Warn if the type of @samp{main} is suspicious. @samp{main} should be a 2051function with external linkage, returning int, taking either zero 2052arguments, two, or three arguments of appropriate types. 2053 2054@item -Wmissing-braces 2055@opindex Wmissing-braces 2056Warn if an aggregate or union initializer is not fully bracketed. In 2057the following example, the initializer for @samp{a} is not fully 2058bracketed, but that for @samp{b} is fully bracketed. 2059 2060@smallexample 2061int a[2][2] = @{ 0, 1, 2, 3 @}; 2062int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 2063@end smallexample 2064 2065@item -Wparentheses 2066@opindex Wparentheses 2067Warn if parentheses are omitted in certain contexts, such 2068as when there is an assignment in a context where a truth value 2069is expected, or when operators are nested whose precedence people 2070often get confused about. 2071 2072Also warn about constructions where there may be confusion to which 2073@code{if} statement an @code{else} branch belongs. Here is an example of 2074such a case: 2075 2076@smallexample 2077@group 2078@{ 2079 if (a) 2080 if (b) 2081 foo (); 2082 else 2083 bar (); 2084@} 2085@end group 2086@end smallexample 2087 2088In C, every @code{else} branch belongs to the innermost possible @code{if} 2089statement, which in this example is @code{if (b)}. This is often not 2090what the programmer expected, as illustrated in the above example by 2091indentation the programmer chose. When there is the potential for this 2092confusion, GCC will issue a warning when this flag is specified. 2093To eliminate the warning, add explicit braces around the innermost 2094@code{if} statement so there is no way the @code{else} could belong to 2095the enclosing @code{if}. The resulting code would look like this: 2096 2097@smallexample 2098@group 2099@{ 2100 if (a) 2101 @{ 2102 if (b) 2103 foo (); 2104 else 2105 bar (); 2106 @} 2107@} 2108@end group 2109@end smallexample 2110 2111@item -Wsequence-point 2112@opindex Wsequence-point 2113Warn about code that may have undefined semantics because of violations 2114of sequence point rules in the C standard. 2115 2116The C standard defines the order in which expressions in a C program are 2117evaluated in terms of @dfn{sequence points}, which represent a partial 2118ordering between the execution of parts of the program: those executed 2119before the sequence point, and those executed after it. These occur 2120after the evaluation of a full expression (one which is not part of a 2121larger expression), after the evaluation of the first operand of a 2122@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 2123function is called (but after the evaluation of its arguments and the 2124expression denoting the called function), and in certain other places. 2125Other than as expressed by the sequence point rules, the order of 2126evaluation of subexpressions of an expression is not specified. All 2127these rules describe only a partial order rather than a total order, 2128since, for example, if two functions are called within one expression 2129with no sequence point between them, the order in which the functions 2130are called is not specified. However, the standards committee have 2131ruled that function calls do not overlap. 2132 2133It is not specified when between sequence points modifications to the 2134values of objects take effect. Programs whose behavior depends on this 2135have undefined behavior; the C standard specifies that ``Between the 2136previous and next sequence point an object shall have its stored value 2137modified at most once by the evaluation of an expression. Furthermore, 2138the prior value shall be read only to determine the value to be 2139stored.''. If a program breaks these rules, the results on any 2140particular implementation are entirely unpredictable. 2141 2142Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 2143= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 2144diagnosed by this option, and it may give an occasional false positive 2145result, but in general it has been found fairly effective at detecting 2146this sort of problem in programs. 2147 2148The present implementation of this option only works for C programs. A 2149future implementation may also work for C++ programs. 2150 2151The C standard is worded confusingly, therefore there is some debate 2152over the precise meaning of the sequence point rules in subtle cases. 2153Links to discussions of the problem, including proposed formal 2154definitions, may be found on our readings page, at 2155@w{@uref{http://gcc.gnu.org/readings.html}}. 2156 2157@item -Wreturn-type 2158@opindex Wreturn-type 2159Warn whenever a function is defined with a return-type that defaults to 2160@code{int}. Also warn about any @code{return} statement with no 2161return-value in a function whose return-type is not @code{void}. 2162 2163For C++, a function without return type always produces a diagnostic 2164message, even when @option{-Wno-return-type} is specified. The only 2165exceptions are @samp{main} and functions defined in system headers. 2166 2167@item -Wswitch 2168@opindex Wswitch 2169Warn whenever a @code{switch} statement has an index of enumeral type 2170and lacks a @code{case} for one or more of the named codes of that 2171enumeration. (The presence of a @code{default} label prevents this 2172warning.) @code{case} labels outside the enumeration range also 2173provoke warnings when this option is used. 2174 2175@item -Wtrigraphs 2176@opindex Wtrigraphs 2177Warn if any trigraphs are encountered that might change the meaning of 2178the program (trigraphs within comments are not warned about). 2179 2180@item -Wunused-function 2181@opindex Wunused-function 2182Warn whenever a static function is declared but not defined or a 2183non\-inline static function is unused. 2184 2185@item -Wunused-label 2186@opindex Wunused-label 2187Warn whenever a label is declared but not used. 2188 2189To suppress this warning use the @samp{unused} attribute 2190(@pxref{Variable Attributes}). 2191 2192@item -Wunused-parameter 2193@opindex Wunused-parameter 2194Warn whenever a function parameter is unused aside from its declaration. 2195 2196To suppress this warning use the @samp{unused} attribute 2197(@pxref{Variable Attributes}). 2198 2199@item -Wunused-variable 2200@opindex Wunused-variable 2201Warn whenever a local variable or non-constant static variable is unused 2202aside from its declaration 2203 2204To suppress this warning use the @samp{unused} attribute 2205(@pxref{Variable Attributes}). 2206 2207@item -Wunused-value 2208@opindex Wunused-value 2209Warn whenever a statement computes a result that is explicitly not used. 2210 2211To suppress this warning cast the expression to @samp{void}. 2212 2213@item -Wunused 2214@opindex Wunused 2215All all the above @option{-Wunused} options combined. 2216 2217In order to get a warning about an unused function parameter, you must 2218either specify @samp{-W -Wunused} or separately specify 2219@option{-Wunused-parameter}. 2220 2221@item -Wuninitialized 2222@opindex Wuninitialized 2223Warn if an automatic variable is used without first being initialized or 2224if a variable may be clobbered by a @code{setjmp} call. 2225 2226These warnings are possible only in optimizing compilation, 2227because they require data flow information that is computed only 2228when optimizing. If you don't specify @option{-O}, you simply won't 2229get these warnings. 2230 2231These warnings occur only for variables that are candidates for 2232register allocation. Therefore, they do not occur for a variable that 2233is declared @code{volatile}, or whose address is taken, or whose size 2234is other than 1, 2, 4 or 8 bytes. Also, they do not occur for 2235structures, unions or arrays, even when they are in registers. 2236 2237Note that there may be no warning about a variable that is used only 2238to compute a value that itself is never used, because such 2239computations may be deleted by data flow analysis before the warnings 2240are printed. 2241 2242These warnings are made optional because GCC is not smart 2243enough to see all the reasons why the code might be correct 2244despite appearing to have an error. Here is one example of how 2245this can happen: 2246 2247@smallexample 2248@group 2249@{ 2250 int x; 2251 switch (y) 2252 @{ 2253 case 1: x = 1; 2254 break; 2255 case 2: x = 4; 2256 break; 2257 case 3: x = 5; 2258 @} 2259 foo (x); 2260@} 2261@end group 2262@end smallexample 2263 2264@noindent 2265If the value of @code{y} is always 1, 2 or 3, then @code{x} is 2266always initialized, but GCC doesn't know this. Here is 2267another common case: 2268 2269@smallexample 2270@{ 2271 int save_y; 2272 if (change_y) save_y = y, y = new_y; 2273 @dots{} 2274 if (change_y) y = save_y; 2275@} 2276@end smallexample 2277 2278@noindent 2279This has no bug because @code{save_y} is used only if it is set. 2280 2281@cindex @code{longjmp} warnings 2282This option also warns when a non-volatile automatic variable might be 2283changed by a call to @code{longjmp}. These warnings as well are possible 2284only in optimizing compilation. 2285 2286The compiler sees only the calls to @code{setjmp}. It cannot know 2287where @code{longjmp} will be called; in fact, a signal handler could 2288call it at any point in the code. As a result, you may get a warning 2289even when there is in fact no problem because @code{longjmp} cannot 2290in fact be called at the place which would cause a problem. 2291 2292Some spurious warnings can be avoided if you declare all the functions 2293you use that never return as @code{noreturn}. @xref{Function 2294Attributes}. 2295 2296@item -Wreorder @r{(C++ only)} 2297@opindex Wreorder 2298@cindex reordering, warning 2299@cindex warning for reordering of member initializers 2300Warn when the order of member initializers given in the code does not 2301match the order in which they must be executed. For instance: 2302 2303@item -Wunknown-pragmas 2304@opindex Wunknown-pragmas 2305@cindex warning for unknown pragmas 2306@cindex unknown pragmas, warning 2307@cindex pragmas, warning of unknown 2308Warn when a #pragma directive is encountered which is not understood by 2309GCC@. If this command line option is used, warnings will even be issued 2310for unknown pragmas in system header files. This is not the case if 2311the warnings were only enabled by the @option{-Wall} command line option. 2312 2313@item -Wall 2314@opindex Wall 2315All of the above @samp{-W} options combined. This enables all the 2316warnings about constructions that some users consider questionable, and 2317that are easy to avoid (or modify to prevent the warning), even in 2318conjunction with macros. 2319 2320@item -Wdiv-by-zero 2321@opindex Wno-div-by-zero 2322@opindex Wdiv-by-zero 2323Warn about compile-time integer division by zero. This is default. To 2324inhibit the warning messages, use @option{-Wno-div-by-zero}. Floating 2325point division by zero is not warned about, as it can be a legitimate 2326way of obtaining infinities and NaNs. 2327 2328@item -Wmultichar 2329@opindex Wno-multichar 2330@opindex Wmultichar 2331Warn if a multicharacter constant (@samp{'FOOF'}) is used. This is 2332default. To inhibit the warning messages, use @option{-Wno-multichar}. 2333Usually they indicate a typo in the user's code, as they have 2334implementation-defined values, and should not be used in portable code. 2335 2336@item -Wsystem-headers 2337@opindex Wsystem-headers 2338@cindex warnings from system headers 2339@cindex system headers, warnings from 2340Print warning messages for constructs found in system header files. 2341Warnings from system headers are normally suppressed, on the assumption 2342that they usually do not indicate real problems and would only make the 2343compiler output harder to read. Using this command line option tells 2344GCC to emit warnings from system headers as if they occurred in user 2345code. However, note that using @option{-Wall} in conjunction with this 2346option will @emph{not} warn about unknown pragmas in system 2347headers---for that, @option{-Wunknown-pragmas} must also be used. 2348@end table 2349 2350The following @option{-W@dots{}} options are not implied by @option{-Wall}. 2351Some of them warn about constructions that users generally do not 2352consider questionable, but which occasionally you might wish to check 2353for; others warn about constructions that are necessary or hard to avoid 2354in some cases, and there is no simple way to modify the code to suppress 2355the warning. 2356 2357@table @gcctabopt 2358@item -W 2359@opindex W 2360Print extra warning messages for these events: 2361 2362@itemize @bullet 2363@item 2364A function can return either with or without a value. (Falling 2365off the end of the function body is considered returning without 2366a value.) For example, this function would evoke such a 2367warning: 2368 2369@smallexample 2370@group 2371foo (a) 2372@{ 2373 if (a > 0) 2374 return a; 2375@} 2376@end group 2377@end smallexample 2378 2379@item 2380An expression-statement or the left-hand side of a comma expression 2381contains no side effects. 2382To suppress the warning, cast the unused expression to void. 2383For example, an expression such as @samp{x[i,j]} will cause a warning, 2384but @samp{x[(void)i,j]} will not. 2385 2386@item 2387An unsigned value is compared against zero with @samp{<} or @samp{<=}. 2388 2389@item 2390A comparison like @samp{x<=y<=z} appears; this is equivalent to 2391@samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from 2392that of ordinary mathematical notation. 2393 2394@item 2395Storage-class specifiers like @code{static} are not the first things in 2396a declaration. According to the C Standard, this usage is obsolescent. 2397 2398@item 2399The return type of a function has a type qualifier such as @code{const}. 2400Such a type qualifier has no effect, since the value returned by a 2401function is not an lvalue. (But don't warn about the GNU extension of 2402@code{volatile void} return types. That extension will be warned about 2403if @option{-pedantic} is specified.) 2404 2405@item 2406If @option{-Wall} or @option{-Wunused} is also specified, warn about unused 2407arguments. 2408 2409@item 2410A comparison between signed and unsigned values could produce an 2411incorrect result when the signed value is converted to unsigned. 2412(But don't warn if @option{-Wno-sign-compare} is also specified.) 2413 2414@item 2415An aggregate has a partly bracketed initializer. 2416For example, the following code would evoke such a warning, 2417because braces are missing around the initializer for @code{x.h}: 2418 2419@smallexample 2420struct s @{ int f, g; @}; 2421struct t @{ struct s h; int i; @}; 2422struct t x = @{ 1, 2, 3 @}; 2423@end smallexample 2424 2425@item 2426An aggregate has an initializer which does not initialize all members. 2427For example, the following code would cause such a warning, because 2428@code{x.h} would be implicitly initialized to zero: 2429 2430@smallexample 2431struct s @{ int f, g, h; @}; 2432struct s x = @{ 3, 4 @}; 2433@end smallexample 2434@end itemize 2435 2436@item -Wfloat-equal 2437@opindex Wfloat-equal 2438Warn if floating point values are used in equality comparisons. 2439 2440The idea behind this is that sometimes it is convenient (for the 2441programmer) to consider floating-point values as approximations to 2442infinitely precise real numbers. If you are doing this, then you need 2443to compute (by analysing the code, or in some other way) the maximum or 2444likely maximum error that the computation introduces, and allow for it 2445when performing comparisons (and when producing output, but that's a 2446different problem). In particular, instead of testing for equality, you 2447would check to see whether the two values have ranges that overlap; and 2448this is done with the relational operators, so equality comparisons are 2449probably mistaken. 2450 2451@item -Wtraditional @r{(C only)} 2452@opindex Wtraditional 2453Warn about certain constructs that behave differently in traditional and 2454ISO C@. Also warn about ISO C constructs that have no traditional C 2455equivalent, and/or problematic constructs which should be avoided. 2456 2457@itemize @bullet 2458@item 2459Macro parameters that appear within string literals in the macro body. 2460In traditional C macro replacement takes place within string literals, 2461but does not in ISO C@. 2462 2463@item 2464In traditional C, some preprocessor directives did not exist. 2465Traditional preprocessors would only consider a line to be a directive 2466if the @samp{#} appeared in column 1 on the line. Therefore 2467@option{-Wtraditional} warns about directives that traditional C 2468understands but would ignore because the @samp{#} does not appear as the 2469first character on the line. It also suggests you hide directives like 2470@samp{#pragma} not understood by traditional C by indenting them. Some 2471traditional implementations would not recognize @samp{#elif}, so it 2472suggests avoiding it altogether. 2473 2474@item 2475A function-like macro that appears without arguments. 2476 2477@item 2478The unary plus operator. 2479 2480@item 2481The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point 2482constant suffixes. (Traditional C does support the @samp{L} suffix on integer 2483constants.) Note, these suffixes appear in macros defined in the system 2484headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 2485Use of these macros in user code might normally lead to spurious 2486warnings, however gcc's integrated preprocessor has enough context to 2487avoid warning in these cases. 2488 2489@item 2490A function declared external in one block and then used after the end of 2491the block. 2492 2493@item 2494A @code{switch} statement has an operand of type @code{long}. 2495 2496@item 2497A non-@code{static} function declaration follows a @code{static} one. 2498This construct is not accepted by some traditional C compilers. 2499 2500@item 2501The ISO type of an integer constant has a different width or 2502signedness from its traditional type. This warning is only issued if 2503the base of the constant is ten. I.e.@: hexadecimal or octal values, which 2504typically represent bit patterns, are not warned about. 2505 2506@item 2507Usage of ISO string concatenation is detected. 2508 2509@item 2510Initialization of automatic aggregates. 2511 2512@item 2513Identifier conflicts with labels. Traditional C lacks a separate 2514namespace for labels. 2515 2516@item 2517Initialization of unions. If the initializer is zero, the warning is 2518omitted. This is done under the assumption that the zero initializer in 2519user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 2520initializer warnings and relies on default initialization to zero in the 2521traditional C case. 2522 2523@item 2524Conversions by prototypes between fixed/floating point values and vice 2525versa. The absence of these prototypes when compiling with traditional 2526C would cause serious problems. This is a subset of the possible 2527conversion warnings, for the full set use @option{-Wconversion}. 2528@end itemize 2529 2530@item -Wundef 2531@opindex Wundef 2532Warn if an undefined identifier is evaluated in an @samp{#if} directive. 2533 2534@item -Wshadow 2535@opindex Wshadow 2536Warn whenever a local variable shadows another local variable, parameter or 2537global variable or whenever a built-in function is shadowed. 2538 2539@item -Wlarger-than-@var{len} 2540@opindex Wlarger-than 2541Warn whenever an object of larger than @var{len} bytes is defined. 2542 2543@item -Wpointer-arith 2544@opindex Wpointer-arith 2545Warn about anything that depends on the ``size of'' a function type or 2546of @code{void}. GNU C assigns these types a size of 1, for 2547convenience in calculations with @code{void *} pointers and pointers 2548to functions. 2549 2550@item -Wbad-function-cast @r{(C only)} 2551@opindex Wbad-function-cast 2552Warn whenever a function call is cast to a non-matching type. 2553For example, warn if @code{int malloc()} is cast to @code{anything *}. 2554 2555@item -Wcast-qual 2556@opindex Wcast-qual 2557Warn whenever a pointer is cast so as to remove a type qualifier from 2558the target type. For example, warn if a @code{const char *} is cast 2559to an ordinary @code{char *}. 2560 2561@item -Wcast-align 2562@opindex Wcast-align 2563Warn whenever a pointer is cast such that the required alignment of the 2564target is increased. For example, warn if a @code{char *} is cast to 2565an @code{int *} on machines where integers can only be accessed at 2566two- or four-byte boundaries. 2567 2568@item -Wwrite-strings 2569@opindex Wwrite-strings 2570When compiling C, give string constants the type @code{const 2571char[@var{length}]} so that 2572copying the address of one into a non-@code{const} @code{char *} 2573pointer will get a warning; when compiling C++, warn about the 2574deprecated conversion from string constants to @code{char *}. 2575These warnings will help you find at 2576compile time code that can try to write into a string constant, but 2577only if you have been very careful about using @code{const} in 2578declarations and prototypes. Otherwise, it will just be a nuisance; 2579this is why we did not make @option{-Wall} request these warnings. 2580 2581@item -Wconversion 2582@opindex Wconversion 2583Warn if a prototype causes a type conversion that is different from what 2584would happen to the same argument in the absence of a prototype. This 2585includes conversions of fixed point to floating and vice versa, and 2586conversions changing the width or signedness of a fixed point argument 2587except when the same as the default promotion. 2588 2589Also, warn if a negative integer constant expression is implicitly 2590converted to an unsigned type. For example, warn about the assignment 2591@code{x = -1} if @code{x} is unsigned. But do not warn about explicit 2592casts like @code{(unsigned) -1}. 2593 2594@item -Wsign-compare 2595@opindex Wsign-compare 2596@cindex warning for comparison of signed and unsigned values 2597@cindex comparison of signed and unsigned values, warning 2598@cindex signed and unsigned values, comparison warning 2599Warn when a comparison between signed and unsigned values could produce 2600an incorrect result when the signed value is converted to unsigned. 2601This warning is also enabled by @option{-W}; to get the other warnings 2602of @option{-W} without this warning, use @samp{-W -Wno-sign-compare}. 2603 2604@item -Waggregate-return 2605@opindex Waggregate-return 2606Warn if any functions that return structures or unions are defined or 2607called. (In languages where you can return an array, this also elicits 2608a warning.) 2609 2610@item -Wstrict-prototypes @r{(C only)} 2611@opindex Wstrict-prototypes 2612Warn if a function is declared or defined without specifying the 2613argument types. (An old-style function definition is permitted without 2614a warning if preceded by a declaration which specifies the argument 2615types.) 2616 2617@item -Wmissing-prototypes @r{(C only)} 2618@opindex Wmissing-prototypes 2619Warn if a global function is defined without a previous prototype 2620declaration. This warning is issued even if the definition itself 2621provides a prototype. The aim is to detect global functions that fail 2622to be declared in header files. 2623 2624@item -Wmissing-declarations 2625@opindex Wmissing-declarations 2626Warn if a global function is defined without a previous declaration. 2627Do so even if the definition itself provides a prototype. 2628Use this option to detect global functions that are not declared in 2629header files. 2630 2631@item -Wmissing-noreturn 2632@opindex Wmissing-noreturn 2633Warn about functions which might be candidates for attribute @code{noreturn}. 2634Note these are only possible candidates, not absolute ones. Care should 2635be taken to manually verify functions actually do not ever return before 2636adding the @code{noreturn} attribute, otherwise subtle code generation 2637bugs could be introduced. You will not get a warning for @code{main} in 2638hosted C environments. 2639 2640@item -Wmissing-format-attribute 2641@opindex Wmissing-format-attribute 2642@opindex Wformat 2643If @option{-Wformat} is enabled, also warn about functions which might be 2644candidates for @code{format} attributes. Note these are only possible 2645candidates, not absolute ones. GCC will guess that @code{format} 2646attributes might be appropriate for any function that calls a function 2647like @code{vprintf} or @code{vscanf}, but this might not always be the 2648case, and some functions for which @code{format} attributes are 2649appropriate may not be detected. This option has no effect unless 2650@option{-Wformat} is enabled (possibly by @option{-Wall}). 2651 2652@item -Wno-deprecated-declarations 2653@opindex Wno-deprecated-declarations 2654Do not warn about uses of functions, variables, and types marked as 2655deprecated by using the @code{deprecated} attribute. 2656(@pxref{Function Attributes}, @pxref{Variable Attributes}, 2657@pxref{Type Attributes}.) 2658 2659@item -Wpacked 2660@opindex Wpacked 2661Warn if a structure is given the packed attribute, but the packed 2662attribute has no effect on the layout or size of the structure. 2663Such structures may be mis-aligned for little benefit. For 2664instance, in this code, the variable @code{f.x} in @code{struct bar} 2665will be misaligned even though @code{struct bar} does not itself 2666have the packed attribute: 2667 2668@smallexample 2669@group 2670struct foo @{ 2671 int x; 2672 char a, b, c, d; 2673@} __attribute__((packed)); 2674struct bar @{ 2675 char z; 2676 struct foo f; 2677@}; 2678@end group 2679@end smallexample 2680 2681@item -Wpadded 2682@opindex Wpadded 2683Warn if padding is included in a structure, either to align an element 2684of the structure or to align the whole structure. Sometimes when this 2685happens it is possible to rearrange the fields of the structure to 2686reduce the padding and so make the structure smaller. 2687 2688@item -Wredundant-decls 2689@opindex Wredundant-decls 2690Warn if anything is declared more than once in the same scope, even in 2691cases where multiple declaration is valid and changes nothing. 2692 2693@item -Wnested-externs @r{(C only)} 2694@opindex Wnested-externs 2695Warn if an @code{extern} declaration is encountered within a function. 2696 2697@item -Wunreachable-code 2698@opindex Wunreachable-code 2699Warn if the compiler detects that code will never be executed. 2700 2701This option is intended to warn when the compiler detects that at 2702least a whole line of source code will never be executed, because 2703some condition is never satisfied or because it is after a 2704procedure that never returns. 2705 2706It is possible for this option to produce a warning even though there 2707are circumstances under which part of the affected line can be executed, 2708so care should be taken when removing apparently-unreachable code. 2709 2710For instance, when a function is inlined, a warning may mean that the 2711line is unreachable in only one inlined copy of the function. 2712 2713This option is not made part of @option{-Wall} because in a debugging 2714version of a program there is often substantial code which checks 2715correct functioning of the program and is, hopefully, unreachable 2716because the program does work. Another common use of unreachable 2717code is to provide behavior which is selectable at compile-time. 2718 2719@item -Winline 2720@opindex Winline 2721Warn if a function can not be inlined and it was declared as inline. 2722 2723@item -Wlong-long 2724@opindex Wlong-long 2725@opindex Wno-long-long 2726Warn if @samp{long long} type is used. This is default. To inhibit 2727the warning messages, use @option{-Wno-long-long}. Flags 2728@option{-Wlong-long} and @option{-Wno-long-long} are taken into account 2729only when @option{-pedantic} flag is used. 2730 2731@item -Wdisabled-optimization 2732@opindex Wdisabled-optimization 2733Warn if a requested optimization pass is disabled. This warning does 2734not generally indicate that there is anything wrong with your code; it 2735merely indicates that GCC's optimizers were unable to handle the code 2736effectively. Often, the problem is that your code is too big or too 2737complex; GCC will refuse to optimize programs when the optimization 2738itself is likely to take inordinate amounts of time. 2739 2740@item -Werror 2741@opindex Werror 2742Make all warnings into errors. 2743@end table 2744 2745@node Debugging Options 2746@section Options for Debugging Your Program or GCC 2747@cindex options, debugging 2748@cindex debugging information options 2749 2750GCC has various special options that are used for debugging 2751either your program or GCC: 2752 2753@table @gcctabopt 2754@item -g 2755@opindex g 2756Produce debugging information in the operating system's native format 2757(stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging 2758information. 2759 2760On most systems that use stabs format, @option{-g} enables use of extra 2761debugging information that only GDB can use; this extra information 2762makes debugging work better in GDB but will probably make other debuggers 2763crash or 2764refuse to read the program. If you want to control for certain whether 2765to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 2766@option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, @option{-gdwarf-1}, 2767or @option{-gvms} (see below). 2768 2769Unlike most other C compilers, GCC allows you to use @option{-g} with 2770@option{-O}. The shortcuts taken by optimized code may occasionally 2771produce surprising results: some variables you declared may not exist 2772at all; flow of control may briefly move where you did not expect it; 2773some statements may not be executed because they compute constant 2774results or their values were already at hand; some statements may 2775execute in different places because they were moved out of loops. 2776 2777Nevertheless it proves possible to debug optimized output. This makes 2778it reasonable to use the optimizer for programs that might have bugs. 2779 2780The following options are useful when GCC is generated with the 2781capability for more than one debugging format. 2782 2783@item -ggdb 2784@opindex ggdb 2785Produce debugging information for use by GDB@. This means to use the 2786most expressive format available (DWARF 2, stabs, or the native format 2787if neither of those are supported), including GDB extensions if at all 2788possible. 2789 2790@item -gstabs 2791@opindex gstabs 2792Produce debugging information in stabs format (if that is supported), 2793without GDB extensions. This is the format used by DBX on most BSD 2794systems. On MIPS, Alpha and System V Release 4 systems this option 2795produces stabs debugging output which is not understood by DBX or SDB@. 2796On System V Release 4 systems this option requires the GNU assembler. 2797 2798@item -gstabs+ 2799@opindex gstabs+ 2800Produce debugging information in stabs format (if that is supported), 2801using GNU extensions understood only by the GNU debugger (GDB)@. The 2802use of these extensions is likely to make other debuggers crash or 2803refuse to read the program. 2804 2805@item -gcoff 2806@opindex gcoff 2807Produce debugging information in COFF format (if that is supported). 2808This is the format used by SDB on most System V systems prior to 2809System V Release 4. 2810 2811@item -gxcoff 2812@opindex gxcoff 2813Produce debugging information in XCOFF format (if that is supported). 2814This is the format used by the DBX debugger on IBM RS/6000 systems. 2815 2816@item -gxcoff+ 2817@opindex gxcoff+ 2818Produce debugging information in XCOFF format (if that is supported), 2819using GNU extensions understood only by the GNU debugger (GDB)@. The 2820use of these extensions is likely to make other debuggers crash or 2821refuse to read the program, and may cause assemblers other than the GNU 2822assembler (GAS) to fail with an error. 2823 2824@item -gdwarf 2825@opindex gdwarf 2826Produce debugging information in DWARF version 1 format (if that is 2827supported). This is the format used by SDB on most System V Release 4 2828systems. 2829 2830@item -gdwarf+ 2831@opindex gdwarf+ 2832Produce debugging information in DWARF version 1 format (if that is 2833supported), using GNU extensions understood only by the GNU debugger 2834(GDB)@. The use of these extensions is likely to make other debuggers 2835crash or refuse to read the program. 2836 2837@item -gdwarf-2 2838@opindex gdwarf-2 2839Produce debugging information in DWARF version 2 format (if that is 2840supported). This is the format used by DBX on IRIX 6. 2841 2842@item -gvms 2843@opindex gvms 2844Produce debugging information in VMS debug format (if that is 2845supported). This is the format used by DEBUG on VMS systems. 2846 2847@item -g@var{level} 2848@itemx -ggdb@var{level} 2849@itemx -gstabs@var{level} 2850@itemx -gcoff@var{level} 2851@itemx -gxcoff@var{level} 2852@itemx -gvms@var{level} 2853Request debugging information and also use @var{level} to specify how 2854much information. The default level is 2. 2855 2856Level 1 produces minimal information, enough for making backtraces in 2857parts of the program that you don't plan to debug. This includes 2858descriptions of functions and external variables, but no information 2859about local variables and no line numbers. 2860 2861Level 3 includes extra information, such as all the macro definitions 2862present in the program. Some debuggers support macro expansion when 2863you use @option{-g3}. 2864 2865Note that in order to avoid confusion between DWARF1 debug level 2, 2866and DWARF2, neither @option{-gdwarf} nor @option{-gdwarf-2} accept 2867a concatenated debug level. Instead use an additional @option{-g@var{level}} 2868option to change the debug level for DWARF1 or DWARF2. 2869 2870@cindex @code{prof} 2871@item -p 2872@opindex p 2873Generate extra code to write profile information suitable for the 2874analysis program @code{prof}. You must use this option when compiling 2875the source files you want data about, and you must also use it when 2876linking. 2877 2878@cindex @code{gprof} 2879@item -pg 2880@opindex pg 2881Generate extra code to write profile information suitable for the 2882analysis program @code{gprof}. You must use this option when compiling 2883the source files you want data about, and you must also use it when 2884linking. 2885 2886@cindex @code{tcov} 2887@item -a 2888@opindex a 2889Generate extra code to write profile information for basic blocks, which will 2890record the number of times each basic block is executed, the basic block start 2891address, and the function name containing the basic block. If @option{-g} is 2892used, the line number and filename of the start of the basic block will also be 2893recorded. If not overridden by the machine description, the default action is 2894to append to the text file @file{bb.out}. 2895 2896This data could be analyzed by a program like @code{tcov}. Note, 2897however, that the format of the data is not what @code{tcov} expects. 2898Eventually GNU @code{gprof} should be extended to process this data. 2899 2900@item -Q 2901@opindex Q 2902Makes the compiler print out each function name as it is compiled, and 2903print some statistics about each pass when it finishes. 2904 2905@item -ftime-report 2906@opindex ftime-report 2907Makes the compiler print some statistics about the time consumed by each 2908pass when it finishes. 2909 2910@item -fmem-report 2911@opindex fmem-report 2912Makes the compiler print some statistics about permanent memory 2913allocation when it finishes. 2914 2915@item -fprofile-arcs 2916@opindex fprofile-arcs 2917Instrument @dfn{arcs} during compilation to generate coverage data 2918or for profile-directed block ordering. During execution the program 2919records how many times each branch is executed and how many times it is 2920taken. When the compiled program exits it saves this data to a file 2921called @file{@var{sourcename}.da} for each source file. 2922 2923For profile-directed block ordering, compile the program with 2924@option{-fprofile-arcs} plus optimization and code generation options, 2925generate the arc profile information by running the program on a 2926selected workload, and then compile the program again with the same 2927optimization and code generation options plus 2928@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 2929Control Optimization}). 2930 2931The other use of @option{-fprofile-arcs} is for use with @code{gcov}, 2932when it is used with the @option{-ftest-coverage} option. GCC 2933supports two methods of determining code coverage: the options that 2934support @code{gcov}, and options @option{-a} and @option{-ax}, which 2935write information to text files. The options that support @code{gcov} 2936do not need to instrument every arc in the program, so a program compiled 2937with them runs faster than a program compiled with @option{-a}, which 2938adds instrumentation code to every basic block in the program. The 2939tradeoff: since @code{gcov} does not have execution counts for all 2940branches, it must start with the execution counts for the instrumented 2941branches, and then iterate over the program flow graph until the entire 2942graph has been solved. Hence, @code{gcov} runs a little more slowly than 2943a program which uses information from @option{-a} and @option{-ax}. 2944 2945With @option{-fprofile-arcs}, for each function of your program GCC 2946creates a program flow graph, then finds a spanning tree for the graph. 2947Only arcs that are not on the spanning tree have to be instrumented: the 2948compiler adds code to count the number of times that these arcs are 2949executed. When an arc is the only exit or only entrance to a block, the 2950instrumentation code can be added to the block; otherwise, a new basic 2951block must be created to hold the instrumentation code. 2952 2953This option makes it possible to estimate branch probabilities and to 2954calculate basic block execution counts. In general, basic block 2955execution counts as provided by @option{-a} do not give enough 2956information to estimate all branch probabilities. 2957 2958@need 2000 2959@item -ftest-coverage 2960@opindex ftest-coverage 2961Create data files for the @code{gcov} code-coverage utility 2962(@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}). 2963The data file names begin with the name of your source file: 2964 2965@table @gcctabopt 2966@item @var{sourcename}.bb 2967A mapping from basic blocks to line numbers, which @code{gcov} uses to 2968associate basic block execution counts with line numbers. 2969 2970@item @var{sourcename}.bbg 2971A list of all arcs in the program flow graph. This allows @code{gcov} 2972to reconstruct the program flow graph, so that it can compute all basic 2973block and arc execution counts from the information in the 2974@code{@var{sourcename}.da} file. 2975@end table 2976 2977Use @option{-ftest-coverage} with @option{-fprofile-arcs}; the latter 2978option adds instrumentation to the program, which then writes 2979execution counts to another data file: 2980 2981@table @gcctabopt 2982@item @var{sourcename}.da 2983Runtime arc execution counts, used in conjunction with the arc 2984information in the file @code{@var{sourcename}.bbg}. 2985@end table 2986 2987Coverage data will map better to the source files if 2988@option{-ftest-coverage} is used without optimization. 2989 2990@item -d@var{letters} 2991@opindex d 2992Says to make debugging dumps during compilation at times specified by 2993@var{letters}. This is used for debugging the compiler. The file names 2994for most of the dumps are made by appending a pass number and a word to 2995the source file name (e.g. @file{foo.c.00.rtl} or @file{foo.c.01.sibling}). 2996Here are the possible letters for use in @var{letters}, and their meanings: 2997 2998@table @samp 2999@item A 3000@opindex dA 3001Annotate the assembler output with miscellaneous debugging information. 3002@item b 3003@opindex db 3004Dump after computing branch probabilities, to @file{@var{file}.14.bp}. 3005@item B 3006@opindex dB 3007Dump after block reordering, to @file{@var{file}.29.bbro}. 3008@item c 3009@opindex dc 3010Dump after instruction combination, to the file @file{@var{file}.16.combine}. 3011@item C 3012@opindex dC 3013Dump after the first if conversion, to the file @file{@var{file}.17.ce}. 3014@item d 3015@opindex dd 3016Dump after delayed branch scheduling, to @file{@var{file}.31.dbr}. 3017@item D 3018@opindex dD 3019Dump all macro definitions, at the end of preprocessing, in addition to 3020normal output. 3021@item e 3022@opindex de 3023Dump after SSA optimizations, to @file{@var{file}.04.ssa} and 3024@file{@var{file}.07.ussa}. 3025@item E 3026@opindex dE 3027Dump after the second if conversion, to @file{@var{file}.26.ce2}. 3028@item f 3029@opindex df 3030Dump after life analysis, to @file{@var{file}.15.life}. 3031@item F 3032@opindex dF 3033Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.09.addressof}. 3034@item g 3035@opindex dg 3036Dump after global register allocation, to @file{@var{file}.21.greg}. 3037@item h 3038@opindex dh 3039Dump after finalization of EH handling code, to @file{@var{file}.02.eh}. 3040@item k 3041@opindex dk 3042Dump after reg-to-stack conversion, to @file{@var{file}.28.stack}. 3043@item o 3044@opindex do 3045Dump after post-reload optimizations, to @file{@var{file}.22.postreload}. 3046@item G 3047@opindex dG 3048Dump after GCSE, to @file{@var{file}.10.gcse}. 3049@item i 3050@opindex di 3051Dump after sibling call optimizations, to @file{@var{file}.01.sibling}. 3052@item j 3053@opindex dj 3054Dump after the first jump optimization, to @file{@var{file}.03.jump}. 3055@item k 3056@opindex dk 3057Dump after conversion from registers to stack, to @file{@var{file}.32.stack}. 3058@item l 3059@opindex dl 3060Dump after local register allocation, to @file{@var{file}.20.lreg}. 3061@item L 3062@opindex dL 3063Dump after loop optimization, to @file{@var{file}.11.loop}. 3064@item M 3065@opindex dM 3066Dump after performing the machine dependent reorganisation pass, to 3067@file{@var{file}.30.mach}. 3068@item n 3069@opindex dn 3070Dump after register renumbering, to @file{@var{file}.25.rnreg}. 3071@item N 3072@opindex dN 3073Dump after the register move pass, to @file{@var{file}.18.regmove}. 3074@item r 3075@opindex dr 3076Dump after RTL generation, to @file{@var{file}.00.rtl}. 3077@item R 3078@opindex dR 3079Dump after the second scheduling pass, to @file{@var{file}.27.sched2}. 3080@item s 3081@opindex ds 3082Dump after CSE (including the jump optimization that sometimes follows 3083CSE), to @file{@var{file}.08.cse}. 3084@item S 3085@opindex dS 3086Dump after the first scheduling pass, to @file{@var{file}.19.sched}. 3087@item t 3088@opindex dt 3089Dump after the second CSE pass (including the jump optimization that 3090sometimes follows CSE), to @file{@var{file}.12.cse2}. 3091@item w 3092@opindex dw 3093Dump after the second flow pass, to @file{@var{file}.23.flow2}. 3094@item X 3095@opindex dX 3096Dump after SSA dead code elimination, to @file{@var{file}.06.ssadce}. 3097@item z 3098@opindex dz 3099Dump after the peephole pass, to @file{@var{file}.24.peephole2}. 3100@item a 3101@opindex da 3102Produce all the dumps listed above. 3103@item m 3104@opindex dm 3105Print statistics on memory usage, at the end of the run, to 3106standard error. 3107@item p 3108@opindex dp 3109Annotate the assembler output with a comment indicating which 3110pattern and alternative was used. The length of each instruction is 3111also printed. 3112@item P 3113@opindex dP 3114Dump the RTL in the assembler output as a comment before each instruction. 3115Also turns on @option{-dp} annotation. 3116@item v 3117@opindex dv 3118For each of the other indicated dump files (except for 3119@file{@var{file}.00.rtl}), dump a representation of the control flow graph 3120suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}. 3121@item x 3122@opindex dx 3123Just generate RTL for a function instead of compiling it. Usually used 3124with @samp{r}. 3125@item y 3126@opindex dy 3127Dump debugging information during parsing, to standard error. 3128@end table 3129 3130@item -fdump-unnumbered 3131@opindex fdump-unnumbered 3132When doing debugging dumps (see @option{-d} option above), suppress instruction 3133numbers and line number note output. This makes it more feasible to 3134use diff on debugging dumps for compiler invocations with different 3135options, in particular with and without @option{-g}. 3136 3137@item -fdump-translation-unit @r{(C and C++ only)} 3138@itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)} 3139@opindex fdump-translation-unit 3140Dump a representation of the tree structure for the entire translation 3141unit to a file. The file name is made by appending @file{.tu} to the 3142source file name. If the @samp{-@var{options}} form is used, @var{options} 3143controls the details of the dump as described for the 3144@option{-fdump-tree} options. 3145 3146@item -fdump-class-hierarchy @r{(C++ only)} 3147@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} 3148@opindex fdump-class-hierarchy 3149Dump a representation of each class's hierarchy and virtual function 3150table layout to a file. The file name is made by appending @file{.class} 3151to the source file name. If the @samp{-@var{options}} form is used, 3152@var{options} controls the details of the dump as described for the 3153@option{-fdump-tree} options. 3154 3155@item -fdump-tree-@var{switch} @r{(C++ only)} 3156@itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)} 3157@opindex fdump-tree 3158Control the dumping at various stages of processing the intermediate 3159language tree to a file. The file name is generated by appending a switch 3160specific suffix to the source file name. If the @samp{-@var{options}} 3161form is used, @var{options} is a list of @samp{-} separated options that 3162control the details of the dump. Not all options are applicable to all 3163dumps, those which are not meaningful will be ignored. The following 3164options are available 3165 3166@table @samp 3167@item address 3168Print the address of each node. Usually this is not meaningful as it 3169changes according to the environment and source file. Its primary use 3170is for tying up a dump file with a debug environment. 3171@item slim 3172Inhibit dumping of members of a scope or body of a function merely 3173because that scope has been reached. Only dump such items when they 3174are directly reachable by some other path. 3175@item all 3176Turn on all options. 3177@end table 3178 3179The following tree dumps are possible: 3180@table @samp 3181@item original 3182Dump before any tree based optimization, to @file{@var{file}.original}. 3183@item optimized 3184Dump after all tree based optimization, to @file{@var{file}.optimized}. 3185@item inlined 3186Dump after function inlining, to @file{@var{file}.inlined}. 3187@end table 3188 3189@item -fpretend-float 3190@opindex fpretend-float 3191When running a cross-compiler, pretend that the target machine uses the 3192same floating point format as the host machine. This causes incorrect 3193output of the actual floating constants, but the actual instruction 3194sequence will probably be the same as GCC would make when running on 3195the target machine. 3196 3197@item -save-temps 3198@opindex save-temps 3199Store the usual ``temporary'' intermediate files permanently; place them 3200in the current directory and name them based on the source file. Thus, 3201compiling @file{foo.c} with @samp{-c -save-temps} would produce files 3202@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 3203preprocessed @file{foo.i} output file even though the compiler now 3204normally uses an integrated preprocessor. 3205 3206@item -time 3207@opindex time 3208Report the CPU time taken by each subprocess in the compilation 3209sequence. For C source files, this is the compiler proper and assembler 3210(plus the linker if linking is done). The output looks like this: 3211 3212@smallexample 3213# cc1 0.12 0.01 3214# as 0.00 0.01 3215@end smallexample 3216 3217The first number on each line is the ``user time,'' that is time spent 3218executing the program itself. The second number is ``system time,'' 3219time spent executing operating system routines on behalf of the program. 3220Both numbers are in seconds. 3221 3222@item -print-file-name=@var{library} 3223@opindex print-file-name 3224Print the full absolute name of the library file @var{library} that 3225would be used when linking---and don't do anything else. With this 3226option, GCC does not compile or link anything; it just prints the 3227file name. 3228 3229@item -print-multi-directory 3230@opindex print-multi-directory 3231Print the directory name corresponding to the multilib selected by any 3232other switches present in the command line. This directory is supposed 3233to exist in @env{GCC_EXEC_PREFIX}. 3234 3235@item -print-multi-lib 3236@opindex print-multi-lib 3237Print the mapping from multilib directory names to compiler switches 3238that enable them. The directory name is separated from the switches by 3239@samp{;}, and each switch starts with an @samp{@@} instead of the 3240@samp{-}, without spaces between multiple switches. This is supposed to 3241ease shell-processing. 3242 3243@item -print-prog-name=@var{program} 3244@opindex print-prog-name 3245Like @option{-print-file-name}, but searches for a program such as @samp{cpp}. 3246 3247@item -print-libgcc-file-name 3248@opindex print-libgcc-file-name 3249Same as @option{-print-file-name=libgcc.a}. 3250 3251This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 3252but you do want to link with @file{libgcc.a}. You can do 3253 3254@example 3255gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 3256@end example 3257 3258@item -print-search-dirs 3259@opindex print-search-dirs 3260Print the name of the configured installation directory and a list of 3261program and library directories gcc will search---and don't do anything else. 3262 3263This is useful when gcc prints the error message 3264@samp{installation problem, cannot exec cpp0: No such file or directory}. 3265To resolve this you either need to put @file{cpp0} and the other compiler 3266components where gcc expects to find them, or you can set the environment 3267variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 3268Don't forget the trailing '/'. 3269@xref{Environment Variables}. 3270 3271@item -dumpmachine 3272@opindex dumpmachine 3273Print the compiler's target machine (for example, 3274@samp{i686-pc-linux-gnu})---and don't do anything else. 3275 3276@item -dumpversion 3277@opindex dumpversion 3278Print the compiler version (for example, @samp{3.0})---and don't do 3279anything else. 3280 3281@item -dumpspecs 3282@opindex dumpspecs 3283Print the compiler's built-in specs---and don't do anything else. (This 3284is used when GCC itself is being built.) @xref{Spec Files}. 3285@end table 3286 3287@node Optimize Options 3288@section Options That Control Optimization 3289@cindex optimize options 3290@cindex options, optimization 3291 3292These options control various sorts of optimizations: 3293 3294@table @gcctabopt 3295@item -O 3296@itemx -O1 3297@opindex O 3298@opindex O1 3299Optimize. Optimizing compilation takes somewhat more time, and a lot 3300more memory for a large function. 3301 3302Without @option{-O}, the compiler's goal is to reduce the cost of 3303compilation and to make debugging produce the expected results. 3304Statements are independent: if you stop the program with a breakpoint 3305between statements, you can then assign a new value to any variable or 3306change the program counter to any other statement in the function and 3307get exactly the results you would expect from the source code. 3308 3309With @option{-O}, the compiler tries to reduce code size and execution 3310time, without performing any optimizations that take a great deal of 3311compilation time. 3312 3313@item -O2 3314@opindex O2 3315Optimize even more. GCC performs nearly all supported optimizations 3316that do not involve a space-speed tradeoff. The compiler does not 3317perform loop unrolling or function inlining when you specify @option{-O2}. 3318As compared to @option{-O}, this option increases both compilation time 3319and the performance of the generated code. 3320 3321@option{-O2} turns on all optional optimizations except for loop unrolling, 3322function inlining, and register renaming. It also turns on the 3323@option{-fforce-mem} option on all machines and frame pointer elimination 3324on machines where doing so does not interfere with debugging. 3325 3326Please note the warning under @option{-fgcse} about 3327invoking @option{-O2} on programs that use computed gotos. 3328 3329@item -O3 3330@opindex O3 3331Optimize yet more. @option{-O3} turns on all optimizations specified by 3332@option{-O2} and also turns on the @option{-finline-functions} and 3333@option{-frename-registers} options. 3334 3335@item -O0 3336@opindex O0 3337Do not optimize. 3338 3339@item -Os 3340@opindex Os 3341Optimize for size. @option{-Os} enables all @option{-O2} optimizations that 3342do not typically increase code size. It also performs further 3343optimizations designed to reduce code size. 3344 3345If you use multiple @option{-O} options, with or without level numbers, 3346the last such option is the one that is effective. 3347@end table 3348 3349Options of the form @option{-f@var{flag}} specify machine-independent 3350flags. Most flags have both positive and negative forms; the negative 3351form of @option{-ffoo} would be @option{-fno-foo}. In the table below, 3352only one of the forms is listed---the one which is not the default. 3353You can figure out the other form by either removing @samp{no-} or 3354adding it. 3355 3356@table @gcctabopt 3357@item -ffloat-store 3358@opindex ffloat-store 3359Do not store floating point variables in registers, and inhibit other 3360options that might change whether a floating point value is taken from a 3361register or memory. 3362 3363@cindex floating point precision 3364This option prevents undesirable excess precision on machines such as 3365the 68000 where the floating registers (of the 68881) keep more 3366precision than a @code{double} is supposed to have. Similarly for the 3367x86 architecture. For most programs, the excess precision does only 3368good, but a few programs rely on the precise definition of IEEE floating 3369point. Use @option{-ffloat-store} for such programs, after modifying 3370them to store all pertinent intermediate computations into variables. 3371 3372@item -fno-default-inline 3373@opindex fno-default-inline 3374Do not make member functions inline by default merely because they are 3375defined inside the class scope (C++ only). Otherwise, when you specify 3376@w{@option{-O}}, member functions defined inside class scope are compiled 3377inline by default; i.e., you don't need to add @samp{inline} in front of 3378the member function name. 3379 3380@item -fno-defer-pop 3381@opindex fno-defer-pop 3382Always pop the arguments to each function call as soon as that function 3383returns. For machines which must pop arguments after a function call, 3384the compiler normally lets arguments accumulate on the stack for several 3385function calls and pops them all at once. 3386 3387@item -fforce-mem 3388@opindex fforce-mem 3389Force memory operands to be copied into registers before doing 3390arithmetic on them. This produces better code by making all memory 3391references potential common subexpressions. When they are not common 3392subexpressions, instruction combination should eliminate the separate 3393register-load. The @option{-O2} option turns on this option. 3394 3395@item -fforce-addr 3396@opindex fforce-addr 3397Force memory address constants to be copied into registers before 3398doing arithmetic on them. This may produce better code just as 3399@option{-fforce-mem} may. 3400 3401@item -fomit-frame-pointer 3402@opindex fomit-frame-pointer 3403Don't keep the frame pointer in a register for functions that 3404don't need one. This avoids the instructions to save, set up and 3405restore frame pointers; it also makes an extra register available 3406in many functions. @strong{It also makes debugging impossible on 3407some machines.} 3408 3409On some machines, such as the VAX, this flag has no effect, because 3410the standard calling sequence automatically handles the frame pointer 3411and nothing is saved by pretending it doesn't exist. The 3412machine-description macro @code{FRAME_POINTER_REQUIRED} controls 3413whether a target machine supports this flag. @xref{Registers,,Register 3414Usage, gccint, GNU Compiler Collection (GCC) Internals}. 3415 3416@item -foptimize-sibling-calls 3417@opindex foptimize-sibling-calls 3418Optimize sibling and tail recursive calls. 3419 3420@item -ftrapv 3421@opindex ftrapv 3422This option generates traps for signed overflow on addition, subtraction, 3423multiplication operations. 3424 3425@item -fno-inline 3426@opindex fno-inline 3427Don't pay attention to the @code{inline} keyword. Normally this option 3428is used to keep the compiler from expanding any functions inline. 3429Note that if you are not optimizing, no functions can be expanded inline. 3430 3431@item -finline-functions 3432@opindex finline-functions 3433Integrate all simple functions into their callers. The compiler 3434heuristically decides which functions are simple enough to be worth 3435integrating in this way. 3436 3437If all calls to a given function are integrated, and the function is 3438declared @code{static}, then the function is normally not output as 3439assembler code in its own right. 3440 3441@item -finline-limit=@var{n} 3442@opindex finline-limit 3443By default, gcc limits the size of functions that can be inlined. This flag 3444allows the control of this limit for functions that are explicitly marked as 3445inline (ie marked with the inline keyword or defined within the class 3446definition in c++). @var{n} is the size of functions that can be inlined in 3447number of pseudo instructions (not counting parameter handling). The default 3448value of @var{n} is 600. 3449Increasing this value can result in more inlined code at 3450the cost of compilation time and memory consumption. Decreasing usually makes 3451the compilation faster and less code will be inlined (which presumably 3452means slower programs). This option is particularly useful for programs that 3453use inlining heavily such as those based on recursive templates with C++. 3454 3455@emph{Note:} pseudo instruction represents, in this particular context, an 3456abstract measurement of function's size. In no way, it represents a count 3457of assembly instructions and as such its exact meaning might change from one 3458release to an another. 3459 3460@item -fkeep-inline-functions 3461@opindex fkeep-inline-functions 3462Even if all calls to a given function are integrated, and the function 3463is declared @code{static}, nevertheless output a separate run-time 3464callable version of the function. This switch does not affect 3465@code{extern inline} functions. 3466 3467@item -fkeep-static-consts 3468@opindex fkeep-static-consts 3469Emit variables declared @code{static const} when optimization isn't turned 3470on, even if the variables aren't referenced. 3471 3472GCC enables this option by default. If you want to force the compiler to 3473check if the variable was referenced, regardless of whether or not 3474optimization is turned on, use the @option{-fno-keep-static-consts} option. 3475 3476@item -fmerge-constants 3477Attempt to merge identical constants (string constants and floating point 3478constants) accross compilation units. 3479 3480This option is default for optimized compilation if assembler and linker 3481support it. Use @option{-fno-merge-constants} to inhibit this behavior. 3482 3483@item -fmerge-all-constants 3484Attempt to merge identical constants and identical variables. 3485 3486This option implies @option{-fmerge-constants}. In addition to 3487@option{-fmerge-constants} this considers e.g. even constant initialized 3488arrays or initialized constant variables with integral or floating point 3489types. Languages like C or C++ require each non-automatic variable to 3490have distinct location, so using this option will result in non-conforming 3491behavior. 3492 3493@item -fno-function-cse 3494@opindex fno-function-cse 3495Do not put function addresses in registers; make each instruction that 3496calls a constant function contain the function's address explicitly. 3497 3498This option results in less efficient code, but some strange hacks 3499that alter the assembler output may be confused by the optimizations 3500performed when this option is not used. 3501 3502@item -ffast-math 3503@opindex ffast-math 3504Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, and @* 3505@option{-fno-trapping-math}. 3506 3507This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 3508 3509This option should never be turned on by any @option{-O} option since 3510it can result in incorrect output for programs which depend on 3511an exact implementation of IEEE or ISO rules/specifications for 3512math functions. 3513 3514@item -fno-math-errno 3515@opindex fno-math-errno 3516Do not set ERRNO after calling math functions that are executed 3517with a single instruction, e.g., sqrt. A program that relies on 3518IEEE exceptions for math error handling may want to use this flag 3519for speed while maintaining IEEE arithmetic compatibility. 3520 3521This option should never be turned on by any @option{-O} option since 3522it can result in incorrect output for programs which depend on 3523an exact implementation of IEEE or ISO rules/specifications for 3524math functions. 3525 3526The default is @option{-fmath-errno}. 3527 3528@item -funsafe-math-optimizations 3529@opindex funsafe-math-optimizations 3530Allow optimizations for floating-point arithmetic that (a) assume 3531that arguments and results are valid and (b) may violate IEEE or 3532ANSI standards. When used at link-time, it may include libraries 3533or startup files that change the default FPU control word or other 3534similar optimizations. 3535 3536This option should never be turned on by any @option{-O} option since 3537it can result in incorrect output for programs which depend on 3538an exact implementation of IEEE or ISO rules/specifications for 3539math functions. 3540 3541The default is @option{-fno-unsafe-math-optimizations}. 3542 3543@item -fno-trapping-math 3544@opindex fno-trapping-math 3545Compile code assuming that floating-point operations cannot generate 3546user-visible traps. Setting this option may allow faster code 3547if one relies on ``non-stop'' IEEE arithmetic, for example. 3548 3549This option should never be turned on by any @option{-O} option since 3550it can result in incorrect output for programs which depend on 3551an exact implementation of IEEE or ISO rules/specifications for 3552math functions. 3553 3554The default is @option{-ftrapping-math}. 3555@end table 3556 3557The following options control specific optimizations. The @option{-O2} 3558option turns on all of these optimizations except @option{-funroll-loops} 3559and @option{-funroll-all-loops}. On most machines, the @option{-O} option 3560turns on the @option{-fthread-jumps} and @option{-fdelayed-branch} options, 3561but specific machines may handle it differently. 3562 3563You can use the following flags in the rare cases when ``fine-tuning'' 3564of optimizations to be performed is desired. 3565 3566Not all of the optimizations performed by GCC have @option{-f} options 3567to control them. 3568 3569@table @gcctabopt 3570@item -fstrength-reduce 3571@opindex fstrength-reduce 3572Perform the optimizations of loop strength reduction and 3573elimination of iteration variables. 3574 3575@item -fthread-jumps 3576@opindex fthread-jumps 3577Perform optimizations where we check to see if a jump branches to a 3578location where another comparison subsumed by the first is found. If 3579so, the first branch is redirected to either the destination of the 3580second branch or a point immediately following it, depending on whether 3581the condition is known to be true or false. 3582 3583@item -fcse-follow-jumps 3584@opindex fcse-follow-jumps 3585In common subexpression elimination, scan through jump instructions 3586when the target of the jump is not reached by any other path. For 3587example, when CSE encounters an @code{if} statement with an 3588@code{else} clause, CSE will follow the jump when the condition 3589tested is false. 3590 3591@item -fcse-skip-blocks 3592@opindex fcse-skip-blocks 3593This is similar to @option{-fcse-follow-jumps}, but causes CSE to 3594follow jumps which conditionally skip over blocks. When CSE 3595encounters a simple @code{if} statement with no else clause, 3596@option{-fcse-skip-blocks} causes CSE to follow the jump around the 3597body of the @code{if}. 3598 3599@item -frerun-cse-after-loop 3600@opindex frerun-cse-after-loop 3601Re-run common subexpression elimination after loop optimizations has been 3602performed. 3603 3604@item -frerun-loop-opt 3605@opindex frerun-loop-opt 3606Run the loop optimizer twice. 3607 3608@item -fgcse 3609@opindex fgcse 3610Perform a global common subexpression elimination pass. 3611This pass also performs global constant and copy propagation. 3612 3613@emph{Note:} When compiling a program using computed gotos, a GCC 3614extension, you may get better runtime performance if you disable 3615the global common subexpression elmination pass by adding 3616@option{-fno-gcse} to the command line. 3617 3618@item -fgcse-lm 3619@opindex fgcse-lm 3620When @option{-fgcse-lm} is enabled, global common subexpression elimination will 3621attempt to move loads which are only killed by stores into themselves. This 3622allows a loop containing a load/store sequence to be changed to a load outside 3623the loop, and a copy/store within the loop. 3624 3625@item -fgcse-sm 3626@opindex fgcse-sm 3627When @option{-fgcse-sm} is enabled, A store motion pass is run after global common 3628subexpression elimination. This pass will attempt to move stores out of loops. 3629When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence 3630can be changed to a load before the loop and a store after the loop. 3631 3632@item -fdelete-null-pointer-checks 3633@opindex fdelete-null-pointer-checks 3634Use global dataflow analysis to identify and eliminate useless checks 3635for null pointers. The compiler assumes that dereferencing a null 3636pointer would have halted the program. If a pointer is checked after 3637it has already been dereferenced, it cannot be null. 3638 3639In some environments, this assumption is not true, and programs can 3640safely dereference null pointers. Use 3641@option{-fno-delete-null-pointer-checks} to disable this optimization 3642for programs which depend on that behavior. 3643 3644@item -fexpensive-optimizations 3645@opindex fexpensive-optimizations 3646Perform a number of minor optimizations that are relatively expensive. 3647 3648@item -foptimize-register-move 3649@itemx -fregmove 3650@opindex foptimize-register-move 3651@opindex fregmove 3652Attempt to reassign register numbers in move instructions and as 3653operands of other simple instructions in order to maximize the amount of 3654register tying. This is especially helpful on machines with two-operand 3655instructions. GCC enables this optimization by default with @option{-O2} 3656or higher. 3657 3658Note @option{-fregmove} and @option{-foptimize-register-move} are the same 3659optimization. 3660 3661@item -fdelayed-branch 3662@opindex fdelayed-branch 3663If supported for the target machine, attempt to reorder instructions 3664to exploit instruction slots available after delayed branch 3665instructions. 3666 3667@item -fschedule-insns 3668@opindex fschedule-insns 3669If supported for the target machine, attempt to reorder instructions to 3670eliminate execution stalls due to required data being unavailable. This 3671helps machines that have slow floating point or memory load instructions 3672by allowing other instructions to be issued until the result of the load 3673or floating point instruction is required. 3674 3675@item -fschedule-insns2 3676@opindex fschedule-insns2 3677Similar to @option{-fschedule-insns}, but requests an additional pass of 3678instruction scheduling after register allocation has been done. This is 3679especially useful on machines with a relatively small number of 3680registers and where memory load instructions take more than one cycle. 3681 3682@item -ffunction-sections 3683@itemx -fdata-sections 3684@opindex ffunction-sections 3685@opindex fdata-sections 3686Place each function or data item into its own section in the output 3687file if the target supports arbitrary sections. The name of the 3688function or the name of the data item determines the section's name 3689in the output file. 3690 3691Use these options on systems where the linker can perform optimizations 3692to improve locality of reference in the instruction space. HPPA 3693processors running HP-UX and Sparc processors running Solaris 2 have 3694linkers with such optimizations. Other systems using the ELF object format 3695as well as AIX may have these optimizations in the future. 3696 3697Only use these options when there are significant benefits from doing 3698so. When you specify these options, the assembler and linker will 3699create larger object and executable files and will also be slower. 3700You will not be able to use @code{gprof} on all systems if you 3701specify this option and you may have problems with debugging if 3702you specify both this option and @option{-g}. 3703 3704@item -fcaller-saves 3705@opindex fcaller-saves 3706Enable values to be allocated in registers that will be clobbered by 3707function calls, by emitting extra instructions to save and restore the 3708registers around such calls. Such allocation is done only when it 3709seems to result in better code than would otherwise be produced. 3710 3711This option is always enabled by default on certain machines, usually 3712those which have no call-preserved registers to use instead. 3713 3714For all machines, optimization level 2 and higher enables this flag by 3715default. 3716 3717@item -funroll-loops 3718@opindex funroll-loops 3719Unroll loops whose number of iterations can be determined at compile 3720time or upon entry to the loop. @option{-funroll-loops} implies both 3721@option{-fstrength-reduce} and @option{-frerun-cse-after-loop}. This 3722option makes code larger, and may or may not make it run faster. 3723 3724@item -funroll-all-loops 3725@opindex funroll-all-loops 3726Unroll all loops, even if their number of iterations is uncertain when 3727the loop is entered. This usually makes programs run more slowly. 3728@option{-funroll-all-loops} implies the same options as 3729@option{-funroll-loops}, 3730 3731@item -fprefetch-loop-arrays 3732@opindex fprefetch-loop-arrays 3733If supported by the target machine, generate instructions to prefetch 3734memory to improve the performance of loops that access large arrays. 3735 3736@item -fmove-all-movables 3737@opindex fmove-all-movables 3738Forces all invariant computations in loops to be moved 3739outside the loop. 3740 3741@item -freduce-all-givs 3742@opindex freduce-all-givs 3743Forces all general-induction variables in loops to be 3744strength-reduced. 3745 3746@emph{Note:} When compiling programs written in Fortran, 3747@option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled 3748by default when you use the optimizer. 3749 3750These options may generate better or worse code; results are highly 3751dependent on the structure of loops within the source code. 3752 3753These two options are intended to be removed someday, once 3754they have helped determine the efficacy of various 3755approaches to improving loop optimizations. 3756 3757Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}}) 3758know how use of these options affects 3759the performance of your production code. 3760We're very interested in code that runs @emph{slower} 3761when these options are @emph{enabled}. 3762 3763@item -fno-peephole 3764@itemx -fno-peephole2 3765@opindex fno-peephole 3766@opindex fno-peephole2 3767Disable any machine-specific peephole optimizations. The difference 3768between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 3769are implemented in the compiler; some targets use one, some use the 3770other, a few use both. 3771 3772@item -fbranch-probabilities 3773@opindex fbranch-probabilities 3774After running a program compiled with @option{-fprofile-arcs} 3775(@pxref{Debugging Options,, Options for Debugging Your Program or 3776@command{gcc}}), you can compile it a second time using 3777@option{-fbranch-probabilities}, to improve optimizations based on 3778the number of times each branch was taken. When the program 3779compiled with @option{-fprofile-arcs} exits it saves arc execution 3780counts to a file called @file{@var{sourcename}.da} for each source 3781file The information in this data file is very dependent on the 3782structure of the generated code, so you must use the same source code 3783and the same optimization options for both compilations. 3784 3785With @option{-fbranch-probabilities}, GCC puts a @samp{REG_EXEC_COUNT} 3786note on the first instruction of each basic block, and a 3787@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 3788These can be used to improve optimization. Currently, they are only 3789used in one place: in @file{reorg.c}, instead of guessing which path a 3790branch is mostly to take, the @samp{REG_BR_PROB} values are used to 3791exactly determine which path is taken more often. 3792 3793@item -fno-guess-branch-probability 3794@opindex fno-guess-branch-probability 3795Do not guess branch probabilities using a randomized model. 3796 3797Sometimes gcc will opt to use a randomized model to guess branch 3798probabilities, when none are available from either profiling feedback 3799(@option{-fprofile-arcs}) or @samp{__builtin_expect}. This means that 3800different runs of the compiler on the same program may produce different 3801object code. 3802 3803In a hard real-time system, people don't want different runs of the 3804compiler to produce code that has different behavior; minimizing 3805non-determinism is of paramount import. This switch allows users to 3806reduce non-determinism, possibly at the expense of inferior 3807optimization. 3808 3809@item -fstrict-aliasing 3810@opindex fstrict-aliasing 3811Allows the compiler to assume the strictest aliasing rules applicable to 3812the language being compiled. For C (and C++), this activates 3813optimizations based on the type of expressions. In particular, an 3814object of one type is assumed never to reside at the same address as an 3815object of a different type, unless the types are almost the same. For 3816example, an @code{unsigned int} can alias an @code{int}, but not a 3817@code{void*} or a @code{double}. A character type may alias any other 3818type. 3819 3820Pay special attention to code like this: 3821@example 3822union a_union @{ 3823 int i; 3824 double d; 3825@}; 3826 3827int f() @{ 3828 a_union t; 3829 t.d = 3.0; 3830 return t.i; 3831@} 3832@end example 3833The practice of reading from a different union member than the one most 3834recently written to (called ``type-punning'') is common. Even with 3835@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 3836is accessed through the union type. So, the code above will work as 3837expected. However, this code might not: 3838@example 3839int f() @{ 3840 a_union t; 3841 int* ip; 3842 t.d = 3.0; 3843 ip = &t.i; 3844 return *ip; 3845@} 3846@end example 3847 3848Every language that wishes to perform language-specific alias analysis 3849should define a function that computes, given an @code{tree} 3850node, an alias set for the node. Nodes in different alias sets are not 3851allowed to alias. For an example, see the C front-end function 3852@code{c_get_alias_set}. 3853 3854@item -falign-functions 3855@itemx -falign-functions=@var{n} 3856@opindex falign-functions 3857Align the start of functions to the next power-of-two greater than 3858@var{n}, skipping up to @var{n} bytes. For instance, 3859@option{-falign-functions=32} aligns functions to the next 32-byte 3860boundary, but @option{-falign-functions=24} would align to the next 386132-byte boundary only if this can be done by skipping 23 bytes or less. 3862 3863@option{-fno-align-functions} and @option{-falign-functions=1} are 3864equivalent and mean that functions will not be aligned. 3865 3866Some assemblers only support this flag when @var{n} is a power of two; 3867in that case, it is rounded up. 3868 3869If @var{n} is not specified, use a machine-dependent default. 3870 3871@item -falign-labels 3872@itemx -falign-labels=@var{n} 3873@opindex falign-labels 3874Align all branch targets to a power-of-two boundary, skipping up to 3875@var{n} bytes like @option{-falign-functions}. This option can easily 3876make code slower, because it must insert dummy operations for when the 3877branch target is reached in the usual flow of the code. 3878 3879If @option{-falign-loops} or @option{-falign-jumps} are applicable and 3880are greater than this value, then their values are used instead. 3881 3882If @var{n} is not specified, use a machine-dependent default which is 3883very likely to be @samp{1}, meaning no alignment. 3884 3885@item -falign-loops 3886@itemx -falign-loops=@var{n} 3887@opindex falign-loops 3888Align loops to a power-of-two boundary, skipping up to @var{n} bytes 3889like @option{-falign-functions}. The hope is that the loop will be 3890executed many times, which will make up for any execution of the dummy 3891operations. 3892 3893If @var{n} is not specified, use a machine-dependent default. 3894 3895@item -falign-jumps 3896@itemx -falign-jumps=@var{n} 3897@opindex falign-jumps 3898Align branch targets to a power-of-two boundary, for branch targets 3899where the targets can only be reached by jumping, skipping up to @var{n} 3900bytes like @option{-falign-functions}. In this case, no dummy operations 3901need be executed. 3902 3903If @var{n} is not specified, use a machine-dependent default. 3904 3905@item -fssa 3906@opindex fssa 3907Perform optimizations in static single assignment form. Each function's 3908flow graph is translated into SSA form, optimizations are performed, and 3909the flow graph is translated back from SSA form. Users should not 3910specify this option, since it is not yet ready for production use. 3911 3912@item -fssa-ccp 3913@opindex fssa-ccp 3914Perform Sparse Conditional Constant Propagation in SSA form. Requires 3915@option{-fssa}. Like @option{-fssa}, this is an experimental feature. 3916 3917@item -fssa-dce 3918@opindex fssa-dce 3919Perform aggressive dead-code elimination in SSA form. Requires @option{-fssa}. 3920Like @option{-fssa}, this is an experimental feature. 3921 3922@item -fsingle-precision-constant 3923@opindex fsingle-precision-constant 3924Treat floating point constant as single precision constant instead of 3925implicitly converting it to double precision constant. 3926 3927@item -frename-registers 3928@opindex frename-registers 3929Attempt to avoid false dependencies in scheduled code by making use 3930of registers left over after register allocation. This optimization 3931will most benefit processors with lots of registers. It can, however, 3932make debugging impossible, since variables will no longer stay in 3933a ``home register''. 3934 3935@item -fno-cprop-registers 3936@opindex fno-cprop-registers 3937After register allocation and post-register allocation instruction splitting, 3938we perform a copy-propagation pass to try to reduce scheduling dependencies 3939and occasionally eliminate the copy. 3940 3941@item --param @var{name}=@var{value} 3942@opindex param 3943In some places, GCC uses various constants to control the amount of 3944optimization that is done. For example, GCC will not inline functions 3945that contain more that a certain number of instructions. You can 3946control some of these constants on the command-line using the 3947@option{--param} option. 3948 3949In each case, the @var{value} is an integer. The allowable choices for 3950@var{name} are given in the following table: 3951 3952@table @gcctabopt 3953@item max-delay-slot-insn-search 3954The maximum number of instructions to consider when looking for an 3955instruction to fill a delay slot. If more than this arbitrary number of 3956instructions is searched, the time savings from filling the delay slot 3957will be minimal so stop searching. Increasing values mean more 3958aggressive optimization, making the compile time increase with probably 3959small improvement in executable run time. 3960 3961@item max-delay-slot-live-search 3962When trying to fill delay slots, the maximum number of instructions to 3963consider when searching for a block with valid live register 3964information. Increasing this arbitrarily chosen value means more 3965aggressive optimization, increasing the compile time. This parameter 3966should be removed when the delay slot code is rewritten to maintain the 3967control-flow graph. 3968 3969@item max-gcse-memory 3970The approximate maximum amount of memory that will be allocated in 3971order to perform the global common subexpression elimination 3972optimization. If more memory than specified is required, the 3973optimization will not be done. 3974 3975@item max-gcse-passes 3976The maximum number of passes of GCSE to run. 3977 3978@item max-pending-list-length 3979The maximum number of pending dependencies scheduling will allow 3980before flushing the current state and starting over. Large functions 3981with few branches or calls can create excessively large lists which 3982needlessly consume memory and resources. 3983 3984@item max-inline-insns 3985If an function contains more than this many instructions, it 3986will not be inlined. This option is precisely equivalent to 3987@option{-finline-limit}. 3988 3989@end table 3990@end table 3991 3992@node Preprocessor Options 3993@section Options Controlling the Preprocessor 3994@cindex preprocessor options 3995@cindex options, preprocessor 3996 3997These options control the C preprocessor, which is run on each C source 3998file before actual compilation. 3999 4000If you use the @option{-E} option, nothing is done except preprocessing. 4001Some of these options make sense only together with @option{-E} because 4002they cause the preprocessor output to be unsuitable for actual 4003compilation. 4004 4005@opindex Wp 4006You can use @option{-Wp,@var{option}} to bypass the compiler driver 4007and pass @var{option} directly through to the preprocessor. If 4008@var{option} contains commas, it is split into multiple options at the 4009commas. However, many options are modified, translated or interpreted 4010by the compiler driver before being passed to the preprocessor, and 4011@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 4012interface is undocumented and subject to change, so whenever possible 4013you should avoid using @option{-Wp} and let the driver handle the 4014options instead. 4015 4016@include cppopts.texi 4017 4018@node Assembler Options 4019@section Passing Options to the Assembler 4020 4021@c prevent bad page break with this line 4022You can pass options to the assembler. 4023 4024@table @gcctabopt 4025@item -Wa,@var{option} 4026@opindex Wa 4027Pass @var{option} as an option to the assembler. If @var{option} 4028contains commas, it is split into multiple options at the commas. 4029@end table 4030 4031@node Link Options 4032@section Options for Linking 4033@cindex link options 4034@cindex options, linking 4035 4036These options come into play when the compiler links object files into 4037an executable output file. They are meaningless if the compiler is 4038not doing a link step. 4039 4040@table @gcctabopt 4041@cindex file names 4042@item @var{object-file-name} 4043A file name that does not end in a special recognized suffix is 4044considered to name an object file or library. (Object files are 4045distinguished from libraries by the linker according to the file 4046contents.) If linking is done, these object files are used as input 4047to the linker. 4048 4049@item -c 4050@itemx -S 4051@itemx -E 4052@opindex c 4053@opindex S 4054@opindex E 4055If any of these options is used, then the linker is not run, and 4056object file names should not be used as arguments. @xref{Overall 4057Options}. 4058 4059@cindex Libraries 4060@item -l@var{library} 4061@itemx -l @var{library} 4062@opindex l 4063Search the library named @var{library} when linking. (The second 4064alternative with the library as a separate argument is only for 4065POSIX compliance and is not recommended.) 4066 4067It makes a difference where in the command you write this option; the 4068linker searches and processes libraries and object files in the order they 4069are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 4070after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 4071to functions in @samp{z}, those functions may not be loaded. 4072 4073The linker searches a standard list of directories for the library, 4074which is actually a file named @file{lib@var{library}.a}. The linker 4075then uses this file as if it had been specified precisely by name. 4076 4077The directories searched include several standard system directories 4078plus any that you specify with @option{-L}. 4079 4080Normally the files found this way are library files---archive files 4081whose members are object files. The linker handles an archive file by 4082scanning through it for members which define symbols that have so far 4083been referenced but not defined. But if the file that is found is an 4084ordinary object file, it is linked in the usual fashion. The only 4085difference between using an @option{-l} option and specifying a file name 4086is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 4087and searches several directories. 4088 4089@item -lobjc 4090@opindex lobjc 4091You need this special case of the @option{-l} option in order to 4092link an Objective-C program. 4093 4094@item -nostartfiles 4095@opindex nostartfiles 4096Do not use the standard system startup files when linking. 4097The standard system libraries are used normally, unless @option{-nostdlib} 4098or @option{-nodefaultlibs} is used. 4099 4100@item -nodefaultlibs 4101@opindex nodefaultlibs 4102Do not use the standard system libraries when linking. 4103Only the libraries you specify will be passed to the linker. 4104The standard startup files are used normally, unless @option{-nostartfiles} 4105is used. The compiler may generate calls to memcmp, memset, and memcpy 4106for System V (and ISO C) environments or to bcopy and bzero for 4107BSD environments. These entries are usually resolved by entries in 4108libc. These entry points should be supplied through some other 4109mechanism when this option is specified. 4110 4111@item -nostdlib 4112@opindex nostdlib 4113Do not use the standard system startup files or libraries when linking. 4114No startup files and only the libraries you specify will be passed to 4115the linker. The compiler may generate calls to memcmp, memset, and memcpy 4116for System V (and ISO C) environments or to bcopy and bzero for 4117BSD environments. These entries are usually resolved by entries in 4118libc. These entry points should be supplied through some other 4119mechanism when this option is specified. 4120 4121@cindex @option{-lgcc}, use with @option{-nostdlib} 4122@cindex @option{-nostdlib} and unresolved references 4123@cindex unresolved references and @option{-nostdlib} 4124@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 4125@cindex @option{-nodefaultlibs} and unresolved references 4126@cindex unresolved references and @option{-nodefaultlibs} 4127One of the standard libraries bypassed by @option{-nostdlib} and 4128@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 4129that GCC uses to overcome shortcomings of particular machines, or special 4130needs for some languages. 4131(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 4132Collection (GCC) Internals}, 4133for more discussion of @file{libgcc.a}.) 4134In most cases, you need @file{libgcc.a} even when you want to avoid 4135other standard libraries. In other words, when you specify @option{-nostdlib} 4136or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 4137This ensures that you have no unresolved references to internal GCC 4138library subroutines. (For example, @samp{__main}, used to ensure C++ 4139constructors will be called; @pxref{Collect2,,@code{collect2}, gccint, 4140GNU Compiler Collection (GCC) Internals}.) 4141 4142@item -s 4143@opindex s 4144Remove all symbol table and relocation information from the executable. 4145 4146@item -static 4147@opindex static 4148On systems that support dynamic linking, this prevents linking with the shared 4149libraries. On other systems, this option has no effect. 4150 4151@item -shared 4152@opindex shared 4153Produce a shared object which can then be linked with other objects to 4154form an executable. Not all systems support this option. For predictable 4155results, you must also specify the same set of options that were used to 4156generate code (@option{-fpic}, @option{-fPIC}, or model suboptions) 4157when you specify this option.@footnote{On some systems, @samp{gcc -shared} 4158needs to build supplementary stub code for constructors to work. On 4159multi-libbed systems, @samp{gcc -shared} must select the correct support 4160libraries to link against. Failing to supply the correct flags may lead 4161to subtle defects. Supplying them in cases where they are not necessary 4162is innocuous.} 4163 4164@item -shared-libgcc 4165@itemx -static-libgcc 4166@opindex shared-libgcc 4167@opindex static-libgcc 4168On systems that provide @file{libgcc} as a shared library, these options 4169force the use of either the shared or static version respectively. 4170If no shared version of @file{libgcc} was built when the compiler was 4171configured, these options have no effect. 4172 4173There are several situations in which an application should use the 4174shared @file{libgcc} instead of the static version. The most common 4175of these is when the application wishes to throw and catch exceptions 4176across different shared libraries. In that case, each of the libraries 4177as well as the application itself should use the shared @file{libgcc}. 4178 4179Therefore, the G++ and GCJ drivers automatically add 4180@option{-shared-libgcc} whenever you build a shared library or a main 4181executable, because C++ and Java programs typically use exceptions, so 4182this is the right thing to do. 4183 4184If, instead, you use the GCC driver to create shared libraries, you may 4185find that they will not always be linked with the shared @file{libgcc}. 4186If GCC finds, at its configuration time, that you have a GNU linker that 4187does not support option @option{--eh-frame-hdr}, it will link the shared 4188version of @file{libgcc} into shared libraries by default. Otherwise, 4189it will take advantage of the linker and optimize away the linking with 4190the shared version of @file{libgcc}, linking with the static version of 4191libgcc by default. This allows exceptions to propagate through such 4192shared libraries, without incurring relocation costs at library load 4193time. 4194 4195However, if a library or main executable is supposed to throw or catch 4196exceptions, you must link it using the G++ or GCJ driver, as appropriate 4197for the languages used in the program, or using the option 4198@option{-shared-libgcc}, such that it is linked with the shared 4199@file{libgcc}. 4200 4201@item -symbolic 4202@opindex symbolic 4203Bind references to global symbols when building a shared object. Warn 4204about any unresolved references (unless overridden by the link editor 4205option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support 4206this option. 4207 4208@item -Xlinker @var{option} 4209@opindex Xlinker 4210Pass @var{option} as an option to the linker. You can use this to 4211supply system-specific linker options which GCC does not know how to 4212recognize. 4213 4214If you want to pass an option that takes an argument, you must use 4215@option{-Xlinker} twice, once for the option and once for the argument. 4216For example, to pass @option{-assert definitions}, you must write 4217@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write 4218@option{-Xlinker "-assert definitions"}, because this passes the entire 4219string as a single argument, which is not what the linker expects. 4220 4221@item -Wl,@var{option} 4222@opindex Wl 4223Pass @var{option} as an option to the linker. If @var{option} contains 4224commas, it is split into multiple options at the commas. 4225 4226@item -u @var{symbol} 4227@opindex u 4228Pretend the symbol @var{symbol} is undefined, to force linking of 4229library modules to define it. You can use @option{-u} multiple times with 4230different symbols to force loading of additional library modules. 4231@end table 4232 4233@node Directory Options 4234@section Options for Directory Search 4235@cindex directory options 4236@cindex options, directory search 4237@cindex search path 4238 4239These options specify directories to search for header files, for 4240libraries and for parts of the compiler: 4241 4242@table @gcctabopt 4243@item -I@var{dir} 4244@opindex I 4245Add the directory @var{dir} to the head of the list of directories to be 4246searched for header files. This can be used to override a system header 4247file, substituting your own version, since these directories are 4248searched before the system header file directories. However, you should 4249not use this option to add directories that contain vendor-supplied 4250system header files (use @option{-isystem} for that). If you use more than 4251one @option{-I} option, the directories are scanned in left-to-right 4252order; the standard system directories come after. 4253 4254If a standard system include directory, or a directory specified with 4255@option{-isystem}, is also specified with @option{-I}, it will be 4256searched only in the position requested by @option{-I}. Also, it will 4257not be considered a system include directory. If that directory really 4258does contain system headers, there is a good chance that they will 4259break. For instance, if GCC's installation procedure edited the headers 4260in @file{/usr/include} to fix bugs, @samp{-I/usr/include} will cause the 4261original, buggy headers to be found instead of the corrected ones. GCC 4262will issue a warning when a system include directory is hidden in this 4263way. 4264 4265@item -I- 4266@opindex I- 4267Any directories you specify with @option{-I} options before the @option{-I-} 4268option are searched only for the case of @samp{#include "@var{file}"}; 4269they are not searched for @samp{#include <@var{file}>}. 4270 4271If additional directories are specified with @option{-I} options after 4272the @option{-I-}, these directories are searched for all @samp{#include} 4273directives. (Ordinarily @emph{all} @option{-I} directories are used 4274this way.) 4275 4276In addition, the @option{-I-} option inhibits the use of the current 4277directory (where the current input file came from) as the first search 4278directory for @samp{#include "@var{file}"}. There is no way to 4279override this effect of @option{-I-}. With @option{-I.} you can specify 4280searching the directory which was current when the compiler was 4281invoked. That is not exactly the same as what the preprocessor does 4282by default, but it is often satisfactory. 4283 4284@option{-I-} does not inhibit the use of the standard system directories 4285for header files. Thus, @option{-I-} and @option{-nostdinc} are 4286independent. 4287 4288@item -L@var{dir} 4289@opindex L 4290Add directory @var{dir} to the list of directories to be searched 4291for @option{-l}. 4292 4293@item -B@var{prefix} 4294@opindex B 4295This option specifies where to find the executables, libraries, 4296include files, and data files of the compiler itself. 4297 4298The compiler driver program runs one or more of the subprograms 4299@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries 4300@var{prefix} as a prefix for each program it tries to run, both with and 4301without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). 4302 4303For each subprogram to be run, the compiler driver first tries the 4304@option{-B} prefix, if any. If that name is not found, or if @option{-B} 4305was not specified, the driver tries two standard prefixes, which are 4306@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}. If neither of 4307those results in a file name that is found, the unmodified program 4308name is searched for using the directories specified in your 4309@env{PATH} environment variable. 4310 4311The compiler will check to see if the path provided by the @option{-B} 4312refers to a directory, and if necessary it will add a directory 4313separator character at the end of the path. 4314 4315@option{-B} prefixes that effectively specify directory names also apply 4316to libraries in the linker, because the compiler translates these 4317options into @option{-L} options for the linker. They also apply to 4318includes files in the preprocessor, because the compiler translates these 4319options into @option{-isystem} options for the preprocessor. In this case, 4320the compiler appends @samp{include} to the prefix. 4321 4322The run-time support file @file{libgcc.a} can also be searched for using 4323the @option{-B} prefix, if needed. If it is not found there, the two 4324standard prefixes above are tried, and that is all. The file is left 4325out of the link if it is not found by those means. 4326 4327Another way to specify a prefix much like the @option{-B} prefix is to use 4328the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 4329Variables}. 4330 4331As a special kludge, if the path provided by @option{-B} is 4332@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 43339, then it will be replaced by @file{[dir/]include}. This is to help 4334with boot-strapping the compiler. 4335 4336@item -specs=@var{file} 4337@opindex specs 4338Process @var{file} after the compiler reads in the standard @file{specs} 4339file, in order to override the defaults that the @file{gcc} driver 4340program uses when determining what switches to pass to @file{cc1}, 4341@file{cc1plus}, @file{as}, @file{ld}, etc. More than one 4342@option{-specs=@var{file}} can be specified on the command line, and they 4343are processed in order, from left to right. 4344@end table 4345 4346@c man end 4347 4348@node Spec Files 4349@section Specifying subprocesses and the switches to pass to them 4350@cindex Spec Files 4351@command{gcc} is a driver program. It performs its job by invoking a 4352sequence of other programs to do the work of compiling, assembling and 4353linking. GCC interprets its command-line parameters and uses these to 4354deduce which programs it should invoke, and which command-line options 4355it ought to place on their command lines. This behavior is controlled 4356by @dfn{spec strings}. In most cases there is one spec string for each 4357program that GCC can invoke, but a few programs have multiple spec 4358strings to control their behavior. The spec strings built into GCC can 4359be overridden by using the @option{-specs=} command-line switch to specify 4360a spec file. 4361 4362@dfn{Spec files} are plaintext files that are used to construct spec 4363strings. They consist of a sequence of directives separated by blank 4364lines. The type of directive is determined by the first non-whitespace 4365character on the line and it can be one of the following: 4366 4367@table @code 4368@item %@var{command} 4369Issues a @var{command} to the spec file processor. The commands that can 4370appear here are: 4371 4372@table @code 4373@item %include <@var{file}> 4374@cindex %include 4375Search for @var{file} and insert its text at the current point in the 4376specs file. 4377 4378@item %include_noerr <@var{file}> 4379@cindex %include_noerr 4380Just like @samp{%include}, but do not generate an error message if the include 4381file cannot be found. 4382 4383@item %rename @var{old_name} @var{new_name} 4384@cindex %rename 4385Rename the spec string @var{old_name} to @var{new_name}. 4386 4387@end table 4388 4389@item *[@var{spec_name}]: 4390This tells the compiler to create, override or delete the named spec 4391string. All lines after this directive up to the next directive or 4392blank line are considered to be the text for the spec string. If this 4393results in an empty string then the spec will be deleted. (Or, if the 4394spec did not exist, then nothing will happened.) Otherwise, if the spec 4395does not currently exist a new spec will be created. If the spec does 4396exist then its contents will be overridden by the text of this 4397directive, unless the first character of that text is the @samp{+} 4398character, in which case the text will be appended to the spec. 4399 4400@item [@var{suffix}]: 4401Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 4402and up to the next directive or blank line are considered to make up the 4403spec string for the indicated suffix. When the compiler encounters an 4404input file with the named suffix, it will processes the spec string in 4405order to work out how to compile that file. For example: 4406 4407@smallexample 4408.ZZ: 4409z-compile -input %i 4410@end smallexample 4411 4412This says that any input file whose name ends in @samp{.ZZ} should be 4413passed to the program @samp{z-compile}, which should be invoked with the 4414command-line switch @option{-input} and with the result of performing the 4415@samp{%i} substitution. (See below.) 4416 4417As an alternative to providing a spec string, the text that follows a 4418suffix directive can be one of the following: 4419 4420@table @code 4421@item @@@var{language} 4422This says that the suffix is an alias for a known @var{language}. This is 4423similar to using the @option{-x} command-line switch to GCC to specify a 4424language explicitly. For example: 4425 4426@smallexample 4427.ZZ: 4428@@c++ 4429@end smallexample 4430 4431Says that .ZZ files are, in fact, C++ source files. 4432 4433@item #@var{name} 4434This causes an error messages saying: 4435 4436@smallexample 4437@var{name} compiler not installed on this system. 4438@end smallexample 4439@end table 4440 4441GCC already has an extensive list of suffixes built into it. 4442This directive will add an entry to the end of the list of suffixes, but 4443since the list is searched from the end backwards, it is effectively 4444possible to override earlier entries using this technique. 4445 4446@end table 4447 4448GCC has the following spec strings built into it. Spec files can 4449override these strings or create their own. Note that individual 4450targets can also add their own spec strings to this list. 4451 4452@smallexample 4453asm Options to pass to the assembler 4454asm_final Options to pass to the assembler post-processor 4455cpp Options to pass to the C preprocessor 4456cc1 Options to pass to the C compiler 4457cc1plus Options to pass to the C++ compiler 4458endfile Object files to include at the end of the link 4459link Options to pass to the linker 4460lib Libraries to include on the command line to the linker 4461libgcc Decides which GCC support library to pass to the linker 4462linker Sets the name of the linker 4463predefines Defines to be passed to the C preprocessor 4464signed_char Defines to pass to CPP to say whether @code{char} is signed 4465 by default 4466startfile Object files to include at the start of the link 4467@end smallexample 4468 4469Here is a small example of a spec file: 4470 4471@smallexample 4472%rename lib old_lib 4473 4474*lib: 4475--start-group -lgcc -lc -leval1 --end-group %(old_lib) 4476@end smallexample 4477 4478This example renames the spec called @samp{lib} to @samp{old_lib} and 4479then overrides the previous definition of @samp{lib} with a new one. 4480The new definition adds in some extra command-line options before 4481including the text of the old definition. 4482 4483@dfn{Spec strings} are a list of command-line options to be passed to their 4484corresponding program. In addition, the spec strings can contain 4485@samp{%}-prefixed sequences to substitute variable text or to 4486conditionally insert text into the command line. Using these constructs 4487it is possible to generate quite complex command lines. 4488 4489Here is a table of all defined @samp{%}-sequences for spec 4490strings. Note that spaces are not generated automatically around the 4491results of expanding these sequences. Therefore you can concatenate them 4492together or combine them with constant text in a single argument. 4493 4494@table @code 4495@item %% 4496Substitute one @samp{%} into the program name or argument. 4497 4498@item %i 4499Substitute the name of the input file being processed. 4500 4501@item %b 4502Substitute the basename of the input file being processed. 4503This is the substring up to (and not including) the last period 4504and not including the directory. 4505 4506@item %B 4507This is the same as @samp{%b}, but include the file suffix (text after 4508the last period). 4509 4510@item %d 4511Marks the argument containing or following the @samp{%d} as a 4512temporary file name, so that that file will be deleted if GCC exits 4513successfully. Unlike @samp{%g}, this contributes no text to the 4514argument. 4515 4516@item %g@var{suffix} 4517Substitute a file name that has suffix @var{suffix} and is chosen 4518once per compilation, and mark the argument in the same way as 4519@samp{%d}. To reduce exposure to denial-of-service attacks, the file 4520name is now chosen in a way that is hard to predict even when previously 4521chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 4522might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 4523the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 4524treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 4525was simply substituted with a file name chosen once per compilation, 4526without regard to any appended suffix (which was therefore treated 4527just like ordinary text), making such attacks more likely to succeed. 4528 4529@item %u@var{suffix} 4530Like @samp{%g}, but generates a new temporary file name even if 4531@samp{%u@var{suffix}} was already seen. 4532 4533@item %U@var{suffix} 4534Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 4535new one if there is no such last file name. In the absence of any 4536@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 4537the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 4538would involve the generation of two distinct file names, one 4539for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 4540simply substituted with a file name chosen for the previous @samp{%u}, 4541without regard to any appended suffix. 4542 4543@item %j@var{SUFFIX} 4544Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 4545writable, and if save-temps is off; otherwise, substitute the name 4546of a temporary file, just like @samp{%u}. This temporary file is not 4547meant for communication between processes, but rather as a junk 4548disposal mechanism. 4549 4550@item %.@var{SUFFIX} 4551Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 4552when it is subsequently output with @samp{%*}. @var{SUFFIX} is 4553terminated by the next space or %. 4554 4555@item %w 4556Marks the argument containing or following the @samp{%w} as the 4557designated output file of this compilation. This puts the argument 4558into the sequence of arguments that @samp{%o} will substitute later. 4559 4560@item %o 4561Substitutes the names of all the output files, with spaces 4562automatically placed around them. You should write spaces 4563around the @samp{%o} as well or the results are undefined. 4564@samp{%o} is for use in the specs for running the linker. 4565Input files whose names have no recognized suffix are not compiled 4566at all, but they are included among the output files, so they will 4567be linked. 4568 4569@item %O 4570Substitutes the suffix for object files. Note that this is 4571handled specially when it immediately follows @samp{%g, %u, or %U}, 4572because of the need for those to form complete file names. The 4573handling is such that @samp{%O} is treated exactly as if it had already 4574been substituted, except that @samp{%g, %u, and %U} do not currently 4575support additional @var{suffix} characters following @samp{%O} as they would 4576following, for example, @samp{.o}. 4577 4578@item %p 4579Substitutes the standard macro predefinitions for the 4580current target machine. Use this when running @code{cpp}. 4581 4582@item %P 4583Like @samp{%p}, but puts @samp{__} before and after the name of each 4584predefined macro, except for macros that start with @samp{__} or with 4585@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 4586C@. 4587 4588@item %I 4589Substitute a @option{-iprefix} option made from @env{GCC_EXEC_PREFIX}. 4590 4591@item %s 4592Current argument is the name of a library or startup file of some sort. 4593Search for that file in a standard list of directories and substitute 4594the full name found. 4595 4596@item %e@var{str} 4597Print @var{str} as an error message. @var{str} is terminated by a newline. 4598Use this when inconsistent options are detected. 4599 4600@item %| 4601Output @samp{-} if the input for the current command is coming from a pipe. 4602 4603@item %(@var{name}) 4604Substitute the contents of spec string @var{name} at this point. 4605 4606@item %[@var{name}] 4607Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments. 4608 4609@item %x@{@var{option}@} 4610Accumulate an option for @samp{%X}. 4611 4612@item %X 4613Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 4614spec string. 4615 4616@item %Y 4617Output the accumulated assembler options specified by @option{-Wa}. 4618 4619@item %Z 4620Output the accumulated preprocessor options specified by @option{-Wp}. 4621 4622@item %v1 4623Substitute the major version number of GCC@. 4624(For version 2.9.5, this is 2.) 4625 4626@item %v2 4627Substitute the minor version number of GCC@. 4628(For version 2.9.5, this is 9.) 4629 4630@item %v3 4631Substitute the patch level number of GCC@. 4632(For version 2.9.5, this is 5.) 4633 4634@item %a 4635Process the @code{asm} spec. This is used to compute the 4636switches to be passed to the assembler. 4637 4638@item %A 4639Process the @code{asm_final} spec. This is a spec string for 4640passing switches to an assembler post-processor, if such a program is 4641needed. 4642 4643@item %l 4644Process the @code{link} spec. This is the spec for computing the 4645command line passed to the linker. Typically it will make use of the 4646@samp{%L %G %S %D and %E} sequences. 4647 4648@item %D 4649Dump out a @option{-L} option for each directory that GCC believes might 4650contain startup files. If the target supports multilibs then the 4651current multilib directory will be prepended to each of these paths. 4652 4653@item %M 4654Output the multilib directory with directory separators replaced with 4655@samp{_}. If multilib directories are not set, or the multilib directory is 4656@file{.} then this option emits nothing. 4657 4658@item %L 4659Process the @code{lib} spec. This is a spec string for deciding which 4660libraries should be included on the command line to the linker. 4661 4662@item %G 4663Process the @code{libgcc} spec. This is a spec string for deciding 4664which GCC support library should be included on the command line to the linker. 4665 4666@item %S 4667Process the @code{startfile} spec. This is a spec for deciding which 4668object files should be the first ones passed to the linker. Typically 4669this might be a file named @file{crt0.o}. 4670 4671@item %E 4672Process the @code{endfile} spec. This is a spec string that specifies 4673the last object files that will be passed to the linker. 4674 4675@item %C 4676Process the @code{cpp} spec. This is used to construct the arguments 4677to be passed to the C preprocessor. 4678 4679@item %c 4680Process the @code{signed_char} spec. This is intended to be used 4681to tell cpp whether a char is signed. It typically has the definition: 4682@smallexample 4683%@{funsigned-char:-D__CHAR_UNSIGNED__@} 4684@end smallexample 4685 4686@item %1 4687Process the @code{cc1} spec. This is used to construct the options to be 4688passed to the actual C compiler (@samp{cc1}). 4689 4690@item %2 4691Process the @code{cc1plus} spec. This is used to construct the options to be 4692passed to the actual C++ compiler (@samp{cc1plus}). 4693 4694@item %* 4695Substitute the variable part of a matched option. See below. 4696Note that each comma in the substituted string is replaced by 4697a single space. 4698 4699@item %@{@code{S}@} 4700Substitutes the @code{-S} switch, if that switch was given to GCC@. 4701If that switch was not specified, this substitutes nothing. Note that 4702the leading dash is omitted when specifying this option, and it is 4703automatically inserted if the substitution is performed. Thus the spec 4704string @samp{%@{foo@}} would match the command-line option @option{-foo} 4705and would output the command line option @option{-foo}. 4706 4707@item %W@{@code{S}@} 4708Like %@{@code{S}@} but mark last argument supplied within as a file to be 4709deleted on failure. 4710 4711@item %@{@code{S}*@} 4712Substitutes all the switches specified to GCC whose names start 4713with @code{-S}, but which also take an argument. This is used for 4714switches like @option{-o}, @option{-D}, @option{-I}, etc. 4715GCC considers @option{-o foo} as being 4716one switch whose names starts with @samp{o}. %@{o*@} would substitute this 4717text, including the space. Thus two arguments would be generated. 4718 4719@item %@{^@code{S}*@} 4720Like %@{@code{S}*@}, but don't put a blank between a switch and its 4721argument. Thus %@{^o*@} would only generate one argument, not two. 4722 4723@item %@{@code{S}*&@code{T}*@} 4724Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 4725(the order of @code{S} and @code{T} in the spec is not significant). 4726There can be any number of ampersand-separated variables; for each the 4727wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 4728 4729@item %@{<@code{S}@} 4730Remove all occurrences of @code{-S} from the command line. Note---this 4731command is position dependent. @samp{%} commands in the spec string 4732before this option will see @code{-S}, @samp{%} commands in the spec 4733string after this option will not. 4734 4735@item %@{@code{S}*:@code{X}@} 4736Substitutes @code{X} if one or more switches whose names start with 4737@code{-S} are specified to GCC@. Note that the tail part of the 4738@code{-S} option (i.e.@: the part matched by the @samp{*}) will be substituted 4739for each occurrence of @samp{%*} within @code{X}. 4740 4741@item %@{@code{S}:@code{X}@} 4742Substitutes @code{X}, but only if the @samp{-S} switch was given to GCC@. 4743 4744@item %@{!@code{S}:@code{X}@} 4745Substitutes @code{X}, but only if the @samp{-S} switch was @emph{not} given to GCC@. 4746 4747@item %@{|@code{S}:@code{X}@} 4748Like %@{@code{S}:@code{X}@}, but if no @code{S} switch, substitute @samp{-}. 4749 4750@item %@{|!@code{S}:@code{X}@} 4751Like %@{!@code{S}:@code{X}@}, but if there is an @code{S} switch, substitute @samp{-}. 4752 4753@item %@{.@code{S}:@code{X}@} 4754Substitutes @code{X}, but only if processing a file with suffix @code{S}. 4755 4756@item %@{!.@code{S}:@code{X}@} 4757Substitutes @code{X}, but only if @emph{not} processing a file with suffix @code{S}. 4758 4759@item %@{@code{S}|@code{P}:@code{X}@} 4760Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. This may be 4761combined with @samp{!} and @samp{.} sequences as well, although they 4762have a stronger binding than the @samp{|}. For example a spec string 4763like this: 4764 4765@smallexample 4766%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 4767@end smallexample 4768 4769will output the following command-line options from the following input 4770command-line options: 4771 4772@smallexample 4773fred.c -foo -baz 4774jim.d -bar -boggle 4775-d fred.c -foo -baz -boggle 4776-d jim.d -bar -baz -boggle 4777@end smallexample 4778 4779@end table 4780 4781The conditional text @code{X} in a %@{@code{S}:@code{X}@} or 4782%@{!@code{S}:@code{X}@} construct may contain other nested @samp{%} constructs 4783or spaces, or even newlines. They are processed as usual, as described 4784above. 4785 4786The @option{-O}, @option{-f}, @option{-m}, and @option{-W} 4787switches are handled specifically in these 4788constructs. If another value of @option{-O} or the negated form of a @option{-f}, @option{-m}, or 4789@option{-W} switch is found later in the command line, the earlier switch 4790value is ignored, except with @{@code{S}*@} where @code{S} is just one 4791letter, which passes all matching options. 4792 4793The character @samp{|} at the beginning of the predicate text is used to indicate 4794that a command should be piped to the following command, but only if @option{-pipe} 4795is specified. 4796 4797It is built into GCC which switches take arguments and which do not. 4798(You might think it would be useful to generalize this to allow each 4799compiler's spec to say which switches take arguments. But this cannot 4800be done in a consistent fashion. GCC cannot even decide which input 4801files have been specified without knowing which switches take arguments, 4802and it must know which input files to compile in order to tell which 4803compilers to run). 4804 4805GCC also knows implicitly that arguments starting in @option{-l} are to be 4806treated as compiler output files, and passed to the linker in their 4807proper position among the other output files. 4808 4809@c man begin OPTIONS 4810 4811@node Target Options 4812@section Specifying Target Machine and Compiler Version 4813@cindex target options 4814@cindex cross compiling 4815@cindex specifying machine version 4816@cindex specifying compiler version and target machine 4817@cindex compiler version, specifying 4818@cindex target machine, specifying 4819 4820By default, GCC compiles code for the same type of machine that you 4821are using. However, it can also be installed as a cross-compiler, to 4822compile for some other type of machine. In fact, several different 4823configurations of GCC, for different target machines, can be 4824installed side by side. Then you specify which one to use with the 4825@option{-b} option. 4826 4827In addition, older and newer versions of GCC can be installed side 4828by side. One of them (probably the newest) will be the default, but 4829you may sometimes wish to use another. 4830 4831@table @gcctabopt 4832@item -b @var{machine} 4833@opindex b 4834The argument @var{machine} specifies the target machine for compilation. 4835This is useful when you have installed GCC as a cross-compiler. 4836 4837The value to use for @var{machine} is the same as was specified as the 4838machine type when configuring GCC as a cross-compiler. For 4839example, if a cross-compiler was configured with @samp{configure 4840i386v}, meaning to compile for an 80386 running System V, then you 4841would specify @option{-b i386v} to run that cross compiler. 4842 4843When you do not specify @option{-b}, it normally means to compile for 4844the same type of machine that you are using. 4845 4846@item -V @var{version} 4847@opindex V 4848The argument @var{version} specifies which version of GCC to run. 4849This is useful when multiple versions are installed. For example, 4850@var{version} might be @samp{2.0}, meaning to run GCC version 2.0. 4851 4852The default version, when you do not specify @option{-V}, is the last 4853version of GCC that you installed. 4854@end table 4855 4856The @option{-b} and @option{-V} options actually work by controlling part of 4857the file name used for the executable files and libraries used for 4858compilation. A given version of GCC, for a given target machine, is 4859normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}. 4860 4861Thus, sites can customize the effect of @option{-b} or @option{-V} either by 4862changing the names of these directories or adding alternate names (or 4863symbolic links). If in directory @file{/usr/local/lib/gcc-lib/} the 4864file @file{80386} is a link to the file @file{i386v}, then @option{-b 486580386} becomes an alias for @option{-b i386v}. 4866 4867In one respect, the @option{-b} or @option{-V} do not completely change 4868to a different compiler: the top-level driver program @command{gcc} 4869that you originally invoked continues to run and invoke the other 4870executables (preprocessor, compiler per se, assembler and linker) 4871that do the real work. However, since no real work is done in the 4872driver program, it usually does not matter that the driver program 4873in use is not the one for the specified target. It is common for the 4874interface to the other executables to change incompatibly between 4875compiler versions, so unless the version specified is very close to that 4876of the driver (for example, @option{-V 3.0} with a driver program from GCC 4877version 3.0.1), use of @option{-V} may not work; for example, using 4878@option{-V 2.95.2} will not work with a driver program from GCC 3.0. 4879 4880The only way that the driver program depends on the target machine is 4881in the parsing and handling of special machine-specific options. 4882However, this is controlled by a file which is found, along with the 4883other executables, in the directory for the specified version and 4884target machine. As a result, a single installed driver program adapts 4885to any specified target machine, and sufficiently similar compiler 4886versions. 4887 4888The driver program executable does control one significant thing, 4889however: the default version and target machine. Therefore, you can 4890install different instances of the driver program, compiled for 4891different targets or versions, under different names. 4892 4893For example, if the driver for version 2.0 is installed as @command{ogcc} 4894and that for version 2.1 is installed as @command{gcc}, then the command 4895@command{gcc} will use version 2.1 by default, while @command{ogcc} will use 48962.0 by default. However, you can choose either version with either 4897command with the @option{-V} option. 4898 4899@node Submodel Options 4900@section Hardware Models and Configurations 4901@cindex submodel options 4902@cindex specifying hardware config 4903@cindex hardware models and configurations, specifying 4904@cindex machine dependent options 4905 4906Earlier we discussed the standard option @option{-b} which chooses among 4907different installed compilers for completely different target 4908machines, such as VAX vs.@: 68000 vs.@: 80386. 4909 4910In addition, each of these target machine types can have its own 4911special options, starting with @samp{-m}, to choose among various 4912hardware models or configurations---for example, 68010 vs 68020, 4913floating coprocessor or none. A single installed version of the 4914compiler can compile for any model or configuration, according to the 4915options specified. 4916 4917Some configurations of the compiler also support additional special 4918options, usually for compatibility with other compilers on the same 4919platform. 4920 4921These options are defined by the macro @code{TARGET_SWITCHES} in the 4922machine description. The default for the options is also defined by 4923that macro, which enables you to change the defaults. 4924 4925@menu 4926* M680x0 Options:: 4927* M68hc1x Options:: 4928* VAX Options:: 4929* SPARC Options:: 4930* Convex Options:: 4931* AMD29K Options:: 4932* ARM Options:: 4933* MN10200 Options:: 4934* MN10300 Options:: 4935* M32R/D Options:: 4936* M88K Options:: 4937* RS/6000 and PowerPC Options:: 4938* RT Options:: 4939* MIPS Options:: 4940* i386 and x86-64 Options:: 4941* HPPA Options:: 4942* Intel 960 Options:: 4943* DEC Alpha Options:: 4944* DEC Alpha/VMS Options:: 4945* Clipper Options:: 4946* H8/300 Options:: 4947* SH Options:: 4948* System V Options:: 4949* TMS320C3x/C4x Options:: 4950* V850 Options:: 4951* ARC Options:: 4952* NS32K Options:: 4953* AVR Options:: 4954* MCore Options:: 4955* IA-64 Options:: 4956* D30V Options:: 4957* S/390 and zSeries Options:: 4958* CRIS Options:: 4959* MMIX Options:: 4960* PDP-11 Options:: 4961* Xstormy16 Options:: 4962* Xtensa Options:: 4963@end menu 4964 4965@node M680x0 Options 4966@subsection M680x0 Options 4967@cindex M680x0 options 4968 4969These are the @samp{-m} options defined for the 68000 series. The default 4970values for these options depends on which style of 68000 was selected when 4971the compiler was configured; the defaults for the most common choices are 4972given below. 4973 4974@table @gcctabopt 4975@item -m68000 4976@itemx -mc68000 4977@opindex m68000 4978@opindex mc68000 4979Generate output for a 68000. This is the default 4980when the compiler is configured for 68000-based systems. 4981 4982Use this option for microcontrollers with a 68000 or EC000 core, 4983including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 4984 4985@item -m68020 4986@itemx -mc68020 4987@opindex m68020 4988@opindex mc68020 4989Generate output for a 68020. This is the default 4990when the compiler is configured for 68020-based systems. 4991 4992@item -m68881 4993@opindex m68881 4994Generate output containing 68881 instructions for floating point. 4995This is the default for most 68020 systems unless @option{--nfp} was 4996specified when the compiler was configured. 4997 4998@item -m68030 4999@opindex m68030 5000Generate output for a 68030. This is the default when the compiler is 5001configured for 68030-based systems. 5002 5003@item -m68040 5004@opindex m68040 5005Generate output for a 68040. This is the default when the compiler is 5006configured for 68040-based systems. 5007 5008This option inhibits the use of 68881/68882 instructions that have to be 5009emulated by software on the 68040. Use this option if your 68040 does not 5010have code to emulate those instructions. 5011 5012@item -m68060 5013@opindex m68060 5014Generate output for a 68060. This is the default when the compiler is 5015configured for 68060-based systems. 5016 5017This option inhibits the use of 68020 and 68881/68882 instructions that 5018have to be emulated by software on the 68060. Use this option if your 68060 5019does not have code to emulate those instructions. 5020 5021@item -mcpu32 5022@opindex mcpu32 5023Generate output for a CPU32. This is the default 5024when the compiler is configured for CPU32-based systems. 5025 5026Use this option for microcontrollers with a 5027CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 502868336, 68340, 68341, 68349 and 68360. 5029 5030@item -m5200 5031@opindex m5200 5032Generate output for a 520X ``coldfire'' family cpu. This is the default 5033when the compiler is configured for 520X-based systems. 5034 5035Use this option for microcontroller with a 5200 core, including 5036the MCF5202, MCF5203, MCF5204 and MCF5202. 5037 5038 5039@item -m68020-40 5040@opindex m68020-40 5041Generate output for a 68040, without using any of the new instructions. 5042This results in code which can run relatively efficiently on either a 504368020/68881 or a 68030 or a 68040. The generated code does use the 504468881 instructions that are emulated on the 68040. 5045 5046@item -m68020-60 5047@opindex m68020-60 5048Generate output for a 68060, without using any of the new instructions. 5049This results in code which can run relatively efficiently on either a 505068020/68881 or a 68030 or a 68040. The generated code does use the 505168881 instructions that are emulated on the 68060. 5052 5053@item -mfpa 5054@opindex mfpa 5055Generate output containing Sun FPA instructions for floating point. 5056 5057@item -msoft-float 5058@opindex msoft-float 5059Generate output containing library calls for floating point. 5060@strong{Warning:} the requisite libraries are not available for all m68k 5061targets. Normally the facilities of the machine's usual C compiler are 5062used, but this can't be done directly in cross-compilation. You must 5063make your own arrangements to provide suitable library functions for 5064cross-compilation. The embedded targets @samp{m68k-*-aout} and 5065@samp{m68k-*-coff} do provide software floating point support. 5066 5067@item -mshort 5068@opindex mshort 5069Consider type @code{int} to be 16 bits wide, like @code{short int}. 5070 5071@item -mnobitfield 5072@opindex mnobitfield 5073Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 5074and @option{-m5200} options imply @w{@option{-mnobitfield}}. 5075 5076@item -mbitfield 5077@opindex mbitfield 5078Do use the bit-field instructions. The @option{-m68020} option implies 5079@option{-mbitfield}. This is the default if you use a configuration 5080designed for a 68020. 5081 5082@item -mrtd 5083@opindex mrtd 5084Use a different function-calling convention, in which functions 5085that take a fixed number of arguments return with the @code{rtd} 5086instruction, which pops their arguments while returning. This 5087saves one instruction in the caller since there is no need to pop 5088the arguments there. 5089 5090This calling convention is incompatible with the one normally 5091used on Unix, so you cannot use it if you need to call libraries 5092compiled with the Unix compiler. 5093 5094Also, you must provide function prototypes for all functions that 5095take variable numbers of arguments (including @code{printf}); 5096otherwise incorrect code will be generated for calls to those 5097functions. 5098 5099In addition, seriously incorrect code will result if you call a 5100function with too many arguments. (Normally, extra arguments are 5101harmlessly ignored.) 5102 5103The @code{rtd} instruction is supported by the 68010, 68020, 68030, 510468040, 68060 and CPU32 processors, but not by the 68000 or 5200. 5105 5106@item -malign-int 5107@itemx -mno-align-int 5108@opindex malign-int 5109@opindex mno-align-int 5110Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 5111@code{float}, @code{double}, and @code{long double} variables on a 32-bit 5112boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 5113Aligning variables on 32-bit boundaries produces code that runs somewhat 5114faster on processors with 32-bit busses at the expense of more memory. 5115 5116@strong{Warning:} if you use the @option{-malign-int} switch, GCC will 5117align structures containing the above types differently than 5118most published application binary interface specifications for the m68k. 5119 5120@item -mpcrel 5121@opindex mpcrel 5122Use the pc-relative addressing mode of the 68000 directly, instead of 5123using a global offset table. At present, this option implies @option{-fpic}, 5124allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 5125not presently supported with @option{-mpcrel}, though this could be supported for 512668020 and higher processors. 5127 5128@item -mno-strict-align 5129@itemx -mstrict-align 5130@opindex mno-strict-align 5131@opindex mstrict-align 5132Do not (do) assume that unaligned memory references will be handled by 5133the system. 5134 5135@end table 5136 5137@node M68hc1x Options 5138@subsection M68hc1x Options 5139@cindex M68hc1x options 5140 5141These are the @samp{-m} options defined for the 68hc11 and 68hc12 5142microcontrollers. The default values for these options depends on 5143which style of microcontroller was selected when the compiler was configured; 5144the defaults for the most common choices are given below. 5145 5146@table @gcctabopt 5147@item -m6811 5148@itemx -m68hc11 5149@opindex m6811 5150@opindex m68hc11 5151Generate output for a 68HC11. This is the default 5152when the compiler is configured for 68HC11-based systems. 5153 5154@item -m6812 5155@itemx -m68hc12 5156@opindex m6812 5157@opindex m68hc12 5158Generate output for a 68HC12. This is the default 5159when the compiler is configured for 68HC12-based systems. 5160 5161@item -mauto-incdec 5162@opindex mauto-incdec 5163Enable the use of 68HC12 pre and post auto-increment and auto-decrement 5164addressing modes. 5165 5166@item -mshort 5167@opindex mshort 5168Consider type @code{int} to be 16 bits wide, like @code{short int}. 5169 5170@item -msoft-reg-count=@var{count} 5171@opindex msoft-reg-count 5172Specify the number of pseudo-soft registers which are used for the 5173code generation. The maximum number is 32. Using more pseudo-soft 5174register may or may not result in better code depending on the program. 5175The default is 4 for 68HC11 and 2 for 68HC12. 5176 5177@end table 5178 5179@node VAX Options 5180@subsection VAX Options 5181@cindex VAX options 5182 5183These @samp{-m} options are defined for the VAX: 5184 5185@table @gcctabopt 5186@item -munix 5187@opindex munix 5188Do not output certain jump instructions (@code{aobleq} and so on) 5189that the Unix assembler for the VAX cannot handle across long 5190ranges. 5191 5192@item -mgnu 5193@opindex mgnu 5194Do output those jump instructions, on the assumption that you 5195will assemble with the GNU assembler. 5196 5197@item -mg 5198@opindex mg 5199Output code for g-format floating point numbers instead of d-format. 5200@end table 5201 5202@node SPARC Options 5203@subsection SPARC Options 5204@cindex SPARC options 5205 5206These @samp{-m} switches are supported on the SPARC: 5207 5208@table @gcctabopt 5209@item -mno-app-regs 5210@itemx -mapp-regs 5211@opindex mno-app-regs 5212@opindex mapp-regs 5213Specify @option{-mapp-regs} to generate output using the global registers 52142 through 4, which the SPARC SVR4 ABI reserves for applications. This 5215is the default. 5216 5217To be fully SVR4 ABI compliant at the cost of some performance loss, 5218specify @option{-mno-app-regs}. You should compile libraries and system 5219software with this option. 5220 5221@item -mfpu 5222@itemx -mhard-float 5223@opindex mfpu 5224@opindex mhard-float 5225Generate output containing floating point instructions. This is the 5226default. 5227 5228@item -mno-fpu 5229@itemx -msoft-float 5230@opindex mno-fpu 5231@opindex msoft-float 5232Generate output containing library calls for floating point. 5233@strong{Warning:} the requisite libraries are not available for all SPARC 5234targets. Normally the facilities of the machine's usual C compiler are 5235used, but this cannot be done directly in cross-compilation. You must make 5236your own arrangements to provide suitable library functions for 5237cross-compilation. The embedded targets @samp{sparc-*-aout} and 5238@samp{sparclite-*-*} do provide software floating point support. 5239 5240@option{-msoft-float} changes the calling convention in the output file; 5241therefore, it is only useful if you compile @emph{all} of a program with 5242this option. In particular, you need to compile @file{libgcc.a}, the 5243library that comes with GCC, with @option{-msoft-float} in order for 5244this to work. 5245 5246@item -mhard-quad-float 5247@opindex mhard-quad-float 5248Generate output containing quad-word (long double) floating point 5249instructions. 5250 5251@item -msoft-quad-float 5252@opindex msoft-quad-float 5253Generate output containing library calls for quad-word (long double) 5254floating point instructions. The functions called are those specified 5255in the SPARC ABI@. This is the default. 5256 5257As of this writing, there are no sparc implementations that have hardware 5258support for the quad-word floating point instructions. They all invoke 5259a trap handler for one of these instructions, and then the trap handler 5260emulates the effect of the instruction. Because of the trap handler overhead, 5261this is much slower than calling the ABI library routines. Thus the 5262@option{-msoft-quad-float} option is the default. 5263 5264@item -mno-flat 5265@itemx -mflat 5266@opindex mno-flat 5267@opindex mflat 5268With @option{-mflat}, the compiler does not generate save/restore instructions 5269and will use a ``flat'' or single register window calling convention. 5270This model uses %i7 as the frame pointer and is compatible with the normal 5271register window model. Code from either may be intermixed. 5272The local registers and the input registers (0--5) are still treated as 5273``call saved'' registers and will be saved on the stack as necessary. 5274 5275With @option{-mno-flat} (the default), the compiler emits save/restore 5276instructions (except for leaf functions) and is the normal mode of operation. 5277 5278@item -mno-unaligned-doubles 5279@itemx -munaligned-doubles 5280@opindex mno-unaligned-doubles 5281@opindex munaligned-doubles 5282Assume that doubles have 8 byte alignment. This is the default. 5283 5284With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte 5285alignment only if they are contained in another type, or if they have an 5286absolute address. Otherwise, it assumes they have 4 byte alignment. 5287Specifying this option avoids some rare compatibility problems with code 5288generated by other compilers. It is not the default because it results 5289in a performance loss, especially for floating point code. 5290 5291@item -mno-faster-structs 5292@itemx -mfaster-structs 5293@opindex mno-faster-structs 5294@opindex mfaster-structs 5295With @option{-mfaster-structs}, the compiler assumes that structures 5296should have 8 byte alignment. This enables the use of pairs of 5297@code{ldd} and @code{std} instructions for copies in structure 5298assignment, in place of twice as many @code{ld} and @code{st} pairs. 5299However, the use of this changed alignment directly violates the Sparc 5300ABI@. Thus, it's intended only for use on targets where the developer 5301acknowledges that their resulting code will not be directly in line with 5302the rules of the ABI@. 5303 5304@item -mv8 5305@itemx -msparclite 5306@opindex mv8 5307@opindex msparclite 5308These two options select variations on the SPARC architecture. 5309 5310By default (unless specifically configured for the Fujitsu SPARClite), 5311GCC generates code for the v7 variant of the SPARC architecture. 5312 5313@option{-mv8} will give you SPARC v8 code. The only difference from v7 5314code is that the compiler emits the integer multiply and integer 5315divide instructions which exist in SPARC v8 but not in SPARC v7. 5316 5317@option{-msparclite} will give you SPARClite code. This adds the integer 5318multiply, integer divide step and scan (@code{ffs}) instructions which 5319exist in SPARClite but not in SPARC v7. 5320 5321These options are deprecated and will be deleted in a future GCC release. 5322They have been replaced with @option{-mcpu=xxx}. 5323 5324@item -mcypress 5325@itemx -msupersparc 5326@opindex mcypress 5327@opindex msupersparc 5328These two options select the processor for which the code is optimized. 5329 5330With @option{-mcypress} (the default), the compiler optimizes code for the 5331Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series. 5332This is also appropriate for the older SparcStation 1, 2, IPX etc. 5333 5334With @option{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as 5335used in the SparcStation 10, 1000 and 2000 series. This flag also enables use 5336of the full SPARC v8 instruction set. 5337 5338These options are deprecated and will be deleted in a future GCC release. 5339They have been replaced with @option{-mcpu=xxx}. 5340 5341@item -mcpu=@var{cpu_type} 5342@opindex mcpu 5343Set the instruction set, register set, and instruction scheduling parameters 5344for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 5345@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite}, 5346@samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934}, 5347@samp{sparclet}, @samp{tsc701}, @samp{v9}, and @samp{ultrasparc}. 5348 5349Default instruction scheduling parameters are used for values that select 5350an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 5351@samp{sparclite}, @samp{sparclet}, @samp{v9}. 5352 5353Here is a list of each supported architecture and their supported 5354implementations. 5355 5356@smallexample 5357 v7: cypress 5358 v8: supersparc, hypersparc 5359 sparclite: f930, f934, sparclite86x 5360 sparclet: tsc701 5361 v9: ultrasparc 5362@end smallexample 5363 5364@item -mtune=@var{cpu_type} 5365@opindex mtune 5366Set the instruction scheduling parameters for machine type 5367@var{cpu_type}, but do not set the instruction set or register set that the 5368option @option{-mcpu=@var{cpu_type}} would. 5369 5370The same values for @option{-mcpu=@var{cpu_type}} can be used for 5371@option{-mtune=@var{cpu_type}}, but the only useful values are those 5372that select a particular cpu implementation. Those are @samp{cypress}, 5373@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934}, 5374@samp{sparclite86x}, @samp{tsc701}, and @samp{ultrasparc}. 5375 5376@end table 5377 5378These @samp{-m} switches are supported in addition to the above 5379on the SPARCLET processor. 5380 5381@table @gcctabopt 5382@item -mlittle-endian 5383@opindex mlittle-endian 5384Generate code for a processor running in little-endian mode. 5385 5386@item -mlive-g0 5387@opindex mlive-g0 5388Treat register @code{%g0} as a normal register. 5389GCC will continue to clobber it as necessary but will not assume 5390it always reads as 0. 5391 5392@item -mbroken-saverestore 5393@opindex mbroken-saverestore 5394Generate code that does not use non-trivial forms of the @code{save} and 5395@code{restore} instructions. Early versions of the SPARCLET processor do 5396not correctly handle @code{save} and @code{restore} instructions used with 5397arguments. They correctly handle them used without arguments. A @code{save} 5398instruction used without arguments increments the current window pointer 5399but does not allocate a new stack frame. It is assumed that the window 5400overflow trap handler will properly handle this case as will interrupt 5401handlers. 5402@end table 5403 5404These @samp{-m} switches are supported in addition to the above 5405on SPARC V9 processors in 64-bit environments. 5406 5407@table @gcctabopt 5408@item -mlittle-endian 5409@opindex mlittle-endian 5410Generate code for a processor running in little-endian mode. 5411 5412@item -m32 5413@itemx -m64 5414@opindex m32 5415@opindex m64 5416Generate code for a 32-bit or 64-bit environment. 5417The 32-bit environment sets int, long and pointer to 32 bits. 5418The 64-bit environment sets int to 32 bits and long and pointer 5419to 64 bits. 5420 5421@item -mcmodel=medlow 5422@opindex mcmodel=medlow 5423Generate code for the Medium/Low code model: the program must be linked 5424in the low 32 bits of the address space. Pointers are 64 bits. 5425Programs can be statically or dynamically linked. 5426 5427@item -mcmodel=medmid 5428@opindex mcmodel=medmid 5429Generate code for the Medium/Middle code model: the program must be linked 5430in the low 44 bits of the address space, the text segment must be less than 54312G bytes, and data segment must be within 2G of the text segment. 5432Pointers are 64 bits. 5433 5434@item -mcmodel=medany 5435@opindex mcmodel=medany 5436Generate code for the Medium/Anywhere code model: the program may be linked 5437anywhere in the address space, the text segment must be less than 54382G bytes, and data segment must be within 2G of the text segment. 5439Pointers are 64 bits. 5440 5441@item -mcmodel=embmedany 5442@opindex mcmodel=embmedany 5443Generate code for the Medium/Anywhere code model for embedded systems: 5444assume a 32-bit text and a 32-bit data segment, both starting anywhere 5445(determined at link time). Register %g4 points to the base of the 5446data segment. Pointers are still 64 bits. 5447Programs are statically linked, PIC is not supported. 5448 5449@item -mstack-bias 5450@itemx -mno-stack-bias 5451@opindex mstack-bias 5452@opindex mno-stack-bias 5453With @option{-mstack-bias}, GCC assumes that the stack pointer, and 5454frame pointer if present, are offset by @minus{}2047 which must be added back 5455when making stack frame references. 5456Otherwise, assume no such offset is present. 5457@end table 5458 5459@node Convex Options 5460@subsection Convex Options 5461@cindex Convex options 5462 5463These @samp{-m} options are defined for Convex: 5464 5465@table @gcctabopt 5466@item -mc1 5467@opindex mc1 5468Generate output for C1. The code will run on any Convex machine. 5469The preprocessor symbol @code{__convex__c1__} is defined. 5470 5471@item -mc2 5472@opindex mc2 5473Generate output for C2. Uses instructions not available on C1. 5474Scheduling and other optimizations are chosen for max performance on C2. 5475The preprocessor symbol @code{__convex_c2__} is defined. 5476 5477@item -mc32 5478@opindex mc32 5479Generate output for C32xx. Uses instructions not available on C1. 5480Scheduling and other optimizations are chosen for max performance on C32. 5481The preprocessor symbol @code{__convex_c32__} is defined. 5482 5483@item -mc34 5484@opindex mc34 5485Generate output for C34xx. Uses instructions not available on C1. 5486Scheduling and other optimizations are chosen for max performance on C34. 5487The preprocessor symbol @code{__convex_c34__} is defined. 5488 5489@item -mc38 5490@opindex mc38 5491Generate output for C38xx. Uses instructions not available on C1. 5492Scheduling and other optimizations are chosen for max performance on C38. 5493The preprocessor symbol @code{__convex_c38__} is defined. 5494 5495@item -margcount 5496@opindex margcount 5497Generate code which puts an argument count in the word preceding each 5498argument list. This is compatible with regular CC, and a few programs 5499may need the argument count word. GDB and other source-level debuggers 5500do not need it; this info is in the symbol table. 5501 5502@item -mnoargcount 5503@opindex mnoargcount 5504Omit the argument count word. This is the default. 5505 5506@item -mvolatile-cache 5507@opindex mvolatile-cache 5508Allow volatile references to be cached. This is the default. 5509 5510@item -mvolatile-nocache 5511@opindex mvolatile-nocache 5512Volatile references bypass the data cache, going all the way to memory. 5513This is only needed for multi-processor code that does not use standard 5514synchronization instructions. Making non-volatile references to volatile 5515locations will not necessarily work. 5516 5517@item -mlong32 5518@opindex mlong32 5519Type long is 32 bits, the same as type int. This is the default. 5520 5521@item -mlong64 5522@opindex mlong64 5523Type long is 64 bits, the same as type long long. This option is useless, 5524because no library support exists for it. 5525@end table 5526 5527@node AMD29K Options 5528@subsection AMD29K Options 5529@cindex AMD29K options 5530 5531These @samp{-m} options are defined for the AMD Am29000: 5532 5533@table @gcctabopt 5534@item -mdw 5535@opindex mdw 5536@cindex DW bit (29k) 5537Generate code that assumes the @code{DW} bit is set, i.e., that byte and 5538halfword operations are directly supported by the hardware. This is the 5539default. 5540 5541@item -mndw 5542@opindex mndw 5543Generate code that assumes the @code{DW} bit is not set. 5544 5545@item -mbw 5546@opindex mbw 5547@cindex byte writes (29k) 5548Generate code that assumes the system supports byte and halfword write 5549operations. This is the default. 5550 5551@item -mnbw 5552@opindex mnbw 5553Generate code that assumes the systems does not support byte and 5554halfword write operations. @option{-mnbw} implies @option{-mndw}. 5555 5556@item -msmall 5557@opindex msmall 5558@cindex memory model (29k) 5559Use a small memory model that assumes that all function addresses are 5560either within a single 256 KB segment or at an absolute address of less 5561than 256k. This allows the @code{call} instruction to be used instead 5562of a @code{const}, @code{consth}, @code{calli} sequence. 5563 5564@item -mnormal 5565@opindex mnormal 5566Use the normal memory model: Generate @code{call} instructions only when 5567calling functions in the same file and @code{calli} instructions 5568otherwise. This works if each file occupies less than 256 KB but allows 5569the entire executable to be larger than 256 KB@. This is the default. 5570 5571@item -mlarge 5572@opindex mlarge 5573Always use @code{calli} instructions. Specify this option if you expect 5574a single file to compile into more than 256 KB of code. 5575 5576@item -m29050 5577@opindex m29050 5578@cindex processor selection (29k) 5579Generate code for the Am29050. 5580 5581@item -m29000 5582@opindex m29000 5583Generate code for the Am29000. This is the default. 5584 5585@item -mkernel-registers 5586@opindex mkernel-registers 5587@cindex kernel and user registers (29k) 5588Generate references to registers @code{gr64-gr95} instead of to 5589registers @code{gr96-gr127}. This option can be used when compiling 5590kernel code that wants a set of global registers disjoint from that used 5591by user-mode code. 5592 5593Note that when this option is used, register names in @samp{-f} flags 5594must use the normal, user-mode, names. 5595 5596@item -muser-registers 5597@opindex muser-registers 5598Use the normal set of global registers, @code{gr96-gr127}. This is the 5599default. 5600 5601@item -mstack-check 5602@itemx -mno-stack-check 5603@opindex mstack-check 5604@opindex mno-stack-check 5605@cindex stack checks (29k) 5606Insert (or do not insert) a call to @code{__msp_check} after each stack 5607adjustment. This is often used for kernel code. 5608 5609@item -mstorem-bug 5610@itemx -mno-storem-bug 5611@opindex mstorem-bug 5612@opindex mno-storem-bug 5613@cindex storem bug (29k) 5614@option{-mstorem-bug} handles 29k processors which cannot handle the 5615separation of a mtsrim insn and a storem instruction (most 29000 chips 5616to date, but not the 29050). 5617 5618@item -mno-reuse-arg-regs 5619@itemx -mreuse-arg-regs 5620@opindex mno-reuse-arg-regs 5621@opindex mreuse-arg-regs 5622@option{-mno-reuse-arg-regs} tells the compiler to only use incoming argument 5623registers for copying out arguments. This helps detect calling a function 5624with fewer arguments than it was declared with. 5625 5626@item -mno-impure-text 5627@itemx -mimpure-text 5628@opindex mno-impure-text 5629@opindex mimpure-text 5630@option{-mimpure-text}, used in addition to @option{-shared}, tells the compiler to 5631not pass @option{-assert pure-text} to the linker when linking a shared object. 5632 5633@item -msoft-float 5634@opindex msoft-float 5635Generate output containing library calls for floating point. 5636@strong{Warning:} the requisite libraries are not part of GCC@. 5637Normally the facilities of the machine's usual C compiler are used, but 5638this can't be done directly in cross-compilation. You must make your 5639own arrangements to provide suitable library functions for 5640cross-compilation. 5641 5642@item -mno-multm 5643@opindex mno-multm 5644Do not generate multm or multmu instructions. This is useful for some embedded 5645systems which do not have trap handlers for these instructions. 5646@end table 5647 5648@node ARM Options 5649@subsection ARM Options 5650@cindex ARM options 5651 5652These @samp{-m} options are defined for Advanced RISC Machines (ARM) 5653architectures: 5654 5655@table @gcctabopt 5656@item -mapcs-frame 5657@opindex mapcs-frame 5658Generate a stack frame that is compliant with the ARM Procedure Call 5659Standard for all functions, even if this is not strictly necessary for 5660correct execution of the code. Specifying @option{-fomit-frame-pointer} 5661with this option will cause the stack frames not to be generated for 5662leaf functions. The default is @option{-mno-apcs-frame}. 5663 5664@item -mapcs 5665@opindex mapcs 5666This is a synonym for @option{-mapcs-frame}. 5667 5668@item -mapcs-26 5669@opindex mapcs-26 5670Generate code for a processor running with a 26-bit program counter, 5671and conforming to the function calling standards for the APCS 26-bit 5672option. This option replaces the @option{-m2} and @option{-m3} options 5673of previous releases of the compiler. 5674 5675@item -mapcs-32 5676@opindex mapcs-32 5677Generate code for a processor running with a 32-bit program counter, 5678and conforming to the function calling standards for the APCS 32-bit 5679option. This option replaces the @option{-m6} option of previous releases 5680of the compiler. 5681 5682@ignore 5683@c not currently implemented 5684@item -mapcs-stack-check 5685@opindex mapcs-stack-check 5686Generate code to check the amount of stack space available upon entry to 5687every function (that actually uses some stack space). If there is 5688insufficient space available then either the function 5689@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be 5690called, depending upon the amount of stack space required. The run time 5691system is required to provide these functions. The default is 5692@option{-mno-apcs-stack-check}, since this produces smaller code. 5693 5694@c not currently implemented 5695@item -mapcs-float 5696@opindex mapcs-float 5697Pass floating point arguments using the float point registers. This is 5698one of the variants of the APCS@. This option is recommended if the 5699target hardware has a floating point unit or if a lot of floating point 5700arithmetic is going to be performed by the code. The default is 5701@option{-mno-apcs-float}, since integer only code is slightly increased in 5702size if @option{-mapcs-float} is used. 5703 5704@c not currently implemented 5705@item -mapcs-reentrant 5706@opindex mapcs-reentrant 5707Generate reentrant, position independent code. The default is 5708@option{-mno-apcs-reentrant}. 5709@end ignore 5710 5711@item -mthumb-interwork 5712@opindex mthumb-interwork 5713Generate code which supports calling between the ARM and Thumb 5714instruction sets. Without this option the two instruction sets cannot 5715be reliably used inside one program. The default is 5716@option{-mno-thumb-interwork}, since slightly larger code is generated 5717when @option{-mthumb-interwork} is specified. 5718 5719@item -mno-sched-prolog 5720@opindex mno-sched-prolog 5721Prevent the reordering of instructions in the function prolog, or the 5722merging of those instruction with the instructions in the function's 5723body. This means that all functions will start with a recognizable set 5724of instructions (or in fact one of a choice from a small set of 5725different function prologues), and this information can be used to 5726locate the start if functions inside an executable piece of code. The 5727default is @option{-msched-prolog}. 5728 5729@item -mhard-float 5730@opindex mhard-float 5731Generate output containing floating point instructions. This is the 5732default. 5733 5734@item -msoft-float 5735@opindex msoft-float 5736Generate output containing library calls for floating point. 5737@strong{Warning:} the requisite libraries are not available for all ARM 5738targets. Normally the facilities of the machine's usual C compiler are 5739used, but this cannot be done directly in cross-compilation. You must make 5740your own arrangements to provide suitable library functions for 5741cross-compilation. 5742 5743@option{-msoft-float} changes the calling convention in the output file; 5744therefore, it is only useful if you compile @emph{all} of a program with 5745this option. In particular, you need to compile @file{libgcc.a}, the 5746library that comes with GCC, with @option{-msoft-float} in order for 5747this to work. 5748 5749@item -mlittle-endian 5750@opindex mlittle-endian 5751Generate code for a processor running in little-endian mode. This is 5752the default for all standard configurations. 5753 5754@item -mbig-endian 5755@opindex mbig-endian 5756Generate code for a processor running in big-endian mode; the default is 5757to compile code for a little-endian processor. 5758 5759@item -mwords-little-endian 5760@opindex mwords-little-endian 5761This option only applies when generating code for big-endian processors. 5762Generate code for a little-endian word order but a big-endian byte 5763order. That is, a byte order of the form @samp{32107654}. Note: this 5764option should only be used if you require compatibility with code for 5765big-endian ARM processors generated by versions of the compiler prior to 57662.8. 5767 5768@item -malignment-traps 5769@opindex malignment-traps 5770Generate code that will not trap if the MMU has alignment traps enabled. 5771On ARM architectures prior to ARMv4, there were no instructions to 5772access half-word objects stored in memory. However, when reading from 5773memory a feature of the ARM architecture allows a word load to be used, 5774even if the address is unaligned, and the processor core will rotate the 5775data as it is being loaded. This option tells the compiler that such 5776misaligned accesses will cause a MMU trap and that it should instead 5777synthesise the access as a series of byte accesses. The compiler can 5778still use word accesses to load half-word data if it knows that the 5779address is aligned to a word boundary. 5780 5781This option is ignored when compiling for ARM architecture 4 or later, 5782since these processors have instructions to directly access half-word 5783objects in memory. 5784 5785@item -mno-alignment-traps 5786@opindex mno-alignment-traps 5787Generate code that assumes that the MMU will not trap unaligned 5788accesses. This produces better code when the target instruction set 5789does not have half-word memory operations (i.e.@: implementations prior to 5790ARMv4). 5791 5792Note that you cannot use this option to access unaligned word objects, 5793since the processor will only fetch one 32-bit aligned object from 5794memory. 5795 5796The default setting for most targets is @option{-mno-alignment-traps}, since 5797this produces better code when there are no half-word memory 5798instructions available. 5799 5800@item -mshort-load-bytes 5801@itemx -mno-short-load-words 5802@opindex mshort-load-bytes 5803@opindex mno-short-load-words 5804These are deprecated aliases for @option{-malignment-traps}. 5805 5806@item -mno-short-load-bytes 5807@itemx -mshort-load-words 5808@opindex mno-short-load-bytes 5809@opindex mshort-load-words 5810This are deprecated aliases for @option{-mno-alignment-traps}. 5811 5812@item -mbsd 5813@opindex mbsd 5814This option only applies to RISC iX@. Emulate the native BSD-mode 5815compiler. This is the default if @option{-ansi} is not specified. 5816 5817@item -mxopen 5818@opindex mxopen 5819This option only applies to RISC iX@. Emulate the native X/Open-mode 5820compiler. 5821 5822@item -mno-symrename 5823@opindex mno-symrename 5824This option only applies to RISC iX@. Do not run the assembler 5825post-processor, @samp{symrename}, after code has been assembled. 5826Normally it is necessary to modify some of the standard symbols in 5827preparation for linking with the RISC iX C library; this option 5828suppresses this pass. The post-processor is never run when the 5829compiler is built for cross-compilation. 5830 5831@item -mcpu=@var{name} 5832@opindex mcpu 5833This specifies the name of the target ARM processor. GCC uses this name 5834to determine what kind of instructions it can emit when generating 5835assembly code. Permissible names are: @samp{arm2}, @samp{arm250}, 5836@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 5837@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 5838@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 5839@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 5840@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8}, 5841@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 5842@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 5843@samp{arm920t}, @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, 5844@samp{arm1020t}, @samp{xscale}. 5845 5846@itemx -mtune=@var{name} 5847@opindex mtune 5848This option is very similar to the @option{-mcpu=} option, except that 5849instead of specifying the actual target processor type, and hence 5850restricting which instructions can be used, it specifies that GCC should 5851tune the performance of the code as if the target were of the type 5852specified in this option, but still choosing the instructions that it 5853will generate based on the cpu specified by a @option{-mcpu=} option. 5854For some ARM implementations better performance can be obtained by using 5855this option. 5856 5857@item -march=@var{name} 5858@opindex march 5859This specifies the name of the target ARM architecture. GCC uses this 5860name to determine what kind of instructions it can emit when generating 5861assembly code. This option can be used in conjunction with or instead 5862of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, 5863@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, 5864@samp{armv5}, @samp{armv5t}, @samp{armv5te}. 5865 5866@item -mfpe=@var{number} 5867@itemx -mfp=@var{number} 5868@opindex mfpe 5869@opindex mfp 5870This specifies the version of the floating point emulation available on 5871the target. Permissible values are 2 and 3. @option{-mfp=} is a synonym 5872for @option{-mfpe=}, for compatibility with older versions of GCC@. 5873 5874@item -mstructure-size-boundary=@var{n} 5875@opindex mstructure-size-boundary 5876The size of all structures and unions will be rounded up to a multiple 5877of the number of bits set by this option. Permissible values are 8 and 587832. The default value varies for different toolchains. For the COFF 5879targeted toolchain the default value is 8. Specifying the larger number 5880can produce faster, more efficient code, but can also increase the size 5881of the program. The two values are potentially incompatible. Code 5882compiled with one value cannot necessarily expect to work with code or 5883libraries compiled with the other value, if they exchange information 5884using structures or unions. 5885 5886@item -mabort-on-noreturn 5887@opindex mabort-on-noreturn 5888Generate a call to the function @code{abort} at the end of a 5889@code{noreturn} function. It will be executed if the function tries to 5890return. 5891 5892@item -mlong-calls 5893@itemx -mno-long-calls 5894@opindex mlong-calls 5895@opindex mno-long-calls 5896Tells the compiler to perform function calls by first loading the 5897address of the function into a register and then performing a subroutine 5898call on this register. This switch is needed if the target function 5899will lie outside of the 64 megabyte addressing range of the offset based 5900version of subroutine call instruction. 5901 5902Even if this switch is enabled, not all function calls will be turned 5903into long calls. The heuristic is that static functions, functions 5904which have the @samp{short-call} attribute, functions that are inside 5905the scope of a @samp{#pragma no_long_calls} directive and functions whose 5906definitions have already been compiled within the current compilation 5907unit, will not be turned into long calls. The exception to this rule is 5908that weak function definitions, functions with the @samp{long-call} 5909attribute or the @samp{section} attribute, and functions that are within 5910the scope of a @samp{#pragma long_calls} directive, will always be 5911turned into long calls. 5912 5913This feature is not enabled by default. Specifying 5914@option{-mno-long-calls} will restore the default behavior, as will 5915placing the function calls within the scope of a @samp{#pragma 5916long_calls_off} directive. Note these switches have no effect on how 5917the compiler generates code to handle function calls via function 5918pointers. 5919 5920@item -mnop-fun-dllimport 5921@opindex mnop-fun-dllimport 5922Disable support for the @code{dllimport} attribute. 5923 5924@item -msingle-pic-base 5925@opindex msingle-pic-base 5926Treat the register used for PIC addressing as read-only, rather than 5927loading it in the prologue for each function. The run-time system is 5928responsible for initializing this register with an appropriate value 5929before execution begins. 5930 5931@item -mpic-register=@var{reg} 5932@opindex mpic-register 5933Specify the register to be used for PIC addressing. The default is R10 5934unless stack-checking is enabled, when R9 is used. 5935 5936@item -mpoke-function-name 5937@opindex mpoke-function-name 5938Write the name of each function into the text section, directly 5939preceding the function prologue. The generated code is similar to this: 5940 5941@smallexample 5942 t0 5943 .ascii "arm_poke_function_name", 0 5944 .align 5945 t1 5946 .word 0xff000000 + (t1 - t0) 5947 arm_poke_function_name 5948 mov ip, sp 5949 stmfd sp!, @{fp, ip, lr, pc@} 5950 sub fp, ip, #4 5951@end smallexample 5952 5953When performing a stack backtrace, code can inspect the value of 5954@code{pc} stored at @code{fp + 0}. If the trace function then looks at 5955location @code{pc - 12} and the top 8 bits are set, then we know that 5956there is a function name embedded immediately preceding this location 5957and has length @code{((pc[-3]) & 0xff000000)}. 5958 5959@item -mthumb 5960@opindex mthumb 5961Generate code for the 16-bit Thumb instruction set. The default is to 5962use the 32-bit ARM instruction set. 5963 5964@item -mtpcs-frame 5965@opindex mtpcs-frame 5966Generate a stack frame that is compliant with the Thumb Procedure Call 5967Standard for all non-leaf functions. (A leaf function is one that does 5968not call any other functions.) The default is @option{-mno-tpcs-frame}. 5969 5970@item -mtpcs-leaf-frame 5971@opindex mtpcs-leaf-frame 5972Generate a stack frame that is compliant with the Thumb Procedure Call 5973Standard for all leaf functions. (A leaf function is one that does 5974not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 5975 5976@item -mcallee-super-interworking 5977@opindex mcallee-super-interworking 5978Gives all externally visible functions in the file being compiled an ARM 5979instruction set header which switches to Thumb mode before executing the 5980rest of the function. This allows these functions to be called from 5981non-interworking code. 5982 5983@item -mcaller-super-interworking 5984@opindex mcaller-super-interworking 5985Allows calls via function pointers (including virtual functions) to 5986execute correctly regardless of whether the target code has been 5987compiled for interworking or not. There is a small overhead in the cost 5988of executing a function pointer if this option is enabled. 5989 5990@end table 5991 5992@node MN10200 Options 5993@subsection MN10200 Options 5994@cindex MN10200 options 5995These @option{-m} options are defined for Matsushita MN10200 architectures: 5996@table @gcctabopt 5997 5998@item -mrelax 5999@opindex mrelax 6000Indicate to the linker that it should perform a relaxation optimization pass 6001to shorten branches, calls and absolute memory addresses. This option only 6002has an effect when used on the command line for the final link step. 6003 6004This option makes symbolic debugging impossible. 6005@end table 6006 6007@node MN10300 Options 6008@subsection MN10300 Options 6009@cindex MN10300 options 6010These @option{-m} options are defined for Matsushita MN10300 architectures: 6011 6012@table @gcctabopt 6013@item -mmult-bug 6014@opindex mmult-bug 6015Generate code to avoid bugs in the multiply instructions for the MN10300 6016processors. This is the default. 6017 6018@item -mno-mult-bug 6019@opindex mno-mult-bug 6020Do not generate code to avoid bugs in the multiply instructions for the 6021MN10300 processors. 6022 6023@item -mam33 6024@opindex mam33 6025Generate code which uses features specific to the AM33 processor. 6026 6027@item -mno-am33 6028@opindex mno-am33 6029Do not generate code which uses features specific to the AM33 processor. This 6030is the default. 6031 6032@item -mno-crt0 6033@opindex mno-crt0 6034Do not link in the C run-time initialization object file. 6035 6036@item -mrelax 6037@opindex mrelax 6038Indicate to the linker that it should perform a relaxation optimization pass 6039to shorten branches, calls and absolute memory addresses. This option only 6040has an effect when used on the command line for the final link step. 6041 6042This option makes symbolic debugging impossible. 6043@end table 6044 6045 6046@node M32R/D Options 6047@subsection M32R/D Options 6048@cindex M32R/D options 6049 6050These @option{-m} options are defined for Mitsubishi M32R/D architectures: 6051 6052@table @gcctabopt 6053@item -m32rx 6054@opindex m32rx 6055Generate code for the M32R/X@. 6056 6057@item -m32r 6058@opindex m32r 6059Generate code for the M32R@. This is the default. 6060 6061@item -mcode-model=small 6062@opindex mcode-model=small 6063Assume all objects live in the lower 16MB of memory (so that their addresses 6064can be loaded with the @code{ld24} instruction), and assume all subroutines 6065are reachable with the @code{bl} instruction. 6066This is the default. 6067 6068The addressability of a particular object can be set with the 6069@code{model} attribute. 6070 6071@item -mcode-model=medium 6072@opindex mcode-model=medium 6073Assume objects may be anywhere in the 32-bit address space (the compiler 6074will generate @code{seth/add3} instructions to load their addresses), and 6075assume all subroutines are reachable with the @code{bl} instruction. 6076 6077@item -mcode-model=large 6078@opindex mcode-model=large 6079Assume objects may be anywhere in the 32-bit address space (the compiler 6080will generate @code{seth/add3} instructions to load their addresses), and 6081assume subroutines may not be reachable with the @code{bl} instruction 6082(the compiler will generate the much slower @code{seth/add3/jl} 6083instruction sequence). 6084 6085@item -msdata=none 6086@opindex msdata=none 6087Disable use of the small data area. Variables will be put into 6088one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the 6089@code{section} attribute has been specified). 6090This is the default. 6091 6092The small data area consists of sections @samp{.sdata} and @samp{.sbss}. 6093Objects may be explicitly put in the small data area with the 6094@code{section} attribute using one of these sections. 6095 6096@item -msdata=sdata 6097@opindex msdata=sdata 6098Put small global and static data in the small data area, but do not 6099generate special code to reference them. 6100 6101@item -msdata=use 6102@opindex msdata=use 6103Put small global and static data in the small data area, and generate 6104special instructions to reference them. 6105 6106@item -G @var{num} 6107@opindex G 6108@cindex smaller data references 6109Put global and static objects less than or equal to @var{num} bytes 6110into the small data or bss sections instead of the normal data or bss 6111sections. The default value of @var{num} is 8. 6112The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 6113for this option to have any effect. 6114 6115All modules should be compiled with the same @option{-G @var{num}} value. 6116Compiling with different values of @var{num} may or may not work; if it 6117doesn't the linker will give an error message---incorrect code will not be 6118generated. 6119 6120@end table 6121 6122@node M88K Options 6123@subsection M88K Options 6124@cindex M88k options 6125 6126These @samp{-m} options are defined for Motorola 88k architectures: 6127 6128@table @gcctabopt 6129@item -m88000 6130@opindex m88000 6131Generate code that works well on both the m88100 and the 6132m88110. 6133 6134@item -m88100 6135@opindex m88100 6136Generate code that works best for the m88100, but that also 6137runs on the m88110. 6138 6139@item -m88110 6140@opindex m88110 6141Generate code that works best for the m88110, and may not run 6142on the m88100. 6143 6144@item -mbig-pic 6145@opindex mbig-pic 6146Obsolete option to be removed from the next revision. 6147Use @option{-fPIC}. 6148 6149@item -midentify-revision 6150@opindex midentify-revision 6151@cindex identifying source, compiler (88k) 6152Include an @code{ident} directive in the assembler output recording the 6153source file name, compiler name and version, timestamp, and compilation 6154flags used. 6155 6156@item -mno-underscores 6157@opindex mno-underscores 6158@cindex underscores, avoiding (88k) 6159In assembler output, emit symbol names without adding an underscore 6160character at the beginning of each name. The default is to use an 6161underscore as prefix on each name. 6162 6163@item -mocs-debug-info 6164@itemx -mno-ocs-debug-info 6165@opindex mocs-debug-info 6166@opindex mno-ocs-debug-info 6167@cindex OCS (88k) 6168@cindex debugging, 88k OCS 6169Include (or omit) additional debugging information (about registers used 6170in each stack frame) as specified in the 88open Object Compatibility 6171Standard, ``OCS''@. This extra information allows debugging of code that 6172has had the frame pointer eliminated. The default for DG/UX, SVr4, and 6173Delta 88 SVr3.2 is to include this information; other 88k configurations 6174omit this information by default. 6175 6176@item -mocs-frame-position 6177@opindex mocs-frame-position 6178@cindex register positions in frame (88k) 6179When emitting COFF debugging information for automatic variables and 6180parameters stored on the stack, use the offset from the canonical frame 6181address, which is the stack pointer (register 31) on entry to the 6182function. The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use 6183@option{-mocs-frame-position}; other 88k configurations have the default 6184@option{-mno-ocs-frame-position}. 6185 6186@item -mno-ocs-frame-position 6187@opindex mno-ocs-frame-position 6188@cindex register positions in frame (88k) 6189When emitting COFF debugging information for automatic variables and 6190parameters stored on the stack, use the offset from the frame pointer 6191register (register 30). When this option is in effect, the frame 6192pointer is not eliminated when debugging information is selected by the 6193-g switch. 6194 6195@item -moptimize-arg-area 6196@opindex moptimize-arg-area 6197@cindex arguments in frame (88k) 6198Save space by reorganizing the stack frame. This option generates code 6199that does not agree with the 88open specifications, but uses less 6200memory. 6201 6202@itemx -mno-optimize-arg-area 6203@opindex mno-optimize-arg-area 6204Do not reorganize the stack frame to save space. This is the default. 6205The generated conforms to the specification, but uses more memory. 6206 6207@item -mshort-data-@var{num} 6208@opindex mshort-data 6209@cindex smaller data references (88k) 6210@cindex r0-relative references (88k) 6211Generate smaller data references by making them relative to @code{r0}, 6212which allows loading a value using a single instruction (rather than the 6213usual two). You control which data references are affected by 6214specifying @var{num} with this option. For example, if you specify 6215@option{-mshort-data-512}, then the data references affected are those 6216involving displacements of less than 512 bytes. 6217@option{-mshort-data-@var{num}} is not effective for @var{num} greater 6218than 64k. 6219 6220@item -mserialize-volatile 6221@opindex mserialize-volatile 6222@itemx -mno-serialize-volatile 6223@opindex mno-serialize-volatile 6224@cindex sequential consistency on 88k 6225Do, or don't, generate code to guarantee sequential consistency 6226of volatile memory references. By default, consistency is 6227guaranteed. 6228 6229The order of memory references made by the MC88110 processor does 6230not always match the order of the instructions requesting those 6231references. In particular, a load instruction may execute before 6232a preceding store instruction. Such reordering violates 6233sequential consistency of volatile memory references, when there 6234are multiple processors. When consistency must be guaranteed, 6235GCC generates special instructions, as needed, to force 6236execution in the proper order. 6237 6238The MC88100 processor does not reorder memory references and so 6239always provides sequential consistency. However, by default, GCC 6240generates the special instructions to guarantee consistency 6241even when you use @option{-m88100}, so that the code may be run on an 6242MC88110 processor. If you intend to run your code only on the 6243MC88100 processor, you may use @option{-mno-serialize-volatile}. 6244 6245The extra code generated to guarantee consistency may affect the 6246performance of your application. If you know that you can safely 6247forgo this guarantee, you may use @option{-mno-serialize-volatile}. 6248 6249@item -msvr4 6250@itemx -msvr3 6251@opindex msvr4 6252@opindex msvr3 6253@cindex assembler syntax, 88k 6254@cindex SVr4 6255Turn on (@option{-msvr4}) or off (@option{-msvr3}) compiler extensions 6256related to System V release 4 (SVr4). This controls the following: 6257 6258@enumerate 6259@item 6260Which variant of the assembler syntax to emit. 6261@item 6262@option{-msvr4} makes the C preprocessor recognize @samp{#pragma weak} 6263that is used on System V release 4. 6264@item 6265@option{-msvr4} makes GCC issue additional declaration directives used in 6266SVr4. 6267@end enumerate 6268 6269@option{-msvr4} is the default for the m88k-motorola-sysv4 and 6270m88k-dg-dgux m88k configurations. @option{-msvr3} is the default for all 6271other m88k configurations. 6272 6273@item -mversion-03.00 6274@opindex mversion-03.00 6275This option is obsolete, and is ignored. 6276@c ??? which asm syntax better for GAS? option there too? 6277 6278@item -mno-check-zero-division 6279@itemx -mcheck-zero-division 6280@opindex mno-check-zero-division 6281@opindex mcheck-zero-division 6282@cindex zero division on 88k 6283Do, or don't, generate code to guarantee that integer division by 6284zero will be detected. By default, detection is guaranteed. 6285 6286Some models of the MC88100 processor fail to trap upon integer 6287division by zero under certain conditions. By default, when 6288compiling code that might be run on such a processor, GCC 6289generates code that explicitly checks for zero-valued divisors 6290and traps with exception number 503 when one is detected. Use of 6291@option{-mno-check-zero-division} suppresses such checking for code 6292generated to run on an MC88100 processor. 6293 6294GCC assumes that the MC88110 processor correctly detects all instances 6295of integer division by zero. When @option{-m88110} is specified, no 6296explicit checks for zero-valued divisors are generated, and both 6297@option{-mcheck-zero-division} and @option{-mno-check-zero-division} are 6298ignored. 6299 6300@item -muse-div-instruction 6301@opindex muse-div-instruction 6302@cindex divide instruction, 88k 6303Use the div instruction for signed integer division on the 6304MC88100 processor. By default, the div instruction is not used. 6305 6306On the MC88100 processor the signed integer division instruction 6307div) traps to the operating system on a negative operand. The 6308operating system transparently completes the operation, but at a 6309large cost in execution time. By default, when compiling code 6310that might be run on an MC88100 processor, GCC emulates signed 6311integer division using the unsigned integer division instruction 6312divu), thereby avoiding the large penalty of a trap to the 6313operating system. Such emulation has its own, smaller, execution 6314cost in both time and space. To the extent that your code's 6315important signed integer division operations are performed on two 6316nonnegative operands, it may be desirable to use the div 6317instruction directly. 6318 6319On the MC88110 processor the div instruction (also known as the 6320divs instruction) processes negative operands without trapping to 6321the operating system. When @option{-m88110} is specified, 6322@option{-muse-div-instruction} is ignored, and the div instruction is used 6323for signed integer division. 6324 6325Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined. In 6326particular, the behavior of such a division with and without 6327@option{-muse-div-instruction} may differ. 6328 6329@item -mtrap-large-shift 6330@itemx -mhandle-large-shift 6331@opindex mtrap-large-shift 6332@opindex mhandle-large-shift 6333@cindex bit shift overflow (88k) 6334@cindex large bit shifts (88k) 6335Include code to detect bit-shifts of more than 31 bits; respectively, 6336trap such shifts or emit code to handle them properly. By default GCC 6337makes no special provision for large bit shifts. 6338 6339@item -mwarn-passed-structs 6340@opindex mwarn-passed-structs 6341@cindex structure passing (88k) 6342Warn when a function passes a struct as an argument or result. 6343Structure-passing conventions have changed during the evolution of the C 6344language, and are often the source of portability problems. By default, 6345GCC issues no such warning. 6346@end table 6347 6348@c break page here to avoid unsightly interparagraph stretch. 6349@c -zw, 2001-8-17 6350@page 6351 6352@node RS/6000 and PowerPC Options 6353@subsection IBM RS/6000 and PowerPC Options 6354@cindex RS/6000 and PowerPC Options 6355@cindex IBM RS/6000 and PowerPC Options 6356 6357These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 6358@table @gcctabopt 6359@item -mpower 6360@itemx -mno-power 6361@itemx -mpower2 6362@itemx -mno-power2 6363@itemx -mpowerpc 6364@itemx -mno-powerpc 6365@itemx -mpowerpc-gpopt 6366@itemx -mno-powerpc-gpopt 6367@itemx -mpowerpc-gfxopt 6368@itemx -mno-powerpc-gfxopt 6369@itemx -mpowerpc64 6370@itemx -mno-powerpc64 6371@opindex mpower 6372@opindex mno-power 6373@opindex mpower2 6374@opindex mno-power2 6375@opindex mpowerpc 6376@opindex mno-powerpc 6377@opindex mpowerpc-gpopt 6378@opindex mno-powerpc-gpopt 6379@opindex mpowerpc-gfxopt 6380@opindex mno-powerpc-gfxopt 6381@opindex mpowerpc64 6382@opindex mno-powerpc64 6383GCC supports two related instruction set architectures for the 6384RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those 6385instructions supported by the @samp{rios} chip set used in the original 6386RS/6000 systems and the @dfn{PowerPC} instruction set is the 6387architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and 6388the IBM 4xx microprocessors. 6389 6390Neither architecture is a subset of the other. However there is a 6391large common subset of instructions supported by both. An MQ 6392register is included in processors supporting the POWER architecture. 6393 6394You use these options to specify which instructions are available on the 6395processor you are using. The default value of these options is 6396determined when configuring GCC@. Specifying the 6397@option{-mcpu=@var{cpu_type}} overrides the specification of these 6398options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 6399rather than the options listed above. 6400 6401The @option{-mpower} option allows GCC to generate instructions that 6402are found only in the POWER architecture and to use the MQ register. 6403Specifying @option{-mpower2} implies @option{-power} and also allows GCC 6404to generate instructions that are present in the POWER2 architecture but 6405not the original POWER architecture. 6406 6407The @option{-mpowerpc} option allows GCC to generate instructions that 6408are found only in the 32-bit subset of the PowerPC architecture. 6409Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows 6410GCC to use the optional PowerPC architecture instructions in the 6411General Purpose group, including floating-point square root. Specifying 6412@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to 6413use the optional PowerPC architecture instructions in the Graphics 6414group, including floating-point select. 6415 6416The @option{-mpowerpc64} option allows GCC to generate the additional 641764-bit instructions that are found in the full PowerPC64 architecture 6418and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 6419@option{-mno-powerpc64}. 6420 6421If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC 6422will use only the instructions in the common subset of both 6423architectures plus some special AIX common-mode calls, and will not use 6424the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc} 6425permits GCC to use any instruction from either architecture and to 6426allow use of the MQ register; specify this for the Motorola MPC601. 6427 6428@item -mnew-mnemonics 6429@itemx -mold-mnemonics 6430@opindex mnew-mnemonics 6431@opindex mold-mnemonics 6432Select which mnemonics to use in the generated assembler code. With 6433@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for 6434the PowerPC architecture. With @option{-mold-mnemonics} it uses the 6435assembler mnemonics defined for the POWER architecture. Instructions 6436defined in only one architecture have only one mnemonic; GCC uses that 6437mnemonic irrespective of which of these options is specified. 6438 6439GCC defaults to the mnemonics appropriate for the architecture in 6440use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the 6441value of these option. Unless you are building a cross-compiler, you 6442should normally not specify either @option{-mnew-mnemonics} or 6443@option{-mold-mnemonics}, but should instead accept the default. 6444 6445@item -mcpu=@var{cpu_type} 6446@opindex mcpu 6447Set architecture type, register usage, choice of mnemonics, and 6448instruction scheduling parameters for machine type @var{cpu_type}. 6449Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1}, 6450@samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602}, 6451@samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, 6452@samp{630}, @samp{740}, @samp{7400}, @samp{7450}, @samp{750}, 6453@samp{power}, @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505}, 6454@samp{801}, @samp{821}, @samp{823}, and @samp{860} and @samp{common}. 6455 6456@option{-mcpu=common} selects a completely generic processor. Code 6457generated under this option will run on any POWER or PowerPC processor. 6458GCC will use only the instructions in the common subset of both 6459architectures, and will not use the MQ register. GCC assumes a generic 6460processor model for scheduling purposes. 6461 6462@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and 6463@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit 6464PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine 6465types, with an appropriate, generic processor model assumed for 6466scheduling purposes. 6467 6468The other options specify a specific processor. Code generated under 6469those options will run best on that processor, and may not run at all on 6470others. 6471 6472The @option{-mcpu} options automatically enable or disable other 6473@option{-m} options as follows: 6474 6475@table @samp 6476@item common 6477@option{-mno-power}, @option{-mno-powerc} 6478 6479@item power 6480@itemx power2 6481@itemx rios1 6482@itemx rios2 6483@itemx rsc 6484@option{-mpower}, @option{-mno-powerpc}, @option{-mno-new-mnemonics} 6485 6486@item powerpc 6487@itemx rs64a 6488@itemx 602 6489@itemx 603 6490@itemx 603e 6491@itemx 604 6492@itemx 620 6493@itemx 630 6494@itemx 740 6495@itemx 7400 6496@itemx 7450 6497@itemx 750 6498@itemx 505 6499@option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics} 6500 6501@item 601 6502@option{-mpower}, @option{-mpowerpc}, @option{-mnew-mnemonics} 6503 6504@item 403 6505@itemx 821 6506@itemx 860 6507@option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}, @option{-msoft-float} 6508@end table 6509 6510@item -mtune=@var{cpu_type} 6511@opindex mtune 6512Set the instruction scheduling parameters for machine type 6513@var{cpu_type}, but do not set the architecture type, register usage, or 6514choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same 6515values for @var{cpu_type} are used for @option{-mtune} as for 6516@option{-mcpu}. If both are specified, the code generated will use the 6517architecture, registers, and mnemonics set by @option{-mcpu}, but the 6518scheduling parameters set by @option{-mtune}. 6519 6520@item -maltivec 6521@itemx -mno-altivec 6522@opindex maltivec 6523@opindex mno-altivec 6524These switches enable or disable the use of built-in functions that 6525allow access to the AltiVec instruction set. You may also need to set 6526@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 6527enhancements. 6528 6529@item -mfull-toc 6530@itemx -mno-fp-in-toc 6531@itemx -mno-sum-in-toc 6532@itemx -mminimal-toc 6533@opindex mfull-toc 6534@opindex mno-fp-in-toc 6535@opindex mno-sum-in-toc 6536@opindex mminimal-toc 6537Modify generation of the TOC (Table Of Contents), which is created for 6538every executable file. The @option{-mfull-toc} option is selected by 6539default. In that case, GCC will allocate at least one TOC entry for 6540each unique non-automatic variable reference in your program. GCC 6541will also place floating-point constants in the TOC@. However, only 654216,384 entries are available in the TOC@. 6543 6544If you receive a linker error message that saying you have overflowed 6545the available TOC space, you can reduce the amount of TOC space used 6546with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 6547@option{-mno-fp-in-toc} prevents GCC from putting floating-point 6548constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 6549generate code to calculate the sum of an address and a constant at 6550run-time instead of putting that sum into the TOC@. You may specify one 6551or both of these options. Each causes GCC to produce very slightly 6552slower and larger code at the expense of conserving TOC space. 6553 6554If you still run out of space in the TOC even when you specify both of 6555these options, specify @option{-mminimal-toc} instead. This option causes 6556GCC to make only one TOC entry for every file. When you specify this 6557option, GCC will produce code that is slower and larger but which 6558uses extremely little TOC space. You may wish to use this option 6559only on files that contain less frequently executed code. 6560 6561@item -maix64 6562@itemx -maix32 6563@opindex maix64 6564@opindex maix32 6565Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 6566@code{long} type, and the infrastructure needed to support them. 6567Specifying @option{-maix64} implies @option{-mpowerpc64} and 6568@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and 6569implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 6570 6571@item -mxl-call 6572@itemx -mno-xl-call 6573@opindex mxl-call 6574@opindex mno-xl-call 6575On AIX, pass floating-point arguments to prototyped functions beyond the 6576register save area (RSA) on the stack in addition to argument FPRs. The 6577AIX calling convention was extended but not initially documented to 6578handle an obscure K&R C case of calling a function that takes the 6579address of its arguments with fewer arguments than declared. AIX XL 6580compilers access floating point arguments which do not fit in the 6581RSA from the stack when a subroutine is compiled without 6582optimization. Because always storing floating-point arguments on the 6583stack is inefficient and rarely needed, this option is not enabled by 6584default and only is necessary when calling subroutines compiled by AIX 6585XL compilers without optimization. 6586 6587@item -mpe 6588@opindex mpe 6589Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 6590application written to use message passing with special startup code to 6591enable the application to run. The system must have PE installed in the 6592standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 6593must be overridden with the @option{-specs=} option to specify the 6594appropriate directory location. The Parallel Environment does not 6595support threads, so the @option{-mpe} option and the @option{-pthread} 6596option are incompatible. 6597 6598@item -msoft-float 6599@itemx -mhard-float 6600@opindex msoft-float 6601@opindex mhard-float 6602Generate code that does not use (uses) the floating-point register set. 6603Software floating point emulation is provided if you use the 6604@option{-msoft-float} option, and pass the option to GCC when linking. 6605 6606@item -mmultiple 6607@itemx -mno-multiple 6608@opindex mmultiple 6609@opindex mno-multiple 6610Generate code that uses (does not use) the load multiple word 6611instructions and the store multiple word instructions. These 6612instructions are generated by default on POWER systems, and not 6613generated on PowerPC systems. Do not use @option{-mmultiple} on little 6614endian PowerPC systems, since those instructions do not work when the 6615processor is in little endian mode. The exceptions are PPC740 and 6616PPC750 which permit the instructions usage in little endian mode. 6617 6618@item -mstring 6619@itemx -mno-string 6620@opindex mstring 6621@opindex mno-string 6622Generate code that uses (does not use) the load string instructions 6623and the store string word instructions to save multiple registers and 6624do small block moves. These instructions are generated by default on 6625POWER systems, and not generated on PowerPC systems. Do not use 6626@option{-mstring} on little endian PowerPC systems, since those 6627instructions do not work when the processor is in little endian mode. 6628The exceptions are PPC740 and PPC750 which permit the instructions 6629usage in little endian mode. 6630 6631@item -mupdate 6632@itemx -mno-update 6633@opindex mupdate 6634@opindex mno-update 6635Generate code that uses (does not use) the load or store instructions 6636that update the base register to the address of the calculated memory 6637location. These instructions are generated by default. If you use 6638@option{-mno-update}, there is a small window between the time that the 6639stack pointer is updated and the address of the previous frame is 6640stored, which means code that walks the stack frame across interrupts or 6641signals may get corrupted data. 6642 6643@item -mfused-madd 6644@itemx -mno-fused-madd 6645@opindex mfused-madd 6646@opindex mno-fused-madd 6647Generate code that uses (does not use) the floating point multiply and 6648accumulate instructions. These instructions are generated by default if 6649hardware floating is used. 6650 6651@item -mno-bit-align 6652@itemx -mbit-align 6653@opindex mno-bit-align 6654@opindex mbit-align 6655On System V.4 and embedded PowerPC systems do not (do) force structures 6656and unions that contain bit-fields to be aligned to the base type of the 6657bit-field. 6658 6659For example, by default a structure containing nothing but 8 6660@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte 6661boundary and have a size of 4 bytes. By using @option{-mno-bit-align}, 6662the structure would be aligned to a 1 byte boundary and be one byte in 6663size. 6664 6665@item -mno-strict-align 6666@itemx -mstrict-align 6667@opindex mno-strict-align 6668@opindex mstrict-align 6669On System V.4 and embedded PowerPC systems do not (do) assume that 6670unaligned memory references will be handled by the system. 6671 6672@item -mrelocatable 6673@itemx -mno-relocatable 6674@opindex mrelocatable 6675@opindex mno-relocatable 6676On embedded PowerPC systems generate code that allows (does not allow) 6677the program to be relocated to a different address at runtime. If you 6678use @option{-mrelocatable} on any module, all objects linked together must 6679be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}. 6680 6681@item -mrelocatable-lib 6682@itemx -mno-relocatable-lib 6683@opindex mrelocatable-lib 6684@opindex mno-relocatable-lib 6685On embedded PowerPC systems generate code that allows (does not allow) 6686the program to be relocated to a different address at runtime. Modules 6687compiled with @option{-mrelocatable-lib} can be linked with either modules 6688compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or 6689with modules compiled with the @option{-mrelocatable} options. 6690 6691@item -mno-toc 6692@itemx -mtoc 6693@opindex mno-toc 6694@opindex mtoc 6695On System V.4 and embedded PowerPC systems do not (do) assume that 6696register 2 contains a pointer to a global area pointing to the addresses 6697used in the program. 6698 6699@item -mlittle 6700@itemx -mlittle-endian 6701@opindex mlittle 6702@opindex mlittle-endian 6703On System V.4 and embedded PowerPC systems compile code for the 6704processor in little endian mode. The @option{-mlittle-endian} option is 6705the same as @option{-mlittle}. 6706 6707@item -mbig 6708@itemx -mbig-endian 6709@opindex mbig 6710@opindex mbig-endian 6711On System V.4 and embedded PowerPC systems compile code for the 6712processor in big endian mode. The @option{-mbig-endian} option is 6713the same as @option{-mbig}. 6714 6715@item -mcall-sysv 6716@opindex mcall-sysv 6717On System V.4 and embedded PowerPC systems compile code using calling 6718conventions that adheres to the March 1995 draft of the System V 6719Application Binary Interface, PowerPC processor supplement. This is the 6720default unless you configured GCC using @samp{powerpc-*-eabiaix}. 6721 6722@item -mcall-sysv-eabi 6723@opindex mcall-sysv-eabi 6724Specify both @option{-mcall-sysv} and @option{-meabi} options. 6725 6726@item -mcall-sysv-noeabi 6727@opindex mcall-sysv-noeabi 6728Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 6729 6730@item -mcall-aix 6731@opindex mcall-aix 6732On System V.4 and embedded PowerPC systems compile code using calling 6733conventions that are similar to those used on AIX@. This is the 6734default if you configured GCC using @samp{powerpc-*-eabiaix}. 6735 6736@item -mcall-solaris 6737@opindex mcall-solaris 6738On System V.4 and embedded PowerPC systems compile code for the Solaris 6739operating system. 6740 6741@item -mcall-linux 6742@opindex mcall-linux 6743On System V.4 and embedded PowerPC systems compile code for the 6744Linux-based GNU system. 6745 6746@item -mcall-gnu 6747@opindex mcall-gnu 6748On System V.4 and embedded PowerPC systems compile code for the 6749Hurd-based GNU system. 6750 6751@item -mcall-netbsd 6752@opindex mcall-netbsd 6753On System V.4 and embedded PowerPC systems compile code for the 6754NetBSD operating system. 6755 6756@item -maix-struct-return 6757@opindex maix-struct-return 6758Return all structures in memory (as specified by the AIX ABI)@. 6759 6760@item -msvr4-struct-return 6761@opindex msvr4-struct-return 6762Return structures smaller than 8 bytes in registers (as specified by the 6763SVR4 ABI)@. 6764 6765@item -mabi=altivec 6766@opindex mabi=altivec 6767Extend the current ABI with AltiVec ABI extensions. This does not 6768change the default ABI, instead it adds the AltiVec ABI extensions to 6769the current ABI@. 6770 6771@item -mabi=no-altivec 6772@opindex mabi=no-altivec 6773Disable AltiVec ABI extensions for the current ABI. 6774 6775@item -mprototype 6776@itemx -mno-prototype 6777@opindex mprototype 6778@opindex mno-prototype 6779On System V.4 and embedded PowerPC systems assume that all calls to 6780variable argument functions are properly prototyped. Otherwise, the 6781compiler must insert an instruction before every non prototyped call to 6782set or clear bit 6 of the condition code register (@var{CR}) to 6783indicate whether floating point values were passed in the floating point 6784registers in case the function takes a variable arguments. With 6785@option{-mprototype}, only calls to prototyped variable argument functions 6786will set or clear the bit. 6787 6788@item -msim 6789@opindex msim 6790On embedded PowerPC systems, assume that the startup module is called 6791@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 6792@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}. 6793configurations. 6794 6795@item -mmvme 6796@opindex mmvme 6797On embedded PowerPC systems, assume that the startup module is called 6798@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 6799@file{libc.a}. 6800 6801@item -mads 6802@opindex mads 6803On embedded PowerPC systems, assume that the startup module is called 6804@file{crt0.o} and the standard C libraries are @file{libads.a} and 6805@file{libc.a}. 6806 6807@item -myellowknife 6808@opindex myellowknife 6809On embedded PowerPC systems, assume that the startup module is called 6810@file{crt0.o} and the standard C libraries are @file{libyk.a} and 6811@file{libc.a}. 6812 6813@item -mvxworks 6814@opindex mvxworks 6815On System V.4 and embedded PowerPC systems, specify that you are 6816compiling for a VxWorks system. 6817 6818@item -memb 6819@opindex memb 6820On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags 6821header to indicate that @samp{eabi} extended relocations are used. 6822 6823@item -meabi 6824@itemx -mno-eabi 6825@opindex meabi 6826@opindex mno-eabi 6827On System V.4 and embedded PowerPC systems do (do not) adhere to the 6828Embedded Applications Binary Interface (eabi) which is a set of 6829modifications to the System V.4 specifications. Selecting @option{-meabi} 6830means that the stack is aligned to an 8 byte boundary, a function 6831@code{__eabi} is called to from @code{main} to set up the eabi 6832environment, and the @option{-msdata} option can use both @code{r2} and 6833@code{r13} to point to two separate small data areas. Selecting 6834@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary, 6835do not call an initialization function from @code{main}, and the 6836@option{-msdata} option will only use @code{r13} to point to a single 6837small data area. The @option{-meabi} option is on by default if you 6838configured GCC using one of the @samp{powerpc*-*-eabi*} options. 6839 6840@item -msdata=eabi 6841@opindex msdata=eabi 6842On System V.4 and embedded PowerPC systems, put small initialized 6843@code{const} global and static data in the @samp{.sdata2} section, which 6844is pointed to by register @code{r2}. Put small initialized 6845non-@code{const} global and static data in the @samp{.sdata} section, 6846which is pointed to by register @code{r13}. Put small uninitialized 6847global and static data in the @samp{.sbss} section, which is adjacent to 6848the @samp{.sdata} section. The @option{-msdata=eabi} option is 6849incompatible with the @option{-mrelocatable} option. The 6850@option{-msdata=eabi} option also sets the @option{-memb} option. 6851 6852@item -msdata=sysv 6853@opindex msdata=sysv 6854On System V.4 and embedded PowerPC systems, put small global and static 6855data in the @samp{.sdata} section, which is pointed to by register 6856@code{r13}. Put small uninitialized global and static data in the 6857@samp{.sbss} section, which is adjacent to the @samp{.sdata} section. 6858The @option{-msdata=sysv} option is incompatible with the 6859@option{-mrelocatable} option. 6860 6861@item -msdata=default 6862@itemx -msdata 6863@opindex msdata=default 6864@opindex msdata 6865On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 6866compile code the same as @option{-msdata=eabi}, otherwise compile code the 6867same as @option{-msdata=sysv}. 6868 6869@item -msdata-data 6870@opindex msdata-data 6871On System V.4 and embedded PowerPC systems, put small global and static 6872data in the @samp{.sdata} section. Put small uninitialized global and 6873static data in the @samp{.sbss} section. Do not use register @code{r13} 6874to address small data however. This is the default behavior unless 6875other @option{-msdata} options are used. 6876 6877@item -msdata=none 6878@itemx -mno-sdata 6879@opindex msdata=none 6880@opindex mno-sdata 6881On embedded PowerPC systems, put all initialized global and static data 6882in the @samp{.data} section, and all uninitialized data in the 6883@samp{.bss} section. 6884 6885@item -G @var{num} 6886@opindex G 6887@cindex smaller data references (PowerPC) 6888@cindex .sdata/.sdata2 references (PowerPC) 6889On embedded PowerPC systems, put global and static items less than or 6890equal to @var{num} bytes into the small data or bss sections instead of 6891the normal data or bss section. By default, @var{num} is 8. The 6892@option{-G @var{num}} switch is also passed to the linker. 6893All modules should be compiled with the same @option{-G @var{num}} value. 6894 6895@item -mregnames 6896@itemx -mno-regnames 6897@opindex mregnames 6898@opindex mno-regnames 6899On System V.4 and embedded PowerPC systems do (do not) emit register 6900names in the assembly language output using symbolic forms. 6901 6902@item -pthread 6903@opindex pthread 6904Adds support for multithreading with the @dfn{pthreads} library. 6905This option sets flags for both the preprocessor and linker. 6906 6907@end table 6908 6909@node RT Options 6910@subsection IBM RT Options 6911@cindex RT options 6912@cindex IBM RT options 6913 6914These @samp{-m} options are defined for the IBM RT PC: 6915 6916@table @gcctabopt 6917@item -min-line-mul 6918@opindex min-line-mul 6919Use an in-line code sequence for integer multiplies. This is the 6920default. 6921 6922@item -mcall-lib-mul 6923@opindex mcall-lib-mul 6924Call @code{lmul$$} for integer multiples. 6925 6926@item -mfull-fp-blocks 6927@opindex mfull-fp-blocks 6928Generate full-size floating point data blocks, including the minimum 6929amount of scratch space recommended by IBM@. This is the default. 6930 6931@item -mminimum-fp-blocks 6932@opindex mminimum-fp-blocks 6933Do not include extra scratch space in floating point data blocks. This 6934results in smaller code, but slower execution, since scratch space must 6935be allocated dynamically. 6936 6937@cindex @file{varargs.h} and RT PC 6938@cindex @file{stdarg.h} and RT PC 6939@item -mfp-arg-in-fpregs 6940@opindex mfp-arg-in-fpregs 6941Use a calling sequence incompatible with the IBM calling convention in 6942which floating point arguments are passed in floating point registers. 6943Note that @code{varargs.h} and @code{stdarg.h} will not work with 6944floating point operands if this option is specified. 6945 6946@item -mfp-arg-in-gregs 6947@opindex mfp-arg-in-gregs 6948Use the normal calling convention for floating point arguments. This is 6949the default. 6950 6951@item -mhc-struct-return 6952@opindex mhc-struct-return 6953Return structures of more than one word in memory, rather than in a 6954register. This provides compatibility with the MetaWare HighC (hc) 6955compiler. Use the option @option{-fpcc-struct-return} for compatibility 6956with the Portable C Compiler (pcc). 6957 6958@item -mnohc-struct-return 6959@opindex mnohc-struct-return 6960Return some structures of more than one word in registers, when 6961convenient. This is the default. For compatibility with the 6962IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the 6963option @option{-mhc-struct-return}. 6964@end table 6965 6966@node MIPS Options 6967@subsection MIPS Options 6968@cindex MIPS options 6969 6970These @samp{-m} options are defined for the MIPS family of computers: 6971 6972@table @gcctabopt 6973 6974@item -march=@var{cpu-type} 6975@opindex march 6976Assume the defaults for the machine type @var{cpu-type} when generating 6977instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000}, 6978@samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400}, 6979@samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000}, 6980and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000}, 6981@samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as 6982@samp{r2k} (or @samp{r2K}), @samp{r3k}, etc. 6983 6984@item -mtune=@var{cpu-type} 6985@opindex mtune 6986Assume the defaults for the machine type @var{cpu-type} when scheduling 6987instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000}, 6988@samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400}, 6989@samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000}, 6990and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000}, 6991@samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as 6992@samp{r2k} (or @samp{r2K}), @samp{r3k}, etc. While picking a specific 6993@var{cpu-type} will schedule things appropriately for that particular 6994chip, the compiler will not generate any code that does not meet level 1 6995of the MIPS ISA (instruction set architecture) without a @option{-mipsX} 6996or @option{-mabi} switch being used. 6997 6998@item -mcpu=@var{cpu-type} 6999@opindex mcpu 7000This is identical to specifying both @option{-march} and @option{-mtune}. 7001 7002@item -mips1 7003@opindex mips1 7004Issue instructions from level 1 of the MIPS ISA@. This is the default. 7005@samp{r3000} is the default @var{cpu-type} at this ISA level. 7006 7007@item -mips2 7008@opindex mips2 7009Issue instructions from level 2 of the MIPS ISA (branch likely, square 7010root instructions). @samp{r6000} is the default @var{cpu-type} at this 7011ISA level. 7012 7013@item -mips3 7014@opindex mips3 7015Issue instructions from level 3 of the MIPS ISA (64-bit instructions). 7016@samp{r4000} is the default @var{cpu-type} at this ISA level. 7017 7018@item -mips4 7019@opindex mips4 7020Issue instructions from level 4 of the MIPS ISA (conditional move, 7021prefetch, enhanced FPU instructions). @samp{r8000} is the default 7022@var{cpu-type} at this ISA level. 7023 7024@item -mfp32 7025@opindex mfp32 7026Assume that 32 32-bit floating point registers are available. This is 7027the default. 7028 7029@item -mfp64 7030@opindex mfp64 7031Assume that 32 64-bit floating point registers are available. This is 7032the default when the @option{-mips3} option is used. 7033 7034@item -mfused-madd 7035@itemx -mno-fused-madd 7036@opindex mfused-madd 7037@opindex mno-fused-madd 7038Generate code that uses (does not use) the floating point multiply and 7039accumulate instructions, when they are available. These instructions 7040are generated by default if they are available, but this may be 7041undesirable if the extra precision causes problems or on certain chips 7042in the mode where denormals are rounded to zero where denormals 7043generated by multiply and accumulate instructions cause exceptions 7044anyway. 7045 7046@item -mgp32 7047@opindex mgp32 7048Assume that 32 32-bit general purpose registers are available. This is 7049the default. 7050 7051@item -mgp64 7052@opindex mgp64 7053Assume that 32 64-bit general purpose registers are available. This is 7054the default when the @option{-mips3} option is used. 7055 7056@item -mint64 7057@opindex mint64 7058Force int and long types to be 64 bits wide. See @option{-mlong32} for an 7059explanation of the default, and the width of pointers. 7060 7061@item -mlong64 7062@opindex mlong64 7063Force long types to be 64 bits wide. See @option{-mlong32} for an 7064explanation of the default, and the width of pointers. 7065 7066@item -mlong32 7067@opindex mlong32 7068Force long, int, and pointer types to be 32 bits wide. 7069 7070If none of @option{-mlong32}, @option{-mlong64}, or @option{-mint64} are set, 7071the size of ints, longs, and pointers depends on the ABI and ISA chosen. 7072For @option{-mabi=32}, and @option{-mabi=n32}, ints and longs are 32 bits 7073wide. For @option{-mabi=64}, ints are 32 bits, and longs are 64 bits wide. 7074For @option{-mabi=eabi} and either @option{-mips1} or @option{-mips2}, ints 7075and longs are 32 bits wide. For @option{-mabi=eabi} and higher ISAs, ints 7076are 32 bits, and longs are 64 bits wide. The width of pointer types is 7077the smaller of the width of longs or the width of general purpose 7078registers (which in turn depends on the ISA)@. 7079 7080@item -mabi=32 7081@itemx -mabi=o64 7082@itemx -mabi=n32 7083@itemx -mabi=64 7084@itemx -mabi=eabi 7085@opindex mabi=32 7086@opindex mabi=o64 7087@opindex mabi=n32 7088@opindex mabi=64 7089@opindex mabi=eabi 7090Generate code for the indicated ABI@. The default instruction level is 7091@option{-mips1} for @samp{32}, @option{-mips3} for @samp{n32}, and 7092@option{-mips4} otherwise. Conversely, with @option{-mips1} or 7093@option{-mips2}, the default ABI is @samp{32}; otherwise, the default ABI 7094is @samp{64}. 7095 7096@item -mmips-as 7097@opindex mmips-as 7098Generate code for the MIPS assembler, and invoke @file{mips-tfile} to 7099add normal debug information. This is the default for all 7100platforms except for the OSF/1 reference platform, using the OSF/rose 7101object format. If the either of the @option{-gstabs} or @option{-gstabs+} 7102switches are used, the @file{mips-tfile} program will encapsulate the 7103stabs within MIPS ECOFF@. 7104 7105@item -mgas 7106@opindex mgas 7107Generate code for the GNU assembler. This is the default on the OSF/1 7108reference platform, using the OSF/rose object format. Also, this is 7109the default if the configure option @option{--with-gnu-as} is used. 7110 7111@item -msplit-addresses 7112@itemx -mno-split-addresses 7113@opindex msplit-addresses 7114@opindex mno-split-addresses 7115Generate code to load the high and low parts of address constants separately. 7116This allows GCC to optimize away redundant loads of the high order 7117bits of addresses. This optimization requires GNU as and GNU ld. 7118This optimization is enabled by default for some embedded targets where 7119GNU as and GNU ld are standard. 7120 7121@item -mrnames 7122@itemx -mno-rnames 7123@opindex mrnames 7124@opindex mno-rnames 7125The @option{-mrnames} switch says to output code using the MIPS software 7126names for the registers, instead of the hardware names (ie, @var{a0} 7127instead of @var{$4}). The only known assembler that supports this option 7128is the Algorithmics assembler. 7129 7130@item -mgpopt 7131@itemx -mno-gpopt 7132@opindex mgpopt 7133@opindex mno-gpopt 7134The @option{-mgpopt} switch says to write all of the data declarations 7135before the instructions in the text section, this allows the MIPS 7136assembler to generate one word memory references instead of using two 7137words for short global or static data items. This is on by default if 7138optimization is selected. 7139 7140@item -mstats 7141@itemx -mno-stats 7142@opindex mstats 7143@opindex mno-stats 7144For each non-inline function processed, the @option{-mstats} switch 7145causes the compiler to emit one line to the standard error file to 7146print statistics about the program (number of registers saved, stack 7147size, etc.). 7148 7149@item -mmemcpy 7150@itemx -mno-memcpy 7151@opindex mmemcpy 7152@opindex mno-memcpy 7153The @option{-mmemcpy} switch makes all block moves call the appropriate 7154string function (@samp{memcpy} or @samp{bcopy}) instead of possibly 7155generating inline code. 7156 7157@item -mmips-tfile 7158@itemx -mno-mips-tfile 7159@opindex mmips-tfile 7160@opindex mno-mips-tfile 7161The @option{-mno-mips-tfile} switch causes the compiler not 7162postprocess the object file with the @file{mips-tfile} program, 7163after the MIPS assembler has generated it to add debug support. If 7164@file{mips-tfile} is not run, then no local variables will be 7165available to the debugger. In addition, @file{stage2} and 7166@file{stage3} objects will have the temporary file names passed to the 7167assembler embedded in the object file, which means the objects will 7168not compare the same. The @option{-mno-mips-tfile} switch should only 7169be used when there are bugs in the @file{mips-tfile} program that 7170prevents compilation. 7171 7172@item -msoft-float 7173@opindex msoft-float 7174Generate output containing library calls for floating point. 7175@strong{Warning:} the requisite libraries are not part of GCC@. 7176Normally the facilities of the machine's usual C compiler are used, but 7177this can't be done directly in cross-compilation. You must make your 7178own arrangements to provide suitable library functions for 7179cross-compilation. 7180 7181@item -mhard-float 7182@opindex mhard-float 7183Generate output containing floating point instructions. This is the 7184default if you use the unmodified sources. 7185 7186@item -mabicalls 7187@itemx -mno-abicalls 7188@opindex mabicalls 7189@opindex mno-abicalls 7190Emit (or do not emit) the pseudo operations @samp{.abicalls}, 7191@samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for 7192position independent code. 7193 7194@item -mlong-calls 7195@itemx -mno-long-calls 7196@opindex mlong-calls 7197@opindex mno-long-calls 7198Do all calls with the @samp{JALR} instruction, which requires 7199loading up a function's address into a register before the call. 7200You need to use this switch, if you call outside of the current 7201512 megabyte segment to functions that are not through pointers. 7202 7203@item -mhalf-pic 7204@itemx -mno-half-pic 7205@opindex mhalf-pic 7206@opindex mno-half-pic 7207Put pointers to extern references into the data section and load them 7208up, rather than put the references in the text section. 7209 7210@item -membedded-pic 7211@itemx -mno-embedded-pic 7212@opindex membedded-pic 7213@opindex mno-embedded-pic 7214Generate PIC code suitable for some embedded systems. All calls are 7215made using PC relative address, and all data is addressed using the $gp 7216register. No more than 65536 bytes of global data may be used. This 7217requires GNU as and GNU ld which do most of the work. This currently 7218only works on targets which use ECOFF; it does not work with ELF@. 7219 7220@item -membedded-data 7221@itemx -mno-embedded-data 7222@opindex membedded-data 7223@opindex mno-embedded-data 7224Allocate variables to the read-only data section first if possible, then 7225next in the small data section if possible, otherwise in data. This gives 7226slightly slower code than the default, but reduces the amount of RAM required 7227when executing, and thus may be preferred for some embedded systems. 7228 7229@item -muninit-const-in-rodata 7230@itemx -mno-uninit-const-in-rodata 7231@opindex muninit-const-in-rodata 7232@opindex mno-uninit-const-in-rodata 7233When used together with @option{-membedded-data}, it will always store uninitialized 7234const variables in the read-only data section. 7235 7236@item -msingle-float 7237@itemx -mdouble-float 7238@opindex msingle-float 7239@opindex mdouble-float 7240The @option{-msingle-float} switch tells gcc to assume that the floating 7241point coprocessor only supports single precision operations, as on the 7242@samp{r4650} chip. The @option{-mdouble-float} switch permits gcc to use 7243double precision operations. This is the default. 7244 7245@item -mmad 7246@itemx -mno-mad 7247@opindex mmad 7248@opindex mno-mad 7249Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions, 7250as on the @samp{r4650} chip. 7251 7252@item -m4650 7253@opindex m4650 7254Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now, 7255@option{-mcpu=r4650}. 7256 7257@item -mips16 7258@itemx -mno-mips16 7259@opindex mips16 7260@opindex mno-mips16 7261Enable 16-bit instructions. 7262 7263@item -mentry 7264@opindex mentry 7265Use the entry and exit pseudo ops. This option can only be used with 7266@option{-mips16}. 7267 7268@item -EL 7269@opindex EL 7270Compile code for the processor in little endian mode. 7271The requisite libraries are assumed to exist. 7272 7273@item -EB 7274@opindex EB 7275Compile code for the processor in big endian mode. 7276The requisite libraries are assumed to exist. 7277 7278@item -G @var{num} 7279@opindex G 7280@cindex smaller data references (MIPS) 7281@cindex gp-relative references (MIPS) 7282Put global and static items less than or equal to @var{num} bytes into 7283the small data or bss sections instead of the normal data or bss 7284section. This allows the assembler to emit one word memory reference 7285instructions based on the global pointer (@var{gp} or @var{$28}), 7286instead of the normal two words used. By default, @var{num} is 8 when 7287the MIPS assembler is used, and 0 when the GNU assembler is used. The 7288@option{-G @var{num}} switch is also passed to the assembler and linker. 7289All modules should be compiled with the same @option{-G @var{num}} 7290value. 7291 7292@item -nocpp 7293@opindex nocpp 7294Tell the MIPS assembler to not run its preprocessor over user 7295assembler files (with a @samp{.s} suffix) when assembling them. 7296 7297@item -mfix7000 7298@opindex mfix7000 7299Pass an option to gas which will cause nops to be inserted if 7300the read of the destination register of an mfhi or mflo instruction 7301occurs in the following two instructions. 7302 7303@item -no-crt0 7304@opindex no-crt0 7305Do not include the default crt0. 7306 7307@item -mflush-func=@var{func} 7308@itemx -mno-flush-func 7309@opindex mflush-func 7310Specifies the function to call to flush the I and D caches, or to not 7311call any such function. If called, the function must take the same 7312arguments as the common @code{_flush_func()}, that is, the address of the 7313memory range for which the cache is being flushed, the size of the 7314memory range, and the number 3 (to flush both caches). The default 7315depends on the target gcc was configured for, but commonly is either 7316@samp{_flush_func} or @samp{__cpu_flush}. 7317@end table 7318 7319These options are defined by the macro 7320@code{TARGET_SWITCHES} in the machine description. The default for the 7321options is also defined by that macro, which enables you to change the 7322defaults. 7323 7324@node i386 and x86-64 Options 7325@subsection Intel 386 and AMD x86-64 Options 7326@cindex i386 Options 7327@cindex x86-64 Options 7328@cindex Intel 386 Options 7329@cindex AMD x86-64 Options 7330 7331These @samp{-m} options are defined for the i386 and x86-64 family of 7332computers: 7333 7334@table @gcctabopt 7335@item -mcpu=@var{cpu-type} 7336@opindex mcpu 7337Tune to @var{cpu-type} everything applicable about the generated code, except 7338for the ABI and the set of available instructions. The choices for 7339@var{cpu-type} are @samp{i386}, @samp{i486}, @samp{i586}, @samp{i686}, 7340@samp{pentium}, @samp{pentium-mmx}, @samp{pentiumpro}, @samp{pentium2}, 7341@samp{pentium3}, @samp{pentium4}, @samp{k6}, @samp{k6-2}, @samp{k6-3}, 7342@samp{athlon}, @samp{athlon-tbird}, @samp{athlon-4}, @samp{athlon-xp} 7343and @samp{athlon-mp}. 7344 7345While picking a specific @var{cpu-type} will schedule things appropriately 7346for that particular chip, the compiler will not generate any code that 7347does not run on the i386 without the @option{-march=@var{cpu-type}} option 7348being used. @samp{i586} is equivalent to @samp{pentium} and @samp{i686} 7349is equivalent to @samp{pentiumpro}. @samp{k6} and @samp{athlon} are the 7350AMD chips as opposed to the Intel ones. 7351 7352@item -march=@var{cpu-type} 7353@opindex march 7354Generate instructions for the machine type @var{cpu-type}. The choices 7355for @var{cpu-type} are the same as for @option{-mcpu}. Moreover, 7356specifying @option{-march=@var{cpu-type}} implies @option{-mcpu=@var{cpu-type}}. 7357 7358@item -m386 7359@itemx -m486 7360@itemx -mpentium 7361@itemx -mpentiumpro 7362@opindex m386 7363@opindex m486 7364@opindex mpentium 7365@opindex mpentiumpro 7366These options are synonyms for @option{-mcpu=i386}, @option{-mcpu=i486}, 7367@option{-mcpu=pentium}, and @option{-mcpu=pentiumpro} respectively. 7368These synonyms are deprecated. 7369 7370@item -mfpmath=@var{unit} 7371@opindex march 7372generate floating point arithmetics for selected unit @var{unit}. the choices 7373for @var{unit} are: 7374 7375@table @samp 7376@item 387 7377Use the standard 387 floating point coprocessor present majority of chips and 7378emulated otherwise. Code compiled with this option will run almost everywhere. 7379The temporary results are computed in 80bit precesion instead of precision 7380specified by the type resulting in slightly different results compared to most 7381of other chips. See @option{-ffloat-store} for more detailed description. 7382 7383This is the default choice for i386 compiler. 7384 7385@item sse 7386Use scalar floating point instructions present in the SSE instruction set. 7387This instruction set is supported by Pentium3 and newer chips, in the AMD line 7388by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE 7389instruction set supports only single precision arithmetics, thus the double and 7390extended precision arithmetics is still done using 387. Later version, present 7391only in Pentium4 and the future AMD x86-64 chips supports double precision 7392arithmetics too. 7393 7394For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or 7395@option{-msse2} switches to enable SSE extensions and make this option 7396effective. For x86-64 compiler, these extensions are enabled by default. 7397 7398The resulting code should be considerably faster in majority of cases and avoid 7399the numerical instability problems of 387 code, but may break some existing 7400code that expects temporaries to be 80bit. 7401 7402This is the default choice for x86-64 compiler. 7403 7404@item sse,387 7405Attempt to utilize both instruction sets at once. This effectivly double the 7406amount of available registers and on chips with separate execution units for 7407387 and SSE the execution resources too. Use this option with care, as it is 7408still experimental, because gcc register allocator does not model separate 7409functional units well resulting in instable performance. 7410@end table 7411 7412@item -masm=@var{dialect} 7413@opindex masm=@var{dialect} 7414Output asm instructions using selected @var{dialect}. Supported choices are 7415@samp{intel} or @samp{att} (the default one). 7416 7417@item -mieee-fp 7418@itemx -mno-ieee-fp 7419@opindex mieee-fp 7420@opindex mno-ieee-fp 7421Control whether or not the compiler uses IEEE floating point 7422comparisons. These handle correctly the case where the result of a 7423comparison is unordered. 7424 7425@item -msoft-float 7426@opindex msoft-float 7427Generate output containing library calls for floating point. 7428@strong{Warning:} the requisite libraries are not part of GCC@. 7429Normally the facilities of the machine's usual C compiler are used, but 7430this can't be done directly in cross-compilation. You must make your 7431own arrangements to provide suitable library functions for 7432cross-compilation. 7433 7434On machines where a function returns floating point results in the 80387 7435register stack, some floating point opcodes may be emitted even if 7436@option{-msoft-float} is used. 7437 7438@item -mno-fp-ret-in-387 7439@opindex mno-fp-ret-in-387 7440Do not use the FPU registers for return values of functions. 7441 7442The usual calling convention has functions return values of types 7443@code{float} and @code{double} in an FPU register, even if there 7444is no FPU@. The idea is that the operating system should emulate 7445an FPU@. 7446 7447The option @option{-mno-fp-ret-in-387} causes such values to be returned 7448in ordinary CPU registers instead. 7449 7450@item -mno-fancy-math-387 7451@opindex mno-fancy-math-387 7452Some 387 emulators do not support the @code{sin}, @code{cos} and 7453@code{sqrt} instructions for the 387. Specify this option to avoid 7454generating those instructions. This option is the default on FreeBSD, 7455OpenBSD and NetBSD@. This option is overridden when @option{-march} 7456indicates that the target cpu will always have an FPU and so the 7457instruction will not need emulation. As of revision 2.6.1, these 7458instructions are not generated unless you also use the 7459@option{-funsafe-math-optimizations} switch. 7460 7461@item -malign-double 7462@itemx -mno-align-double 7463@opindex malign-double 7464@opindex mno-align-double 7465Control whether GCC aligns @code{double}, @code{long double}, and 7466@code{long long} variables on a two word boundary or a one word 7467boundary. Aligning @code{double} variables on a two word boundary will 7468produce code that runs somewhat faster on a @samp{Pentium} at the 7469expense of more memory. 7470 7471@strong{Warning:} if you use the @samp{-malign-double} switch, 7472structures containing the above types will be aligned differently than 7473the published application binary interface specifications for the 386. 7474 7475@item -m128bit-long-double 7476@opindex m128bit-long-double 7477Control the size of @code{long double} type. i386 application binary interface 7478specify the size to be 12 bytes, while modern architectures (Pentium and newer) 7479prefer @code{long double} aligned to 8 or 16 byte boundary. This is 7480impossible to reach with 12 byte long doubles in the array accesses. 7481 7482@strong{Warning:} if you use the @option{-m128bit-long-double} switch, the 7483structures and arrays containing @code{long double} will change their size as 7484well as function calling convention for function taking @code{long double} 7485will be modified. 7486 7487@item -m96bit-long-double 7488@opindex m96bit-long-double 7489Set the size of @code{long double} to 96 bits as required by the i386 7490application binary interface. This is the default. 7491 7492@item -msvr3-shlib 7493@itemx -mno-svr3-shlib 7494@opindex msvr3-shlib 7495@opindex mno-svr3-shlib 7496Control whether GCC places uninitialized local variables into the 7497@code{bss} or @code{data} segments. @option{-msvr3-shlib} places them 7498into @code{bss}. These options are meaningful only on System V Release 3. 7499 7500@item -mrtd 7501@opindex mrtd 7502Use a different function-calling convention, in which functions that 7503take a fixed number of arguments return with the @code{ret} @var{num} 7504instruction, which pops their arguments while returning. This saves one 7505instruction in the caller since there is no need to pop the arguments 7506there. 7507 7508You can specify that an individual function is called with this calling 7509sequence with the function attribute @samp{stdcall}. You can also 7510override the @option{-mrtd} option by using the function attribute 7511@samp{cdecl}. @xref{Function Attributes}. 7512 7513@strong{Warning:} this calling convention is incompatible with the one 7514normally used on Unix, so you cannot use it if you need to call 7515libraries compiled with the Unix compiler. 7516 7517Also, you must provide function prototypes for all functions that 7518take variable numbers of arguments (including @code{printf}); 7519otherwise incorrect code will be generated for calls to those 7520functions. 7521 7522In addition, seriously incorrect code will result if you call a 7523function with too many arguments. (Normally, extra arguments are 7524harmlessly ignored.) 7525 7526@item -mregparm=@var{num} 7527@opindex mregparm 7528Control how many registers are used to pass integer arguments. By 7529default, no registers are used to pass arguments, and at most 3 7530registers can be used. You can control this behavior for a specific 7531function by using the function attribute @samp{regparm}. 7532@xref{Function Attributes}. 7533 7534@strong{Warning:} if you use this switch, and 7535@var{num} is nonzero, then you must build all modules with the same 7536value, including any libraries. This includes the system libraries and 7537startup modules. 7538 7539@item -mpreferred-stack-boundary=@var{num} 7540@opindex mpreferred-stack-boundary 7541Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 7542byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 7543the default is 4 (16 bytes or 128 bits), except when optimizing for code 7544size (@option{-Os}), in which case the default is the minimum correct 7545alignment (4 bytes for x86, and 8 bytes for x86-64). 7546 7547On Pentium and PentiumPro, @code{double} and @code{long double} values 7548should be aligned to an 8 byte boundary (see @option{-malign-double}) or 7549suffer significant run time performance penalties. On Pentium III, the 7550Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar 7551penalties if it is not 16 byte aligned. 7552 7553To ensure proper alignment of this values on the stack, the stack boundary 7554must be as aligned as that required by any value stored on the stack. 7555Further, every function must be generated such that it keeps the stack 7556aligned. Thus calling a function compiled with a higher preferred 7557stack boundary from a function compiled with a lower preferred stack 7558boundary will most likely misalign the stack. It is recommended that 7559libraries that use callbacks always use the default setting. 7560 7561This extra alignment does consume extra stack space, and generally 7562increases code size. Code that is sensitive to stack space usage, such 7563as embedded systems and operating system kernels, may want to reduce the 7564preferred alignment to @option{-mpreferred-stack-boundary=2}. 7565 7566@item -mmmx 7567@itemx -mno-mmx 7568@item -msse 7569@itemx -mno-sse 7570@item -msse2 7571@itemx -mno-sse2 7572@item -m3dnow 7573@itemx -mno-3dnow 7574@opindex mmmx 7575@opindex mno-mmx 7576@opindex msse 7577@opindex mno-sse 7578@opindex m3dnow 7579@opindex mno-3dnow 7580These switches enable or disable the use of built-in functions that allow 7581direct access to the MMX, SSE and 3Dnow extensions of the instruction set. 7582 7583@xref{X86 Built-in Functions}, for details of the functions enabled 7584and disabled by these switches. 7585 7586@item -mpush-args 7587@itemx -mno-push-args 7588@opindex mpush-args 7589@opindex mno-push-args 7590Use PUSH operations to store outgoing parameters. This method is shorter 7591and usually equally fast as method using SUB/MOV operations and is enabled 7592by default. In some cases disabling it may improve performance because of 7593improved scheduling and reduced dependencies. 7594 7595@item -maccumulate-outgoing-args 7596@opindex maccumulate-outgoing-args 7597If enabled, the maximum amount of space required for outgoing arguments will be 7598computed in the function prologue. This is faster on most modern CPUs 7599because of reduced dependencies, improved scheduling and reduced stack usage 7600when preferred stack boundary is not equal to 2. The drawback is a notable 7601increase in code size. This switch implies @option{-mno-push-args}. 7602 7603@item -mthreads 7604@opindex mthreads 7605Support thread-safe exception handling on @samp{Mingw32}. Code that relies 7606on thread-safe exception handling must compile and link all code with the 7607@option{-mthreads} option. When compiling, @option{-mthreads} defines 7608@option{-D_MT}; when linking, it links in a special thread helper library 7609@option{-lmingwthrd} which cleans up per thread exception handling data. 7610 7611@item -mno-align-stringops 7612@opindex mno-align-stringops 7613Do not align destination of inlined string operations. This switch reduces 7614code size and improves performance in case the destination is already aligned, 7615but gcc don't know about it. 7616 7617@item -minline-all-stringops 7618@opindex minline-all-stringops 7619By default GCC inlines string operations only when destination is known to be 7620aligned at least to 4 byte boundary. This enables more inlining, increase code 7621size, but may improve performance of code that depends on fast memcpy, strlen 7622and memset for short lengths. 7623 7624@item -momit-leaf-frame-pointer 7625@opindex momit-leaf-frame-pointer 7626Don't keep the frame pointer in a register for leaf functions. This 7627avoids the instructions to save, set up and restore frame pointers and 7628makes an extra register available in leaf functions. The option 7629@option{-fomit-frame-pointer} removes the frame pointer for all functions 7630which might make debugging harder. 7631@end table 7632 7633These @samp{-m} switches are supported in addition to the above 7634on AMD x86-64 processors in 64-bit environments. 7635 7636@table @gcctabopt 7637@item -m32 7638@itemx -m64 7639@opindex m32 7640@opindex m64 7641Generate code for a 32-bit or 64-bit environment. 7642The 32-bit environment sets int, long and pointer to 32 bits and 7643generates code that runs on any i386 system. 7644The 64-bit environment sets int to 32 bits and long and pointer 7645to 64 bits and generates code for AMD's x86-64 architecture. 7646 7647@item -mno-red-zone 7648@opindex no-red-zone 7649Do not use a so called red zone for x86-64 code. The red zone is mandated 7650by the x86-64 ABI, it is a 128-byte area beyond the location of the 7651stack pointer that will not be modified by signal or interrupt handlers 7652and therefore can be used for temporary data without adjusting the stack 7653pointer. The flag @option{-mno-red-zone} disables this red zone. 7654 7655@item -mcmodel=small 7656@opindex mcmodel=small 7657Generate code for the small code model: the program and its symbols must 7658be linked in the lower 2 GB of the address space. Pointers are 64 bits. 7659Programs can be statically or dynamically linked. This is the default 7660code model. 7661 7662@item -mcmodel=kernel 7663@opindex mcmodel=kernel 7664Generate code for the kernel code model. The kernel runs in the 7665negative 2 GB of the address space. 7666This model has to be used for Linux kernel code. 7667 7668@item -mcmodel=medium 7669@opindex mcmodel=medium 7670Generate code for the medium model: The program is linked in the lower 2 7671GB of the address space but symbols can be located anywhere in the 7672address space. Programs can be statically or dynamically linked, but 7673building of shared libraries are not supported with the medium model. 7674 7675@item -mcmodel=large 7676@opindex mcmodel=large 7677Generate code for the large model: This model makes no assumptions 7678about addresses and sizes of sections. Currently GCC does not implement 7679this model. 7680@end table 7681 7682@node HPPA Options 7683@subsection HPPA Options 7684@cindex HPPA Options 7685 7686These @samp{-m} options are defined for the HPPA family of computers: 7687 7688@table @gcctabopt 7689@item -march=@var{architecture-type} 7690@opindex march 7691Generate code for the specified architecture. The choices for 7692@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 76931.1, and @samp{2.0} for PA 2.0 processors. Refer to 7694@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 7695architecture option for your machine. Code compiled for lower numbered 7696architectures will run on higher numbered architectures, but not the 7697other way around. 7698 7699PA 2.0 support currently requires gas snapshot 19990413 or later. The 7700next release of binutils (current is 2.9.1) will probably contain PA 2.0 7701support. 7702 7703@item -mpa-risc-1-0 7704@itemx -mpa-risc-1-1 7705@itemx -mpa-risc-2-0 7706@opindex mpa-risc-1-0 7707@opindex mpa-risc-1-1 7708@opindex mpa-risc-2-0 7709Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 7710 7711@item -mbig-switch 7712@opindex mbig-switch 7713Generate code suitable for big switch tables. Use this option only if 7714the assembler/linker complain about out of range branches within a switch 7715table. 7716 7717@item -mjump-in-delay 7718@opindex mjump-in-delay 7719Fill delay slots of function calls with unconditional jump instructions 7720by modifying the return pointer for the function call to be the target 7721of the conditional jump. 7722 7723@item -mdisable-fpregs 7724@opindex mdisable-fpregs 7725Prevent floating point registers from being used in any manner. This is 7726necessary for compiling kernels which perform lazy context switching of 7727floating point registers. If you use this option and attempt to perform 7728floating point operations, the compiler will abort. 7729 7730@item -mdisable-indexing 7731@opindex mdisable-indexing 7732Prevent the compiler from using indexing address modes. This avoids some 7733rather obscure problems when compiling MIG generated code under MACH@. 7734 7735@item -mno-space-regs 7736@opindex mno-space-regs 7737Generate code that assumes the target has no space registers. This allows 7738GCC to generate faster indirect calls and use unscaled index address modes. 7739 7740Such code is suitable for level 0 PA systems and kernels. 7741 7742@item -mfast-indirect-calls 7743@opindex mfast-indirect-calls 7744Generate code that assumes calls never cross space boundaries. This 7745allows GCC to emit code which performs faster indirect calls. 7746 7747This option will not work in the presence of shared libraries or nested 7748functions. 7749 7750@item -mlong-load-store 7751@opindex mlong-load-store 7752Generate 3-instruction load and store sequences as sometimes required by 7753the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 7754the HP compilers. 7755 7756@item -mportable-runtime 7757@opindex mportable-runtime 7758Use the portable calling conventions proposed by HP for ELF systems. 7759 7760@item -mgas 7761@opindex mgas 7762Enable the use of assembler directives only GAS understands. 7763 7764@item -mschedule=@var{cpu-type} 7765@opindex mschedule 7766Schedule code according to the constraints for the machine type 7767@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 7768@samp{7100}, @samp{7100LC}, @samp{7200}, and @samp{8000}. Refer to 7769@file{/usr/lib/sched.models} on an HP-UX system to determine the 7770proper scheduling option for your machine. 7771 7772@item -mlinker-opt 7773@opindex mlinker-opt 7774Enable the optimization pass in the HPUX linker. Note this makes symbolic 7775debugging impossible. It also triggers a bug in the HPUX 8 and HPUX 9 linkers 7776in which they give bogus error messages when linking some programs. 7777 7778@item -msoft-float 7779@opindex msoft-float 7780Generate output containing library calls for floating point. 7781@strong{Warning:} the requisite libraries are not available for all HPPA 7782targets. Normally the facilities of the machine's usual C compiler are 7783used, but this cannot be done directly in cross-compilation. You must make 7784your own arrangements to provide suitable library functions for 7785cross-compilation. The embedded target @samp{hppa1.1-*-pro} 7786does provide software floating point support. 7787 7788@option{-msoft-float} changes the calling convention in the output file; 7789therefore, it is only useful if you compile @emph{all} of a program with 7790this option. In particular, you need to compile @file{libgcc.a}, the 7791library that comes with GCC, with @option{-msoft-float} in order for 7792this to work. 7793@end table 7794 7795@node Intel 960 Options 7796@subsection Intel 960 Options 7797 7798These @samp{-m} options are defined for the Intel 960 implementations: 7799 7800@table @gcctabopt 7801@item -m@var{cpu-type} 7802@opindex mka 7803@opindex mkb 7804@opindex mmc 7805@opindex mca 7806@opindex mcf 7807@opindex msa 7808@opindex msb 7809Assume the defaults for the machine type @var{cpu-type} for some of 7810the other options, including instruction scheduling, floating point 7811support, and addressing modes. The choices for @var{cpu-type} are 7812@samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf}, 7813@samp{sa}, and @samp{sb}. 7814The default is 7815@samp{kb}. 7816 7817@item -mnumerics 7818@itemx -msoft-float 7819@opindex mnumerics 7820@opindex msoft-float 7821The @option{-mnumerics} option indicates that the processor does support 7822floating-point instructions. The @option{-msoft-float} option indicates 7823that floating-point support should not be assumed. 7824 7825@item -mleaf-procedures 7826@itemx -mno-leaf-procedures 7827@opindex mleaf-procedures 7828@opindex mno-leaf-procedures 7829Do (or do not) attempt to alter leaf procedures to be callable with the 7830@code{bal} instruction as well as @code{call}. This will result in more 7831efficient code for explicit calls when the @code{bal} instruction can be 7832substituted by the assembler or linker, but less efficient code in other 7833cases, such as calls via function pointers, or using a linker that doesn't 7834support this optimization. 7835 7836@item -mtail-call 7837@itemx -mno-tail-call 7838@opindex mtail-call 7839@opindex mno-tail-call 7840Do (or do not) make additional attempts (beyond those of the 7841machine-independent portions of the compiler) to optimize tail-recursive 7842calls into branches. You may not want to do this because the detection of 7843cases where this is not valid is not totally complete. The default is 7844@option{-mno-tail-call}. 7845 7846@item -mcomplex-addr 7847@itemx -mno-complex-addr 7848@opindex mcomplex-addr 7849@opindex mno-complex-addr 7850Assume (or do not assume) that the use of a complex addressing mode is a 7851win on this implementation of the i960. Complex addressing modes may not 7852be worthwhile on the K-series, but they definitely are on the C-series. 7853The default is currently @option{-mcomplex-addr} for all processors except 7854the CB and CC@. 7855 7856@item -mcode-align 7857@itemx -mno-code-align 7858@opindex mcode-align 7859@opindex mno-code-align 7860Align code to 8-byte boundaries for faster fetching (or don't bother). 7861Currently turned on by default for C-series implementations only. 7862 7863@ignore 7864@item -mclean-linkage 7865@itemx -mno-clean-linkage 7866@opindex mclean-linkage 7867@opindex mno-clean-linkage 7868These options are not fully implemented. 7869@end ignore 7870 7871@item -mic-compat 7872@itemx -mic2.0-compat 7873@itemx -mic3.0-compat 7874@opindex mic-compat 7875@opindex mic2.0-compat 7876@opindex mic3.0-compat 7877Enable compatibility with iC960 v2.0 or v3.0. 7878 7879@item -masm-compat 7880@itemx -mintel-asm 7881@opindex masm-compat 7882@opindex mintel-asm 7883Enable compatibility with the iC960 assembler. 7884 7885@item -mstrict-align 7886@itemx -mno-strict-align 7887@opindex mstrict-align 7888@opindex mno-strict-align 7889Do not permit (do permit) unaligned accesses. 7890 7891@item -mold-align 7892@opindex mold-align 7893Enable structure-alignment compatibility with Intel's gcc release version 78941.3 (based on gcc 1.37). This option implies @option{-mstrict-align}. 7895 7896@item -mlong-double-64 7897@opindex mlong-double-64 7898Implement type @samp{long double} as 64-bit floating point numbers. 7899Without the option @samp{long double} is implemented by 80-bit 7900floating point numbers. The only reason we have it because there is 7901no 128-bit @samp{long double} support in @samp{fp-bit.c} yet. So it 7902is only useful for people using soft-float targets. Otherwise, we 7903should recommend against use of it. 7904 7905@end table 7906 7907@node DEC Alpha Options 7908@subsection DEC Alpha Options 7909 7910These @samp{-m} options are defined for the DEC Alpha implementations: 7911 7912@table @gcctabopt 7913@item -mno-soft-float 7914@itemx -msoft-float 7915@opindex mno-soft-float 7916@opindex msoft-float 7917Use (do not use) the hardware floating-point instructions for 7918floating-point operations. When @option{-msoft-float} is specified, 7919functions in @file{libgcc.a} will be used to perform floating-point 7920operations. Unless they are replaced by routines that emulate the 7921floating-point operations, or compiled in such a way as to call such 7922emulations routines, these routines will issue floating-point 7923operations. If you are compiling for an Alpha without floating-point 7924operations, you must ensure that the library is built so as not to call 7925them. 7926 7927Note that Alpha implementations without floating-point operations are 7928required to have floating-point registers. 7929 7930@item -mfp-reg 7931@itemx -mno-fp-regs 7932@opindex mfp-reg 7933@opindex mno-fp-regs 7934Generate code that uses (does not use) the floating-point register set. 7935@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 7936register set is not used, floating point operands are passed in integer 7937registers as if they were integers and floating-point results are passed 7938in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 7939so any function with a floating-point argument or return value called by code 7940compiled with @option{-mno-fp-regs} must also be compiled with that 7941option. 7942 7943A typical use of this option is building a kernel that does not use, 7944and hence need not save and restore, any floating-point registers. 7945 7946@item -mieee 7947@opindex mieee 7948The Alpha architecture implements floating-point hardware optimized for 7949maximum performance. It is mostly compliant with the IEEE floating 7950point standard. However, for full compliance, software assistance is 7951required. This option generates code fully IEEE compliant code 7952@emph{except} that the @var{inexact-flag} is not maintained (see below). 7953If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 7954defined during compilation. The resulting code is less efficient but is 7955able to correctly support denormalized numbers and exceptional IEEE 7956values such as not-a-number and plus/minus infinity. Other Alpha 7957compilers call this option @option{-ieee_with_no_inexact}. 7958 7959@item -mieee-with-inexact 7960@opindex mieee-with-inexact 7961This is like @option{-mieee} except the generated code also maintains 7962the IEEE @var{inexact-flag}. Turning on this option causes the 7963generated code to implement fully-compliant IEEE math. In addition to 7964@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 7965macro. On some Alpha implementations the resulting code may execute 7966significantly slower than the code generated by default. Since there is 7967very little code that depends on the @var{inexact-flag}, you should 7968normally not specify this option. Other Alpha compilers call this 7969option @option{-ieee_with_inexact}. 7970 7971@item -mfp-trap-mode=@var{trap-mode} 7972@opindex mfp-trap-mode 7973This option controls what floating-point related traps are enabled. 7974Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 7975The trap mode can be set to one of four values: 7976 7977@table @samp 7978@item n 7979This is the default (normal) setting. The only traps that are enabled 7980are the ones that cannot be disabled in software (e.g., division by zero 7981trap). 7982 7983@item u 7984In addition to the traps enabled by @samp{n}, underflow traps are enabled 7985as well. 7986 7987@item su 7988Like @samp{su}, but the instructions are marked to be safe for software 7989completion (see Alpha architecture manual for details). 7990 7991@item sui 7992Like @samp{su}, but inexact traps are enabled as well. 7993@end table 7994 7995@item -mfp-rounding-mode=@var{rounding-mode} 7996@opindex mfp-rounding-mode 7997Selects the IEEE rounding mode. Other Alpha compilers call this option 7998@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 7999of: 8000 8001@table @samp 8002@item n 8003Normal IEEE rounding mode. Floating point numbers are rounded towards 8004the nearest machine number or towards the even machine number in case 8005of a tie. 8006 8007@item m 8008Round towards minus infinity. 8009 8010@item c 8011Chopped rounding mode. Floating point numbers are rounded towards zero. 8012 8013@item d 8014Dynamic rounding mode. A field in the floating point control register 8015(@var{fpcr}, see Alpha architecture reference manual) controls the 8016rounding mode in effect. The C library initializes this register for 8017rounding towards plus infinity. Thus, unless your program modifies the 8018@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 8019@end table 8020 8021@item -mtrap-precision=@var{trap-precision} 8022@opindex mtrap-precision 8023In the Alpha architecture, floating point traps are imprecise. This 8024means without software assistance it is impossible to recover from a 8025floating trap and program execution normally needs to be terminated. 8026GCC can generate code that can assist operating system trap handlers 8027in determining the exact location that caused a floating point trap. 8028Depending on the requirements of an application, different levels of 8029precisions can be selected: 8030 8031@table @samp 8032@item p 8033Program precision. This option is the default and means a trap handler 8034can only identify which program caused a floating point exception. 8035 8036@item f 8037Function precision. The trap handler can determine the function that 8038caused a floating point exception. 8039 8040@item i 8041Instruction precision. The trap handler can determine the exact 8042instruction that caused a floating point exception. 8043@end table 8044 8045Other Alpha compilers provide the equivalent options called 8046@option{-scope_safe} and @option{-resumption_safe}. 8047 8048@item -mieee-conformant 8049@opindex mieee-conformant 8050This option marks the generated code as IEEE conformant. You must not 8051use this option unless you also specify @option{-mtrap-precision=i} and either 8052@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 8053is to emit the line @samp{.eflag 48} in the function prologue of the 8054generated assembly file. Under DEC Unix, this has the effect that 8055IEEE-conformant math library routines will be linked in. 8056 8057@item -mbuild-constants 8058@opindex mbuild-constants 8059Normally GCC examines a 32- or 64-bit integer constant to 8060see if it can construct it from smaller constants in two or three 8061instructions. If it cannot, it will output the constant as a literal and 8062generate code to load it from the data segment at runtime. 8063 8064Use this option to require GCC to construct @emph{all} integer constants 8065using code, even if it takes more instructions (the maximum is six). 8066 8067You would typically use this option to build a shared library dynamic 8068loader. Itself a shared library, it must relocate itself in memory 8069before it can find the variables and constants in its own data segment. 8070 8071@item -malpha-as 8072@itemx -mgas 8073@opindex malpha-as 8074@opindex mgas 8075Select whether to generate code to be assembled by the vendor-supplied 8076assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}. 8077 8078@item -mbwx 8079@itemx -mno-bwx 8080@itemx -mcix 8081@itemx -mno-cix 8082@itemx -mfix 8083@itemx -mno-fix 8084@itemx -mmax 8085@itemx -mno-max 8086@opindex mbwx 8087@opindex mno-bwx 8088@opindex mcix 8089@opindex mno-cix 8090@opindex mfix 8091@opindex mno-fix 8092@opindex mmax 8093@opindex mno-max 8094Indicate whether GCC should generate code to use the optional BWX, 8095CIX, FIX and MAX instruction sets. The default is to use the instruction 8096sets supported by the CPU type specified via @option{-mcpu=} option or that 8097of the CPU on which GCC was built if none was specified. 8098 8099@item -mfloat-vax 8100@itemx -mfloat-ieee 8101@opindex mfloat-vax 8102@opindex mfloat-ieee 8103Generate code that uses (does not use) VAX F and G floating point 8104arithmetic instead of IEEE single and double precision. 8105 8106@item -mexplicit-relocs 8107@itemx -mno-explicit-relocs 8108@opindex mexplicit-relocs 8109@opindex mno-explicit-relocs 8110Older Alpha assemblers provided no way to generate symbol relocations 8111except via assembler macros. Use of these macros does not allow 8112optimial instruction scheduling. GNU binutils as of version 2.12 8113supports a new syntax that allows the compiler to explicitly mark 8114which relocations should apply to which instructions. This option 8115is mostly useful for debugging, as GCC detects the capabilities of 8116the assembler when it is built and sets the default accordingly. 8117 8118@item -msmall-data 8119@itemx -mlarge-data 8120@opindex msmall-data 8121@opindex mlarge-data 8122When @option{-mexplicit-relocs} is in effect, static data is 8123accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 8124is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 8125(the @code{.sdata} and @code{.sbss} sections) and are accessed via 812616-bit relocations off of the @code{$gp} register. This limits the 8127size of the small data area to 64KB, but allows the variables to be 8128directly accessed via a single instruction. 8129 8130The default is @option{-mlarge-data}. With this option the data area 8131is limited to just below 2GB. Programs that require more than 2GB of 8132data must use @code{malloc} or @code{mmap} to allocate the data in the 8133heap instead of in the program's data segment. 8134 8135When generating code for shared libraries, @option{-fpic} implies 8136@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 8137 8138@item -mcpu=@var{cpu_type} 8139@opindex mcpu 8140Set the instruction set and instruction scheduling parameters for 8141machine type @var{cpu_type}. You can specify either the @samp{EV} 8142style name or the corresponding chip number. GCC supports scheduling 8143parameters for the EV4, EV5 and EV6 family of processors and will 8144choose the default values for the instruction set from the processor 8145you specify. If you do not specify a processor type, GCC will default 8146to the processor on which the compiler was built. 8147 8148Supported values for @var{cpu_type} are 8149 8150@table @samp 8151@item ev4 8152@item ev45 8153@itemx 21064 8154Schedules as an EV4 and has no instruction set extensions. 8155 8156@item ev5 8157@itemx 21164 8158Schedules as an EV5 and has no instruction set extensions. 8159 8160@item ev56 8161@itemx 21164a 8162Schedules as an EV5 and supports the BWX extension. 8163 8164@item pca56 8165@itemx 21164pc 8166@itemx 21164PC 8167Schedules as an EV5 and supports the BWX and MAX extensions. 8168 8169@item ev6 8170@itemx 21264 8171Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 8172 8173@item ev67 8174@item 21264a 8175Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 8176@end table 8177 8178@item -mtune=@var{cpu_type} 8179@opindex mtune 8180Set only the instruction scheduling parameters for machine type 8181@var{cpu_type}. The instruction set is not changed. 8182 8183@item -mmemory-latency=@var{time} 8184@opindex mmemory-latency 8185Sets the latency the scheduler should assume for typical memory 8186references as seen by the application. This number is highly 8187dependent on the memory access patterns used by the application 8188and the size of the external cache on the machine. 8189 8190Valid options for @var{time} are 8191 8192@table @samp 8193@item @var{number} 8194A decimal number representing clock cycles. 8195 8196@item L1 8197@itemx L2 8198@itemx L3 8199@itemx main 8200The compiler contains estimates of the number of clock cycles for 8201``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 8202(also called Dcache, Scache, and Bcache), as well as to main memory. 8203Note that L3 is only valid for EV5. 8204 8205@end table 8206@end table 8207 8208@node DEC Alpha/VMS Options 8209@subsection DEC Alpha/VMS Options 8210 8211These @samp{-m} options are defined for the DEC Alpha/VMS implementations: 8212 8213@table @gcctabopt 8214@item -mvms-return-codes 8215@opindex mvms-return-codes 8216Return VMS condition codes from main. The default is to return POSIX 8217style condition (e.g.@ error) codes. 8218@end table 8219 8220@node Clipper Options 8221@subsection Clipper Options 8222 8223These @samp{-m} options are defined for the Clipper implementations: 8224 8225@table @gcctabopt 8226@item -mc300 8227@opindex mc300 8228Produce code for a C300 Clipper processor. This is the default. 8229 8230@item -mc400 8231@opindex mc400 8232Produce code for a C400 Clipper processor, i.e.@: use floating point 8233registers f8--f15. 8234@end table 8235 8236@node H8/300 Options 8237@subsection H8/300 Options 8238 8239These @samp{-m} options are defined for the H8/300 implementations: 8240 8241@table @gcctabopt 8242@item -mrelax 8243@opindex mrelax 8244Shorten some address references at link time, when possible; uses the 8245linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 8246ld.info, Using ld}, for a fuller description. 8247 8248@item -mh 8249@opindex mh 8250Generate code for the H8/300H@. 8251 8252@item -ms 8253@opindex ms 8254Generate code for the H8/S@. 8255 8256@item -ms2600 8257@opindex ms2600 8258Generate code for the H8/S2600. This switch must be used with @option{-ms}. 8259 8260@item -mint32 8261@opindex mint32 8262Make @code{int} data 32 bits by default. 8263 8264@item -malign-300 8265@opindex malign-300 8266On the H8/300H and H8/S, use the same alignment rules as for the H8/300. 8267The default for the H8/300H and H8/S is to align longs and floats on 4 8268byte boundaries. 8269@option{-malign-300} causes them to be aligned on 2 byte boundaries. 8270This option has no effect on the H8/300. 8271@end table 8272 8273@node SH Options 8274@subsection SH Options 8275 8276These @samp{-m} options are defined for the SH implementations: 8277 8278@table @gcctabopt 8279@item -m1 8280@opindex m1 8281Generate code for the SH1. 8282 8283@item -m2 8284@opindex m2 8285Generate code for the SH2. 8286 8287@item -m3 8288@opindex m3 8289Generate code for the SH3. 8290 8291@item -m3e 8292@opindex m3e 8293Generate code for the SH3e. 8294 8295@item -m4-nofpu 8296@opindex m4-nofpu 8297Generate code for the SH4 without a floating-point unit. 8298 8299@item -m4-single-only 8300@opindex m4-single-only 8301Generate code for the SH4 with a floating-point unit that only 8302supports single-precision arithmetic. 8303 8304@item -m4-single 8305@opindex m4-single 8306Generate code for the SH4 assuming the floating-point unit is in 8307single-precision mode by default. 8308 8309@item -m4 8310@opindex m4 8311Generate code for the SH4. 8312 8313@item -mb 8314@opindex mb 8315Compile code for the processor in big endian mode. 8316 8317@item -ml 8318@opindex ml 8319Compile code for the processor in little endian mode. 8320 8321@item -mdalign 8322@opindex mdalign 8323Align doubles at 64-bit boundaries. Note that this changes the calling 8324conventions, and thus some functions from the standard C library will 8325not work unless you recompile it first with @option{-mdalign}. 8326 8327@item -mrelax 8328@opindex mrelax 8329Shorten some address references at link time, when possible; uses the 8330linker option @option{-relax}. 8331 8332@item -mbigtable 8333@opindex mbigtable 8334Use 32-bit offsets in @code{switch} tables. The default is to use 833516-bit offsets. 8336 8337@item -mfmovd 8338@opindex mfmovd 8339Enable the use of the instruction @code{fmovd}. 8340 8341@item -mhitachi 8342@opindex mhitachi 8343Comply with the calling conventions defined by Hitachi. 8344 8345@item -mnomacsave 8346@opindex mnomacsave 8347Mark the @code{MAC} register as call-clobbered, even if 8348@option{-mhitachi} is given. 8349 8350@item -mieee 8351@opindex mieee 8352Increase IEEE-compliance of floating-point code. 8353 8354@item -misize 8355@opindex misize 8356Dump instruction size and location in the assembly code. 8357 8358@item -mpadstruct 8359@opindex mpadstruct 8360This option is deprecated. It pads structures to multiple of 4 bytes, 8361which is incompatible with the SH ABI@. 8362 8363@item -mspace 8364@opindex mspace 8365Optimize for space instead of speed. Implied by @option{-Os}. 8366 8367@item -mprefergot 8368@opindex mprefergot 8369When generating position-independent code, emit function calls using 8370the Global Offset Table instead of the Procedure Linkage Table. 8371 8372@item -musermode 8373@opindex musermode 8374Generate a library function call to invalidate instruction cache 8375entries, after fixing up a trampoline. This library function call 8376doesn't assume it can write to the whole memory address space. This 8377is the default when the target is @code{sh-*-linux*}. 8378@end table 8379 8380@node System V Options 8381@subsection Options for System V 8382 8383These additional options are available on System V Release 4 for 8384compatibility with other compilers on those systems: 8385 8386@table @gcctabopt 8387@item -G 8388@opindex G 8389Create a shared object. 8390It is recommended that @option{-symbolic} or @option{-shared} be used instead. 8391 8392@item -Qy 8393@opindex Qy 8394Identify the versions of each tool used by the compiler, in a 8395@code{.ident} assembler directive in the output. 8396 8397@item -Qn 8398@opindex Qn 8399Refrain from adding @code{.ident} directives to the output file (this is 8400the default). 8401 8402@item -YP,@var{dirs} 8403@opindex YP 8404Search the directories @var{dirs}, and no others, for libraries 8405specified with @option{-l}. 8406 8407@item -Ym,@var{dir} 8408@opindex Ym 8409Look in the directory @var{dir} to find the M4 preprocessor. 8410The assembler uses this option. 8411@c This is supposed to go with a -Yd for predefined M4 macro files, but 8412@c the generic assembler that comes with Solaris takes just -Ym. 8413@end table 8414 8415@node TMS320C3x/C4x Options 8416@subsection TMS320C3x/C4x Options 8417@cindex TMS320C3x/C4x Options 8418 8419These @samp{-m} options are defined for TMS320C3x/C4x implementations: 8420 8421@table @gcctabopt 8422 8423@item -mcpu=@var{cpu_type} 8424@opindex mcpu 8425Set the instruction set, register set, and instruction scheduling 8426parameters for machine type @var{cpu_type}. Supported values for 8427@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and 8428@samp{c44}. The default is @samp{c40} to generate code for the 8429TMS320C40. 8430 8431@item -mbig-memory 8432@item -mbig 8433@itemx -msmall-memory 8434@itemx -msmall 8435@opindex mbig-memory 8436@opindex mbig 8437@opindex msmall-memory 8438@opindex msmall 8439Generates code for the big or small memory model. The small memory 8440model assumed that all data fits into one 64K word page. At run-time 8441the data page (DP) register must be set to point to the 64K page 8442containing the .bss and .data program sections. The big memory model is 8443the default and requires reloading of the DP register for every direct 8444memory access. 8445 8446@item -mbk 8447@itemx -mno-bk 8448@opindex mbk 8449@opindex mno-bk 8450Allow (disallow) allocation of general integer operands into the block 8451count register BK@. 8452 8453@item -mdb 8454@itemx -mno-db 8455@opindex mdb 8456@opindex mno-db 8457Enable (disable) generation of code using decrement and branch, 8458DBcond(D), instructions. This is enabled by default for the C4x. To be 8459on the safe side, this is disabled for the C3x, since the maximum 8460iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than 8461@math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so 8462that it can utilise the decrement and branch instruction, but will give 8463up if there is more than one memory reference in the loop. Thus a loop 8464where the loop counter is decremented can generate slightly more 8465efficient code, in cases where the RPTB instruction cannot be utilised. 8466 8467@item -mdp-isr-reload 8468@itemx -mparanoid 8469@opindex mdp-isr-reload 8470@opindex mparanoid 8471Force the DP register to be saved on entry to an interrupt service 8472routine (ISR), reloaded to point to the data section, and restored on 8473exit from the ISR@. This should not be required unless someone has 8474violated the small memory model by modifying the DP register, say within 8475an object library. 8476 8477@item -mmpyi 8478@itemx -mno-mpyi 8479@opindex mmpyi 8480@opindex mno-mpyi 8481For the C3x use the 24-bit MPYI instruction for integer multiplies 8482instead of a library call to guarantee 32-bit results. Note that if one 8483of the operands is a constant, then the multiplication will be performed 8484using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x, 8485then squaring operations are performed inline instead of a library call. 8486 8487@item -mfast-fix 8488@itemx -mno-fast-fix 8489@opindex mfast-fix 8490@opindex mno-fast-fix 8491The C3x/C4x FIX instruction to convert a floating point value to an 8492integer value chooses the nearest integer less than or equal to the 8493floating point value rather than to the nearest integer. Thus if the 8494floating point number is negative, the result will be incorrectly 8495truncated an additional code is necessary to detect and correct this 8496case. This option can be used to disable generation of the additional 8497code required to correct the result. 8498 8499@item -mrptb 8500@itemx -mno-rptb 8501@opindex mrptb 8502@opindex mno-rptb 8503Enable (disable) generation of repeat block sequences using the RPTB 8504instruction for zero overhead looping. The RPTB construct is only used 8505for innermost loops that do not call functions or jump across the loop 8506boundaries. There is no advantage having nested RPTB loops due to the 8507overhead required to save and restore the RC, RS, and RE registers. 8508This is enabled by default with @option{-O2}. 8509 8510@item -mrpts=@var{count} 8511@itemx -mno-rpts 8512@opindex mrpts 8513@opindex mno-rpts 8514Enable (disable) the use of the single instruction repeat instruction 8515RPTS@. If a repeat block contains a single instruction, and the loop 8516count can be guaranteed to be less than the value @var{count}, GCC will 8517emit a RPTS instruction instead of a RPTB@. If no value is specified, 8518then a RPTS will be emitted even if the loop count cannot be determined 8519at compile time. Note that the repeated instruction following RPTS does 8520not have to be reloaded from memory each iteration, thus freeing up the 8521CPU buses for operands. However, since interrupts are blocked by this 8522instruction, it is disabled by default. 8523 8524@item -mloop-unsigned 8525@itemx -mno-loop-unsigned 8526@opindex mloop-unsigned 8527@opindex mno-loop-unsigned 8528The maximum iteration count when using RPTS and RPTB (and DB on the C40) 8529is @math{2^{31} + 1} since these instructions test if the iteration count is 8530negative to terminate the loop. If the iteration count is unsigned 8531there is a possibility than the @math{2^{31} + 1} maximum iteration count may be 8532exceeded. This switch allows an unsigned iteration count. 8533 8534@item -mti 8535@opindex mti 8536Try to emit an assembler syntax that the TI assembler (asm30) is happy 8537with. This also enforces compatibility with the API employed by the TI 8538C3x C compiler. For example, long doubles are passed as structures 8539rather than in floating point registers. 8540 8541@item -mregparm 8542@itemx -mmemparm 8543@opindex mregparm 8544@opindex mmemparm 8545Generate code that uses registers (stack) for passing arguments to functions. 8546By default, arguments are passed in registers where possible rather 8547than by pushing arguments on to the stack. 8548 8549@item -mparallel-insns 8550@itemx -mno-parallel-insns 8551@opindex mparallel-insns 8552@opindex mno-parallel-insns 8553Allow the generation of parallel instructions. This is enabled by 8554default with @option{-O2}. 8555 8556@item -mparallel-mpy 8557@itemx -mno-parallel-mpy 8558@opindex mparallel-mpy 8559@opindex mno-parallel-mpy 8560Allow the generation of MPY||ADD and MPY||SUB parallel instructions, 8561provided @option{-mparallel-insns} is also specified. These instructions have 8562tight register constraints which can pessimize the code generation 8563of large functions. 8564 8565@end table 8566 8567@node V850 Options 8568@subsection V850 Options 8569@cindex V850 Options 8570 8571These @samp{-m} options are defined for V850 implementations: 8572 8573@table @gcctabopt 8574@item -mlong-calls 8575@itemx -mno-long-calls 8576@opindex mlong-calls 8577@opindex mno-long-calls 8578Treat all calls as being far away (near). If calls are assumed to be 8579far away, the compiler will always load the functions address up into a 8580register, and call indirect through the pointer. 8581 8582@item -mno-ep 8583@itemx -mep 8584@opindex mno-ep 8585@opindex mep 8586Do not optimize (do optimize) basic blocks that use the same index 8587pointer 4 or more times to copy pointer into the @code{ep} register, and 8588use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 8589option is on by default if you optimize. 8590 8591@item -mno-prolog-function 8592@itemx -mprolog-function 8593@opindex mno-prolog-function 8594@opindex mprolog-function 8595Do not use (do use) external functions to save and restore registers at 8596the prolog and epilog of a function. The external functions are slower, 8597but use less code space if more than one function saves the same number 8598of registers. The @option{-mprolog-function} option is on by default if 8599you optimize. 8600 8601@item -mspace 8602@opindex mspace 8603Try to make the code as small as possible. At present, this just turns 8604on the @option{-mep} and @option{-mprolog-function} options. 8605 8606@item -mtda=@var{n} 8607@opindex mtda 8608Put static or global variables whose size is @var{n} bytes or less into 8609the tiny data area that register @code{ep} points to. The tiny data 8610area can hold up to 256 bytes in total (128 bytes for byte references). 8611 8612@item -msda=@var{n} 8613@opindex msda 8614Put static or global variables whose size is @var{n} bytes or less into 8615the small data area that register @code{gp} points to. The small data 8616area can hold up to 64 kilobytes. 8617 8618@item -mzda=@var{n} 8619@opindex mzda 8620Put static or global variables whose size is @var{n} bytes or less into 8621the first 32 kilobytes of memory. 8622 8623@item -mv850 8624@opindex mv850 8625Specify that the target processor is the V850. 8626 8627@item -mbig-switch 8628@opindex mbig-switch 8629Generate code suitable for big switch tables. Use this option only if 8630the assembler/linker complain about out of range branches within a switch 8631table. 8632@end table 8633 8634@node ARC Options 8635@subsection ARC Options 8636@cindex ARC Options 8637 8638These options are defined for ARC implementations: 8639 8640@table @gcctabopt 8641@item -EL 8642@opindex EL 8643Compile code for little endian mode. This is the default. 8644 8645@item -EB 8646@opindex EB 8647Compile code for big endian mode. 8648 8649@item -mmangle-cpu 8650@opindex mmangle-cpu 8651Prepend the name of the cpu to all public symbol names. 8652In multiple-processor systems, there are many ARC variants with different 8653instruction and register set characteristics. This flag prevents code 8654compiled for one cpu to be linked with code compiled for another. 8655No facility exists for handling variants that are ``almost identical''. 8656This is an all or nothing option. 8657 8658@item -mcpu=@var{cpu} 8659@opindex mcpu 8660Compile code for ARC variant @var{cpu}. 8661Which variants are supported depend on the configuration. 8662All variants support @option{-mcpu=base}, this is the default. 8663 8664@item -mtext=@var{text-section} 8665@itemx -mdata=@var{data-section} 8666@itemx -mrodata=@var{readonly-data-section} 8667@opindex mtext 8668@opindex mdata 8669@opindex mrodata 8670Put functions, data, and readonly data in @var{text-section}, 8671@var{data-section}, and @var{readonly-data-section} respectively 8672by default. This can be overridden with the @code{section} attribute. 8673@xref{Variable Attributes}. 8674 8675@end table 8676 8677@node NS32K Options 8678@subsection NS32K Options 8679@cindex NS32K options 8680 8681These are the @samp{-m} options defined for the 32000 series. The default 8682values for these options depends on which style of 32000 was selected when 8683the compiler was configured; the defaults for the most common choices are 8684given below. 8685 8686@table @gcctabopt 8687@item -m32032 8688@itemx -m32032 8689@opindex m32032 8690@opindex m32032 8691Generate output for a 32032. This is the default 8692when the compiler is configured for 32032 and 32016 based systems. 8693 8694@item -m32332 8695@itemx -m32332 8696@opindex m32332 8697@opindex m32332 8698Generate output for a 32332. This is the default 8699when the compiler is configured for 32332-based systems. 8700 8701@item -m32532 8702@itemx -m32532 8703@opindex m32532 8704@opindex m32532 8705Generate output for a 32532. This is the default 8706when the compiler is configured for 32532-based systems. 8707 8708@item -m32081 8709@opindex m32081 8710Generate output containing 32081 instructions for floating point. 8711This is the default for all systems. 8712 8713@item -m32381 8714@opindex m32381 8715Generate output containing 32381 instructions for floating point. This 8716also implies @option{-m32081}. The 32381 is only compatible with the 32332 8717and 32532 cpus. This is the default for the pc532-netbsd configuration. 8718 8719@item -mmulti-add 8720@opindex mmulti-add 8721Try and generate multiply-add floating point instructions @code{polyF} 8722and @code{dotF}. This option is only available if the @option{-m32381} 8723option is in effect. Using these instructions requires changes to 8724register allocation which generally has a negative impact on 8725performance. This option should only be enabled when compiling code 8726particularly likely to make heavy use of multiply-add instructions. 8727 8728@item -mnomulti-add 8729@opindex mnomulti-add 8730Do not try and generate multiply-add floating point instructions 8731@code{polyF} and @code{dotF}. This is the default on all platforms. 8732 8733@item -msoft-float 8734@opindex msoft-float 8735Generate output containing library calls for floating point. 8736@strong{Warning:} the requisite libraries may not be available. 8737 8738@item -mnobitfield 8739@opindex mnobitfield 8740Do not use the bit-field instructions. On some machines it is faster to 8741use shifting and masking operations. This is the default for the pc532. 8742 8743@item -mbitfield 8744@opindex mbitfield 8745Do use the bit-field instructions. This is the default for all platforms 8746except the pc532. 8747 8748@item -mrtd 8749@opindex mrtd 8750Use a different function-calling convention, in which functions 8751that take a fixed number of arguments return pop their 8752arguments on return with the @code{ret} instruction. 8753 8754This calling convention is incompatible with the one normally 8755used on Unix, so you cannot use it if you need to call libraries 8756compiled with the Unix compiler. 8757 8758Also, you must provide function prototypes for all functions that 8759take variable numbers of arguments (including @code{printf}); 8760otherwise incorrect code will be generated for calls to those 8761functions. 8762 8763In addition, seriously incorrect code will result if you call a 8764function with too many arguments. (Normally, extra arguments are 8765harmlessly ignored.) 8766 8767This option takes its name from the 680x0 @code{rtd} instruction. 8768 8769 8770@item -mregparam 8771@opindex mregparam 8772Use a different function-calling convention where the first two arguments 8773are passed in registers. 8774 8775This calling convention is incompatible with the one normally 8776used on Unix, so you cannot use it if you need to call libraries 8777compiled with the Unix compiler. 8778 8779@item -mnoregparam 8780@opindex mnoregparam 8781Do not pass any arguments in registers. This is the default for all 8782targets. 8783 8784@item -msb 8785@opindex msb 8786It is OK to use the sb as an index register which is always loaded with 8787zero. This is the default for the pc532-netbsd target. 8788 8789@item -mnosb 8790@opindex mnosb 8791The sb register is not available for use or has not been initialized to 8792zero by the run time system. This is the default for all targets except 8793the pc532-netbsd. It is also implied whenever @option{-mhimem} or 8794@option{-fpic} is set. 8795 8796@item -mhimem 8797@opindex mhimem 8798Many ns32000 series addressing modes use displacements of up to 512MB@. 8799If an address is above 512MB then displacements from zero can not be used. 8800This option causes code to be generated which can be loaded above 512MB@. 8801This may be useful for operating systems or ROM code. 8802 8803@item -mnohimem 8804@opindex mnohimem 8805Assume code will be loaded in the first 512MB of virtual address space. 8806This is the default for all platforms. 8807 8808 8809@end table 8810 8811@node AVR Options 8812@subsection AVR Options 8813@cindex AVR Options 8814 8815These options are defined for AVR implementations: 8816 8817@table @gcctabopt 8818@item -mmcu=@var{mcu} 8819@opindex mmcu 8820Specify ATMEL AVR instruction set or MCU type. 8821 8822Instruction set avr1 is for the minimal AVR core, not supported by the C 8823compiler, only for assembler programs (MCU types: at90s1200, attiny10, 8824attiny11, attiny12, attiny15, attiny28). 8825 8826Instruction set avr2 (default) is for the classic AVR core with up to 88278K program memory space (MCU types: at90s2313, at90s2323, attiny22, 8828at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, 8829at90c8534, at90s8535). 8830 8831Instruction set avr3 is for the classic AVR core with up to 128K program 8832memory space (MCU types: atmega103, atmega603, at43usb320, at76c711). 8833 8834Instruction set avr4 is for the enhanced AVR core with up to 8K program 8835memory space (MCU types: atmega8, atmega83, atmega85). 8836 8837Instruction set avr5 is for the enhanced AVR core with up to 128K program 8838memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323, 8839atmega64, atmega128, at43usb355, at94k). 8840 8841@item -msize 8842@opindex msize 8843Output instruction sizes to the asm file. 8844 8845@item -minit-stack=@var{N} 8846@opindex minit-stack 8847Specify the initial stack address, which may be a symbol or numeric value, 8848@samp{__stack} is the default. 8849 8850@item -mno-interrupts 8851@opindex mno-interrupts 8852Generated code is not compatible with hardware interrupts. 8853Code size will be smaller. 8854 8855@item -mcall-prologues 8856@opindex mcall-prologues 8857Functions prologues/epilogues expanded as call to appropriate 8858subroutines. Code size will be smaller. 8859 8860@item -mno-tablejump 8861@opindex mno-tablejump 8862Do not generate tablejump insns which sometimes increase code size. 8863 8864@item -mtiny-stack 8865@opindex mtiny-stack 8866Change only the low 8 bits of the stack pointer. 8867@end table 8868 8869@node MCore Options 8870@subsection MCore Options 8871@cindex MCore options 8872 8873These are the @samp{-m} options defined for the Motorola M*Core 8874processors. 8875 8876@table @gcctabopt 8877 8878@item -mhardlit 8879@itemx -mhardlit 8880@itemx -mno-hardlit 8881@opindex mhardlit 8882@opindex mhardlit 8883@opindex mno-hardlit 8884Inline constants into the code stream if it can be done in two 8885instructions or less. 8886 8887@item -mdiv 8888@itemx -mdiv 8889@itemx -mno-div 8890@opindex mdiv 8891@opindex mdiv 8892@opindex mno-div 8893Use the divide instruction. (Enabled by default). 8894 8895@item -mrelax-immediate 8896@itemx -mrelax-immediate 8897@itemx -mno-relax-immediate 8898@opindex mrelax-immediate 8899@opindex mrelax-immediate 8900@opindex mno-relax-immediate 8901Allow arbitrary sized immediates in bit operations. 8902 8903@item -mwide-bitfields 8904@itemx -mwide-bitfields 8905@itemx -mno-wide-bitfields 8906@opindex mwide-bitfields 8907@opindex mwide-bitfields 8908@opindex mno-wide-bitfields 8909Always treat bit-fields as int-sized. 8910 8911@item -m4byte-functions 8912@itemx -m4byte-functions 8913@itemx -mno-4byte-functions 8914@opindex m4byte-functions 8915@opindex m4byte-functions 8916@opindex mno-4byte-functions 8917Force all functions to be aligned to a four byte boundary. 8918 8919@item -mcallgraph-data 8920@itemx -mcallgraph-data 8921@itemx -mno-callgraph-data 8922@opindex mcallgraph-data 8923@opindex mcallgraph-data 8924@opindex mno-callgraph-data 8925Emit callgraph information. 8926 8927@item -mslow-bytes 8928@itemx -mslow-bytes 8929@itemx -mno-slow-bytes 8930@opindex mslow-bytes 8931@opindex mslow-bytes 8932@opindex mno-slow-bytes 8933Prefer word access when reading byte quantities. 8934 8935@item -mlittle-endian 8936@itemx -mlittle-endian 8937@itemx -mbig-endian 8938@opindex mlittle-endian 8939@opindex mlittle-endian 8940@opindex mbig-endian 8941Generate code for a little endian target. 8942 8943@item -m210 8944@itemx -m210 8945@itemx -m340 8946@opindex m210 8947@opindex m210 8948@opindex m340 8949Generate code for the 210 processor. 8950@end table 8951 8952@node IA-64 Options 8953@subsection IA-64 Options 8954@cindex IA-64 Options 8955 8956These are the @samp{-m} options defined for the Intel IA-64 architecture. 8957 8958@table @gcctabopt 8959@item -mbig-endian 8960@opindex mbig-endian 8961Generate code for a big endian target. This is the default for HPUX@. 8962 8963@item -mlittle-endian 8964@opindex mlittle-endian 8965Generate code for a little endian target. This is the default for AIX5 8966and Linux. 8967 8968@item -mgnu-as 8969@itemx -mno-gnu-as 8970@opindex mgnu-as 8971@opindex mno-gnu-as 8972Generate (or don't) code for the GNU assembler. This is the default. 8973@c Also, this is the default if the configure option @option{--with-gnu-as} 8974@c is used. 8975 8976@item -mgnu-ld 8977@itemx -mno-gnu-ld 8978@opindex mgnu-ld 8979@opindex mno-gnu-ld 8980Generate (or don't) code for the GNU linker. This is the default. 8981@c Also, this is the default if the configure option @option{--with-gnu-ld} 8982@c is used. 8983 8984@item -mno-pic 8985@opindex mno-pic 8986Generate code that does not use a global pointer register. The result 8987is not position independent code, and violates the IA-64 ABI@. 8988 8989@item -mvolatile-asm-stop 8990@itemx -mno-volatile-asm-stop 8991@opindex mvolatile-asm-stop 8992@opindex mno-volatile-asm-stop 8993Generate (or don't) a stop bit immediately before and after volatile asm 8994statements. 8995 8996@item -mb-step 8997@opindex mb-step 8998Generate code that works around Itanium B step errata. 8999 9000@item -mregister-names 9001@itemx -mno-register-names 9002@opindex mregister-names 9003@opindex mno-register-names 9004Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 9005the stacked registers. This may make assembler output more readable. 9006 9007@item -mno-sdata 9008@itemx -msdata 9009@opindex mno-sdata 9010@opindex msdata 9011Disable (or enable) optimizations that use the small data section. This may 9012be useful for working around optimizer bugs. 9013 9014@item -mconstant-gp 9015@opindex mconstant-gp 9016Generate code that uses a single constant global pointer value. This is 9017useful when compiling kernel code. 9018 9019@item -mauto-pic 9020@opindex mauto-pic 9021Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 9022This is useful when compiling firmware code. 9023 9024@item -minline-divide-min-latency 9025@opindex minline-divide-min-latency 9026Generate code for inline divides using the minimum latency algorithm. 9027 9028@item -minline-divide-max-throughput 9029@opindex minline-divide-max-throughput 9030Generate code for inline divides using the maximum throughput algorithm. 9031 9032@item -mno-dwarf2-asm 9033@itemx -mdwarf2-asm 9034@opindex mno-dwarf2-asm 9035@opindex mdwarf2-asm 9036Don't (or do) generate assembler code for the DWARF2 line number debugging 9037info. This may be useful when not using the GNU assembler. 9038 9039@item -mfixed-range=@var{register-range} 9040@opindex mfixed-range 9041Generate code treating the given register range as fixed registers. 9042A fixed register is one that the register allocator can not use. This is 9043useful when compiling kernel code. A register range is specified as 9044two registers separated by a dash. Multiple register ranges can be 9045specified separated by a comma. 9046@end table 9047 9048@node D30V Options 9049@subsection D30V Options 9050@cindex D30V Options 9051 9052These @samp{-m} options are defined for D30V implementations: 9053 9054@table @gcctabopt 9055@item -mextmem 9056@opindex mextmem 9057Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings}, 9058@samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external 9059memory, which starts at location @code{0x80000000}. 9060 9061@item -mextmemory 9062@opindex mextmemory 9063Same as the @option{-mextmem} switch. 9064 9065@item -monchip 9066@opindex monchip 9067Link the @samp{.text} section into onchip text memory, which starts at 9068location @code{0x0}. Also link @samp{.data}, @samp{.bss}, 9069@samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections 9070into onchip data memory, which starts at location @code{0x20000000}. 9071 9072@item -mno-asm-optimize 9073@itemx -masm-optimize 9074@opindex mno-asm-optimize 9075@opindex masm-optimize 9076Disable (enable) passing @option{-O} to the assembler when optimizing. 9077The assembler uses the @option{-O} option to automatically parallelize 9078adjacent short instructions where possible. 9079 9080@item -mbranch-cost=@var{n} 9081@opindex mbranch-cost 9082Increase the internal costs of branches to @var{n}. Higher costs means 9083that the compiler will issue more instructions to avoid doing a branch. 9084The default is 2. 9085 9086@item -mcond-exec=@var{n} 9087@opindex mcond-exec 9088Specify the maximum number of conditionally executed instructions that 9089replace a branch. The default is 4. 9090@end table 9091 9092@node S/390 and zSeries Options 9093@subsection S/390 and zSeries Options 9094@cindex S/390 and zSeries Options 9095 9096These are the @samp{-m} options defined for the S/390 and zSeries architecture. 9097 9098@table @gcctabopt 9099@item -mhard-float 9100@itemx -msoft-float 9101@opindex mhard-float 9102@opindex msoft-float 9103Use (do not use) the hardware floating-point instructions and registers 9104for floating-point operations. When @option{-msoft-float} is specified, 9105functions in @file{libgcc.a} will be used to perform floating-point 9106operations. When @option{-mhard-float} is specified, the compiler 9107generates IEEE floating-point instructions. This is the default. 9108 9109@item -mbackchain 9110@itemx -mno-backchain 9111@opindex mbackchain 9112@opindex mno-backchain 9113Generate (or do not generate) code which maintains an explicit 9114backchain within the stack frame that points to the caller's frame. 9115This is currently needed to allow debugging. The default is to 9116generate the backchain. 9117 9118@item -msmall-exec 9119@itemx -mno-small-exec 9120@opindex msmall-exec 9121@opindex mno-small-exec 9122Generate (or do not generate) code using the @code{bras} instruction 9123to do subroutine calls. 9124This only works reliably if the total executable size does not 9125exceed 64k. The default is to use the @code{basr} instruction instead, 9126which does not have this limitation. 9127 9128@item -m64 9129@itemx -m31 9130@opindex m64 9131@opindex m31 9132When @option{-m31} is specified, generate code compliant to the 9133Linux for S/390 ABI@. When @option{-m64} is specified, generate 9134code compliant to the Linux for zSeries ABI@. This allows GCC in 9135particular to generate 64-bit instructions. For the @samp{s390} 9136targets, the default is @option{-m31}, while the @samp{s390x} 9137targets default to @option{-m64}. 9138 9139@item -mmvcle 9140@itemx -mno-mvcle 9141@opindex mmvcle 9142@opindex mno-mvcle 9143Generate (or do not generate) code using the @code{mvcle} instruction 9144to perform block moves. When @option{-mno-mvcle} is specifed, 9145use a @code{mvc} loop instead. This is the default. 9146 9147@item -mdebug 9148@itemx -mno-debug 9149@opindex mdebug 9150@opindex mno-debug 9151Print (or do not print) additional debug information when compiling. 9152The default is to not print debug information. 9153 9154@end table 9155 9156@node CRIS Options 9157@subsection CRIS Options 9158@cindex CRIS Options 9159 9160These options are defined specifically for the CRIS ports. 9161 9162@table @gcctabopt 9163@item -march=@var{architecture-type} 9164@itemx -mcpu=@var{architecture-type} 9165@opindex march 9166@opindex mcpu 9167Generate code for the specified architecture. The choices for 9168@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 9169respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX. 9170Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 9171@samp{v10}. 9172 9173@item -mtune=@var{architecture-type} 9174@opindex mtune 9175Tune to @var{architecture-type} everything applicable about the generated 9176code, except for the ABI and the set of available instructions. The 9177choices for @var{architecture-type} are the same as for 9178@option{-march=@var{architecture-type}}. 9179 9180@item -mmax-stack-frame=@var{n} 9181@opindex mmax-stack-frame 9182Warn when the stack frame of a function exceeds @var{n} bytes. 9183 9184@item -melinux-stacksize=@var{n} 9185@opindex melinux-stacksize 9186Only available with the @samp{cris-axis-aout} target. Arranges for 9187indications in the program to the kernel loader that the stack of the 9188program should be set to @var{n} bytes. 9189 9190@item -metrax4 9191@itemx -metrax100 9192@opindex metrax4 9193@opindex metrax100 9194The options @option{-metrax4} and @option{-metrax100} are synonyms for 9195@option{-march=v3} and @option{-march=v8} respectively. 9196 9197@item -mpdebug 9198@opindex mpdebug 9199Enable CRIS-specific verbose debug-related information in the assembly 9200code. This option also has the effect to turn off the @samp{#NO_APP} 9201formatted-code indicator to the assembler at the beginning of the 9202assembly file. 9203 9204@item -mcc-init 9205@opindex mcc-init 9206Do not use condition-code results from previous instruction; always emit 9207compare and test instructions before use of condition codes. 9208 9209@item -mno-side-effects 9210@opindex mno-side-effects 9211Do not emit instructions with side-effects in addressing modes other than 9212post-increment. 9213 9214@item -mstack-align 9215@itemx -mno-stack-align 9216@itemx -mdata-align 9217@itemx -mno-data-align 9218@itemx -mconst-align 9219@itemx -mno-const-align 9220@opindex mstack-align 9221@opindex mno-stack-align 9222@opindex mdata-align 9223@opindex mno-data-align 9224@opindex mconst-align 9225@opindex mno-const-align 9226These options (no-options) arranges (eliminate arrangements) for the 9227stack-frame, individual data and constants to be aligned for the maximum 9228single data access size for the chosen CPU model. The default is to 9229arrange for 32-bit alignment. ABI details such as structure layout are 9230not affected by these options. 9231 9232@item -m32-bit 9233@itemx -m16-bit 9234@itemx -m8-bit 9235@opindex m32-bit 9236@opindex m16-bit 9237@opindex m8-bit 9238Similar to the stack- data- and const-align options above, these options 9239arrange for stack-frame, writable data and constants to all be 32-bit, 924016-bit or 8-bit aligned. The default is 32-bit alignment. 9241 9242@item -mno-prologue-epilogue 9243@itemx -mprologue-epilogue 9244@opindex mno-prologue-epilogue 9245@opindex mprologue-epilogue 9246With @option{-mno-prologue-epilogue}, the normal function prologue and 9247epilogue that sets up the stack-frame are omitted and no return 9248instructions or return sequences are generated in the code. Use this 9249option only together with visual inspection of the compiled code: no 9250warnings or errors are generated when call-saved registers must be saved, 9251or storage for local variable needs to be allocated. 9252 9253@item -mno-gotplt 9254@itemx -mgotplt 9255@opindex mno-gotplt 9256@opindex mgotplt 9257With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 9258instruction sequences that load addresses for functions from the PLT part 9259of the GOT rather than (traditional on other architectures) calls to the 9260PLT. The default is @option{-mgotplt}. 9261 9262@item -maout 9263@opindex maout 9264Legacy no-op option only recognized with the cris-axis-aout target. 9265 9266@item -melf 9267@opindex melf 9268Legacy no-op option only recognized with the cris-axis-elf and 9269cris-axis-linux-gnu targets. 9270 9271@item -melinux 9272@opindex melinux 9273Only recognized with the cris-axis-aout target, where it selects a 9274GNU/linux-like multilib, include files and instruction set for 9275@option{-march=v8}. 9276 9277@item -mlinux 9278@opindex mlinux 9279Legacy no-op option only recognized with the cris-axis-linux-gnu target. 9280 9281@item -sim 9282@opindex sim 9283This option, recognized for the cris-axis-aout and cris-axis-elf arranges 9284to link with input-output functions from a simulator library. Code, 9285initialized data and zero-initialized data are allocated consecutively. 9286 9287@item -sim2 9288@opindex sim2 9289Like @option{-sim}, but pass linker options to locate initialized data at 92900x40000000 and zero-initialized data at 0x80000000. 9291@end table 9292 9293@node MMIX Options 9294@subsection MMIX Options 9295@cindex MMIX Options 9296 9297These options are defined for the MMIX: 9298 9299@table @gcctabopt 9300@item -mlibfuncs 9301@itemx -mno-libfuncs 9302@opindex mlibfuncs 9303@opindex mno-libfuncs 9304Specify that intrinsic library functions are being compiled, passing all 9305values in registers, no matter the size. 9306 9307@item -mepsilon 9308@itemx -mno-epsilon 9309@opindex mepsilon 9310@opindex mno-epsilon 9311Generate floating-point comparison instructions that compare with respect 9312to the @code{rE} epsilon register. 9313 9314@item -mabi=mmixware 9315@itemx -mabi=gnu 9316@opindex mabi-mmixware 9317@opindex mabi=gnu 9318Generate code that passes function parameters and return values that (in 9319the called function) are seen as registers @code{$0} and up, as opposed to 9320the GNU ABI which uses global registers @code{$231} and up. 9321 9322@item -mzero-extend 9323@itemx -mno-zero-extend 9324@opindex mzero-extend 9325@opindex mno-zero-extend 9326When reading data from memory in sizes shorter than 64 bits, use (do not 9327use) zero-extending load instructions by default, rather than 9328sign-extending ones. 9329 9330@item -mknuthdiv 9331@itemx -mno-knuthdiv 9332@opindex mknuthdiv 9333@opindex mno-knuthdiv 9334Make the result of a division yielding a remainder have the same sign as 9335the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 9336remainder follows the sign of the dividend. Both methods are 9337arithmetically valid, the latter being almost exclusively used. 9338 9339@item -mtoplevel-symbols 9340@itemx -mno-toplevel-symbols 9341@opindex mtoplevel-symbols 9342@opindex mno-toplevel-symbols 9343Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 9344code can be used with the @code{PREFIX} assembly directive. 9345 9346@item -melf 9347@opindex melf 9348Generate an executable in the ELF format, rather than the default 9349@samp{mmo} format used by the @command{mmix} simulator. 9350 9351@item -mbranch-predict 9352@itemx -mno-branch-predict 9353@opindex mbranch-predict 9354@opindex mno-branch-predict 9355Use (do not use) the probable-branch instructions, when static branch 9356prediction indicates a probable branch. 9357 9358@item -mbase-addresses 9359@itemx -mno-base-addresses 9360@opindex mbase-addresses 9361@opindex mno-base-addresses 9362Generate (do not generate) code that uses @emph{base addresses}. Using a 9363base address automatically generates a request (handled by the assembler 9364and the linker) for a constant to be set up in a global register. The 9365register is used for one or more base address requests within the range 0 9366to 255 from the value held in the register. The generally leads to short 9367and fast code, but the number of different data items that can be 9368addressed is limited. This means that a program that uses lots of static 9369data may require @option{-mno-base-addresses}. 9370@end table 9371 9372@node PDP-11 Options 9373@subsection PDP-11 Options 9374@cindex PDP-11 Options 9375 9376These options are defined for the PDP-11: 9377 9378@table @gcctabopt 9379@item -mfpu 9380@opindex mfpu 9381Use hardware FPP floating point. This is the default. (FIS floating 9382point on the PDP-11/40 is not supported.) 9383 9384@item -msoft-float 9385@opindex msoft-float 9386Do not use hardware floating point. 9387 9388@item -mac0 9389@opindex mac0 9390Return floating-point results in ac0 (fr0 in Unix assembler syntax). 9391 9392@item -mno-ac0 9393@opindex mno-ac0 9394Return floating-point results in memory. This is the default. 9395 9396@item -m40 9397@opindex m40 9398Generate code for a PDP-11/40. 9399 9400@item -m45 9401@opindex m45 9402Generate code for a PDP-11/45. This is the default. 9403 9404@item -m10 9405@opindex m10 9406Generate code for a PDP-11/10. 9407 9408@item -mbcopy-builtin 9409@opindex bcopy-builtin 9410Use inline @code{movstrhi} patterns for copying memory. This is the 9411default. 9412 9413@item -mbcopy 9414@opindex mbcopy 9415Do not use inline @code{movstrhi} patterns for copying memory. 9416 9417@item -mint16 9418@itemx -mno-int32 9419@opindex mint16 9420@opindex mno-int32 9421Use 16-bit @code{int}. This is the default. 9422 9423@item -mint32 9424@itemx -mno-int16 9425@opindex mint32 9426@opindex mno-int16 9427Use 32-bit @code{int}. 9428 9429@item -mfloat64 9430@itemx -mno-float32 9431@opindex mfloat64 9432@opindex mno-float32 9433Use 64-bit @code{float}. This is the default. 9434 9435@item -mfloat32 9436@item -mno-float64 9437@opindex mfloat32 9438@opindex mno-float64 9439Use 32-bit @code{float}. 9440 9441@item -mabshi 9442@opindex mabshi 9443Use @code{abshi2} pattern. This is the default. 9444 9445@item -mno-abshi 9446@opindex mno-abshi 9447Do not use @code{abshi2} pattern. 9448 9449@item -mbranch-expensive 9450@opindex mbranch-expensive 9451Pretend that branches are expensive. This is for experimenting with 9452code generation only. 9453 9454@item -mbranch-cheap 9455@opindex mbranch-cheap 9456Do not pretend that branches are expensive. This is the default. 9457 9458@item -msplit 9459@opindex msplit 9460Generate code for a system with split I&D. 9461 9462@item -mno-split 9463@opindex mno-split 9464Generate code for a system without split I&D. This is the default. 9465 9466@item -munix-asm 9467@opindex munix-asm 9468Use Unix assembler syntax. This is the default when configured for 9469@samp{pdp11-*-bsd}. 9470 9471@item -mdec-asm 9472@opindex mdec-asm 9473Use DEC assembler syntax. This is the default when configured for any 9474PDP-11 target other than @samp{pdp11-*-bsd}. 9475@end table 9476 9477@node Xstormy16 Options 9478@subsection Xstormy16 Options 9479@cindex Xstormy16 Options 9480 9481These options are defined for Xstormy16: 9482 9483@table @gcctabopt 9484@item -msim 9485@opindex msim 9486Choose startup files and linker script suitable for the simulator. 9487@end table 9488 9489@node Xtensa Options 9490@subsection Xtensa Options 9491@cindex Xtensa Options 9492 9493The Xtensa architecture is designed to support many different 9494configurations. The compiler's default options can be set to match a 9495particular Xtensa configuration by copying a configuration file into the 9496GCC sources when building GCC@. The options below may be used to 9497override the default options. 9498 9499@table @gcctabopt 9500@item -mbig-endian 9501@itemx -mlittle-endian 9502@opindex mbig-endian 9503@opindex mlittle-endian 9504Specify big-endian or little-endian byte ordering for the target Xtensa 9505processor. 9506 9507@item -mdensity 9508@itemx -mno-density 9509@opindex mdensity 9510@opindex mno-density 9511Enable or disable use of the optional Xtensa code density instructions. 9512 9513@item -mmac16 9514@itemx -mno-mac16 9515@opindex mmac16 9516@opindex mno-mac16 9517Enable or disable use of the Xtensa MAC16 option. When enabled, GCC 9518will generate MAC16 instructions from standard C code, with the 9519limitation that it will use neither the MR register file nor any 9520instruction that operates on the MR registers. When this option is 9521disabled, GCC will translate 16-bit multiply/accumulate operations to a 9522combination of core instructions and library calls, depending on whether 9523any other multiplier options are enabled. 9524 9525@item -mmul16 9526@itemx -mno-mul16 9527@opindex mmul16 9528@opindex mno-mul16 9529Enable or disable use of the 16-bit integer multiplier option. When 9530enabled, the compiler will generate 16-bit multiply instructions for 9531multiplications of 16 bits or smaller in standard C code. When this 9532option is disabled, the compiler will either use 32-bit multiply or 9533MAC16 instructions if they are available or generate library calls to 9534perform the multiply operations using shifts and adds. 9535 9536@item -mmul32 9537@itemx -mno-mul32 9538@opindex mmul32 9539@opindex mno-mul32 9540Enable or disable use of the 32-bit integer multiplier option. When 9541enabled, the compiler will generate 32-bit multiply instructions for 9542multiplications of 32 bits or smaller in standard C code. When this 9543option is disabled, the compiler will generate library calls to perform 9544the multiply operations using either shifts and adds or 16-bit multiply 9545instructions if they are available. 9546 9547@item -mnsa 9548@itemx -mno-nsa 9549@opindex mnsa 9550@opindex mno-nsa 9551Enable or disable use of the optional normalization shift amount 9552(@code{NSA}) instructions to implement the built-in @code{ffs} function. 9553 9554@item -mminmax 9555@itemx -mno-minmax 9556@opindex mminmax 9557@opindex mno-minmax 9558Enable or disable use of the optional minimum and maximum value 9559instructions. 9560 9561@item -msext 9562@itemx -mno-sext 9563@opindex msext 9564@opindex mno-sext 9565Enable or disable use of the optional sign extend (@code{SEXT}) 9566instruction. 9567 9568@item -mbooleans 9569@itemx -mno-booleans 9570@opindex mbooleans 9571@opindex mno-booleans 9572Enable or disable support for the boolean register file used by Xtensa 9573coprocessors. This is not typically useful by itself but may be 9574required for other options that make use of the boolean registers (e.g., 9575the floating-point option). 9576 9577@item -mhard-float 9578@itemx -msoft-float 9579@opindex mhard-float 9580@opindex msoft-float 9581Enable or disable use of the floating-point option. When enabled, GCC 9582generates floating-point instructions for 32-bit @code{float} 9583operations. When this option is disabled, GCC generates library calls 9584to emulate 32-bit floating-point operations using integer instructions. 9585Regardless of this option, 64-bit @code{double} operations are always 9586emulated with calls to library functions. 9587 9588@item -mfused-madd 9589@itemx -mno-fused-madd 9590@opindex mfused-madd 9591@opindex mno-fused-madd 9592Enable or disable use of fused multiply/add and multiply/subtract 9593instructions in the floating-point option. This has no effect if the 9594floating-point option is not also enabled. Disabling fused multiply/add 9595and multiply/subtract instructions forces the compiler to use separate 9596instructions for the multiply and add/subtract operations. This may be 9597desirable in some cases where strict IEEE 754-compliant results are 9598required: the fused multiply add/subtract instructions do not round the 9599intermediate result, thereby producing results with @emph{more} bits of 9600precision than specified by the IEEE standard. Disabling fused multiply 9601add/subtract instructions also ensures that the program output is not 9602sensitive to the compiler's ability to combine multiply and add/subtract 9603operations. 9604 9605@item -mserialize-volatile 9606@itemx -mno-serialize-volatile 9607@opindex mserialize-volatile 9608@opindex mno-serialize-volatile 9609When this option is enabled, GCC inserts @code{MEMW} instructions before 9610@code{volatile} memory references to guarantee sequential consistency. 9611The default is @option{-mserialize-volatile}. Use 9612@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions. 9613 9614@item -mtext-section-literals 9615@itemx -mno-text-section-literals 9616@opindex mtext-section-literals 9617@opindex mno-text-section-literals 9618Control the treatment of literal pools. The default is 9619@option{-mno-text-section-literals}, which places literals in a separate 9620section in the output file. This allows the literal pool to be placed 9621in a data RAM/ROM, and it also allows the linker to combine literal 9622pools from separate object files to remove redundant literals and 9623improve code size. With @option{-mtext-section-literals}, the literals 9624are interspersed in the text section in order to keep them as close as 9625possible to their references. This may be necessary for large assembly 9626files. 9627 9628@item -mtarget-align 9629@itemx -mno-target-align 9630@opindex mtarget-align 9631@opindex mno-target-align 9632When this option is enabled, GCC instructs the assembler to 9633automatically align instructions to reduce branch penalties at the 9634expense of some code density. The assembler attempts to widen density 9635instructions to align branch targets and the instructions following call 9636instructions. If there are not enough preceding safe density 9637instructions to align a target, no widening will be performed. The 9638default is @option{-mtarget-align}. These options do not affect the 9639treatment of auto-aligned instructions like @code{LOOP}, which the 9640assembler will always align, either by widening density instructions or 9641by inserting no-op instructions. 9642 9643@item -mlongcalls 9644@itemx -mno-longcalls 9645@opindex mlongcalls 9646@opindex mno-longcalls 9647When this option is enabled, GCC instructs the assembler to translate 9648direct calls to indirect calls unless it can determine that the target 9649of a direct call is in the range allowed by the call instruction. This 9650translation typically occurs for calls to functions in other source 9651files. Specifically, the assembler translates a direct @code{CALL} 9652instruction into an @code{L32R} followed by a @code{CALLX} instruction. 9653The default is @option{-mno-longcalls}. This option should be used in 9654programs where the call target can potentially be out of range. This 9655option is implemented in the assembler, not the compiler, so the 9656assembly code generated by GCC will still show direct call 9657instructions---look at the disassembled object code to see the actual 9658instructions. Note that the assembler will use an indirect call for 9659every cross-file call, not just those that really will be out of range. 9660@end table 9661 9662@node Code Gen Options 9663@section Options for Code Generation Conventions 9664@cindex code generation conventions 9665@cindex options, code generation 9666@cindex run-time options 9667 9668These machine-independent options control the interface conventions 9669used in code generation. 9670 9671Most of them have both positive and negative forms; the negative form 9672of @option{-ffoo} would be @option{-fno-foo}. In the table below, only 9673one of the forms is listed---the one which is not the default. You 9674can figure out the other form by either removing @samp{no-} or adding 9675it. 9676 9677@table @gcctabopt 9678@item -fexceptions 9679@opindex fexceptions 9680Enable exception handling. Generates extra code needed to propagate 9681exceptions. For some targets, this implies GCC will generate frame 9682unwind information for all functions, which can produce significant data 9683size overhead, although it does not affect execution. If you do not 9684specify this option, GCC will enable it by default for languages like 9685C++ which normally require exception handling, and disable it for 9686languages like C that do not normally require it. However, you may need 9687to enable this option when compiling C code that needs to interoperate 9688properly with exception handlers written in C++. You may also wish to 9689disable this option if you are compiling older C++ programs that don't 9690use exception handling. 9691 9692@item -fnon-call-exceptions 9693@opindex fnon-call-exceptions 9694Generate code that allows trapping instructions to throw exceptions. 9695Note that this requires platform-specific runtime support that does 9696not exist everywhere. Moreover, it only allows @emph{trapping} 9697instructions to throw exceptions, i.e.@: memory references or floating 9698point instructions. It does not allow exceptions to be thrown from 9699arbitrary signal handlers such as @code{SIGALRM}. 9700 9701@item -funwind-tables 9702@opindex funwind-tables 9703Similar to @option{-fexceptions}, except that it will just generate any needed 9704static data, but will not affect the generated code in any other way. 9705You will normally not enable this option; instead, a language processor 9706that needs this handling would enable it on your behalf. 9707 9708@item -fasynchronous-unwind-tables 9709@opindex funwind-tables 9710Generate unwind table in dwarf2 format, if supported by target machine. The 9711table is exact at each instruction boundary, so it can be used for stack 9712unwinding from asynchronous events (such as debugger or garbage collector). 9713 9714@item -fpcc-struct-return 9715@opindex fpcc-struct-return 9716Return ``short'' @code{struct} and @code{union} values in memory like 9717longer ones, rather than in registers. This convention is less 9718efficient, but it has the advantage of allowing intercallability between 9719GCC-compiled files and files compiled with other compilers. 9720 9721The precise convention for returning structures in memory depends 9722on the target configuration macros. 9723 9724Short structures and unions are those whose size and alignment match 9725that of some integer type. 9726 9727@item -freg-struct-return 9728@opindex freg-struct-return 9729Return @code{struct} and @code{union} values in registers when possible. 9730This is more efficient for small structures than 9731@option{-fpcc-struct-return}. 9732 9733If you specify neither @option{-fpcc-struct-return} nor 9734@option{-freg-struct-return}, GCC defaults to whichever convention is 9735standard for the target. If there is no standard convention, GCC 9736defaults to @option{-fpcc-struct-return}, except on targets where GCC is 9737the principal compiler. In those cases, we can choose the standard, and 9738we chose the more efficient register return alternative. 9739 9740@item -fshort-enums 9741@opindex fshort-enums 9742Allocate to an @code{enum} type only as many bytes as it needs for the 9743declared range of possible values. Specifically, the @code{enum} type 9744will be equivalent to the smallest integer type which has enough room. 9745 9746@item -fshort-double 9747@opindex fshort-double 9748Use the same size for @code{double} as for @code{float}. 9749 9750@item -fshared-data 9751@opindex fshared-data 9752Requests that the data and non-@code{const} variables of this 9753compilation be shared data rather than private data. The distinction 9754makes sense only on certain operating systems, where shared data is 9755shared between processes running the same program, while private data 9756exists in one copy per process. 9757 9758@item -fno-common 9759@opindex fno-common 9760In C, allocate even uninitialized global variables in the data section of the 9761object file, rather than generating them as common blocks. This has the 9762effect that if the same variable is declared (without @code{extern}) in 9763two different compilations, you will get an error when you link them. 9764The only reason this might be useful is if you wish to verify that the 9765program will work on other systems which always work this way. 9766 9767@item -fno-ident 9768@opindex fno-ident 9769Ignore the @samp{#ident} directive. 9770 9771@item -fno-gnu-linker 9772@opindex fno-gnu-linker 9773Do not output global initializations (such as C++ constructors and 9774destructors) in the form used by the GNU linker (on systems where the GNU 9775linker is the standard method of handling them). Use this option when 9776you want to use a non-GNU linker, which also requires using the 9777@command{collect2} program to make sure the system linker includes 9778constructors and destructors. (@command{collect2} is included in the GCC 9779distribution.) For systems which @emph{must} use @command{collect2}, the 9780compiler driver @command{gcc} is configured to do this automatically. 9781 9782@item -finhibit-size-directive 9783@opindex finhibit-size-directive 9784Don't output a @code{.size} assembler directive, or anything else that 9785would cause trouble if the function is split in the middle, and the 9786two halves are placed at locations far apart in memory. This option is 9787used when compiling @file{crtstuff.c}; you should not need to use it 9788for anything else. 9789 9790@item -fverbose-asm 9791@opindex fverbose-asm 9792Put extra commentary information in the generated assembly code to 9793make it more readable. This option is generally only of use to those 9794who actually need to read the generated assembly code (perhaps while 9795debugging the compiler itself). 9796 9797@option{-fno-verbose-asm}, the default, causes the 9798extra information to be omitted and is useful when comparing two assembler 9799files. 9800 9801@item -fvolatile 9802@opindex fvolatile 9803Consider all memory references through pointers to be volatile. 9804 9805@item -fvolatile-global 9806@opindex fvolatile-global 9807Consider all memory references to extern and global data items to 9808be volatile. GCC does not consider static data items to be volatile 9809because of this switch. 9810 9811@item -fvolatile-static 9812@opindex fvolatile-static 9813Consider all memory references to static data to be volatile. 9814 9815@item -fpic 9816@opindex fpic 9817@cindex global offset table 9818@cindex PIC 9819Generate position-independent code (PIC) suitable for use in a shared 9820library, if supported for the target machine. Such code accesses all 9821constant addresses through a global offset table (GOT)@. The dynamic 9822loader resolves the GOT entries when the program starts (the dynamic 9823loader is not part of GCC; it is part of the operating system). If 9824the GOT size for the linked executable exceeds a machine-specific 9825maximum size, you get an error message from the linker indicating that 9826@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 9827instead. (These maximums are 16k on the m88k, 8k on the Sparc, and 32k 9828on the m68k and RS/6000. The 386 has no such limit.) 9829 9830Position-independent code requires special support, and therefore works 9831only on certain machines. For the 386, GCC supports PIC for System V 9832but not for the Sun 386i. Code generated for the IBM RS/6000 is always 9833position-independent. 9834 9835@item -fPIC 9836@opindex fPIC 9837If supported for the target machine, emit position-independent code, 9838suitable for dynamic linking and avoiding any limit on the size of the 9839global offset table. This option makes a difference on the m68k, m88k, 9840and the Sparc. 9841 9842Position-independent code requires special support, and therefore works 9843only on certain machines. 9844 9845@item -ffixed-@var{reg} 9846@opindex ffixed 9847Treat the register named @var{reg} as a fixed register; generated code 9848should never refer to it (except perhaps as a stack pointer, frame 9849pointer or in some other fixed role). 9850 9851@var{reg} must be the name of a register. The register names accepted 9852are machine-specific and are defined in the @code{REGISTER_NAMES} 9853macro in the machine description macro file. 9854 9855This flag does not have a negative form, because it specifies a 9856three-way choice. 9857 9858@item -fcall-used-@var{reg} 9859@opindex fcall-used 9860Treat the register named @var{reg} as an allocable register that is 9861clobbered by function calls. It may be allocated for temporaries or 9862variables that do not live across a call. Functions compiled this way 9863will not save and restore the register @var{reg}. 9864 9865It is an error to used this flag with the frame pointer or stack pointer. 9866Use of this flag for other registers that have fixed pervasive roles in 9867the machine's execution model will produce disastrous results. 9868 9869This flag does not have a negative form, because it specifies a 9870three-way choice. 9871 9872@item -fcall-saved-@var{reg} 9873@opindex fcall-saved 9874Treat the register named @var{reg} as an allocable register saved by 9875functions. It may be allocated even for temporaries or variables that 9876live across a call. Functions compiled this way will save and restore 9877the register @var{reg} if they use it. 9878 9879It is an error to used this flag with the frame pointer or stack pointer. 9880Use of this flag for other registers that have fixed pervasive roles in 9881the machine's execution model will produce disastrous results. 9882 9883A different sort of disaster will result from the use of this flag for 9884a register in which function values may be returned. 9885 9886This flag does not have a negative form, because it specifies a 9887three-way choice. 9888 9889@item -fpack-struct 9890@opindex fpack-struct 9891Pack all structure members together without holes. Usually you would 9892not want to use this option, since it makes the code suboptimal, and 9893the offsets of structure members won't agree with system libraries. 9894 9895@item -finstrument-functions 9896@opindex finstrument-functions 9897Generate instrumentation calls for entry and exit to functions. Just 9898after function entry and just before function exit, the following 9899profiling functions will be called with the address of the current 9900function and its call site. (On some platforms, 9901@code{__builtin_return_address} does not work beyond the current 9902function, so the call site information may not be available to the 9903profiling functions otherwise.) 9904 9905@example 9906void __cyg_profile_func_enter (void *this_fn, 9907 void *call_site); 9908void __cyg_profile_func_exit (void *this_fn, 9909 void *call_site); 9910@end example 9911 9912The first argument is the address of the start of the current function, 9913which may be looked up exactly in the symbol table. 9914 9915This instrumentation is also done for functions expanded inline in other 9916functions. The profiling calls will indicate where, conceptually, the 9917inline function is entered and exited. This means that addressable 9918versions of such functions must be available. If all your uses of a 9919function are expanded inline, this may mean an additional expansion of 9920code size. If you use @samp{extern inline} in your C code, an 9921addressable version of such functions must be provided. (This is 9922normally the case anyways, but if you get lucky and the optimizer always 9923expands the functions inline, you might have gotten away without 9924providing static copies.) 9925 9926A function may be given the attribute @code{no_instrument_function}, in 9927which case this instrumentation will not be done. This can be used, for 9928example, for the profiling functions listed above, high-priority 9929interrupt routines, and any functions from which the profiling functions 9930cannot safely be called (perhaps signal handlers, if the profiling 9931routines generate output or allocate memory). 9932 9933@item -fstack-check 9934@opindex fstack-check 9935Generate code to verify that you do not go beyond the boundary of the 9936stack. You should specify this flag if you are running in an 9937environment with multiple threads, but only rarely need to specify it in 9938a single-threaded environment since stack overflow is automatically 9939detected on nearly all systems if there is only one stack. 9940 9941Note that this switch does not actually cause checking to be done; the 9942operating system must do that. The switch causes generation of code 9943to ensure that the operating system sees the stack being extended. 9944 9945@item -fstack-limit-register=@var{reg} 9946@itemx -fstack-limit-symbol=@var{sym} 9947@itemx -fno-stack-limit 9948@opindex fstack-limit-register 9949@opindex fstack-limit-symbol 9950@opindex fno-stack-limit 9951Generate code to ensure that the stack does not grow beyond a certain value, 9952either the value of a register or the address of a symbol. If the stack 9953would grow beyond the value, a signal is raised. For most targets, 9954the signal is raised before the stack overruns the boundary, so 9955it is possible to catch the signal without taking special precautions. 9956 9957For instance, if the stack starts at absolute address @samp{0x80000000} 9958and grows downwards, you can use the flags 9959@option{-fstack-limit-symbol=__stack_limit} and 9960@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 9961of 128KB@. Note that this may only work with the GNU linker. 9962 9963@cindex aliasing of parameters 9964@cindex parameters, aliased 9965@item -fargument-alias 9966@itemx -fargument-noalias 9967@itemx -fargument-noalias-global 9968@opindex fargument-alias 9969@opindex fargument-noalias 9970@opindex fargument-noalias-global 9971Specify the possible relationships among parameters and between 9972parameters and global data. 9973 9974@option{-fargument-alias} specifies that arguments (parameters) may 9975alias each other and may alias global storage.@* 9976@option{-fargument-noalias} specifies that arguments do not alias 9977each other, but may alias global storage.@* 9978@option{-fargument-noalias-global} specifies that arguments do not 9979alias each other and do not alias global storage. 9980 9981Each language will automatically use whatever option is required by 9982the language standard. You should not need to use these options yourself. 9983 9984@item -fleading-underscore 9985@opindex fleading-underscore 9986This option and its counterpart, @option{-fno-leading-underscore}, forcibly 9987change the way C symbols are represented in the object file. One use 9988is to help link with legacy assembly code. 9989 9990Be warned that you should know what you are doing when invoking this 9991option, and that not all targets provide complete support for it. 9992@end table 9993 9994@c man end 9995 9996@node Environment Variables 9997@section Environment Variables Affecting GCC 9998@cindex environment variables 9999 10000@c man begin ENVIRONMENT 10001 10002This section describes several environment variables that affect how GCC 10003operates. Some of them work by specifying directories or prefixes to use 10004when searching for various kinds of files. Some are used to specify other 10005aspects of the compilation environment. 10006 10007Note that you can also specify places to search using options such as 10008@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 10009take precedence over places specified using environment variables, which 10010in turn take precedence over those specified by the configuration of GCC@. 10011@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 10012GNU Compiler Collection (GCC) Internals}. 10013 10014@table @env 10015@item LANG 10016@itemx LC_CTYPE 10017@c @itemx LC_COLLATE 10018@itemx LC_MESSAGES 10019@c @itemx LC_MONETARY 10020@c @itemx LC_NUMERIC 10021@c @itemx LC_TIME 10022@itemx LC_ALL 10023@findex LANG 10024@findex LC_CTYPE 10025@c @findex LC_COLLATE 10026@findex LC_MESSAGES 10027@c @findex LC_MONETARY 10028@c @findex LC_NUMERIC 10029@c @findex LC_TIME 10030@findex LC_ALL 10031@cindex locale 10032These environment variables control the way that GCC uses 10033localization information that allow GCC to work with different 10034national conventions. GCC inspects the locale categories 10035@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 10036so. These locale categories can be set to any value supported by your 10037installation. A typical value is @samp{en_UK} for English in the United 10038Kingdom. 10039 10040The @env{LC_CTYPE} environment variable specifies character 10041classification. GCC uses it to determine the character boundaries in 10042a string; this is needed for some multibyte encodings that contain quote 10043and escape characters that would otherwise be interpreted as a string 10044end or escape. 10045 10046The @env{LC_MESSAGES} environment variable specifies the language to 10047use in diagnostic messages. 10048 10049If the @env{LC_ALL} environment variable is set, it overrides the value 10050of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 10051and @env{LC_MESSAGES} default to the value of the @env{LANG} 10052environment variable. If none of these variables are set, GCC 10053defaults to traditional C English behavior. 10054 10055@item TMPDIR 10056@findex TMPDIR 10057If @env{TMPDIR} is set, it specifies the directory to use for temporary 10058files. GCC uses temporary files to hold the output of one stage of 10059compilation which is to be used as input to the next stage: for example, 10060the output of the preprocessor, which is the input to the compiler 10061proper. 10062 10063@item GCC_EXEC_PREFIX 10064@findex GCC_EXEC_PREFIX 10065If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 10066names of the subprograms executed by the compiler. No slash is added 10067when this prefix is combined with the name of a subprogram, but you can 10068specify a prefix that ends with a slash if you wish. 10069 10070If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out 10071an appropriate prefix to use based on the pathname it was invoked with. 10072 10073If GCC cannot find the subprogram using the specified prefix, it 10074tries looking in the usual places for the subprogram. 10075 10076The default value of @env{GCC_EXEC_PREFIX} is 10077@file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value 10078of @code{prefix} when you ran the @file{configure} script. 10079 10080Other prefixes specified with @option{-B} take precedence over this prefix. 10081 10082This prefix is also used for finding files such as @file{crt0.o} that are 10083used for linking. 10084 10085In addition, the prefix is used in an unusual way in finding the 10086directories to search for header files. For each of the standard 10087directories whose name normally begins with @samp{/usr/local/lib/gcc-lib} 10088(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 10089replacing that beginning with the specified prefix to produce an 10090alternate directory name. Thus, with @option{-Bfoo/}, GCC will search 10091@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}. 10092These alternate directories are searched first; the standard directories 10093come next. 10094 10095@item COMPILER_PATH 10096@findex COMPILER_PATH 10097The value of @env{COMPILER_PATH} is a colon-separated list of 10098directories, much like @env{PATH}. GCC tries the directories thus 10099specified when searching for subprograms, if it can't find the 10100subprograms using @env{GCC_EXEC_PREFIX}. 10101 10102@item LIBRARY_PATH 10103@findex LIBRARY_PATH 10104The value of @env{LIBRARY_PATH} is a colon-separated list of 10105directories, much like @env{PATH}. When configured as a native compiler, 10106GCC tries the directories thus specified when searching for special 10107linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking 10108using GCC also uses these directories when searching for ordinary 10109libraries for the @option{-l} option (but directories specified with 10110@option{-L} come first). 10111 10112@item LANG 10113@findex LANG 10114@cindex locale definition 10115This variable is used to pass locale information to the compiler. One way in 10116which this information is used is to determine the character set to be used 10117when character literals, string literals and comments are parsed in C and C++. 10118When the compiler is configured to allow multibyte characters, 10119the following values for @env{LANG} are recognized: 10120 10121@table @samp 10122@item C-JIS 10123Recognize JIS characters. 10124@item C-SJIS 10125Recognize SJIS characters. 10126@item C-EUCJP 10127Recognize EUCJP characters. 10128@end table 10129 10130If @env{LANG} is not defined, or if it has some other value, then the 10131compiler will use mblen and mbtowc as defined by the default locale to 10132recognize and translate multibyte characters. 10133@end table 10134 10135@noindent 10136Some additional environments variables affect the behavior of the 10137preprocessor. 10138 10139@include cppenv.texi 10140 10141@c man end 10142 10143@node Running Protoize 10144@section Running Protoize 10145 10146The program @code{protoize} is an optional part of GCC@. You can use 10147it to add prototypes to a program, thus converting the program to ISO 10148C in one respect. The companion program @code{unprotoize} does the 10149reverse: it removes argument types from any prototypes that are found. 10150 10151When you run these programs, you must specify a set of source files as 10152command line arguments. The conversion programs start out by compiling 10153these files to see what functions they define. The information gathered 10154about a file @var{foo} is saved in a file named @file{@var{foo}.X}. 10155 10156After scanning comes actual conversion. The specified files are all 10157eligible to be converted; any files they include (whether sources or 10158just headers) are eligible as well. 10159 10160But not all the eligible files are converted. By default, 10161@code{protoize} and @code{unprotoize} convert only source and header 10162files in the current directory. You can specify additional directories 10163whose files should be converted with the @option{-d @var{directory}} 10164option. You can also specify particular files to exclude with the 10165@option{-x @var{file}} option. A file is converted if it is eligible, its 10166directory name matches one of the specified directory names, and its 10167name within the directory has not been excluded. 10168 10169Basic conversion with @code{protoize} consists of rewriting most 10170function definitions and function declarations to specify the types of 10171the arguments. The only ones not rewritten are those for varargs 10172functions. 10173 10174@code{protoize} optionally inserts prototype declarations at the 10175beginning of the source file, to make them available for any calls that 10176precede the function's definition. Or it can insert prototype 10177declarations with block scope in the blocks where undeclared functions 10178are called. 10179 10180Basic conversion with @code{unprotoize} consists of rewriting most 10181function declarations to remove any argument types, and rewriting 10182function definitions to the old-style pre-ISO form. 10183 10184Both conversion programs print a warning for any function declaration or 10185definition that they can't convert. You can suppress these warnings 10186with @option{-q}. 10187 10188The output from @code{protoize} or @code{unprotoize} replaces the 10189original source file. The original file is renamed to a name ending 10190with @samp{.save} (for DOS, the saved filename ends in @samp{.sav} 10191without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav} 10192for DOS) file already exists, then the source file is simply discarded. 10193 10194@code{protoize} and @code{unprotoize} both depend on GCC itself to 10195scan the program and collect information about the functions it uses. 10196So neither of these programs will work until GCC is installed. 10197 10198Here is a table of the options you can use with @code{protoize} and 10199@code{unprotoize}. Each option works with both programs unless 10200otherwise stated. 10201 10202@table @code 10203@item -B @var{directory} 10204Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the 10205usual directory (normally @file{/usr/local/lib}). This file contains 10206prototype information about standard system functions. This option 10207applies only to @code{protoize}. 10208 10209@item -c @var{compilation-options} 10210Use @var{compilation-options} as the options when running @code{gcc} to 10211produce the @samp{.X} files. The special option @option{-aux-info} is 10212always passed in addition, to tell @code{gcc} to write a @samp{.X} file. 10213 10214Note that the compilation options must be given as a single argument to 10215@code{protoize} or @code{unprotoize}. If you want to specify several 10216@code{gcc} options, you must quote the entire set of compilation options 10217to make them a single word in the shell. 10218 10219There are certain @code{gcc} arguments that you cannot use, because they 10220would produce the wrong kind of output. These include @option{-g}, 10221@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in 10222the @var{compilation-options}, they are ignored. 10223 10224@item -C 10225Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file 10226systems) instead of @samp{.c}. This is convenient if you are converting 10227a C program to C++. This option applies only to @code{protoize}. 10228 10229@item -g 10230Add explicit global declarations. This means inserting explicit 10231declarations at the beginning of each source file for each function 10232that is called in the file and was not declared. These declarations 10233precede the first function definition that contains a call to an 10234undeclared function. This option applies only to @code{protoize}. 10235 10236@item -i @var{string} 10237Indent old-style parameter declarations with the string @var{string}. 10238This option applies only to @code{protoize}. 10239 10240@code{unprotoize} converts prototyped function definitions to old-style 10241function definitions, where the arguments are declared between the 10242argument list and the initial @samp{@{}. By default, @code{unprotoize} 10243uses five spaces as the indentation. If you want to indent with just 10244one space instead, use @option{-i " "}. 10245 10246@item -k 10247Keep the @samp{.X} files. Normally, they are deleted after conversion 10248is finished. 10249 10250@item -l 10251Add explicit local declarations. @code{protoize} with @option{-l} inserts 10252a prototype declaration for each function in each block which calls the 10253function without any declaration. This option applies only to 10254@code{protoize}. 10255 10256@item -n 10257Make no real changes. This mode just prints information about the conversions 10258that would have been done without @option{-n}. 10259 10260@item -N 10261Make no @samp{.save} files. The original files are simply deleted. 10262Use this option with caution. 10263 10264@item -p @var{program} 10265Use the program @var{program} as the compiler. Normally, the name 10266@file{gcc} is used. 10267 10268@item -q 10269Work quietly. Most warnings are suppressed. 10270 10271@item -v 10272Print the version number, just like @option{-v} for @code{gcc}. 10273@end table 10274 10275If you need special compiler options to compile one of your program's 10276source files, then you should generate that file's @samp{.X} file 10277specially, by running @code{gcc} on that source file with the 10278appropriate options and the option @option{-aux-info}. Then run 10279@code{protoize} on the entire set of files. @code{protoize} will use 10280the existing @samp{.X} file because it is newer than the source file. 10281For example: 10282 10283@example 10284gcc -Dfoo=bar file1.c -aux-info file1.X 10285protoize *.c 10286@end example 10287 10288@noindent 10289You need to include the special files along with the rest in the 10290@code{protoize} command, even though their @samp{.X} files already 10291exist, because otherwise they won't get converted. 10292 10293@xref{Protoize Caveats}, for more information on how to use 10294@code{protoize} successfully. 10295