invoke.texi revision 110611
1264790Sbapt@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2264790Sbapt@c 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 3264790Sbapt@c This is part of the GCC manual. 4264790Sbapt@c For copying conditions, see the file gcc.texi. 5264790Sbapt 6264790Sbapt@ignore 7264790Sbapt@c man begin COPYRIGHT 8264790SbaptCopyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 9264790Sbapt1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 10264790Sbapt 11264790SbaptPermission is granted to copy, distribute and/or modify this document 12264790Sbaptunder the terms of the GNU Free Documentation License, Version 1.1 or 13264790Sbaptany later version published by the Free Software Foundation; with the 14264790SbaptInvariant Sections being ``GNU General Public License'' and ``Funding 15264790SbaptFree Software'', the Front-Cover texts being (a) (see below), and with 16264790Sbaptthe Back-Cover Texts being (b) (see below). A copy of the license is 17264790Sbaptincluded in the gfdl(7) man page. 18264790Sbapt 19264790Sbapt(a) The FSF's Front-Cover Text is: 20264790Sbapt 21264790Sbapt A GNU Manual 22264790Sbapt 23264790Sbapt(b) The FSF's Back-Cover Text is: 24264790Sbapt 25264790Sbapt You have freedom to copy and modify this GNU Manual, like GNU 26264790Sbapt software. Copies published by the Free Software Foundation raise 27264790Sbapt funds for GNU development. 28264790Sbapt@c man end 29264790Sbapt@c Set file name and title for the man page. 30264790Sbapt@setfilename gcc 31264790Sbapt@settitle GNU project C and C++ compiler 32264790Sbapt@c man begin SYNOPSIS 33264790Sbaptgcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}] 34264790Sbapt [@option{-g}] [@option{-pg}] [@option{-O}@var{level}] 35264790Sbapt [@option{-W}@var{warn}@dots{}] [@option{-pedantic}] 36264790Sbapt [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}] 37264790Sbapt [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] 38264790Sbapt [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}] 39264790Sbapt [@option{-o} @var{outfile}] @var{infile}@dots{} 40264790Sbapt 41264790SbaptOnly the most useful options are listed here; see below for the 42264790Sbaptremainder. @samp{g++} accepts mostly the same options as @samp{gcc}. 43264790Sbapt@c man end 44264790Sbapt@c man begin SEEALSO 45264790Sbaptgpl(7), gfdl(7), fsf-funding(7), 46264790Sbaptcpp(1), gcov(1), g77(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) 47264790Sbaptand the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as}, 48264790Sbapt@file{ld}, @file{binutils} and @file{gdb}. 49264790Sbapt@c man end 50264790Sbapt@c man begin BUGS 51264790SbaptFor instructions on reporting bugs, see 52264790Sbapt@w{@uref{http://gcc.gnu.org/bugs.html}}. Use of the @command{gccbug} 53264790Sbaptscript to report bugs is recommended. 54264790Sbapt@c man end 55264790Sbapt@c man begin AUTHOR 56264790SbaptSee the Info entry for @command{gcc}, or 57264790Sbapt@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}}, 58264790Sbaptfor contributors to GCC@. 59264790Sbapt@c man end 60264790Sbapt@end ignore 61264790Sbapt 62264790Sbapt@node Invoking GCC 63264790Sbapt@chapter GCC Command Options 64264790Sbapt@cindex GCC command options 65264790Sbapt@cindex command options 66264790Sbapt@cindex options, GCC command 67264790Sbapt 68264790Sbapt@c man begin DESCRIPTION 69264790Sbapt 70264790SbaptWhen you invoke GCC, it normally does preprocessing, compilation, 71264790Sbaptassembly and linking. The ``overall options'' allow you to stop this 72264790Sbaptprocess at an intermediate stage. For example, the @option{-c} option 73264790Sbaptsays not to run the linker. Then the output consists of object files 74264790Sbaptoutput by the assembler. 75264790Sbapt 76264790SbaptOther options are passed on to one stage of processing. Some options 77264790Sbaptcontrol the preprocessor and others the compiler itself. Yet other 78264790Sbaptoptions control the assembler and linker; most of these are not 79264790Sbaptdocumented here, since you rarely need to use any of them. 80264790Sbapt 81264790Sbapt@cindex C compilation options 82264790SbaptMost of the command line options that you can use with GCC are useful 83264790Sbaptfor C programs; when an option is only useful with another language 84264790Sbapt(usually C++), the explanation says so explicitly. If the description 85264790Sbaptfor a particular option does not mention a source language, you can use 86264790Sbaptthat option with all supported languages. 87264790Sbapt 88264790Sbapt@cindex C++ compilation options 89264790Sbapt@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special 90264790Sbaptoptions for compiling C++ programs. 91264790Sbapt 92264790Sbapt@cindex grouping options 93264790Sbapt@cindex options, grouping 94264790SbaptThe @command{gcc} program accepts options and file names as operands. Many 95264790Sbaptoptions have multi-letter names; therefore multiple single-letter options 96264790Sbaptmay @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d 97264790Sbapt-r}}. 98264790Sbapt 99264790Sbapt@cindex order of options 100264790Sbapt@cindex options, order 101264790SbaptYou can mix options and other arguments. For the most part, the order 102264790Sbaptyou use doesn't matter. Order does matter when you use several options 103264790Sbaptof the same kind; for example, if you specify @option{-L} more than once, 104264790Sbaptthe directories are searched in the order specified. 105264790Sbapt 106264790SbaptMany options have long names starting with @samp{-f} or with 107264790Sbapt@samp{-W}---for example, @option{-fforce-mem}, 108264790Sbapt@option{-fstrength-reduce}, @option{-Wformat} and so on. Most of 109264790Sbaptthese have both positive and negative forms; the negative form of 110264790Sbapt@option{-ffoo} would be @option{-fno-foo}. This manual documents 111264790Sbaptonly one of these two forms, whichever one is not the default. 112264790Sbapt 113264790Sbapt@c man end 114264790Sbapt 115264790Sbapt@xref{Option Index}, for an index to GCC's options. 116264790Sbapt 117264790Sbapt@menu 118264790Sbapt* Option Summary:: Brief list of all options, without explanations. 119264790Sbapt* Overall Options:: Controlling the kind of output: 120264790Sbapt an executable, object files, assembler files, 121264790Sbapt or preprocessed source. 122264790Sbapt* Invoking G++:: Compiling C++ programs. 123264790Sbapt* C Dialect Options:: Controlling the variant of C language compiled. 124264790Sbapt* C++ Dialect Options:: Variations on C++. 125264790Sbapt* Objective-C Dialect Options:: Variations on Objective-C. 126264790Sbapt* Language Independent Options:: Controlling how diagnostics should be 127264790Sbapt formatted. 128264790Sbapt* Warning Options:: How picky should the compiler be? 129264790Sbapt* Debugging Options:: Symbol tables, measurements, and debugging dumps. 130264790Sbapt* Optimize Options:: How much optimization? 131264790Sbapt* Preprocessor Options:: Controlling header files and macro definitions. 132264790Sbapt Also, getting dependency information for Make. 133264790Sbapt* Assembler Options:: Passing options to the assembler. 134264790Sbapt* Link Options:: Specifying libraries and so on. 135264790Sbapt* Directory Options:: Where to find header files and libraries. 136264790Sbapt Where to find the compiler executable files. 137264790Sbapt* Spec Files:: How to pass switches to sub-processes. 138264790Sbapt* Target Options:: Running a cross-compiler, or an old version of GCC. 139264790Sbapt* Submodel Options:: Specifying minor hardware or convention variations, 140264790Sbapt such as 68010 vs 68020. 141264790Sbapt* Code Gen Options:: Specifying conventions for function calls, data layout 142264790Sbapt and register usage. 143264790Sbapt* Environment Variables:: Env vars that affect GCC. 144264790Sbapt* Running Protoize:: Automatically adding or removing function prototypes. 145264790Sbapt@end menu 146264790Sbapt 147264790Sbapt@c man begin OPTIONS 148264790Sbapt 149264790Sbapt@node Option Summary 150264790Sbapt@section Option Summary 151264790Sbapt 152264790SbaptHere is a summary of all the options, grouped by type. Explanations are 153264790Sbaptin the following sections. 154264790Sbapt 155264790Sbapt@table @emph 156264790Sbapt@item Overall Options 157264790Sbapt@xref{Overall Options,,Options Controlling the Kind of Output}. 158264790Sbapt@gccoptlist{ 159264790Sbapt-c -S -E -o @var{file} -pipe -pass-exit-codes -x @var{language} @gol 160264790Sbapt-v -### --help --target-help --version} 161264790Sbapt 162264790Sbapt@item C Language Options 163264790Sbapt@xref{C Dialect Options,,Options Controlling C Dialect}. 164264790Sbapt@gccoptlist{ 165264790Sbapt-ansi -std=@var{standard} -aux-info @var{filename} @gol 166264790Sbapt-fno-asm -fno-builtin -fno-builtin-@var{function} @gol 167264790Sbapt-fhosted -ffreestanding @gol 168264790Sbapt-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol 169264790Sbapt-fallow-single-precision -fcond-mismatch @gol 170264790Sbapt-fsigned-bitfields -fsigned-char @gol 171264790Sbapt-funsigned-bitfields -funsigned-char @gol 172264790Sbapt-fwritable-strings} 173264790Sbapt 174264790Sbapt@item C++ Language Options 175264790Sbapt@xref{C++ Dialect Options,,Options Controlling C++ Dialect}. 176264790Sbapt@gccoptlist{ 177264790Sbapt-fno-access-control -fcheck-new -fconserve-space @gol 178264790Sbapt-fno-const-strings -fdollars-in-identifiers @gol 179264790Sbapt-fno-elide-constructors @gol 180264790Sbapt-fno-enforce-eh-specs -fexternal-templates @gol 181264790Sbapt-falt-external-templates @gol 182264790Sbapt-ffor-scope -fno-for-scope -fno-gnu-keywords @gol 183264790Sbapt-fno-implicit-templates @gol 184264790Sbapt-fno-implicit-inline-templates @gol 185264790Sbapt-fno-implement-inlines -fms-extensions @gol 186264790Sbapt-fno-nonansi-builtins -fno-operator-names @gol 187264790Sbapt-fno-optional-diags -fpermissive @gol 188264790Sbapt-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol 189264790Sbapt-fuse-cxa-atexit -fvtable-gc -fno-weak -nostdinc++ @gol 190264790Sbapt-fno-default-inline -Wabi -Wctor-dtor-privacy @gol 191264790Sbapt-Wnon-virtual-dtor -Wreorder @gol 192264790Sbapt-Weffc++ -Wno-deprecated @gol 193264790Sbapt-Wno-non-template-friend -Wold-style-cast @gol 194264790Sbapt-Woverloaded-virtual -Wno-pmf-conversions @gol 195264790Sbapt-Wsign-promo -Wsynth} 196264790Sbapt 197264790Sbapt@item Objective-C Language Options 198264790Sbapt@xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}. 199264790Sbapt@gccoptlist{ 200264790Sbapt-fconstant-string-class=@var{class-name} @gol 201264790Sbapt-fgnu-runtime -fnext-runtime -gen-decls @gol 202264790Sbapt-Wno-protocol -Wselector} 203264790Sbapt 204264790Sbapt@item Language Independent Options 205264790Sbapt@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. 206264790Sbapt@gccoptlist{ 207264790Sbapt-fmessage-length=@var{n} @gol 208264790Sbapt-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}} 209264790Sbapt 210264790Sbapt@item Warning Options 211264790Sbapt@xref{Warning Options,,Options to Request or Suppress Warnings}. 212264790Sbapt@gccoptlist{ 213264790Sbapt-fsyntax-only -pedantic -pedantic-errors @gol 214264790Sbapt-w -W -Wall -Waggregate-return @gol 215264790Sbapt-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol 216264790Sbapt-Wconversion -Wno-deprecated-declarations @gol 217264790Sbapt-Wdisabled-optimization -Wdiv-by-zero -Werror @gol 218264790Sbapt-Wfloat-equal -Wformat -Wformat=2 @gol 219264790Sbapt-Wformat-nonliteral -Wformat-security @gol 220264790Sbapt-Wimplicit -Wimplicit-int @gol 221264790Sbapt-Wimplicit-function-declaration @gol 222264790Sbapt-Werror-implicit-function-declaration @gol 223264790Sbapt-Wimport -Winline @gol 224264790Sbapt-Wlarger-than-@var{len} -Wlong-long @gol 225264790Sbapt-Wmain -Wmissing-braces @gol 226264790Sbapt-Wmissing-format-attribute -Wmissing-noreturn @gol 227264790Sbapt-Wmultichar -Wno-format-extra-args -Wno-format-y2k @gol 228264790Sbapt-Wno-import -Wpacked -Wpadded @gol 229264790Sbapt-Wparentheses -Wpointer-arith -Wredundant-decls @gol 230264790Sbapt-Wreturn-type -Wsequence-point -Wshadow @gol 231264790Sbapt-Wsign-compare -Wswitch -Wsystem-headers @gol 232264790Sbapt-Wtrigraphs -Wundef -Wuninitialized @gol 233264790Sbapt-Wunknown-pragmas -Wunreachable-code @gol 234264790Sbapt-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol 235264790Sbapt-Wunused-value -Wunused-variable -Wwrite-strings} 236264790Sbapt 237264790Sbapt@item C-only Warning Options 238264790Sbapt@gccoptlist{ 239264790Sbapt-Wbad-function-cast -Wmissing-declarations @gol 240264790Sbapt-Wmissing-prototypes -Wnested-externs @gol 241264790Sbapt-Wstrict-prototypes -Wtraditional} 242264790Sbapt 243264790Sbapt@item Debugging Options 244264790Sbapt@xref{Debugging Options,,Options for Debugging Your Program or GCC}. 245264790Sbapt@gccoptlist{ 246264790Sbapt-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 247264790Sbapt-fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol 248264790Sbapt-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol 249264790Sbapt-fdump-tree-original@r{[}-@var{n}@r{]} -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol 250264790Sbapt-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol 251264790Sbapt-fmem-report -fpretend-float @gol 252264790Sbapt-fprofile-arcs -fsched-verbose=@var{n} @gol 253264790Sbapt-ftest-coverage -ftime-report @gol 254264790Sbapt-g -g@var{level} -gcoff -gdwarf -gdwarf-1 -gdwarf-1+ -gdwarf-2 @gol 255264790Sbapt-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol 256264790Sbapt-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol 257264790Sbapt-print-multi-directory -print-multi-lib @gol 258264790Sbapt-print-prog-name=@var{program} -print-search-dirs -Q @gol 259264790Sbapt-save-temps -time} 260264790Sbapt 261264790Sbapt@item Optimization Options 262264790Sbapt@xref{Optimize Options,,Options that Control Optimization}. 263264790Sbapt@gccoptlist{ 264264790Sbapt-falign-functions=@var{n} -falign-jumps=@var{n} @gol 265264790Sbapt-falign-labels=@var{n} -falign-loops=@var{n} @gol 266264790Sbapt-fbounds-check @gol 267264790Sbapt-fbranch-probabilities -fcaller-saves -fcprop-registers @gol 268264790Sbapt-fcse-follow-jumps -fcse-skip-blocks -fdata-sections @gol 269264790Sbapt-fdelayed-branch -fdelete-null-pointer-checks @gol 270264790Sbapt-fexpensive-optimizations -ffast-math -ffloat-store @gol 271264790Sbapt-fforce-addr -fforce-mem -ffunction-sections @gol 272264790Sbapt-fgcse -fgcse-lm -fgcse-sm @gol 273264790Sbapt-finline-functions -finline-limit=@var{n} -fkeep-inline-functions @gol 274264790Sbapt-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol 275264790Sbapt-fmove-all-movables -fno-branch-count-reg @gol 276264790Sbapt-fno-default-inline -fno-defer-pop @gol 277264790Sbapt-fno-function-cse -fno-guess-branch-probability @gol 278264790Sbapt-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol 279264790Sbapt-funsafe-math-optimizations -fno-trapping-math @gol 280264790Sbapt-fomit-frame-pointer -foptimize-register-move @gol 281264790Sbapt-foptimize-sibling-calls -fprefetch-loop-arrays @gol 282264790Sbapt-freduce-all-givs -fregmove -frename-registers @gol 283264790Sbapt-frerun-cse-after-loop -frerun-loop-opt @gol 284264790Sbapt-fschedule-insns -fschedule-insns2 @gol 285264790Sbapt-fno-sched-interblock -fno-sched-spec @gol 286264790Sbapt-fsched-spec-load -fsched-spec-load-dangerous @gol 287264790Sbapt-fsingle-precision-constant -fssa -fssa-ccp -fssa-dce @gol 288264790Sbapt-fstrength-reduce -fstrict-aliasing -fthread-jumps @gol 289264790Sbapt-ftrapv -funroll-all-loops -funroll-loops @gol 290264790Sbapt--param @var{name}=@var{value} 291264790Sbapt-O -O0 -O1 -O2 -O3 -Os} 292264790Sbapt 293264790Sbapt@item Preprocessor Options 294264790Sbapt@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 295264790Sbapt@gccoptlist{ 296264790Sbapt-$ -A@var{question}=@var{answer} -A-@var{question}@r{[}=@var{answer}@r{]} @gol 297264790Sbapt-C -dD -dI -dM -dN @gol 298264790Sbapt-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol 299264790Sbapt-idirafter @var{dir} @gol 300264790Sbapt-include @var{file} -imacros @var{file} @gol 301264790Sbapt-iprefix @var{file} -iwithprefix @var{dir} @gol 302264790Sbapt-iwithprefixbefore @var{dir} -isystem @var{dir} @gol 303264790Sbapt-M -MM -MF -MG -MP -MQ -MT -nostdinc -P -remap @gol 304264790Sbapt-trigraphs -undef -U@var{macro} -Wp,@var{option}} 305264790Sbapt 306264790Sbapt@item Assembler Option 307264790Sbapt@xref{Assembler Options,,Passing Options to the Assembler}. 308264790Sbapt@gccoptlist{ 309264790Sbapt-Wa,@var{option}} 310264790Sbapt 311264790Sbapt@item Linker Options 312264790Sbapt@xref{Link Options,,Options for Linking}. 313264790Sbapt@gccoptlist{ 314264790Sbapt@var{object-file-name} -l@var{library} @gol 315264790Sbapt-nostartfiles -nodefaultlibs -nostdlib @gol 316264790Sbapt-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol 317264790Sbapt-Wl,@var{option} -Xlinker @var{option} @gol 318264790Sbapt-u @var{symbol}} 319264790Sbapt 320264790Sbapt@item Directory Options 321264790Sbapt@xref{Directory Options,,Options for Directory Search}. 322264790Sbapt@gccoptlist{ 323264790Sbapt-B@var{prefix} -I@var{dir} -I- -L@var{dir} -specs=@var{file}} 324264790Sbapt 325264790Sbapt@item Target Options 326264790Sbapt@c I wrote this xref this way to avoid overfull hbox. -- rms 327264790Sbapt@xref{Target Options}. 328264790Sbapt@gccoptlist{ 329264790Sbapt-b @var{machine} -V @var{version}} 330264790Sbapt 331264790Sbapt@item Machine Dependent Options 332264790Sbapt@xref{Submodel Options,,Hardware Models and Configurations}. 333264790Sbapt 334264790Sbapt@emph{M680x0 Options} 335264790Sbapt@gccoptlist{ 336264790Sbapt-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 337264790Sbapt-m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol 338264790Sbapt-mfpa -mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol 339264790Sbapt-malign-int -mstrict-align} 340264790Sbapt 341264790Sbapt@emph{M68hc1x Options} 342264790Sbapt@gccoptlist{ 343264790Sbapt-m6811 -m6812 -m68hc11 -m68hc12 @gol 344264790Sbapt-mauto-incdec -mshort -msoft-reg-count=@var{count}} 345264790Sbapt 346264790Sbapt@emph{VAX Options} 347264790Sbapt@gccoptlist{ 348264790Sbapt-mg -mgnu -munix} 349264790Sbapt 350264790Sbapt@emph{SPARC Options} 351264790Sbapt@gccoptlist{ 352264790Sbapt-mcpu=@var{cpu-type} @gol 353264790Sbapt-mtune=@var{cpu-type} @gol 354264790Sbapt-mcmodel=@var{code-model} @gol 355264790Sbapt-m32 -m64 @gol 356264790Sbapt-mapp-regs -mbroken-saverestore -mcypress @gol 357264790Sbapt-mfaster-structs -mflat @gol 358264790Sbapt-mfpu -mhard-float -mhard-quad-float @gol 359264790Sbapt-mimpure-text -mlive-g0 -mno-app-regs @gol 360264790Sbapt-mno-faster-structs -mno-flat -mno-fpu @gol 361264790Sbapt-mno-impure-text -mno-stack-bias -mno-unaligned-doubles @gol 362264790Sbapt-msoft-float -msoft-quad-float -msparclite -mstack-bias @gol 363264790Sbapt-msupersparc -munaligned-doubles -mv8} 364264790Sbapt 365264790Sbapt@emph{Convex Options} 366264790Sbapt@gccoptlist{ 367264790Sbapt-mc1 -mc2 -mc32 -mc34 -mc38 @gol 368264790Sbapt-margcount -mnoargcount @gol 369264790Sbapt-mlong32 -mlong64 @gol 370264790Sbapt-mvolatile-cache -mvolatile-nocache} 371264790Sbapt 372264790Sbapt@emph{AMD29K Options} 373264790Sbapt@gccoptlist{ 374264790Sbapt-m29000 -m29050 -mbw -mnbw -mdw -mndw @gol 375264790Sbapt-mlarge -mnormal -msmall @gol 376264790Sbapt-mkernel-registers -mno-reuse-arg-regs @gol 377264790Sbapt-mno-stack-check -mno-storem-bug @gol 378264790Sbapt-mreuse-arg-regs -msoft-float -mstack-check @gol 379264790Sbapt-mstorem-bug -muser-registers} 380264790Sbapt 381264790Sbapt@emph{ARM Options} 382264790Sbapt@gccoptlist{ 383264790Sbapt-mapcs-frame -mno-apcs-frame @gol 384264790Sbapt-mapcs-26 -mapcs-32 @gol 385264790Sbapt-mapcs-stack-check -mno-apcs-stack-check @gol 386264790Sbapt-mapcs-float -mno-apcs-float @gol 387264790Sbapt-mapcs-reentrant -mno-apcs-reentrant @gol 388264790Sbapt-msched-prolog -mno-sched-prolog @gol 389264790Sbapt-mlittle-endian -mbig-endian -mwords-little-endian @gol 390264790Sbapt-malignment-traps -mno-alignment-traps @gol 391264790Sbapt-msoft-float -mhard-float -mfpe @gol 392264790Sbapt-mthumb-interwork -mno-thumb-interwork @gol 393264790Sbapt-mcpu=@var{name} -march=@var{name} -mfpe=@var{name} @gol 394264790Sbapt-mstructure-size-boundary=@var{n} @gol 395264790Sbapt-mbsd -mxopen -mno-symrename @gol 396264790Sbapt-mabort-on-noreturn @gol 397264790Sbapt-mlong-calls -mno-long-calls @gol 398264790Sbapt-msingle-pic-base -mno-single-pic-base @gol 399264790Sbapt-mpic-register=@var{reg} @gol 400264790Sbapt-mnop-fun-dllimport @gol 401264790Sbapt-mpoke-function-name @gol 402264790Sbapt-mthumb -marm @gol 403264790Sbapt-mtpcs-frame -mtpcs-leaf-frame @gol 404264790Sbapt-mcaller-super-interworking -mcallee-super-interworking } 405264790Sbapt 406264790Sbapt@emph{MN10200 Options} 407264790Sbapt@gccoptlist{ 408264790Sbapt-mrelax} 409264790Sbapt 410264790Sbapt@emph{MN10300 Options} 411264790Sbapt@gccoptlist{ 412264790Sbapt-mmult-bug -mno-mult-bug @gol 413264790Sbapt-mam33 -mno-am33 @gol 414264790Sbapt-mno-crt0 -mrelax} 415264790Sbapt 416264790Sbapt@emph{M32R/D Options} 417264790Sbapt@gccoptlist{ 418264790Sbapt-m32rx -m32r -mcode-model=@var{model-type} -msdata=@var{sdata-type} @gol 419264790Sbapt-G @var{num}} 420264790Sbapt 421264790Sbapt@emph{M88K Options} 422264790Sbapt@gccoptlist{ 423264790Sbapt-m88000 -m88100 -m88110 -mbig-pic @gol 424264790Sbapt-mcheck-zero-division -mhandle-large-shift @gol 425264790Sbapt-midentify-revision -mno-check-zero-division @gol 426264790Sbapt-mno-ocs-debug-info -mno-ocs-frame-position @gol 427264790Sbapt-mno-optimize-arg-area -mno-serialize-volatile @gol 428264790Sbapt-mno-underscores -mocs-debug-info @gol 429264790Sbapt-mocs-frame-position -moptimize-arg-area @gol 430264790Sbapt-mserialize-volatile -mshort-data-@var{num} -msvr3 @gol 431264790Sbapt-msvr4 -mtrap-large-shift -muse-div-instruction @gol 432264790Sbapt-mversion-03.00 -mwarn-passed-structs} 433264790Sbapt 434264790Sbapt@emph{RS/6000 and PowerPC Options} 435264790Sbapt@gccoptlist{ 436264790Sbapt-mcpu=@var{cpu-type} @gol 437264790Sbapt-mtune=@var{cpu-type} @gol 438264790Sbapt-mpower -mno-power -mpower2 -mno-power2 @gol 439264790Sbapt-mpowerpc -mpowerpc64 -mno-powerpc @gol 440264790Sbapt-maltivec -mno-altivec @gol 441264790Sbapt-mpowerpc-gpopt -mno-powerpc-gpopt @gol 442264790Sbapt-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 443264790Sbapt-mnew-mnemonics -mold-mnemonics @gol 444264790Sbapt-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 445264790Sbapt-m64 -m32 -mxl-call -mno-xl-call -mpe @gol 446264790Sbapt-msoft-float -mhard-float -mmultiple -mno-multiple @gol 447264790Sbapt-mstring -mno-string -mupdate -mno-update @gol 448264790Sbapt-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 449264790Sbapt-mstrict-align -mno-strict-align -mrelocatable @gol 450264790Sbapt-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 451264790Sbapt-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 452264790Sbapt-mcall-aix -mcall-sysv -mcall-netbsd @gol 453264790Sbapt-maix-struct-return -msvr4-struct-return @gol 454264790Sbapt-mabi=altivec -mabi=no-altivec @gol 455264790Sbapt-mprototype -mno-prototype @gol 456264790Sbapt-msim -mmvme -mads -myellowknife -memb -msdata @gol 457264790Sbapt-msdata=@var{opt} -mvxworks -G @var{num} -pthread} 458264790Sbapt 459264790Sbapt@emph{RT Options} 460264790Sbapt@gccoptlist{ 461264790Sbapt-mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs @gol 462264790Sbapt-mfull-fp-blocks -mhc-struct-return -min-line-mul @gol 463264790Sbapt-mminimum-fp-blocks -mnohc-struct-return} 464264790Sbapt 465264790Sbapt@emph{MIPS Options} 466264790Sbapt@gccoptlist{ 467264790Sbapt-mabicalls -march=@var{cpu-type} -mtune=@var{cpu=type} @gol 468264790Sbapt-mcpu=@var{cpu-type} -membedded-data -muninit-const-in-rodata @gol 469264790Sbapt-membedded-pic -mfp32 -mfp64 -mfused-madd -mno-fused-madd @gol 470264790Sbapt-mgas -mgp32 -mgp64 @gol 471264790Sbapt-mgpopt -mhalf-pic -mhard-float -mint64 -mips1 @gol 472264790Sbapt-mips2 -mips3 -mips4 -mlong64 -mlong32 -mlong-calls -mmemcpy @gol 473264790Sbapt-mmips-as -mmips-tfile -mno-abicalls @gol 474264790Sbapt-mno-embedded-data -mno-uninit-const-in-rodata @gol 475264790Sbapt-mno-embedded-pic -mno-gpopt -mno-long-calls @gol 476264790Sbapt-mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats @gol 477264790Sbapt-mrnames -msoft-float @gol 478264790Sbapt-m4650 -msingle-float -mmad @gol 479264790Sbapt-mstats -EL -EB -G @var{num} -nocpp @gol 480264790Sbapt-mabi=32 -mabi=n32 -mabi=64 -mabi=eabi @gol 481264790Sbapt-mfix7000 -mno-crt0 -mflush-func=@var{func} -mno-flush-func} 482264790Sbapt 483264790Sbapt@emph{i386 and x86-64 Options} 484264790Sbapt@gccoptlist{ 485264790Sbapt-mcpu=@var{cpu-type} -march=@var{cpu-type} -mfpmath=@var{unit} @gol 486264790Sbapt-masm=@var{dialect} -mno-fancy-math-387 @gol 487264790Sbapt-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol 488264790Sbapt-mno-wide-multiply -mrtd -malign-double @gol 489264790Sbapt-mpreferred-stack-boundary=@var{num} @gol 490264790Sbapt-mmmx -msse -msse2 -m3dnow @gol 491264790Sbapt-mthreads -mno-align-stringops -minline-all-stringops @gol 492264790Sbapt-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 493264790Sbapt-m96bit-long-double -mregparm=@var{num} -momit-leaf-frame-pointer @gol 494264790Sbapt-mno-red-zone@gol 495264790Sbapt-mcmodel=@var{code-model} @gol 496264790Sbapt-m32 -m64} 497264790Sbapt 498264790Sbapt@emph{HPPA Options} 499264790Sbapt@gccoptlist{ 500264790Sbapt-march=@var{architecture-type} @gol 501264790Sbapt-mbig-switch -mdisable-fpregs -mdisable-indexing @gol 502264790Sbapt-mfast-indirect-calls -mgas -mjump-in-delay @gol 503264790Sbapt-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol 504264790Sbapt-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 505264790Sbapt-mno-jump-in-delay -mno-long-load-store @gol 506264790Sbapt-mno-portable-runtime -mno-soft-float @gol 507264790Sbapt-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 508264790Sbapt-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 509264790Sbapt-mschedule=@var{cpu-type} -mspace-regs} 510264790Sbapt 511264790Sbapt@emph{Intel 960 Options} 512264790Sbapt@gccoptlist{ 513264790Sbapt-m@var{cpu-type} -masm-compat -mclean-linkage @gol 514264790Sbapt-mcode-align -mcomplex-addr -mleaf-procedures @gol 515264790Sbapt-mic-compat -mic2.0-compat -mic3.0-compat @gol 516264790Sbapt-mintel-asm -mno-clean-linkage -mno-code-align @gol 517264790Sbapt-mno-complex-addr -mno-leaf-procedures @gol 518264790Sbapt-mno-old-align -mno-strict-align -mno-tail-call @gol 519264790Sbapt-mnumerics -mold-align -msoft-float -mstrict-align @gol 520264790Sbapt-mtail-call} 521264790Sbapt 522264790Sbapt@emph{DEC Alpha Options} 523264790Sbapt@gccoptlist{ 524264790Sbapt-mno-fp-regs -msoft-float -malpha-as -mgas @gol 525264790Sbapt-mieee -mieee-with-inexact -mieee-conformant @gol 526264790Sbapt-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 527264790Sbapt-mtrap-precision=@var{mode} -mbuild-constants @gol 528264790Sbapt-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 529264790Sbapt-mbwx -mmax -mfix -mcix @gol 530264790Sbapt-mfloat-vax -mfloat-ieee @gol 531264790Sbapt-mexplicit-relocs -msmall-data -mlarge-data @gol 532264790Sbapt-mmemory-latency=@var{time}} 533264790Sbapt 534264790Sbapt@emph{DEC Alpha/VMS Options} 535264790Sbapt@gccoptlist{ 536264790Sbapt-mvms-return-codes} 537264790Sbapt 538264790Sbapt@emph{Clipper Options} 539264790Sbapt@gccoptlist{ 540264790Sbapt-mc300 -mc400} 541264790Sbapt 542264790Sbapt@emph{H8/300 Options} 543264790Sbapt@gccoptlist{ 544264790Sbapt-mrelax -mh -ms -mint32 -malign-300} 545264790Sbapt 546264790Sbapt@emph{SH Options} 547264790Sbapt@gccoptlist{ 548264790Sbapt-m1 -m2 -m3 -m3e @gol 549264790Sbapt-m4-nofpu -m4-single-only -m4-single -m4 @gol 550264790Sbapt-m5-64media -m5-64media-nofpu @gol 551264790Sbapt-m5-32media -m5-32media-nofpu @gol 552264790Sbapt-m5-compact -m5-compact-nofpu @gol 553264790Sbapt-mb -ml -mdalign -mrelax @gol 554264790Sbapt-mbigtable -mfmovd -mhitachi -mnomacsave @gol 555264790Sbapt-mieee -misize -mpadstruct -mspace @gol 556264790Sbapt-mprefergot -musermode} 557264790Sbapt 558@emph{System V Options} 559@gccoptlist{ 560-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 561 562@emph{ARC Options} 563@gccoptlist{ 564-EB -EL @gol 565-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol 566-mdata=@var{data-section} -mrodata=@var{readonly-data-section}} 567 568@emph{TMS320C3x/C4x Options} 569@gccoptlist{ 570-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol 571-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol 572-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol 573-mparallel-insns -mparallel-mpy -mpreserve-float} 574 575@emph{V850 Options} 576@gccoptlist{ 577-mlong-calls -mno-long-calls -mep -mno-ep @gol 578-mprolog-function -mno-prolog-function -mspace @gol 579-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 580-mv850 -mbig-switch} 581 582@emph{NS32K Options} 583@gccoptlist{ 584-m32032 -m32332 -m32532 -m32081 -m32381 @gol 585-mmult-add -mnomult-add -msoft-float -mrtd -mnortd @gol 586-mregparam -mnoregparam -msb -mnosb @gol 587-mbitfield -mnobitfield -mhimem -mnohimem} 588 589@emph{AVR Options} 590@gccoptlist{ 591-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol 592-mcall-prologues -mno-tablejump -mtiny-stack} 593 594@emph{MCore Options} 595@gccoptlist{ 596-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 597-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 598-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 599-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 600-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 601 602@emph{MMIX Options} 603@gccoptlist{ 604-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 605-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 606-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 607-mno-base-addresses} 608 609@emph{IA-64 Options} 610@gccoptlist{ 611-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 612-mvolatile-asm-stop -mb-step -mregister-names -mno-sdata @gol 613-mconstant-gp -mauto-pic -minline-divide-min-latency @gol 614-minline-divide-max-throughput -mno-dwarf2-asm @gol 615-mfixed-range=@var{register-range}} 616 617@emph{D30V Options} 618@gccoptlist{ 619-mextmem -mextmemory -monchip -mno-asm-optimize @gol 620-masm-optimize -mbranch-cost=@var{n} -mcond-exec=@var{n}} 621 622@emph{S/390 and zSeries Options} 623@gccoptlist{ 624-mhard-float -msoft-float -mbackchain -mno-backchain @gol 625-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 626-m64 -m31 -mdebug -mno-debug} 627 628@emph{CRIS Options} 629@gccoptlist{ 630-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 631-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 632-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 633-mstack-align -mdata-align -mconst-align @gol 634-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 635-melf -maout -melinux -mlinux -sim -sim2} 636 637@emph{PDP-11 Options} 638@gccoptlist{ 639-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 640-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 641-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 642-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 643-mbranch-expensive -mbranch-cheap @gol 644-msplit -mno-split -munix-asm -mdec-asm} 645 646@emph{Xstormy16 Options} 647@gccoptlist{ 648-msim} 649 650@emph{Xtensa Options} 651@gccoptlist{ 652-mbig-endian -mlittle-endian @gol 653-mdensity -mno-density @gol 654-mmac16 -mno-mac16 @gol 655-mmul16 -mno-mul16 @gol 656-mmul32 -mno-mul32 @gol 657-mnsa -mno-nsa @gol 658-mminmax -mno-minmax @gol 659-msext -mno-sext @gol 660-mbooleans -mno-booleans @gol 661-mhard-float -msoft-float @gol 662-mfused-madd -mno-fused-madd @gol 663-mserialize-volatile -mno-serialize-volatile @gol 664-mtext-section-literals -mno-text-section-literals @gol 665-mtarget-align -mno-target-align @gol 666-mlongcalls -mno-longcalls} 667 668@item Code Generation Options 669@xref{Code Gen Options,,Options for Code Generation Conventions}. 670@gccoptlist{ 671-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 672-ffixed-@var{reg} -fexceptions @gol 673-fnon-call-exceptions -funwind-tables @gol 674-fasynchronous-unwind-tables @gol 675-finhibit-size-directive -finstrument-functions @gol 676-fno-common -fno-ident -fno-gnu-linker @gol 677-fpcc-struct-return -fpic -fPIC @gol 678-freg-struct-return -fshared-data -fshort-enums @gol 679-fshort-double -fshort-wchar -fvolatile @gol 680-fvolatile-global -fvolatile-static @gol 681-fverbose-asm -fpack-struct -fstack-check @gol 682-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 683-fargument-alias -fargument-noalias @gol 684-fargument-noalias-global -fleading-underscore} 685@end table 686 687@menu 688* Overall Options:: Controlling the kind of output: 689 an executable, object files, assembler files, 690 or preprocessed source. 691* C Dialect Options:: Controlling the variant of C language compiled. 692* C++ Dialect Options:: Variations on C++. 693* Objective-C Dialect Options:: Variations on Objective-C. 694* Language Independent Options:: Controlling how diagnostics should be 695 formatted. 696* Warning Options:: How picky should the compiler be? 697* Debugging Options:: Symbol tables, measurements, and debugging dumps. 698* Optimize Options:: How much optimization? 699* Preprocessor Options:: Controlling header files and macro definitions. 700 Also, getting dependency information for Make. 701* Assembler Options:: Passing options to the assembler. 702* Link Options:: Specifying libraries and so on. 703* Directory Options:: Where to find header files and libraries. 704 Where to find the compiler executable files. 705* Spec Files:: How to pass switches to sub-processes. 706* Target Options:: Running a cross-compiler, or an old version of GCC. 707@end menu 708 709@node Overall Options 710@section Options Controlling the Kind of Output 711 712Compilation can involve up to four stages: preprocessing, compilation 713proper, assembly and linking, always in that order. The first three 714stages apply to an individual source file, and end by producing an 715object file; linking combines all the object files (those newly 716compiled, and those specified as input) into an executable file. 717 718@cindex file name suffix 719For any given input file, the file name suffix determines what kind of 720compilation is done: 721 722@table @gcctabopt 723@item @var{file}.c 724C source code which must be preprocessed. 725 726@item @var{file}.i 727C source code which should not be preprocessed. 728 729@item @var{file}.ii 730C++ source code which should not be preprocessed. 731 732@item @var{file}.m 733Objective-C source code. Note that you must link with the library 734@file{libobjc.a} to make an Objective-C program work. 735 736@item @var{file}.mi 737Objective-C source code which should not be preprocessed. 738 739@item @var{file}.h 740C header file (not to be compiled or linked). 741 742@item @var{file}.cc 743@itemx @var{file}.cp 744@itemx @var{file}.cxx 745@itemx @var{file}.cpp 746@itemx @var{file}.c++ 747@itemx @var{file}.C 748C++ source code which must be preprocessed. Note that in @samp{.cxx}, 749the last two letters must both be literally @samp{x}. Likewise, 750@samp{.C} refers to a literal capital C@. 751 752@item @var{file}.f 753@itemx @var{file}.for 754@itemx @var{file}.FOR 755Fortran source code which should not be preprocessed. 756 757@item @var{file}.F 758@itemx @var{file}.fpp 759@itemx @var{file}.FPP 760Fortran source code which must be preprocessed (with the traditional 761preprocessor). 762 763@item @var{file}.r 764Fortran source code which must be preprocessed with a RATFOR 765preprocessor (not included with GCC)@. 766 767@xref{Overall Options,,Options Controlling the Kind of Output, g77, 768Using and Porting GNU Fortran}, for more details of the handling of 769Fortran input files. 770 771@c FIXME: Descriptions of Java file types. 772@c @var{file}.java 773@c @var{file}.class 774@c @var{file}.zip 775@c @var{file}.jar 776 777@item @var{file}.ads 778Ada source code file which contains a library unit declaration (a 779declaration of a package, subprogram, or generic, or a generic 780instantiation), or a library unit renaming declaration (a package, 781generic, or subprogram renaming declaration). Such files are also 782called @dfn{specs}. 783 784@itemx @var{file}.adb 785Ada source code file containing a library unit body (a subprogram or 786package body). Such files are also called @dfn{bodies}. 787 788@c GCC also knows about some suffixes for languages not yet included: 789@c Pascal: 790@c @var{file}.p 791@c @var{file}.pas 792 793@item @var{file}.s 794Assembler code. 795 796@item @var{file}.S 797Assembler code which must be preprocessed. 798 799@item @var{other} 800An object file to be fed straight into linking. 801Any file name with no recognized suffix is treated this way. 802@end table 803 804@opindex x 805You can specify the input language explicitly with the @option{-x} option: 806 807@table @gcctabopt 808@item -x @var{language} 809Specify explicitly the @var{language} for the following input files 810(rather than letting the compiler choose a default based on the file 811name suffix). This option applies to all following input files until 812the next @option{-x} option. Possible values for @var{language} are: 813@example 814c c-header cpp-output 815c++ c++-cpp-output 816objective-c objc-cpp-output 817assembler assembler-with-cpp 818ada 819f77 f77-cpp-input ratfor 820java 821@end example 822 823@item -x none 824Turn off any specification of a language, so that subsequent files are 825handled according to their file name suffixes (as they are if @option{-x} 826has not been used at all). 827 828@item -pass-exit-codes 829@opindex pass-exit-codes 830Normally the @command{gcc} program will exit with the code of 1 if any 831phase of the compiler returns a non-success return code. If you specify 832@option{-pass-exit-codes}, the @command{gcc} program will instead return with 833numerically highest error produced by any phase that returned an error 834indication. 835@end table 836 837If you only want some of the stages of compilation, you can use 838@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 839one of the options @option{-c}, @option{-S}, or @option{-E} to say where 840@command{gcc} is to stop. Note that some combinations (for example, 841@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 842 843@table @gcctabopt 844@item -c 845@opindex c 846Compile or assemble the source files, but do not link. The linking 847stage simply is not done. The ultimate output is in the form of an 848object file for each source file. 849 850By default, the object file name for a source file is made by replacing 851the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 852 853Unrecognized input files, not requiring compilation or assembly, are 854ignored. 855 856@item -S 857@opindex S 858Stop after the stage of compilation proper; do not assemble. The output 859is in the form of an assembler code file for each non-assembler input 860file specified. 861 862By default, the assembler file name for a source file is made by 863replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 864 865Input files that don't require compilation are ignored. 866 867@item -E 868@opindex E 869Stop after the preprocessing stage; do not run the compiler proper. The 870output is in the form of preprocessed source code, which is sent to the 871standard output. 872 873Input files which don't require preprocessing are ignored. 874 875@cindex output file option 876@item -o @var{file} 877@opindex o 878Place output in file @var{file}. This applies regardless to whatever 879sort of output is being produced, whether it be an executable file, 880an object file, an assembler file or preprocessed C code. 881 882Since only one output file can be specified, it does not make sense to 883use @option{-o} when compiling more than one input file, unless you are 884producing an executable file as output. 885 886If @option{-o} is not specified, the default is to put an executable file 887in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in 888@file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and 889all preprocessed C source on standard output. 890 891@item -v 892@opindex v 893Print (on standard error output) the commands executed to run the stages 894of compilation. Also print the version number of the compiler driver 895program and of the preprocessor and the compiler proper. 896 897@item -### 898@opindex ### 899Like @option{-v} except the commands are not executed and all command 900arguments are quoted. This is useful for shell scripts to capture the 901driver-generated command lines. 902 903@item -pipe 904@opindex pipe 905Use pipes rather than temporary files for communication between the 906various stages of compilation. This fails to work on some systems where 907the assembler is unable to read from a pipe; but the GNU assembler has 908no trouble. 909 910@item --help 911@opindex help 912Print (on the standard output) a description of the command line options 913understood by @command{gcc}. If the @option{-v} option is also specified 914then @option{--help} will also be passed on to the various processes 915invoked by @command{gcc}, so that they can display the command line options 916they accept. If the @option{-W} option is also specified then command 917line options which have no documentation associated with them will also 918be displayed. 919 920@item --target-help 921@opindex target-help 922Print (on the standard output) a description of target specific command 923line options for each tool. 924 925@item --version 926@opindex version 927Display the version number and copyrights of the invoked GCC. 928@end table 929 930@node Invoking G++ 931@section Compiling C++ Programs 932 933@cindex suffixes for C++ source 934@cindex C++ source file suffixes 935C++ source files conventionally use one of the suffixes @samp{.C}, 936@samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx}; 937preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 938files with these names and compiles them as C++ programs even if you 939call the compiler the same way as for compiling C programs (usually with 940the name @command{gcc}). 941 942@findex g++ 943@findex c++ 944However, C++ programs often require class libraries as well as a 945compiler that understands the C++ language---and under some 946circumstances, you might want to compile programs from standard input, 947or otherwise without a suffix that flags them as C++ programs. 948@command{g++} is a program that calls GCC with the default language 949set to C++, and automatically specifies linking against the C++ 950library. On many systems, @command{g++} is also 951installed with the name @command{c++}. 952 953@cindex invoking @command{g++} 954When you compile C++ programs, you may specify many of the same 955command-line options that you use for compiling programs in any 956language; or command-line options meaningful for C and related 957languages; or options that are meaningful only for C++ programs. 958@xref{C Dialect Options,,Options Controlling C Dialect}, for 959explanations of options for languages related to C@. 960@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 961explanations of options that are meaningful only for C++ programs. 962 963@node C Dialect Options 964@section Options Controlling C Dialect 965@cindex dialect options 966@cindex language dialect options 967@cindex options, dialect 968 969The following options control the dialect of C (or languages derived 970from C, such as C++ and Objective-C) that the compiler accepts: 971 972@table @gcctabopt 973@cindex ANSI support 974@cindex ISO support 975@item -ansi 976@opindex ansi 977In C mode, support all ISO C89 programs. In C++ mode, 978remove GNU extensions that conflict with ISO C++. 979 980This turns off certain features of GCC that are incompatible with ISO 981C89 (when compiling C code), or of standard C++ (when compiling C++ code), 982such as the @code{asm} and @code{typeof} keywords, and 983predefined macros such as @code{unix} and @code{vax} that identify the 984type of system you are using. It also enables the undesirable and 985rarely used ISO trigraph feature. For the C compiler, 986it disables recognition of C++ style @samp{//} comments as well as 987the @code{inline} keyword. 988 989The alternate keywords @code{__asm__}, @code{__extension__}, 990@code{__inline__} and @code{__typeof__} continue to work despite 991@option{-ansi}. You would not want to use them in an ISO C program, of 992course, but it is useful to put them in header files that might be included 993in compilations done with @option{-ansi}. Alternate predefined macros 994such as @code{__unix__} and @code{__vax__} are also available, with or 995without @option{-ansi}. 996 997The @option{-ansi} option does not cause non-ISO programs to be 998rejected gratuitously. For that, @option{-pedantic} is required in 999addition to @option{-ansi}. @xref{Warning Options}. 1000 1001The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 1002option is used. Some header files may notice this macro and refrain 1003from declaring certain functions or defining certain macros that the 1004ISO standard doesn't call for; this is to avoid interfering with any 1005programs that might use these names for other things. 1006 1007Functions which would normally be built in but do not have semantics 1008defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 1009functions with @option{-ansi} is used. @xref{Other Builtins,,Other 1010built-in functions provided by GCC}, for details of the functions 1011affected. 1012 1013@item -std= 1014@opindex std 1015Determine the language standard. This option is currently only 1016supported when compiling C@. A value for this option must be provided; 1017possible values are 1018 1019@table @samp 1020@item c89 1021@itemx iso9899:1990 1022ISO C89 (same as @option{-ansi}). 1023 1024@item iso9899:199409 1025ISO C89 as modified in amendment 1. 1026 1027@item c99 1028@itemx c9x 1029@itemx iso9899:1999 1030@itemx iso9899:199x 1031ISO C99. Note that this standard is not yet fully supported; see 1032@w{@uref{http://gcc.gnu.org/gcc-3.1/c99status.html}} for more information. The 1033names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1034 1035@item gnu89 1036Default, ISO C89 plus GNU extensions (including some C99 features). 1037 1038@item gnu99 1039@item gnu9x 1040ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, 1041this will become the default. The name @samp{gnu9x} is deprecated. 1042 1043@end table 1044 1045Even when this option is not specified, you can still use some of the 1046features of newer standards in so far as they do not conflict with 1047previous C standards. For example, you may use @code{__restrict__} even 1048when @option{-std=c99} is not specified. 1049 1050The @option{-std} options specifying some version of ISO C have the same 1051effects as @option{-ansi}, except that features that were not in ISO C89 1052but are in the specified version (for example, @samp{//} comments and 1053the @code{inline} keyword in ISO C99) are not disabled. 1054 1055@xref{Standards,,Language Standards Supported by GCC}, for details of 1056these standard versions. 1057 1058@item -aux-info @var{filename} 1059@opindex aux-info 1060Output to the given filename prototyped declarations for all functions 1061declared and/or defined in a translation unit, including those in header 1062files. This option is silently ignored in any language other than C@. 1063 1064Besides declarations, the file indicates, in comments, the origin of 1065each declaration (source file and line), whether the declaration was 1066implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 1067@samp{O} for old, respectively, in the first character after the line 1068number and the colon), and whether it came from a declaration or a 1069definition (@samp{C} or @samp{F}, respectively, in the following 1070character). In the case of function definitions, a K&R-style list of 1071arguments followed by their declarations is also provided, inside 1072comments, after the declaration. 1073 1074@item -fno-asm 1075@opindex fno-asm 1076Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 1077keyword, so that code can use these words as identifiers. You can use 1078the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 1079instead. @option{-ansi} implies @option{-fno-asm}. 1080 1081In C++, this switch only affects the @code{typeof} keyword, since 1082@code{asm} and @code{inline} are standard keywords. You may want to 1083use the @option{-fno-gnu-keywords} flag instead, which has the same 1084effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 1085switch only affects the @code{asm} and @code{typeof} keywords, since 1086@code{inline} is a standard keyword in ISO C99. 1087 1088@item -fno-builtin 1089@itemx -fno-builtin-@var{function} @r{(C and Objective-C only)} 1090@opindex fno-builtin 1091@cindex built-in functions 1092Don't recognize built-in functions that do not begin with 1093@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 1094functions provided by GCC}, for details of the functions affected, 1095including those which are not built-in functions when @option{-ansi} or 1096@option{-std} options for strict ISO C conformance are used because they 1097do not have an ISO standard meaning. 1098 1099GCC normally generates special code to handle certain built-in functions 1100more efficiently; for instance, calls to @code{alloca} may become single 1101instructions that adjust the stack directly, and calls to @code{memcpy} 1102may become inline copy loops. The resulting code is often both smaller 1103and faster, but since the function calls no longer appear as such, you 1104cannot set a breakpoint on those calls, nor can you change the behavior 1105of the functions by linking with a different library. 1106 1107In C++, @option{-fno-builtin} is always in effect. The @option{-fbuiltin} 1108option has no effect. Therefore, in C++, the only way to get the 1109optimization benefits of built-in functions is to call the function 1110using the @samp{__builtin_} prefix. The GNU C++ Standard Library uses 1111built-in functions to implement many functions (like 1112@code{std::strchr}), so that you automatically get efficient code. 1113 1114With the @option{-fno-builtin-@var{function}} option, not available 1115when compiling C++, only the built-in function @var{function} is 1116disabled. @var{function} must not begin with @samp{__builtin_}. If a 1117function is named this is not built-in in this version of GCC, this 1118option is ignored. There is no corresponding 1119@option{-fbuiltin-@var{function}} option; if you wish to enable 1120built-in functions selectively when using @option{-fno-builtin} or 1121@option{-ffreestanding}, you may define macros such as: 1122 1123@smallexample 1124#define abs(n) __builtin_abs ((n)) 1125#define strcpy(d, s) __builtin_strcpy ((d), (s)) 1126@end smallexample 1127 1128@item -fhosted 1129@opindex fhosted 1130@cindex hosted environment 1131 1132Assert that compilation takes place in a hosted environment. This implies 1133@option{-fbuiltin}. A hosted environment is one in which the 1134entire standard library is available, and in which @code{main} has a return 1135type of @code{int}. Examples are nearly everything except a kernel. 1136This is equivalent to @option{-fno-freestanding}. 1137 1138@item -ffreestanding 1139@opindex ffreestanding 1140@cindex hosted environment 1141 1142Assert that compilation takes place in a freestanding environment. This 1143implies @option{-fno-builtin}. A freestanding environment 1144is one in which the standard library may not exist, and program startup may 1145not necessarily be at @code{main}. The most obvious example is an OS kernel. 1146This is equivalent to @option{-fno-hosted}. 1147 1148@xref{Standards,,Language Standards Supported by GCC}, for details of 1149freestanding and hosted environments. 1150 1151@item -trigraphs 1152@opindex trigraphs 1153Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} 1154options for strict ISO C conformance) implies @option{-trigraphs}. 1155 1156@item -no-integrated-cpp 1157@opindex no-integrated-cpp 1158Invoke the external cpp during compilation. The default is to use the 1159integrated cpp (internal cpp). This option also allows a 1160user-supplied cpp via the @option{-B} option. This flag is applicable 1161in both C and C++ modes. 1162 1163We do not guarantee to retain this option in future, and we may change 1164its semantics. 1165 1166@cindex traditional C language 1167@cindex C language, traditional 1168@item -traditional 1169@opindex traditional 1170Attempt to support some aspects of traditional C compilers. 1171Specifically: 1172 1173@itemize @bullet 1174@item 1175All @code{extern} declarations take effect globally even if they 1176are written inside of a function definition. This includes implicit 1177declarations of functions. 1178 1179@item 1180The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const} 1181and @code{volatile} are not recognized. (You can still use the 1182alternative keywords such as @code{__typeof__}, @code{__inline__}, and 1183so on.) 1184 1185@item 1186Comparisons between pointers and integers are always allowed. 1187 1188@item 1189Integer types @code{unsigned short} and @code{unsigned char} promote 1190to @code{unsigned int}. 1191 1192@item 1193Out-of-range floating point literals are not an error. 1194 1195@item 1196Certain constructs which ISO regards as a single invalid preprocessing 1197number, such as @samp{0xe-0xd}, are treated as expressions instead. 1198 1199@item 1200String ``constants'' are not necessarily constant; they are stored in 1201writable space, and identical looking constants are allocated 1202separately. (This is the same as the effect of 1203@option{-fwritable-strings}.) 1204 1205@cindex @code{longjmp} and automatic variables 1206@item 1207All automatic variables not declared @code{register} are preserved by 1208@code{longjmp}. Ordinarily, GNU C follows ISO C: automatic variables 1209not declared @code{volatile} may be clobbered. 1210 1211@item 1212@cindex @samp{\x} 1213@cindex @samp{\a} 1214@cindex escape sequences, traditional 1215The character escape sequences @samp{\x} and @samp{\a} evaluate as the 1216literal characters @samp{x} and @samp{a} respectively. Without 1217@w{@option{-traditional}}, @samp{\x} is a prefix for the hexadecimal 1218representation of a character, and @samp{\a} produces a bell. 1219@end itemize 1220 1221This option is deprecated and may be removed. 1222 1223You may wish to use @option{-fno-builtin} as well as @option{-traditional} 1224if your program uses names that are normally GNU C built-in functions for 1225other purposes of its own. 1226 1227You cannot use @option{-traditional} if you include any header files that 1228rely on ISO C features. Some vendors are starting to ship systems with 1229ISO C header files and you cannot use @option{-traditional} on such 1230systems to compile files that include any system headers. 1231 1232The @option{-traditional} option also enables @option{-traditional-cpp}. 1233 1234@item -traditional-cpp 1235@opindex traditional-cpp 1236Attempt to support some aspects of traditional C preprocessors. 1237See the GNU CPP manual for details. 1238 1239@item -fcond-mismatch 1240@opindex fcond-mismatch 1241Allow conditional expressions with mismatched types in the second and 1242third arguments. The value of such an expression is void. This option 1243is not supported for C++. 1244 1245@item -funsigned-char 1246@opindex funsigned-char 1247Let the type @code{char} be unsigned, like @code{unsigned char}. 1248 1249Each kind of machine has a default for what @code{char} should 1250be. It is either like @code{unsigned char} by default or like 1251@code{signed char} by default. 1252 1253Ideally, a portable program should always use @code{signed char} or 1254@code{unsigned char} when it depends on the signedness of an object. 1255But many programs have been written to use plain @code{char} and 1256expect it to be signed, or expect it to be unsigned, depending on the 1257machines they were written for. This option, and its inverse, let you 1258make such a program work with the opposite default. 1259 1260The type @code{char} is always a distinct type from each of 1261@code{signed char} or @code{unsigned char}, even though its behavior 1262is always just like one of those two. 1263 1264@item -fsigned-char 1265@opindex fsigned-char 1266Let the type @code{char} be signed, like @code{signed char}. 1267 1268Note that this is equivalent to @option{-fno-unsigned-char}, which is 1269the negative form of @option{-funsigned-char}. Likewise, the option 1270@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 1271 1272@item -fsigned-bitfields 1273@itemx -funsigned-bitfields 1274@itemx -fno-signed-bitfields 1275@itemx -fno-unsigned-bitfields 1276@opindex fsigned-bitfields 1277@opindex funsigned-bitfields 1278@opindex fno-signed-bitfields 1279@opindex fno-unsigned-bitfields 1280These options control whether a bit-field is signed or unsigned, when the 1281declaration does not use either @code{signed} or @code{unsigned}. By 1282default, such a bit-field is signed, because this is consistent: the 1283basic integer types such as @code{int} are signed types. 1284 1285However, when @option{-traditional} is used, bit-fields are all unsigned 1286no matter what. 1287 1288@item -fwritable-strings 1289@opindex fwritable-strings 1290Store string constants in the writable data segment and don't uniquize 1291them. This is for compatibility with old programs which assume they can 1292write into string constants. The option @option{-traditional} also has 1293this effect. 1294 1295Writing into string constants is a very bad idea; ``constants'' should 1296be constant. 1297 1298@item -fallow-single-precision 1299@opindex fallow-single-precision 1300Do not promote single precision math operations to double precision, 1301even when compiling with @option{-traditional}. 1302 1303Traditional K&R C promotes all floating point operations to double 1304precision, regardless of the sizes of the operands. On the 1305architecture for which you are compiling, single precision may be faster 1306than double precision. If you must use @option{-traditional}, but want 1307to use single precision operations when the operands are single 1308precision, use this option. This option has no effect when compiling 1309with ISO or GNU C conventions (the default). 1310@end table 1311 1312@node C++ Dialect Options 1313@section Options Controlling C++ Dialect 1314 1315@cindex compiler options, C++ 1316@cindex C++ options, command line 1317@cindex options, C++ 1318This section describes the command-line options that are only meaningful 1319for C++ programs; but you can also use most of the GNU compiler options 1320regardless of what language your program is in. For example, you 1321might compile a file @code{firstClass.C} like this: 1322 1323@example 1324g++ -g -frepo -O -c firstClass.C 1325@end example 1326 1327@noindent 1328In this example, only @option{-frepo} is an option meant 1329only for C++ programs; you can use the other options with any 1330language supported by GCC@. 1331 1332Here is a list of options that are @emph{only} for compiling C++ programs: 1333 1334@table @gcctabopt 1335@item -fno-access-control 1336@opindex fno-access-control 1337Turn off all access checking. This switch is mainly useful for working 1338around bugs in the access control code. 1339 1340@item -fcheck-new 1341@opindex fcheck-new 1342Check that the pointer returned by @code{operator new} is non-null 1343before attempting to modify the storage allocated. The current Working 1344Paper requires that @code{operator new} never return a null pointer, so 1345this check is normally unnecessary. 1346 1347An alternative to using this option is to specify that your 1348@code{operator new} does not throw any exceptions; if you declare it 1349@samp{throw()}, G++ will check the return value. See also @samp{new 1350(nothrow)}. 1351 1352@item -fconserve-space 1353@opindex fconserve-space 1354Put uninitialized or runtime-initialized global variables into the 1355common segment, as C does. This saves space in the executable at the 1356cost of not diagnosing duplicate definitions. If you compile with this 1357flag and your program mysteriously crashes after @code{main()} has 1358completed, you may have an object that is being destroyed twice because 1359two definitions were merged. 1360 1361This option is no longer useful on most targets, now that support has 1362been added for putting variables into BSS without making them common. 1363 1364@item -fno-const-strings 1365@opindex fno-const-strings 1366Give string constants type @code{char *} instead of type @code{const 1367char *}. By default, G++ uses type @code{const char *} as required by 1368the standard. Even if you use @option{-fno-const-strings}, you cannot 1369actually modify the value of a string constant, unless you also use 1370@option{-fwritable-strings}. 1371 1372This option might be removed in a future release of G++. For maximum 1373portability, you should structure your code so that it works with 1374string constants that have type @code{const char *}. 1375 1376@item -fdollars-in-identifiers 1377@opindex fdollars-in-identifiers 1378Accept @samp{$} in identifiers. You can also explicitly prohibit use of 1379@samp{$} with the option @option{-fno-dollars-in-identifiers}. (GNU C allows 1380@samp{$} by default on most target systems, but there are a few exceptions.) 1381Traditional C allowed the character @samp{$} to form part of 1382identifiers. However, ISO C and C++ forbid @samp{$} in identifiers. 1383 1384@item -fno-elide-constructors 1385@opindex fno-elide-constructors 1386The C++ standard allows an implementation to omit creating a temporary 1387which is only used to initialize another object of the same type. 1388Specifying this option disables that optimization, and forces G++ to 1389call the copy constructor in all cases. 1390 1391@item -fno-enforce-eh-specs 1392@opindex fno-enforce-eh-specs 1393Don't check for violation of exception specifications at runtime. This 1394option violates the C++ standard, but may be useful for reducing code 1395size in production builds, much like defining @samp{NDEBUG}. The compiler 1396will still optimize based on the exception specifications. 1397 1398@item -fexternal-templates 1399@opindex fexternal-templates 1400 1401Cause @samp{#pragma interface} and @samp{implementation} to apply to 1402template instantiation; template instances are emitted or not according 1403to the location of the template definition. @xref{Template 1404Instantiation}, for more information. 1405 1406This option is deprecated. 1407 1408@item -falt-external-templates 1409@opindex falt-external-templates 1410Similar to @option{-fexternal-templates}, but template instances are 1411emitted or not according to the place where they are first instantiated. 1412@xref{Template Instantiation}, for more information. 1413 1414This option is deprecated. 1415 1416@item -ffor-scope 1417@itemx -fno-for-scope 1418@opindex ffor-scope 1419@opindex fno-for-scope 1420If @option{-ffor-scope} is specified, the scope of variables declared in 1421a @i{for-init-statement} is limited to the @samp{for} loop itself, 1422as specified by the C++ standard. 1423If @option{-fno-for-scope} is specified, the scope of variables declared in 1424a @i{for-init-statement} extends to the end of the enclosing scope, 1425as was the case in old versions of G++, and other (traditional) 1426implementations of C++. 1427 1428The default if neither flag is given to follow the standard, 1429but to allow and give a warning for old-style code that would 1430otherwise be invalid, or have different behavior. 1431 1432@item -fno-gnu-keywords 1433@opindex fno-gnu-keywords 1434Do not recognize @code{typeof} as a keyword, so that code can use this 1435word as an identifier. You can use the keyword @code{__typeof__} instead. 1436@option{-ansi} implies @option{-fno-gnu-keywords}. 1437 1438@item -fno-implicit-templates 1439@opindex fno-implicit-templates 1440Never emit code for non-inline templates which are instantiated 1441implicitly (i.e.@: by use); only emit code for explicit instantiations. 1442@xref{Template Instantiation}, for more information. 1443 1444@item -fno-implicit-inline-templates 1445@opindex fno-implicit-inline-templates 1446Don't emit code for implicit instantiations of inline templates, either. 1447The default is to handle inlines differently so that compiles with and 1448without optimization will need the same set of explicit instantiations. 1449 1450@item -fno-implement-inlines 1451@opindex fno-implement-inlines 1452To save space, do not emit out-of-line copies of inline functions 1453controlled by @samp{#pragma implementation}. This will cause linker 1454errors if these functions are not inlined everywhere they are called. 1455 1456@item -fms-extensions 1457@opindex fms-extensions 1458Disable pedantic warnings about constructs used in MFC, such as implicit 1459int and getting a pointer to member function via non-standard syntax. 1460 1461@item -fno-nonansi-builtins 1462@opindex fno-nonansi-builtins 1463Disable built-in declarations of functions that are not mandated by 1464ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 1465@code{index}, @code{bzero}, @code{conjf}, and other related functions. 1466 1467@item -fno-operator-names 1468@opindex fno-operator-names 1469Do not treat the operator name keywords @code{and}, @code{bitand}, 1470@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 1471synonyms as keywords. 1472 1473@item -fno-optional-diags 1474@opindex fno-optional-diags 1475Disable diagnostics that the standard says a compiler does not need to 1476issue. Currently, the only such diagnostic issued by G++ is the one for 1477a name having multiple meanings within a class. 1478 1479@item -fpermissive 1480@opindex fpermissive 1481Downgrade messages about nonconformant code from errors to warnings. By 1482default, G++ effectively sets @option{-pedantic-errors} without 1483@option{-pedantic}; this option reverses that. This behavior and this 1484option are superseded by @option{-pedantic}, which works as it does for GNU C@. 1485 1486@item -frepo 1487@opindex frepo 1488Enable automatic template instantiation at link time. This option also 1489implies @option{-fno-implicit-templates}. @xref{Template 1490Instantiation}, for more information. 1491 1492@item -fno-rtti 1493@opindex fno-rtti 1494Disable generation of information about every class with virtual 1495functions for use by the C++ runtime type identification features 1496(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts 1497of the language, you can save some space by using this flag. Note that 1498exception handling uses the same information, but it will generate it as 1499needed. 1500 1501@item -fstats 1502@opindex fstats 1503Emit statistics about front-end processing at the end of the compilation. 1504This information is generally only useful to the G++ development team. 1505 1506@item -ftemplate-depth-@var{n} 1507@opindex ftemplate-depth 1508Set the maximum instantiation depth for template classes to @var{n}. 1509A limit on the template instantiation depth is needed to detect 1510endless recursions during template class instantiation. ANSI/ISO C++ 1511conforming programs must not rely on a maximum depth greater than 17. 1512 1513@item -fuse-cxa-atexit 1514@opindex fuse-cxa-atexit 1515Register destructors for objects with static storage duration with the 1516@code{__cxa_atexit} function rather than the @code{atexit} function. 1517This option is required for fully standards-compliant handling of static 1518destructors, but will only work if your C library supports 1519@code{__cxa_atexit}. 1520 1521@item -fvtable-gc 1522@opindex fvtable-gc 1523Emit special relocations for vtables and virtual function references 1524so that the linker can identify unused virtual functions and zero out 1525vtable slots that refer to them. This is most useful with 1526@option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to 1527also discard the functions themselves. 1528 1529This optimization requires GNU as and GNU ld. Not all systems support 1530this option. @option{-Wl,--gc-sections} is ignored without @option{-static}. 1531 1532@item -fno-weak 1533@opindex fno-weak 1534Do not use weak symbol support, even if it is provided by the linker. 1535By default, G++ will use weak symbols if they are available. This 1536option exists only for testing, and should not be used by end-users; 1537it will result in inferior code and has no benefits. This option may 1538be removed in a future release of G++. 1539 1540@item -nostdinc++ 1541@opindex nostdinc++ 1542Do not search for header files in the standard directories specific to 1543C++, but do still search the other standard directories. (This option 1544is used when building the C++ library.) 1545@end table 1546 1547In addition, these optimization, warning, and code generation options 1548have meanings only for C++ programs: 1549 1550@table @gcctabopt 1551@item -fno-default-inline 1552@opindex fno-default-inline 1553Do not assume @samp{inline} for functions defined inside a class scope. 1554@xref{Optimize Options,,Options That Control Optimization}. Note that these 1555functions will have linkage like inline functions; they just won't be 1556inlined by default. 1557 1558@item -Wabi @r{(C++ only)} 1559@opindex Wabi 1560Warn when G++ generates code that is probably not compatible with the 1561vendor-neutral C++ ABI. Although an effort has been made to warn about 1562all such cases, there are probably some cases that are not warned about, 1563even though G++ is generating incompatible code. There may also be 1564cases where warnings are emitted even though the code that is generated 1565will be compatible. 1566 1567You should rewrite your code to avoid these warnings if you are 1568concerned about the fact that code generated by G++ may not be binary 1569compatible with code generated by other compilers. 1570 1571The known incompatibilites at this point include: 1572 1573@itemize @bullet 1574 1575@item 1576Incorrect handling of tail-padding for bit-fields. G++ may attempt to 1577pack data into the same byte as a base class. For example: 1578 1579@smallexample 1580struct A @{ virtual void f(); int f1 : 1; @}; 1581struct B : public A @{ int f2 : 1; @}; 1582@end smallexample 1583 1584@noindent 1585In this case, G++ will place @code{B::f2} into the same byte 1586as@code{A::f1}; other compilers will not. You can avoid this problem 1587by explicitly padding @code{A} so that its size is a multiple of the 1588byte size on your platform; that will cause G++ and other compilers to 1589layout @code{B} identically. 1590 1591@item 1592Incorrect handling of tail-padding for virtual bases. G++ does not use 1593tail padding when laying out virtual bases. For example: 1594 1595@smallexample 1596struct A @{ virtual void f(); char c1; @}; 1597struct B @{ B(); char c2; @}; 1598struct C : public A, public virtual B @{@}; 1599@end smallexample 1600 1601@noindent 1602In this case, G++ will not place @code{B} into the tail-padding for 1603@code{A}; other compilers will. You can avoid this problem by 1604explicitly padding @code{A} so that its size is a multiple of its 1605alignment (ignoring virtual base classes); that will cause G++ and other 1606compilers to layout @code{C} identically. 1607 1608@end itemize 1609 1610@item -Wctor-dtor-privacy @r{(C++ only)} 1611@opindex Wctor-dtor-privacy 1612Warn when a class seems unusable, because all the constructors or 1613destructors in a class are private and the class has no friends or 1614public static member functions. 1615 1616@item -Wnon-virtual-dtor @r{(C++ only)} 1617@opindex Wnon-virtual-dtor 1618Warn when a class declares a non-virtual destructor that should probably 1619be virtual, because it looks like the class will be used polymorphically. 1620 1621@item -Wreorder @r{(C++ only)} 1622@opindex Wreorder 1623@cindex reordering, warning 1624@cindex warning for reordering of member initializers 1625Warn when the order of member initializers given in the code does not 1626match the order in which they must be executed. For instance: 1627 1628@smallexample 1629struct A @{ 1630 int i; 1631 int j; 1632 A(): j (0), i (1) @{ @} 1633@}; 1634@end smallexample 1635 1636Here the compiler will warn that the member initializers for @samp{i} 1637and @samp{j} will be rearranged to match the declaration order of the 1638members. 1639@end table 1640 1641The following @option{-W@dots{}} options are not affected by @option{-Wall}. 1642 1643@table @gcctabopt 1644@item -Weffc++ @r{(C++ only)} 1645@opindex Weffc++ 1646Warn about violations of the following style guidelines from Scott Meyers' 1647@cite{Effective C++} book: 1648 1649@itemize @bullet 1650@item 1651Item 11: Define a copy constructor and an assignment operator for classes 1652with dynamically allocated memory. 1653 1654@item 1655Item 12: Prefer initialization to assignment in constructors. 1656 1657@item 1658Item 14: Make destructors virtual in base classes. 1659 1660@item 1661Item 15: Have @code{operator=} return a reference to @code{*this}. 1662 1663@item 1664Item 23: Don't try to return a reference when you must return an object. 1665 1666@end itemize 1667 1668and about violations of the following style guidelines from Scott Meyers' 1669@cite{More Effective C++} book: 1670 1671@itemize @bullet 1672@item 1673Item 6: Distinguish between prefix and postfix forms of increment and 1674decrement operators. 1675 1676@item 1677Item 7: Never overload @code{&&}, @code{||}, or @code{,}. 1678 1679@end itemize 1680 1681If you use this option, you should be aware that the standard library 1682headers do not obey all of these guidelines; you can use @samp{grep -v} 1683to filter out those warnings. 1684 1685@item -Wno-deprecated @r{(C++ only)} 1686@opindex Wno-deprecated 1687Do not warn about usage of deprecated features. @xref{Deprecated Features}. 1688 1689@item -Wno-non-template-friend @r{(C++ only)} 1690@opindex Wno-non-template-friend 1691Disable warnings when non-templatized friend functions are declared 1692within a template. With the advent of explicit template specification 1693support in G++, if the name of the friend is an unqualified-id (i.e., 1694@samp{friend foo(int)}), the C++ language specification demands that the 1695friend declare or define an ordinary, nontemplate function. (Section 169614.5.3). Before G++ implemented explicit specification, unqualified-ids 1697could be interpreted as a particular specialization of a templatized 1698function. Because this non-conforming behavior is no longer the default 1699behavior for G++, @option{-Wnon-template-friend} allows the compiler to 1700check existing code for potential trouble spots, and is on by default. 1701This new compiler behavior can be turned off with 1702@option{-Wno-non-template-friend} which keeps the conformant compiler code 1703but disables the helpful warning. 1704 1705@item -Wold-style-cast @r{(C++ only)} 1706@opindex Wold-style-cast 1707Warn if an old-style (C-style) cast to a non-void type is used within 1708a C++ program. The new-style casts (@samp{static_cast}, 1709@samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to 1710unintended effects, and much easier to grep for. 1711 1712@item -Woverloaded-virtual @r{(C++ only)} 1713@opindex Woverloaded-virtual 1714@cindex overloaded virtual fn, warning 1715@cindex warning for overloaded virtual fn 1716Warn when a function declaration hides virtual functions from a 1717base class. For example, in: 1718 1719@smallexample 1720struct A @{ 1721 virtual void f(); 1722@}; 1723 1724struct B: public A @{ 1725 void f(int); 1726@}; 1727@end smallexample 1728 1729the @code{A} class version of @code{f} is hidden in @code{B}, and code 1730like this: 1731 1732@smallexample 1733B* b; 1734b->f(); 1735@end smallexample 1736 1737will fail to compile. 1738 1739@item -Wno-pmf-conversions @r{(C++ only)} 1740@opindex Wno-pmf-conversions 1741Disable the diagnostic for converting a bound pointer to member function 1742to a plain pointer. 1743 1744@item -Wsign-promo @r{(C++ only)} 1745@opindex Wsign-promo 1746Warn when overload resolution chooses a promotion from unsigned or 1747enumeral type to a signed type over a conversion to an unsigned type of 1748the same size. Previous versions of G++ would try to preserve 1749unsignedness, but the standard mandates the current behavior. 1750 1751@item -Wsynth @r{(C++ only)} 1752@opindex Wsynth 1753@cindex warning for synthesized methods 1754@cindex synthesized methods, warning 1755Warn when G++'s synthesis behavior does not match that of cfront. For 1756instance: 1757 1758@smallexample 1759struct A @{ 1760 operator int (); 1761 A& operator = (int); 1762@}; 1763 1764main () 1765@{ 1766 A a,b; 1767 a = b; 1768@} 1769@end smallexample 1770 1771In this example, G++ will synthesize a default @samp{A& operator = 1772(const A&);}, while cfront will use the user-defined @samp{operator =}. 1773@end table 1774 1775@node Objective-C Dialect Options 1776@section Options Controlling Objective-C Dialect 1777 1778@cindex compiler options, Objective-C 1779@cindex Objective-C options, command line 1780@cindex options, Objective-C 1781This section describes the command-line options that are only meaningful 1782for Objective-C programs; but you can also use most of the GNU compiler 1783options regardless of what language your program is in. For example, 1784you might compile a file @code{some_class.m} like this: 1785 1786@example 1787gcc -g -fgnu-runtime -O -c some_class.m 1788@end example 1789 1790@noindent 1791In this example, only @option{-fgnu-runtime} is an option meant only for 1792Objective-C programs; you can use the other options with any language 1793supported by GCC@. 1794 1795Here is a list of options that are @emph{only} for compiling Objective-C 1796programs: 1797 1798@table @gcctabopt 1799@item -fconstant-string-class=@var{class-name} 1800@opindex fconstant-string-class 1801Use @var{class-name} as the name of the class to instantiate for each 1802literal string specified with the syntax @code{@@"@dots{}"}. The default 1803class name is @code{NXConstantString}. 1804 1805@item -fgnu-runtime 1806@opindex fgnu-runtime 1807Generate object code compatible with the standard GNU Objective-C 1808runtime. This is the default for most types of systems. 1809 1810@item -fnext-runtime 1811@opindex fnext-runtime 1812Generate output compatible with the NeXT runtime. This is the default 1813for NeXT-based systems, including Darwin and Mac OS X@. 1814 1815@item -gen-decls 1816@opindex gen-decls 1817Dump interface declarations for all classes seen in the source file to a 1818file named @file{@var{sourcename}.decl}. 1819 1820@item -Wno-protocol 1821@opindex Wno-protocol 1822Do not warn if methods required by a protocol are not implemented 1823in the class adopting it. 1824 1825@item -Wselector 1826@opindex Wselector 1827Warn if a selector has multiple methods of different types defined. 1828 1829@c not documented because only avail via -Wp 1830@c @item -print-objc-runtime-info 1831 1832@end table 1833 1834@node Language Independent Options 1835@section Options to Control Diagnostic Messages Formatting 1836@cindex options to control diagnostics formatting 1837@cindex diagnostic messages 1838@cindex message formatting 1839 1840Traditionally, diagnostic messages have been formatted irrespective of 1841the output device's aspect (e.g.@: its width, @dots{}). The options described 1842below can be used to control the diagnostic messages formatting 1843algorithm, e.g.@: how many characters per line, how often source location 1844information should be reported. Right now, only the C++ front end can 1845honor these options. However it is expected, in the near future, that 1846the remaining front ends would be able to digest them correctly. 1847 1848@table @gcctabopt 1849@item -fmessage-length=@var{n} 1850@opindex fmessage-length 1851Try to format error messages so that they fit on lines of about @var{n} 1852characters. The default is 72 characters for @command{g++} and 0 for the rest of 1853the front ends supported by GCC@. If @var{n} is zero, then no 1854line-wrapping will be done; each error message will appear on a single 1855line. 1856 1857@opindex fdiagnostics-show-location 1858@item -fdiagnostics-show-location=once 1859Only meaningful in line-wrapping mode. Instructs the diagnostic messages 1860reporter to emit @emph{once} source location information; that is, in 1861case the message is too long to fit on a single physical line and has to 1862be wrapped, the source location won't be emitted (as prefix) again, 1863over and over, in subsequent continuation lines. This is the default 1864behavior. 1865 1866@item -fdiagnostics-show-location=every-line 1867Only meaningful in line-wrapping mode. Instructs the diagnostic 1868messages reporter to emit the same source location information (as 1869prefix) for physical lines that result from the process of breaking 1870a message which is too long to fit on a single line. 1871 1872@end table 1873 1874@node Warning Options 1875@section Options to Request or Suppress Warnings 1876@cindex options to control warnings 1877@cindex warning messages 1878@cindex messages, warning 1879@cindex suppressing warnings 1880 1881Warnings are diagnostic messages that report constructions which 1882are not inherently erroneous but which are risky or suggest there 1883may have been an error. 1884 1885You can request many specific warnings with options beginning @samp{-W}, 1886for example @option{-Wimplicit} to request warnings on implicit 1887declarations. Each of these specific warning options also has a 1888negative form beginning @samp{-Wno-} to turn off warnings; 1889for example, @option{-Wno-implicit}. This manual lists only one of the 1890two forms, whichever is not the default. 1891 1892The following options control the amount and kinds of warnings produced 1893by GCC; for further, language-specific options also refer to 1894@ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}. 1895 1896@table @gcctabopt 1897@cindex syntax checking 1898@item -fsyntax-only 1899@opindex fsyntax-only 1900Check the code for syntax errors, but don't do anything beyond that. 1901 1902@item -pedantic 1903@opindex pedantic 1904Issue all the warnings demanded by strict ISO C and ISO C++; 1905reject all programs that use forbidden extensions, and some other 1906programs that do not follow ISO C and ISO C++. For ISO C, follows the 1907version of the ISO C standard specified by any @option{-std} option used. 1908 1909Valid ISO C and ISO C++ programs should compile properly with or without 1910this option (though a rare few will require @option{-ansi} or a 1911@option{-std} option specifying the required version of ISO C)@. However, 1912without this option, certain GNU extensions and traditional C and C++ 1913features are supported as well. With this option, they are rejected. 1914 1915@option{-pedantic} does not cause warning messages for use of the 1916alternate keywords whose names begin and end with @samp{__}. Pedantic 1917warnings are also disabled in the expression that follows 1918@code{__extension__}. However, only system header files should use 1919these escape routes; application programs should avoid them. 1920@xref{Alternate Keywords}. 1921 1922Some users try to use @option{-pedantic} to check programs for strict ISO 1923C conformance. They soon find that it does not do quite what they want: 1924it finds some non-ISO practices, but not all---only those for which 1925ISO C @emph{requires} a diagnostic, and some others for which 1926diagnostics have been added. 1927 1928A feature to report any failure to conform to ISO C might be useful in 1929some instances, but would require considerable additional work and would 1930be quite different from @option{-pedantic}. We don't have plans to 1931support such a feature in the near future. 1932 1933Where the standard specified with @option{-std} represents a GNU 1934extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a 1935corresponding @dfn{base standard}, the version of ISO C on which the GNU 1936extended dialect is based. Warnings from @option{-pedantic} are given 1937where they are required by the base standard. (It would not make sense 1938for such warnings to be given only for features not in the specified GNU 1939C dialect, since by definition the GNU dialects of C include all 1940features the compiler supports with the given option, and there would be 1941nothing to warn about.) 1942 1943@item -pedantic-errors 1944@opindex pedantic-errors 1945Like @option{-pedantic}, except that errors are produced rather than 1946warnings. 1947 1948@item -w 1949@opindex w 1950Inhibit all warning messages. 1951 1952@item -Wno-import 1953@opindex Wno-import 1954Inhibit warning messages about the use of @samp{#import}. 1955 1956@item -Wchar-subscripts 1957@opindex Wchar-subscripts 1958Warn if an array subscript has type @code{char}. This is a common cause 1959of error, as programmers often forget that this type is signed on some 1960machines. 1961 1962@item -Wcomment 1963@opindex Wcomment 1964Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 1965comment, or whenever a Backslash-Newline appears in a @samp{//} comment. 1966 1967@item -Wformat 1968@opindex Wformat 1969Check calls to @code{printf} and @code{scanf}, etc., to make sure that 1970the arguments supplied have types appropriate to the format string 1971specified, and that the conversions specified in the format string make 1972sense. This includes standard functions, and others specified by format 1973attributes (@pxref{Function Attributes}), in the @code{printf}, 1974@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 1975not in the C standard) families. 1976 1977The formats are checked against the format features supported by GNU 1978libc version 2.2. These include all ISO C89 and C99 features, as well 1979as features from the Single Unix Specification and some BSD and GNU 1980extensions. Other library implementations may not support all these 1981features; GCC does not support warning about features that go beyond a 1982particular library's limitations. However, if @option{-pedantic} is used 1983with @option{-Wformat}, warnings will be given about format features not 1984in the selected standard version (but not for @code{strfmon} formats, 1985since those are not in any version of the C standard). @xref{C Dialect 1986Options,,Options Controlling C Dialect}. 1987 1988@option{-Wformat} is included in @option{-Wall}. For more control over some 1989aspects of format checking, the options @option{-Wno-format-y2k}, 1990@option{-Wno-format-extra-args}, @option{-Wformat-nonliteral}, 1991@option{-Wformat-security} and @option{-Wformat=2} are available, but are 1992not included in @option{-Wall}. 1993 1994@item -Wno-format-y2k 1995@opindex Wno-format-y2k 1996If @option{-Wformat} is specified, do not warn about @code{strftime} 1997formats which may yield only a two-digit year. 1998 1999@item -Wno-format-extra-args 2000@opindex Wno-format-extra-args 2001If @option{-Wformat} is specified, do not warn about excess arguments to a 2002@code{printf} or @code{scanf} format function. The C standard specifies 2003that such arguments are ignored. 2004 2005Where the unused arguments lie between used arguments that are 2006specified with @samp{$} operand number specifications, normally 2007warnings are still given, since the implementation could not know what 2008type to pass to @code{va_arg} to skip the unused arguments. However, 2009in the case of @code{scanf} formats, this option will suppress the 2010warning if the unused arguments are all pointers, since the Single 2011Unix Specification says that such unused arguments are allowed. 2012 2013@item -Wformat-nonliteral 2014@opindex Wformat-nonliteral 2015If @option{-Wformat} is specified, also warn if the format string is not a 2016string literal and so cannot be checked, unless the format function 2017takes its format arguments as a @code{va_list}. 2018 2019@item -Wformat-security 2020@opindex Wformat-security 2021If @option{-Wformat} is specified, also warn about uses of format 2022functions that represent possible security problems. At present, this 2023warns about calls to @code{printf} and @code{scanf} functions where the 2024format string is not a string literal and there are no format arguments, 2025as in @code{printf (foo);}. This may be a security hole if the format 2026string came from untrusted input and contains @samp{%n}. (This is 2027currently a subset of what @option{-Wformat-nonliteral} warns about, but 2028in future warnings may be added to @option{-Wformat-security} that are not 2029included in @option{-Wformat-nonliteral}.) 2030 2031@item -Wformat=2 2032@opindex Wformat=2 2033Enable @option{-Wformat} plus format checks not included in 2034@option{-Wformat}. Currently equivalent to @samp{-Wformat 2035-Wformat-nonliteral -Wformat-security}. 2036 2037@item -Wimplicit-int 2038@opindex Wimplicit-int 2039Warn when a declaration does not specify a type. 2040 2041@item -Wimplicit-function-declaration 2042@itemx -Werror-implicit-function-declaration 2043@opindex Wimplicit-function-declaration 2044@opindex Werror-implicit-function-declaration 2045Give a warning (or error) whenever a function is used before being 2046declared. 2047 2048@item -Wimplicit 2049@opindex Wimplicit 2050Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 2051 2052@item -Wmain 2053@opindex Wmain 2054Warn if the type of @samp{main} is suspicious. @samp{main} should be a 2055function with external linkage, returning int, taking either zero 2056arguments, two, or three arguments of appropriate types. 2057 2058@item -Wmissing-braces 2059@opindex Wmissing-braces 2060Warn if an aggregate or union initializer is not fully bracketed. In 2061the following example, the initializer for @samp{a} is not fully 2062bracketed, but that for @samp{b} is fully bracketed. 2063 2064@smallexample 2065int a[2][2] = @{ 0, 1, 2, 3 @}; 2066int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 2067@end smallexample 2068 2069@item -Wparentheses 2070@opindex Wparentheses 2071Warn if parentheses are omitted in certain contexts, such 2072as when there is an assignment in a context where a truth value 2073is expected, or when operators are nested whose precedence people 2074often get confused about. 2075 2076Also warn about constructions where there may be confusion to which 2077@code{if} statement an @code{else} branch belongs. Here is an example of 2078such a case: 2079 2080@smallexample 2081@group 2082@{ 2083 if (a) 2084 if (b) 2085 foo (); 2086 else 2087 bar (); 2088@} 2089@end group 2090@end smallexample 2091 2092In C, every @code{else} branch belongs to the innermost possible @code{if} 2093statement, which in this example is @code{if (b)}. This is often not 2094what the programmer expected, as illustrated in the above example by 2095indentation the programmer chose. When there is the potential for this 2096confusion, GCC will issue a warning when this flag is specified. 2097To eliminate the warning, add explicit braces around the innermost 2098@code{if} statement so there is no way the @code{else} could belong to 2099the enclosing @code{if}. The resulting code would look like this: 2100 2101@smallexample 2102@group 2103@{ 2104 if (a) 2105 @{ 2106 if (b) 2107 foo (); 2108 else 2109 bar (); 2110 @} 2111@} 2112@end group 2113@end smallexample 2114 2115@item -Wsequence-point 2116@opindex Wsequence-point 2117Warn about code that may have undefined semantics because of violations 2118of sequence point rules in the C standard. 2119 2120The C standard defines the order in which expressions in a C program are 2121evaluated in terms of @dfn{sequence points}, which represent a partial 2122ordering between the execution of parts of the program: those executed 2123before the sequence point, and those executed after it. These occur 2124after the evaluation of a full expression (one which is not part of a 2125larger expression), after the evaluation of the first operand of a 2126@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 2127function is called (but after the evaluation of its arguments and the 2128expression denoting the called function), and in certain other places. 2129Other than as expressed by the sequence point rules, the order of 2130evaluation of subexpressions of an expression is not specified. All 2131these rules describe only a partial order rather than a total order, 2132since, for example, if two functions are called within one expression 2133with no sequence point between them, the order in which the functions 2134are called is not specified. However, the standards committee have 2135ruled that function calls do not overlap. 2136 2137It is not specified when between sequence points modifications to the 2138values of objects take effect. Programs whose behavior depends on this 2139have undefined behavior; the C standard specifies that ``Between the 2140previous and next sequence point an object shall have its stored value 2141modified at most once by the evaluation of an expression. Furthermore, 2142the prior value shall be read only to determine the value to be 2143stored.''. If a program breaks these rules, the results on any 2144particular implementation are entirely unpredictable. 2145 2146Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 2147= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 2148diagnosed by this option, and it may give an occasional false positive 2149result, but in general it has been found fairly effective at detecting 2150this sort of problem in programs. 2151 2152The present implementation of this option only works for C programs. A 2153future implementation may also work for C++ programs. 2154 2155The C standard is worded confusingly, therefore there is some debate 2156over the precise meaning of the sequence point rules in subtle cases. 2157Links to discussions of the problem, including proposed formal 2158definitions, may be found on our readings page, at 2159@w{@uref{http://gcc.gnu.org/readings.html}}. 2160 2161@item -Wreturn-type 2162@opindex Wreturn-type 2163Warn whenever a function is defined with a return-type that defaults to 2164@code{int}. Also warn about any @code{return} statement with no 2165return-value in a function whose return-type is not @code{void}. 2166 2167For C++, a function without return type always produces a diagnostic 2168message, even when @option{-Wno-return-type} is specified. The only 2169exceptions are @samp{main} and functions defined in system headers. 2170 2171@item -Wswitch 2172@opindex Wswitch 2173Warn whenever a @code{switch} statement has an index of enumeral type 2174and lacks a @code{case} for one or more of the named codes of that 2175enumeration. (The presence of a @code{default} label prevents this 2176warning.) @code{case} labels outside the enumeration range also 2177provoke warnings when this option is used. 2178 2179@item -Wtrigraphs 2180@opindex Wtrigraphs 2181Warn if any trigraphs are encountered that might change the meaning of 2182the program (trigraphs within comments are not warned about). 2183 2184@item -Wunused-function 2185@opindex Wunused-function 2186Warn whenever a static function is declared but not defined or a 2187non\-inline static function is unused. 2188 2189@item -Wunused-label 2190@opindex Wunused-label 2191Warn whenever a label is declared but not used. 2192 2193To suppress this warning use the @samp{unused} attribute 2194(@pxref{Variable Attributes}). 2195 2196@item -Wunused-parameter 2197@opindex Wunused-parameter 2198Warn whenever a function parameter is unused aside from its declaration. 2199 2200To suppress this warning use the @samp{unused} attribute 2201(@pxref{Variable Attributes}). 2202 2203@item -Wunused-variable 2204@opindex Wunused-variable 2205Warn whenever a local variable or non-constant static variable is unused 2206aside from its declaration 2207 2208To suppress this warning use the @samp{unused} attribute 2209(@pxref{Variable Attributes}). 2210 2211@item -Wunused-value 2212@opindex Wunused-value 2213Warn whenever a statement computes a result that is explicitly not used. 2214 2215To suppress this warning cast the expression to @samp{void}. 2216 2217@item -Wunused 2218@opindex Wunused 2219All all the above @option{-Wunused} options combined. 2220 2221In order to get a warning about an unused function parameter, you must 2222either specify @samp{-W -Wunused} or separately specify 2223@option{-Wunused-parameter}. 2224 2225@item -Wuninitialized 2226@opindex Wuninitialized 2227Warn if an automatic variable is used without first being initialized or 2228if a variable may be clobbered by a @code{setjmp} call. 2229 2230These warnings are possible only in optimizing compilation, 2231because they require data flow information that is computed only 2232when optimizing. If you don't specify @option{-O}, you simply won't 2233get these warnings. 2234 2235These warnings occur only for variables that are candidates for 2236register allocation. Therefore, they do not occur for a variable that 2237is declared @code{volatile}, or whose address is taken, or whose size 2238is other than 1, 2, 4 or 8 bytes. Also, they do not occur for 2239structures, unions or arrays, even when they are in registers. 2240 2241Note that there may be no warning about a variable that is used only 2242to compute a value that itself is never used, because such 2243computations may be deleted by data flow analysis before the warnings 2244are printed. 2245 2246These warnings are made optional because GCC is not smart 2247enough to see all the reasons why the code might be correct 2248despite appearing to have an error. Here is one example of how 2249this can happen: 2250 2251@smallexample 2252@group 2253@{ 2254 int x; 2255 switch (y) 2256 @{ 2257 case 1: x = 1; 2258 break; 2259 case 2: x = 4; 2260 break; 2261 case 3: x = 5; 2262 @} 2263 foo (x); 2264@} 2265@end group 2266@end smallexample 2267 2268@noindent 2269If the value of @code{y} is always 1, 2 or 3, then @code{x} is 2270always initialized, but GCC doesn't know this. Here is 2271another common case: 2272 2273@smallexample 2274@{ 2275 int save_y; 2276 if (change_y) save_y = y, y = new_y; 2277 @dots{} 2278 if (change_y) y = save_y; 2279@} 2280@end smallexample 2281 2282@noindent 2283This has no bug because @code{save_y} is used only if it is set. 2284 2285@cindex @code{longjmp} warnings 2286This option also warns when a non-volatile automatic variable might be 2287changed by a call to @code{longjmp}. These warnings as well are possible 2288only in optimizing compilation. 2289 2290The compiler sees only the calls to @code{setjmp}. It cannot know 2291where @code{longjmp} will be called; in fact, a signal handler could 2292call it at any point in the code. As a result, you may get a warning 2293even when there is in fact no problem because @code{longjmp} cannot 2294in fact be called at the place which would cause a problem. 2295 2296Some spurious warnings can be avoided if you declare all the functions 2297you use that never return as @code{noreturn}. @xref{Function 2298Attributes}. 2299 2300@item -Wreorder @r{(C++ only)} 2301@opindex Wreorder 2302@cindex reordering, warning 2303@cindex warning for reordering of member initializers 2304Warn when the order of member initializers given in the code does not 2305match the order in which they must be executed. For instance: 2306 2307@item -Wunknown-pragmas 2308@opindex Wunknown-pragmas 2309@cindex warning for unknown pragmas 2310@cindex unknown pragmas, warning 2311@cindex pragmas, warning of unknown 2312Warn when a #pragma directive is encountered which is not understood by 2313GCC@. If this command line option is used, warnings will even be issued 2314for unknown pragmas in system header files. This is not the case if 2315the warnings were only enabled by the @option{-Wall} command line option. 2316 2317@item -Wall 2318@opindex Wall 2319All of the above @samp{-W} options combined. This enables all the 2320warnings about constructions that some users consider questionable, and 2321that are easy to avoid (or modify to prevent the warning), even in 2322conjunction with macros. 2323 2324@item -Wdiv-by-zero 2325@opindex Wno-div-by-zero 2326@opindex Wdiv-by-zero 2327Warn about compile-time integer division by zero. This is default. To 2328inhibit the warning messages, use @option{-Wno-div-by-zero}. Floating 2329point division by zero is not warned about, as it can be a legitimate 2330way of obtaining infinities and NaNs. 2331 2332@item -Wmultichar 2333@opindex Wno-multichar 2334@opindex Wmultichar 2335Warn if a multicharacter constant (@samp{'FOOF'}) is used. This is 2336default. To inhibit the warning messages, use @option{-Wno-multichar}. 2337Usually they indicate a typo in the user's code, as they have 2338implementation-defined values, and should not be used in portable code. 2339 2340@item -Wsystem-headers 2341@opindex Wsystem-headers 2342@cindex warnings from system headers 2343@cindex system headers, warnings from 2344Print warning messages for constructs found in system header files. 2345Warnings from system headers are normally suppressed, on the assumption 2346that they usually do not indicate real problems and would only make the 2347compiler output harder to read. Using this command line option tells 2348GCC to emit warnings from system headers as if they occurred in user 2349code. However, note that using @option{-Wall} in conjunction with this 2350option will @emph{not} warn about unknown pragmas in system 2351headers---for that, @option{-Wunknown-pragmas} must also be used. 2352@end table 2353 2354The following @option{-W@dots{}} options are not implied by @option{-Wall}. 2355Some of them warn about constructions that users generally do not 2356consider questionable, but which occasionally you might wish to check 2357for; others warn about constructions that are necessary or hard to avoid 2358in some cases, and there is no simple way to modify the code to suppress 2359the warning. 2360 2361@table @gcctabopt 2362@item -W 2363@opindex W 2364Print extra warning messages for these events: 2365 2366@itemize @bullet 2367@item 2368A function can return either with or without a value. (Falling 2369off the end of the function body is considered returning without 2370a value.) For example, this function would evoke such a 2371warning: 2372 2373@smallexample 2374@group 2375foo (a) 2376@{ 2377 if (a > 0) 2378 return a; 2379@} 2380@end group 2381@end smallexample 2382 2383@item 2384An expression-statement or the left-hand side of a comma expression 2385contains no side effects. 2386To suppress the warning, cast the unused expression to void. 2387For example, an expression such as @samp{x[i,j]} will cause a warning, 2388but @samp{x[(void)i,j]} will not. 2389 2390@item 2391An unsigned value is compared against zero with @samp{<} or @samp{<=}. 2392 2393@item 2394A comparison like @samp{x<=y<=z} appears; this is equivalent to 2395@samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from 2396that of ordinary mathematical notation. 2397 2398@item 2399Storage-class specifiers like @code{static} are not the first things in 2400a declaration. According to the C Standard, this usage is obsolescent. 2401 2402@item 2403The return type of a function has a type qualifier such as @code{const}. 2404Such a type qualifier has no effect, since the value returned by a 2405function is not an lvalue. (But don't warn about the GNU extension of 2406@code{volatile void} return types. That extension will be warned about 2407if @option{-pedantic} is specified.) 2408 2409@item 2410If @option{-Wall} or @option{-Wunused} is also specified, warn about unused 2411arguments. 2412 2413@item 2414A comparison between signed and unsigned values could produce an 2415incorrect result when the signed value is converted to unsigned. 2416(But don't warn if @option{-Wno-sign-compare} is also specified.) 2417 2418@item 2419An aggregate has a partly bracketed initializer. 2420For example, the following code would evoke such a warning, 2421because braces are missing around the initializer for @code{x.h}: 2422 2423@smallexample 2424struct s @{ int f, g; @}; 2425struct t @{ struct s h; int i; @}; 2426struct t x = @{ 1, 2, 3 @}; 2427@end smallexample 2428 2429@item 2430An aggregate has an initializer which does not initialize all members. 2431For example, the following code would cause such a warning, because 2432@code{x.h} would be implicitly initialized to zero: 2433 2434@smallexample 2435struct s @{ int f, g, h; @}; 2436struct s x = @{ 3, 4 @}; 2437@end smallexample 2438@end itemize 2439 2440@item -Wfloat-equal 2441@opindex Wfloat-equal 2442Warn if floating point values are used in equality comparisons. 2443 2444The idea behind this is that sometimes it is convenient (for the 2445programmer) to consider floating-point values as approximations to 2446infinitely precise real numbers. If you are doing this, then you need 2447to compute (by analysing the code, or in some other way) the maximum or 2448likely maximum error that the computation introduces, and allow for it 2449when performing comparisons (and when producing output, but that's a 2450different problem). In particular, instead of testing for equality, you 2451would check to see whether the two values have ranges that overlap; and 2452this is done with the relational operators, so equality comparisons are 2453probably mistaken. 2454 2455@item -Wtraditional @r{(C only)} 2456@opindex Wtraditional 2457Warn about certain constructs that behave differently in traditional and 2458ISO C@. Also warn about ISO C constructs that have no traditional C 2459equivalent, and/or problematic constructs which should be avoided. 2460 2461@itemize @bullet 2462@item 2463Macro parameters that appear within string literals in the macro body. 2464In traditional C macro replacement takes place within string literals, 2465but does not in ISO C@. 2466 2467@item 2468In traditional C, some preprocessor directives did not exist. 2469Traditional preprocessors would only consider a line to be a directive 2470if the @samp{#} appeared in column 1 on the line. Therefore 2471@option{-Wtraditional} warns about directives that traditional C 2472understands but would ignore because the @samp{#} does not appear as the 2473first character on the line. It also suggests you hide directives like 2474@samp{#pragma} not understood by traditional C by indenting them. Some 2475traditional implementations would not recognize @samp{#elif}, so it 2476suggests avoiding it altogether. 2477 2478@item 2479A function-like macro that appears without arguments. 2480 2481@item 2482The unary plus operator. 2483 2484@item 2485The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point 2486constant suffixes. (Traditional C does support the @samp{L} suffix on integer 2487constants.) Note, these suffixes appear in macros defined in the system 2488headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 2489Use of these macros in user code might normally lead to spurious 2490warnings, however gcc's integrated preprocessor has enough context to 2491avoid warning in these cases. 2492 2493@item 2494A function declared external in one block and then used after the end of 2495the block. 2496 2497@item 2498A @code{switch} statement has an operand of type @code{long}. 2499 2500@item 2501A non-@code{static} function declaration follows a @code{static} one. 2502This construct is not accepted by some traditional C compilers. 2503 2504@item 2505The ISO type of an integer constant has a different width or 2506signedness from its traditional type. This warning is only issued if 2507the base of the constant is ten. I.e.@: hexadecimal or octal values, which 2508typically represent bit patterns, are not warned about. 2509 2510@item 2511Usage of ISO string concatenation is detected. 2512 2513@item 2514Initialization of automatic aggregates. 2515 2516@item 2517Identifier conflicts with labels. Traditional C lacks a separate 2518namespace for labels. 2519 2520@item 2521Initialization of unions. If the initializer is zero, the warning is 2522omitted. This is done under the assumption that the zero initializer in 2523user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 2524initializer warnings and relies on default initialization to zero in the 2525traditional C case. 2526 2527@item 2528Conversions by prototypes between fixed/floating point values and vice 2529versa. The absence of these prototypes when compiling with traditional 2530C would cause serious problems. This is a subset of the possible 2531conversion warnings, for the full set use @option{-Wconversion}. 2532@end itemize 2533 2534@item -Wundef 2535@opindex Wundef 2536Warn if an undefined identifier is evaluated in an @samp{#if} directive. 2537 2538@item -Wshadow 2539@opindex Wshadow 2540Warn whenever a local variable shadows another local variable, parameter or 2541global variable or whenever a built-in function is shadowed. 2542 2543@item -Wlarger-than-@var{len} 2544@opindex Wlarger-than 2545Warn whenever an object of larger than @var{len} bytes is defined. 2546 2547@item -Wpointer-arith 2548@opindex Wpointer-arith 2549Warn about anything that depends on the ``size of'' a function type or 2550of @code{void}. GNU C assigns these types a size of 1, for 2551convenience in calculations with @code{void *} pointers and pointers 2552to functions. 2553 2554@item -Wbad-function-cast @r{(C only)} 2555@opindex Wbad-function-cast 2556Warn whenever a function call is cast to a non-matching type. 2557For example, warn if @code{int malloc()} is cast to @code{anything *}. 2558 2559@item -Wcast-qual 2560@opindex Wcast-qual 2561Warn whenever a pointer is cast so as to remove a type qualifier from 2562the target type. For example, warn if a @code{const char *} is cast 2563to an ordinary @code{char *}. 2564 2565@item -Wcast-align 2566@opindex Wcast-align 2567Warn whenever a pointer is cast such that the required alignment of the 2568target is increased. For example, warn if a @code{char *} is cast to 2569an @code{int *} on machines where integers can only be accessed at 2570two- or four-byte boundaries. 2571 2572@item -Wwrite-strings 2573@opindex Wwrite-strings 2574When compiling C, give string constants the type @code{const 2575char[@var{length}]} so that 2576copying the address of one into a non-@code{const} @code{char *} 2577pointer will get a warning; when compiling C++, warn about the 2578deprecated conversion from string constants to @code{char *}. 2579These warnings will help you find at 2580compile time code that can try to write into a string constant, but 2581only if you have been very careful about using @code{const} in 2582declarations and prototypes. Otherwise, it will just be a nuisance; 2583this is why we did not make @option{-Wall} request these warnings. 2584 2585@item -Wconversion 2586@opindex Wconversion 2587Warn if a prototype causes a type conversion that is different from what 2588would happen to the same argument in the absence of a prototype. This 2589includes conversions of fixed point to floating and vice versa, and 2590conversions changing the width or signedness of a fixed point argument 2591except when the same as the default promotion. 2592 2593Also, warn if a negative integer constant expression is implicitly 2594converted to an unsigned type. For example, warn about the assignment 2595@code{x = -1} if @code{x} is unsigned. But do not warn about explicit 2596casts like @code{(unsigned) -1}. 2597 2598@item -Wsign-compare 2599@opindex Wsign-compare 2600@cindex warning for comparison of signed and unsigned values 2601@cindex comparison of signed and unsigned values, warning 2602@cindex signed and unsigned values, comparison warning 2603Warn when a comparison between signed and unsigned values could produce 2604an incorrect result when the signed value is converted to unsigned. 2605This warning is also enabled by @option{-W}; to get the other warnings 2606of @option{-W} without this warning, use @samp{-W -Wno-sign-compare}. 2607 2608@item -Waggregate-return 2609@opindex Waggregate-return 2610Warn if any functions that return structures or unions are defined or 2611called. (In languages where you can return an array, this also elicits 2612a warning.) 2613 2614@item -Wstrict-prototypes @r{(C only)} 2615@opindex Wstrict-prototypes 2616Warn if a function is declared or defined without specifying the 2617argument types. (An old-style function definition is permitted without 2618a warning if preceded by a declaration which specifies the argument 2619types.) 2620 2621@item -Wmissing-prototypes @r{(C only)} 2622@opindex Wmissing-prototypes 2623Warn if a global function is defined without a previous prototype 2624declaration. This warning is issued even if the definition itself 2625provides a prototype. The aim is to detect global functions that fail 2626to be declared in header files. 2627 2628@item -Wmissing-declarations 2629@opindex Wmissing-declarations 2630Warn if a global function is defined without a previous declaration. 2631Do so even if the definition itself provides a prototype. 2632Use this option to detect global functions that are not declared in 2633header files. 2634 2635@item -Wmissing-noreturn 2636@opindex Wmissing-noreturn 2637Warn about functions which might be candidates for attribute @code{noreturn}. 2638Note these are only possible candidates, not absolute ones. Care should 2639be taken to manually verify functions actually do not ever return before 2640adding the @code{noreturn} attribute, otherwise subtle code generation 2641bugs could be introduced. You will not get a warning for @code{main} in 2642hosted C environments. 2643 2644@item -Wmissing-format-attribute 2645@opindex Wmissing-format-attribute 2646@opindex Wformat 2647If @option{-Wformat} is enabled, also warn about functions which might be 2648candidates for @code{format} attributes. Note these are only possible 2649candidates, not absolute ones. GCC will guess that @code{format} 2650attributes might be appropriate for any function that calls a function 2651like @code{vprintf} or @code{vscanf}, but this might not always be the 2652case, and some functions for which @code{format} attributes are 2653appropriate may not be detected. This option has no effect unless 2654@option{-Wformat} is enabled (possibly by @option{-Wall}). 2655 2656@item -Wno-deprecated-declarations 2657@opindex Wno-deprecated-declarations 2658Do not warn about uses of functions, variables, and types marked as 2659deprecated by using the @code{deprecated} attribute. 2660(@pxref{Function Attributes}, @pxref{Variable Attributes}, 2661@pxref{Type Attributes}.) 2662 2663@item -Wpacked 2664@opindex Wpacked 2665Warn if a structure is given the packed attribute, but the packed 2666attribute has no effect on the layout or size of the structure. 2667Such structures may be mis-aligned for little benefit. For 2668instance, in this code, the variable @code{f.x} in @code{struct bar} 2669will be misaligned even though @code{struct bar} does not itself 2670have the packed attribute: 2671 2672@smallexample 2673@group 2674struct foo @{ 2675 int x; 2676 char a, b, c, d; 2677@} __attribute__((packed)); 2678struct bar @{ 2679 char z; 2680 struct foo f; 2681@}; 2682@end group 2683@end smallexample 2684 2685@item -Wpadded 2686@opindex Wpadded 2687Warn if padding is included in a structure, either to align an element 2688of the structure or to align the whole structure. Sometimes when this 2689happens it is possible to rearrange the fields of the structure to 2690reduce the padding and so make the structure smaller. 2691 2692@item -Wredundant-decls 2693@opindex Wredundant-decls 2694Warn if anything is declared more than once in the same scope, even in 2695cases where multiple declaration is valid and changes nothing. 2696 2697@item -Wnested-externs @r{(C only)} 2698@opindex Wnested-externs 2699Warn if an @code{extern} declaration is encountered within a function. 2700 2701@item -Wunreachable-code 2702@opindex Wunreachable-code 2703Warn if the compiler detects that code will never be executed. 2704 2705This option is intended to warn when the compiler detects that at 2706least a whole line of source code will never be executed, because 2707some condition is never satisfied or because it is after a 2708procedure that never returns. 2709 2710It is possible for this option to produce a warning even though there 2711are circumstances under which part of the affected line can be executed, 2712so care should be taken when removing apparently-unreachable code. 2713 2714For instance, when a function is inlined, a warning may mean that the 2715line is unreachable in only one inlined copy of the function. 2716 2717This option is not made part of @option{-Wall} because in a debugging 2718version of a program there is often substantial code which checks 2719correct functioning of the program and is, hopefully, unreachable 2720because the program does work. Another common use of unreachable 2721code is to provide behavior which is selectable at compile-time. 2722 2723@item -Winline 2724@opindex Winline 2725Warn if a function can not be inlined and it was declared as inline. 2726 2727@item -Wlong-long 2728@opindex Wlong-long 2729@opindex Wno-long-long 2730Warn if @samp{long long} type is used. This is default. To inhibit 2731the warning messages, use @option{-Wno-long-long}. Flags 2732@option{-Wlong-long} and @option{-Wno-long-long} are taken into account 2733only when @option{-pedantic} flag is used. 2734 2735@item -Wdisabled-optimization 2736@opindex Wdisabled-optimization 2737Warn if a requested optimization pass is disabled. This warning does 2738not generally indicate that there is anything wrong with your code; it 2739merely indicates that GCC's optimizers were unable to handle the code 2740effectively. Often, the problem is that your code is too big or too 2741complex; GCC will refuse to optimize programs when the optimization 2742itself is likely to take inordinate amounts of time. 2743 2744@item -Werror 2745@opindex Werror 2746Make all warnings into errors. 2747@end table 2748 2749@node Debugging Options 2750@section Options for Debugging Your Program or GCC 2751@cindex options, debugging 2752@cindex debugging information options 2753 2754GCC has various special options that are used for debugging 2755either your program or GCC: 2756 2757@table @gcctabopt 2758@item -g 2759@opindex g 2760Produce debugging information in the operating system's native format 2761(stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging 2762information. 2763 2764On most systems that use stabs format, @option{-g} enables use of extra 2765debugging information that only GDB can use; this extra information 2766makes debugging work better in GDB but will probably make other debuggers 2767crash or 2768refuse to read the program. If you want to control for certain whether 2769to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 2770@option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, @option{-gdwarf-1}, 2771or @option{-gvms} (see below). 2772 2773Unlike most other C compilers, GCC allows you to use @option{-g} with 2774@option{-O}. The shortcuts taken by optimized code may occasionally 2775produce surprising results: some variables you declared may not exist 2776at all; flow of control may briefly move where you did not expect it; 2777some statements may not be executed because they compute constant 2778results or their values were already at hand; some statements may 2779execute in different places because they were moved out of loops. 2780 2781Nevertheless it proves possible to debug optimized output. This makes 2782it reasonable to use the optimizer for programs that might have bugs. 2783 2784The following options are useful when GCC is generated with the 2785capability for more than one debugging format. 2786 2787@item -ggdb 2788@opindex ggdb 2789Produce debugging information for use by GDB@. This means to use the 2790most expressive format available (DWARF 2, stabs, or the native format 2791if neither of those are supported), including GDB extensions if at all 2792possible. 2793 2794@item -gstabs 2795@opindex gstabs 2796Produce debugging information in stabs format (if that is supported), 2797without GDB extensions. This is the format used by DBX on most BSD 2798systems. On MIPS, Alpha and System V Release 4 systems this option 2799produces stabs debugging output which is not understood by DBX or SDB@. 2800On System V Release 4 systems this option requires the GNU assembler. 2801 2802@item -gstabs+ 2803@opindex gstabs+ 2804Produce debugging information in stabs format (if that is supported), 2805using GNU extensions understood only by the GNU debugger (GDB)@. The 2806use of these extensions is likely to make other debuggers crash or 2807refuse to read the program. 2808 2809@item -gcoff 2810@opindex gcoff 2811Produce debugging information in COFF format (if that is supported). 2812This is the format used by SDB on most System V systems prior to 2813System V Release 4. 2814 2815@item -gxcoff 2816@opindex gxcoff 2817Produce debugging information in XCOFF format (if that is supported). 2818This is the format used by the DBX debugger on IBM RS/6000 systems. 2819 2820@item -gxcoff+ 2821@opindex gxcoff+ 2822Produce debugging information in XCOFF format (if that is supported), 2823using GNU extensions understood only by the GNU debugger (GDB)@. The 2824use of these extensions is likely to make other debuggers crash or 2825refuse to read the program, and may cause assemblers other than the GNU 2826assembler (GAS) to fail with an error. 2827 2828@item -gdwarf 2829@opindex gdwarf 2830Produce debugging information in DWARF version 1 format (if that is 2831supported). This is the format used by SDB on most System V Release 4 2832systems. 2833 2834@item -gdwarf+ 2835@opindex gdwarf+ 2836Produce debugging information in DWARF version 1 format (if that is 2837supported), using GNU extensions understood only by the GNU debugger 2838(GDB)@. The use of these extensions is likely to make other debuggers 2839crash or refuse to read the program. 2840 2841@item -gdwarf-2 2842@opindex gdwarf-2 2843Produce debugging information in DWARF version 2 format (if that is 2844supported). This is the format used by DBX on IRIX 6. 2845 2846@item -gvms 2847@opindex gvms 2848Produce debugging information in VMS debug format (if that is 2849supported). This is the format used by DEBUG on VMS systems. 2850 2851@item -g@var{level} 2852@itemx -ggdb@var{level} 2853@itemx -gstabs@var{level} 2854@itemx -gcoff@var{level} 2855@itemx -gxcoff@var{level} 2856@itemx -gvms@var{level} 2857Request debugging information and also use @var{level} to specify how 2858much information. The default level is 2. 2859 2860Level 1 produces minimal information, enough for making backtraces in 2861parts of the program that you don't plan to debug. This includes 2862descriptions of functions and external variables, but no information 2863about local variables and no line numbers. 2864 2865Level 3 includes extra information, such as all the macro definitions 2866present in the program. Some debuggers support macro expansion when 2867you use @option{-g3}. 2868 2869Note that in order to avoid confusion between DWARF1 debug level 2, 2870and DWARF2, neither @option{-gdwarf} nor @option{-gdwarf-2} accept 2871a concatenated debug level. Instead use an additional @option{-g@var{level}} 2872option to change the debug level for DWARF1 or DWARF2. 2873 2874@cindex @code{prof} 2875@item -p 2876@opindex p 2877Generate extra code to write profile information suitable for the 2878analysis program @code{prof}. You must use this option when compiling 2879the source files you want data about, and you must also use it when 2880linking. 2881 2882@cindex @code{gprof} 2883@item -pg 2884@opindex pg 2885Generate extra code to write profile information suitable for the 2886analysis program @code{gprof}. You must use this option when compiling 2887the source files you want data about, and you must also use it when 2888linking. 2889 2890@item -Q 2891@opindex Q 2892Makes the compiler print out each function name as it is compiled, and 2893print some statistics about each pass when it finishes. 2894 2895@item -ftime-report 2896@opindex ftime-report 2897Makes the compiler print some statistics about the time consumed by each 2898pass when it finishes. 2899 2900@item -fmem-report 2901@opindex fmem-report 2902Makes the compiler print some statistics about permanent memory 2903allocation when it finishes. 2904 2905@item -fprofile-arcs 2906@opindex fprofile-arcs 2907Instrument @dfn{arcs} during compilation to generate coverage data 2908or for profile-directed block ordering. During execution the program 2909records how many times each branch is executed and how many times it is 2910taken. When the compiled program exits it saves this data to a file 2911called @file{@var{sourcename}.da} for each source file. 2912 2913For profile-directed block ordering, compile the program with 2914@option{-fprofile-arcs} plus optimization and code generation options, 2915generate the arc profile information by running the program on a 2916selected workload, and then compile the program again with the same 2917optimization and code generation options plus 2918@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 2919Control Optimization}). 2920 2921The other use of @option{-fprofile-arcs} is for use with @code{gcov}, 2922when it is used with the @option{-ftest-coverage} option. 2923 2924With @option{-fprofile-arcs}, for each function of your program GCC 2925creates a program flow graph, then finds a spanning tree for the graph. 2926Only arcs that are not on the spanning tree have to be instrumented: the 2927compiler adds code to count the number of times that these arcs are 2928executed. When an arc is the only exit or only entrance to a block, the 2929instrumentation code can be added to the block; otherwise, a new basic 2930block must be created to hold the instrumentation code. 2931 2932@need 2000 2933@item -ftest-coverage 2934@opindex ftest-coverage 2935Create data files for the @command{gcov} code-coverage utility 2936(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}). 2937The data file names begin with the name of your source file: 2938 2939@table @gcctabopt 2940@item @var{sourcename}.bb 2941A mapping from basic blocks to line numbers, which @code{gcov} uses to 2942associate basic block execution counts with line numbers. 2943 2944@item @var{sourcename}.bbg 2945A list of all arcs in the program flow graph. This allows @code{gcov} 2946to reconstruct the program flow graph, so that it can compute all basic 2947block and arc execution counts from the information in the 2948@code{@var{sourcename}.da} file. 2949@end table 2950 2951Use @option{-ftest-coverage} with @option{-fprofile-arcs}; the latter 2952option adds instrumentation to the program, which then writes 2953execution counts to another data file: 2954 2955@table @gcctabopt 2956@item @var{sourcename}.da 2957Runtime arc execution counts, used in conjunction with the arc 2958information in the file @code{@var{sourcename}.bbg}. 2959@end table 2960 2961Coverage data will map better to the source files if 2962@option{-ftest-coverage} is used without optimization. 2963 2964@item -d@var{letters} 2965@opindex d 2966Says to make debugging dumps during compilation at times specified by 2967@var{letters}. This is used for debugging the compiler. The file names 2968for most of the dumps are made by appending a pass number and a word to 2969the source file name (e.g. @file{foo.c.00.rtl} or @file{foo.c.01.sibling}). 2970Here are the possible letters for use in @var{letters}, and their meanings: 2971 2972@table @samp 2973@item A 2974@opindex dA 2975Annotate the assembler output with miscellaneous debugging information. 2976@item b 2977@opindex db 2978Dump after computing branch probabilities, to @file{@var{file}.14.bp}. 2979@item B 2980@opindex dB 2981Dump after block reordering, to @file{@var{file}.29.bbro}. 2982@item c 2983@opindex dc 2984Dump after instruction combination, to the file @file{@var{file}.16.combine}. 2985@item C 2986@opindex dC 2987Dump after the first if conversion, to the file @file{@var{file}.17.ce}. 2988@item d 2989@opindex dd 2990Dump after delayed branch scheduling, to @file{@var{file}.31.dbr}. 2991@item D 2992@opindex dD 2993Dump all macro definitions, at the end of preprocessing, in addition to 2994normal output. 2995@item e 2996@opindex de 2997Dump after SSA optimizations, to @file{@var{file}.04.ssa} and 2998@file{@var{file}.07.ussa}. 2999@item E 3000@opindex dE 3001Dump after the second if conversion, to @file{@var{file}.26.ce2}. 3002@item f 3003@opindex df 3004Dump after life analysis, to @file{@var{file}.15.life}. 3005@item F 3006@opindex dF 3007Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.09.addressof}. 3008@item g 3009@opindex dg 3010Dump after global register allocation, to @file{@var{file}.21.greg}. 3011@item h 3012@opindex dh 3013Dump after finalization of EH handling code, to @file{@var{file}.02.eh}. 3014@item k 3015@opindex dk 3016Dump after reg-to-stack conversion, to @file{@var{file}.28.stack}. 3017@item o 3018@opindex do 3019Dump after post-reload optimizations, to @file{@var{file}.22.postreload}. 3020@item G 3021@opindex dG 3022Dump after GCSE, to @file{@var{file}.10.gcse}. 3023@item i 3024@opindex di 3025Dump after sibling call optimizations, to @file{@var{file}.01.sibling}. 3026@item j 3027@opindex dj 3028Dump after the first jump optimization, to @file{@var{file}.03.jump}. 3029@item k 3030@opindex dk 3031Dump after conversion from registers to stack, to @file{@var{file}.32.stack}. 3032@item l 3033@opindex dl 3034Dump after local register allocation, to @file{@var{file}.20.lreg}. 3035@item L 3036@opindex dL 3037Dump after loop optimization, to @file{@var{file}.11.loop}. 3038@item M 3039@opindex dM 3040Dump after performing the machine dependent reorganisation pass, to 3041@file{@var{file}.30.mach}. 3042@item n 3043@opindex dn 3044Dump after register renumbering, to @file{@var{file}.25.rnreg}. 3045@item N 3046@opindex dN 3047Dump after the register move pass, to @file{@var{file}.18.regmove}. 3048@item r 3049@opindex dr 3050Dump after RTL generation, to @file{@var{file}.00.rtl}. 3051@item R 3052@opindex dR 3053Dump after the second scheduling pass, to @file{@var{file}.27.sched2}. 3054@item s 3055@opindex ds 3056Dump after CSE (including the jump optimization that sometimes follows 3057CSE), to @file{@var{file}.08.cse}. 3058@item S 3059@opindex dS 3060Dump after the first scheduling pass, to @file{@var{file}.19.sched}. 3061@item t 3062@opindex dt 3063Dump after the second CSE pass (including the jump optimization that 3064sometimes follows CSE), to @file{@var{file}.12.cse2}. 3065@item w 3066@opindex dw 3067Dump after the second flow pass, to @file{@var{file}.23.flow2}. 3068@item X 3069@opindex dX 3070Dump after SSA dead code elimination, to @file{@var{file}.06.ssadce}. 3071@item z 3072@opindex dz 3073Dump after the peephole pass, to @file{@var{file}.24.peephole2}. 3074@item a 3075@opindex da 3076Produce all the dumps listed above. 3077@item m 3078@opindex dm 3079Print statistics on memory usage, at the end of the run, to 3080standard error. 3081@item p 3082@opindex dp 3083Annotate the assembler output with a comment indicating which 3084pattern and alternative was used. The length of each instruction is 3085also printed. 3086@item P 3087@opindex dP 3088Dump the RTL in the assembler output as a comment before each instruction. 3089Also turns on @option{-dp} annotation. 3090@item v 3091@opindex dv 3092For each of the other indicated dump files (except for 3093@file{@var{file}.00.rtl}), dump a representation of the control flow graph 3094suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}. 3095@item x 3096@opindex dx 3097Just generate RTL for a function instead of compiling it. Usually used 3098with @samp{r}. 3099@item y 3100@opindex dy 3101Dump debugging information during parsing, to standard error. 3102@end table 3103 3104@item -fdump-unnumbered 3105@opindex fdump-unnumbered 3106When doing debugging dumps (see @option{-d} option above), suppress instruction 3107numbers and line number note output. This makes it more feasible to 3108use diff on debugging dumps for compiler invocations with different 3109options, in particular with and without @option{-g}. 3110 3111@item -fdump-translation-unit @r{(C and C++ only)} 3112@itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)} 3113@opindex fdump-translation-unit 3114Dump a representation of the tree structure for the entire translation 3115unit to a file. The file name is made by appending @file{.tu} to the 3116source file name. If the @samp{-@var{options}} form is used, @var{options} 3117controls the details of the dump as described for the 3118@option{-fdump-tree} options. 3119 3120@item -fdump-class-hierarchy @r{(C++ only)} 3121@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} 3122@opindex fdump-class-hierarchy 3123Dump a representation of each class's hierarchy and virtual function 3124table layout to a file. The file name is made by appending @file{.class} 3125to the source file name. If the @samp{-@var{options}} form is used, 3126@var{options} controls the details of the dump as described for the 3127@option{-fdump-tree} options. 3128 3129@item -fdump-tree-@var{switch} @r{(C++ only)} 3130@itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)} 3131@opindex fdump-tree 3132Control the dumping at various stages of processing the intermediate 3133language tree to a file. The file name is generated by appending a switch 3134specific suffix to the source file name. If the @samp{-@var{options}} 3135form is used, @var{options} is a list of @samp{-} separated options that 3136control the details of the dump. Not all options are applicable to all 3137dumps, those which are not meaningful will be ignored. The following 3138options are available 3139 3140@table @samp 3141@item address 3142Print the address of each node. Usually this is not meaningful as it 3143changes according to the environment and source file. Its primary use 3144is for tying up a dump file with a debug environment. 3145@item slim 3146Inhibit dumping of members of a scope or body of a function merely 3147because that scope has been reached. Only dump such items when they 3148are directly reachable by some other path. 3149@item all 3150Turn on all options. 3151@end table 3152 3153The following tree dumps are possible: 3154@table @samp 3155@item original 3156Dump before any tree based optimization, to @file{@var{file}.original}. 3157@item optimized 3158Dump after all tree based optimization, to @file{@var{file}.optimized}. 3159@item inlined 3160Dump after function inlining, to @file{@var{file}.inlined}. 3161@end table 3162 3163@item -fsched-verbose=@var{n} 3164@opindex fsched-verbose 3165On targets that use instruction scheduling, this option controls the 3166amount of debugging output the scheduler prints. This information is 3167written to standard error, unless @option{-dS} or @option{-dR} is 3168specified, in which case it is output to the usual dump 3169listing file, @file{.sched} or @file{.sched2} respectively. However 3170for @var{n} greater than nine, the output is always printed to standard 3171error. 3172 3173For @var{n} greater than zero, @option{-fsched-verbose} outputs the 3174same information as @option{-dRS}. For @var{n} greater than one, it 3175also output basic block probabilities, detailed ready list information 3176and unit/insn info. For @var{n} greater than two, it includes RTL 3177at abort point, control-flow and regions info. And for @var{n} over 3178four, @option{-fsched-verbose} also includes dependence info. 3179 3180@item -fpretend-float 3181@opindex fpretend-float 3182When running a cross-compiler, pretend that the target machine uses the 3183same floating point format as the host machine. This causes incorrect 3184output of the actual floating constants, but the actual instruction 3185sequence will probably be the same as GCC would make when running on 3186the target machine. 3187 3188@item -save-temps 3189@opindex save-temps 3190Store the usual ``temporary'' intermediate files permanently; place them 3191in the current directory and name them based on the source file. Thus, 3192compiling @file{foo.c} with @samp{-c -save-temps} would produce files 3193@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 3194preprocessed @file{foo.i} output file even though the compiler now 3195normally uses an integrated preprocessor. 3196 3197@item -time 3198@opindex time 3199Report the CPU time taken by each subprocess in the compilation 3200sequence. For C source files, this is the compiler proper and assembler 3201(plus the linker if linking is done). The output looks like this: 3202 3203@smallexample 3204# cc1 0.12 0.01 3205# as 0.00 0.01 3206@end smallexample 3207 3208The first number on each line is the ``user time,'' that is time spent 3209executing the program itself. The second number is ``system time,'' 3210time spent executing operating system routines on behalf of the program. 3211Both numbers are in seconds. 3212 3213@item -print-file-name=@var{library} 3214@opindex print-file-name 3215Print the full absolute name of the library file @var{library} that 3216would be used when linking---and don't do anything else. With this 3217option, GCC does not compile or link anything; it just prints the 3218file name. 3219 3220@item -print-multi-directory 3221@opindex print-multi-directory 3222Print the directory name corresponding to the multilib selected by any 3223other switches present in the command line. This directory is supposed 3224to exist in @env{GCC_EXEC_PREFIX}. 3225 3226@item -print-multi-lib 3227@opindex print-multi-lib 3228Print the mapping from multilib directory names to compiler switches 3229that enable them. The directory name is separated from the switches by 3230@samp{;}, and each switch starts with an @samp{@@} instead of the 3231@samp{-}, without spaces between multiple switches. This is supposed to 3232ease shell-processing. 3233 3234@item -print-prog-name=@var{program} 3235@opindex print-prog-name 3236Like @option{-print-file-name}, but searches for a program such as @samp{cpp}. 3237 3238@item -print-libgcc-file-name 3239@opindex print-libgcc-file-name 3240Same as @option{-print-file-name=libgcc.a}. 3241 3242This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 3243but you do want to link with @file{libgcc.a}. You can do 3244 3245@example 3246gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 3247@end example 3248 3249@item -print-search-dirs 3250@opindex print-search-dirs 3251Print the name of the configured installation directory and a list of 3252program and library directories gcc will search---and don't do anything else. 3253 3254This is useful when gcc prints the error message 3255@samp{installation problem, cannot exec cpp0: No such file or directory}. 3256To resolve this you either need to put @file{cpp0} and the other compiler 3257components where gcc expects to find them, or you can set the environment 3258variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 3259Don't forget the trailing '/'. 3260@xref{Environment Variables}. 3261 3262@item -dumpmachine 3263@opindex dumpmachine 3264Print the compiler's target machine (for example, 3265@samp{i686-pc-linux-gnu})---and don't do anything else. 3266 3267@item -dumpversion 3268@opindex dumpversion 3269Print the compiler version (for example, @samp{3.0})---and don't do 3270anything else. 3271 3272@item -dumpspecs 3273@opindex dumpspecs 3274Print the compiler's built-in specs---and don't do anything else. (This 3275is used when GCC itself is being built.) @xref{Spec Files}. 3276@end table 3277 3278@node Optimize Options 3279@section Options That Control Optimization 3280@cindex optimize options 3281@cindex options, optimization 3282 3283These options control various sorts of optimizations: 3284 3285@table @gcctabopt 3286@item -O 3287@itemx -O1 3288@opindex O 3289@opindex O1 3290Optimize. Optimizing compilation takes somewhat more time, and a lot 3291more memory for a large function. 3292 3293Without @option{-O}, the compiler's goal is to reduce the cost of 3294compilation and to make debugging produce the expected results. 3295Statements are independent: if you stop the program with a breakpoint 3296between statements, you can then assign a new value to any variable or 3297change the program counter to any other statement in the function and 3298get exactly the results you would expect from the source code. 3299 3300With @option{-O}, the compiler tries to reduce code size and execution 3301time, without performing any optimizations that take a great deal of 3302compilation time. 3303 3304@item -O2 3305@opindex O2 3306Optimize even more. GCC performs nearly all supported optimizations 3307that do not involve a space-speed tradeoff. The compiler does not 3308perform loop unrolling or function inlining when you specify @option{-O2}. 3309As compared to @option{-O}, this option increases both compilation time 3310and the performance of the generated code. 3311 3312@option{-O2} turns on all optional optimizations except for loop unrolling, 3313function inlining, and register renaming. It also turns on the 3314@option{-fforce-mem} option on all machines and frame pointer elimination 3315on machines where doing so does not interfere with debugging. 3316 3317Please note the warning under @option{-fgcse} about 3318invoking @option{-O2} on programs that use computed gotos. 3319 3320@item -O3 3321@opindex O3 3322Optimize yet more. @option{-O3} turns on all optimizations specified by 3323@option{-O2} and also turns on the @option{-finline-functions} and 3324@option{-frename-registers} options. 3325 3326@item -O0 3327@opindex O0 3328Do not optimize. 3329 3330@item -Os 3331@opindex Os 3332Optimize for size. @option{-Os} enables all @option{-O2} optimizations that 3333do not typically increase code size. It also performs further 3334optimizations designed to reduce code size. 3335 3336If you use multiple @option{-O} options, with or without level numbers, 3337the last such option is the one that is effective. 3338@end table 3339 3340Options of the form @option{-f@var{flag}} specify machine-independent 3341flags. Most flags have both positive and negative forms; the negative 3342form of @option{-ffoo} would be @option{-fno-foo}. In the table below, 3343only one of the forms is listed---the one which is not the default. 3344You can figure out the other form by either removing @samp{no-} or 3345adding it. 3346 3347@table @gcctabopt 3348@item -ffloat-store 3349@opindex ffloat-store 3350Do not store floating point variables in registers, and inhibit other 3351options that might change whether a floating point value is taken from a 3352register or memory. 3353 3354@cindex floating point precision 3355This option prevents undesirable excess precision on machines such as 3356the 68000 where the floating registers (of the 68881) keep more 3357precision than a @code{double} is supposed to have. Similarly for the 3358x86 architecture. For most programs, the excess precision does only 3359good, but a few programs rely on the precise definition of IEEE floating 3360point. Use @option{-ffloat-store} for such programs, after modifying 3361them to store all pertinent intermediate computations into variables. 3362 3363@item -fno-default-inline 3364@opindex fno-default-inline 3365Do not make member functions inline by default merely because they are 3366defined inside the class scope (C++ only). Otherwise, when you specify 3367@w{@option{-O}}, member functions defined inside class scope are compiled 3368inline by default; i.e., you don't need to add @samp{inline} in front of 3369the member function name. 3370 3371@item -fno-defer-pop 3372@opindex fno-defer-pop 3373Always pop the arguments to each function call as soon as that function 3374returns. For machines which must pop arguments after a function call, 3375the compiler normally lets arguments accumulate on the stack for several 3376function calls and pops them all at once. 3377 3378@item -fforce-mem 3379@opindex fforce-mem 3380Force memory operands to be copied into registers before doing 3381arithmetic on them. This produces better code by making all memory 3382references potential common subexpressions. When they are not common 3383subexpressions, instruction combination should eliminate the separate 3384register-load. The @option{-O2} option turns on this option. 3385 3386@item -fforce-addr 3387@opindex fforce-addr 3388Force memory address constants to be copied into registers before 3389doing arithmetic on them. This may produce better code just as 3390@option{-fforce-mem} may. 3391 3392@item -fomit-frame-pointer 3393@opindex fomit-frame-pointer 3394Don't keep the frame pointer in a register for functions that 3395don't need one. This avoids the instructions to save, set up and 3396restore frame pointers; it also makes an extra register available 3397in many functions. @strong{It also makes debugging impossible on 3398some machines.} 3399 3400On some machines, such as the VAX, this flag has no effect, because 3401the standard calling sequence automatically handles the frame pointer 3402and nothing is saved by pretending it doesn't exist. The 3403machine-description macro @code{FRAME_POINTER_REQUIRED} controls 3404whether a target machine supports this flag. @xref{Registers,,Register 3405Usage, gccint, GNU Compiler Collection (GCC) Internals}. 3406 3407@item -foptimize-sibling-calls 3408@opindex foptimize-sibling-calls 3409Optimize sibling and tail recursive calls. 3410 3411@item -ftrapv 3412@opindex ftrapv 3413This option generates traps for signed overflow on addition, subtraction, 3414multiplication operations. 3415 3416@item -fno-inline 3417@opindex fno-inline 3418Don't pay attention to the @code{inline} keyword. Normally this option 3419is used to keep the compiler from expanding any functions inline. 3420Note that if you are not optimizing, no functions can be expanded inline. 3421 3422@item -finline-functions 3423@opindex finline-functions 3424Integrate all simple functions into their callers. The compiler 3425heuristically decides which functions are simple enough to be worth 3426integrating in this way. 3427 3428If all calls to a given function are integrated, and the function is 3429declared @code{static}, then the function is normally not output as 3430assembler code in its own right. 3431 3432@item -finline-limit=@var{n} 3433@opindex finline-limit 3434By default, gcc limits the size of functions that can be inlined. This flag 3435allows the control of this limit for functions that are explicitly marked as 3436inline (ie marked with the inline keyword or defined within the class 3437definition in c++). @var{n} is the size of functions that can be inlined in 3438number of pseudo instructions (not counting parameter handling). The default 3439value of @var{n} is 600. 3440Increasing this value can result in more inlined code at 3441the cost of compilation time and memory consumption. Decreasing usually makes 3442the compilation faster and less code will be inlined (which presumably 3443means slower programs). This option is particularly useful for programs that 3444use inlining heavily such as those based on recursive templates with C++. 3445 3446@emph{Note:} pseudo instruction represents, in this particular context, an 3447abstract measurement of function's size. In no way, it represents a count 3448of assembly instructions and as such its exact meaning might change from one 3449release to an another. 3450 3451@item -fkeep-inline-functions 3452@opindex fkeep-inline-functions 3453Even if all calls to a given function are integrated, and the function 3454is declared @code{static}, nevertheless output a separate run-time 3455callable version of the function. This switch does not affect 3456@code{extern inline} functions. 3457 3458@item -fkeep-static-consts 3459@opindex fkeep-static-consts 3460Emit variables declared @code{static const} when optimization isn't turned 3461on, even if the variables aren't referenced. 3462 3463GCC enables this option by default. If you want to force the compiler to 3464check if the variable was referenced, regardless of whether or not 3465optimization is turned on, use the @option{-fno-keep-static-consts} option. 3466 3467@item -fmerge-constants 3468Attempt to merge identical constants (string constants and floating point 3469constants) accross compilation units. 3470 3471This option is default for optimized compilation if assembler and linker 3472support it. Use @option{-fno-merge-constants} to inhibit this behavior. 3473 3474@item -fmerge-all-constants 3475Attempt to merge identical constants and identical variables. 3476 3477This option implies @option{-fmerge-constants}. In addition to 3478@option{-fmerge-constants} this considers e.g. even constant initialized 3479arrays or initialized constant variables with integral or floating point 3480types. Languages like C or C++ require each non-automatic variable to 3481have distinct location, so using this option will result in non-conforming 3482behavior. 3483 3484@item -fno-branch-count-reg 3485@opindex fno-branch-count-reg 3486Do not use ``decrement and branch'' instructions on a count register, 3487but instead generate a sequence of instructions that decrement a 3488register, compare it against zero, then branch based upon the result. 3489This option is only meaningful on architectures that support such 3490instructions, which include x86, PowerPC, IA-64 and S/390. 3491 3492@item -fno-function-cse 3493@opindex fno-function-cse 3494Do not put function addresses in registers; make each instruction that 3495calls a constant function contain the function's address explicitly. 3496 3497This option results in less efficient code, but some strange hacks 3498that alter the assembler output may be confused by the optimizations 3499performed when this option is not used. 3500 3501@item -ffast-math 3502@opindex ffast-math 3503Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, and @* 3504@option{-fno-trapping-math}. 3505 3506This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 3507 3508This option should never be turned on by any @option{-O} option since 3509it can result in incorrect output for programs which depend on 3510an exact implementation of IEEE or ISO rules/specifications for 3511math functions. 3512 3513@item -fno-math-errno 3514@opindex fno-math-errno 3515Do not set ERRNO after calling math functions that are executed 3516with a single instruction, e.g., sqrt. A program that relies on 3517IEEE exceptions for math error handling may want to use this flag 3518for speed while maintaining IEEE arithmetic compatibility. 3519 3520This option should never be turned on by any @option{-O} option since 3521it can result in incorrect output for programs which depend on 3522an exact implementation of IEEE or ISO rules/specifications for 3523math functions. 3524 3525The default is @option{-fmath-errno}. 3526 3527@item -funsafe-math-optimizations 3528@opindex funsafe-math-optimizations 3529Allow optimizations for floating-point arithmetic that (a) assume 3530that arguments and results are valid and (b) may violate IEEE or 3531ANSI standards. When used at link-time, it may include libraries 3532or startup files that change the default FPU control word or other 3533similar optimizations. 3534 3535This option should never be turned on by any @option{-O} option since 3536it can result in incorrect output for programs which depend on 3537an exact implementation of IEEE or ISO rules/specifications for 3538math functions. 3539 3540The default is @option{-fno-unsafe-math-optimizations}. 3541 3542@item -fno-trapping-math 3543@opindex fno-trapping-math 3544Compile code assuming that floating-point operations cannot generate 3545user-visible traps. Setting this option may allow faster code 3546if one relies on ``non-stop'' IEEE arithmetic, for example. 3547 3548This option should never be turned on by any @option{-O} option since 3549it can result in incorrect output for programs which depend on 3550an exact implementation of IEEE or ISO rules/specifications for 3551math functions. 3552 3553The default is @option{-ftrapping-math}. 3554 3555@item -fbounds-check 3556@opindex fbounds-check 3557For front-ends that support it, generate additional code to check that 3558indices used to access arrays are within the declared range. This is 3559currenly only supported by the Java and Fortran 77 front-ends, where 3560this option defaults to true and false respectively. 3561 3562@end table 3563 3564The following options control specific optimizations. The @option{-O2} 3565option turns on all of these optimizations except @option{-funroll-loops} 3566and @option{-funroll-all-loops}. On most machines, the @option{-O} option 3567turns on the @option{-fthread-jumps} and @option{-fdelayed-branch} options, 3568but specific machines may handle it differently. 3569 3570You can use the following flags in the rare cases when ``fine-tuning'' 3571of optimizations to be performed is desired. 3572 3573Not all of the optimizations performed by GCC have @option{-f} options 3574to control them. 3575 3576@table @gcctabopt 3577@item -fstrength-reduce 3578@opindex fstrength-reduce 3579Perform the optimizations of loop strength reduction and 3580elimination of iteration variables. 3581 3582@item -fthread-jumps 3583@opindex fthread-jumps 3584Perform optimizations where we check to see if a jump branches to a 3585location where another comparison subsumed by the first is found. If 3586so, the first branch is redirected to either the destination of the 3587second branch or a point immediately following it, depending on whether 3588the condition is known to be true or false. 3589 3590@item -fcse-follow-jumps 3591@opindex fcse-follow-jumps 3592In common subexpression elimination, scan through jump instructions 3593when the target of the jump is not reached by any other path. For 3594example, when CSE encounters an @code{if} statement with an 3595@code{else} clause, CSE will follow the jump when the condition 3596tested is false. 3597 3598@item -fcse-skip-blocks 3599@opindex fcse-skip-blocks 3600This is similar to @option{-fcse-follow-jumps}, but causes CSE to 3601follow jumps which conditionally skip over blocks. When CSE 3602encounters a simple @code{if} statement with no else clause, 3603@option{-fcse-skip-blocks} causes CSE to follow the jump around the 3604body of the @code{if}. 3605 3606@item -frerun-cse-after-loop 3607@opindex frerun-cse-after-loop 3608Re-run common subexpression elimination after loop optimizations has been 3609performed. 3610 3611@item -frerun-loop-opt 3612@opindex frerun-loop-opt 3613Run the loop optimizer twice. 3614 3615@item -fgcse 3616@opindex fgcse 3617Perform a global common subexpression elimination pass. 3618This pass also performs global constant and copy propagation. 3619 3620@emph{Note:} When compiling a program using computed gotos, a GCC 3621extension, you may get better runtime performance if you disable 3622the global common subexpression elmination pass by adding 3623@option{-fno-gcse} to the command line. 3624 3625@item -fgcse-lm 3626@opindex fgcse-lm 3627When @option{-fgcse-lm} is enabled, global common subexpression elimination will 3628attempt to move loads which are only killed by stores into themselves. This 3629allows a loop containing a load/store sequence to be changed to a load outside 3630the loop, and a copy/store within the loop. 3631 3632@item -fgcse-sm 3633@opindex fgcse-sm 3634When @option{-fgcse-sm} is enabled, A store motion pass is run after global common 3635subexpression elimination. This pass will attempt to move stores out of loops. 3636When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence 3637can be changed to a load before the loop and a store after the loop. 3638 3639@item -fdelete-null-pointer-checks 3640@opindex fdelete-null-pointer-checks 3641Use global dataflow analysis to identify and eliminate useless checks 3642for null pointers. The compiler assumes that dereferencing a null 3643pointer would have halted the program. If a pointer is checked after 3644it has already been dereferenced, it cannot be null. 3645 3646In some environments, this assumption is not true, and programs can 3647safely dereference null pointers. Use 3648@option{-fno-delete-null-pointer-checks} to disable this optimization 3649for programs which depend on that behavior. 3650 3651@item -fexpensive-optimizations 3652@opindex fexpensive-optimizations 3653Perform a number of minor optimizations that are relatively expensive. 3654 3655@item -foptimize-register-move 3656@itemx -fregmove 3657@opindex foptimize-register-move 3658@opindex fregmove 3659Attempt to reassign register numbers in move instructions and as 3660operands of other simple instructions in order to maximize the amount of 3661register tying. This is especially helpful on machines with two-operand 3662instructions. GCC enables this optimization by default with @option{-O2} 3663or higher. 3664 3665Note @option{-fregmove} and @option{-foptimize-register-move} are the same 3666optimization. 3667 3668@item -fdelayed-branch 3669@opindex fdelayed-branch 3670If supported for the target machine, attempt to reorder instructions 3671to exploit instruction slots available after delayed branch 3672instructions. 3673 3674@item -fschedule-insns 3675@opindex fschedule-insns 3676If supported for the target machine, attempt to reorder instructions to 3677eliminate execution stalls due to required data being unavailable. This 3678helps machines that have slow floating point or memory load instructions 3679by allowing other instructions to be issued until the result of the load 3680or floating point instruction is required. 3681 3682@item -fschedule-insns2 3683@opindex fschedule-insns2 3684Similar to @option{-fschedule-insns}, but requests an additional pass of 3685instruction scheduling after register allocation has been done. This is 3686especially useful on machines with a relatively small number of 3687registers and where memory load instructions take more than one cycle. 3688 3689@item -fno-sched-interblock 3690@opindex fno-sched-interblock 3691Don't schedule instructions across basic blocks. This is normally 3692enabled by default when scheduling before register allocation, i.e.@: 3693with @option{-fschedule-insns} or at @option{-O2} or higher. 3694 3695@item -fno-sched-spec 3696@opindex fno-sched-spec 3697Don't allow speculative motion of non-load instructions. This is normally 3698enabled by default when scheduling before register allocation, i.e.@: 3699with @option{-fschedule-insns} or at @option{-O2} or higher. 3700 3701@item -fsched-spec-load 3702@opindex fsched-spec-load 3703Allow speculative motion of some load instructions. This only makes 3704sense when scheduling before register allocation, i.e.@: with 3705@option{-fschedule-insns} or at @option{-O2} or higher. 3706 3707@item -fsched-spec-load-dangerous 3708@opindex fsched-spec-load-dangerous 3709Allow speculative motion of more load instructions. This only makes 3710sense when scheduling before register allocation, i.e.@: with 3711@option{-fschedule-insns} or at @option{-O2} or higher. 3712 3713@item -ffunction-sections 3714@itemx -fdata-sections 3715@opindex ffunction-sections 3716@opindex fdata-sections 3717Place each function or data item into its own section in the output 3718file if the target supports arbitrary sections. The name of the 3719function or the name of the data item determines the section's name 3720in the output file. 3721 3722Use these options on systems where the linker can perform optimizations 3723to improve locality of reference in the instruction space. HPPA 3724processors running HP-UX and Sparc processors running Solaris 2 have 3725linkers with such optimizations. Other systems using the ELF object format 3726as well as AIX may have these optimizations in the future. 3727 3728Only use these options when there are significant benefits from doing 3729so. When you specify these options, the assembler and linker will 3730create larger object and executable files and will also be slower. 3731You will not be able to use @code{gprof} on all systems if you 3732specify this option and you may have problems with debugging if 3733you specify both this option and @option{-g}. 3734 3735@item -fcaller-saves 3736@opindex fcaller-saves 3737Enable values to be allocated in registers that will be clobbered by 3738function calls, by emitting extra instructions to save and restore the 3739registers around such calls. Such allocation is done only when it 3740seems to result in better code than would otherwise be produced. 3741 3742This option is always enabled by default on certain machines, usually 3743those which have no call-preserved registers to use instead. 3744 3745For all machines, optimization level 2 and higher enables this flag by 3746default. 3747 3748@item -funroll-loops 3749@opindex funroll-loops 3750Unroll loops whose number of iterations can be determined at compile 3751time or upon entry to the loop. @option{-funroll-loops} implies both 3752@option{-fstrength-reduce} and @option{-frerun-cse-after-loop}. This 3753option makes code larger, and may or may not make it run faster. 3754 3755@item -funroll-all-loops 3756@opindex funroll-all-loops 3757Unroll all loops, even if their number of iterations is uncertain when 3758the loop is entered. This usually makes programs run more slowly. 3759@option{-funroll-all-loops} implies the same options as 3760@option{-funroll-loops}, 3761 3762@item -fprefetch-loop-arrays 3763@opindex fprefetch-loop-arrays 3764If supported by the target machine, generate instructions to prefetch 3765memory to improve the performance of loops that access large arrays. 3766 3767@item -fmove-all-movables 3768@opindex fmove-all-movables 3769Forces all invariant computations in loops to be moved 3770outside the loop. 3771 3772@item -freduce-all-givs 3773@opindex freduce-all-givs 3774Forces all general-induction variables in loops to be 3775strength-reduced. 3776 3777@emph{Note:} When compiling programs written in Fortran, 3778@option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled 3779by default when you use the optimizer. 3780 3781These options may generate better or worse code; results are highly 3782dependent on the structure of loops within the source code. 3783 3784These two options are intended to be removed someday, once 3785they have helped determine the efficacy of various 3786approaches to improving loop optimizations. 3787 3788Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}}) 3789know how use of these options affects 3790the performance of your production code. 3791We're very interested in code that runs @emph{slower} 3792when these options are @emph{enabled}. 3793 3794@item -fno-peephole 3795@itemx -fno-peephole2 3796@opindex fno-peephole 3797@opindex fno-peephole2 3798Disable any machine-specific peephole optimizations. The difference 3799between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 3800are implemented in the compiler; some targets use one, some use the 3801other, a few use both. 3802 3803@item -fbranch-probabilities 3804@opindex fbranch-probabilities 3805After running a program compiled with @option{-fprofile-arcs} 3806(@pxref{Debugging Options,, Options for Debugging Your Program or 3807@command{gcc}}), you can compile it a second time using 3808@option{-fbranch-probabilities}, to improve optimizations based on 3809the number of times each branch was taken. When the program 3810compiled with @option{-fprofile-arcs} exits it saves arc execution 3811counts to a file called @file{@var{sourcename}.da} for each source 3812file The information in this data file is very dependent on the 3813structure of the generated code, so you must use the same source code 3814and the same optimization options for both compilations. 3815 3816With @option{-fbranch-probabilities}, GCC puts a @samp{REG_EXEC_COUNT} 3817note on the first instruction of each basic block, and a 3818@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 3819These can be used to improve optimization. Currently, they are only 3820used in one place: in @file{reorg.c}, instead of guessing which path a 3821branch is mostly to take, the @samp{REG_BR_PROB} values are used to 3822exactly determine which path is taken more often. 3823 3824@item -fno-guess-branch-probability 3825@opindex fno-guess-branch-probability 3826Do not guess branch probabilities using a randomized model. 3827 3828Sometimes gcc will opt to use a randomized model to guess branch 3829probabilities, when none are available from either profiling feedback 3830(@option{-fprofile-arcs}) or @samp{__builtin_expect}. This means that 3831different runs of the compiler on the same program may produce different 3832object code. 3833 3834In a hard real-time system, people don't want different runs of the 3835compiler to produce code that has different behavior; minimizing 3836non-determinism is of paramount import. This switch allows users to 3837reduce non-determinism, possibly at the expense of inferior 3838optimization. 3839 3840@item -fstrict-aliasing 3841@opindex fstrict-aliasing 3842Allows the compiler to assume the strictest aliasing rules applicable to 3843the language being compiled. For C (and C++), this activates 3844optimizations based on the type of expressions. In particular, an 3845object of one type is assumed never to reside at the same address as an 3846object of a different type, unless the types are almost the same. For 3847example, an @code{unsigned int} can alias an @code{int}, but not a 3848@code{void*} or a @code{double}. A character type may alias any other 3849type. 3850 3851Pay special attention to code like this: 3852@example 3853union a_union @{ 3854 int i; 3855 double d; 3856@}; 3857 3858int f() @{ 3859 a_union t; 3860 t.d = 3.0; 3861 return t.i; 3862@} 3863@end example 3864The practice of reading from a different union member than the one most 3865recently written to (called ``type-punning'') is common. Even with 3866@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 3867is accessed through the union type. So, the code above will work as 3868expected. However, this code might not: 3869@example 3870int f() @{ 3871 a_union t; 3872 int* ip; 3873 t.d = 3.0; 3874 ip = &t.i; 3875 return *ip; 3876@} 3877@end example 3878 3879Every language that wishes to perform language-specific alias analysis 3880should define a function that computes, given an @code{tree} 3881node, an alias set for the node. Nodes in different alias sets are not 3882allowed to alias. For an example, see the C front-end function 3883@code{c_get_alias_set}. 3884 3885@item -falign-functions 3886@itemx -falign-functions=@var{n} 3887@opindex falign-functions 3888Align the start of functions to the next power-of-two greater than 3889@var{n}, skipping up to @var{n} bytes. For instance, 3890@option{-falign-functions=32} aligns functions to the next 32-byte 3891boundary, but @option{-falign-functions=24} would align to the next 389232-byte boundary only if this can be done by skipping 23 bytes or less. 3893 3894@option{-fno-align-functions} and @option{-falign-functions=1} are 3895equivalent and mean that functions will not be aligned. 3896 3897Some assemblers only support this flag when @var{n} is a power of two; 3898in that case, it is rounded up. 3899 3900If @var{n} is not specified, use a machine-dependent default. 3901 3902@item -falign-labels 3903@itemx -falign-labels=@var{n} 3904@opindex falign-labels 3905Align all branch targets to a power-of-two boundary, skipping up to 3906@var{n} bytes like @option{-falign-functions}. This option can easily 3907make code slower, because it must insert dummy operations for when the 3908branch target is reached in the usual flow of the code. 3909 3910If @option{-falign-loops} or @option{-falign-jumps} are applicable and 3911are greater than this value, then their values are used instead. 3912 3913If @var{n} is not specified, use a machine-dependent default which is 3914very likely to be @samp{1}, meaning no alignment. 3915 3916@item -falign-loops 3917@itemx -falign-loops=@var{n} 3918@opindex falign-loops 3919Align loops to a power-of-two boundary, skipping up to @var{n} bytes 3920like @option{-falign-functions}. The hope is that the loop will be 3921executed many times, which will make up for any execution of the dummy 3922operations. 3923 3924If @var{n} is not specified, use a machine-dependent default. 3925 3926@item -falign-jumps 3927@itemx -falign-jumps=@var{n} 3928@opindex falign-jumps 3929Align branch targets to a power-of-two boundary, for branch targets 3930where the targets can only be reached by jumping, skipping up to @var{n} 3931bytes like @option{-falign-functions}. In this case, no dummy operations 3932need be executed. 3933 3934If @var{n} is not specified, use a machine-dependent default. 3935 3936@item -fssa 3937@opindex fssa 3938Perform optimizations in static single assignment form. Each function's 3939flow graph is translated into SSA form, optimizations are performed, and 3940the flow graph is translated back from SSA form. Users should not 3941specify this option, since it is not yet ready for production use. 3942 3943@item -fssa-ccp 3944@opindex fssa-ccp 3945Perform Sparse Conditional Constant Propagation in SSA form. Requires 3946@option{-fssa}. Like @option{-fssa}, this is an experimental feature. 3947 3948@item -fssa-dce 3949@opindex fssa-dce 3950Perform aggressive dead-code elimination in SSA form. Requires @option{-fssa}. 3951Like @option{-fssa}, this is an experimental feature. 3952 3953@item -fsingle-precision-constant 3954@opindex fsingle-precision-constant 3955Treat floating point constant as single precision constant instead of 3956implicitly converting it to double precision constant. 3957 3958@item -frename-registers 3959@opindex frename-registers 3960Attempt to avoid false dependencies in scheduled code by making use 3961of registers left over after register allocation. This optimization 3962will most benefit processors with lots of registers. It can, however, 3963make debugging impossible, since variables will no longer stay in 3964a ``home register''. 3965 3966@item -fno-cprop-registers 3967@opindex fno-cprop-registers 3968After register allocation and post-register allocation instruction splitting, 3969we perform a copy-propagation pass to try to reduce scheduling dependencies 3970and occasionally eliminate the copy. 3971 3972@item --param @var{name}=@var{value} 3973@opindex param 3974In some places, GCC uses various constants to control the amount of 3975optimization that is done. For example, GCC will not inline functions 3976that contain more that a certain number of instructions. You can 3977control some of these constants on the command-line using the 3978@option{--param} option. 3979 3980In each case, the @var{value} is an integer. The allowable choices for 3981@var{name} are given in the following table: 3982 3983@table @gcctabopt 3984@item max-delay-slot-insn-search 3985The maximum number of instructions to consider when looking for an 3986instruction to fill a delay slot. If more than this arbitrary number of 3987instructions is searched, the time savings from filling the delay slot 3988will be minimal so stop searching. Increasing values mean more 3989aggressive optimization, making the compile time increase with probably 3990small improvement in executable run time. 3991 3992@item max-delay-slot-live-search 3993When trying to fill delay slots, the maximum number of instructions to 3994consider when searching for a block with valid live register 3995information. Increasing this arbitrarily chosen value means more 3996aggressive optimization, increasing the compile time. This parameter 3997should be removed when the delay slot code is rewritten to maintain the 3998control-flow graph. 3999 4000@item max-gcse-memory 4001The approximate maximum amount of memory that will be allocated in 4002order to perform the global common subexpression elimination 4003optimization. If more memory than specified is required, the 4004optimization will not be done. 4005 4006@item max-gcse-passes 4007The maximum number of passes of GCSE to run. 4008 4009@item max-pending-list-length 4010The maximum number of pending dependencies scheduling will allow 4011before flushing the current state and starting over. Large functions 4012with few branches or calls can create excessively large lists which 4013needlessly consume memory and resources. 4014 4015@item max-inline-insns 4016If an function contains more than this many instructions, it 4017will not be inlined. This option is precisely equivalent to 4018@option{-finline-limit}. 4019 4020@end table 4021@end table 4022 4023@node Preprocessor Options 4024@section Options Controlling the Preprocessor 4025@cindex preprocessor options 4026@cindex options, preprocessor 4027 4028These options control the C preprocessor, which is run on each C source 4029file before actual compilation. 4030 4031If you use the @option{-E} option, nothing is done except preprocessing. 4032Some of these options make sense only together with @option{-E} because 4033they cause the preprocessor output to be unsuitable for actual 4034compilation. 4035 4036@opindex Wp 4037You can use @option{-Wp,@var{option}} to bypass the compiler driver 4038and pass @var{option} directly through to the preprocessor. If 4039@var{option} contains commas, it is split into multiple options at the 4040commas. However, many options are modified, translated or interpreted 4041by the compiler driver before being passed to the preprocessor, and 4042@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 4043interface is undocumented and subject to change, so whenever possible 4044you should avoid using @option{-Wp} and let the driver handle the 4045options instead. 4046 4047@include cppopts.texi 4048 4049@node Assembler Options 4050@section Passing Options to the Assembler 4051 4052@c prevent bad page break with this line 4053You can pass options to the assembler. 4054 4055@table @gcctabopt 4056@item -Wa,@var{option} 4057@opindex Wa 4058Pass @var{option} as an option to the assembler. If @var{option} 4059contains commas, it is split into multiple options at the commas. 4060@end table 4061 4062@node Link Options 4063@section Options for Linking 4064@cindex link options 4065@cindex options, linking 4066 4067These options come into play when the compiler links object files into 4068an executable output file. They are meaningless if the compiler is 4069not doing a link step. 4070 4071@table @gcctabopt 4072@cindex file names 4073@item @var{object-file-name} 4074A file name that does not end in a special recognized suffix is 4075considered to name an object file or library. (Object files are 4076distinguished from libraries by the linker according to the file 4077contents.) If linking is done, these object files are used as input 4078to the linker. 4079 4080@item -c 4081@itemx -S 4082@itemx -E 4083@opindex c 4084@opindex S 4085@opindex E 4086If any of these options is used, then the linker is not run, and 4087object file names should not be used as arguments. @xref{Overall 4088Options}. 4089 4090@cindex Libraries 4091@item -l@var{library} 4092@itemx -l @var{library} 4093@opindex l 4094Search the library named @var{library} when linking. (The second 4095alternative with the library as a separate argument is only for 4096POSIX compliance and is not recommended.) 4097 4098It makes a difference where in the command you write this option; the 4099linker searches and processes libraries and object files in the order they 4100are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 4101after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 4102to functions in @samp{z}, those functions may not be loaded. 4103 4104The linker searches a standard list of directories for the library, 4105which is actually a file named @file{lib@var{library}.a}. The linker 4106then uses this file as if it had been specified precisely by name. 4107 4108The directories searched include several standard system directories 4109plus any that you specify with @option{-L}. 4110 4111Normally the files found this way are library files---archive files 4112whose members are object files. The linker handles an archive file by 4113scanning through it for members which define symbols that have so far 4114been referenced but not defined. But if the file that is found is an 4115ordinary object file, it is linked in the usual fashion. The only 4116difference between using an @option{-l} option and specifying a file name 4117is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 4118and searches several directories. 4119 4120@item -lobjc 4121@opindex lobjc 4122You need this special case of the @option{-l} option in order to 4123link an Objective-C program. 4124 4125@item -nostartfiles 4126@opindex nostartfiles 4127Do not use the standard system startup files when linking. 4128The standard system libraries are used normally, unless @option{-nostdlib} 4129or @option{-nodefaultlibs} is used. 4130 4131@item -nodefaultlibs 4132@opindex nodefaultlibs 4133Do not use the standard system libraries when linking. 4134Only the libraries you specify will be passed to the linker. 4135The standard startup files are used normally, unless @option{-nostartfiles} 4136is used. The compiler may generate calls to memcmp, memset, and memcpy 4137for System V (and ISO C) environments or to bcopy and bzero for 4138BSD environments. These entries are usually resolved by entries in 4139libc. These entry points should be supplied through some other 4140mechanism when this option is specified. 4141 4142@item -nostdlib 4143@opindex nostdlib 4144Do not use the standard system startup files or libraries when linking. 4145No startup files and only the libraries you specify will be passed to 4146the linker. The compiler may generate calls to memcmp, memset, and memcpy 4147for System V (and ISO C) environments or to bcopy and bzero for 4148BSD environments. These entries are usually resolved by entries in 4149libc. These entry points should be supplied through some other 4150mechanism when this option is specified. 4151 4152@cindex @option{-lgcc}, use with @option{-nostdlib} 4153@cindex @option{-nostdlib} and unresolved references 4154@cindex unresolved references and @option{-nostdlib} 4155@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 4156@cindex @option{-nodefaultlibs} and unresolved references 4157@cindex unresolved references and @option{-nodefaultlibs} 4158One of the standard libraries bypassed by @option{-nostdlib} and 4159@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 4160that GCC uses to overcome shortcomings of particular machines, or special 4161needs for some languages. 4162(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 4163Collection (GCC) Internals}, 4164for more discussion of @file{libgcc.a}.) 4165In most cases, you need @file{libgcc.a} even when you want to avoid 4166other standard libraries. In other words, when you specify @option{-nostdlib} 4167or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 4168This ensures that you have no unresolved references to internal GCC 4169library subroutines. (For example, @samp{__main}, used to ensure C++ 4170constructors will be called; @pxref{Collect2,,@code{collect2}, gccint, 4171GNU Compiler Collection (GCC) Internals}.) 4172 4173@item -s 4174@opindex s 4175Remove all symbol table and relocation information from the executable. 4176 4177@item -static 4178@opindex static 4179On systems that support dynamic linking, this prevents linking with the shared 4180libraries. On other systems, this option has no effect. 4181 4182@item -shared 4183@opindex shared 4184Produce a shared object which can then be linked with other objects to 4185form an executable. Not all systems support this option. For predictable 4186results, you must also specify the same set of options that were used to 4187generate code (@option{-fpic}, @option{-fPIC}, or model suboptions) 4188when you specify this option.@footnote{On some systems, @samp{gcc -shared} 4189needs to build supplementary stub code for constructors to work. On 4190multi-libbed systems, @samp{gcc -shared} must select the correct support 4191libraries to link against. Failing to supply the correct flags may lead 4192to subtle defects. Supplying them in cases where they are not necessary 4193is innocuous.} 4194 4195@item -shared-libgcc 4196@itemx -static-libgcc 4197@opindex shared-libgcc 4198@opindex static-libgcc 4199On systems that provide @file{libgcc} as a shared library, these options 4200force the use of either the shared or static version respectively. 4201If no shared version of @file{libgcc} was built when the compiler was 4202configured, these options have no effect. 4203 4204There are several situations in which an application should use the 4205shared @file{libgcc} instead of the static version. The most common 4206of these is when the application wishes to throw and catch exceptions 4207across different shared libraries. In that case, each of the libraries 4208as well as the application itself should use the shared @file{libgcc}. 4209 4210Therefore, the G++ and GCJ drivers automatically add 4211@option{-shared-libgcc} whenever you build a shared library or a main 4212executable, because C++ and Java programs typically use exceptions, so 4213this is the right thing to do. 4214 4215If, instead, you use the GCC driver to create shared libraries, you may 4216find that they will not always be linked with the shared @file{libgcc}. 4217If GCC finds, at its configuration time, that you have a GNU linker that 4218does not support option @option{--eh-frame-hdr}, it will link the shared 4219version of @file{libgcc} into shared libraries by default. Otherwise, 4220it will take advantage of the linker and optimize away the linking with 4221the shared version of @file{libgcc}, linking with the static version of 4222libgcc by default. This allows exceptions to propagate through such 4223shared libraries, without incurring relocation costs at library load 4224time. 4225 4226However, if a library or main executable is supposed to throw or catch 4227exceptions, you must link it using the G++ or GCJ driver, as appropriate 4228for the languages used in the program, or using the option 4229@option{-shared-libgcc}, such that it is linked with the shared 4230@file{libgcc}. 4231 4232@item -symbolic 4233@opindex symbolic 4234Bind references to global symbols when building a shared object. Warn 4235about any unresolved references (unless overridden by the link editor 4236option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support 4237this option. 4238 4239@item -Xlinker @var{option} 4240@opindex Xlinker 4241Pass @var{option} as an option to the linker. You can use this to 4242supply system-specific linker options which GCC does not know how to 4243recognize. 4244 4245If you want to pass an option that takes an argument, you must use 4246@option{-Xlinker} twice, once for the option and once for the argument. 4247For example, to pass @option{-assert definitions}, you must write 4248@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write 4249@option{-Xlinker "-assert definitions"}, because this passes the entire 4250string as a single argument, which is not what the linker expects. 4251 4252@item -Wl,@var{option} 4253@opindex Wl 4254Pass @var{option} as an option to the linker. If @var{option} contains 4255commas, it is split into multiple options at the commas. 4256 4257@item -u @var{symbol} 4258@opindex u 4259Pretend the symbol @var{symbol} is undefined, to force linking of 4260library modules to define it. You can use @option{-u} multiple times with 4261different symbols to force loading of additional library modules. 4262@end table 4263 4264@node Directory Options 4265@section Options for Directory Search 4266@cindex directory options 4267@cindex options, directory search 4268@cindex search path 4269 4270These options specify directories to search for header files, for 4271libraries and for parts of the compiler: 4272 4273@table @gcctabopt 4274@item -I@var{dir} 4275@opindex I 4276Add the directory @var{dir} to the head of the list of directories to be 4277searched for header files. This can be used to override a system header 4278file, substituting your own version, since these directories are 4279searched before the system header file directories. However, you should 4280not use this option to add directories that contain vendor-supplied 4281system header files (use @option{-isystem} for that). If you use more than 4282one @option{-I} option, the directories are scanned in left-to-right 4283order; the standard system directories come after. 4284 4285If a standard system include directory, or a directory specified with 4286@option{-isystem}, is also specified with @option{-I}, the @option{-I} 4287option will be ignored. The directory will still be searched but as a 4288system directory at its normal position in the system include chain. 4289This is to ensure that GCC's procedure to fix buggy system headers and 4290the ordering for the include_next directive are not inadvertantly changed. 4291If you really need to change the search order for system directories, 4292use the @option{-nostdinc} and/or @option{-isystem} options. 4293 4294@item -I- 4295@opindex I- 4296Any directories you specify with @option{-I} options before the @option{-I-} 4297option are searched only for the case of @samp{#include "@var{file}"}; 4298they are not searched for @samp{#include <@var{file}>}. 4299 4300If additional directories are specified with @option{-I} options after 4301the @option{-I-}, these directories are searched for all @samp{#include} 4302directives. (Ordinarily @emph{all} @option{-I} directories are used 4303this way.) 4304 4305In addition, the @option{-I-} option inhibits the use of the current 4306directory (where the current input file came from) as the first search 4307directory for @samp{#include "@var{file}"}. There is no way to 4308override this effect of @option{-I-}. With @option{-I.} you can specify 4309searching the directory which was current when the compiler was 4310invoked. That is not exactly the same as what the preprocessor does 4311by default, but it is often satisfactory. 4312 4313@option{-I-} does not inhibit the use of the standard system directories 4314for header files. Thus, @option{-I-} and @option{-nostdinc} are 4315independent. 4316 4317@item -L@var{dir} 4318@opindex L 4319Add directory @var{dir} to the list of directories to be searched 4320for @option{-l}. 4321 4322@item -B@var{prefix} 4323@opindex B 4324This option specifies where to find the executables, libraries, 4325include files, and data files of the compiler itself. 4326 4327The compiler driver program runs one or more of the subprograms 4328@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries 4329@var{prefix} as a prefix for each program it tries to run, both with and 4330without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). 4331 4332For each subprogram to be run, the compiler driver first tries the 4333@option{-B} prefix, if any. If that name is not found, or if @option{-B} 4334was not specified, the driver tries two standard prefixes, which are 4335@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}. If neither of 4336those results in a file name that is found, the unmodified program 4337name is searched for using the directories specified in your 4338@env{PATH} environment variable. 4339 4340The compiler will check to see if the path provided by the @option{-B} 4341refers to a directory, and if necessary it will add a directory 4342separator character at the end of the path. 4343 4344@option{-B} prefixes that effectively specify directory names also apply 4345to libraries in the linker, because the compiler translates these 4346options into @option{-L} options for the linker. They also apply to 4347includes files in the preprocessor, because the compiler translates these 4348options into @option{-isystem} options for the preprocessor. In this case, 4349the compiler appends @samp{include} to the prefix. 4350 4351The run-time support file @file{libgcc.a} can also be searched for using 4352the @option{-B} prefix, if needed. If it is not found there, the two 4353standard prefixes above are tried, and that is all. The file is left 4354out of the link if it is not found by those means. 4355 4356Another way to specify a prefix much like the @option{-B} prefix is to use 4357the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 4358Variables}. 4359 4360As a special kludge, if the path provided by @option{-B} is 4361@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 43629, then it will be replaced by @file{[dir/]include}. This is to help 4363with boot-strapping the compiler. 4364 4365@item -specs=@var{file} 4366@opindex specs 4367Process @var{file} after the compiler reads in the standard @file{specs} 4368file, in order to override the defaults that the @file{gcc} driver 4369program uses when determining what switches to pass to @file{cc1}, 4370@file{cc1plus}, @file{as}, @file{ld}, etc. More than one 4371@option{-specs=@var{file}} can be specified on the command line, and they 4372are processed in order, from left to right. 4373@end table 4374 4375@c man end 4376 4377@node Spec Files 4378@section Specifying subprocesses and the switches to pass to them 4379@cindex Spec Files 4380@command{gcc} is a driver program. It performs its job by invoking a 4381sequence of other programs to do the work of compiling, assembling and 4382linking. GCC interprets its command-line parameters and uses these to 4383deduce which programs it should invoke, and which command-line options 4384it ought to place on their command lines. This behavior is controlled 4385by @dfn{spec strings}. In most cases there is one spec string for each 4386program that GCC can invoke, but a few programs have multiple spec 4387strings to control their behavior. The spec strings built into GCC can 4388be overridden by using the @option{-specs=} command-line switch to specify 4389a spec file. 4390 4391@dfn{Spec files} are plaintext files that are used to construct spec 4392strings. They consist of a sequence of directives separated by blank 4393lines. The type of directive is determined by the first non-whitespace 4394character on the line and it can be one of the following: 4395 4396@table @code 4397@item %@var{command} 4398Issues a @var{command} to the spec file processor. The commands that can 4399appear here are: 4400 4401@table @code 4402@item %include <@var{file}> 4403@cindex %include 4404Search for @var{file} and insert its text at the current point in the 4405specs file. 4406 4407@item %include_noerr <@var{file}> 4408@cindex %include_noerr 4409Just like @samp{%include}, but do not generate an error message if the include 4410file cannot be found. 4411 4412@item %rename @var{old_name} @var{new_name} 4413@cindex %rename 4414Rename the spec string @var{old_name} to @var{new_name}. 4415 4416@end table 4417 4418@item *[@var{spec_name}]: 4419This tells the compiler to create, override or delete the named spec 4420string. All lines after this directive up to the next directive or 4421blank line are considered to be the text for the spec string. If this 4422results in an empty string then the spec will be deleted. (Or, if the 4423spec did not exist, then nothing will happened.) Otherwise, if the spec 4424does not currently exist a new spec will be created. If the spec does 4425exist then its contents will be overridden by the text of this 4426directive, unless the first character of that text is the @samp{+} 4427character, in which case the text will be appended to the spec. 4428 4429@item [@var{suffix}]: 4430Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 4431and up to the next directive or blank line are considered to make up the 4432spec string for the indicated suffix. When the compiler encounters an 4433input file with the named suffix, it will processes the spec string in 4434order to work out how to compile that file. For example: 4435 4436@smallexample 4437.ZZ: 4438z-compile -input %i 4439@end smallexample 4440 4441This says that any input file whose name ends in @samp{.ZZ} should be 4442passed to the program @samp{z-compile}, which should be invoked with the 4443command-line switch @option{-input} and with the result of performing the 4444@samp{%i} substitution. (See below.) 4445 4446As an alternative to providing a spec string, the text that follows a 4447suffix directive can be one of the following: 4448 4449@table @code 4450@item @@@var{language} 4451This says that the suffix is an alias for a known @var{language}. This is 4452similar to using the @option{-x} command-line switch to GCC to specify a 4453language explicitly. For example: 4454 4455@smallexample 4456.ZZ: 4457@@c++ 4458@end smallexample 4459 4460Says that .ZZ files are, in fact, C++ source files. 4461 4462@item #@var{name} 4463This causes an error messages saying: 4464 4465@smallexample 4466@var{name} compiler not installed on this system. 4467@end smallexample 4468@end table 4469 4470GCC already has an extensive list of suffixes built into it. 4471This directive will add an entry to the end of the list of suffixes, but 4472since the list is searched from the end backwards, it is effectively 4473possible to override earlier entries using this technique. 4474 4475@end table 4476 4477GCC has the following spec strings built into it. Spec files can 4478override these strings or create their own. Note that individual 4479targets can also add their own spec strings to this list. 4480 4481@smallexample 4482asm Options to pass to the assembler 4483asm_final Options to pass to the assembler post-processor 4484cpp Options to pass to the C preprocessor 4485cc1 Options to pass to the C compiler 4486cc1plus Options to pass to the C++ compiler 4487endfile Object files to include at the end of the link 4488link Options to pass to the linker 4489lib Libraries to include on the command line to the linker 4490libgcc Decides which GCC support library to pass to the linker 4491linker Sets the name of the linker 4492predefines Defines to be passed to the C preprocessor 4493signed_char Defines to pass to CPP to say whether @code{char} is signed 4494 by default 4495startfile Object files to include at the start of the link 4496@end smallexample 4497 4498Here is a small example of a spec file: 4499 4500@smallexample 4501%rename lib old_lib 4502 4503*lib: 4504--start-group -lgcc -lc -leval1 --end-group %(old_lib) 4505@end smallexample 4506 4507This example renames the spec called @samp{lib} to @samp{old_lib} and 4508then overrides the previous definition of @samp{lib} with a new one. 4509The new definition adds in some extra command-line options before 4510including the text of the old definition. 4511 4512@dfn{Spec strings} are a list of command-line options to be passed to their 4513corresponding program. In addition, the spec strings can contain 4514@samp{%}-prefixed sequences to substitute variable text or to 4515conditionally insert text into the command line. Using these constructs 4516it is possible to generate quite complex command lines. 4517 4518Here is a table of all defined @samp{%}-sequences for spec 4519strings. Note that spaces are not generated automatically around the 4520results of expanding these sequences. Therefore you can concatenate them 4521together or combine them with constant text in a single argument. 4522 4523@table @code 4524@item %% 4525Substitute one @samp{%} into the program name or argument. 4526 4527@item %i 4528Substitute the name of the input file being processed. 4529 4530@item %b 4531Substitute the basename of the input file being processed. 4532This is the substring up to (and not including) the last period 4533and not including the directory. 4534 4535@item %B 4536This is the same as @samp{%b}, but include the file suffix (text after 4537the last period). 4538 4539@item %d 4540Marks the argument containing or following the @samp{%d} as a 4541temporary file name, so that that file will be deleted if GCC exits 4542successfully. Unlike @samp{%g}, this contributes no text to the 4543argument. 4544 4545@item %g@var{suffix} 4546Substitute a file name that has suffix @var{suffix} and is chosen 4547once per compilation, and mark the argument in the same way as 4548@samp{%d}. To reduce exposure to denial-of-service attacks, the file 4549name is now chosen in a way that is hard to predict even when previously 4550chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 4551might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 4552the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 4553treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 4554was simply substituted with a file name chosen once per compilation, 4555without regard to any appended suffix (which was therefore treated 4556just like ordinary text), making such attacks more likely to succeed. 4557 4558@item %u@var{suffix} 4559Like @samp{%g}, but generates a new temporary file name even if 4560@samp{%u@var{suffix}} was already seen. 4561 4562@item %U@var{suffix} 4563Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 4564new one if there is no such last file name. In the absence of any 4565@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 4566the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 4567would involve the generation of two distinct file names, one 4568for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 4569simply substituted with a file name chosen for the previous @samp{%u}, 4570without regard to any appended suffix. 4571 4572@item %j@var{SUFFIX} 4573Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 4574writable, and if save-temps is off; otherwise, substitute the name 4575of a temporary file, just like @samp{%u}. This temporary file is not 4576meant for communication between processes, but rather as a junk 4577disposal mechanism. 4578 4579@item %.@var{SUFFIX} 4580Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 4581when it is subsequently output with @samp{%*}. @var{SUFFIX} is 4582terminated by the next space or %. 4583 4584@item %w 4585Marks the argument containing or following the @samp{%w} as the 4586designated output file of this compilation. This puts the argument 4587into the sequence of arguments that @samp{%o} will substitute later. 4588 4589@item %o 4590Substitutes the names of all the output files, with spaces 4591automatically placed around them. You should write spaces 4592around the @samp{%o} as well or the results are undefined. 4593@samp{%o} is for use in the specs for running the linker. 4594Input files whose names have no recognized suffix are not compiled 4595at all, but they are included among the output files, so they will 4596be linked. 4597 4598@item %O 4599Substitutes the suffix for object files. Note that this is 4600handled specially when it immediately follows @samp{%g, %u, or %U}, 4601because of the need for those to form complete file names. The 4602handling is such that @samp{%O} is treated exactly as if it had already 4603been substituted, except that @samp{%g, %u, and %U} do not currently 4604support additional @var{suffix} characters following @samp{%O} as they would 4605following, for example, @samp{.o}. 4606 4607@item %p 4608Substitutes the standard macro predefinitions for the 4609current target machine. Use this when running @code{cpp}. 4610 4611@item %P 4612Like @samp{%p}, but puts @samp{__} before and after the name of each 4613predefined macro, except for macros that start with @samp{__} or with 4614@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 4615C@. 4616 4617@item %I 4618Substitute a @option{-iprefix} option made from @env{GCC_EXEC_PREFIX}. 4619 4620@item %s 4621Current argument is the name of a library or startup file of some sort. 4622Search for that file in a standard list of directories and substitute 4623the full name found. 4624 4625@item %e@var{str} 4626Print @var{str} as an error message. @var{str} is terminated by a newline. 4627Use this when inconsistent options are detected. 4628 4629@item %| 4630Output @samp{-} if the input for the current command is coming from a pipe. 4631 4632@item %(@var{name}) 4633Substitute the contents of spec string @var{name} at this point. 4634 4635@item %[@var{name}] 4636Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments. 4637 4638@item %x@{@var{option}@} 4639Accumulate an option for @samp{%X}. 4640 4641@item %X 4642Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 4643spec string. 4644 4645@item %Y 4646Output the accumulated assembler options specified by @option{-Wa}. 4647 4648@item %Z 4649Output the accumulated preprocessor options specified by @option{-Wp}. 4650 4651@item %v1 4652Substitute the major version number of GCC@. 4653(For version 2.9.5, this is 2.) 4654 4655@item %v2 4656Substitute the minor version number of GCC@. 4657(For version 2.9.5, this is 9.) 4658 4659@item %v3 4660Substitute the patch level number of GCC@. 4661(For version 2.9.5, this is 5.) 4662 4663@item %a 4664Process the @code{asm} spec. This is used to compute the 4665switches to be passed to the assembler. 4666 4667@item %A 4668Process the @code{asm_final} spec. This is a spec string for 4669passing switches to an assembler post-processor, if such a program is 4670needed. 4671 4672@item %l 4673Process the @code{link} spec. This is the spec for computing the 4674command line passed to the linker. Typically it will make use of the 4675@samp{%L %G %S %D and %E} sequences. 4676 4677@item %D 4678Dump out a @option{-L} option for each directory that GCC believes might 4679contain startup files. If the target supports multilibs then the 4680current multilib directory will be prepended to each of these paths. 4681 4682@item %M 4683Output the multilib directory with directory separators replaced with 4684@samp{_}. If multilib directories are not set, or the multilib directory is 4685@file{.} then this option emits nothing. 4686 4687@item %L 4688Process the @code{lib} spec. This is a spec string for deciding which 4689libraries should be included on the command line to the linker. 4690 4691@item %G 4692Process the @code{libgcc} spec. This is a spec string for deciding 4693which GCC support library should be included on the command line to the linker. 4694 4695@item %S 4696Process the @code{startfile} spec. This is a spec for deciding which 4697object files should be the first ones passed to the linker. Typically 4698this might be a file named @file{crt0.o}. 4699 4700@item %E 4701Process the @code{endfile} spec. This is a spec string that specifies 4702the last object files that will be passed to the linker. 4703 4704@item %C 4705Process the @code{cpp} spec. This is used to construct the arguments 4706to be passed to the C preprocessor. 4707 4708@item %c 4709Process the @code{signed_char} spec. This is intended to be used 4710to tell cpp whether a char is signed. It typically has the definition: 4711@smallexample 4712%@{funsigned-char:-D__CHAR_UNSIGNED__@} 4713@end smallexample 4714 4715@item %1 4716Process the @code{cc1} spec. This is used to construct the options to be 4717passed to the actual C compiler (@samp{cc1}). 4718 4719@item %2 4720Process the @code{cc1plus} spec. This is used to construct the options to be 4721passed to the actual C++ compiler (@samp{cc1plus}). 4722 4723@item %* 4724Substitute the variable part of a matched option. See below. 4725Note that each comma in the substituted string is replaced by 4726a single space. 4727 4728@item %@{@code{S}@} 4729Substitutes the @code{-S} switch, if that switch was given to GCC@. 4730If that switch was not specified, this substitutes nothing. Note that 4731the leading dash is omitted when specifying this option, and it is 4732automatically inserted if the substitution is performed. Thus the spec 4733string @samp{%@{foo@}} would match the command-line option @option{-foo} 4734and would output the command line option @option{-foo}. 4735 4736@item %W@{@code{S}@} 4737Like %@{@code{S}@} but mark last argument supplied within as a file to be 4738deleted on failure. 4739 4740@item %@{@code{S}*@} 4741Substitutes all the switches specified to GCC whose names start 4742with @code{-S}, but which also take an argument. This is used for 4743switches like @option{-o}, @option{-D}, @option{-I}, etc. 4744GCC considers @option{-o foo} as being 4745one switch whose names starts with @samp{o}. %@{o*@} would substitute this 4746text, including the space. Thus two arguments would be generated. 4747 4748@item %@{^@code{S}*@} 4749Like %@{@code{S}*@}, but don't put a blank between a switch and its 4750argument. Thus %@{^o*@} would only generate one argument, not two. 4751 4752@item %@{@code{S}*&@code{T}*@} 4753Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 4754(the order of @code{S} and @code{T} in the spec is not significant). 4755There can be any number of ampersand-separated variables; for each the 4756wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 4757 4758@item %@{<@code{S}@} 4759Remove all occurrences of @code{-S} from the command line. Note---this 4760command is position dependent. @samp{%} commands in the spec string 4761before this option will see @code{-S}, @samp{%} commands in the spec 4762string after this option will not. 4763 4764@item %@{@code{S}*:@code{X}@} 4765Substitutes @code{X} if one or more switches whose names start with 4766@code{-S} are specified to GCC@. Note that the tail part of the 4767@code{-S} option (i.e.@: the part matched by the @samp{*}) will be substituted 4768for each occurrence of @samp{%*} within @code{X}. 4769 4770@item %@{@code{S}:@code{X}@} 4771Substitutes @code{X}, but only if the @samp{-S} switch was given to GCC@. 4772 4773@item %@{!@code{S}:@code{X}@} 4774Substitutes @code{X}, but only if the @samp{-S} switch was @emph{not} given to GCC@. 4775 4776@item %@{|@code{S}:@code{X}@} 4777Like %@{@code{S}:@code{X}@}, but if no @code{S} switch, substitute @samp{-}. 4778 4779@item %@{|!@code{S}:@code{X}@} 4780Like %@{!@code{S}:@code{X}@}, but if there is an @code{S} switch, substitute @samp{-}. 4781 4782@item %@{.@code{S}:@code{X}@} 4783Substitutes @code{X}, but only if processing a file with suffix @code{S}. 4784 4785@item %@{!.@code{S}:@code{X}@} 4786Substitutes @code{X}, but only if @emph{not} processing a file with suffix @code{S}. 4787 4788@item %@{@code{S}|@code{P}:@code{X}@} 4789Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. This may be 4790combined with @samp{!} and @samp{.} sequences as well, although they 4791have a stronger binding than the @samp{|}. For example a spec string 4792like this: 4793 4794@smallexample 4795%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 4796@end smallexample 4797 4798will output the following command-line options from the following input 4799command-line options: 4800 4801@smallexample 4802fred.c -foo -baz 4803jim.d -bar -boggle 4804-d fred.c -foo -baz -boggle 4805-d jim.d -bar -baz -boggle 4806@end smallexample 4807 4808@end table 4809 4810The conditional text @code{X} in a %@{@code{S}:@code{X}@} or 4811%@{!@code{S}:@code{X}@} construct may contain other nested @samp{%} constructs 4812or spaces, or even newlines. They are processed as usual, as described 4813above. 4814 4815The @option{-O}, @option{-f}, @option{-m}, and @option{-W} 4816switches are handled specifically in these 4817constructs. If another value of @option{-O} or the negated form of a @option{-f}, @option{-m}, or 4818@option{-W} switch is found later in the command line, the earlier switch 4819value is ignored, except with @{@code{S}*@} where @code{S} is just one 4820letter, which passes all matching options. 4821 4822The character @samp{|} at the beginning of the predicate text is used to indicate 4823that a command should be piped to the following command, but only if @option{-pipe} 4824is specified. 4825 4826It is built into GCC which switches take arguments and which do not. 4827(You might think it would be useful to generalize this to allow each 4828compiler's spec to say which switches take arguments. But this cannot 4829be done in a consistent fashion. GCC cannot even decide which input 4830files have been specified without knowing which switches take arguments, 4831and it must know which input files to compile in order to tell which 4832compilers to run). 4833 4834GCC also knows implicitly that arguments starting in @option{-l} are to be 4835treated as compiler output files, and passed to the linker in their 4836proper position among the other output files. 4837 4838@c man begin OPTIONS 4839 4840@node Target Options 4841@section Specifying Target Machine and Compiler Version 4842@cindex target options 4843@cindex cross compiling 4844@cindex specifying machine version 4845@cindex specifying compiler version and target machine 4846@cindex compiler version, specifying 4847@cindex target machine, specifying 4848 4849By default, GCC compiles code for the same type of machine that you 4850are using. However, it can also be installed as a cross-compiler, to 4851compile for some other type of machine. In fact, several different 4852configurations of GCC, for different target machines, can be 4853installed side by side. Then you specify which one to use with the 4854@option{-b} option. 4855 4856In addition, older and newer versions of GCC can be installed side 4857by side. One of them (probably the newest) will be the default, but 4858you may sometimes wish to use another. 4859 4860@table @gcctabopt 4861@item -b @var{machine} 4862@opindex b 4863The argument @var{machine} specifies the target machine for compilation. 4864This is useful when you have installed GCC as a cross-compiler. 4865 4866The value to use for @var{machine} is the same as was specified as the 4867machine type when configuring GCC as a cross-compiler. For 4868example, if a cross-compiler was configured with @samp{configure 4869i386v}, meaning to compile for an 80386 running System V, then you 4870would specify @option{-b i386v} to run that cross compiler. 4871 4872When you do not specify @option{-b}, it normally means to compile for 4873the same type of machine that you are using. 4874 4875@item -V @var{version} 4876@opindex V 4877The argument @var{version} specifies which version of GCC to run. 4878This is useful when multiple versions are installed. For example, 4879@var{version} might be @samp{2.0}, meaning to run GCC version 2.0. 4880 4881The default version, when you do not specify @option{-V}, is the last 4882version of GCC that you installed. 4883@end table 4884 4885The @option{-b} and @option{-V} options actually work by controlling part of 4886the file name used for the executable files and libraries used for 4887compilation. A given version of GCC, for a given target machine, is 4888normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}. 4889 4890Thus, sites can customize the effect of @option{-b} or @option{-V} either by 4891changing the names of these directories or adding alternate names (or 4892symbolic links). If in directory @file{/usr/local/lib/gcc-lib/} the 4893file @file{80386} is a link to the file @file{i386v}, then @option{-b 489480386} becomes an alias for @option{-b i386v}. 4895 4896In one respect, the @option{-b} or @option{-V} do not completely change 4897to a different compiler: the top-level driver program @command{gcc} 4898that you originally invoked continues to run and invoke the other 4899executables (preprocessor, compiler per se, assembler and linker) 4900that do the real work. However, since no real work is done in the 4901driver program, it usually does not matter that the driver program 4902in use is not the one for the specified target. It is common for the 4903interface to the other executables to change incompatibly between 4904compiler versions, so unless the version specified is very close to that 4905of the driver (for example, @option{-V 3.0} with a driver program from GCC 4906version 3.0.1), use of @option{-V} may not work; for example, using 4907@option{-V 2.95.2} will not work with a driver program from GCC 3.0. 4908 4909The only way that the driver program depends on the target machine is 4910in the parsing and handling of special machine-specific options. 4911However, this is controlled by a file which is found, along with the 4912other executables, in the directory for the specified version and 4913target machine. As a result, a single installed driver program adapts 4914to any specified target machine, and sufficiently similar compiler 4915versions. 4916 4917The driver program executable does control one significant thing, 4918however: the default version and target machine. Therefore, you can 4919install different instances of the driver program, compiled for 4920different targets or versions, under different names. 4921 4922For example, if the driver for version 2.0 is installed as @command{ogcc} 4923and that for version 2.1 is installed as @command{gcc}, then the command 4924@command{gcc} will use version 2.1 by default, while @command{ogcc} will use 49252.0 by default. However, you can choose either version with either 4926command with the @option{-V} option. 4927 4928@node Submodel Options 4929@section Hardware Models and Configurations 4930@cindex submodel options 4931@cindex specifying hardware config 4932@cindex hardware models and configurations, specifying 4933@cindex machine dependent options 4934 4935Earlier we discussed the standard option @option{-b} which chooses among 4936different installed compilers for completely different target 4937machines, such as VAX vs.@: 68000 vs.@: 80386. 4938 4939In addition, each of these target machine types can have its own 4940special options, starting with @samp{-m}, to choose among various 4941hardware models or configurations---for example, 68010 vs 68020, 4942floating coprocessor or none. A single installed version of the 4943compiler can compile for any model or configuration, according to the 4944options specified. 4945 4946Some configurations of the compiler also support additional special 4947options, usually for compatibility with other compilers on the same 4948platform. 4949 4950These options are defined by the macro @code{TARGET_SWITCHES} in the 4951machine description. The default for the options is also defined by 4952that macro, which enables you to change the defaults. 4953 4954@menu 4955* M680x0 Options:: 4956* M68hc1x Options:: 4957* VAX Options:: 4958* SPARC Options:: 4959* Convex Options:: 4960* AMD29K Options:: 4961* ARM Options:: 4962* MN10200 Options:: 4963* MN10300 Options:: 4964* M32R/D Options:: 4965* M88K Options:: 4966* RS/6000 and PowerPC Options:: 4967* RT Options:: 4968* MIPS Options:: 4969* i386 and x86-64 Options:: 4970* HPPA Options:: 4971* Intel 960 Options:: 4972* DEC Alpha Options:: 4973* DEC Alpha/VMS Options:: 4974* Clipper Options:: 4975* H8/300 Options:: 4976* SH Options:: 4977* System V Options:: 4978* TMS320C3x/C4x Options:: 4979* V850 Options:: 4980* ARC Options:: 4981* NS32K Options:: 4982* AVR Options:: 4983* MCore Options:: 4984* IA-64 Options:: 4985* D30V Options:: 4986* S/390 and zSeries Options:: 4987* CRIS Options:: 4988* MMIX Options:: 4989* PDP-11 Options:: 4990* Xstormy16 Options:: 4991* Xtensa Options:: 4992@end menu 4993 4994@node M680x0 Options 4995@subsection M680x0 Options 4996@cindex M680x0 options 4997 4998These are the @samp{-m} options defined for the 68000 series. The default 4999values for these options depends on which style of 68000 was selected when 5000the compiler was configured; the defaults for the most common choices are 5001given below. 5002 5003@table @gcctabopt 5004@item -m68000 5005@itemx -mc68000 5006@opindex m68000 5007@opindex mc68000 5008Generate output for a 68000. This is the default 5009when the compiler is configured for 68000-based systems. 5010 5011Use this option for microcontrollers with a 68000 or EC000 core, 5012including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 5013 5014@item -m68020 5015@itemx -mc68020 5016@opindex m68020 5017@opindex mc68020 5018Generate output for a 68020. This is the default 5019when the compiler is configured for 68020-based systems. 5020 5021@item -m68881 5022@opindex m68881 5023Generate output containing 68881 instructions for floating point. 5024This is the default for most 68020 systems unless @option{--nfp} was 5025specified when the compiler was configured. 5026 5027@item -m68030 5028@opindex m68030 5029Generate output for a 68030. This is the default when the compiler is 5030configured for 68030-based systems. 5031 5032@item -m68040 5033@opindex m68040 5034Generate output for a 68040. This is the default when the compiler is 5035configured for 68040-based systems. 5036 5037This option inhibits the use of 68881/68882 instructions that have to be 5038emulated by software on the 68040. Use this option if your 68040 does not 5039have code to emulate those instructions. 5040 5041@item -m68060 5042@opindex m68060 5043Generate output for a 68060. This is the default when the compiler is 5044configured for 68060-based systems. 5045 5046This option inhibits the use of 68020 and 68881/68882 instructions that 5047have to be emulated by software on the 68060. Use this option if your 68060 5048does not have code to emulate those instructions. 5049 5050@item -mcpu32 5051@opindex mcpu32 5052Generate output for a CPU32. This is the default 5053when the compiler is configured for CPU32-based systems. 5054 5055Use this option for microcontrollers with a 5056CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 505768336, 68340, 68341, 68349 and 68360. 5058 5059@item -m5200 5060@opindex m5200 5061Generate output for a 520X ``coldfire'' family cpu. This is the default 5062when the compiler is configured for 520X-based systems. 5063 5064Use this option for microcontroller with a 5200 core, including 5065the MCF5202, MCF5203, MCF5204 and MCF5202. 5066 5067 5068@item -m68020-40 5069@opindex m68020-40 5070Generate output for a 68040, without using any of the new instructions. 5071This results in code which can run relatively efficiently on either a 507268020/68881 or a 68030 or a 68040. The generated code does use the 507368881 instructions that are emulated on the 68040. 5074 5075@item -m68020-60 5076@opindex m68020-60 5077Generate output for a 68060, without using any of the new instructions. 5078This results in code which can run relatively efficiently on either a 507968020/68881 or a 68030 or a 68040. The generated code does use the 508068881 instructions that are emulated on the 68060. 5081 5082@item -mfpa 5083@opindex mfpa 5084Generate output containing Sun FPA instructions for floating point. 5085 5086@item -msoft-float 5087@opindex msoft-float 5088Generate output containing library calls for floating point. 5089@strong{Warning:} the requisite libraries are not available for all m68k 5090targets. Normally the facilities of the machine's usual C compiler are 5091used, but this can't be done directly in cross-compilation. You must 5092make your own arrangements to provide suitable library functions for 5093cross-compilation. The embedded targets @samp{m68k-*-aout} and 5094@samp{m68k-*-coff} do provide software floating point support. 5095 5096@item -mshort 5097@opindex mshort 5098Consider type @code{int} to be 16 bits wide, like @code{short int}. 5099 5100@item -mnobitfield 5101@opindex mnobitfield 5102Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 5103and @option{-m5200} options imply @w{@option{-mnobitfield}}. 5104 5105@item -mbitfield 5106@opindex mbitfield 5107Do use the bit-field instructions. The @option{-m68020} option implies 5108@option{-mbitfield}. This is the default if you use a configuration 5109designed for a 68020. 5110 5111@item -mrtd 5112@opindex mrtd 5113Use a different function-calling convention, in which functions 5114that take a fixed number of arguments return with the @code{rtd} 5115instruction, which pops their arguments while returning. This 5116saves one instruction in the caller since there is no need to pop 5117the arguments there. 5118 5119This calling convention is incompatible with the one normally 5120used on Unix, so you cannot use it if you need to call libraries 5121compiled with the Unix compiler. 5122 5123Also, you must provide function prototypes for all functions that 5124take variable numbers of arguments (including @code{printf}); 5125otherwise incorrect code will be generated for calls to those 5126functions. 5127 5128In addition, seriously incorrect code will result if you call a 5129function with too many arguments. (Normally, extra arguments are 5130harmlessly ignored.) 5131 5132The @code{rtd} instruction is supported by the 68010, 68020, 68030, 513368040, 68060 and CPU32 processors, but not by the 68000 or 5200. 5134 5135@item -malign-int 5136@itemx -mno-align-int 5137@opindex malign-int 5138@opindex mno-align-int 5139Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 5140@code{float}, @code{double}, and @code{long double} variables on a 32-bit 5141boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 5142Aligning variables on 32-bit boundaries produces code that runs somewhat 5143faster on processors with 32-bit busses at the expense of more memory. 5144 5145@strong{Warning:} if you use the @option{-malign-int} switch, GCC will 5146align structures containing the above types differently than 5147most published application binary interface specifications for the m68k. 5148 5149@item -mpcrel 5150@opindex mpcrel 5151Use the pc-relative addressing mode of the 68000 directly, instead of 5152using a global offset table. At present, this option implies @option{-fpic}, 5153allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 5154not presently supported with @option{-mpcrel}, though this could be supported for 515568020 and higher processors. 5156 5157@item -mno-strict-align 5158@itemx -mstrict-align 5159@opindex mno-strict-align 5160@opindex mstrict-align 5161Do not (do) assume that unaligned memory references will be handled by 5162the system. 5163 5164@end table 5165 5166@node M68hc1x Options 5167@subsection M68hc1x Options 5168@cindex M68hc1x options 5169 5170These are the @samp{-m} options defined for the 68hc11 and 68hc12 5171microcontrollers. The default values for these options depends on 5172which style of microcontroller was selected when the compiler was configured; 5173the defaults for the most common choices are given below. 5174 5175@table @gcctabopt 5176@item -m6811 5177@itemx -m68hc11 5178@opindex m6811 5179@opindex m68hc11 5180Generate output for a 68HC11. This is the default 5181when the compiler is configured for 68HC11-based systems. 5182 5183@item -m6812 5184@itemx -m68hc12 5185@opindex m6812 5186@opindex m68hc12 5187Generate output for a 68HC12. This is the default 5188when the compiler is configured for 68HC12-based systems. 5189 5190@item -mauto-incdec 5191@opindex mauto-incdec 5192Enable the use of 68HC12 pre and post auto-increment and auto-decrement 5193addressing modes. 5194 5195@item -mshort 5196@opindex mshort 5197Consider type @code{int} to be 16 bits wide, like @code{short int}. 5198 5199@item -msoft-reg-count=@var{count} 5200@opindex msoft-reg-count 5201Specify the number of pseudo-soft registers which are used for the 5202code generation. The maximum number is 32. Using more pseudo-soft 5203register may or may not result in better code depending on the program. 5204The default is 4 for 68HC11 and 2 for 68HC12. 5205 5206@end table 5207 5208@node VAX Options 5209@subsection VAX Options 5210@cindex VAX options 5211 5212These @samp{-m} options are defined for the VAX: 5213 5214@table @gcctabopt 5215@item -munix 5216@opindex munix 5217Do not output certain jump instructions (@code{aobleq} and so on) 5218that the Unix assembler for the VAX cannot handle across long 5219ranges. 5220 5221@item -mgnu 5222@opindex mgnu 5223Do output those jump instructions, on the assumption that you 5224will assemble with the GNU assembler. 5225 5226@item -mg 5227@opindex mg 5228Output code for g-format floating point numbers instead of d-format. 5229@end table 5230 5231@node SPARC Options 5232@subsection SPARC Options 5233@cindex SPARC options 5234 5235These @samp{-m} switches are supported on the SPARC: 5236 5237@table @gcctabopt 5238@item -mno-app-regs 5239@itemx -mapp-regs 5240@opindex mno-app-regs 5241@opindex mapp-regs 5242Specify @option{-mapp-regs} to generate output using the global registers 52432 through 4, which the SPARC SVR4 ABI reserves for applications. This 5244is the default. 5245 5246To be fully SVR4 ABI compliant at the cost of some performance loss, 5247specify @option{-mno-app-regs}. You should compile libraries and system 5248software with this option. 5249 5250@item -mfpu 5251@itemx -mhard-float 5252@opindex mfpu 5253@opindex mhard-float 5254Generate output containing floating point instructions. This is the 5255default. 5256 5257@item -mno-fpu 5258@itemx -msoft-float 5259@opindex mno-fpu 5260@opindex msoft-float 5261Generate output containing library calls for floating point. 5262@strong{Warning:} the requisite libraries are not available for all SPARC 5263targets. Normally the facilities of the machine's usual C compiler are 5264used, but this cannot be done directly in cross-compilation. You must make 5265your own arrangements to provide suitable library functions for 5266cross-compilation. The embedded targets @samp{sparc-*-aout} and 5267@samp{sparclite-*-*} do provide software floating point support. 5268 5269@option{-msoft-float} changes the calling convention in the output file; 5270therefore, it is only useful if you compile @emph{all} of a program with 5271this option. In particular, you need to compile @file{libgcc.a}, the 5272library that comes with GCC, with @option{-msoft-float} in order for 5273this to work. 5274 5275@item -mhard-quad-float 5276@opindex mhard-quad-float 5277Generate output containing quad-word (long double) floating point 5278instructions. 5279 5280@item -msoft-quad-float 5281@opindex msoft-quad-float 5282Generate output containing library calls for quad-word (long double) 5283floating point instructions. The functions called are those specified 5284in the SPARC ABI@. This is the default. 5285 5286As of this writing, there are no sparc implementations that have hardware 5287support for the quad-word floating point instructions. They all invoke 5288a trap handler for one of these instructions, and then the trap handler 5289emulates the effect of the instruction. Because of the trap handler overhead, 5290this is much slower than calling the ABI library routines. Thus the 5291@option{-msoft-quad-float} option is the default. 5292 5293@item -mno-flat 5294@itemx -mflat 5295@opindex mno-flat 5296@opindex mflat 5297With @option{-mflat}, the compiler does not generate save/restore instructions 5298and will use a ``flat'' or single register window calling convention. 5299This model uses %i7 as the frame pointer and is compatible with the normal 5300register window model. Code from either may be intermixed. 5301The local registers and the input registers (0--5) are still treated as 5302``call saved'' registers and will be saved on the stack as necessary. 5303 5304With @option{-mno-flat} (the default), the compiler emits save/restore 5305instructions (except for leaf functions) and is the normal mode of operation. 5306 5307@item -mno-unaligned-doubles 5308@itemx -munaligned-doubles 5309@opindex mno-unaligned-doubles 5310@opindex munaligned-doubles 5311Assume that doubles have 8 byte alignment. This is the default. 5312 5313With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte 5314alignment only if they are contained in another type, or if they have an 5315absolute address. Otherwise, it assumes they have 4 byte alignment. 5316Specifying this option avoids some rare compatibility problems with code 5317generated by other compilers. It is not the default because it results 5318in a performance loss, especially for floating point code. 5319 5320@item -mno-faster-structs 5321@itemx -mfaster-structs 5322@opindex mno-faster-structs 5323@opindex mfaster-structs 5324With @option{-mfaster-structs}, the compiler assumes that structures 5325should have 8 byte alignment. This enables the use of pairs of 5326@code{ldd} and @code{std} instructions for copies in structure 5327assignment, in place of twice as many @code{ld} and @code{st} pairs. 5328However, the use of this changed alignment directly violates the Sparc 5329ABI@. Thus, it's intended only for use on targets where the developer 5330acknowledges that their resulting code will not be directly in line with 5331the rules of the ABI@. 5332 5333@item -mv8 5334@itemx -msparclite 5335@opindex mv8 5336@opindex msparclite 5337These two options select variations on the SPARC architecture. 5338 5339By default (unless specifically configured for the Fujitsu SPARClite), 5340GCC generates code for the v7 variant of the SPARC architecture. 5341 5342@option{-mv8} will give you SPARC v8 code. The only difference from v7 5343code is that the compiler emits the integer multiply and integer 5344divide instructions which exist in SPARC v8 but not in SPARC v7. 5345 5346@option{-msparclite} will give you SPARClite code. This adds the integer 5347multiply, integer divide step and scan (@code{ffs}) instructions which 5348exist in SPARClite but not in SPARC v7. 5349 5350These options are deprecated and will be deleted in a future GCC release. 5351They have been replaced with @option{-mcpu=xxx}. 5352 5353@item -mcypress 5354@itemx -msupersparc 5355@opindex mcypress 5356@opindex msupersparc 5357These two options select the processor for which the code is optimized. 5358 5359With @option{-mcypress} (the default), the compiler optimizes code for the 5360Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series. 5361This is also appropriate for the older SparcStation 1, 2, IPX etc. 5362 5363With @option{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as 5364used in the SparcStation 10, 1000 and 2000 series. This flag also enables use 5365of the full SPARC v8 instruction set. 5366 5367These options are deprecated and will be deleted in a future GCC release. 5368They have been replaced with @option{-mcpu=xxx}. 5369 5370@item -mcpu=@var{cpu_type} 5371@opindex mcpu 5372Set the instruction set, register set, and instruction scheduling parameters 5373for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 5374@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite}, 5375@samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934}, 5376@samp{sparclet}, @samp{tsc701}, @samp{v9}, and @samp{ultrasparc}. 5377 5378Default instruction scheduling parameters are used for values that select 5379an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 5380@samp{sparclite}, @samp{sparclet}, @samp{v9}. 5381 5382Here is a list of each supported architecture and their supported 5383implementations. 5384 5385@smallexample 5386 v7: cypress 5387 v8: supersparc, hypersparc 5388 sparclite: f930, f934, sparclite86x 5389 sparclet: tsc701 5390 v9: ultrasparc 5391@end smallexample 5392 5393@item -mtune=@var{cpu_type} 5394@opindex mtune 5395Set the instruction scheduling parameters for machine type 5396@var{cpu_type}, but do not set the instruction set or register set that the 5397option @option{-mcpu=@var{cpu_type}} would. 5398 5399The same values for @option{-mcpu=@var{cpu_type}} can be used for 5400@option{-mtune=@var{cpu_type}}, but the only useful values are those 5401that select a particular cpu implementation. Those are @samp{cypress}, 5402@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934}, 5403@samp{sparclite86x}, @samp{tsc701}, and @samp{ultrasparc}. 5404 5405@end table 5406 5407These @samp{-m} switches are supported in addition to the above 5408on the SPARCLET processor. 5409 5410@table @gcctabopt 5411@item -mlittle-endian 5412@opindex mlittle-endian 5413Generate code for a processor running in little-endian mode. 5414 5415@item -mlive-g0 5416@opindex mlive-g0 5417Treat register @code{%g0} as a normal register. 5418GCC will continue to clobber it as necessary but will not assume 5419it always reads as 0. 5420 5421@item -mbroken-saverestore 5422@opindex mbroken-saverestore 5423Generate code that does not use non-trivial forms of the @code{save} and 5424@code{restore} instructions. Early versions of the SPARCLET processor do 5425not correctly handle @code{save} and @code{restore} instructions used with 5426arguments. They correctly handle them used without arguments. A @code{save} 5427instruction used without arguments increments the current window pointer 5428but does not allocate a new stack frame. It is assumed that the window 5429overflow trap handler will properly handle this case as will interrupt 5430handlers. 5431@end table 5432 5433These @samp{-m} switches are supported in addition to the above 5434on SPARC V9 processors in 64-bit environments. 5435 5436@table @gcctabopt 5437@item -mlittle-endian 5438@opindex mlittle-endian 5439Generate code for a processor running in little-endian mode. 5440 5441@item -m32 5442@itemx -m64 5443@opindex m32 5444@opindex m64 5445Generate code for a 32-bit or 64-bit environment. 5446The 32-bit environment sets int, long and pointer to 32 bits. 5447The 64-bit environment sets int to 32 bits and long and pointer 5448to 64 bits. 5449 5450@item -mcmodel=medlow 5451@opindex mcmodel=medlow 5452Generate code for the Medium/Low code model: the program must be linked 5453in the low 32 bits of the address space. Pointers are 64 bits. 5454Programs can be statically or dynamically linked. 5455 5456@item -mcmodel=medmid 5457@opindex mcmodel=medmid 5458Generate code for the Medium/Middle code model: the program must be linked 5459in the low 44 bits of the address space, the text segment must be less than 54602G bytes, and data segment must be within 2G of the text segment. 5461Pointers are 64 bits. 5462 5463@item -mcmodel=medany 5464@opindex mcmodel=medany 5465Generate code for the Medium/Anywhere code model: the program may be linked 5466anywhere in the address space, the text segment must be less than 54672G bytes, and data segment must be within 2G of the text segment. 5468Pointers are 64 bits. 5469 5470@item -mcmodel=embmedany 5471@opindex mcmodel=embmedany 5472Generate code for the Medium/Anywhere code model for embedded systems: 5473assume a 32-bit text and a 32-bit data segment, both starting anywhere 5474(determined at link time). Register %g4 points to the base of the 5475data segment. Pointers are still 64 bits. 5476Programs are statically linked, PIC is not supported. 5477 5478@item -mstack-bias 5479@itemx -mno-stack-bias 5480@opindex mstack-bias 5481@opindex mno-stack-bias 5482With @option{-mstack-bias}, GCC assumes that the stack pointer, and 5483frame pointer if present, are offset by @minus{}2047 which must be added back 5484when making stack frame references. 5485Otherwise, assume no such offset is present. 5486@end table 5487 5488@node Convex Options 5489@subsection Convex Options 5490@cindex Convex options 5491 5492These @samp{-m} options are defined for Convex: 5493 5494@table @gcctabopt 5495@item -mc1 5496@opindex mc1 5497Generate output for C1. The code will run on any Convex machine. 5498The preprocessor symbol @code{__convex__c1__} is defined. 5499 5500@item -mc2 5501@opindex mc2 5502Generate output for C2. Uses instructions not available on C1. 5503Scheduling and other optimizations are chosen for max performance on C2. 5504The preprocessor symbol @code{__convex_c2__} is defined. 5505 5506@item -mc32 5507@opindex mc32 5508Generate output for C32xx. Uses instructions not available on C1. 5509Scheduling and other optimizations are chosen for max performance on C32. 5510The preprocessor symbol @code{__convex_c32__} is defined. 5511 5512@item -mc34 5513@opindex mc34 5514Generate output for C34xx. Uses instructions not available on C1. 5515Scheduling and other optimizations are chosen for max performance on C34. 5516The preprocessor symbol @code{__convex_c34__} is defined. 5517 5518@item -mc38 5519@opindex mc38 5520Generate output for C38xx. Uses instructions not available on C1. 5521Scheduling and other optimizations are chosen for max performance on C38. 5522The preprocessor symbol @code{__convex_c38__} is defined. 5523 5524@item -margcount 5525@opindex margcount 5526Generate code which puts an argument count in the word preceding each 5527argument list. This is compatible with regular CC, and a few programs 5528may need the argument count word. GDB and other source-level debuggers 5529do not need it; this info is in the symbol table. 5530 5531@item -mnoargcount 5532@opindex mnoargcount 5533Omit the argument count word. This is the default. 5534 5535@item -mvolatile-cache 5536@opindex mvolatile-cache 5537Allow volatile references to be cached. This is the default. 5538 5539@item -mvolatile-nocache 5540@opindex mvolatile-nocache 5541Volatile references bypass the data cache, going all the way to memory. 5542This is only needed for multi-processor code that does not use standard 5543synchronization instructions. Making non-volatile references to volatile 5544locations will not necessarily work. 5545 5546@item -mlong32 5547@opindex mlong32 5548Type long is 32 bits, the same as type int. This is the default. 5549 5550@item -mlong64 5551@opindex mlong64 5552Type long is 64 bits, the same as type long long. This option is useless, 5553because no library support exists for it. 5554@end table 5555 5556@node AMD29K Options 5557@subsection AMD29K Options 5558@cindex AMD29K options 5559 5560These @samp{-m} options are defined for the AMD Am29000: 5561 5562@table @gcctabopt 5563@item -mdw 5564@opindex mdw 5565@cindex DW bit (29k) 5566Generate code that assumes the @code{DW} bit is set, i.e., that byte and 5567halfword operations are directly supported by the hardware. This is the 5568default. 5569 5570@item -mndw 5571@opindex mndw 5572Generate code that assumes the @code{DW} bit is not set. 5573 5574@item -mbw 5575@opindex mbw 5576@cindex byte writes (29k) 5577Generate code that assumes the system supports byte and halfword write 5578operations. This is the default. 5579 5580@item -mnbw 5581@opindex mnbw 5582Generate code that assumes the systems does not support byte and 5583halfword write operations. @option{-mnbw} implies @option{-mndw}. 5584 5585@item -msmall 5586@opindex msmall 5587@cindex memory model (29k) 5588Use a small memory model that assumes that all function addresses are 5589either within a single 256 KB segment or at an absolute address of less 5590than 256k. This allows the @code{call} instruction to be used instead 5591of a @code{const}, @code{consth}, @code{calli} sequence. 5592 5593@item -mnormal 5594@opindex mnormal 5595Use the normal memory model: Generate @code{call} instructions only when 5596calling functions in the same file and @code{calli} instructions 5597otherwise. This works if each file occupies less than 256 KB but allows 5598the entire executable to be larger than 256 KB@. This is the default. 5599 5600@item -mlarge 5601@opindex mlarge 5602Always use @code{calli} instructions. Specify this option if you expect 5603a single file to compile into more than 256 KB of code. 5604 5605@item -m29050 5606@opindex m29050 5607@cindex processor selection (29k) 5608Generate code for the Am29050. 5609 5610@item -m29000 5611@opindex m29000 5612Generate code for the Am29000. This is the default. 5613 5614@item -mkernel-registers 5615@opindex mkernel-registers 5616@cindex kernel and user registers (29k) 5617Generate references to registers @code{gr64-gr95} instead of to 5618registers @code{gr96-gr127}. This option can be used when compiling 5619kernel code that wants a set of global registers disjoint from that used 5620by user-mode code. 5621 5622Note that when this option is used, register names in @samp{-f} flags 5623must use the normal, user-mode, names. 5624 5625@item -muser-registers 5626@opindex muser-registers 5627Use the normal set of global registers, @code{gr96-gr127}. This is the 5628default. 5629 5630@item -mstack-check 5631@itemx -mno-stack-check 5632@opindex mstack-check 5633@opindex mno-stack-check 5634@cindex stack checks (29k) 5635Insert (or do not insert) a call to @code{__msp_check} after each stack 5636adjustment. This is often used for kernel code. 5637 5638@item -mstorem-bug 5639@itemx -mno-storem-bug 5640@opindex mstorem-bug 5641@opindex mno-storem-bug 5642@cindex storem bug (29k) 5643@option{-mstorem-bug} handles 29k processors which cannot handle the 5644separation of a mtsrim insn and a storem instruction (most 29000 chips 5645to date, but not the 29050). 5646 5647@item -mno-reuse-arg-regs 5648@itemx -mreuse-arg-regs 5649@opindex mno-reuse-arg-regs 5650@opindex mreuse-arg-regs 5651@option{-mno-reuse-arg-regs} tells the compiler to only use incoming argument 5652registers for copying out arguments. This helps detect calling a function 5653with fewer arguments than it was declared with. 5654 5655@item -mno-impure-text 5656@itemx -mimpure-text 5657@opindex mno-impure-text 5658@opindex mimpure-text 5659@option{-mimpure-text}, used in addition to @option{-shared}, tells the compiler to 5660not pass @option{-assert pure-text} to the linker when linking a shared object. 5661 5662@item -msoft-float 5663@opindex msoft-float 5664Generate output containing library calls for floating point. 5665@strong{Warning:} the requisite libraries are not part of GCC@. 5666Normally the facilities of the machine's usual C compiler are used, but 5667this can't be done directly in cross-compilation. You must make your 5668own arrangements to provide suitable library functions for 5669cross-compilation. 5670 5671@item -mno-multm 5672@opindex mno-multm 5673Do not generate multm or multmu instructions. This is useful for some embedded 5674systems which do not have trap handlers for these instructions. 5675@end table 5676 5677@node ARM Options 5678@subsection ARM Options 5679@cindex ARM options 5680 5681These @samp{-m} options are defined for Advanced RISC Machines (ARM) 5682architectures: 5683 5684@table @gcctabopt 5685@item -mapcs-frame 5686@opindex mapcs-frame 5687Generate a stack frame that is compliant with the ARM Procedure Call 5688Standard for all functions, even if this is not strictly necessary for 5689correct execution of the code. Specifying @option{-fomit-frame-pointer} 5690with this option will cause the stack frames not to be generated for 5691leaf functions. The default is @option{-mno-apcs-frame}. 5692 5693@item -mapcs 5694@opindex mapcs 5695This is a synonym for @option{-mapcs-frame}. 5696 5697@item -mapcs-26 5698@opindex mapcs-26 5699Generate code for a processor running with a 26-bit program counter, 5700and conforming to the function calling standards for the APCS 26-bit 5701option. This option replaces the @option{-m2} and @option{-m3} options 5702of previous releases of the compiler. 5703 5704@item -mapcs-32 5705@opindex mapcs-32 5706Generate code for a processor running with a 32-bit program counter, 5707and conforming to the function calling standards for the APCS 32-bit 5708option. This option replaces the @option{-m6} option of previous releases 5709of the compiler. 5710 5711@ignore 5712@c not currently implemented 5713@item -mapcs-stack-check 5714@opindex mapcs-stack-check 5715Generate code to check the amount of stack space available upon entry to 5716every function (that actually uses some stack space). If there is 5717insufficient space available then either the function 5718@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be 5719called, depending upon the amount of stack space required. The run time 5720system is required to provide these functions. The default is 5721@option{-mno-apcs-stack-check}, since this produces smaller code. 5722 5723@c not currently implemented 5724@item -mapcs-float 5725@opindex mapcs-float 5726Pass floating point arguments using the float point registers. This is 5727one of the variants of the APCS@. This option is recommended if the 5728target hardware has a floating point unit or if a lot of floating point 5729arithmetic is going to be performed by the code. The default is 5730@option{-mno-apcs-float}, since integer only code is slightly increased in 5731size if @option{-mapcs-float} is used. 5732 5733@c not currently implemented 5734@item -mapcs-reentrant 5735@opindex mapcs-reentrant 5736Generate reentrant, position independent code. The default is 5737@option{-mno-apcs-reentrant}. 5738@end ignore 5739 5740@item -mthumb-interwork 5741@opindex mthumb-interwork 5742Generate code which supports calling between the ARM and Thumb 5743instruction sets. Without this option the two instruction sets cannot 5744be reliably used inside one program. The default is 5745@option{-mno-thumb-interwork}, since slightly larger code is generated 5746when @option{-mthumb-interwork} is specified. 5747 5748@item -mno-sched-prolog 5749@opindex mno-sched-prolog 5750Prevent the reordering of instructions in the function prolog, or the 5751merging of those instruction with the instructions in the function's 5752body. This means that all functions will start with a recognizable set 5753of instructions (or in fact one of a choice from a small set of 5754different function prologues), and this information can be used to 5755locate the start if functions inside an executable piece of code. The 5756default is @option{-msched-prolog}. 5757 5758@item -mhard-float 5759@opindex mhard-float 5760Generate output containing floating point instructions. This is the 5761default. 5762 5763@item -msoft-float 5764@opindex msoft-float 5765Generate output containing library calls for floating point. 5766@strong{Warning:} the requisite libraries are not available for all ARM 5767targets. Normally the facilities of the machine's usual C compiler are 5768used, but this cannot be done directly in cross-compilation. You must make 5769your own arrangements to provide suitable library functions for 5770cross-compilation. 5771 5772@option{-msoft-float} changes the calling convention in the output file; 5773therefore, it is only useful if you compile @emph{all} of a program with 5774this option. In particular, you need to compile @file{libgcc.a}, the 5775library that comes with GCC, with @option{-msoft-float} in order for 5776this to work. 5777 5778@item -mlittle-endian 5779@opindex mlittle-endian 5780Generate code for a processor running in little-endian mode. This is 5781the default for all standard configurations. 5782 5783@item -mbig-endian 5784@opindex mbig-endian 5785Generate code for a processor running in big-endian mode; the default is 5786to compile code for a little-endian processor. 5787 5788@item -mwords-little-endian 5789@opindex mwords-little-endian 5790This option only applies when generating code for big-endian processors. 5791Generate code for a little-endian word order but a big-endian byte 5792order. That is, a byte order of the form @samp{32107654}. Note: this 5793option should only be used if you require compatibility with code for 5794big-endian ARM processors generated by versions of the compiler prior to 57952.8. 5796 5797@item -malignment-traps 5798@opindex malignment-traps 5799Generate code that will not trap if the MMU has alignment traps enabled. 5800On ARM architectures prior to ARMv4, there were no instructions to 5801access half-word objects stored in memory. However, when reading from 5802memory a feature of the ARM architecture allows a word load to be used, 5803even if the address is unaligned, and the processor core will rotate the 5804data as it is being loaded. This option tells the compiler that such 5805misaligned accesses will cause a MMU trap and that it should instead 5806synthesise the access as a series of byte accesses. The compiler can 5807still use word accesses to load half-word data if it knows that the 5808address is aligned to a word boundary. 5809 5810This option is ignored when compiling for ARM architecture 4 or later, 5811since these processors have instructions to directly access half-word 5812objects in memory. 5813 5814@item -mno-alignment-traps 5815@opindex mno-alignment-traps 5816Generate code that assumes that the MMU will not trap unaligned 5817accesses. This produces better code when the target instruction set 5818does not have half-word memory operations (i.e.@: implementations prior to 5819ARMv4). 5820 5821Note that you cannot use this option to access unaligned word objects, 5822since the processor will only fetch one 32-bit aligned object from 5823memory. 5824 5825The default setting for most targets is @option{-mno-alignment-traps}, since 5826this produces better code when there are no half-word memory 5827instructions available. 5828 5829@item -mshort-load-bytes 5830@itemx -mno-short-load-words 5831@opindex mshort-load-bytes 5832@opindex mno-short-load-words 5833These are deprecated aliases for @option{-malignment-traps}. 5834 5835@item -mno-short-load-bytes 5836@itemx -mshort-load-words 5837@opindex mno-short-load-bytes 5838@opindex mshort-load-words 5839This are deprecated aliases for @option{-mno-alignment-traps}. 5840 5841@item -mbsd 5842@opindex mbsd 5843This option only applies to RISC iX@. Emulate the native BSD-mode 5844compiler. This is the default if @option{-ansi} is not specified. 5845 5846@item -mxopen 5847@opindex mxopen 5848This option only applies to RISC iX@. Emulate the native X/Open-mode 5849compiler. 5850 5851@item -mno-symrename 5852@opindex mno-symrename 5853This option only applies to RISC iX@. Do not run the assembler 5854post-processor, @samp{symrename}, after code has been assembled. 5855Normally it is necessary to modify some of the standard symbols in 5856preparation for linking with the RISC iX C library; this option 5857suppresses this pass. The post-processor is never run when the 5858compiler is built for cross-compilation. 5859 5860@item -mcpu=@var{name} 5861@opindex mcpu 5862This specifies the name of the target ARM processor. GCC uses this name 5863to determine what kind of instructions it can emit when generating 5864assembly code. Permissible names are: @samp{arm2}, @samp{arm250}, 5865@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 5866@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 5867@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 5868@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 5869@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8}, 5870@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 5871@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 5872@samp{arm920t}, @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, 5873@samp{arm1020t}, @samp{xscale}. 5874 5875@itemx -mtune=@var{name} 5876@opindex mtune 5877This option is very similar to the @option{-mcpu=} option, except that 5878instead of specifying the actual target processor type, and hence 5879restricting which instructions can be used, it specifies that GCC should 5880tune the performance of the code as if the target were of the type 5881specified in this option, but still choosing the instructions that it 5882will generate based on the cpu specified by a @option{-mcpu=} option. 5883For some ARM implementations better performance can be obtained by using 5884this option. 5885 5886@item -march=@var{name} 5887@opindex march 5888This specifies the name of the target ARM architecture. GCC uses this 5889name to determine what kind of instructions it can emit when generating 5890assembly code. This option can be used in conjunction with or instead 5891of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, 5892@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, 5893@samp{armv5}, @samp{armv5t}, @samp{armv5te}. 5894 5895@item -mfpe=@var{number} 5896@itemx -mfp=@var{number} 5897@opindex mfpe 5898@opindex mfp 5899This specifies the version of the floating point emulation available on 5900the target. Permissible values are 2 and 3. @option{-mfp=} is a synonym 5901for @option{-mfpe=}, for compatibility with older versions of GCC@. 5902 5903@item -mstructure-size-boundary=@var{n} 5904@opindex mstructure-size-boundary 5905The size of all structures and unions will be rounded up to a multiple 5906of the number of bits set by this option. Permissible values are 8 and 590732. The default value varies for different toolchains. For the COFF 5908targeted toolchain the default value is 8. Specifying the larger number 5909can produce faster, more efficient code, but can also increase the size 5910of the program. The two values are potentially incompatible. Code 5911compiled with one value cannot necessarily expect to work with code or 5912libraries compiled with the other value, if they exchange information 5913using structures or unions. 5914 5915@item -mabort-on-noreturn 5916@opindex mabort-on-noreturn 5917Generate a call to the function @code{abort} at the end of a 5918@code{noreturn} function. It will be executed if the function tries to 5919return. 5920 5921@item -mlong-calls 5922@itemx -mno-long-calls 5923@opindex mlong-calls 5924@opindex mno-long-calls 5925Tells the compiler to perform function calls by first loading the 5926address of the function into a register and then performing a subroutine 5927call on this register. This switch is needed if the target function 5928will lie outside of the 64 megabyte addressing range of the offset based 5929version of subroutine call instruction. 5930 5931Even if this switch is enabled, not all function calls will be turned 5932into long calls. The heuristic is that static functions, functions 5933which have the @samp{short-call} attribute, functions that are inside 5934the scope of a @samp{#pragma no_long_calls} directive and functions whose 5935definitions have already been compiled within the current compilation 5936unit, will not be turned into long calls. The exception to this rule is 5937that weak function definitions, functions with the @samp{long-call} 5938attribute or the @samp{section} attribute, and functions that are within 5939the scope of a @samp{#pragma long_calls} directive, will always be 5940turned into long calls. 5941 5942This feature is not enabled by default. Specifying 5943@option{-mno-long-calls} will restore the default behavior, as will 5944placing the function calls within the scope of a @samp{#pragma 5945long_calls_off} directive. Note these switches have no effect on how 5946the compiler generates code to handle function calls via function 5947pointers. 5948 5949@item -mnop-fun-dllimport 5950@opindex mnop-fun-dllimport 5951Disable support for the @code{dllimport} attribute. 5952 5953@item -msingle-pic-base 5954@opindex msingle-pic-base 5955Treat the register used for PIC addressing as read-only, rather than 5956loading it in the prologue for each function. The run-time system is 5957responsible for initializing this register with an appropriate value 5958before execution begins. 5959 5960@item -mpic-register=@var{reg} 5961@opindex mpic-register 5962Specify the register to be used for PIC addressing. The default is R10 5963unless stack-checking is enabled, when R9 is used. 5964 5965@item -mpoke-function-name 5966@opindex mpoke-function-name 5967Write the name of each function into the text section, directly 5968preceding the function prologue. The generated code is similar to this: 5969 5970@smallexample 5971 t0 5972 .ascii "arm_poke_function_name", 0 5973 .align 5974 t1 5975 .word 0xff000000 + (t1 - t0) 5976 arm_poke_function_name 5977 mov ip, sp 5978 stmfd sp!, @{fp, ip, lr, pc@} 5979 sub fp, ip, #4 5980@end smallexample 5981 5982When performing a stack backtrace, code can inspect the value of 5983@code{pc} stored at @code{fp + 0}. If the trace function then looks at 5984location @code{pc - 12} and the top 8 bits are set, then we know that 5985there is a function name embedded immediately preceding this location 5986and has length @code{((pc[-3]) & 0xff000000)}. 5987 5988@item -mthumb 5989@opindex mthumb 5990Generate code for the 16-bit Thumb instruction set. The default is to 5991use the 32-bit ARM instruction set. 5992 5993@item -mtpcs-frame 5994@opindex mtpcs-frame 5995Generate a stack frame that is compliant with the Thumb Procedure Call 5996Standard for all non-leaf functions. (A leaf function is one that does 5997not call any other functions.) The default is @option{-mno-tpcs-frame}. 5998 5999@item -mtpcs-leaf-frame 6000@opindex mtpcs-leaf-frame 6001Generate a stack frame that is compliant with the Thumb Procedure Call 6002Standard for all leaf functions. (A leaf function is one that does 6003not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 6004 6005@item -mcallee-super-interworking 6006@opindex mcallee-super-interworking 6007Gives all externally visible functions in the file being compiled an ARM 6008instruction set header which switches to Thumb mode before executing the 6009rest of the function. This allows these functions to be called from 6010non-interworking code. 6011 6012@item -mcaller-super-interworking 6013@opindex mcaller-super-interworking 6014Allows calls via function pointers (including virtual functions) to 6015execute correctly regardless of whether the target code has been 6016compiled for interworking or not. There is a small overhead in the cost 6017of executing a function pointer if this option is enabled. 6018 6019@end table 6020 6021@node MN10200 Options 6022@subsection MN10200 Options 6023@cindex MN10200 options 6024These @option{-m} options are defined for Matsushita MN10200 architectures: 6025@table @gcctabopt 6026 6027@item -mrelax 6028@opindex mrelax 6029Indicate to the linker that it should perform a relaxation optimization pass 6030to shorten branches, calls and absolute memory addresses. This option only 6031has an effect when used on the command line for the final link step. 6032 6033This option makes symbolic debugging impossible. 6034@end table 6035 6036@node MN10300 Options 6037@subsection MN10300 Options 6038@cindex MN10300 options 6039These @option{-m} options are defined for Matsushita MN10300 architectures: 6040 6041@table @gcctabopt 6042@item -mmult-bug 6043@opindex mmult-bug 6044Generate code to avoid bugs in the multiply instructions for the MN10300 6045processors. This is the default. 6046 6047@item -mno-mult-bug 6048@opindex mno-mult-bug 6049Do not generate code to avoid bugs in the multiply instructions for the 6050MN10300 processors. 6051 6052@item -mam33 6053@opindex mam33 6054Generate code which uses features specific to the AM33 processor. 6055 6056@item -mno-am33 6057@opindex mno-am33 6058Do not generate code which uses features specific to the AM33 processor. This 6059is the default. 6060 6061@item -mno-crt0 6062@opindex mno-crt0 6063Do not link in the C run-time initialization object file. 6064 6065@item -mrelax 6066@opindex mrelax 6067Indicate to the linker that it should perform a relaxation optimization pass 6068to shorten branches, calls and absolute memory addresses. This option only 6069has an effect when used on the command line for the final link step. 6070 6071This option makes symbolic debugging impossible. 6072@end table 6073 6074 6075@node M32R/D Options 6076@subsection M32R/D Options 6077@cindex M32R/D options 6078 6079These @option{-m} options are defined for Mitsubishi M32R/D architectures: 6080 6081@table @gcctabopt 6082@item -m32rx 6083@opindex m32rx 6084Generate code for the M32R/X@. 6085 6086@item -m32r 6087@opindex m32r 6088Generate code for the M32R@. This is the default. 6089 6090@item -mcode-model=small 6091@opindex mcode-model=small 6092Assume all objects live in the lower 16MB of memory (so that their addresses 6093can be loaded with the @code{ld24} instruction), and assume all subroutines 6094are reachable with the @code{bl} instruction. 6095This is the default. 6096 6097The addressability of a particular object can be set with the 6098@code{model} attribute. 6099 6100@item -mcode-model=medium 6101@opindex mcode-model=medium 6102Assume objects may be anywhere in the 32-bit address space (the compiler 6103will generate @code{seth/add3} instructions to load their addresses), and 6104assume all subroutines are reachable with the @code{bl} instruction. 6105 6106@item -mcode-model=large 6107@opindex mcode-model=large 6108Assume objects may be anywhere in the 32-bit address space (the compiler 6109will generate @code{seth/add3} instructions to load their addresses), and 6110assume subroutines may not be reachable with the @code{bl} instruction 6111(the compiler will generate the much slower @code{seth/add3/jl} 6112instruction sequence). 6113 6114@item -msdata=none 6115@opindex msdata=none 6116Disable use of the small data area. Variables will be put into 6117one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the 6118@code{section} attribute has been specified). 6119This is the default. 6120 6121The small data area consists of sections @samp{.sdata} and @samp{.sbss}. 6122Objects may be explicitly put in the small data area with the 6123@code{section} attribute using one of these sections. 6124 6125@item -msdata=sdata 6126@opindex msdata=sdata 6127Put small global and static data in the small data area, but do not 6128generate special code to reference them. 6129 6130@item -msdata=use 6131@opindex msdata=use 6132Put small global and static data in the small data area, and generate 6133special instructions to reference them. 6134 6135@item -G @var{num} 6136@opindex G 6137@cindex smaller data references 6138Put global and static objects less than or equal to @var{num} bytes 6139into the small data or bss sections instead of the normal data or bss 6140sections. The default value of @var{num} is 8. 6141The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 6142for this option to have any effect. 6143 6144All modules should be compiled with the same @option{-G @var{num}} value. 6145Compiling with different values of @var{num} may or may not work; if it 6146doesn't the linker will give an error message---incorrect code will not be 6147generated. 6148 6149@end table 6150 6151@node M88K Options 6152@subsection M88K Options 6153@cindex M88k options 6154 6155These @samp{-m} options are defined for Motorola 88k architectures: 6156 6157@table @gcctabopt 6158@item -m88000 6159@opindex m88000 6160Generate code that works well on both the m88100 and the 6161m88110. 6162 6163@item -m88100 6164@opindex m88100 6165Generate code that works best for the m88100, but that also 6166runs on the m88110. 6167 6168@item -m88110 6169@opindex m88110 6170Generate code that works best for the m88110, and may not run 6171on the m88100. 6172 6173@item -mbig-pic 6174@opindex mbig-pic 6175Obsolete option to be removed from the next revision. 6176Use @option{-fPIC}. 6177 6178@item -midentify-revision 6179@opindex midentify-revision 6180@cindex identifying source, compiler (88k) 6181Include an @code{ident} directive in the assembler output recording the 6182source file name, compiler name and version, timestamp, and compilation 6183flags used. 6184 6185@item -mno-underscores 6186@opindex mno-underscores 6187@cindex underscores, avoiding (88k) 6188In assembler output, emit symbol names without adding an underscore 6189character at the beginning of each name. The default is to use an 6190underscore as prefix on each name. 6191 6192@item -mocs-debug-info 6193@itemx -mno-ocs-debug-info 6194@opindex mocs-debug-info 6195@opindex mno-ocs-debug-info 6196@cindex OCS (88k) 6197@cindex debugging, 88k OCS 6198Include (or omit) additional debugging information (about registers used 6199in each stack frame) as specified in the 88open Object Compatibility 6200Standard, ``OCS''@. This extra information allows debugging of code that 6201has had the frame pointer eliminated. The default for DG/UX, SVr4, and 6202Delta 88 SVr3.2 is to include this information; other 88k configurations 6203omit this information by default. 6204 6205@item -mocs-frame-position 6206@opindex mocs-frame-position 6207@cindex register positions in frame (88k) 6208When emitting COFF debugging information for automatic variables and 6209parameters stored on the stack, use the offset from the canonical frame 6210address, which is the stack pointer (register 31) on entry to the 6211function. The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use 6212@option{-mocs-frame-position}; other 88k configurations have the default 6213@option{-mno-ocs-frame-position}. 6214 6215@item -mno-ocs-frame-position 6216@opindex mno-ocs-frame-position 6217@cindex register positions in frame (88k) 6218When emitting COFF debugging information for automatic variables and 6219parameters stored on the stack, use the offset from the frame pointer 6220register (register 30). When this option is in effect, the frame 6221pointer is not eliminated when debugging information is selected by the 6222-g switch. 6223 6224@item -moptimize-arg-area 6225@opindex moptimize-arg-area 6226@cindex arguments in frame (88k) 6227Save space by reorganizing the stack frame. This option generates code 6228that does not agree with the 88open specifications, but uses less 6229memory. 6230 6231@itemx -mno-optimize-arg-area 6232@opindex mno-optimize-arg-area 6233Do not reorganize the stack frame to save space. This is the default. 6234The generated conforms to the specification, but uses more memory. 6235 6236@item -mshort-data-@var{num} 6237@opindex mshort-data 6238@cindex smaller data references (88k) 6239@cindex r0-relative references (88k) 6240Generate smaller data references by making them relative to @code{r0}, 6241which allows loading a value using a single instruction (rather than the 6242usual two). You control which data references are affected by 6243specifying @var{num} with this option. For example, if you specify 6244@option{-mshort-data-512}, then the data references affected are those 6245involving displacements of less than 512 bytes. 6246@option{-mshort-data-@var{num}} is not effective for @var{num} greater 6247than 64k. 6248 6249@item -mserialize-volatile 6250@opindex mserialize-volatile 6251@itemx -mno-serialize-volatile 6252@opindex mno-serialize-volatile 6253@cindex sequential consistency on 88k 6254Do, or don't, generate code to guarantee sequential consistency 6255of volatile memory references. By default, consistency is 6256guaranteed. 6257 6258The order of memory references made by the MC88110 processor does 6259not always match the order of the instructions requesting those 6260references. In particular, a load instruction may execute before 6261a preceding store instruction. Such reordering violates 6262sequential consistency of volatile memory references, when there 6263are multiple processors. When consistency must be guaranteed, 6264GCC generates special instructions, as needed, to force 6265execution in the proper order. 6266 6267The MC88100 processor does not reorder memory references and so 6268always provides sequential consistency. However, by default, GCC 6269generates the special instructions to guarantee consistency 6270even when you use @option{-m88100}, so that the code may be run on an 6271MC88110 processor. If you intend to run your code only on the 6272MC88100 processor, you may use @option{-mno-serialize-volatile}. 6273 6274The extra code generated to guarantee consistency may affect the 6275performance of your application. If you know that you can safely 6276forgo this guarantee, you may use @option{-mno-serialize-volatile}. 6277 6278@item -msvr4 6279@itemx -msvr3 6280@opindex msvr4 6281@opindex msvr3 6282@cindex assembler syntax, 88k 6283@cindex SVr4 6284Turn on (@option{-msvr4}) or off (@option{-msvr3}) compiler extensions 6285related to System V release 4 (SVr4). This controls the following: 6286 6287@enumerate 6288@item 6289Which variant of the assembler syntax to emit. 6290@item 6291@option{-msvr4} makes the C preprocessor recognize @samp{#pragma weak} 6292that is used on System V release 4. 6293@item 6294@option{-msvr4} makes GCC issue additional declaration directives used in 6295SVr4. 6296@end enumerate 6297 6298@option{-msvr4} is the default for the m88k-motorola-sysv4 and 6299m88k-dg-dgux m88k configurations. @option{-msvr3} is the default for all 6300other m88k configurations. 6301 6302@item -mversion-03.00 6303@opindex mversion-03.00 6304This option is obsolete, and is ignored. 6305@c ??? which asm syntax better for GAS? option there too? 6306 6307@item -mno-check-zero-division 6308@itemx -mcheck-zero-division 6309@opindex mno-check-zero-division 6310@opindex mcheck-zero-division 6311@cindex zero division on 88k 6312Do, or don't, generate code to guarantee that integer division by 6313zero will be detected. By default, detection is guaranteed. 6314 6315Some models of the MC88100 processor fail to trap upon integer 6316division by zero under certain conditions. By default, when 6317compiling code that might be run on such a processor, GCC 6318generates code that explicitly checks for zero-valued divisors 6319and traps with exception number 503 when one is detected. Use of 6320@option{-mno-check-zero-division} suppresses such checking for code 6321generated to run on an MC88100 processor. 6322 6323GCC assumes that the MC88110 processor correctly detects all instances 6324of integer division by zero. When @option{-m88110} is specified, no 6325explicit checks for zero-valued divisors are generated, and both 6326@option{-mcheck-zero-division} and @option{-mno-check-zero-division} are 6327ignored. 6328 6329@item -muse-div-instruction 6330@opindex muse-div-instruction 6331@cindex divide instruction, 88k 6332Use the div instruction for signed integer division on the 6333MC88100 processor. By default, the div instruction is not used. 6334 6335On the MC88100 processor the signed integer division instruction 6336div) traps to the operating system on a negative operand. The 6337operating system transparently completes the operation, but at a 6338large cost in execution time. By default, when compiling code 6339that might be run on an MC88100 processor, GCC emulates signed 6340integer division using the unsigned integer division instruction 6341divu), thereby avoiding the large penalty of a trap to the 6342operating system. Such emulation has its own, smaller, execution 6343cost in both time and space. To the extent that your code's 6344important signed integer division operations are performed on two 6345nonnegative operands, it may be desirable to use the div 6346instruction directly. 6347 6348On the MC88110 processor the div instruction (also known as the 6349divs instruction) processes negative operands without trapping to 6350the operating system. When @option{-m88110} is specified, 6351@option{-muse-div-instruction} is ignored, and the div instruction is used 6352for signed integer division. 6353 6354Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined. In 6355particular, the behavior of such a division with and without 6356@option{-muse-div-instruction} may differ. 6357 6358@item -mtrap-large-shift 6359@itemx -mhandle-large-shift 6360@opindex mtrap-large-shift 6361@opindex mhandle-large-shift 6362@cindex bit shift overflow (88k) 6363@cindex large bit shifts (88k) 6364Include code to detect bit-shifts of more than 31 bits; respectively, 6365trap such shifts or emit code to handle them properly. By default GCC 6366makes no special provision for large bit shifts. 6367 6368@item -mwarn-passed-structs 6369@opindex mwarn-passed-structs 6370@cindex structure passing (88k) 6371Warn when a function passes a struct as an argument or result. 6372Structure-passing conventions have changed during the evolution of the C 6373language, and are often the source of portability problems. By default, 6374GCC issues no such warning. 6375@end table 6376 6377@c break page here to avoid unsightly interparagraph stretch. 6378@c -zw, 2001-8-17 6379@page 6380 6381@node RS/6000 and PowerPC Options 6382@subsection IBM RS/6000 and PowerPC Options 6383@cindex RS/6000 and PowerPC Options 6384@cindex IBM RS/6000 and PowerPC Options 6385 6386These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 6387@table @gcctabopt 6388@item -mpower 6389@itemx -mno-power 6390@itemx -mpower2 6391@itemx -mno-power2 6392@itemx -mpowerpc 6393@itemx -mno-powerpc 6394@itemx -mpowerpc-gpopt 6395@itemx -mno-powerpc-gpopt 6396@itemx -mpowerpc-gfxopt 6397@itemx -mno-powerpc-gfxopt 6398@itemx -mpowerpc64 6399@itemx -mno-powerpc64 6400@opindex mpower 6401@opindex mno-power 6402@opindex mpower2 6403@opindex mno-power2 6404@opindex mpowerpc 6405@opindex mno-powerpc 6406@opindex mpowerpc-gpopt 6407@opindex mno-powerpc-gpopt 6408@opindex mpowerpc-gfxopt 6409@opindex mno-powerpc-gfxopt 6410@opindex mpowerpc64 6411@opindex mno-powerpc64 6412GCC supports two related instruction set architectures for the 6413RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those 6414instructions supported by the @samp{rios} chip set used in the original 6415RS/6000 systems and the @dfn{PowerPC} instruction set is the 6416architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and 6417the IBM 4xx microprocessors. 6418 6419Neither architecture is a subset of the other. However there is a 6420large common subset of instructions supported by both. An MQ 6421register is included in processors supporting the POWER architecture. 6422 6423You use these options to specify which instructions are available on the 6424processor you are using. The default value of these options is 6425determined when configuring GCC@. Specifying the 6426@option{-mcpu=@var{cpu_type}} overrides the specification of these 6427options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 6428rather than the options listed above. 6429 6430The @option{-mpower} option allows GCC to generate instructions that 6431are found only in the POWER architecture and to use the MQ register. 6432Specifying @option{-mpower2} implies @option{-power} and also allows GCC 6433to generate instructions that are present in the POWER2 architecture but 6434not the original POWER architecture. 6435 6436The @option{-mpowerpc} option allows GCC to generate instructions that 6437are found only in the 32-bit subset of the PowerPC architecture. 6438Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows 6439GCC to use the optional PowerPC architecture instructions in the 6440General Purpose group, including floating-point square root. Specifying 6441@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to 6442use the optional PowerPC architecture instructions in the Graphics 6443group, including floating-point select. 6444 6445The @option{-mpowerpc64} option allows GCC to generate the additional 644664-bit instructions that are found in the full PowerPC64 architecture 6447and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 6448@option{-mno-powerpc64}. 6449 6450If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC 6451will use only the instructions in the common subset of both 6452architectures plus some special AIX common-mode calls, and will not use 6453the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc} 6454permits GCC to use any instruction from either architecture and to 6455allow use of the MQ register; specify this for the Motorola MPC601. 6456 6457@item -mnew-mnemonics 6458@itemx -mold-mnemonics 6459@opindex mnew-mnemonics 6460@opindex mold-mnemonics 6461Select which mnemonics to use in the generated assembler code. With 6462@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for 6463the PowerPC architecture. With @option{-mold-mnemonics} it uses the 6464assembler mnemonics defined for the POWER architecture. Instructions 6465defined in only one architecture have only one mnemonic; GCC uses that 6466mnemonic irrespective of which of these options is specified. 6467 6468GCC defaults to the mnemonics appropriate for the architecture in 6469use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the 6470value of these option. Unless you are building a cross-compiler, you 6471should normally not specify either @option{-mnew-mnemonics} or 6472@option{-mold-mnemonics}, but should instead accept the default. 6473 6474@item -mcpu=@var{cpu_type} 6475@opindex mcpu 6476Set architecture type, register usage, choice of mnemonics, and 6477instruction scheduling parameters for machine type @var{cpu_type}. 6478Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1}, 6479@samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602}, 6480@samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, 6481@samp{630}, @samp{740}, @samp{7400}, @samp{7450}, @samp{750}, 6482@samp{power}, @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505}, 6483@samp{801}, @samp{821}, @samp{823}, and @samp{860} and @samp{common}. 6484 6485@option{-mcpu=common} selects a completely generic processor. Code 6486generated under this option will run on any POWER or PowerPC processor. 6487GCC will use only the instructions in the common subset of both 6488architectures, and will not use the MQ register. GCC assumes a generic 6489processor model for scheduling purposes. 6490 6491@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and 6492@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit 6493PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine 6494types, with an appropriate, generic processor model assumed for 6495scheduling purposes. 6496 6497The other options specify a specific processor. Code generated under 6498those options will run best on that processor, and may not run at all on 6499others. 6500 6501The @option{-mcpu} options automatically enable or disable other 6502@option{-m} options as follows: 6503 6504@table @samp 6505@item common 6506@option{-mno-power}, @option{-mno-powerc} 6507 6508@item power 6509@itemx power2 6510@itemx rios1 6511@itemx rios2 6512@itemx rsc 6513@option{-mpower}, @option{-mno-powerpc}, @option{-mno-new-mnemonics} 6514 6515@item powerpc 6516@itemx rs64a 6517@itemx 602 6518@itemx 603 6519@itemx 603e 6520@itemx 604 6521@itemx 620 6522@itemx 630 6523@itemx 740 6524@itemx 7400 6525@itemx 7450 6526@itemx 750 6527@itemx 505 6528@option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics} 6529 6530@item 601 6531@option{-mpower}, @option{-mpowerpc}, @option{-mnew-mnemonics} 6532 6533@item 403 6534@itemx 821 6535@itemx 860 6536@option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}, @option{-msoft-float} 6537@end table 6538 6539@item -mtune=@var{cpu_type} 6540@opindex mtune 6541Set the instruction scheduling parameters for machine type 6542@var{cpu_type}, but do not set the architecture type, register usage, or 6543choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same 6544values for @var{cpu_type} are used for @option{-mtune} as for 6545@option{-mcpu}. If both are specified, the code generated will use the 6546architecture, registers, and mnemonics set by @option{-mcpu}, but the 6547scheduling parameters set by @option{-mtune}. 6548 6549@item -maltivec 6550@itemx -mno-altivec 6551@opindex maltivec 6552@opindex mno-altivec 6553These switches enable or disable the use of built-in functions that 6554allow access to the AltiVec instruction set. You may also need to set 6555@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 6556enhancements. 6557 6558@item -mfull-toc 6559@itemx -mno-fp-in-toc 6560@itemx -mno-sum-in-toc 6561@itemx -mminimal-toc 6562@opindex mfull-toc 6563@opindex mno-fp-in-toc 6564@opindex mno-sum-in-toc 6565@opindex mminimal-toc 6566Modify generation of the TOC (Table Of Contents), which is created for 6567every executable file. The @option{-mfull-toc} option is selected by 6568default. In that case, GCC will allocate at least one TOC entry for 6569each unique non-automatic variable reference in your program. GCC 6570will also place floating-point constants in the TOC@. However, only 657116,384 entries are available in the TOC@. 6572 6573If you receive a linker error message that saying you have overflowed 6574the available TOC space, you can reduce the amount of TOC space used 6575with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 6576@option{-mno-fp-in-toc} prevents GCC from putting floating-point 6577constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 6578generate code to calculate the sum of an address and a constant at 6579run-time instead of putting that sum into the TOC@. You may specify one 6580or both of these options. Each causes GCC to produce very slightly 6581slower and larger code at the expense of conserving TOC space. 6582 6583If you still run out of space in the TOC even when you specify both of 6584these options, specify @option{-mminimal-toc} instead. This option causes 6585GCC to make only one TOC entry for every file. When you specify this 6586option, GCC will produce code that is slower and larger but which 6587uses extremely little TOC space. You may wish to use this option 6588only on files that contain less frequently executed code. 6589 6590@item -maix64 6591@itemx -maix32 6592@opindex maix64 6593@opindex maix32 6594Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 6595@code{long} type, and the infrastructure needed to support them. 6596Specifying @option{-maix64} implies @option{-mpowerpc64} and 6597@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and 6598implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 6599 6600@item -mxl-call 6601@itemx -mno-xl-call 6602@opindex mxl-call 6603@opindex mno-xl-call 6604On AIX, pass floating-point arguments to prototyped functions beyond the 6605register save area (RSA) on the stack in addition to argument FPRs. The 6606AIX calling convention was extended but not initially documented to 6607handle an obscure K&R C case of calling a function that takes the 6608address of its arguments with fewer arguments than declared. AIX XL 6609compilers access floating point arguments which do not fit in the 6610RSA from the stack when a subroutine is compiled without 6611optimization. Because always storing floating-point arguments on the 6612stack is inefficient and rarely needed, this option is not enabled by 6613default and only is necessary when calling subroutines compiled by AIX 6614XL compilers without optimization. 6615 6616@item -mpe 6617@opindex mpe 6618Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 6619application written to use message passing with special startup code to 6620enable the application to run. The system must have PE installed in the 6621standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 6622must be overridden with the @option{-specs=} option to specify the 6623appropriate directory location. The Parallel Environment does not 6624support threads, so the @option{-mpe} option and the @option{-pthread} 6625option are incompatible. 6626 6627@item -msoft-float 6628@itemx -mhard-float 6629@opindex msoft-float 6630@opindex mhard-float 6631Generate code that does not use (uses) the floating-point register set. 6632Software floating point emulation is provided if you use the 6633@option{-msoft-float} option, and pass the option to GCC when linking. 6634 6635@item -mmultiple 6636@itemx -mno-multiple 6637@opindex mmultiple 6638@opindex mno-multiple 6639Generate code that uses (does not use) the load multiple word 6640instructions and the store multiple word instructions. These 6641instructions are generated by default on POWER systems, and not 6642generated on PowerPC systems. Do not use @option{-mmultiple} on little 6643endian PowerPC systems, since those instructions do not work when the 6644processor is in little endian mode. The exceptions are PPC740 and 6645PPC750 which permit the instructions usage in little endian mode. 6646 6647@item -mstring 6648@itemx -mno-string 6649@opindex mstring 6650@opindex mno-string 6651Generate code that uses (does not use) the load string instructions 6652and the store string word instructions to save multiple registers and 6653do small block moves. These instructions are generated by default on 6654POWER systems, and not generated on PowerPC systems. Do not use 6655@option{-mstring} on little endian PowerPC systems, since those 6656instructions do not work when the processor is in little endian mode. 6657The exceptions are PPC740 and PPC750 which permit the instructions 6658usage in little endian mode. 6659 6660@item -mupdate 6661@itemx -mno-update 6662@opindex mupdate 6663@opindex mno-update 6664Generate code that uses (does not use) the load or store instructions 6665that update the base register to the address of the calculated memory 6666location. These instructions are generated by default. If you use 6667@option{-mno-update}, there is a small window between the time that the 6668stack pointer is updated and the address of the previous frame is 6669stored, which means code that walks the stack frame across interrupts or 6670signals may get corrupted data. 6671 6672@item -mfused-madd 6673@itemx -mno-fused-madd 6674@opindex mfused-madd 6675@opindex mno-fused-madd 6676Generate code that uses (does not use) the floating point multiply and 6677accumulate instructions. These instructions are generated by default if 6678hardware floating is used. 6679 6680@item -mno-bit-align 6681@itemx -mbit-align 6682@opindex mno-bit-align 6683@opindex mbit-align 6684On System V.4 and embedded PowerPC systems do not (do) force structures 6685and unions that contain bit-fields to be aligned to the base type of the 6686bit-field. 6687 6688For example, by default a structure containing nothing but 8 6689@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte 6690boundary and have a size of 4 bytes. By using @option{-mno-bit-align}, 6691the structure would be aligned to a 1 byte boundary and be one byte in 6692size. 6693 6694@item -mno-strict-align 6695@itemx -mstrict-align 6696@opindex mno-strict-align 6697@opindex mstrict-align 6698On System V.4 and embedded PowerPC systems do not (do) assume that 6699unaligned memory references will be handled by the system. 6700 6701@item -mrelocatable 6702@itemx -mno-relocatable 6703@opindex mrelocatable 6704@opindex mno-relocatable 6705On embedded PowerPC systems generate code that allows (does not allow) 6706the program to be relocated to a different address at runtime. If you 6707use @option{-mrelocatable} on any module, all objects linked together must 6708be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}. 6709 6710@item -mrelocatable-lib 6711@itemx -mno-relocatable-lib 6712@opindex mrelocatable-lib 6713@opindex mno-relocatable-lib 6714On embedded PowerPC systems generate code that allows (does not allow) 6715the program to be relocated to a different address at runtime. Modules 6716compiled with @option{-mrelocatable-lib} can be linked with either modules 6717compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or 6718with modules compiled with the @option{-mrelocatable} options. 6719 6720@item -mno-toc 6721@itemx -mtoc 6722@opindex mno-toc 6723@opindex mtoc 6724On System V.4 and embedded PowerPC systems do not (do) assume that 6725register 2 contains a pointer to a global area pointing to the addresses 6726used in the program. 6727 6728@item -mlittle 6729@itemx -mlittle-endian 6730@opindex mlittle 6731@opindex mlittle-endian 6732On System V.4 and embedded PowerPC systems compile code for the 6733processor in little endian mode. The @option{-mlittle-endian} option is 6734the same as @option{-mlittle}. 6735 6736@item -mbig 6737@itemx -mbig-endian 6738@opindex mbig 6739@opindex mbig-endian 6740On System V.4 and embedded PowerPC systems compile code for the 6741processor in big endian mode. The @option{-mbig-endian} option is 6742the same as @option{-mbig}. 6743 6744@item -mcall-sysv 6745@opindex mcall-sysv 6746On System V.4 and embedded PowerPC systems compile code using calling 6747conventions that adheres to the March 1995 draft of the System V 6748Application Binary Interface, PowerPC processor supplement. This is the 6749default unless you configured GCC using @samp{powerpc-*-eabiaix}. 6750 6751@item -mcall-sysv-eabi 6752@opindex mcall-sysv-eabi 6753Specify both @option{-mcall-sysv} and @option{-meabi} options. 6754 6755@item -mcall-sysv-noeabi 6756@opindex mcall-sysv-noeabi 6757Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 6758 6759@item -mcall-aix 6760@opindex mcall-aix 6761On System V.4 and embedded PowerPC systems compile code using calling 6762conventions that are similar to those used on AIX@. This is the 6763default if you configured GCC using @samp{powerpc-*-eabiaix}. 6764 6765@item -mcall-solaris 6766@opindex mcall-solaris 6767On System V.4 and embedded PowerPC systems compile code for the Solaris 6768operating system. 6769 6770@item -mcall-linux 6771@opindex mcall-linux 6772On System V.4 and embedded PowerPC systems compile code for the 6773Linux-based GNU system. 6774 6775@item -mcall-gnu 6776@opindex mcall-gnu 6777On System V.4 and embedded PowerPC systems compile code for the 6778Hurd-based GNU system. 6779 6780@item -mcall-netbsd 6781@opindex mcall-netbsd 6782On System V.4 and embedded PowerPC systems compile code for the 6783NetBSD operating system. 6784 6785@item -maix-struct-return 6786@opindex maix-struct-return 6787Return all structures in memory (as specified by the AIX ABI)@. 6788 6789@item -msvr4-struct-return 6790@opindex msvr4-struct-return 6791Return structures smaller than 8 bytes in registers (as specified by the 6792SVR4 ABI)@. 6793 6794@item -mabi=altivec 6795@opindex mabi=altivec 6796Extend the current ABI with AltiVec ABI extensions. This does not 6797change the default ABI, instead it adds the AltiVec ABI extensions to 6798the current ABI@. 6799 6800@item -mabi=no-altivec 6801@opindex mabi=no-altivec 6802Disable AltiVec ABI extensions for the current ABI. 6803 6804@item -mprototype 6805@itemx -mno-prototype 6806@opindex mprototype 6807@opindex mno-prototype 6808On System V.4 and embedded PowerPC systems assume that all calls to 6809variable argument functions are properly prototyped. Otherwise, the 6810compiler must insert an instruction before every non prototyped call to 6811set or clear bit 6 of the condition code register (@var{CR}) to 6812indicate whether floating point values were passed in the floating point 6813registers in case the function takes a variable arguments. With 6814@option{-mprototype}, only calls to prototyped variable argument functions 6815will set or clear the bit. 6816 6817@item -msim 6818@opindex msim 6819On embedded PowerPC systems, assume that the startup module is called 6820@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 6821@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}. 6822configurations. 6823 6824@item -mmvme 6825@opindex mmvme 6826On embedded PowerPC systems, assume that the startup module is called 6827@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 6828@file{libc.a}. 6829 6830@item -mads 6831@opindex mads 6832On embedded PowerPC systems, assume that the startup module is called 6833@file{crt0.o} and the standard C libraries are @file{libads.a} and 6834@file{libc.a}. 6835 6836@item -myellowknife 6837@opindex myellowknife 6838On embedded PowerPC systems, assume that the startup module is called 6839@file{crt0.o} and the standard C libraries are @file{libyk.a} and 6840@file{libc.a}. 6841 6842@item -mvxworks 6843@opindex mvxworks 6844On System V.4 and embedded PowerPC systems, specify that you are 6845compiling for a VxWorks system. 6846 6847@item -memb 6848@opindex memb 6849On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags 6850header to indicate that @samp{eabi} extended relocations are used. 6851 6852@item -meabi 6853@itemx -mno-eabi 6854@opindex meabi 6855@opindex mno-eabi 6856On System V.4 and embedded PowerPC systems do (do not) adhere to the 6857Embedded Applications Binary Interface (eabi) which is a set of 6858modifications to the System V.4 specifications. Selecting @option{-meabi} 6859means that the stack is aligned to an 8 byte boundary, a function 6860@code{__eabi} is called to from @code{main} to set up the eabi 6861environment, and the @option{-msdata} option can use both @code{r2} and 6862@code{r13} to point to two separate small data areas. Selecting 6863@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary, 6864do not call an initialization function from @code{main}, and the 6865@option{-msdata} option will only use @code{r13} to point to a single 6866small data area. The @option{-meabi} option is on by default if you 6867configured GCC using one of the @samp{powerpc*-*-eabi*} options. 6868 6869@item -msdata=eabi 6870@opindex msdata=eabi 6871On System V.4 and embedded PowerPC systems, put small initialized 6872@code{const} global and static data in the @samp{.sdata2} section, which 6873is pointed to by register @code{r2}. Put small initialized 6874non-@code{const} global and static data in the @samp{.sdata} section, 6875which is pointed to by register @code{r13}. Put small uninitialized 6876global and static data in the @samp{.sbss} section, which is adjacent to 6877the @samp{.sdata} section. The @option{-msdata=eabi} option is 6878incompatible with the @option{-mrelocatable} option. The 6879@option{-msdata=eabi} option also sets the @option{-memb} option. 6880 6881@item -msdata=sysv 6882@opindex msdata=sysv 6883On System V.4 and embedded PowerPC systems, put small global and static 6884data in the @samp{.sdata} section, which is pointed to by register 6885@code{r13}. Put small uninitialized global and static data in the 6886@samp{.sbss} section, which is adjacent to the @samp{.sdata} section. 6887The @option{-msdata=sysv} option is incompatible with the 6888@option{-mrelocatable} option. 6889 6890@item -msdata=default 6891@itemx -msdata 6892@opindex msdata=default 6893@opindex msdata 6894On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 6895compile code the same as @option{-msdata=eabi}, otherwise compile code the 6896same as @option{-msdata=sysv}. 6897 6898@item -msdata-data 6899@opindex msdata-data 6900On System V.4 and embedded PowerPC systems, put small global and static 6901data in the @samp{.sdata} section. Put small uninitialized global and 6902static data in the @samp{.sbss} section. Do not use register @code{r13} 6903to address small data however. This is the default behavior unless 6904other @option{-msdata} options are used. 6905 6906@item -msdata=none 6907@itemx -mno-sdata 6908@opindex msdata=none 6909@opindex mno-sdata 6910On embedded PowerPC systems, put all initialized global and static data 6911in the @samp{.data} section, and all uninitialized data in the 6912@samp{.bss} section. 6913 6914@item -G @var{num} 6915@opindex G 6916@cindex smaller data references (PowerPC) 6917@cindex .sdata/.sdata2 references (PowerPC) 6918On embedded PowerPC systems, put global and static items less than or 6919equal to @var{num} bytes into the small data or bss sections instead of 6920the normal data or bss section. By default, @var{num} is 8. The 6921@option{-G @var{num}} switch is also passed to the linker. 6922All modules should be compiled with the same @option{-G @var{num}} value. 6923 6924@item -mregnames 6925@itemx -mno-regnames 6926@opindex mregnames 6927@opindex mno-regnames 6928On System V.4 and embedded PowerPC systems do (do not) emit register 6929names in the assembly language output using symbolic forms. 6930 6931@item -pthread 6932@opindex pthread 6933Adds support for multithreading with the @dfn{pthreads} library. 6934This option sets flags for both the preprocessor and linker. 6935 6936@end table 6937 6938@node RT Options 6939@subsection IBM RT Options 6940@cindex RT options 6941@cindex IBM RT options 6942 6943These @samp{-m} options are defined for the IBM RT PC: 6944 6945@table @gcctabopt 6946@item -min-line-mul 6947@opindex min-line-mul 6948Use an in-line code sequence for integer multiplies. This is the 6949default. 6950 6951@item -mcall-lib-mul 6952@opindex mcall-lib-mul 6953Call @code{lmul$$} for integer multiples. 6954 6955@item -mfull-fp-blocks 6956@opindex mfull-fp-blocks 6957Generate full-size floating point data blocks, including the minimum 6958amount of scratch space recommended by IBM@. This is the default. 6959 6960@item -mminimum-fp-blocks 6961@opindex mminimum-fp-blocks 6962Do not include extra scratch space in floating point data blocks. This 6963results in smaller code, but slower execution, since scratch space must 6964be allocated dynamically. 6965 6966@cindex @file{varargs.h} and RT PC 6967@cindex @file{stdarg.h} and RT PC 6968@item -mfp-arg-in-fpregs 6969@opindex mfp-arg-in-fpregs 6970Use a calling sequence incompatible with the IBM calling convention in 6971which floating point arguments are passed in floating point registers. 6972Note that @code{varargs.h} and @code{stdarg.h} will not work with 6973floating point operands if this option is specified. 6974 6975@item -mfp-arg-in-gregs 6976@opindex mfp-arg-in-gregs 6977Use the normal calling convention for floating point arguments. This is 6978the default. 6979 6980@item -mhc-struct-return 6981@opindex mhc-struct-return 6982Return structures of more than one word in memory, rather than in a 6983register. This provides compatibility with the MetaWare HighC (hc) 6984compiler. Use the option @option{-fpcc-struct-return} for compatibility 6985with the Portable C Compiler (pcc). 6986 6987@item -mnohc-struct-return 6988@opindex mnohc-struct-return 6989Return some structures of more than one word in registers, when 6990convenient. This is the default. For compatibility with the 6991IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the 6992option @option{-mhc-struct-return}. 6993@end table 6994 6995@node MIPS Options 6996@subsection MIPS Options 6997@cindex MIPS options 6998 6999These @samp{-m} options are defined for the MIPS family of computers: 7000 7001@table @gcctabopt 7002 7003@item -march=@var{cpu-type} 7004@opindex march 7005Assume the defaults for the machine type @var{cpu-type} when generating 7006instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000}, 7007@samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400}, 7008@samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000}, 7009and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000}, 7010@samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as 7011@samp{r2k} (or @samp{r2K}), @samp{r3k}, etc. 7012 7013@item -mtune=@var{cpu-type} 7014@opindex mtune 7015Assume the defaults for the machine type @var{cpu-type} when scheduling 7016instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000}, 7017@samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400}, 7018@samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000}, 7019and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000}, 7020@samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as 7021@samp{r2k} (or @samp{r2K}), @samp{r3k}, etc. While picking a specific 7022@var{cpu-type} will schedule things appropriately for that particular 7023chip, the compiler will not generate any code that does not meet level 1 7024of the MIPS ISA (instruction set architecture) without a @option{-mipsX} 7025or @option{-mabi} switch being used. 7026 7027@item -mcpu=@var{cpu-type} 7028@opindex mcpu 7029This is identical to specifying both @option{-march} and @option{-mtune}. 7030 7031@item -mips1 7032@opindex mips1 7033Issue instructions from level 1 of the MIPS ISA@. This is the default. 7034@samp{r3000} is the default @var{cpu-type} at this ISA level. 7035 7036@item -mips2 7037@opindex mips2 7038Issue instructions from level 2 of the MIPS ISA (branch likely, square 7039root instructions). @samp{r6000} is the default @var{cpu-type} at this 7040ISA level. 7041 7042@item -mips3 7043@opindex mips3 7044Issue instructions from level 3 of the MIPS ISA (64-bit instructions). 7045@samp{r4000} is the default @var{cpu-type} at this ISA level. 7046 7047@item -mips4 7048@opindex mips4 7049Issue instructions from level 4 of the MIPS ISA (conditional move, 7050prefetch, enhanced FPU instructions). @samp{r8000} is the default 7051@var{cpu-type} at this ISA level. 7052 7053@item -mfp32 7054@opindex mfp32 7055Assume that 32 32-bit floating point registers are available. This is 7056the default. 7057 7058@item -mfp64 7059@opindex mfp64 7060Assume that 32 64-bit floating point registers are available. This is 7061the default when the @option{-mips3} option is used. 7062 7063@item -mfused-madd 7064@itemx -mno-fused-madd 7065@opindex mfused-madd 7066@opindex mno-fused-madd 7067Generate code that uses (does not use) the floating point multiply and 7068accumulate instructions, when they are available. These instructions 7069are generated by default if they are available, but this may be 7070undesirable if the extra precision causes problems or on certain chips 7071in the mode where denormals are rounded to zero where denormals 7072generated by multiply and accumulate instructions cause exceptions 7073anyway. 7074 7075@item -mgp32 7076@opindex mgp32 7077Assume that 32 32-bit general purpose registers are available. This is 7078the default. 7079 7080@item -mgp64 7081@opindex mgp64 7082Assume that 32 64-bit general purpose registers are available. This is 7083the default when the @option{-mips3} option is used. 7084 7085@item -mint64 7086@opindex mint64 7087Force int and long types to be 64 bits wide. See @option{-mlong32} for an 7088explanation of the default, and the width of pointers. 7089 7090@item -mlong64 7091@opindex mlong64 7092Force long types to be 64 bits wide. See @option{-mlong32} for an 7093explanation of the default, and the width of pointers. 7094 7095@item -mlong32 7096@opindex mlong32 7097Force long, int, and pointer types to be 32 bits wide. 7098 7099If none of @option{-mlong32}, @option{-mlong64}, or @option{-mint64} are set, 7100the size of ints, longs, and pointers depends on the ABI and ISA chosen. 7101For @option{-mabi=32}, and @option{-mabi=n32}, ints and longs are 32 bits 7102wide. For @option{-mabi=64}, ints are 32 bits, and longs are 64 bits wide. 7103For @option{-mabi=eabi} and either @option{-mips1} or @option{-mips2}, ints 7104and longs are 32 bits wide. For @option{-mabi=eabi} and higher ISAs, ints 7105are 32 bits, and longs are 64 bits wide. The width of pointer types is 7106the smaller of the width of longs or the width of general purpose 7107registers (which in turn depends on the ISA)@. 7108 7109@item -mabi=32 7110@itemx -mabi=o64 7111@itemx -mabi=n32 7112@itemx -mabi=64 7113@itemx -mabi=eabi 7114@opindex mabi=32 7115@opindex mabi=o64 7116@opindex mabi=n32 7117@opindex mabi=64 7118@opindex mabi=eabi 7119Generate code for the indicated ABI@. The default instruction level is 7120@option{-mips1} for @samp{32}, @option{-mips3} for @samp{n32}, and 7121@option{-mips4} otherwise. Conversely, with @option{-mips1} or 7122@option{-mips2}, the default ABI is @samp{32}; otherwise, the default ABI 7123is @samp{64}. 7124 7125@item -mmips-as 7126@opindex mmips-as 7127Generate code for the MIPS assembler, and invoke @file{mips-tfile} to 7128add normal debug information. This is the default for all 7129platforms except for the OSF/1 reference platform, using the OSF/rose 7130object format. If the either of the @option{-gstabs} or @option{-gstabs+} 7131switches are used, the @file{mips-tfile} program will encapsulate the 7132stabs within MIPS ECOFF@. 7133 7134@item -mgas 7135@opindex mgas 7136Generate code for the GNU assembler. This is the default on the OSF/1 7137reference platform, using the OSF/rose object format. Also, this is 7138the default if the configure option @option{--with-gnu-as} is used. 7139 7140@item -msplit-addresses 7141@itemx -mno-split-addresses 7142@opindex msplit-addresses 7143@opindex mno-split-addresses 7144Generate code to load the high and low parts of address constants separately. 7145This allows GCC to optimize away redundant loads of the high order 7146bits of addresses. This optimization requires GNU as and GNU ld. 7147This optimization is enabled by default for some embedded targets where 7148GNU as and GNU ld are standard. 7149 7150@item -mrnames 7151@itemx -mno-rnames 7152@opindex mrnames 7153@opindex mno-rnames 7154The @option{-mrnames} switch says to output code using the MIPS software 7155names for the registers, instead of the hardware names (ie, @var{a0} 7156instead of @var{$4}). The only known assembler that supports this option 7157is the Algorithmics assembler. 7158 7159@item -mgpopt 7160@itemx -mno-gpopt 7161@opindex mgpopt 7162@opindex mno-gpopt 7163The @option{-mgpopt} switch says to write all of the data declarations 7164before the instructions in the text section, this allows the MIPS 7165assembler to generate one word memory references instead of using two 7166words for short global or static data items. This is on by default if 7167optimization is selected. 7168 7169@item -mstats 7170@itemx -mno-stats 7171@opindex mstats 7172@opindex mno-stats 7173For each non-inline function processed, the @option{-mstats} switch 7174causes the compiler to emit one line to the standard error file to 7175print statistics about the program (number of registers saved, stack 7176size, etc.). 7177 7178@item -mmemcpy 7179@itemx -mno-memcpy 7180@opindex mmemcpy 7181@opindex mno-memcpy 7182The @option{-mmemcpy} switch makes all block moves call the appropriate 7183string function (@samp{memcpy} or @samp{bcopy}) instead of possibly 7184generating inline code. 7185 7186@item -mmips-tfile 7187@itemx -mno-mips-tfile 7188@opindex mmips-tfile 7189@opindex mno-mips-tfile 7190The @option{-mno-mips-tfile} switch causes the compiler not 7191postprocess the object file with the @file{mips-tfile} program, 7192after the MIPS assembler has generated it to add debug support. If 7193@file{mips-tfile} is not run, then no local variables will be 7194available to the debugger. In addition, @file{stage2} and 7195@file{stage3} objects will have the temporary file names passed to the 7196assembler embedded in the object file, which means the objects will 7197not compare the same. The @option{-mno-mips-tfile} switch should only 7198be used when there are bugs in the @file{mips-tfile} program that 7199prevents compilation. 7200 7201@item -msoft-float 7202@opindex msoft-float 7203Generate output containing library calls for floating point. 7204@strong{Warning:} the requisite libraries are not part of GCC@. 7205Normally the facilities of the machine's usual C compiler are used, but 7206this can't be done directly in cross-compilation. You must make your 7207own arrangements to provide suitable library functions for 7208cross-compilation. 7209 7210@item -mhard-float 7211@opindex mhard-float 7212Generate output containing floating point instructions. This is the 7213default if you use the unmodified sources. 7214 7215@item -mabicalls 7216@itemx -mno-abicalls 7217@opindex mabicalls 7218@opindex mno-abicalls 7219Emit (or do not emit) the pseudo operations @samp{.abicalls}, 7220@samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for 7221position independent code. 7222 7223@item -mlong-calls 7224@itemx -mno-long-calls 7225@opindex mlong-calls 7226@opindex mno-long-calls 7227Do all calls with the @samp{JALR} instruction, which requires 7228loading up a function's address into a register before the call. 7229You need to use this switch, if you call outside of the current 7230512 megabyte segment to functions that are not through pointers. 7231 7232@item -mhalf-pic 7233@itemx -mno-half-pic 7234@opindex mhalf-pic 7235@opindex mno-half-pic 7236Put pointers to extern references into the data section and load them 7237up, rather than put the references in the text section. 7238 7239@item -membedded-pic 7240@itemx -mno-embedded-pic 7241@opindex membedded-pic 7242@opindex mno-embedded-pic 7243Generate PIC code suitable for some embedded systems. All calls are 7244made using PC relative address, and all data is addressed using the $gp 7245register. No more than 65536 bytes of global data may be used. This 7246requires GNU as and GNU ld which do most of the work. This currently 7247only works on targets which use ECOFF; it does not work with ELF@. 7248 7249@item -membedded-data 7250@itemx -mno-embedded-data 7251@opindex membedded-data 7252@opindex mno-embedded-data 7253Allocate variables to the read-only data section first if possible, then 7254next in the small data section if possible, otherwise in data. This gives 7255slightly slower code than the default, but reduces the amount of RAM required 7256when executing, and thus may be preferred for some embedded systems. 7257 7258@item -muninit-const-in-rodata 7259@itemx -mno-uninit-const-in-rodata 7260@opindex muninit-const-in-rodata 7261@opindex mno-uninit-const-in-rodata 7262When used together with @option{-membedded-data}, it will always store uninitialized 7263const variables in the read-only data section. 7264 7265@item -msingle-float 7266@itemx -mdouble-float 7267@opindex msingle-float 7268@opindex mdouble-float 7269The @option{-msingle-float} switch tells gcc to assume that the floating 7270point coprocessor only supports single precision operations, as on the 7271@samp{r4650} chip. The @option{-mdouble-float} switch permits gcc to use 7272double precision operations. This is the default. 7273 7274@item -mmad 7275@itemx -mno-mad 7276@opindex mmad 7277@opindex mno-mad 7278Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions, 7279as on the @samp{r4650} chip. 7280 7281@item -m4650 7282@opindex m4650 7283Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now, 7284@option{-mcpu=r4650}. 7285 7286@item -mips16 7287@itemx -mno-mips16 7288@opindex mips16 7289@opindex mno-mips16 7290Enable 16-bit instructions. 7291 7292@item -mentry 7293@opindex mentry 7294Use the entry and exit pseudo ops. This option can only be used with 7295@option{-mips16}. 7296 7297@item -EL 7298@opindex EL 7299Compile code for the processor in little endian mode. 7300The requisite libraries are assumed to exist. 7301 7302@item -EB 7303@opindex EB 7304Compile code for the processor in big endian mode. 7305The requisite libraries are assumed to exist. 7306 7307@item -G @var{num} 7308@opindex G 7309@cindex smaller data references (MIPS) 7310@cindex gp-relative references (MIPS) 7311Put global and static items less than or equal to @var{num} bytes into 7312the small data or bss sections instead of the normal data or bss 7313section. This allows the assembler to emit one word memory reference 7314instructions based on the global pointer (@var{gp} or @var{$28}), 7315instead of the normal two words used. By default, @var{num} is 8 when 7316the MIPS assembler is used, and 0 when the GNU assembler is used. The 7317@option{-G @var{num}} switch is also passed to the assembler and linker. 7318All modules should be compiled with the same @option{-G @var{num}} 7319value. 7320 7321@item -nocpp 7322@opindex nocpp 7323Tell the MIPS assembler to not run its preprocessor over user 7324assembler files (with a @samp{.s} suffix) when assembling them. 7325 7326@item -mfix7000 7327@opindex mfix7000 7328Pass an option to gas which will cause nops to be inserted if 7329the read of the destination register of an mfhi or mflo instruction 7330occurs in the following two instructions. 7331 7332@item -no-crt0 7333@opindex no-crt0 7334Do not include the default crt0. 7335 7336@item -mflush-func=@var{func} 7337@itemx -mno-flush-func 7338@opindex mflush-func 7339Specifies the function to call to flush the I and D caches, or to not 7340call any such function. If called, the function must take the same 7341arguments as the common @code{_flush_func()}, that is, the address of the 7342memory range for which the cache is being flushed, the size of the 7343memory range, and the number 3 (to flush both caches). The default 7344depends on the target gcc was configured for, but commonly is either 7345@samp{_flush_func} or @samp{__cpu_flush}. 7346@end table 7347 7348These options are defined by the macro 7349@code{TARGET_SWITCHES} in the machine description. The default for the 7350options is also defined by that macro, which enables you to change the 7351defaults. 7352 7353@node i386 and x86-64 Options 7354@subsection Intel 386 and AMD x86-64 Options 7355@cindex i386 Options 7356@cindex x86-64 Options 7357@cindex Intel 386 Options 7358@cindex AMD x86-64 Options 7359 7360These @samp{-m} options are defined for the i386 and x86-64 family of 7361computers: 7362 7363@table @gcctabopt 7364@item -mcpu=@var{cpu-type} 7365@opindex mcpu 7366Tune to @var{cpu-type} everything applicable about the generated code, except 7367for the ABI and the set of available instructions. The choices for 7368@var{cpu-type} are @samp{i386}, @samp{i486}, @samp{i586}, @samp{i686}, 7369@samp{pentium}, @samp{pentium-mmx}, @samp{pentiumpro}, @samp{pentium2}, 7370@samp{pentium3}, @samp{pentium4}, @samp{k6}, @samp{k6-2}, @samp{k6-3}, 7371@samp{athlon}, @samp{athlon-tbird}, @samp{athlon-4}, @samp{athlon-xp} 7372and @samp{athlon-mp}. 7373 7374While picking a specific @var{cpu-type} will schedule things appropriately 7375for that particular chip, the compiler will not generate any code that 7376does not run on the i386 without the @option{-march=@var{cpu-type}} option 7377being used. @samp{i586} is equivalent to @samp{pentium} and @samp{i686} 7378is equivalent to @samp{pentiumpro}. @samp{k6} and @samp{athlon} are the 7379AMD chips as opposed to the Intel ones. 7380 7381@item -march=@var{cpu-type} 7382@opindex march 7383Generate instructions for the machine type @var{cpu-type}. The choices 7384for @var{cpu-type} are the same as for @option{-mcpu}. Moreover, 7385specifying @option{-march=@var{cpu-type}} implies @option{-mcpu=@var{cpu-type}}. 7386 7387@item -m386 7388@itemx -m486 7389@itemx -mpentium 7390@itemx -mpentiumpro 7391@opindex m386 7392@opindex m486 7393@opindex mpentium 7394@opindex mpentiumpro 7395These options are synonyms for @option{-mcpu=i386}, @option{-mcpu=i486}, 7396@option{-mcpu=pentium}, and @option{-mcpu=pentiumpro} respectively. 7397These synonyms are deprecated. 7398 7399@item -mfpmath=@var{unit} 7400@opindex march 7401generate floating point arithmetics for selected unit @var{unit}. the choices 7402for @var{unit} are: 7403 7404@table @samp 7405@item 387 7406Use the standard 387 floating point coprocessor present majority of chips and 7407emulated otherwise. Code compiled with this option will run almost everywhere. 7408The temporary results are computed in 80bit precesion instead of precision 7409specified by the type resulting in slightly different results compared to most 7410of other chips. See @option{-ffloat-store} for more detailed description. 7411 7412This is the default choice for i386 compiler. 7413 7414@item sse 7415Use scalar floating point instructions present in the SSE instruction set. 7416This instruction set is supported by Pentium3 and newer chips, in the AMD line 7417by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE 7418instruction set supports only single precision arithmetics, thus the double and 7419extended precision arithmetics is still done using 387. Later version, present 7420only in Pentium4 and the future AMD x86-64 chips supports double precision 7421arithmetics too. 7422 7423For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or 7424@option{-msse2} switches to enable SSE extensions and make this option 7425effective. For x86-64 compiler, these extensions are enabled by default. 7426 7427The resulting code should be considerably faster in majority of cases and avoid 7428the numerical instability problems of 387 code, but may break some existing 7429code that expects temporaries to be 80bit. 7430 7431This is the default choice for x86-64 compiler. 7432 7433@item sse,387 7434Attempt to utilize both instruction sets at once. This effectivly double the 7435amount of available registers and on chips with separate execution units for 7436387 and SSE the execution resources too. Use this option with care, as it is 7437still experimental, because gcc register allocator does not model separate 7438functional units well resulting in instable performance. 7439@end table 7440 7441@item -masm=@var{dialect} 7442@opindex masm=@var{dialect} 7443Output asm instructions using selected @var{dialect}. Supported choices are 7444@samp{intel} or @samp{att} (the default one). 7445 7446@item -mieee-fp 7447@itemx -mno-ieee-fp 7448@opindex mieee-fp 7449@opindex mno-ieee-fp 7450Control whether or not the compiler uses IEEE floating point 7451comparisons. These handle correctly the case where the result of a 7452comparison is unordered. 7453 7454@item -msoft-float 7455@opindex msoft-float 7456Generate output containing library calls for floating point. 7457@strong{Warning:} the requisite libraries are not part of GCC@. 7458Normally the facilities of the machine's usual C compiler are used, but 7459this can't be done directly in cross-compilation. You must make your 7460own arrangements to provide suitable library functions for 7461cross-compilation. 7462 7463On machines where a function returns floating point results in the 80387 7464register stack, some floating point opcodes may be emitted even if 7465@option{-msoft-float} is used. 7466 7467@item -mno-fp-ret-in-387 7468@opindex mno-fp-ret-in-387 7469Do not use the FPU registers for return values of functions. 7470 7471The usual calling convention has functions return values of types 7472@code{float} and @code{double} in an FPU register, even if there 7473is no FPU@. The idea is that the operating system should emulate 7474an FPU@. 7475 7476The option @option{-mno-fp-ret-in-387} causes such values to be returned 7477in ordinary CPU registers instead. 7478 7479@item -mno-fancy-math-387 7480@opindex mno-fancy-math-387 7481Some 387 emulators do not support the @code{sin}, @code{cos} and 7482@code{sqrt} instructions for the 387. Specify this option to avoid 7483generating those instructions. This option is the default on FreeBSD, 7484OpenBSD and NetBSD@. This option is overridden when @option{-march} 7485indicates that the target cpu will always have an FPU and so the 7486instruction will not need emulation. As of revision 2.6.1, these 7487instructions are not generated unless you also use the 7488@option{-funsafe-math-optimizations} switch. 7489 7490@item -malign-double 7491@itemx -mno-align-double 7492@opindex malign-double 7493@opindex mno-align-double 7494Control whether GCC aligns @code{double}, @code{long double}, and 7495@code{long long} variables on a two word boundary or a one word 7496boundary. Aligning @code{double} variables on a two word boundary will 7497produce code that runs somewhat faster on a @samp{Pentium} at the 7498expense of more memory. 7499 7500@strong{Warning:} if you use the @option{-malign-double} switch, 7501structures containing the above types will be aligned differently than 7502the published application binary interface specifications for the 386 7503and will not be binary compatible with structures in code compiled 7504without that switch. 7505 7506@item -m128bit-long-double 7507@opindex m128bit-long-double 7508Control the size of @code{long double} type. i386 application binary interface 7509specify the size to be 12 bytes, while modern architectures (Pentium and newer) 7510prefer @code{long double} aligned to 8 or 16 byte boundary. This is 7511impossible to reach with 12 byte long doubles in the array accesses. 7512 7513@strong{Warning:} if you use the @option{-m128bit-long-double} switch, the 7514structures and arrays containing @code{long double} will change their size as 7515well as function calling convention for function taking @code{long double} 7516will be modified. 7517 7518@item -m96bit-long-double 7519@opindex m96bit-long-double 7520Set the size of @code{long double} to 96 bits as required by the i386 7521application binary interface. This is the default. 7522 7523@item -msvr3-shlib 7524@itemx -mno-svr3-shlib 7525@opindex msvr3-shlib 7526@opindex mno-svr3-shlib 7527Control whether GCC places uninitialized local variables into the 7528@code{bss} or @code{data} segments. @option{-msvr3-shlib} places them 7529into @code{bss}. These options are meaningful only on System V Release 3. 7530 7531@item -mrtd 7532@opindex mrtd 7533Use a different function-calling convention, in which functions that 7534take a fixed number of arguments return with the @code{ret} @var{num} 7535instruction, which pops their arguments while returning. This saves one 7536instruction in the caller since there is no need to pop the arguments 7537there. 7538 7539You can specify that an individual function is called with this calling 7540sequence with the function attribute @samp{stdcall}. You can also 7541override the @option{-mrtd} option by using the function attribute 7542@samp{cdecl}. @xref{Function Attributes}. 7543 7544@strong{Warning:} this calling convention is incompatible with the one 7545normally used on Unix, so you cannot use it if you need to call 7546libraries compiled with the Unix compiler. 7547 7548Also, you must provide function prototypes for all functions that 7549take variable numbers of arguments (including @code{printf}); 7550otherwise incorrect code will be generated for calls to those 7551functions. 7552 7553In addition, seriously incorrect code will result if you call a 7554function with too many arguments. (Normally, extra arguments are 7555harmlessly ignored.) 7556 7557@item -mregparm=@var{num} 7558@opindex mregparm 7559Control how many registers are used to pass integer arguments. By 7560default, no registers are used to pass arguments, and at most 3 7561registers can be used. You can control this behavior for a specific 7562function by using the function attribute @samp{regparm}. 7563@xref{Function Attributes}. 7564 7565@strong{Warning:} if you use this switch, and 7566@var{num} is nonzero, then you must build all modules with the same 7567value, including any libraries. This includes the system libraries and 7568startup modules. 7569 7570@item -mpreferred-stack-boundary=@var{num} 7571@opindex mpreferred-stack-boundary 7572Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 7573byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 7574the default is 4 (16 bytes or 128 bits), except when optimizing for code 7575size (@option{-Os}), in which case the default is the minimum correct 7576alignment (4 bytes for x86, and 8 bytes for x86-64). 7577 7578On Pentium and PentiumPro, @code{double} and @code{long double} values 7579should be aligned to an 8 byte boundary (see @option{-malign-double}) or 7580suffer significant run time performance penalties. On Pentium III, the 7581Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar 7582penalties if it is not 16 byte aligned. 7583 7584To ensure proper alignment of this values on the stack, the stack boundary 7585must be as aligned as that required by any value stored on the stack. 7586Further, every function must be generated such that it keeps the stack 7587aligned. Thus calling a function compiled with a higher preferred 7588stack boundary from a function compiled with a lower preferred stack 7589boundary will most likely misalign the stack. It is recommended that 7590libraries that use callbacks always use the default setting. 7591 7592This extra alignment does consume extra stack space, and generally 7593increases code size. Code that is sensitive to stack space usage, such 7594as embedded systems and operating system kernels, may want to reduce the 7595preferred alignment to @option{-mpreferred-stack-boundary=2}. 7596 7597@item -mmmx 7598@itemx -mno-mmx 7599@item -msse 7600@itemx -mno-sse 7601@item -msse2 7602@itemx -mno-sse2 7603@item -m3dnow 7604@itemx -mno-3dnow 7605@opindex mmmx 7606@opindex mno-mmx 7607@opindex msse 7608@opindex mno-sse 7609@opindex m3dnow 7610@opindex mno-3dnow 7611These switches enable or disable the use of built-in functions that allow 7612direct access to the MMX, SSE and 3Dnow extensions of the instruction set. 7613 7614@xref{X86 Built-in Functions}, for details of the functions enabled 7615and disabled by these switches. 7616 7617To have SSE/SSE2 instructions generated automatically from floating-point code, 7618see @option{-mfpmath=sse}. 7619 7620@item -mpush-args 7621@itemx -mno-push-args 7622@opindex mpush-args 7623@opindex mno-push-args 7624Use PUSH operations to store outgoing parameters. This method is shorter 7625and usually equally fast as method using SUB/MOV operations and is enabled 7626by default. In some cases disabling it may improve performance because of 7627improved scheduling and reduced dependencies. 7628 7629@item -maccumulate-outgoing-args 7630@opindex maccumulate-outgoing-args 7631If enabled, the maximum amount of space required for outgoing arguments will be 7632computed in the function prologue. This is faster on most modern CPUs 7633because of reduced dependencies, improved scheduling and reduced stack usage 7634when preferred stack boundary is not equal to 2. The drawback is a notable 7635increase in code size. This switch implies @option{-mno-push-args}. 7636 7637@item -mthreads 7638@opindex mthreads 7639Support thread-safe exception handling on @samp{Mingw32}. Code that relies 7640on thread-safe exception handling must compile and link all code with the 7641@option{-mthreads} option. When compiling, @option{-mthreads} defines 7642@option{-D_MT}; when linking, it links in a special thread helper library 7643@option{-lmingwthrd} which cleans up per thread exception handling data. 7644 7645@item -mno-align-stringops 7646@opindex mno-align-stringops 7647Do not align destination of inlined string operations. This switch reduces 7648code size and improves performance in case the destination is already aligned, 7649but gcc don't know about it. 7650 7651@item -minline-all-stringops 7652@opindex minline-all-stringops 7653By default GCC inlines string operations only when destination is known to be 7654aligned at least to 4 byte boundary. This enables more inlining, increase code 7655size, but may improve performance of code that depends on fast memcpy, strlen 7656and memset for short lengths. 7657 7658@item -momit-leaf-frame-pointer 7659@opindex momit-leaf-frame-pointer 7660Don't keep the frame pointer in a register for leaf functions. This 7661avoids the instructions to save, set up and restore frame pointers and 7662makes an extra register available in leaf functions. The option 7663@option{-fomit-frame-pointer} removes the frame pointer for all functions 7664which might make debugging harder. 7665@end table 7666 7667These @samp{-m} switches are supported in addition to the above 7668on AMD x86-64 processors in 64-bit environments. 7669 7670@table @gcctabopt 7671@item -m32 7672@itemx -m64 7673@opindex m32 7674@opindex m64 7675Generate code for a 32-bit or 64-bit environment. 7676The 32-bit environment sets int, long and pointer to 32 bits and 7677generates code that runs on any i386 system. 7678The 64-bit environment sets int to 32 bits and long and pointer 7679to 64 bits and generates code for AMD's x86-64 architecture. 7680 7681@item -mno-red-zone 7682@opindex no-red-zone 7683Do not use a so called red zone for x86-64 code. The red zone is mandated 7684by the x86-64 ABI, it is a 128-byte area beyond the location of the 7685stack pointer that will not be modified by signal or interrupt handlers 7686and therefore can be used for temporary data without adjusting the stack 7687pointer. The flag @option{-mno-red-zone} disables this red zone. 7688 7689@item -mcmodel=small 7690@opindex mcmodel=small 7691Generate code for the small code model: the program and its symbols must 7692be linked in the lower 2 GB of the address space. Pointers are 64 bits. 7693Programs can be statically or dynamically linked. This is the default 7694code model. 7695 7696@item -mcmodel=kernel 7697@opindex mcmodel=kernel 7698Generate code for the kernel code model. The kernel runs in the 7699negative 2 GB of the address space. 7700This model has to be used for Linux kernel code. 7701 7702@item -mcmodel=medium 7703@opindex mcmodel=medium 7704Generate code for the medium model: The program is linked in the lower 2 7705GB of the address space but symbols can be located anywhere in the 7706address space. Programs can be statically or dynamically linked, but 7707building of shared libraries are not supported with the medium model. 7708 7709@item -mcmodel=large 7710@opindex mcmodel=large 7711Generate code for the large model: This model makes no assumptions 7712about addresses and sizes of sections. Currently GCC does not implement 7713this model. 7714@end table 7715 7716@node HPPA Options 7717@subsection HPPA Options 7718@cindex HPPA Options 7719 7720These @samp{-m} options are defined for the HPPA family of computers: 7721 7722@table @gcctabopt 7723@item -march=@var{architecture-type} 7724@opindex march 7725Generate code for the specified architecture. The choices for 7726@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 77271.1, and @samp{2.0} for PA 2.0 processors. Refer to 7728@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 7729architecture option for your machine. Code compiled for lower numbered 7730architectures will run on higher numbered architectures, but not the 7731other way around. 7732 7733PA 2.0 support currently requires gas snapshot 19990413 or later. The 7734next release of binutils (current is 2.9.1) will probably contain PA 2.0 7735support. 7736 7737@item -mpa-risc-1-0 7738@itemx -mpa-risc-1-1 7739@itemx -mpa-risc-2-0 7740@opindex mpa-risc-1-0 7741@opindex mpa-risc-1-1 7742@opindex mpa-risc-2-0 7743Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 7744 7745@item -mbig-switch 7746@opindex mbig-switch 7747Generate code suitable for big switch tables. Use this option only if 7748the assembler/linker complain about out of range branches within a switch 7749table. 7750 7751@item -mjump-in-delay 7752@opindex mjump-in-delay 7753Fill delay slots of function calls with unconditional jump instructions 7754by modifying the return pointer for the function call to be the target 7755of the conditional jump. 7756 7757@item -mdisable-fpregs 7758@opindex mdisable-fpregs 7759Prevent floating point registers from being used in any manner. This is 7760necessary for compiling kernels which perform lazy context switching of 7761floating point registers. If you use this option and attempt to perform 7762floating point operations, the compiler will abort. 7763 7764@item -mdisable-indexing 7765@opindex mdisable-indexing 7766Prevent the compiler from using indexing address modes. This avoids some 7767rather obscure problems when compiling MIG generated code under MACH@. 7768 7769@item -mno-space-regs 7770@opindex mno-space-regs 7771Generate code that assumes the target has no space registers. This allows 7772GCC to generate faster indirect calls and use unscaled index address modes. 7773 7774Such code is suitable for level 0 PA systems and kernels. 7775 7776@item -mfast-indirect-calls 7777@opindex mfast-indirect-calls 7778Generate code that assumes calls never cross space boundaries. This 7779allows GCC to emit code which performs faster indirect calls. 7780 7781This option will not work in the presence of shared libraries or nested 7782functions. 7783 7784@item -mlong-load-store 7785@opindex mlong-load-store 7786Generate 3-instruction load and store sequences as sometimes required by 7787the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 7788the HP compilers. 7789 7790@item -mportable-runtime 7791@opindex mportable-runtime 7792Use the portable calling conventions proposed by HP for ELF systems. 7793 7794@item -mgas 7795@opindex mgas 7796Enable the use of assembler directives only GAS understands. 7797 7798@item -mschedule=@var{cpu-type} 7799@opindex mschedule 7800Schedule code according to the constraints for the machine type 7801@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 7802@samp{7100}, @samp{7100LC}, @samp{7200}, and @samp{8000}. Refer to 7803@file{/usr/lib/sched.models} on an HP-UX system to determine the 7804proper scheduling option for your machine. 7805 7806@item -mlinker-opt 7807@opindex mlinker-opt 7808Enable the optimization pass in the HPUX linker. Note this makes symbolic 7809debugging impossible. It also triggers a bug in the HPUX 8 and HPUX 9 linkers 7810in which they give bogus error messages when linking some programs. 7811 7812@item -msoft-float 7813@opindex msoft-float 7814Generate output containing library calls for floating point. 7815@strong{Warning:} the requisite libraries are not available for all HPPA 7816targets. Normally the facilities of the machine's usual C compiler are 7817used, but this cannot be done directly in cross-compilation. You must make 7818your own arrangements to provide suitable library functions for 7819cross-compilation. The embedded target @samp{hppa1.1-*-pro} 7820does provide software floating point support. 7821 7822@option{-msoft-float} changes the calling convention in the output file; 7823therefore, it is only useful if you compile @emph{all} of a program with 7824this option. In particular, you need to compile @file{libgcc.a}, the 7825library that comes with GCC, with @option{-msoft-float} in order for 7826this to work. 7827@end table 7828 7829@node Intel 960 Options 7830@subsection Intel 960 Options 7831 7832These @samp{-m} options are defined for the Intel 960 implementations: 7833 7834@table @gcctabopt 7835@item -m@var{cpu-type} 7836@opindex mka 7837@opindex mkb 7838@opindex mmc 7839@opindex mca 7840@opindex mcf 7841@opindex msa 7842@opindex msb 7843Assume the defaults for the machine type @var{cpu-type} for some of 7844the other options, including instruction scheduling, floating point 7845support, and addressing modes. The choices for @var{cpu-type} are 7846@samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf}, 7847@samp{sa}, and @samp{sb}. 7848The default is 7849@samp{kb}. 7850 7851@item -mnumerics 7852@itemx -msoft-float 7853@opindex mnumerics 7854@opindex msoft-float 7855The @option{-mnumerics} option indicates that the processor does support 7856floating-point instructions. The @option{-msoft-float} option indicates 7857that floating-point support should not be assumed. 7858 7859@item -mleaf-procedures 7860@itemx -mno-leaf-procedures 7861@opindex mleaf-procedures 7862@opindex mno-leaf-procedures 7863Do (or do not) attempt to alter leaf procedures to be callable with the 7864@code{bal} instruction as well as @code{call}. This will result in more 7865efficient code for explicit calls when the @code{bal} instruction can be 7866substituted by the assembler or linker, but less efficient code in other 7867cases, such as calls via function pointers, or using a linker that doesn't 7868support this optimization. 7869 7870@item -mtail-call 7871@itemx -mno-tail-call 7872@opindex mtail-call 7873@opindex mno-tail-call 7874Do (or do not) make additional attempts (beyond those of the 7875machine-independent portions of the compiler) to optimize tail-recursive 7876calls into branches. You may not want to do this because the detection of 7877cases where this is not valid is not totally complete. The default is 7878@option{-mno-tail-call}. 7879 7880@item -mcomplex-addr 7881@itemx -mno-complex-addr 7882@opindex mcomplex-addr 7883@opindex mno-complex-addr 7884Assume (or do not assume) that the use of a complex addressing mode is a 7885win on this implementation of the i960. Complex addressing modes may not 7886be worthwhile on the K-series, but they definitely are on the C-series. 7887The default is currently @option{-mcomplex-addr} for all processors except 7888the CB and CC@. 7889 7890@item -mcode-align 7891@itemx -mno-code-align 7892@opindex mcode-align 7893@opindex mno-code-align 7894Align code to 8-byte boundaries for faster fetching (or don't bother). 7895Currently turned on by default for C-series implementations only. 7896 7897@ignore 7898@item -mclean-linkage 7899@itemx -mno-clean-linkage 7900@opindex mclean-linkage 7901@opindex mno-clean-linkage 7902These options are not fully implemented. 7903@end ignore 7904 7905@item -mic-compat 7906@itemx -mic2.0-compat 7907@itemx -mic3.0-compat 7908@opindex mic-compat 7909@opindex mic2.0-compat 7910@opindex mic3.0-compat 7911Enable compatibility with iC960 v2.0 or v3.0. 7912 7913@item -masm-compat 7914@itemx -mintel-asm 7915@opindex masm-compat 7916@opindex mintel-asm 7917Enable compatibility with the iC960 assembler. 7918 7919@item -mstrict-align 7920@itemx -mno-strict-align 7921@opindex mstrict-align 7922@opindex mno-strict-align 7923Do not permit (do permit) unaligned accesses. 7924 7925@item -mold-align 7926@opindex mold-align 7927Enable structure-alignment compatibility with Intel's gcc release version 79281.3 (based on gcc 1.37). This option implies @option{-mstrict-align}. 7929 7930@item -mlong-double-64 7931@opindex mlong-double-64 7932Implement type @samp{long double} as 64-bit floating point numbers. 7933Without the option @samp{long double} is implemented by 80-bit 7934floating point numbers. The only reason we have it because there is 7935no 128-bit @samp{long double} support in @samp{fp-bit.c} yet. So it 7936is only useful for people using soft-float targets. Otherwise, we 7937should recommend against use of it. 7938 7939@end table 7940 7941@node DEC Alpha Options 7942@subsection DEC Alpha Options 7943 7944These @samp{-m} options are defined for the DEC Alpha implementations: 7945 7946@table @gcctabopt 7947@item -mno-soft-float 7948@itemx -msoft-float 7949@opindex mno-soft-float 7950@opindex msoft-float 7951Use (do not use) the hardware floating-point instructions for 7952floating-point operations. When @option{-msoft-float} is specified, 7953functions in @file{libgcc.a} will be used to perform floating-point 7954operations. Unless they are replaced by routines that emulate the 7955floating-point operations, or compiled in such a way as to call such 7956emulations routines, these routines will issue floating-point 7957operations. If you are compiling for an Alpha without floating-point 7958operations, you must ensure that the library is built so as not to call 7959them. 7960 7961Note that Alpha implementations without floating-point operations are 7962required to have floating-point registers. 7963 7964@item -mfp-reg 7965@itemx -mno-fp-regs 7966@opindex mfp-reg 7967@opindex mno-fp-regs 7968Generate code that uses (does not use) the floating-point register set. 7969@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 7970register set is not used, floating point operands are passed in integer 7971registers as if they were integers and floating-point results are passed 7972in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 7973so any function with a floating-point argument or return value called by code 7974compiled with @option{-mno-fp-regs} must also be compiled with that 7975option. 7976 7977A typical use of this option is building a kernel that does not use, 7978and hence need not save and restore, any floating-point registers. 7979 7980@item -mieee 7981@opindex mieee 7982The Alpha architecture implements floating-point hardware optimized for 7983maximum performance. It is mostly compliant with the IEEE floating 7984point standard. However, for full compliance, software assistance is 7985required. This option generates code fully IEEE compliant code 7986@emph{except} that the @var{inexact-flag} is not maintained (see below). 7987If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 7988defined during compilation. The resulting code is less efficient but is 7989able to correctly support denormalized numbers and exceptional IEEE 7990values such as not-a-number and plus/minus infinity. Other Alpha 7991compilers call this option @option{-ieee_with_no_inexact}. 7992 7993@item -mieee-with-inexact 7994@opindex mieee-with-inexact 7995This is like @option{-mieee} except the generated code also maintains 7996the IEEE @var{inexact-flag}. Turning on this option causes the 7997generated code to implement fully-compliant IEEE math. In addition to 7998@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 7999macro. On some Alpha implementations the resulting code may execute 8000significantly slower than the code generated by default. Since there is 8001very little code that depends on the @var{inexact-flag}, you should 8002normally not specify this option. Other Alpha compilers call this 8003option @option{-ieee_with_inexact}. 8004 8005@item -mfp-trap-mode=@var{trap-mode} 8006@opindex mfp-trap-mode 8007This option controls what floating-point related traps are enabled. 8008Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 8009The trap mode can be set to one of four values: 8010 8011@table @samp 8012@item n 8013This is the default (normal) setting. The only traps that are enabled 8014are the ones that cannot be disabled in software (e.g., division by zero 8015trap). 8016 8017@item u 8018In addition to the traps enabled by @samp{n}, underflow traps are enabled 8019as well. 8020 8021@item su 8022Like @samp{su}, but the instructions are marked to be safe for software 8023completion (see Alpha architecture manual for details). 8024 8025@item sui 8026Like @samp{su}, but inexact traps are enabled as well. 8027@end table 8028 8029@item -mfp-rounding-mode=@var{rounding-mode} 8030@opindex mfp-rounding-mode 8031Selects the IEEE rounding mode. Other Alpha compilers call this option 8032@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 8033of: 8034 8035@table @samp 8036@item n 8037Normal IEEE rounding mode. Floating point numbers are rounded towards 8038the nearest machine number or towards the even machine number in case 8039of a tie. 8040 8041@item m 8042Round towards minus infinity. 8043 8044@item c 8045Chopped rounding mode. Floating point numbers are rounded towards zero. 8046 8047@item d 8048Dynamic rounding mode. A field in the floating point control register 8049(@var{fpcr}, see Alpha architecture reference manual) controls the 8050rounding mode in effect. The C library initializes this register for 8051rounding towards plus infinity. Thus, unless your program modifies the 8052@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 8053@end table 8054 8055@item -mtrap-precision=@var{trap-precision} 8056@opindex mtrap-precision 8057In the Alpha architecture, floating point traps are imprecise. This 8058means without software assistance it is impossible to recover from a 8059floating trap and program execution normally needs to be terminated. 8060GCC can generate code that can assist operating system trap handlers 8061in determining the exact location that caused a floating point trap. 8062Depending on the requirements of an application, different levels of 8063precisions can be selected: 8064 8065@table @samp 8066@item p 8067Program precision. This option is the default and means a trap handler 8068can only identify which program caused a floating point exception. 8069 8070@item f 8071Function precision. The trap handler can determine the function that 8072caused a floating point exception. 8073 8074@item i 8075Instruction precision. The trap handler can determine the exact 8076instruction that caused a floating point exception. 8077@end table 8078 8079Other Alpha compilers provide the equivalent options called 8080@option{-scope_safe} and @option{-resumption_safe}. 8081 8082@item -mieee-conformant 8083@opindex mieee-conformant 8084This option marks the generated code as IEEE conformant. You must not 8085use this option unless you also specify @option{-mtrap-precision=i} and either 8086@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 8087is to emit the line @samp{.eflag 48} in the function prologue of the 8088generated assembly file. Under DEC Unix, this has the effect that 8089IEEE-conformant math library routines will be linked in. 8090 8091@item -mbuild-constants 8092@opindex mbuild-constants 8093Normally GCC examines a 32- or 64-bit integer constant to 8094see if it can construct it from smaller constants in two or three 8095instructions. If it cannot, it will output the constant as a literal and 8096generate code to load it from the data segment at runtime. 8097 8098Use this option to require GCC to construct @emph{all} integer constants 8099using code, even if it takes more instructions (the maximum is six). 8100 8101You would typically use this option to build a shared library dynamic 8102loader. Itself a shared library, it must relocate itself in memory 8103before it can find the variables and constants in its own data segment. 8104 8105@item -malpha-as 8106@itemx -mgas 8107@opindex malpha-as 8108@opindex mgas 8109Select whether to generate code to be assembled by the vendor-supplied 8110assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}. 8111 8112@item -mbwx 8113@itemx -mno-bwx 8114@itemx -mcix 8115@itemx -mno-cix 8116@itemx -mfix 8117@itemx -mno-fix 8118@itemx -mmax 8119@itemx -mno-max 8120@opindex mbwx 8121@opindex mno-bwx 8122@opindex mcix 8123@opindex mno-cix 8124@opindex mfix 8125@opindex mno-fix 8126@opindex mmax 8127@opindex mno-max 8128Indicate whether GCC should generate code to use the optional BWX, 8129CIX, FIX and MAX instruction sets. The default is to use the instruction 8130sets supported by the CPU type specified via @option{-mcpu=} option or that 8131of the CPU on which GCC was built if none was specified. 8132 8133@item -mfloat-vax 8134@itemx -mfloat-ieee 8135@opindex mfloat-vax 8136@opindex mfloat-ieee 8137Generate code that uses (does not use) VAX F and G floating point 8138arithmetic instead of IEEE single and double precision. 8139 8140@item -mexplicit-relocs 8141@itemx -mno-explicit-relocs 8142@opindex mexplicit-relocs 8143@opindex mno-explicit-relocs 8144Older Alpha assemblers provided no way to generate symbol relocations 8145except via assembler macros. Use of these macros does not allow 8146optimial instruction scheduling. GNU binutils as of version 2.12 8147supports a new syntax that allows the compiler to explicitly mark 8148which relocations should apply to which instructions. This option 8149is mostly useful for debugging, as GCC detects the capabilities of 8150the assembler when it is built and sets the default accordingly. 8151 8152@item -msmall-data 8153@itemx -mlarge-data 8154@opindex msmall-data 8155@opindex mlarge-data 8156When @option{-mexplicit-relocs} is in effect, static data is 8157accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 8158is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 8159(the @code{.sdata} and @code{.sbss} sections) and are accessed via 816016-bit relocations off of the @code{$gp} register. This limits the 8161size of the small data area to 64KB, but allows the variables to be 8162directly accessed via a single instruction. 8163 8164The default is @option{-mlarge-data}. With this option the data area 8165is limited to just below 2GB. Programs that require more than 2GB of 8166data must use @code{malloc} or @code{mmap} to allocate the data in the 8167heap instead of in the program's data segment. 8168 8169When generating code for shared libraries, @option{-fpic} implies 8170@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 8171 8172@item -mcpu=@var{cpu_type} 8173@opindex mcpu 8174Set the instruction set and instruction scheduling parameters for 8175machine type @var{cpu_type}. You can specify either the @samp{EV} 8176style name or the corresponding chip number. GCC supports scheduling 8177parameters for the EV4, EV5 and EV6 family of processors and will 8178choose the default values for the instruction set from the processor 8179you specify. If you do not specify a processor type, GCC will default 8180to the processor on which the compiler was built. 8181 8182Supported values for @var{cpu_type} are 8183 8184@table @samp 8185@item ev4 8186@item ev45 8187@itemx 21064 8188Schedules as an EV4 and has no instruction set extensions. 8189 8190@item ev5 8191@itemx 21164 8192Schedules as an EV5 and has no instruction set extensions. 8193 8194@item ev56 8195@itemx 21164a 8196Schedules as an EV5 and supports the BWX extension. 8197 8198@item pca56 8199@itemx 21164pc 8200@itemx 21164PC 8201Schedules as an EV5 and supports the BWX and MAX extensions. 8202 8203@item ev6 8204@itemx 21264 8205Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 8206 8207@item ev67 8208@item 21264a 8209Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 8210@end table 8211 8212@item -mtune=@var{cpu_type} 8213@opindex mtune 8214Set only the instruction scheduling parameters for machine type 8215@var{cpu_type}. The instruction set is not changed. 8216 8217@item -mmemory-latency=@var{time} 8218@opindex mmemory-latency 8219Sets the latency the scheduler should assume for typical memory 8220references as seen by the application. This number is highly 8221dependent on the memory access patterns used by the application 8222and the size of the external cache on the machine. 8223 8224Valid options for @var{time} are 8225 8226@table @samp 8227@item @var{number} 8228A decimal number representing clock cycles. 8229 8230@item L1 8231@itemx L2 8232@itemx L3 8233@itemx main 8234The compiler contains estimates of the number of clock cycles for 8235``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 8236(also called Dcache, Scache, and Bcache), as well as to main memory. 8237Note that L3 is only valid for EV5. 8238 8239@end table 8240@end table 8241 8242@node DEC Alpha/VMS Options 8243@subsection DEC Alpha/VMS Options 8244 8245These @samp{-m} options are defined for the DEC Alpha/VMS implementations: 8246 8247@table @gcctabopt 8248@item -mvms-return-codes 8249@opindex mvms-return-codes 8250Return VMS condition codes from main. The default is to return POSIX 8251style condition (e.g.@ error) codes. 8252@end table 8253 8254@node Clipper Options 8255@subsection Clipper Options 8256 8257These @samp{-m} options are defined for the Clipper implementations: 8258 8259@table @gcctabopt 8260@item -mc300 8261@opindex mc300 8262Produce code for a C300 Clipper processor. This is the default. 8263 8264@item -mc400 8265@opindex mc400 8266Produce code for a C400 Clipper processor, i.e.@: use floating point 8267registers f8--f15. 8268@end table 8269 8270@node H8/300 Options 8271@subsection H8/300 Options 8272 8273These @samp{-m} options are defined for the H8/300 implementations: 8274 8275@table @gcctabopt 8276@item -mrelax 8277@opindex mrelax 8278Shorten some address references at link time, when possible; uses the 8279linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 8280ld.info, Using ld}, for a fuller description. 8281 8282@item -mh 8283@opindex mh 8284Generate code for the H8/300H@. 8285 8286@item -ms 8287@opindex ms 8288Generate code for the H8/S@. 8289 8290@item -ms2600 8291@opindex ms2600 8292Generate code for the H8/S2600. This switch must be used with @option{-ms}. 8293 8294@item -mint32 8295@opindex mint32 8296Make @code{int} data 32 bits by default. 8297 8298@item -malign-300 8299@opindex malign-300 8300On the H8/300H and H8/S, use the same alignment rules as for the H8/300. 8301The default for the H8/300H and H8/S is to align longs and floats on 4 8302byte boundaries. 8303@option{-malign-300} causes them to be aligned on 2 byte boundaries. 8304This option has no effect on the H8/300. 8305@end table 8306 8307@node SH Options 8308@subsection SH Options 8309 8310These @samp{-m} options are defined for the SH implementations: 8311 8312@table @gcctabopt 8313@item -m1 8314@opindex m1 8315Generate code for the SH1. 8316 8317@item -m2 8318@opindex m2 8319Generate code for the SH2. 8320 8321@item -m3 8322@opindex m3 8323Generate code for the SH3. 8324 8325@item -m3e 8326@opindex m3e 8327Generate code for the SH3e. 8328 8329@item -m4-nofpu 8330@opindex m4-nofpu 8331Generate code for the SH4 without a floating-point unit. 8332 8333@item -m4-single-only 8334@opindex m4-single-only 8335Generate code for the SH4 with a floating-point unit that only 8336supports single-precision arithmetic. 8337 8338@item -m4-single 8339@opindex m4-single 8340Generate code for the SH4 assuming the floating-point unit is in 8341single-precision mode by default. 8342 8343@item -m4 8344@opindex m4 8345Generate code for the SH4. 8346 8347@item -mb 8348@opindex mb 8349Compile code for the processor in big endian mode. 8350 8351@item -ml 8352@opindex ml 8353Compile code for the processor in little endian mode. 8354 8355@item -mdalign 8356@opindex mdalign 8357Align doubles at 64-bit boundaries. Note that this changes the calling 8358conventions, and thus some functions from the standard C library will 8359not work unless you recompile it first with @option{-mdalign}. 8360 8361@item -mrelax 8362@opindex mrelax 8363Shorten some address references at link time, when possible; uses the 8364linker option @option{-relax}. 8365 8366@item -mbigtable 8367@opindex mbigtable 8368Use 32-bit offsets in @code{switch} tables. The default is to use 836916-bit offsets. 8370 8371@item -mfmovd 8372@opindex mfmovd 8373Enable the use of the instruction @code{fmovd}. 8374 8375@item -mhitachi 8376@opindex mhitachi 8377Comply with the calling conventions defined by Hitachi. 8378 8379@item -mnomacsave 8380@opindex mnomacsave 8381Mark the @code{MAC} register as call-clobbered, even if 8382@option{-mhitachi} is given. 8383 8384@item -mieee 8385@opindex mieee 8386Increase IEEE-compliance of floating-point code. 8387 8388@item -misize 8389@opindex misize 8390Dump instruction size and location in the assembly code. 8391 8392@item -mpadstruct 8393@opindex mpadstruct 8394This option is deprecated. It pads structures to multiple of 4 bytes, 8395which is incompatible with the SH ABI@. 8396 8397@item -mspace 8398@opindex mspace 8399Optimize for space instead of speed. Implied by @option{-Os}. 8400 8401@item -mprefergot 8402@opindex mprefergot 8403When generating position-independent code, emit function calls using 8404the Global Offset Table instead of the Procedure Linkage Table. 8405 8406@item -musermode 8407@opindex musermode 8408Generate a library function call to invalidate instruction cache 8409entries, after fixing up a trampoline. This library function call 8410doesn't assume it can write to the whole memory address space. This 8411is the default when the target is @code{sh-*-linux*}. 8412@end table 8413 8414@node System V Options 8415@subsection Options for System V 8416 8417These additional options are available on System V Release 4 for 8418compatibility with other compilers on those systems: 8419 8420@table @gcctabopt 8421@item -G 8422@opindex G 8423Create a shared object. 8424It is recommended that @option{-symbolic} or @option{-shared} be used instead. 8425 8426@item -Qy 8427@opindex Qy 8428Identify the versions of each tool used by the compiler, in a 8429@code{.ident} assembler directive in the output. 8430 8431@item -Qn 8432@opindex Qn 8433Refrain from adding @code{.ident} directives to the output file (this is 8434the default). 8435 8436@item -YP,@var{dirs} 8437@opindex YP 8438Search the directories @var{dirs}, and no others, for libraries 8439specified with @option{-l}. 8440 8441@item -Ym,@var{dir} 8442@opindex Ym 8443Look in the directory @var{dir} to find the M4 preprocessor. 8444The assembler uses this option. 8445@c This is supposed to go with a -Yd for predefined M4 macro files, but 8446@c the generic assembler that comes with Solaris takes just -Ym. 8447@end table 8448 8449@node TMS320C3x/C4x Options 8450@subsection TMS320C3x/C4x Options 8451@cindex TMS320C3x/C4x Options 8452 8453These @samp{-m} options are defined for TMS320C3x/C4x implementations: 8454 8455@table @gcctabopt 8456 8457@item -mcpu=@var{cpu_type} 8458@opindex mcpu 8459Set the instruction set, register set, and instruction scheduling 8460parameters for machine type @var{cpu_type}. Supported values for 8461@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and 8462@samp{c44}. The default is @samp{c40} to generate code for the 8463TMS320C40. 8464 8465@item -mbig-memory 8466@item -mbig 8467@itemx -msmall-memory 8468@itemx -msmall 8469@opindex mbig-memory 8470@opindex mbig 8471@opindex msmall-memory 8472@opindex msmall 8473Generates code for the big or small memory model. The small memory 8474model assumed that all data fits into one 64K word page. At run-time 8475the data page (DP) register must be set to point to the 64K page 8476containing the .bss and .data program sections. The big memory model is 8477the default and requires reloading of the DP register for every direct 8478memory access. 8479 8480@item -mbk 8481@itemx -mno-bk 8482@opindex mbk 8483@opindex mno-bk 8484Allow (disallow) allocation of general integer operands into the block 8485count register BK@. 8486 8487@item -mdb 8488@itemx -mno-db 8489@opindex mdb 8490@opindex mno-db 8491Enable (disable) generation of code using decrement and branch, 8492DBcond(D), instructions. This is enabled by default for the C4x. To be 8493on the safe side, this is disabled for the C3x, since the maximum 8494iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than 8495@math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so 8496that it can utilise the decrement and branch instruction, but will give 8497up if there is more than one memory reference in the loop. Thus a loop 8498where the loop counter is decremented can generate slightly more 8499efficient code, in cases where the RPTB instruction cannot be utilised. 8500 8501@item -mdp-isr-reload 8502@itemx -mparanoid 8503@opindex mdp-isr-reload 8504@opindex mparanoid 8505Force the DP register to be saved on entry to an interrupt service 8506routine (ISR), reloaded to point to the data section, and restored on 8507exit from the ISR@. This should not be required unless someone has 8508violated the small memory model by modifying the DP register, say within 8509an object library. 8510 8511@item -mmpyi 8512@itemx -mno-mpyi 8513@opindex mmpyi 8514@opindex mno-mpyi 8515For the C3x use the 24-bit MPYI instruction for integer multiplies 8516instead of a library call to guarantee 32-bit results. Note that if one 8517of the operands is a constant, then the multiplication will be performed 8518using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x, 8519then squaring operations are performed inline instead of a library call. 8520 8521@item -mfast-fix 8522@itemx -mno-fast-fix 8523@opindex mfast-fix 8524@opindex mno-fast-fix 8525The C3x/C4x FIX instruction to convert a floating point value to an 8526integer value chooses the nearest integer less than or equal to the 8527floating point value rather than to the nearest integer. Thus if the 8528floating point number is negative, the result will be incorrectly 8529truncated an additional code is necessary to detect and correct this 8530case. This option can be used to disable generation of the additional 8531code required to correct the result. 8532 8533@item -mrptb 8534@itemx -mno-rptb 8535@opindex mrptb 8536@opindex mno-rptb 8537Enable (disable) generation of repeat block sequences using the RPTB 8538instruction for zero overhead looping. The RPTB construct is only used 8539for innermost loops that do not call functions or jump across the loop 8540boundaries. There is no advantage having nested RPTB loops due to the 8541overhead required to save and restore the RC, RS, and RE registers. 8542This is enabled by default with @option{-O2}. 8543 8544@item -mrpts=@var{count} 8545@itemx -mno-rpts 8546@opindex mrpts 8547@opindex mno-rpts 8548Enable (disable) the use of the single instruction repeat instruction 8549RPTS@. If a repeat block contains a single instruction, and the loop 8550count can be guaranteed to be less than the value @var{count}, GCC will 8551emit a RPTS instruction instead of a RPTB@. If no value is specified, 8552then a RPTS will be emitted even if the loop count cannot be determined 8553at compile time. Note that the repeated instruction following RPTS does 8554not have to be reloaded from memory each iteration, thus freeing up the 8555CPU buses for operands. However, since interrupts are blocked by this 8556instruction, it is disabled by default. 8557 8558@item -mloop-unsigned 8559@itemx -mno-loop-unsigned 8560@opindex mloop-unsigned 8561@opindex mno-loop-unsigned 8562The maximum iteration count when using RPTS and RPTB (and DB on the C40) 8563is @math{2^{31} + 1} since these instructions test if the iteration count is 8564negative to terminate the loop. If the iteration count is unsigned 8565there is a possibility than the @math{2^{31} + 1} maximum iteration count may be 8566exceeded. This switch allows an unsigned iteration count. 8567 8568@item -mti 8569@opindex mti 8570Try to emit an assembler syntax that the TI assembler (asm30) is happy 8571with. This also enforces compatibility with the API employed by the TI 8572C3x C compiler. For example, long doubles are passed as structures 8573rather than in floating point registers. 8574 8575@item -mregparm 8576@itemx -mmemparm 8577@opindex mregparm 8578@opindex mmemparm 8579Generate code that uses registers (stack) for passing arguments to functions. 8580By default, arguments are passed in registers where possible rather 8581than by pushing arguments on to the stack. 8582 8583@item -mparallel-insns 8584@itemx -mno-parallel-insns 8585@opindex mparallel-insns 8586@opindex mno-parallel-insns 8587Allow the generation of parallel instructions. This is enabled by 8588default with @option{-O2}. 8589 8590@item -mparallel-mpy 8591@itemx -mno-parallel-mpy 8592@opindex mparallel-mpy 8593@opindex mno-parallel-mpy 8594Allow the generation of MPY||ADD and MPY||SUB parallel instructions, 8595provided @option{-mparallel-insns} is also specified. These instructions have 8596tight register constraints which can pessimize the code generation 8597of large functions. 8598 8599@end table 8600 8601@node V850 Options 8602@subsection V850 Options 8603@cindex V850 Options 8604 8605These @samp{-m} options are defined for V850 implementations: 8606 8607@table @gcctabopt 8608@item -mlong-calls 8609@itemx -mno-long-calls 8610@opindex mlong-calls 8611@opindex mno-long-calls 8612Treat all calls as being far away (near). If calls are assumed to be 8613far away, the compiler will always load the functions address up into a 8614register, and call indirect through the pointer. 8615 8616@item -mno-ep 8617@itemx -mep 8618@opindex mno-ep 8619@opindex mep 8620Do not optimize (do optimize) basic blocks that use the same index 8621pointer 4 or more times to copy pointer into the @code{ep} register, and 8622use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 8623option is on by default if you optimize. 8624 8625@item -mno-prolog-function 8626@itemx -mprolog-function 8627@opindex mno-prolog-function 8628@opindex mprolog-function 8629Do not use (do use) external functions to save and restore registers at 8630the prolog and epilog of a function. The external functions are slower, 8631but use less code space if more than one function saves the same number 8632of registers. The @option{-mprolog-function} option is on by default if 8633you optimize. 8634 8635@item -mspace 8636@opindex mspace 8637Try to make the code as small as possible. At present, this just turns 8638on the @option{-mep} and @option{-mprolog-function} options. 8639 8640@item -mtda=@var{n} 8641@opindex mtda 8642Put static or global variables whose size is @var{n} bytes or less into 8643the tiny data area that register @code{ep} points to. The tiny data 8644area can hold up to 256 bytes in total (128 bytes for byte references). 8645 8646@item -msda=@var{n} 8647@opindex msda 8648Put static or global variables whose size is @var{n} bytes or less into 8649the small data area that register @code{gp} points to. The small data 8650area can hold up to 64 kilobytes. 8651 8652@item -mzda=@var{n} 8653@opindex mzda 8654Put static or global variables whose size is @var{n} bytes or less into 8655the first 32 kilobytes of memory. 8656 8657@item -mv850 8658@opindex mv850 8659Specify that the target processor is the V850. 8660 8661@item -mbig-switch 8662@opindex mbig-switch 8663Generate code suitable for big switch tables. Use this option only if 8664the assembler/linker complain about out of range branches within a switch 8665table. 8666@end table 8667 8668@node ARC Options 8669@subsection ARC Options 8670@cindex ARC Options 8671 8672These options are defined for ARC implementations: 8673 8674@table @gcctabopt 8675@item -EL 8676@opindex EL 8677Compile code for little endian mode. This is the default. 8678 8679@item -EB 8680@opindex EB 8681Compile code for big endian mode. 8682 8683@item -mmangle-cpu 8684@opindex mmangle-cpu 8685Prepend the name of the cpu to all public symbol names. 8686In multiple-processor systems, there are many ARC variants with different 8687instruction and register set characteristics. This flag prevents code 8688compiled for one cpu to be linked with code compiled for another. 8689No facility exists for handling variants that are ``almost identical''. 8690This is an all or nothing option. 8691 8692@item -mcpu=@var{cpu} 8693@opindex mcpu 8694Compile code for ARC variant @var{cpu}. 8695Which variants are supported depend on the configuration. 8696All variants support @option{-mcpu=base}, this is the default. 8697 8698@item -mtext=@var{text-section} 8699@itemx -mdata=@var{data-section} 8700@itemx -mrodata=@var{readonly-data-section} 8701@opindex mtext 8702@opindex mdata 8703@opindex mrodata 8704Put functions, data, and readonly data in @var{text-section}, 8705@var{data-section}, and @var{readonly-data-section} respectively 8706by default. This can be overridden with the @code{section} attribute. 8707@xref{Variable Attributes}. 8708 8709@end table 8710 8711@node NS32K Options 8712@subsection NS32K Options 8713@cindex NS32K options 8714 8715These are the @samp{-m} options defined for the 32000 series. The default 8716values for these options depends on which style of 32000 was selected when 8717the compiler was configured; the defaults for the most common choices are 8718given below. 8719 8720@table @gcctabopt 8721@item -m32032 8722@itemx -m32032 8723@opindex m32032 8724@opindex m32032 8725Generate output for a 32032. This is the default 8726when the compiler is configured for 32032 and 32016 based systems. 8727 8728@item -m32332 8729@itemx -m32332 8730@opindex m32332 8731@opindex m32332 8732Generate output for a 32332. This is the default 8733when the compiler is configured for 32332-based systems. 8734 8735@item -m32532 8736@itemx -m32532 8737@opindex m32532 8738@opindex m32532 8739Generate output for a 32532. This is the default 8740when the compiler is configured for 32532-based systems. 8741 8742@item -m32081 8743@opindex m32081 8744Generate output containing 32081 instructions for floating point. 8745This is the default for all systems. 8746 8747@item -m32381 8748@opindex m32381 8749Generate output containing 32381 instructions for floating point. This 8750also implies @option{-m32081}. The 32381 is only compatible with the 32332 8751and 32532 cpus. This is the default for the pc532-netbsd configuration. 8752 8753@item -mmulti-add 8754@opindex mmulti-add 8755Try and generate multiply-add floating point instructions @code{polyF} 8756and @code{dotF}. This option is only available if the @option{-m32381} 8757option is in effect. Using these instructions requires changes to 8758register allocation which generally has a negative impact on 8759performance. This option should only be enabled when compiling code 8760particularly likely to make heavy use of multiply-add instructions. 8761 8762@item -mnomulti-add 8763@opindex mnomulti-add 8764Do not try and generate multiply-add floating point instructions 8765@code{polyF} and @code{dotF}. This is the default on all platforms. 8766 8767@item -msoft-float 8768@opindex msoft-float 8769Generate output containing library calls for floating point. 8770@strong{Warning:} the requisite libraries may not be available. 8771 8772@item -mnobitfield 8773@opindex mnobitfield 8774Do not use the bit-field instructions. On some machines it is faster to 8775use shifting and masking operations. This is the default for the pc532. 8776 8777@item -mbitfield 8778@opindex mbitfield 8779Do use the bit-field instructions. This is the default for all platforms 8780except the pc532. 8781 8782@item -mrtd 8783@opindex mrtd 8784Use a different function-calling convention, in which functions 8785that take a fixed number of arguments return pop their 8786arguments on return with the @code{ret} instruction. 8787 8788This calling convention is incompatible with the one normally 8789used on Unix, so you cannot use it if you need to call libraries 8790compiled with the Unix compiler. 8791 8792Also, you must provide function prototypes for all functions that 8793take variable numbers of arguments (including @code{printf}); 8794otherwise incorrect code will be generated for calls to those 8795functions. 8796 8797In addition, seriously incorrect code will result if you call a 8798function with too many arguments. (Normally, extra arguments are 8799harmlessly ignored.) 8800 8801This option takes its name from the 680x0 @code{rtd} instruction. 8802 8803 8804@item -mregparam 8805@opindex mregparam 8806Use a different function-calling convention where the first two arguments 8807are passed in registers. 8808 8809This calling convention is incompatible with the one normally 8810used on Unix, so you cannot use it if you need to call libraries 8811compiled with the Unix compiler. 8812 8813@item -mnoregparam 8814@opindex mnoregparam 8815Do not pass any arguments in registers. This is the default for all 8816targets. 8817 8818@item -msb 8819@opindex msb 8820It is OK to use the sb as an index register which is always loaded with 8821zero. This is the default for the pc532-netbsd target. 8822 8823@item -mnosb 8824@opindex mnosb 8825The sb register is not available for use or has not been initialized to 8826zero by the run time system. This is the default for all targets except 8827the pc532-netbsd. It is also implied whenever @option{-mhimem} or 8828@option{-fpic} is set. 8829 8830@item -mhimem 8831@opindex mhimem 8832Many ns32000 series addressing modes use displacements of up to 512MB@. 8833If an address is above 512MB then displacements from zero can not be used. 8834This option causes code to be generated which can be loaded above 512MB@. 8835This may be useful for operating systems or ROM code. 8836 8837@item -mnohimem 8838@opindex mnohimem 8839Assume code will be loaded in the first 512MB of virtual address space. 8840This is the default for all platforms. 8841 8842 8843@end table 8844 8845@node AVR Options 8846@subsection AVR Options 8847@cindex AVR Options 8848 8849These options are defined for AVR implementations: 8850 8851@table @gcctabopt 8852@item -mmcu=@var{mcu} 8853@opindex mmcu 8854Specify ATMEL AVR instruction set or MCU type. 8855 8856Instruction set avr1 is for the minimal AVR core, not supported by the C 8857compiler, only for assembler programs (MCU types: at90s1200, attiny10, 8858attiny11, attiny12, attiny15, attiny28). 8859 8860Instruction set avr2 (default) is for the classic AVR core with up to 88618K program memory space (MCU types: at90s2313, at90s2323, attiny22, 8862at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, 8863at90c8534, at90s8535). 8864 8865Instruction set avr3 is for the classic AVR core with up to 128K program 8866memory space (MCU types: atmega103, atmega603, at43usb320, at76c711). 8867 8868Instruction set avr4 is for the enhanced AVR core with up to 8K program 8869memory space (MCU types: atmega8, atmega83, atmega85). 8870 8871Instruction set avr5 is for the enhanced AVR core with up to 128K program 8872memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323, 8873atmega64, atmega128, at43usb355, at94k). 8874 8875@item -msize 8876@opindex msize 8877Output instruction sizes to the asm file. 8878 8879@item -minit-stack=@var{N} 8880@opindex minit-stack 8881Specify the initial stack address, which may be a symbol or numeric value, 8882@samp{__stack} is the default. 8883 8884@item -mno-interrupts 8885@opindex mno-interrupts 8886Generated code is not compatible with hardware interrupts. 8887Code size will be smaller. 8888 8889@item -mcall-prologues 8890@opindex mcall-prologues 8891Functions prologues/epilogues expanded as call to appropriate 8892subroutines. Code size will be smaller. 8893 8894@item -mno-tablejump 8895@opindex mno-tablejump 8896Do not generate tablejump insns which sometimes increase code size. 8897 8898@item -mtiny-stack 8899@opindex mtiny-stack 8900Change only the low 8 bits of the stack pointer. 8901@end table 8902 8903@node MCore Options 8904@subsection MCore Options 8905@cindex MCore options 8906 8907These are the @samp{-m} options defined for the Motorola M*Core 8908processors. 8909 8910@table @gcctabopt 8911 8912@item -mhardlit 8913@itemx -mhardlit 8914@itemx -mno-hardlit 8915@opindex mhardlit 8916@opindex mhardlit 8917@opindex mno-hardlit 8918Inline constants into the code stream if it can be done in two 8919instructions or less. 8920 8921@item -mdiv 8922@itemx -mdiv 8923@itemx -mno-div 8924@opindex mdiv 8925@opindex mdiv 8926@opindex mno-div 8927Use the divide instruction. (Enabled by default). 8928 8929@item -mrelax-immediate 8930@itemx -mrelax-immediate 8931@itemx -mno-relax-immediate 8932@opindex mrelax-immediate 8933@opindex mrelax-immediate 8934@opindex mno-relax-immediate 8935Allow arbitrary sized immediates in bit operations. 8936 8937@item -mwide-bitfields 8938@itemx -mwide-bitfields 8939@itemx -mno-wide-bitfields 8940@opindex mwide-bitfields 8941@opindex mwide-bitfields 8942@opindex mno-wide-bitfields 8943Always treat bit-fields as int-sized. 8944 8945@item -m4byte-functions 8946@itemx -m4byte-functions 8947@itemx -mno-4byte-functions 8948@opindex m4byte-functions 8949@opindex m4byte-functions 8950@opindex mno-4byte-functions 8951Force all functions to be aligned to a four byte boundary. 8952 8953@item -mcallgraph-data 8954@itemx -mcallgraph-data 8955@itemx -mno-callgraph-data 8956@opindex mcallgraph-data 8957@opindex mcallgraph-data 8958@opindex mno-callgraph-data 8959Emit callgraph information. 8960 8961@item -mslow-bytes 8962@itemx -mslow-bytes 8963@itemx -mno-slow-bytes 8964@opindex mslow-bytes 8965@opindex mslow-bytes 8966@opindex mno-slow-bytes 8967Prefer word access when reading byte quantities. 8968 8969@item -mlittle-endian 8970@itemx -mlittle-endian 8971@itemx -mbig-endian 8972@opindex mlittle-endian 8973@opindex mlittle-endian 8974@opindex mbig-endian 8975Generate code for a little endian target. 8976 8977@item -m210 8978@itemx -m210 8979@itemx -m340 8980@opindex m210 8981@opindex m210 8982@opindex m340 8983Generate code for the 210 processor. 8984@end table 8985 8986@node IA-64 Options 8987@subsection IA-64 Options 8988@cindex IA-64 Options 8989 8990These are the @samp{-m} options defined for the Intel IA-64 architecture. 8991 8992@table @gcctabopt 8993@item -mbig-endian 8994@opindex mbig-endian 8995Generate code for a big endian target. This is the default for HPUX@. 8996 8997@item -mlittle-endian 8998@opindex mlittle-endian 8999Generate code for a little endian target. This is the default for AIX5 9000and Linux. 9001 9002@item -mgnu-as 9003@itemx -mno-gnu-as 9004@opindex mgnu-as 9005@opindex mno-gnu-as 9006Generate (or don't) code for the GNU assembler. This is the default. 9007@c Also, this is the default if the configure option @option{--with-gnu-as} 9008@c is used. 9009 9010@item -mgnu-ld 9011@itemx -mno-gnu-ld 9012@opindex mgnu-ld 9013@opindex mno-gnu-ld 9014Generate (or don't) code for the GNU linker. This is the default. 9015@c Also, this is the default if the configure option @option{--with-gnu-ld} 9016@c is used. 9017 9018@item -mno-pic 9019@opindex mno-pic 9020Generate code that does not use a global pointer register. The result 9021is not position independent code, and violates the IA-64 ABI@. 9022 9023@item -mvolatile-asm-stop 9024@itemx -mno-volatile-asm-stop 9025@opindex mvolatile-asm-stop 9026@opindex mno-volatile-asm-stop 9027Generate (or don't) a stop bit immediately before and after volatile asm 9028statements. 9029 9030@item -mb-step 9031@opindex mb-step 9032Generate code that works around Itanium B step errata. 9033 9034@item -mregister-names 9035@itemx -mno-register-names 9036@opindex mregister-names 9037@opindex mno-register-names 9038Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 9039the stacked registers. This may make assembler output more readable. 9040 9041@item -mno-sdata 9042@itemx -msdata 9043@opindex mno-sdata 9044@opindex msdata 9045Disable (or enable) optimizations that use the small data section. This may 9046be useful for working around optimizer bugs. 9047 9048@item -mconstant-gp 9049@opindex mconstant-gp 9050Generate code that uses a single constant global pointer value. This is 9051useful when compiling kernel code. 9052 9053@item -mauto-pic 9054@opindex mauto-pic 9055Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 9056This is useful when compiling firmware code. 9057 9058@item -minline-divide-min-latency 9059@opindex minline-divide-min-latency 9060Generate code for inline divides using the minimum latency algorithm. 9061 9062@item -minline-divide-max-throughput 9063@opindex minline-divide-max-throughput 9064Generate code for inline divides using the maximum throughput algorithm. 9065 9066@item -mno-dwarf2-asm 9067@itemx -mdwarf2-asm 9068@opindex mno-dwarf2-asm 9069@opindex mdwarf2-asm 9070Don't (or do) generate assembler code for the DWARF2 line number debugging 9071info. This may be useful when not using the GNU assembler. 9072 9073@item -mfixed-range=@var{register-range} 9074@opindex mfixed-range 9075Generate code treating the given register range as fixed registers. 9076A fixed register is one that the register allocator can not use. This is 9077useful when compiling kernel code. A register range is specified as 9078two registers separated by a dash. Multiple register ranges can be 9079specified separated by a comma. 9080@end table 9081 9082@node D30V Options 9083@subsection D30V Options 9084@cindex D30V Options 9085 9086These @samp{-m} options are defined for D30V implementations: 9087 9088@table @gcctabopt 9089@item -mextmem 9090@opindex mextmem 9091Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings}, 9092@samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external 9093memory, which starts at location @code{0x80000000}. 9094 9095@item -mextmemory 9096@opindex mextmemory 9097Same as the @option{-mextmem} switch. 9098 9099@item -monchip 9100@opindex monchip 9101Link the @samp{.text} section into onchip text memory, which starts at 9102location @code{0x0}. Also link @samp{.data}, @samp{.bss}, 9103@samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections 9104into onchip data memory, which starts at location @code{0x20000000}. 9105 9106@item -mno-asm-optimize 9107@itemx -masm-optimize 9108@opindex mno-asm-optimize 9109@opindex masm-optimize 9110Disable (enable) passing @option{-O} to the assembler when optimizing. 9111The assembler uses the @option{-O} option to automatically parallelize 9112adjacent short instructions where possible. 9113 9114@item -mbranch-cost=@var{n} 9115@opindex mbranch-cost 9116Increase the internal costs of branches to @var{n}. Higher costs means 9117that the compiler will issue more instructions to avoid doing a branch. 9118The default is 2. 9119 9120@item -mcond-exec=@var{n} 9121@opindex mcond-exec 9122Specify the maximum number of conditionally executed instructions that 9123replace a branch. The default is 4. 9124@end table 9125 9126@node S/390 and zSeries Options 9127@subsection S/390 and zSeries Options 9128@cindex S/390 and zSeries Options 9129 9130These are the @samp{-m} options defined for the S/390 and zSeries architecture. 9131 9132@table @gcctabopt 9133@item -mhard-float 9134@itemx -msoft-float 9135@opindex mhard-float 9136@opindex msoft-float 9137Use (do not use) the hardware floating-point instructions and registers 9138for floating-point operations. When @option{-msoft-float} is specified, 9139functions in @file{libgcc.a} will be used to perform floating-point 9140operations. When @option{-mhard-float} is specified, the compiler 9141generates IEEE floating-point instructions. This is the default. 9142 9143@item -mbackchain 9144@itemx -mno-backchain 9145@opindex mbackchain 9146@opindex mno-backchain 9147Generate (or do not generate) code which maintains an explicit 9148backchain within the stack frame that points to the caller's frame. 9149This is currently needed to allow debugging. The default is to 9150generate the backchain. 9151 9152@item -msmall-exec 9153@itemx -mno-small-exec 9154@opindex msmall-exec 9155@opindex mno-small-exec 9156Generate (or do not generate) code using the @code{bras} instruction 9157to do subroutine calls. 9158This only works reliably if the total executable size does not 9159exceed 64k. The default is to use the @code{basr} instruction instead, 9160which does not have this limitation. 9161 9162@item -m64 9163@itemx -m31 9164@opindex m64 9165@opindex m31 9166When @option{-m31} is specified, generate code compliant to the 9167Linux for S/390 ABI@. When @option{-m64} is specified, generate 9168code compliant to the Linux for zSeries ABI@. This allows GCC in 9169particular to generate 64-bit instructions. For the @samp{s390} 9170targets, the default is @option{-m31}, while the @samp{s390x} 9171targets default to @option{-m64}. 9172 9173@item -mmvcle 9174@itemx -mno-mvcle 9175@opindex mmvcle 9176@opindex mno-mvcle 9177Generate (or do not generate) code using the @code{mvcle} instruction 9178to perform block moves. When @option{-mno-mvcle} is specifed, 9179use a @code{mvc} loop instead. This is the default. 9180 9181@item -mdebug 9182@itemx -mno-debug 9183@opindex mdebug 9184@opindex mno-debug 9185Print (or do not print) additional debug information when compiling. 9186The default is to not print debug information. 9187 9188@end table 9189 9190@node CRIS Options 9191@subsection CRIS Options 9192@cindex CRIS Options 9193 9194These options are defined specifically for the CRIS ports. 9195 9196@table @gcctabopt 9197@item -march=@var{architecture-type} 9198@itemx -mcpu=@var{architecture-type} 9199@opindex march 9200@opindex mcpu 9201Generate code for the specified architecture. The choices for 9202@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 9203respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX. 9204Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 9205@samp{v10}. 9206 9207@item -mtune=@var{architecture-type} 9208@opindex mtune 9209Tune to @var{architecture-type} everything applicable about the generated 9210code, except for the ABI and the set of available instructions. The 9211choices for @var{architecture-type} are the same as for 9212@option{-march=@var{architecture-type}}. 9213 9214@item -mmax-stack-frame=@var{n} 9215@opindex mmax-stack-frame 9216Warn when the stack frame of a function exceeds @var{n} bytes. 9217 9218@item -melinux-stacksize=@var{n} 9219@opindex melinux-stacksize 9220Only available with the @samp{cris-axis-aout} target. Arranges for 9221indications in the program to the kernel loader that the stack of the 9222program should be set to @var{n} bytes. 9223 9224@item -metrax4 9225@itemx -metrax100 9226@opindex metrax4 9227@opindex metrax100 9228The options @option{-metrax4} and @option{-metrax100} are synonyms for 9229@option{-march=v3} and @option{-march=v8} respectively. 9230 9231@item -mpdebug 9232@opindex mpdebug 9233Enable CRIS-specific verbose debug-related information in the assembly 9234code. This option also has the effect to turn off the @samp{#NO_APP} 9235formatted-code indicator to the assembler at the beginning of the 9236assembly file. 9237 9238@item -mcc-init 9239@opindex mcc-init 9240Do not use condition-code results from previous instruction; always emit 9241compare and test instructions before use of condition codes. 9242 9243@item -mno-side-effects 9244@opindex mno-side-effects 9245Do not emit instructions with side-effects in addressing modes other than 9246post-increment. 9247 9248@item -mstack-align 9249@itemx -mno-stack-align 9250@itemx -mdata-align 9251@itemx -mno-data-align 9252@itemx -mconst-align 9253@itemx -mno-const-align 9254@opindex mstack-align 9255@opindex mno-stack-align 9256@opindex mdata-align 9257@opindex mno-data-align 9258@opindex mconst-align 9259@opindex mno-const-align 9260These options (no-options) arranges (eliminate arrangements) for the 9261stack-frame, individual data and constants to be aligned for the maximum 9262single data access size for the chosen CPU model. The default is to 9263arrange for 32-bit alignment. ABI details such as structure layout are 9264not affected by these options. 9265 9266@item -m32-bit 9267@itemx -m16-bit 9268@itemx -m8-bit 9269@opindex m32-bit 9270@opindex m16-bit 9271@opindex m8-bit 9272Similar to the stack- data- and const-align options above, these options 9273arrange for stack-frame, writable data and constants to all be 32-bit, 927416-bit or 8-bit aligned. The default is 32-bit alignment. 9275 9276@item -mno-prologue-epilogue 9277@itemx -mprologue-epilogue 9278@opindex mno-prologue-epilogue 9279@opindex mprologue-epilogue 9280With @option{-mno-prologue-epilogue}, the normal function prologue and 9281epilogue that sets up the stack-frame are omitted and no return 9282instructions or return sequences are generated in the code. Use this 9283option only together with visual inspection of the compiled code: no 9284warnings or errors are generated when call-saved registers must be saved, 9285or storage for local variable needs to be allocated. 9286 9287@item -mno-gotplt 9288@itemx -mgotplt 9289@opindex mno-gotplt 9290@opindex mgotplt 9291With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 9292instruction sequences that load addresses for functions from the PLT part 9293of the GOT rather than (traditional on other architectures) calls to the 9294PLT. The default is @option{-mgotplt}. 9295 9296@item -maout 9297@opindex maout 9298Legacy no-op option only recognized with the cris-axis-aout target. 9299 9300@item -melf 9301@opindex melf 9302Legacy no-op option only recognized with the cris-axis-elf and 9303cris-axis-linux-gnu targets. 9304 9305@item -melinux 9306@opindex melinux 9307Only recognized with the cris-axis-aout target, where it selects a 9308GNU/linux-like multilib, include files and instruction set for 9309@option{-march=v8}. 9310 9311@item -mlinux 9312@opindex mlinux 9313Legacy no-op option only recognized with the cris-axis-linux-gnu target. 9314 9315@item -sim 9316@opindex sim 9317This option, recognized for the cris-axis-aout and cris-axis-elf arranges 9318to link with input-output functions from a simulator library. Code, 9319initialized data and zero-initialized data are allocated consecutively. 9320 9321@item -sim2 9322@opindex sim2 9323Like @option{-sim}, but pass linker options to locate initialized data at 93240x40000000 and zero-initialized data at 0x80000000. 9325@end table 9326 9327@node MMIX Options 9328@subsection MMIX Options 9329@cindex MMIX Options 9330 9331These options are defined for the MMIX: 9332 9333@table @gcctabopt 9334@item -mlibfuncs 9335@itemx -mno-libfuncs 9336@opindex mlibfuncs 9337@opindex mno-libfuncs 9338Specify that intrinsic library functions are being compiled, passing all 9339values in registers, no matter the size. 9340 9341@item -mepsilon 9342@itemx -mno-epsilon 9343@opindex mepsilon 9344@opindex mno-epsilon 9345Generate floating-point comparison instructions that compare with respect 9346to the @code{rE} epsilon register. 9347 9348@item -mabi=mmixware 9349@itemx -mabi=gnu 9350@opindex mabi-mmixware 9351@opindex mabi=gnu 9352Generate code that passes function parameters and return values that (in 9353the called function) are seen as registers @code{$0} and up, as opposed to 9354the GNU ABI which uses global registers @code{$231} and up. 9355 9356@item -mzero-extend 9357@itemx -mno-zero-extend 9358@opindex mzero-extend 9359@opindex mno-zero-extend 9360When reading data from memory in sizes shorter than 64 bits, use (do not 9361use) zero-extending load instructions by default, rather than 9362sign-extending ones. 9363 9364@item -mknuthdiv 9365@itemx -mno-knuthdiv 9366@opindex mknuthdiv 9367@opindex mno-knuthdiv 9368Make the result of a division yielding a remainder have the same sign as 9369the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 9370remainder follows the sign of the dividend. Both methods are 9371arithmetically valid, the latter being almost exclusively used. 9372 9373@item -mtoplevel-symbols 9374@itemx -mno-toplevel-symbols 9375@opindex mtoplevel-symbols 9376@opindex mno-toplevel-symbols 9377Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 9378code can be used with the @code{PREFIX} assembly directive. 9379 9380@item -melf 9381@opindex melf 9382Generate an executable in the ELF format, rather than the default 9383@samp{mmo} format used by the @command{mmix} simulator. 9384 9385@item -mbranch-predict 9386@itemx -mno-branch-predict 9387@opindex mbranch-predict 9388@opindex mno-branch-predict 9389Use (do not use) the probable-branch instructions, when static branch 9390prediction indicates a probable branch. 9391 9392@item -mbase-addresses 9393@itemx -mno-base-addresses 9394@opindex mbase-addresses 9395@opindex mno-base-addresses 9396Generate (do not generate) code that uses @emph{base addresses}. Using a 9397base address automatically generates a request (handled by the assembler 9398and the linker) for a constant to be set up in a global register. The 9399register is used for one or more base address requests within the range 0 9400to 255 from the value held in the register. The generally leads to short 9401and fast code, but the number of different data items that can be 9402addressed is limited. This means that a program that uses lots of static 9403data may require @option{-mno-base-addresses}. 9404@end table 9405 9406@node PDP-11 Options 9407@subsection PDP-11 Options 9408@cindex PDP-11 Options 9409 9410These options are defined for the PDP-11: 9411 9412@table @gcctabopt 9413@item -mfpu 9414@opindex mfpu 9415Use hardware FPP floating point. This is the default. (FIS floating 9416point on the PDP-11/40 is not supported.) 9417 9418@item -msoft-float 9419@opindex msoft-float 9420Do not use hardware floating point. 9421 9422@item -mac0 9423@opindex mac0 9424Return floating-point results in ac0 (fr0 in Unix assembler syntax). 9425 9426@item -mno-ac0 9427@opindex mno-ac0 9428Return floating-point results in memory. This is the default. 9429 9430@item -m40 9431@opindex m40 9432Generate code for a PDP-11/40. 9433 9434@item -m45 9435@opindex m45 9436Generate code for a PDP-11/45. This is the default. 9437 9438@item -m10 9439@opindex m10 9440Generate code for a PDP-11/10. 9441 9442@item -mbcopy-builtin 9443@opindex bcopy-builtin 9444Use inline @code{movstrhi} patterns for copying memory. This is the 9445default. 9446 9447@item -mbcopy 9448@opindex mbcopy 9449Do not use inline @code{movstrhi} patterns for copying memory. 9450 9451@item -mint16 9452@itemx -mno-int32 9453@opindex mint16 9454@opindex mno-int32 9455Use 16-bit @code{int}. This is the default. 9456 9457@item -mint32 9458@itemx -mno-int16 9459@opindex mint32 9460@opindex mno-int16 9461Use 32-bit @code{int}. 9462 9463@item -mfloat64 9464@itemx -mno-float32 9465@opindex mfloat64 9466@opindex mno-float32 9467Use 64-bit @code{float}. This is the default. 9468 9469@item -mfloat32 9470@item -mno-float64 9471@opindex mfloat32 9472@opindex mno-float64 9473Use 32-bit @code{float}. 9474 9475@item -mabshi 9476@opindex mabshi 9477Use @code{abshi2} pattern. This is the default. 9478 9479@item -mno-abshi 9480@opindex mno-abshi 9481Do not use @code{abshi2} pattern. 9482 9483@item -mbranch-expensive 9484@opindex mbranch-expensive 9485Pretend that branches are expensive. This is for experimenting with 9486code generation only. 9487 9488@item -mbranch-cheap 9489@opindex mbranch-cheap 9490Do not pretend that branches are expensive. This is the default. 9491 9492@item -msplit 9493@opindex msplit 9494Generate code for a system with split I&D. 9495 9496@item -mno-split 9497@opindex mno-split 9498Generate code for a system without split I&D. This is the default. 9499 9500@item -munix-asm 9501@opindex munix-asm 9502Use Unix assembler syntax. This is the default when configured for 9503@samp{pdp11-*-bsd}. 9504 9505@item -mdec-asm 9506@opindex mdec-asm 9507Use DEC assembler syntax. This is the default when configured for any 9508PDP-11 target other than @samp{pdp11-*-bsd}. 9509@end table 9510 9511@node Xstormy16 Options 9512@subsection Xstormy16 Options 9513@cindex Xstormy16 Options 9514 9515These options are defined for Xstormy16: 9516 9517@table @gcctabopt 9518@item -msim 9519@opindex msim 9520Choose startup files and linker script suitable for the simulator. 9521@end table 9522 9523@node Xtensa Options 9524@subsection Xtensa Options 9525@cindex Xtensa Options 9526 9527The Xtensa architecture is designed to support many different 9528configurations. The compiler's default options can be set to match a 9529particular Xtensa configuration by copying a configuration file into the 9530GCC sources when building GCC@. The options below may be used to 9531override the default options. 9532 9533@table @gcctabopt 9534@item -mbig-endian 9535@itemx -mlittle-endian 9536@opindex mbig-endian 9537@opindex mlittle-endian 9538Specify big-endian or little-endian byte ordering for the target Xtensa 9539processor. 9540 9541@item -mdensity 9542@itemx -mno-density 9543@opindex mdensity 9544@opindex mno-density 9545Enable or disable use of the optional Xtensa code density instructions. 9546 9547@item -mmac16 9548@itemx -mno-mac16 9549@opindex mmac16 9550@opindex mno-mac16 9551Enable or disable use of the Xtensa MAC16 option. When enabled, GCC 9552will generate MAC16 instructions from standard C code, with the 9553limitation that it will use neither the MR register file nor any 9554instruction that operates on the MR registers. When this option is 9555disabled, GCC will translate 16-bit multiply/accumulate operations to a 9556combination of core instructions and library calls, depending on whether 9557any other multiplier options are enabled. 9558 9559@item -mmul16 9560@itemx -mno-mul16 9561@opindex mmul16 9562@opindex mno-mul16 9563Enable or disable use of the 16-bit integer multiplier option. When 9564enabled, the compiler will generate 16-bit multiply instructions for 9565multiplications of 16 bits or smaller in standard C code. When this 9566option is disabled, the compiler will either use 32-bit multiply or 9567MAC16 instructions if they are available or generate library calls to 9568perform the multiply operations using shifts and adds. 9569 9570@item -mmul32 9571@itemx -mno-mul32 9572@opindex mmul32 9573@opindex mno-mul32 9574Enable or disable use of the 32-bit integer multiplier option. When 9575enabled, the compiler will generate 32-bit multiply instructions for 9576multiplications of 32 bits or smaller in standard C code. When this 9577option is disabled, the compiler will generate library calls to perform 9578the multiply operations using either shifts and adds or 16-bit multiply 9579instructions if they are available. 9580 9581@item -mnsa 9582@itemx -mno-nsa 9583@opindex mnsa 9584@opindex mno-nsa 9585Enable or disable use of the optional normalization shift amount 9586(@code{NSA}) instructions to implement the built-in @code{ffs} function. 9587 9588@item -mminmax 9589@itemx -mno-minmax 9590@opindex mminmax 9591@opindex mno-minmax 9592Enable or disable use of the optional minimum and maximum value 9593instructions. 9594 9595@item -msext 9596@itemx -mno-sext 9597@opindex msext 9598@opindex mno-sext 9599Enable or disable use of the optional sign extend (@code{SEXT}) 9600instruction. 9601 9602@item -mbooleans 9603@itemx -mno-booleans 9604@opindex mbooleans 9605@opindex mno-booleans 9606Enable or disable support for the boolean register file used by Xtensa 9607coprocessors. This is not typically useful by itself but may be 9608required for other options that make use of the boolean registers (e.g., 9609the floating-point option). 9610 9611@item -mhard-float 9612@itemx -msoft-float 9613@opindex mhard-float 9614@opindex msoft-float 9615Enable or disable use of the floating-point option. When enabled, GCC 9616generates floating-point instructions for 32-bit @code{float} 9617operations. When this option is disabled, GCC generates library calls 9618to emulate 32-bit floating-point operations using integer instructions. 9619Regardless of this option, 64-bit @code{double} operations are always 9620emulated with calls to library functions. 9621 9622@item -mfused-madd 9623@itemx -mno-fused-madd 9624@opindex mfused-madd 9625@opindex mno-fused-madd 9626Enable or disable use of fused multiply/add and multiply/subtract 9627instructions in the floating-point option. This has no effect if the 9628floating-point option is not also enabled. Disabling fused multiply/add 9629and multiply/subtract instructions forces the compiler to use separate 9630instructions for the multiply and add/subtract operations. This may be 9631desirable in some cases where strict IEEE 754-compliant results are 9632required: the fused multiply add/subtract instructions do not round the 9633intermediate result, thereby producing results with @emph{more} bits of 9634precision than specified by the IEEE standard. Disabling fused multiply 9635add/subtract instructions also ensures that the program output is not 9636sensitive to the compiler's ability to combine multiply and add/subtract 9637operations. 9638 9639@item -mserialize-volatile 9640@itemx -mno-serialize-volatile 9641@opindex mserialize-volatile 9642@opindex mno-serialize-volatile 9643When this option is enabled, GCC inserts @code{MEMW} instructions before 9644@code{volatile} memory references to guarantee sequential consistency. 9645The default is @option{-mserialize-volatile}. Use 9646@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions. 9647 9648@item -mtext-section-literals 9649@itemx -mno-text-section-literals 9650@opindex mtext-section-literals 9651@opindex mno-text-section-literals 9652Control the treatment of literal pools. The default is 9653@option{-mno-text-section-literals}, which places literals in a separate 9654section in the output file. This allows the literal pool to be placed 9655in a data RAM/ROM, and it also allows the linker to combine literal 9656pools from separate object files to remove redundant literals and 9657improve code size. With @option{-mtext-section-literals}, the literals 9658are interspersed in the text section in order to keep them as close as 9659possible to their references. This may be necessary for large assembly 9660files. 9661 9662@item -mtarget-align 9663@itemx -mno-target-align 9664@opindex mtarget-align 9665@opindex mno-target-align 9666When this option is enabled, GCC instructs the assembler to 9667automatically align instructions to reduce branch penalties at the 9668expense of some code density. The assembler attempts to widen density 9669instructions to align branch targets and the instructions following call 9670instructions. If there are not enough preceding safe density 9671instructions to align a target, no widening will be performed. The 9672default is @option{-mtarget-align}. These options do not affect the 9673treatment of auto-aligned instructions like @code{LOOP}, which the 9674assembler will always align, either by widening density instructions or 9675by inserting no-op instructions. 9676 9677@item -mlongcalls 9678@itemx -mno-longcalls 9679@opindex mlongcalls 9680@opindex mno-longcalls 9681When this option is enabled, GCC instructs the assembler to translate 9682direct calls to indirect calls unless it can determine that the target 9683of a direct call is in the range allowed by the call instruction. This 9684translation typically occurs for calls to functions in other source 9685files. Specifically, the assembler translates a direct @code{CALL} 9686instruction into an @code{L32R} followed by a @code{CALLX} instruction. 9687The default is @option{-mno-longcalls}. This option should be used in 9688programs where the call target can potentially be out of range. This 9689option is implemented in the assembler, not the compiler, so the 9690assembly code generated by GCC will still show direct call 9691instructions---look at the disassembled object code to see the actual 9692instructions. Note that the assembler will use an indirect call for 9693every cross-file call, not just those that really will be out of range. 9694@end table 9695 9696@node Code Gen Options 9697@section Options for Code Generation Conventions 9698@cindex code generation conventions 9699@cindex options, code generation 9700@cindex run-time options 9701 9702These machine-independent options control the interface conventions 9703used in code generation. 9704 9705Most of them have both positive and negative forms; the negative form 9706of @option{-ffoo} would be @option{-fno-foo}. In the table below, only 9707one of the forms is listed---the one which is not the default. You 9708can figure out the other form by either removing @samp{no-} or adding 9709it. 9710 9711@table @gcctabopt 9712@item -fexceptions 9713@opindex fexceptions 9714Enable exception handling. Generates extra code needed to propagate 9715exceptions. For some targets, this implies GCC will generate frame 9716unwind information for all functions, which can produce significant data 9717size overhead, although it does not affect execution. If you do not 9718specify this option, GCC will enable it by default for languages like 9719C++ which normally require exception handling, and disable it for 9720languages like C that do not normally require it. However, you may need 9721to enable this option when compiling C code that needs to interoperate 9722properly with exception handlers written in C++. You may also wish to 9723disable this option if you are compiling older C++ programs that don't 9724use exception handling. 9725 9726@item -fnon-call-exceptions 9727@opindex fnon-call-exceptions 9728Generate code that allows trapping instructions to throw exceptions. 9729Note that this requires platform-specific runtime support that does 9730not exist everywhere. Moreover, it only allows @emph{trapping} 9731instructions to throw exceptions, i.e.@: memory references or floating 9732point instructions. It does not allow exceptions to be thrown from 9733arbitrary signal handlers such as @code{SIGALRM}. 9734 9735@item -funwind-tables 9736@opindex funwind-tables 9737Similar to @option{-fexceptions}, except that it will just generate any needed 9738static data, but will not affect the generated code in any other way. 9739You will normally not enable this option; instead, a language processor 9740that needs this handling would enable it on your behalf. 9741 9742@item -fasynchronous-unwind-tables 9743@opindex funwind-tables 9744Generate unwind table in dwarf2 format, if supported by target machine. The 9745table is exact at each instruction boundary, so it can be used for stack 9746unwinding from asynchronous events (such as debugger or garbage collector). 9747 9748@item -fpcc-struct-return 9749@opindex fpcc-struct-return 9750Return ``short'' @code{struct} and @code{union} values in memory like 9751longer ones, rather than in registers. This convention is less 9752efficient, but it has the advantage of allowing intercallability between 9753GCC-compiled files and files compiled with other compilers, particularly 9754the Portable C Compiler (pcc). 9755 9756The precise convention for returning structures in memory depends 9757on the target configuration macros. 9758 9759Short structures and unions are those whose size and alignment match 9760that of some integer type. 9761 9762@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 9763switch is not binary compatible with code compiled with the 9764@option{-freg-struct-return} switch. 9765Use it to conform to a non-default application binary interface. 9766 9767@item -freg-struct-return 9768@opindex freg-struct-return 9769Return @code{struct} and @code{union} values in registers when possible. 9770This is more efficient for small structures than 9771@option{-fpcc-struct-return}. 9772 9773If you specify neither @option{-fpcc-struct-return} nor 9774@option{-freg-struct-return}, GCC defaults to whichever convention is 9775standard for the target. If there is no standard convention, GCC 9776defaults to @option{-fpcc-struct-return}, except on targets where GCC is 9777the principal compiler. In those cases, we can choose the standard, and 9778we chose the more efficient register return alternative. 9779 9780@strong{Warning:} code compiled with the @option{-freg-struct-return} 9781switch is not binary compatible with code compiled with the 9782@option{-fpcc-struct-return} switch. 9783Use it to conform to a non-default application binary interface. 9784 9785@item -fshort-enums 9786@opindex fshort-enums 9787Allocate to an @code{enum} type only as many bytes as it needs for the 9788declared range of possible values. Specifically, the @code{enum} type 9789will be equivalent to the smallest integer type which has enough room. 9790 9791@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 9792code that is not binary compatible with code generated without that switch. 9793Use it to conform to a non-default application binary interface. 9794 9795@item -fshort-double 9796@opindex fshort-double 9797Use the same size for @code{double} as for @code{float}. 9798 9799@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate 9800code that is not binary compatible with code generated without that switch. 9801Use it to conform to a non-default application binary interface. 9802 9803@item -fshort-wchar 9804@opindex fshort-wchar 9805Override the underlying type for @samp{wchar_t} to be @samp{short 9806unsigned int} instead of the default for the target. This option is 9807useful for building programs to run under WINE@. 9808 9809@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 9810code that is not binary compatible with code generated without that switch. 9811Use it to conform to a non-default application binary interface. 9812 9813@item -fshared-data 9814@opindex fshared-data 9815Requests that the data and non-@code{const} variables of this 9816compilation be shared data rather than private data. The distinction 9817makes sense only on certain operating systems, where shared data is 9818shared between processes running the same program, while private data 9819exists in one copy per process. 9820 9821@item -fno-common 9822@opindex fno-common 9823In C, allocate even uninitialized global variables in the data section of the 9824object file, rather than generating them as common blocks. This has the 9825effect that if the same variable is declared (without @code{extern}) in 9826two different compilations, you will get an error when you link them. 9827The only reason this might be useful is if you wish to verify that the 9828program will work on other systems which always work this way. 9829 9830@item -fno-ident 9831@opindex fno-ident 9832Ignore the @samp{#ident} directive. 9833 9834@item -fno-gnu-linker 9835@opindex fno-gnu-linker 9836Do not output global initializations (such as C++ constructors and 9837destructors) in the form used by the GNU linker (on systems where the GNU 9838linker is the standard method of handling them). Use this option when 9839you want to use a non-GNU linker, which also requires using the 9840@command{collect2} program to make sure the system linker includes 9841constructors and destructors. (@command{collect2} is included in the GCC 9842distribution.) For systems which @emph{must} use @command{collect2}, the 9843compiler driver @command{gcc} is configured to do this automatically. 9844 9845@item -finhibit-size-directive 9846@opindex finhibit-size-directive 9847Don't output a @code{.size} assembler directive, or anything else that 9848would cause trouble if the function is split in the middle, and the 9849two halves are placed at locations far apart in memory. This option is 9850used when compiling @file{crtstuff.c}; you should not need to use it 9851for anything else. 9852 9853@item -fverbose-asm 9854@opindex fverbose-asm 9855Put extra commentary information in the generated assembly code to 9856make it more readable. This option is generally only of use to those 9857who actually need to read the generated assembly code (perhaps while 9858debugging the compiler itself). 9859 9860@option{-fno-verbose-asm}, the default, causes the 9861extra information to be omitted and is useful when comparing two assembler 9862files. 9863 9864@item -fvolatile 9865@opindex fvolatile 9866Consider all memory references through pointers to be volatile. 9867 9868@item -fvolatile-global 9869@opindex fvolatile-global 9870Consider all memory references to extern and global data items to 9871be volatile. GCC does not consider static data items to be volatile 9872because of this switch. 9873 9874@item -fvolatile-static 9875@opindex fvolatile-static 9876Consider all memory references to static data to be volatile. 9877 9878@item -fpic 9879@opindex fpic 9880@cindex global offset table 9881@cindex PIC 9882Generate position-independent code (PIC) suitable for use in a shared 9883library, if supported for the target machine. Such code accesses all 9884constant addresses through a global offset table (GOT)@. The dynamic 9885loader resolves the GOT entries when the program starts (the dynamic 9886loader is not part of GCC; it is part of the operating system). If 9887the GOT size for the linked executable exceeds a machine-specific 9888maximum size, you get an error message from the linker indicating that 9889@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 9890instead. (These maximums are 16k on the m88k, 8k on the Sparc, and 32k 9891on the m68k and RS/6000. The 386 has no such limit.) 9892 9893Position-independent code requires special support, and therefore works 9894only on certain machines. For the 386, GCC supports PIC for System V 9895but not for the Sun 386i. Code generated for the IBM RS/6000 is always 9896position-independent. 9897 9898@item -fPIC 9899@opindex fPIC 9900If supported for the target machine, emit position-independent code, 9901suitable for dynamic linking and avoiding any limit on the size of the 9902global offset table. This option makes a difference on the m68k, m88k, 9903and the Sparc. 9904 9905Position-independent code requires special support, and therefore works 9906only on certain machines. 9907 9908@item -ffixed-@var{reg} 9909@opindex ffixed 9910Treat the register named @var{reg} as a fixed register; generated code 9911should never refer to it (except perhaps as a stack pointer, frame 9912pointer or in some other fixed role). 9913 9914@var{reg} must be the name of a register. The register names accepted 9915are machine-specific and are defined in the @code{REGISTER_NAMES} 9916macro in the machine description macro file. 9917 9918This flag does not have a negative form, because it specifies a 9919three-way choice. 9920 9921@item -fcall-used-@var{reg} 9922@opindex fcall-used 9923Treat the register named @var{reg} as an allocable register that is 9924clobbered by function calls. It may be allocated for temporaries or 9925variables that do not live across a call. Functions compiled this way 9926will not save and restore the register @var{reg}. 9927 9928It is an error to used this flag with the frame pointer or stack pointer. 9929Use of this flag for other registers that have fixed pervasive roles in 9930the machine's execution model will produce disastrous results. 9931 9932This flag does not have a negative form, because it specifies a 9933three-way choice. 9934 9935@item -fcall-saved-@var{reg} 9936@opindex fcall-saved 9937Treat the register named @var{reg} as an allocable register saved by 9938functions. It may be allocated even for temporaries or variables that 9939live across a call. Functions compiled this way will save and restore 9940the register @var{reg} if they use it. 9941 9942It is an error to used this flag with the frame pointer or stack pointer. 9943Use of this flag for other registers that have fixed pervasive roles in 9944the machine's execution model will produce disastrous results. 9945 9946A different sort of disaster will result from the use of this flag for 9947a register in which function values may be returned. 9948 9949This flag does not have a negative form, because it specifies a 9950three-way choice. 9951 9952@item -fpack-struct 9953@opindex fpack-struct 9954Pack all structure members together without holes. 9955 9956@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 9957code that is not binary compatible with code generated without that switch. 9958Additionally, it makes the code suboptimial. 9959Use it to conform to a non-default application binary interface. 9960 9961@item -finstrument-functions 9962@opindex finstrument-functions 9963Generate instrumentation calls for entry and exit to functions. Just 9964after function entry and just before function exit, the following 9965profiling functions will be called with the address of the current 9966function and its call site. (On some platforms, 9967@code{__builtin_return_address} does not work beyond the current 9968function, so the call site information may not be available to the 9969profiling functions otherwise.) 9970 9971@example 9972void __cyg_profile_func_enter (void *this_fn, 9973 void *call_site); 9974void __cyg_profile_func_exit (void *this_fn, 9975 void *call_site); 9976@end example 9977 9978The first argument is the address of the start of the current function, 9979which may be looked up exactly in the symbol table. 9980 9981This instrumentation is also done for functions expanded inline in other 9982functions. The profiling calls will indicate where, conceptually, the 9983inline function is entered and exited. This means that addressable 9984versions of such functions must be available. If all your uses of a 9985function are expanded inline, this may mean an additional expansion of 9986code size. If you use @samp{extern inline} in your C code, an 9987addressable version of such functions must be provided. (This is 9988normally the case anyways, but if you get lucky and the optimizer always 9989expands the functions inline, you might have gotten away without 9990providing static copies.) 9991 9992A function may be given the attribute @code{no_instrument_function}, in 9993which case this instrumentation will not be done. This can be used, for 9994example, for the profiling functions listed above, high-priority 9995interrupt routines, and any functions from which the profiling functions 9996cannot safely be called (perhaps signal handlers, if the profiling 9997routines generate output or allocate memory). 9998 9999@item -fstack-check 10000@opindex fstack-check 10001Generate code to verify that you do not go beyond the boundary of the 10002stack. You should specify this flag if you are running in an 10003environment with multiple threads, but only rarely need to specify it in 10004a single-threaded environment since stack overflow is automatically 10005detected on nearly all systems if there is only one stack. 10006 10007Note that this switch does not actually cause checking to be done; the 10008operating system must do that. The switch causes generation of code 10009to ensure that the operating system sees the stack being extended. 10010 10011@item -fstack-limit-register=@var{reg} 10012@itemx -fstack-limit-symbol=@var{sym} 10013@itemx -fno-stack-limit 10014@opindex fstack-limit-register 10015@opindex fstack-limit-symbol 10016@opindex fno-stack-limit 10017Generate code to ensure that the stack does not grow beyond a certain value, 10018either the value of a register or the address of a symbol. If the stack 10019would grow beyond the value, a signal is raised. For most targets, 10020the signal is raised before the stack overruns the boundary, so 10021it is possible to catch the signal without taking special precautions. 10022 10023For instance, if the stack starts at absolute address @samp{0x80000000} 10024and grows downwards, you can use the flags 10025@option{-fstack-limit-symbol=__stack_limit} and 10026@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 10027of 128KB@. Note that this may only work with the GNU linker. 10028 10029@cindex aliasing of parameters 10030@cindex parameters, aliased 10031@item -fargument-alias 10032@itemx -fargument-noalias 10033@itemx -fargument-noalias-global 10034@opindex fargument-alias 10035@opindex fargument-noalias 10036@opindex fargument-noalias-global 10037Specify the possible relationships among parameters and between 10038parameters and global data. 10039 10040@option{-fargument-alias} specifies that arguments (parameters) may 10041alias each other and may alias global storage.@* 10042@option{-fargument-noalias} specifies that arguments do not alias 10043each other, but may alias global storage.@* 10044@option{-fargument-noalias-global} specifies that arguments do not 10045alias each other and do not alias global storage. 10046 10047Each language will automatically use whatever option is required by 10048the language standard. You should not need to use these options yourself. 10049 10050@item -fleading-underscore 10051@opindex fleading-underscore 10052This option and its counterpart, @option{-fno-leading-underscore}, forcibly 10053change the way C symbols are represented in the object file. One use 10054is to help link with legacy assembly code. 10055 10056@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 10057generate code that is not binary compatible with code generated without that 10058switch. Use it to conform to a non-default application binary interface. 10059Not all targets provide complete support for this switch. 10060@end table 10061 10062@c man end 10063 10064@node Environment Variables 10065@section Environment Variables Affecting GCC 10066@cindex environment variables 10067 10068@c man begin ENVIRONMENT 10069 10070This section describes several environment variables that affect how GCC 10071operates. Some of them work by specifying directories or prefixes to use 10072when searching for various kinds of files. Some are used to specify other 10073aspects of the compilation environment. 10074 10075Note that you can also specify places to search using options such as 10076@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 10077take precedence over places specified using environment variables, which 10078in turn take precedence over those specified by the configuration of GCC@. 10079@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 10080GNU Compiler Collection (GCC) Internals}. 10081 10082@table @env 10083@item LANG 10084@itemx LC_CTYPE 10085@c @itemx LC_COLLATE 10086@itemx LC_MESSAGES 10087@c @itemx LC_MONETARY 10088@c @itemx LC_NUMERIC 10089@c @itemx LC_TIME 10090@itemx LC_ALL 10091@findex LANG 10092@findex LC_CTYPE 10093@c @findex LC_COLLATE 10094@findex LC_MESSAGES 10095@c @findex LC_MONETARY 10096@c @findex LC_NUMERIC 10097@c @findex LC_TIME 10098@findex LC_ALL 10099@cindex locale 10100These environment variables control the way that GCC uses 10101localization information that allow GCC to work with different 10102national conventions. GCC inspects the locale categories 10103@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 10104so. These locale categories can be set to any value supported by your 10105installation. A typical value is @samp{en_UK} for English in the United 10106Kingdom. 10107 10108The @env{LC_CTYPE} environment variable specifies character 10109classification. GCC uses it to determine the character boundaries in 10110a string; this is needed for some multibyte encodings that contain quote 10111and escape characters that would otherwise be interpreted as a string 10112end or escape. 10113 10114The @env{LC_MESSAGES} environment variable specifies the language to 10115use in diagnostic messages. 10116 10117If the @env{LC_ALL} environment variable is set, it overrides the value 10118of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 10119and @env{LC_MESSAGES} default to the value of the @env{LANG} 10120environment variable. If none of these variables are set, GCC 10121defaults to traditional C English behavior. 10122 10123@item TMPDIR 10124@findex TMPDIR 10125If @env{TMPDIR} is set, it specifies the directory to use for temporary 10126files. GCC uses temporary files to hold the output of one stage of 10127compilation which is to be used as input to the next stage: for example, 10128the output of the preprocessor, which is the input to the compiler 10129proper. 10130 10131@item GCC_EXEC_PREFIX 10132@findex GCC_EXEC_PREFIX 10133If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 10134names of the subprograms executed by the compiler. No slash is added 10135when this prefix is combined with the name of a subprogram, but you can 10136specify a prefix that ends with a slash if you wish. 10137 10138If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out 10139an appropriate prefix to use based on the pathname it was invoked with. 10140 10141If GCC cannot find the subprogram using the specified prefix, it 10142tries looking in the usual places for the subprogram. 10143 10144The default value of @env{GCC_EXEC_PREFIX} is 10145@file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value 10146of @code{prefix} when you ran the @file{configure} script. 10147 10148Other prefixes specified with @option{-B} take precedence over this prefix. 10149 10150This prefix is also used for finding files such as @file{crt0.o} that are 10151used for linking. 10152 10153In addition, the prefix is used in an unusual way in finding the 10154directories to search for header files. For each of the standard 10155directories whose name normally begins with @samp{/usr/local/lib/gcc-lib} 10156(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 10157replacing that beginning with the specified prefix to produce an 10158alternate directory name. Thus, with @option{-Bfoo/}, GCC will search 10159@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}. 10160These alternate directories are searched first; the standard directories 10161come next. 10162 10163@item COMPILER_PATH 10164@findex COMPILER_PATH 10165The value of @env{COMPILER_PATH} is a colon-separated list of 10166directories, much like @env{PATH}. GCC tries the directories thus 10167specified when searching for subprograms, if it can't find the 10168subprograms using @env{GCC_EXEC_PREFIX}. 10169 10170@item LIBRARY_PATH 10171@findex LIBRARY_PATH 10172The value of @env{LIBRARY_PATH} is a colon-separated list of 10173directories, much like @env{PATH}. When configured as a native compiler, 10174GCC tries the directories thus specified when searching for special 10175linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking 10176using GCC also uses these directories when searching for ordinary 10177libraries for the @option{-l} option (but directories specified with 10178@option{-L} come first). 10179 10180@item LANG 10181@findex LANG 10182@cindex locale definition 10183This variable is used to pass locale information to the compiler. One way in 10184which this information is used is to determine the character set to be used 10185when character literals, string literals and comments are parsed in C and C++. 10186When the compiler is configured to allow multibyte characters, 10187the following values for @env{LANG} are recognized: 10188 10189@table @samp 10190@item C-JIS 10191Recognize JIS characters. 10192@item C-SJIS 10193Recognize SJIS characters. 10194@item C-EUCJP 10195Recognize EUCJP characters. 10196@end table 10197 10198If @env{LANG} is not defined, or if it has some other value, then the 10199compiler will use mblen and mbtowc as defined by the default locale to 10200recognize and translate multibyte characters. 10201@end table 10202 10203@noindent 10204Some additional environments variables affect the behavior of the 10205preprocessor. 10206 10207@include cppenv.texi 10208 10209@c man end 10210 10211@node Running Protoize 10212@section Running Protoize 10213 10214The program @code{protoize} is an optional part of GCC@. You can use 10215it to add prototypes to a program, thus converting the program to ISO 10216C in one respect. The companion program @code{unprotoize} does the 10217reverse: it removes argument types from any prototypes that are found. 10218 10219When you run these programs, you must specify a set of source files as 10220command line arguments. The conversion programs start out by compiling 10221these files to see what functions they define. The information gathered 10222about a file @var{foo} is saved in a file named @file{@var{foo}.X}. 10223 10224After scanning comes actual conversion. The specified files are all 10225eligible to be converted; any files they include (whether sources or 10226just headers) are eligible as well. 10227 10228But not all the eligible files are converted. By default, 10229@code{protoize} and @code{unprotoize} convert only source and header 10230files in the current directory. You can specify additional directories 10231whose files should be converted with the @option{-d @var{directory}} 10232option. You can also specify particular files to exclude with the 10233@option{-x @var{file}} option. A file is converted if it is eligible, its 10234directory name matches one of the specified directory names, and its 10235name within the directory has not been excluded. 10236 10237Basic conversion with @code{protoize} consists of rewriting most 10238function definitions and function declarations to specify the types of 10239the arguments. The only ones not rewritten are those for varargs 10240functions. 10241 10242@code{protoize} optionally inserts prototype declarations at the 10243beginning of the source file, to make them available for any calls that 10244precede the function's definition. Or it can insert prototype 10245declarations with block scope in the blocks where undeclared functions 10246are called. 10247 10248Basic conversion with @code{unprotoize} consists of rewriting most 10249function declarations to remove any argument types, and rewriting 10250function definitions to the old-style pre-ISO form. 10251 10252Both conversion programs print a warning for any function declaration or 10253definition that they can't convert. You can suppress these warnings 10254with @option{-q}. 10255 10256The output from @code{protoize} or @code{unprotoize} replaces the 10257original source file. The original file is renamed to a name ending 10258with @samp{.save} (for DOS, the saved filename ends in @samp{.sav} 10259without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav} 10260for DOS) file already exists, then the source file is simply discarded. 10261 10262@code{protoize} and @code{unprotoize} both depend on GCC itself to 10263scan the program and collect information about the functions it uses. 10264So neither of these programs will work until GCC is installed. 10265 10266Here is a table of the options you can use with @code{protoize} and 10267@code{unprotoize}. Each option works with both programs unless 10268otherwise stated. 10269 10270@table @code 10271@item -B @var{directory} 10272Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the 10273usual directory (normally @file{/usr/local/lib}). This file contains 10274prototype information about standard system functions. This option 10275applies only to @code{protoize}. 10276 10277@item -c @var{compilation-options} 10278Use @var{compilation-options} as the options when running @code{gcc} to 10279produce the @samp{.X} files. The special option @option{-aux-info} is 10280always passed in addition, to tell @code{gcc} to write a @samp{.X} file. 10281 10282Note that the compilation options must be given as a single argument to 10283@code{protoize} or @code{unprotoize}. If you want to specify several 10284@code{gcc} options, you must quote the entire set of compilation options 10285to make them a single word in the shell. 10286 10287There are certain @code{gcc} arguments that you cannot use, because they 10288would produce the wrong kind of output. These include @option{-g}, 10289@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in 10290the @var{compilation-options}, they are ignored. 10291 10292@item -C 10293Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file 10294systems) instead of @samp{.c}. This is convenient if you are converting 10295a C program to C++. This option applies only to @code{protoize}. 10296 10297@item -g 10298Add explicit global declarations. This means inserting explicit 10299declarations at the beginning of each source file for each function 10300that is called in the file and was not declared. These declarations 10301precede the first function definition that contains a call to an 10302undeclared function. This option applies only to @code{protoize}. 10303 10304@item -i @var{string} 10305Indent old-style parameter declarations with the string @var{string}. 10306This option applies only to @code{protoize}. 10307 10308@code{unprotoize} converts prototyped function definitions to old-style 10309function definitions, where the arguments are declared between the 10310argument list and the initial @samp{@{}. By default, @code{unprotoize} 10311uses five spaces as the indentation. If you want to indent with just 10312one space instead, use @option{-i " "}. 10313 10314@item -k 10315Keep the @samp{.X} files. Normally, they are deleted after conversion 10316is finished. 10317 10318@item -l 10319Add explicit local declarations. @code{protoize} with @option{-l} inserts 10320a prototype declaration for each function in each block which calls the 10321function without any declaration. This option applies only to 10322@code{protoize}. 10323 10324@item -n 10325Make no real changes. This mode just prints information about the conversions 10326that would have been done without @option{-n}. 10327 10328@item -N 10329Make no @samp{.save} files. The original files are simply deleted. 10330Use this option with caution. 10331 10332@item -p @var{program} 10333Use the program @var{program} as the compiler. Normally, the name 10334@file{gcc} is used. 10335 10336@item -q 10337Work quietly. Most warnings are suppressed. 10338 10339@item -v 10340Print the version number, just like @option{-v} for @code{gcc}. 10341@end table 10342 10343If you need special compiler options to compile one of your program's 10344source files, then you should generate that file's @samp{.X} file 10345specially, by running @code{gcc} on that source file with the 10346appropriate options and the option @option{-aux-info}. Then run 10347@code{protoize} on the entire set of files. @code{protoize} will use 10348the existing @samp{.X} file because it is newer than the source file. 10349For example: 10350 10351@example 10352gcc -Dfoo=bar file1.c -aux-info file1.X 10353protoize *.c 10354@end example 10355 10356@noindent 10357You need to include the special files along with the rest in the 10358@code{protoize} command, even though their @samp{.X} files already 10359exist, because otherwise they won't get converted. 10360 10361@xref{Protoize Caveats}, for more information on how to use 10362@code{protoize} successfully. 10363