invoke.texi revision 261188
1109998Smarkm@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2280304Sjkim@c 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 3280304Sjkim@c This is part of the GCC manual. 4280304Sjkim@c For copying conditions, see the file gcc.texi. 5109998Smarkm 6109998Smarkm@ignore 7109998Smarkm@c man begin INCLUDE 8109998Smarkm@include gcc-vers.texi 9109998Smarkm@c man end 10109998Smarkm 11109998Smarkm@c man begin COPYRIGHT 12109998SmarkmCopyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 13109998Smarkm1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 14280304Sjkim 15109998SmarkmPermission is granted to copy, distribute and/or modify this document 16109998Smarkmunder the terms of the GNU Free Documentation License, Version 1.2 or 17109998Smarkmany later version published by the Free Software Foundation; with the 18109998SmarkmInvariant Sections being ``GNU General Public License'' and ``Funding 19109998SmarkmFree Software'', the Front-Cover texts being (a) (see below), and with 20109998Smarkmthe Back-Cover Texts being (b) (see below). A copy of the license is 21109998Smarkmincluded in the gfdl(7) man page. 22109998Smarkm 23109998Smarkm(a) The FSF's Front-Cover Text is: 24109998Smarkm 25109998Smarkm A GNU Manual 26109998Smarkm 27109998Smarkm(b) The FSF's Back-Cover Text is: 28109998Smarkm 29109998Smarkm You have freedom to copy and modify this GNU Manual, like GNU 30109998Smarkm software. Copies published by the Free Software Foundation raise 31109998Smarkm funds for GNU development. 32109998Smarkm@c man end 33109998Smarkm@c Set file name and title for the man page. 34109998Smarkm@setfilename gcc 35109998Smarkm@settitle GNU project C and C++ compiler 36109998Smarkm@c man begin SYNOPSIS 37109998Smarkmgcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}] 38109998Smarkm [@option{-g}] [@option{-pg}] [@option{-O}@var{level}] 39109998Smarkm [@option{-W}@var{warn}@dots{}] [@option{-pedantic}] 40109998Smarkm [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}] 41109998Smarkm [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] 42109998Smarkm [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}] 43109998Smarkm [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{} 44109998Smarkm 45109998SmarkmOnly the most useful options are listed here; see below for the 46109998Smarkmremainder. @samp{g++} accepts mostly the same options as @samp{gcc}. 47109998Smarkm@c man end 48109998Smarkm@c man begin SEEALSO 49109998Smarkmgpl(7), gfdl(7), fsf-funding(7), 50109998Smarkmcpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) 51109998Smarkmand the Info entries for @file{gcc}, @file{cpp}, @file{as}, 52109998Smarkm@file{ld}, @file{binutils} and @file{gdb}. 53109998Smarkm@c man end 54109998Smarkm@c man begin BUGS 55109998SmarkmFor instructions on reporting bugs, see 56109998Smarkm@w{@uref{http://gcc.gnu.org/bugs.html}}. 57109998Smarkm@c man end 58109998Smarkm@c man begin AUTHOR 59160814SsimonSee the Info entry for @command{gcc}, or 60160814Ssimon@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}}, 61280304Sjkimfor contributors to GCC@. 62160814Ssimon@c man end 63160814Ssimon@end ignore 64109998Smarkm 65109998Smarkm@node Invoking GCC 66109998Smarkm@chapter GCC Command Options 67109998Smarkm@cindex GCC command options 68109998Smarkm@cindex command options 69109998Smarkm@cindex options, GCC command 70109998Smarkm 71109998Smarkm@c man begin DESCRIPTION 72160814SsimonWhen you invoke GCC, it normally does preprocessing, compilation, 73160814Ssimonassembly and linking. The ``overall options'' allow you to stop this 74280304Sjkimprocess at an intermediate stage. For example, the @option{-c} option 75160814Ssimonsays not to run the linker. Then the output consists of object files 76160814Ssimonoutput by the assembler. 77280304Sjkim 78160814SsimonOther options are passed on to one stage of processing. Some options 79160814Ssimoncontrol the preprocessor and others the compiler itself. Yet other 80280304Sjkimoptions control the assembler and linker; most of these are not 81160814Ssimondocumented here, since you rarely need to use any of them. 82109998Smarkm 83280304Sjkim@cindex C compilation options 84280304SjkimMost of the command line options that you can use with GCC are useful 85280304Sjkimfor C programs; when an option is only useful with another language 86280304Sjkim(usually C++), the explanation says so explicitly. If the description 87280304Sjkimfor a particular option does not mention a source language, you can use 88109998Smarkmthat option with all supported languages. 89109998Smarkm 90109998Smarkm@cindex C++ compilation options 91109998Smarkm@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special 92109998Smarkmoptions for compiling C++ programs. 93109998Smarkm 94109998Smarkm@cindex grouping options 95109998Smarkm@cindex options, grouping 96109998SmarkmThe @command{gcc} program accepts options and file names as operands. Many 97109998Smarkmoptions have multi-letter names; therefore multiple single-letter options 98109998Smarkmmay @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d 99109998Smarkm-r}}. 100109998Smarkm 101280304Sjkim@cindex order of options 102280304Sjkim@cindex options, order 103280304SjkimYou can mix options and other arguments. For the most part, the order 104280304Sjkimyou use doesn't matter. Order does matter when you use several options 105109998Smarkmof the same kind; for example, if you specify @option{-L} more than once, 106109998Smarkmthe directories are searched in the order specified. 107280304Sjkim 108280304SjkimMany options have long names starting with @samp{-f} or with 109280304Sjkim@samp{-W}---for example, 110280304Sjkim@option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of 111280304Sjkimthese have both positive and negative forms; the negative form of 112109998Smarkm@option{-ffoo} would be @option{-fno-foo}. This manual documents 113109998Smarkmonly one of these two forms, whichever one is not the default. 114109998Smarkm 115109998Smarkm@c man end 116280304Sjkim 117109998Smarkm@xref{Option Index}, for an index to GCC's options. 118109998Smarkm 119109998Smarkm@menu 120280304Sjkim* Option Summary:: Brief list of all options, without explanations. 121109998Smarkm* Overall Options:: Controlling the kind of output: 122109998Smarkm an executable, object files, assembler files, 123109998Smarkm or preprocessed source. 124109998Smarkm* Invoking G++:: Compiling C++ programs. 125280304Sjkim* C Dialect Options:: Controlling the variant of C language compiled. 126280304Sjkim* C++ Dialect Options:: Variations on C++. 127109998Smarkm* Language Independent Options:: Controlling how diagnostics should be 128109998Smarkm formatted. 129109998Smarkm* Warning Options:: How picky should the compiler be? 130109998Smarkm* Debugging Options:: Symbol tables, measurements, and debugging dumps. 131109998Smarkm* Optimize Options:: How much optimization? 132109998Smarkm* Preprocessor Options:: Controlling header files and macro definitions. 133280304Sjkim Also, getting dependency information for Make. 134280304Sjkim* Assembler Options:: Passing options to the assembler. 135280304Sjkim* Link Options:: Specifying libraries and so on. 136280304Sjkim* Directory Options:: Where to find header files and libraries. 137109998Smarkm Where to find the compiler executable files. 138280304Sjkim* Spec Files:: How to pass switches to sub-processes. 139280304Sjkim* Target Options:: Running a cross-compiler, or an old version of GCC. 140280304Sjkim* Submodel Options:: Specifying minor hardware or convention variations, 141109998Smarkm such as 68010 vs 68020. 142280304Sjkim* Code Gen Options:: Specifying conventions for function calls, data layout 143280304Sjkim and register usage. 144280304Sjkim* Environment Variables:: Env vars that affect GCC. 145280304Sjkim* Precompiled Headers:: Compiling a header once, and using it many times. 146280304Sjkim* Running Protoize:: Automatically adding or removing function prototypes. 147280304Sjkim@end menu 148280304Sjkim 149280304Sjkim@c man begin OPTIONS 150280304Sjkim 151280304Sjkim@node Option Summary 152280304Sjkim@section Option Summary 153280304Sjkim 154280304SjkimHere is a summary of all the options, grouped by type. Explanations are 155280304Sjkimin the following sections. 156280304Sjkim 157280304Sjkim@table @emph 158280304Sjkim@item Overall Options 159280304Sjkim@xref{Overall Options,,Options Controlling the Kind of Output}. 160280304Sjkim@gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol 161280304Sjkim-x @var{language} -v -### --help --target-help --version @@@var{file}} 162280304Sjkim 163280304Sjkim@item C Language Options 164109998Smarkm@xref{C Dialect Options,,Options Controlling C Dialect}. 165109998Smarkm@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol 166280304Sjkim-aux-info @var{filename} @gol 167109998Smarkm@c APPLE LOCAL blocks 7205047 5811887 168280304Sjkim-fno-asm -fno-blocks -fno-builtin -fno-builtin-@var{function} @gol 169280304Sjkim-fhosted -ffreestanding -fopenmp -fms-extensions @gol 170280304Sjkim-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol 171280304Sjkim-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol 172280304Sjkim@c APPLE LOCAL nested functions 4357979 */ 173280304Sjkim-fno-nested-functions @gol 174280304Sjkim-fsigned-bitfields -fsigned-char @gol 175280304Sjkim@c APPLE LOCAL -Wnewline-eof 2001-08-23 --sts ** 176280304Sjkim-Wnewline-eof (Apple compatible) @gol 177109998Smarkm-funsigned-bitfields -funsigned-char} 178109998Smarkm 179280304Sjkim@item C++ Language Options 180280304Sjkim@xref{C++ Dialect Options,,Options Controlling C++ Dialect}. 181280304Sjkim@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol 182280304Sjkim-fconserve-space -ffriend-injection @gol 183280304Sjkim-fno-elide-constructors @gol 184280304Sjkim-fno-enforce-eh-specs @gol 185280304Sjkim-ffor-scope -fno-for-scope -fno-gnu-keywords @gol 186280304Sjkim-fno-implicit-templates @gol 187280304Sjkim-fno-implicit-inline-templates @gol 188280304Sjkim-fno-implement-inlines -fms-extensions @gol 189109998Smarkm-fno-nonansi-builtins -fno-operator-names @gol 190109998Smarkm-fno-optional-diags -fpermissive @gol 191280304Sjkim-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol 192280304Sjkim-fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol 193280304Sjkim-fno-default-inline -fvisibility-inlines-hidden @gol 194280304Sjkim-fvisibility-ms-compat @gol 195280304Sjkim-Wabi -Wctor-dtor-privacy @gol 196280304Sjkim-Wnon-virtual-dtor -Wreorder @gol 197280304Sjkim-Weffc++ -Wno-deprecated -Wstrict-null-sentinel @gol 198280304Sjkim-Wno-non-template-friend -Wold-style-cast @gol 199280304Sjkim-Woverloaded-virtual -Wno-pmf-conversions @gol 200280304Sjkim-Wsign-promo} 201280304Sjkim 202280304Sjkim@item Language Independent Options 203109998Smarkm@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. 204280304Sjkim@gccoptlist{-fmessage-length=@var{n} @gol 205280304Sjkim-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol 206280304Sjkim-fdiagnostics-show-option} 207280304Sjkim 208109998Smarkm@item Warning Options 209109998Smarkm@xref{Warning Options,,Options to Request or Suppress Warnings}. 210280304Sjkim@gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol 211280304Sjkim-w -Wextra -Wall -Waddress -Waggregate-return -Wno-attributes @gol 212280304Sjkim-Wc++-compat -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol 213280304Sjkim-Wconversion -Wno-deprecated-declarations @gol 214280304Sjkim-Wdisabled-optimization -Wno-div-by-zero -Wno-endif-labels @gol 215280304Sjkim-Werror -Werror=* -Werror-implicit-function-declaration @gol 216280304Sjkim-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol 217280304Sjkim-Wno-format-extra-args -Wformat-nonliteral @gol 218109998Smarkm-Wformat-security -Wformat-y2k @gol 219280304Sjkim-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol 220280304Sjkim-Wimport -Wno-import -Winit-self -Winline @gol 221109998Smarkm-Wno-int-to-pointer-cast @gol 222280304Sjkim-Wno-invalid-offsetof -Winvalid-pch @gol 223280304Sjkim-Wlarger-than-@var{len} -Wframe-larger-than-@var{len} @gol 224109998Smarkm-Wunsafe-loop-optimizations -Wlong-long @gol 225109998Smarkm-Wmain -Wmissing-braces -Wmissing-field-initializers @gol 226109998Smarkm-Wmissing-format-attribute -Wmissing-include-dirs @gol 227109998Smarkm-Wmissing-noreturn @gol 228109998Smarkm@c APPLE LOCAL -Wmost 229109998Smarkm-Wmost (APPLE ONLY) @gol 230109998Smarkm-Wno-multichar -Wnonnull -Wno-overflow @gol 231109998Smarkm-Woverlength-strings -Wpacked -Wpadded @gol 232109998Smarkm-Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol 233280304Sjkim-Wredundant-decls @gol 234280304Sjkim-Wreturn-type -Wsequence-point -Wshadow @gol 235280304Sjkim-Wsign-compare -Wstack-protector @gol 236280304Sjkim-Wstrict-aliasing -Wstrict-aliasing=2 @gol 237109998Smarkm-Wstrict-overflow -Wstrict-overflow=@var{n} @gol 238109998Smarkm-Wswitch -Wswitch-default -Wswitch-enum @gol 239280304Sjkim-Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol 240280304Sjkim-Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol 241280304Sjkim-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol 242280304Sjkim-Wunused-value -Wunused-variable @gol 243109998Smarkm-Wvariadic-macros -Wvla @gol 244280304Sjkim-Wvolatile-register-var -Wwrite-strings} 245280304Sjkim 246280304Sjkim@item C-only Warning Options 247280304Sjkim@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 248280304Sjkim-Wmissing-prototypes -Wnested-externs -Wold-style-definition @gol 249280304Sjkim-Wstrict-prototypes -Wtraditional @gol 250280304Sjkim-Wdeclaration-after-statement -Wpointer-sign} 251280304Sjkim 252280304Sjkim@item Debugging Options 253280304Sjkim@xref{Debugging Options,,Options for Debugging Your Program or GCC}. 254280304Sjkim@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 255109998Smarkm-fdump-noaddr -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol 256280304Sjkim-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol 257280304Sjkim-fdump-ipa-all -fdump-ipa-cgraph @gol 258280304Sjkim-fdump-tree-all @gol 259280304Sjkim-fdump-tree-original@r{[}-@var{n}@r{]} @gol 260280304Sjkim-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol 261280304Sjkim-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol 262280304Sjkim-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol 263280304Sjkim-fdump-tree-ch @gol 264280304Sjkim-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol 265280304Sjkim-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol 266280304Sjkim-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol 267280304Sjkim-fdump-tree-dom@r{[}-@var{n}@r{]} @gol 268280304Sjkim-fdump-tree-dse@r{[}-@var{n}@r{]} @gol 269280304Sjkim-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol 270280304Sjkim-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol 271280304Sjkim-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol 272280304Sjkim-fdump-tree-nrv -fdump-tree-vect @gol 273280304Sjkim-fdump-tree-sink @gol 274280304Sjkim-fdump-tree-sra@r{[}-@var{n}@r{]} @gol 275280304Sjkim-fdump-tree-salias @gol 276280304Sjkim-fdump-tree-fre@r{[}-@var{n}@r{]} @gol 277280304Sjkim-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol 278280304Sjkim-ftree-vectorizer-verbose=@var{n} @gol 279280304Sjkim-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol 280280304Sjkim-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol 281280304Sjkim-feliminate-unused-debug-symbols -femit-class-debug-always @gol 282280304Sjkim-fmem-report -fprofile-arcs @gol 283280304Sjkim-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 284280304Sjkim-ftest-coverage -ftime-report -fvar-tracking @gol 285280304Sjkim-g -g@var{level} -gcoff -gdwarf-2 @gol 286280304Sjkim-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol 287280304Sjkim-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol 288280304Sjkim-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol 289280304Sjkim-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol 290280304Sjkim-print-multi-directory -print-multi-lib @gol 291280304Sjkim-print-prog-name=@var{program} -print-search-dirs -Q @gol 292280304Sjkim-save-temps -time} 293109998Smarkm 294280304Sjkim@item Optimization Options 295280304Sjkim@xref{Optimize Options,,Options that Control Optimization}. 296280304Sjkim@gccoptlist{-falign-functions=@var{n} -falign-jumps=@var{n} @gol 297280304Sjkim-falign-labels=@var{n} -falign-loops=@var{n} @gol 298280304Sjkim-fbounds-check -fmudflap -fmudflapth -fmudflapir @gol 299280304Sjkim-fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol 300280304Sjkim-fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol 301280304Sjkim-fcaller-saves -fcprop-registers -fcse-follow-jumps @gol 302280304Sjkim-fcse-skip-blocks -fcx-limited-range -fdata-sections @gol 303280304Sjkim-fdelayed-branch -fdelete-null-pointer-checks -fearly-inlining @gol 304280304Sjkim-fexpensive-optimizations -ffast-math -ffloat-store @gol 305280304Sjkim-fforce-addr -ffunction-sections @gol 306280304Sjkim-fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol 307280304Sjkim-fcrossjumping -fif-conversion -fif-conversion2 @gol 308280304Sjkim-finline-functions -finline-functions-called-once @gol 309280304Sjkim-finline-limit=@var{n} -fkeep-inline-functions @gol 310280304Sjkim-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol 311280304Sjkim-fmodulo-sched -fno-branch-count-reg @gol 312280304Sjkim-fno-default-inline -fno-defer-pop -fmove-loop-invariants @gol 313280304Sjkim-fno-function-cse -fno-guess-branch-probability @gol 314280304Sjkim-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol 315280304Sjkim-funsafe-math-optimizations -funsafe-loop-optimizations -ffinite-math-only @gol 316109998Smarkm-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol 317109998Smarkm-fomit-frame-pointer -foptimize-register-move @gol 318109998Smarkm-foptimize-sibling-calls -fprefetch-loop-arrays @gol 319109998Smarkm-fprofile-generate -fprofile-use @gol 320280304Sjkim-fregmove -frename-registers @gol 321280304Sjkim-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol 322280304Sjkim-frerun-cse-after-loop @gol 323109998Smarkm-frounding-math -frtl-abstract-sequences @gol 324109998Smarkm-fschedule-insns -fschedule-insns2 @gol 325280304Sjkim-fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol 326280304Sjkim-fsched-spec-load-dangerous @gol 327280304Sjkim-fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol 328280304Sjkim-fsched2-use-superblocks @gol 329280304Sjkim-fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol 330280304Sjkim-fsection-anchors -fsignaling-nans -fsingle-precision-constant @gol 331280304Sjkim-fstack-protector -fstack-protector-all @gol 332280304Sjkim-fstrict-aliasing -fstrict-overflow -ftracer -fthread-jumps @gol 333280304Sjkim-funroll-all-loops -funroll-loops -fpeel-loops @gol 334280304Sjkim-fsplit-ivs-in-unroller -funswitch-loops @gol 335280304Sjkim-fvariable-expansion-in-unroller @gol 336280304Sjkim-ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol 337280304Sjkim-ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol 338280304Sjkim-ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol 339280304Sjkim-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol 340280304Sjkim-ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol 341280304Sjkim-ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol 342280304Sjkim--param @var{name}=@var{value} 343280304Sjkim-O -O0 -O1 -O2 -O3 -Os} 344280304Sjkim 345280304Sjkim@item Preprocessor Options 346280304Sjkim@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 347280304Sjkim@gccoptlist{-A@var{question}=@var{answer} @gol 348280304Sjkim-A-@var{question}@r{[}=@var{answer}@r{]} @gol 349280304Sjkim-C -dD -dI -dM -dN @gol 350280304Sjkim-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol 351280304Sjkim-idirafter @var{dir} @gol 352280304Sjkim-include @var{file} -imacros @var{file} @gol 353280304Sjkim-iprefix @var{file} -iwithprefix @var{dir} @gol 354280304Sjkim-iwithprefixbefore @var{dir} -isystem @var{dir} @gol 355280304Sjkim-imultilib @var{dir} -isysroot @var{dir} @gol 356280304Sjkim-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol 357280304Sjkim-P -fworking-directory -remap @gol 358280304Sjkim-trigraphs -undef -U@var{macro} -Wp,@var{option} @gol 359280304Sjkim-Xpreprocessor @var{option}} 360280304Sjkim 361280304Sjkim@item Assembler Option 362280304Sjkim@xref{Assembler Options,,Passing Options to the Assembler}. 363109998Smarkm@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 364280304Sjkim 365280304Sjkim@item Linker Options 366280304Sjkim@xref{Link Options,,Options for Linking}. 367280304Sjkim@gccoptlist{@var{object-file-name} -l@var{library} @gol 368280304Sjkim-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol 369280304Sjkim-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol 370280304Sjkim-Wl,@var{option} -Xlinker @var{option} @gol 371280304Sjkim-u @var{symbol}} 372280304Sjkim 373280304Sjkim@item Directory Options 374280304Sjkim@xref{Directory Options,,Options for Directory Search}. 375280304Sjkim@gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir} 376280304Sjkim-specs=@var{file} -I- --sysroot=@var{dir}} 377280304Sjkim 378280304Sjkim@item Target Options 379280304Sjkim@c I wrote this xref this way to avoid overfull hbox. -- rms 380280304Sjkim@xref{Target Options}. 381280304Sjkim@gccoptlist{-V @var{version} -b @var{machine}} 382280304Sjkim 383280304Sjkim@item Machine Dependent Options 384109998Smarkm@xref{Submodel Options,,Hardware Models and Configurations}. 385109998Smarkm@c This list is ordered alphanumerically by subsection name. 386109998Smarkm@c Try and put the significant identifier (CPU or system) first, 387109998Smarkm@c so users have a clue at guessing where the ones they want will be. 388280304Sjkim 389280304Sjkim@emph{ARC Options} 390280304Sjkim@gccoptlist{-EB -EL @gol 391280304Sjkim-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol 392280304Sjkim-mdata=@var{data-section} -mrodata=@var{readonly-data-section}} 393280304Sjkim 394280304Sjkim@emph{ARM Options} 395280304Sjkim@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 396280304Sjkim-mabi=@var{name} @gol 397280304Sjkim-mapcs-stack-check -mno-apcs-stack-check @gol 398280304Sjkim-mapcs-float -mno-apcs-float @gol 399280304Sjkim-mapcs-reentrant -mno-apcs-reentrant @gol 400280304Sjkim-msched-prolog -mno-sched-prolog @gol 401280304Sjkim-mlittle-endian -mbig-endian -mwords-little-endian @gol 402109998Smarkm-mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol 403-mthumb-interwork -mno-thumb-interwork @gol 404-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 405-mstructure-size-boundary=@var{n} @gol 406-mabort-on-noreturn @gol 407-mlong-calls -mno-long-calls @gol 408-msingle-pic-base -mno-single-pic-base @gol 409-mpic-register=@var{reg} @gol 410-mnop-fun-dllimport @gol 411-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol 412-mpoke-function-name @gol 413-mthumb -marm @gol 414-mtpcs-frame -mtpcs-leaf-frame @gol 415-mcaller-super-interworking -mcallee-super-interworking @gol 416-mtp=@var{name}} 417 418@emph{AVR Options} 419@gccoptlist{-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol 420-mcall-prologues -mno-tablejump -mtiny-stack -mint8} 421 422@emph{Blackfin Options} 423@gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 424-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 425-mlow-64k -mno-low64k -mid-shared-library @gol 426-mno-id-shared-library -mshared-library-id=@var{n} @gol 427-mlong-calls -mno-long-calls} 428 429@emph{CRIS Options} 430@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 431-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 432-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 433-mstack-align -mdata-align -mconst-align @gol 434-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 435-melf -maout -melinux -mlinux -sim -sim2 @gol 436-mmul-bug-workaround -mno-mul-bug-workaround} 437 438@emph{CRX Options} 439@gccoptlist{-mmac -mpush-args} 440 441@emph{Darwin Options} 442@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 443-arch_only -bind_at_load -bundle -bundle_loader @gol 444-client_name -compatibility_version -current_version @gol 445-dead_strip @gol 446-dependency-file -dylib_file -dylinker_install_name @gol 447-dynamic -dynamiclib -exported_symbols_list @gol 448-filelist -flat_namespace -force_cpusubtype_ALL @gol 449-force_flat_namespace -headerpad_max_install_names @gol 450-image_base -init -install_name -keep_private_externs @gol 451-multi_module -multiply_defined -multiply_defined_unused @gol 452-noall_load -no_dead_strip_inits_and_terms @gol 453-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 454-pagezero_size -prebind -prebind_all_twolevel_modules @gol 455-private_bundle -read_only_relocs -sectalign @gol 456-sectobjectsymbols -whyload -seg1addr @gol 457-sectcreate -sectobjectsymbols -sectorder @gol 458-segaddr -segs_read_only_addr -segs_read_write_addr @gol 459-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 460-segprot -segs_read_only_addr -segs_read_write_addr @gol 461-single_module -static -sub_library -sub_umbrella @gol 462-twolevel_namespace -umbrella -undefined @gol 463-unexported_symbols_list -weak_reference_mismatches @gol 464-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 465-mkernel -mone-byte-bool} 466 467@emph{DEC Alpha Options} 468@gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol 469-mieee -mieee-with-inexact -mieee-conformant @gol 470-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 471-mtrap-precision=@var{mode} -mbuild-constants @gol 472-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 473-mbwx -mmax -mfix -mcix @gol 474-mfloat-vax -mfloat-ieee @gol 475-mexplicit-relocs -msmall-data -mlarge-data @gol 476-msmall-text -mlarge-text @gol 477-mmemory-latency=@var{time}} 478 479@emph{DEC Alpha/VMS Options} 480@gccoptlist{-mvms-return-codes} 481 482@emph{FRV Options} 483@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 484-mhard-float -msoft-float @gol 485-malloc-cc -mfixed-cc -mdword -mno-dword @gol 486-mdouble -mno-double @gol 487-mmedia -mno-media -mmuladd -mno-muladd @gol 488-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 489-mlinked-fp -mlong-calls -malign-labels @gol 490-mlibrary-pic -macc-4 -macc-8 @gol 491-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 492-moptimize-membar -mno-optimize-membar @gol 493-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 494-mvliw-branch -mno-vliw-branch @gol 495-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 496-mno-nested-cond-exec -mtomcat-stats @gol 497-mTLS -mtls @gol 498-mcpu=@var{cpu}} 499 500@emph{GNU/Linux Options} 501@gccoptlist{-muclibc} 502 503@emph{H8/300 Options} 504@gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300} 505 506@emph{HPPA Options} 507@gccoptlist{-march=@var{architecture-type} @gol 508-mbig-switch -mdisable-fpregs -mdisable-indexing @gol 509-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 510-mfixed-range=@var{register-range} @gol 511-mjump-in-delay -mlinker-opt -mlong-calls @gol 512-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol 513-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 514-mno-jump-in-delay -mno-long-load-store @gol 515-mno-portable-runtime -mno-soft-float @gol 516-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 517-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 518-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 519-munix=@var{unix-std} -nolibdld -static -threads} 520 521@emph{i386 and x86-64 Options} 522@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 523-mfpmath=@var{unit} @gol 524-masm=@var{dialect} -mno-fancy-math-387 @gol 525-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol 526-mno-wide-multiply -mrtd -malign-double @gol 527-mpreferred-stack-boundary=@var{num} @gol 528-mmmx -msse -msse2 -msse3 -mssse3 -msse4a -m3dnow -mpopcnt -mabm -maes @gol 529-mthreads -mno-align-stringops -minline-all-stringops @gol 530-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 531-m96bit-long-double -mregparm=@var{num} -msseregparm @gol 532-mstackrealign @gol 533-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 534-mcmodel=@var{code-model} @gol 535-m32 -m64 -mlarge-data-threshold=@var{num}} 536 537@emph{IA-64 Options} 538@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 539-mvolatile-asm-stop -mregister-names -mno-sdata @gol 540-mconstant-gp -mauto-pic -minline-float-divide-min-latency @gol 541-minline-float-divide-max-throughput @gol 542-minline-int-divide-min-latency @gol 543-minline-int-divide-max-throughput @gol 544-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 545-mno-dwarf2-asm -mearly-stop-bits @gol 546-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 547-mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol 548-mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol 549-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 550-msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol 551-mno-sched-prefer-non-data-spec-insns @gol 552-mno-sched-prefer-non-control-spec-insns @gol 553-mno-sched-count-spec-in-critical-path} 554 555@emph{M32R/D Options} 556@gccoptlist{-m32r2 -m32rx -m32r @gol 557-mdebug @gol 558-malign-loops -mno-align-loops @gol 559-missue-rate=@var{number} @gol 560-mbranch-cost=@var{number} @gol 561-mmodel=@var{code-size-model-type} @gol 562-msdata=@var{sdata-type} @gol 563-mno-flush-func -mflush-func=@var{name} @gol 564-mno-flush-trap -mflush-trap=@var{number} @gol 565-G @var{num}} 566 567@emph{M32C Options} 568@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 569 570@emph{M680x0 Options} 571@gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 572-m68060 -mcpu32 -m5200 -mcfv4e -m68881 -mbitfield @gol 573-mc68000 -mc68020 @gol 574-mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol 575-malign-int -mstrict-align -msep-data -mno-sep-data @gol 576-mshared-library-id=n -mid-shared-library -mno-id-shared-library} 577 578@emph{M68hc1x Options} 579@gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol 580-mauto-incdec -minmax -mlong-calls -mshort @gol 581-msoft-reg-count=@var{count}} 582 583@emph{MCore Options} 584@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 585-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 586-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 587-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 588-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 589 590@emph{MIPS Options} 591@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 592-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol 593-mips16 -mno-mips16 -mabi=@var{abi} -mabicalls -mno-abicalls @gol 594-mshared -mno-shared -mxgot -mno-xgot -mgp32 -mgp64 @gol 595-mfp32 -mfp64 -mhard-float -msoft-float @gol 596-msingle-float -mdouble-float -mdsp -mpaired-single -mips3d @gol 597-mlong64 -mlong32 -msym32 -mno-sym32 @gol 598-G@var{num} -membedded-data -mno-embedded-data @gol 599-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 600-msplit-addresses -mno-split-addresses @gol 601-mexplicit-relocs -mno-explicit-relocs @gol 602-mcheck-zero-division -mno-check-zero-division @gol 603-mdivide-traps -mdivide-breaks @gol 604-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 605-mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol 606-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 607-mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130 @gol 608-mfix-sb1 -mno-fix-sb1 @gol 609-mflush-func=@var{func} -mno-flush-func @gol 610-mbranch-likely -mno-branch-likely @gol 611-mfp-exceptions -mno-fp-exceptions @gol 612-mvr4130-align -mno-vr4130-align} 613 614@emph{MMIX Options} 615@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 616-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 617-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 618-mno-base-addresses -msingle-exit -mno-single-exit} 619 620@emph{MN10300 Options} 621@gccoptlist{-mmult-bug -mno-mult-bug @gol 622-mam33 -mno-am33 @gol 623-mam33-2 -mno-am33-2 @gol 624-mreturn-pointer-on-d0 @gol 625-mno-crt0 -mrelax} 626 627@emph{MT Options} 628@gccoptlist{-mno-crt0 -mbacc -msim @gol 629-march=@var{cpu-type} } 630 631@emph{PDP-11 Options} 632@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 633-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 634-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 635-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 636-mbranch-expensive -mbranch-cheap @gol 637-msplit -mno-split -munix-asm -mdec-asm} 638 639@emph{PowerPC Options} 640See RS/6000 and PowerPC Options. 641 642@emph{RS/6000 and PowerPC Options} 643@gccoptlist{-mcpu=@var{cpu-type} @gol 644-mtune=@var{cpu-type} @gol 645-mpower -mno-power -mpower2 -mno-power2 @gol 646-mpowerpc -mpowerpc64 -mno-powerpc @gol 647-maltivec -mno-altivec @gol 648-mpowerpc-gpopt -mno-powerpc-gpopt @gol 649-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 650-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mfprnd -mno-fprnd @gol 651-mnew-mnemonics -mold-mnemonics @gol 652-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 653-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 654-malign-power -malign-natural @gol 655-msoft-float -mhard-float -mmultiple -mno-multiple @gol 656-mstring -mno-string -mupdate -mno-update @gol 657-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 658-mstrict-align -mno-strict-align -mrelocatable @gol 659-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 660-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 661-mdynamic-no-pic -maltivec -mswdiv @gol 662-mprioritize-restricted-insns=@var{priority} @gol 663-msched-costly-dep=@var{dependence_type} @gol 664-minsert-sched-nops=@var{scheme} @gol 665-mcall-sysv -mcall-netbsd @gol 666-maix-struct-return -msvr4-struct-return @gol 667-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 668-misel -mno-isel @gol 669-misel=yes -misel=no @gol 670-mspe -mno-spe @gol 671-mspe=yes -mspe=no @gol 672-mvrsave -mno-vrsave @gol 673-mmulhw -mno-mulhw @gol 674-mdlmzb -mno-dlmzb @gol 675-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol 676-mprototype -mno-prototype @gol 677-msim -mmvme -mads -myellowknife -memb -msdata @gol 678-msdata=@var{opt} -mvxworks -mwindiss -G @var{num} -pthread} 679 680@emph{S/390 and zSeries Options} 681@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 682-mhard-float -msoft-float -mlong-double-64 -mlong-double-128 @gol 683-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 684-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 685-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 686-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol 687-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard} 688 689@emph{Score Options} 690@gccoptlist{-meb -mel @gol 691-mnhwloop @gol 692-muls @gol 693-mmac @gol 694-mscore5 -mscore5u -mscore7 -mscore7d} 695 696@emph{SH Options} 697@gccoptlist{-m1 -m2 -m2e -m3 -m3e @gol 698-m4-nofpu -m4-single-only -m4-single -m4 @gol 699-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 700-m5-64media -m5-64media-nofpu @gol 701-m5-32media -m5-32media-nofpu @gol 702-m5-compact -m5-compact-nofpu @gol 703-mb -ml -mdalign -mrelax @gol 704-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol 705-mieee -misize -mpadstruct -mspace @gol 706-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 707-mdivsi3_libfunc=@var{name} @gol 708-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol 709 -minvalid-symbols} 710 711@emph{SPARC Options} 712@gccoptlist{-mcpu=@var{cpu-type} @gol 713-mtune=@var{cpu-type} @gol 714-mcmodel=@var{code-model} @gol 715-m32 -m64 -mapp-regs -mno-app-regs @gol 716-mfaster-structs -mno-faster-structs @gol 717-mfpu -mno-fpu -mhard-float -msoft-float @gol 718-mhard-quad-float -msoft-quad-float @gol 719-mimpure-text -mno-impure-text -mlittle-endian @gol 720-mstack-bias -mno-stack-bias @gol 721-munaligned-doubles -mno-unaligned-doubles @gol 722-mv8plus -mno-v8plus -mvis -mno-vis 723-threads -pthreads -pthread} 724 725@emph{System V Options} 726@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 727 728@emph{TMS320C3x/C4x Options} 729@gccoptlist{-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol 730-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol 731-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol 732-mparallel-insns -mparallel-mpy -mpreserve-float} 733 734@emph{V850 Options} 735@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 736-mprolog-function -mno-prolog-function -mspace @gol 737-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 738-mapp-regs -mno-app-regs @gol 739-mdisable-callt -mno-disable-callt @gol 740-mv850e1 @gol 741-mv850e @gol 742-mv850 -mbig-switch} 743 744@emph{VAX Options} 745@gccoptlist{-mg -mgnu -munix} 746 747@emph{x86-64 Options} 748See i386 and x86-64 Options. 749 750@emph{Xstormy16 Options} 751@gccoptlist{-msim} 752 753@emph{Xtensa Options} 754@gccoptlist{-mconst16 -mno-const16 @gol 755-mfused-madd -mno-fused-madd @gol 756-mtext-section-literals -mno-text-section-literals @gol 757-mtarget-align -mno-target-align @gol 758-mlongcalls -mno-longcalls} 759 760@emph{zSeries Options} 761See S/390 and zSeries Options. 762 763@item Code Generation Options 764@xref{Code Gen Options,,Options for Code Generation Conventions}. 765@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 766-ffixed-@var{reg} -fexceptions @gol 767-fnon-call-exceptions -funwind-tables @gol 768-fasynchronous-unwind-tables @gol 769-finhibit-size-directive -finstrument-functions @gol 770-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol 771-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol 772-fno-common -fno-ident @gol 773-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol 774-fno-jump-tables @gol 775-freg-struct-return -fshort-enums @gol 776-fshort-double -fshort-wchar @gol 777-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol 778-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 779-fargument-alias -fargument-noalias @gol 780-fargument-noalias-global -fargument-noalias-anything 781-fleading-underscore -ftls-model=@var{model} @gol 782-ftrapv -fwrapv -fbounds-check @gol 783-fvisibility} 784@end table 785 786@menu 787* Overall Options:: Controlling the kind of output: 788 an executable, object files, assembler files, 789 or preprocessed source. 790* C Dialect Options:: Controlling the variant of C language compiled. 791* C++ Dialect Options:: Variations on C++. 792* Language Independent Options:: Controlling how diagnostics should be 793 formatted. 794* Warning Options:: How picky should the compiler be? 795* Debugging Options:: Symbol tables, measurements, and debugging dumps. 796* Optimize Options:: How much optimization? 797* Preprocessor Options:: Controlling header files and macro definitions. 798 Also, getting dependency information for Make. 799* Assembler Options:: Passing options to the assembler. 800* Link Options:: Specifying libraries and so on. 801* Directory Options:: Where to find header files and libraries. 802 Where to find the compiler executable files. 803* Spec Files:: How to pass switches to sub-processes. 804* Target Options:: Running a cross-compiler, or an old version of GCC. 805@end menu 806 807@node Overall Options 808@section Options Controlling the Kind of Output 809 810Compilation can involve up to four stages: preprocessing, compilation 811proper, assembly and linking, always in that order. GCC is capable of 812preprocessing and compiling several files either into several 813assembler input files, or into one assembler input file; then each 814assembler input file produces an object file, and linking combines all 815the object files (those newly compiled, and those specified as input) 816into an executable file. 817 818@cindex file name suffix 819For any given input file, the file name suffix determines what kind of 820compilation is done: 821 822@table @gcctabopt 823@item @var{file}.c 824C source code which must be preprocessed. 825 826@item @var{file}.i 827C source code which should not be preprocessed. 828 829@item @var{file}.ii 830C++ source code which should not be preprocessed. 831 832@item @var{file}.h 833C, or C++ header file to be turned into a precompiled header. 834 835@item @var{file}.cc 836@itemx @var{file}.cp 837@itemx @var{file}.cxx 838@itemx @var{file}.cpp 839@itemx @var{file}.CPP 840@itemx @var{file}.c++ 841@itemx @var{file}.C 842C++ source code which must be preprocessed. Note that in @samp{.cxx}, 843the last two letters must both be literally @samp{x}. Likewise, 844@samp{.C} refers to a literal capital C@. 845 846@item @var{file}.hh 847@itemx @var{file}.H 848C++ header file to be turned into a precompiled header. 849 850@item @var{file}.f 851@itemx @var{file}.for 852@itemx @var{file}.FOR 853Fixed form Fortran source code which should not be preprocessed. 854 855@item @var{file}.F 856@itemx @var{file}.fpp 857@itemx @var{file}.FPP 858Fixed form Fortran source code which must be preprocessed (with the traditional 859preprocessor). 860 861@item @var{file}.f90 862@itemx @var{file}.f95 863Free form Fortran source code which should not be preprocessed. 864 865@item @var{file}.F90 866@itemx @var{file}.F95 867Free form Fortran source code which must be preprocessed (with the 868traditional preprocessor). 869 870@c FIXME: Descriptions of Java file types. 871@c @var{file}.java 872@c @var{file}.class 873@c @var{file}.zip 874@c @var{file}.jar 875 876@item @var{file}.ads 877Ada source code file which contains a library unit declaration (a 878declaration of a package, subprogram, or generic, or a generic 879instantiation), or a library unit renaming declaration (a package, 880generic, or subprogram renaming declaration). Such files are also 881called @dfn{specs}. 882 883@itemx @var{file}.adb 884Ada source code file containing a library unit body (a subprogram or 885package body). Such files are also called @dfn{bodies}. 886 887@c GCC also knows about some suffixes for languages not yet included: 888@c Pascal: 889@c @var{file}.p 890@c @var{file}.pas 891@c Ratfor: 892@c @var{file}.r 893 894@item @var{file}.s 895Assembler code. 896 897@item @var{file}.S 898Assembler code which must be preprocessed. 899 900@item @var{other} 901An object file to be fed straight into linking. 902Any file name with no recognized suffix is treated this way. 903@end table 904 905@opindex x 906You can specify the input language explicitly with the @option{-x} option: 907 908@table @gcctabopt 909@item -x @var{language} 910Specify explicitly the @var{language} for the following input files 911(rather than letting the compiler choose a default based on the file 912name suffix). This option applies to all following input files until 913the next @option{-x} option. Possible values for @var{language} are: 914@smallexample 915c c-header c-cpp-output 916c++ c++-header c++-cpp-output 917assembler assembler-with-cpp 918ada 919f95 f95-cpp-input 920java 921treelang 922@end smallexample 923 924@item -x none 925Turn off any specification of a language, so that subsequent files are 926handled according to their file name suffixes (as they are if @option{-x} 927has not been used at all). 928 929@item -pass-exit-codes 930@opindex pass-exit-codes 931Normally the @command{gcc} program will exit with the code of 1 if any 932phase of the compiler returns a non-success return code. If you specify 933@option{-pass-exit-codes}, the @command{gcc} program will instead return with 934numerically highest error produced by any phase that returned an error 935indication. The C, C++, and Fortran frontends return 4, if an internal 936compiler error is encountered. 937@end table 938 939If you only want some of the stages of compilation, you can use 940@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 941one of the options @option{-c}, @option{-S}, or @option{-E} to say where 942@command{gcc} is to stop. Note that some combinations (for example, 943@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 944 945@table @gcctabopt 946@item -c 947@opindex c 948Compile or assemble the source files, but do not link. The linking 949stage simply is not done. The ultimate output is in the form of an 950object file for each source file. 951 952By default, the object file name for a source file is made by replacing 953the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 954 955Unrecognized input files, not requiring compilation or assembly, are 956ignored. 957 958@item -S 959@opindex S 960Stop after the stage of compilation proper; do not assemble. The output 961is in the form of an assembler code file for each non-assembler input 962file specified. 963 964By default, the assembler file name for a source file is made by 965replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 966 967Input files that don't require compilation are ignored. 968 969@item -E 970@opindex E 971Stop after the preprocessing stage; do not run the compiler proper. The 972output is in the form of preprocessed source code, which is sent to the 973standard output. 974 975Input files which don't require preprocessing are ignored. 976 977@cindex output file option 978@item -o @var{file} 979@opindex o 980Place output in file @var{file}. This applies regardless to whatever 981sort of output is being produced, whether it be an executable file, 982an object file, an assembler file or preprocessed C code. 983 984If @option{-o} is not specified, the default is to put an executable 985file in @file{a.out}, the object file for 986@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 987assembler file in @file{@var{source}.s}, a precompiled header file in 988@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 989standard output. 990 991@item -v 992@opindex v 993Print (on standard error output) the commands executed to run the stages 994of compilation. Also print the version number of the compiler driver 995program and of the preprocessor and the compiler proper. 996 997@item -### 998@opindex ### 999Like @option{-v} except the commands are not executed and all command 1000arguments are quoted. This is useful for shell scripts to capture the 1001driver-generated command lines. 1002 1003@item -pipe 1004@opindex pipe 1005Use pipes rather than temporary files for communication between the 1006various stages of compilation. This fails to work on some systems where 1007the assembler is unable to read from a pipe; but the GNU assembler has 1008no trouble. 1009 1010@item -combine 1011@opindex combine 1012If you are compiling multiple source files, this option tells the driver 1013to pass all the source files to the compiler at once (for those 1014languages for which the compiler can handle this). This will allow 1015intermodule analysis (IMA) to be performed by the compiler. Currently the only 1016language for which this is supported is C@. If you pass source files for 1017multiple languages to the driver, using this option, the driver will invoke 1018the compiler(s) that support IMA once each, passing each compiler all the 1019source files appropriate for it. For those languages that do not support 1020IMA this option will be ignored, and the compiler will be invoked once for 1021each source file in that language. If you use this option in conjunction 1022with @option{-save-temps}, the compiler will generate multiple 1023pre-processed files 1024(one for each source file), but only one (combined) @file{.o} or 1025@file{.s} file. 1026 1027@item --help 1028@opindex help 1029Print (on the standard output) a description of the command line options 1030understood by @command{gcc}. If the @option{-v} option is also specified 1031then @option{--help} will also be passed on to the various processes 1032invoked by @command{gcc}, so that they can display the command line options 1033they accept. If the @option{-Wextra} option is also specified then command 1034line options which have no documentation associated with them will also 1035be displayed. 1036 1037@item --target-help 1038@opindex target-help 1039Print (on the standard output) a description of target specific command 1040line options for each tool. 1041 1042@item --version 1043@opindex version 1044Display the version number and copyrights of the invoked GCC@. 1045 1046@include @value{srcdir}/../libiberty/at-file.texi 1047@end table 1048 1049@node Invoking G++ 1050@section Compiling C++ Programs 1051 1052@cindex suffixes for C++ source 1053@cindex C++ source file suffixes 1054C++ source files conventionally use one of the suffixes @samp{.C}, 1055@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 1056@samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and 1057preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 1058files with these names and compiles them as C++ programs even if you 1059call the compiler the same way as for compiling C programs (usually 1060with the name @command{gcc}). 1061 1062@findex g++ 1063@findex c++ 1064However, the use of @command{gcc} does not add the C++ library. 1065@command{g++} is a program that calls GCC and treats @samp{.c}, 1066@samp{.h} and @samp{.i} files as C++ source files instead of C source 1067files unless @option{-x} is used, and automatically specifies linking 1068against the C++ library. This program is also useful when 1069precompiling a C header file with a @samp{.h} extension for use in C++ 1070compilations. On many systems, @command{g++} is also installed with 1071the name @command{c++}. 1072 1073@cindex invoking @command{g++} 1074When you compile C++ programs, you may specify many of the same 1075command-line options that you use for compiling programs in any 1076language; or command-line options meaningful for C and related 1077languages; or options that are meaningful only for C++ programs. 1078@xref{C Dialect Options,,Options Controlling C Dialect}, for 1079explanations of options for languages related to C@. 1080@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 1081explanations of options that are meaningful only for C++ programs. 1082 1083@node C Dialect Options 1084@section Options Controlling C Dialect 1085@cindex dialect options 1086@cindex language dialect options 1087@cindex options, dialect 1088 1089The following options control the dialect of C (or languages derived 1090from C, such as C++) that the compiler accepts: 1091 1092@table @gcctabopt 1093@cindex ANSI support 1094@cindex ISO support 1095@item -ansi 1096@opindex ansi 1097In C mode, support all ISO C90 programs. In C++ mode, 1098remove GNU extensions that conflict with ISO C++. 1099 1100This turns off certain features of GCC that are incompatible with ISO 1101C90 (when compiling C code), or of standard C++ (when compiling C++ code), 1102such as the @code{asm} and @code{typeof} keywords, and 1103predefined macros such as @code{unix} and @code{vax} that identify the 1104type of system you are using. It also enables the undesirable and 1105rarely used ISO trigraph feature. For the C compiler, 1106it disables recognition of C++ style @samp{//} comments as well as 1107the @code{inline} keyword. 1108 1109The alternate keywords @code{__asm__}, @code{__extension__}, 1110@code{__inline__} and @code{__typeof__} continue to work despite 1111@option{-ansi}. You would not want to use them in an ISO C program, of 1112course, but it is useful to put them in header files that might be included 1113in compilations done with @option{-ansi}. Alternate predefined macros 1114such as @code{__unix__} and @code{__vax__} are also available, with or 1115without @option{-ansi}. 1116 1117The @option{-ansi} option does not cause non-ISO programs to be 1118rejected gratuitously. For that, @option{-pedantic} is required in 1119addition to @option{-ansi}. @xref{Warning Options}. 1120 1121The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 1122option is used. Some header files may notice this macro and refrain 1123from declaring certain functions or defining certain macros that the 1124ISO standard doesn't call for; this is to avoid interfering with any 1125programs that might use these names for other things. 1126 1127Functions which would normally be built in but do not have semantics 1128defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 1129functions with @option{-ansi} is used. @xref{Other Builtins,,Other 1130built-in functions provided by GCC}, for details of the functions 1131affected. 1132 1133@item -std= 1134@opindex std 1135Determine the language standard. This option is currently only 1136supported when compiling C or C++. A value for this option must be 1137provided; possible values are 1138 1139@table @samp 1140@item c89 1141@itemx iso9899:1990 1142ISO C90 (same as @option{-ansi}). 1143 1144@item iso9899:199409 1145ISO C90 as modified in amendment 1. 1146 1147@item c99 1148@itemx c9x 1149@itemx iso9899:1999 1150@itemx iso9899:199x 1151ISO C99. Note that this standard is not yet fully supported; see 1152@w{@uref{http://gcc.gnu.org/gcc-4.2/c99status.html}} for more information. The 1153names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1154 1155@item gnu89 1156Default, ISO C90 plus GNU extensions (including some C99 features). 1157 1158@item gnu99 1159@itemx gnu9x 1160ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, 1161this will become the default. The name @samp{gnu9x} is deprecated. 1162 1163@item c++98 1164The 1998 ISO C++ standard plus amendments. 1165 1166@item gnu++98 1167The same as @option{-std=c++98} plus GNU extensions. This is the 1168default for C++ code. 1169@end table 1170 1171Even when this option is not specified, you can still use some of the 1172features of newer standards in so far as they do not conflict with 1173previous C standards. For example, you may use @code{__restrict__} even 1174when @option{-std=c99} is not specified. 1175 1176The @option{-std} options specifying some version of ISO C have the same 1177effects as @option{-ansi}, except that features that were not in ISO C90 1178but are in the specified version (for example, @samp{//} comments and 1179the @code{inline} keyword in ISO C99) are not disabled. 1180 1181@xref{Standards,,Language Standards Supported by GCC}, for details of 1182these standard versions. 1183 1184@item -fgnu89-inline 1185@opindex fgnu89-inline 1186The option @option{-fgnu89-inline} tells GCC to use the traditional 1187GNU semantics for @code{inline} functions when in C99 mode. 1188@xref{Inline,,An Inline Function is As Fast As a Macro}. Using this 1189option is roughly equivalent to adding the @code{gnu_inline} function 1190attribute to all inline functions (@pxref{Function Attributes}). 1191 1192This option is accepted by GCC versions 4.1.3 and up. In GCC versions 1193prior to 4.3, C99 inline semantics are not supported, and thus this 1194option is effectively assumed to be present regardless of whether or not 1195it is specified; the only effect of specifying it explicitly is to 1196disable warnings about using inline functions in C99 mode. Likewise, 1197the option @option{-fno-gnu89-inline} is not supported in versions of 1198GCC before 4.3. It will be supported only in C99 or gnu99 mode, not in 1199C89 or gnu89 mode. 1200 1201The preprocesor macros @code{__GNUC_GNU_INLINE__} and 1202@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 1203in effect for @code{inline} functions. @xref{Common Predefined 1204Macros,,,cpp,The C Preprocessor}. 1205 1206@item -aux-info @var{filename} 1207@opindex aux-info 1208Output to the given filename prototyped declarations for all functions 1209declared and/or defined in a translation unit, including those in header 1210files. This option is silently ignored in any language other than C@. 1211 1212Besides declarations, the file indicates, in comments, the origin of 1213each declaration (source file and line), whether the declaration was 1214implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 1215@samp{O} for old, respectively, in the first character after the line 1216number and the colon), and whether it came from a declaration or a 1217definition (@samp{C} or @samp{F}, respectively, in the following 1218character). In the case of function definitions, a K&R-style list of 1219arguments followed by their declarations is also provided, inside 1220comments, after the declaration. 1221 1222@item -fno-asm 1223@opindex fno-asm 1224Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 1225keyword, so that code can use these words as identifiers. You can use 1226the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 1227instead. @option{-ansi} implies @option{-fno-asm}. 1228 1229In C++, this switch only affects the @code{typeof} keyword, since 1230@code{asm} and @code{inline} are standard keywords. You may want to 1231use the @option{-fno-gnu-keywords} flag instead, which has the same 1232effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 1233switch only affects the @code{asm} and @code{typeof} keywords, since 1234@code{inline} is a standard keyword in ISO C99. 1235 1236@c APPLE LOCAL begin blocks 7205047 5811887 1237@item -fno-blocks 1238@opindex fno-blocks 1239Disable the use of blocks. In @option{-std=c99} mode, blocks are 1240turned off by default. @option{-fblocks} can be used to re-enable the 1241feature, if off. Runtime support for blocks first appeared in Mac OS 1242X 10.6. When targeting 10.6 (see @option{-mmacosx-version-min}) and 1243later, the extension is on by default. 1244@c APPLE LOCAL end blocks 7205047 5811887 1245 1246@item -fno-builtin 1247@itemx -fno-builtin-@var{function} 1248@opindex fno-builtin 1249@cindex built-in functions 1250Don't recognize built-in functions that do not begin with 1251@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 1252functions provided by GCC}, for details of the functions affected, 1253including those which are not built-in functions when @option{-ansi} or 1254@option{-std} options for strict ISO C conformance are used because they 1255do not have an ISO standard meaning. 1256 1257GCC normally generates special code to handle certain built-in functions 1258more efficiently; for instance, calls to @code{alloca} may become single 1259instructions that adjust the stack directly, and calls to @code{memcpy} 1260may become inline copy loops. The resulting code is often both smaller 1261and faster, but since the function calls no longer appear as such, you 1262cannot set a breakpoint on those calls, nor can you change the behavior 1263of the functions by linking with a different library. In addition, 1264when a function is recognized as a built-in function, GCC may use 1265information about that function to warn about problems with calls to 1266that function, or to generate more efficient code, even if the 1267resulting code still contains calls to that function. For example, 1268warnings are given with @option{-Wformat} for bad calls to 1269@code{printf}, when @code{printf} is built in, and @code{strlen} is 1270known not to modify global memory. 1271 1272With the @option{-fno-builtin-@var{function}} option 1273only the built-in function @var{function} is 1274disabled. @var{function} must not begin with @samp{__builtin_}. If a 1275function is named this is not built-in in this version of GCC, this 1276option is ignored. There is no corresponding 1277@option{-fbuiltin-@var{function}} option; if you wish to enable 1278built-in functions selectively when using @option{-fno-builtin} or 1279@option{-ffreestanding}, you may define macros such as: 1280 1281@smallexample 1282#define abs(n) __builtin_abs ((n)) 1283#define strcpy(d, s) __builtin_strcpy ((d), (s)) 1284@end smallexample 1285 1286@item -fhosted 1287@opindex fhosted 1288@cindex hosted environment 1289 1290Assert that compilation takes place in a hosted environment. This implies 1291@option{-fbuiltin}. A hosted environment is one in which the 1292entire standard library is available, and in which @code{main} has a return 1293type of @code{int}. Examples are nearly everything except a kernel. 1294This is equivalent to @option{-fno-freestanding}. 1295 1296@item -ffreestanding 1297@opindex ffreestanding 1298@cindex hosted environment 1299 1300Assert that compilation takes place in a freestanding environment. This 1301implies @option{-fno-builtin}. A freestanding environment 1302is one in which the standard library may not exist, and program startup may 1303not necessarily be at @code{main}. The most obvious example is an OS kernel. 1304This is equivalent to @option{-fno-hosted}. 1305 1306@xref{Standards,,Language Standards Supported by GCC}, for details of 1307freestanding and hosted environments. 1308 1309@item -fopenmp 1310@opindex fopenmp 1311@cindex openmp parallel 1312Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and 1313@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 1314compiler generates parallel code according to the OpenMP Application 1315Program Interface v2.5 @w{@uref{http://www.openmp.org/}}. 1316 1317@item -fms-extensions 1318@opindex fms-extensions 1319Accept some non-standard constructs used in Microsoft header files. 1320 1321Some cases of unnamed fields in structures and unions are only 1322accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 1323fields within structs/unions}, for details. 1324 1325@item -trigraphs 1326@opindex trigraphs 1327Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} 1328options for strict ISO C conformance) implies @option{-trigraphs}. 1329 1330@item -no-integrated-cpp 1331@opindex no-integrated-cpp 1332Performs a compilation in two passes: preprocessing and compiling. This 1333option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the 1334@option{-B} option. The user supplied compilation step can then add in 1335an additional preprocessing step after normal preprocessing but before 1336compiling. The default is to use the integrated cpp (internal cpp) 1337 1338The semantics of this option will change if "cc1", "cc1plus", and 1339"cc1obj" are merged. 1340 1341@cindex traditional C language 1342@cindex C language, traditional 1343@item -traditional 1344@itemx -traditional-cpp 1345@opindex traditional-cpp 1346@opindex traditional 1347Formerly, these options caused GCC to attempt to emulate a pre-standard 1348C compiler. They are now only supported with the @option{-E} switch. 1349The preprocessor continues to support a pre-standard mode. See the GNU 1350CPP manual for details. 1351 1352@c APPLE LOCAL begin nested functions 4357979 1353@item -fno-nested-functions 1354@opindex fno-nested-functions 1355Disable nested functions. This option is not supported for C++ or 1356Objective-C++. On FreeBSD, nested functions are disabled by default. 1357@c APPLE LOCAL end nested functions 4357979 1358 1359@item -fcond-mismatch 1360@opindex fcond-mismatch 1361Allow conditional expressions with mismatched types in the second and 1362third arguments. The value of such an expression is void. This option 1363is not supported for C++. 1364 1365@item -flax-vector-conversions 1366@opindex flax-vector-conversions 1367Allow implicit conversions between vectors with differing numbers of 1368elements and/or incompatible element types. This option should not be 1369used for new code. 1370 1371@item -funsigned-char 1372@opindex funsigned-char 1373Let the type @code{char} be unsigned, like @code{unsigned char}. 1374 1375Each kind of machine has a default for what @code{char} should 1376be. It is either like @code{unsigned char} by default or like 1377@code{signed char} by default. 1378 1379Ideally, a portable program should always use @code{signed char} or 1380@code{unsigned char} when it depends on the signedness of an object. 1381But many programs have been written to use plain @code{char} and 1382expect it to be signed, or expect it to be unsigned, depending on the 1383machines they were written for. This option, and its inverse, let you 1384make such a program work with the opposite default. 1385 1386The type @code{char} is always a distinct type from each of 1387@code{signed char} or @code{unsigned char}, even though its behavior 1388is always just like one of those two. 1389 1390@item -fsigned-char 1391@opindex fsigned-char 1392Let the type @code{char} be signed, like @code{signed char}. 1393 1394Note that this is equivalent to @option{-fno-unsigned-char}, which is 1395the negative form of @option{-funsigned-char}. Likewise, the option 1396@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 1397 1398@item -fsigned-bitfields 1399@itemx -funsigned-bitfields 1400@itemx -fno-signed-bitfields 1401@itemx -fno-unsigned-bitfields 1402@opindex fsigned-bitfields 1403@opindex funsigned-bitfields 1404@opindex fno-signed-bitfields 1405@opindex fno-unsigned-bitfields 1406These options control whether a bit-field is signed or unsigned, when the 1407declaration does not use either @code{signed} or @code{unsigned}. By 1408default, such a bit-field is signed, because this is consistent: the 1409basic integer types such as @code{int} are signed types. 1410@end table 1411 1412@node C++ Dialect Options 1413@section Options Controlling C++ Dialect 1414 1415@cindex compiler options, C++ 1416@cindex C++ options, command line 1417@cindex options, C++ 1418This section describes the command-line options that are only meaningful 1419for C++ programs; but you can also use most of the GNU compiler options 1420regardless of what language your program is in. For example, you 1421might compile a file @code{firstClass.C} like this: 1422 1423@smallexample 1424g++ -g -frepo -O -c firstClass.C 1425@end smallexample 1426 1427@noindent 1428In this example, only @option{-frepo} is an option meant 1429only for C++ programs; you can use the other options with any 1430language supported by GCC@. 1431 1432Here is a list of options that are @emph{only} for compiling C++ programs: 1433 1434@table @gcctabopt 1435 1436@item -fabi-version=@var{n} 1437@opindex fabi-version 1438Use version @var{n} of the C++ ABI@. Version 2 is the version of the 1439C++ ABI that first appeared in G++ 3.4. Version 1 is the version of 1440the C++ ABI that first appeared in G++ 3.2. Version 0 will always be 1441the version that conforms most closely to the C++ ABI specification. 1442Therefore, the ABI obtained using version 0 will change as ABI bugs 1443are fixed. 1444 1445The default is version 2. 1446 1447@item -fno-access-control 1448@opindex fno-access-control 1449Turn off all access checking. This switch is mainly useful for working 1450around bugs in the access control code. 1451 1452@item -fcheck-new 1453@opindex fcheck-new 1454Check that the pointer returned by @code{operator new} is non-null 1455before attempting to modify the storage allocated. This check is 1456normally unnecessary because the C++ standard specifies that 1457@code{operator new} will only return @code{0} if it is declared 1458@samp{throw()}, in which case the compiler will always check the 1459return value even without this option. In all other cases, when 1460@code{operator new} has a non-empty exception specification, memory 1461exhaustion is signalled by throwing @code{std::bad_alloc}. See also 1462@samp{new (nothrow)}. 1463 1464@item -fconserve-space 1465@opindex fconserve-space 1466Put uninitialized or runtime-initialized global variables into the 1467common segment, as C does. This saves space in the executable at the 1468cost of not diagnosing duplicate definitions. If you compile with this 1469flag and your program mysteriously crashes after @code{main()} has 1470completed, you may have an object that is being destroyed twice because 1471two definitions were merged. 1472 1473This option is no longer useful on most targets, now that support has 1474been added for putting variables into BSS without making them common. 1475 1476@item -ffriend-injection 1477@opindex ffriend-injection 1478Inject friend functions into the enclosing namespace, so that they are 1479visible outside the scope of the class in which they are declared. 1480Friend functions were documented to work this way in the old Annotated 1481C++ Reference Manual, and versions of G++ before 4.1 always worked 1482that way. However, in ISO C++ a friend function which is not declared 1483in an enclosing scope can only be found using argument dependent 1484lookup. This option causes friends to be injected as they were in 1485earlier releases. 1486 1487This option is for compatibility, and may be removed in a future 1488release of G++. 1489 1490@item -fno-elide-constructors 1491@opindex fno-elide-constructors 1492The C++ standard allows an implementation to omit creating a temporary 1493which is only used to initialize another object of the same type. 1494Specifying this option disables that optimization, and forces G++ to 1495call the copy constructor in all cases. 1496 1497@item -fno-enforce-eh-specs 1498@opindex fno-enforce-eh-specs 1499Don't generate code to check for violation of exception specifications 1500at runtime. This option violates the C++ standard, but may be useful 1501for reducing code size in production builds, much like defining 1502@samp{NDEBUG}. This does not give user code permission to throw 1503exceptions in violation of the exception specifications; the compiler 1504will still optimize based on the specifications, so throwing an 1505unexpected exception will result in undefined behavior. 1506 1507@item -ffor-scope 1508@itemx -fno-for-scope 1509@opindex ffor-scope 1510@opindex fno-for-scope 1511If @option{-ffor-scope} is specified, the scope of variables declared in 1512a @i{for-init-statement} is limited to the @samp{for} loop itself, 1513as specified by the C++ standard. 1514If @option{-fno-for-scope} is specified, the scope of variables declared in 1515a @i{for-init-statement} extends to the end of the enclosing scope, 1516as was the case in old versions of G++, and other (traditional) 1517implementations of C++. 1518 1519The default if neither flag is given to follow the standard, 1520but to allow and give a warning for old-style code that would 1521otherwise be invalid, or have different behavior. 1522 1523@item -fno-gnu-keywords 1524@opindex fno-gnu-keywords 1525Do not recognize @code{typeof} as a keyword, so that code can use this 1526word as an identifier. You can use the keyword @code{__typeof__} instead. 1527@option{-ansi} implies @option{-fno-gnu-keywords}. 1528 1529@item -fno-implicit-templates 1530@opindex fno-implicit-templates 1531Never emit code for non-inline templates which are instantiated 1532implicitly (i.e.@: by use); only emit code for explicit instantiations. 1533@xref{Template Instantiation}, for more information. 1534 1535@item -fno-implicit-inline-templates 1536@opindex fno-implicit-inline-templates 1537Don't emit code for implicit instantiations of inline templates, either. 1538The default is to handle inlines differently so that compiles with and 1539without optimization will need the same set of explicit instantiations. 1540 1541@item -fno-implement-inlines 1542@opindex fno-implement-inlines 1543To save space, do not emit out-of-line copies of inline functions 1544controlled by @samp{#pragma implementation}. This will cause linker 1545errors if these functions are not inlined everywhere they are called. 1546 1547@item -fms-extensions 1548@opindex fms-extensions 1549Disable pedantic warnings about constructs used in MFC, such as implicit 1550int and getting a pointer to member function via non-standard syntax. 1551 1552@item -fno-nonansi-builtins 1553@opindex fno-nonansi-builtins 1554Disable built-in declarations of functions that are not mandated by 1555ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 1556@code{index}, @code{bzero}, @code{conjf}, and other related functions. 1557 1558@item -fno-operator-names 1559@opindex fno-operator-names 1560Do not treat the operator name keywords @code{and}, @code{bitand}, 1561@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 1562synonyms as keywords. 1563 1564@item -fno-optional-diags 1565@opindex fno-optional-diags 1566Disable diagnostics that the standard says a compiler does not need to 1567issue. Currently, the only such diagnostic issued by G++ is the one for 1568a name having multiple meanings within a class. 1569 1570@item -fpermissive 1571@opindex fpermissive 1572Downgrade some diagnostics about nonconformant code from errors to 1573warnings. Thus, using @option{-fpermissive} will allow some 1574nonconforming code to compile. 1575 1576@item -frepo 1577@opindex frepo 1578Enable automatic template instantiation at link time. This option also 1579implies @option{-fno-implicit-templates}. @xref{Template 1580Instantiation}, for more information. 1581 1582@item -fno-rtti 1583@opindex fno-rtti 1584Disable generation of information about every class with virtual 1585functions for use by the C++ runtime type identification features 1586(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts 1587of the language, you can save some space by using this flag. Note that 1588exception handling uses the same information, but it will generate it as 1589needed. The @samp{dynamic_cast} operator can still be used for casts that 1590do not require runtime type information, i.e. casts to @code{void *} or to 1591unambiguous base classes. 1592 1593@item -fstats 1594@opindex fstats 1595Emit statistics about front-end processing at the end of the compilation. 1596This information is generally only useful to the G++ development team. 1597 1598@item -ftemplate-depth-@var{n} 1599@opindex ftemplate-depth 1600Set the maximum instantiation depth for template classes to @var{n}. 1601A limit on the template instantiation depth is needed to detect 1602endless recursions during template class instantiation. ANSI/ISO C++ 1603conforming programs must not rely on a maximum depth greater than 17. 1604 1605@item -fno-threadsafe-statics 1606@opindex fno-threadsafe-statics 1607Do not emit the extra code to use the routines specified in the C++ 1608ABI for thread-safe initialization of local statics. You can use this 1609option to reduce code size slightly in code that doesn't need to be 1610thread-safe. 1611 1612@item -fuse-cxa-atexit 1613@opindex fuse-cxa-atexit 1614Register destructors for objects with static storage duration with the 1615@code{__cxa_atexit} function rather than the @code{atexit} function. 1616This option is required for fully standards-compliant handling of static 1617destructors, but will only work if your C library supports 1618@code{__cxa_atexit}. 1619 1620@item -fno-use-cxa-get-exception-ptr 1621@opindex fno-use-cxa-get-exception-ptr 1622Don't use the @code{__cxa_get_exception_ptr} runtime routine. This 1623will cause @code{std::uncaught_exception} to be incorrect, but is necessary 1624if the runtime routine is not available. 1625 1626@item -fvisibility-inlines-hidden 1627@opindex fvisibility-inlines-hidden 1628This switch declares that the user does not attempt to compare 1629pointers to inline methods where the addresses of the two functions 1630were taken in different shared objects. 1631 1632The effect of this is that GCC may, effectively, mark inline methods with 1633@code{__attribute__ ((visibility ("hidden")))} so that they do not 1634appear in the export table of a DSO and do not require a PLT indirection 1635when used within the DSO@. Enabling this option can have a dramatic effect 1636on load and link times of a DSO as it massively reduces the size of the 1637dynamic export table when the library makes heavy use of templates. 1638 1639The behaviour of this switch is not quite the same as marking the 1640methods as hidden directly, because it does not affect static variables 1641local to the function or cause the compiler to deduce that 1642the function is defined in only one shared object. 1643 1644You may mark a method as having a visibility explicitly to negate the 1645effect of the switch for that method. For example, if you do want to 1646compare pointers to a particular inline method, you might mark it as 1647having default visibility. Marking the enclosing class with explicit 1648visibility will have no effect. 1649 1650Explicitly instantiated inline methods are unaffected by this option 1651as their linkage might otherwise cross a shared library boundary. 1652@xref{Template Instantiation}. 1653 1654@item -fvisibility-ms-compat 1655@opindex fvisibility-ms-compat 1656This flag attempts to use visibility settings to make GCC's C++ 1657linkage model compatible with that of Microsoft Visual Studio. 1658 1659The flag makes these changes to GCC's linkage model: 1660 1661@enumerate 1662@item 1663It sets the default visibility to @code{hidden}, like 1664@option{-fvisibility=hidden}. 1665 1666@item 1667Types, but not their members, are not hidden by default. 1668 1669@item 1670The One Definition Rule is relaxed for types without explicit 1671visibility specifications which are defined in more than one different 1672shared object: those declarations are permitted if they would have 1673been permitted when this option was not used. 1674@end enumerate 1675 1676In new code it is better to use @option{-fvisibility=hidden} and 1677export those classes which are intended to be externally visible. 1678Unfortunately it is possible for code to rely, perhaps accidentally, 1679on the Visual Studio behaviour. 1680 1681Among the consequences of these changes are that static data members 1682of the same type with the same name but defined in different shared 1683objects will be different, so changing one will not change the other; 1684and that pointers to function members defined in different shared 1685objects may not compare equal. When this flag is given, it is a 1686violation of the ODR to define types with the same name differently. 1687 1688@item -fno-weak 1689@opindex fno-weak 1690Do not use weak symbol support, even if it is provided by the linker. 1691By default, G++ will use weak symbols if they are available. This 1692option exists only for testing, and should not be used by end-users; 1693it will result in inferior code and has no benefits. This option may 1694be removed in a future release of G++. 1695 1696@item -nostdinc++ 1697@opindex nostdinc++ 1698Do not search for header files in the standard directories specific to 1699C++, but do still search the other standard directories. (This option 1700is used when building the C++ library.) 1701@end table 1702 1703In addition, these optimization, warning, and code generation options 1704have meanings only for C++ programs: 1705 1706@table @gcctabopt 1707@item -fno-default-inline 1708@opindex fno-default-inline 1709Do not assume @samp{inline} for functions defined inside a class scope. 1710@xref{Optimize Options,,Options That Control Optimization}. Note that these 1711functions will have linkage like inline functions; they just won't be 1712inlined by default. 1713 1714@item -Wabi @r{(C++ only)} 1715@opindex Wabi 1716Warn when G++ generates code that is probably not compatible with the 1717vendor-neutral C++ ABI@. Although an effort has been made to warn about 1718all such cases, there are probably some cases that are not warned about, 1719even though G++ is generating incompatible code. There may also be 1720cases where warnings are emitted even though the code that is generated 1721will be compatible. 1722 1723You should rewrite your code to avoid these warnings if you are 1724concerned about the fact that code generated by G++ may not be binary 1725compatible with code generated by other compilers. 1726 1727The known incompatibilities at this point include: 1728 1729@itemize @bullet 1730 1731@item 1732Incorrect handling of tail-padding for bit-fields. G++ may attempt to 1733pack data into the same byte as a base class. For example: 1734 1735@smallexample 1736struct A @{ virtual void f(); int f1 : 1; @}; 1737struct B : public A @{ int f2 : 1; @}; 1738@end smallexample 1739 1740@noindent 1741In this case, G++ will place @code{B::f2} into the same byte 1742as@code{A::f1}; other compilers will not. You can avoid this problem 1743by explicitly padding @code{A} so that its size is a multiple of the 1744byte size on your platform; that will cause G++ and other compilers to 1745layout @code{B} identically. 1746 1747@item 1748Incorrect handling of tail-padding for virtual bases. G++ does not use 1749tail padding when laying out virtual bases. For example: 1750 1751@smallexample 1752struct A @{ virtual void f(); char c1; @}; 1753struct B @{ B(); char c2; @}; 1754struct C : public A, public virtual B @{@}; 1755@end smallexample 1756 1757@noindent 1758In this case, G++ will not place @code{B} into the tail-padding for 1759@code{A}; other compilers will. You can avoid this problem by 1760explicitly padding @code{A} so that its size is a multiple of its 1761alignment (ignoring virtual base classes); that will cause G++ and other 1762compilers to layout @code{C} identically. 1763 1764@item 1765Incorrect handling of bit-fields with declared widths greater than that 1766of their underlying types, when the bit-fields appear in a union. For 1767example: 1768 1769@smallexample 1770union U @{ int i : 4096; @}; 1771@end smallexample 1772 1773@noindent 1774Assuming that an @code{int} does not have 4096 bits, G++ will make the 1775union too small by the number of bits in an @code{int}. 1776 1777@item 1778Empty classes can be placed at incorrect offsets. For example: 1779 1780@smallexample 1781struct A @{@}; 1782 1783struct B @{ 1784 A a; 1785 virtual void f (); 1786@}; 1787 1788struct C : public B, public A @{@}; 1789@end smallexample 1790 1791@noindent 1792G++ will place the @code{A} base class of @code{C} at a nonzero offset; 1793it should be placed at offset zero. G++ mistakenly believes that the 1794@code{A} data member of @code{B} is already at offset zero. 1795 1796@item 1797Names of template functions whose types involve @code{typename} or 1798template template parameters can be mangled incorrectly. 1799 1800@smallexample 1801template <typename Q> 1802void f(typename Q::X) @{@} 1803 1804template <template <typename> class Q> 1805void f(typename Q<int>::X) @{@} 1806@end smallexample 1807 1808@noindent 1809Instantiations of these templates may be mangled incorrectly. 1810 1811@end itemize 1812 1813@item -Wctor-dtor-privacy @r{(C++ only)} 1814@opindex Wctor-dtor-privacy 1815Warn when a class seems unusable because all the constructors or 1816destructors in that class are private, and it has neither friends nor 1817public static member functions. 1818 1819@item -Wnon-virtual-dtor @r{(C++ only)} 1820@opindex Wnon-virtual-dtor 1821Warn when a class appears to be polymorphic, thereby requiring a virtual 1822destructor, yet it declares a non-virtual one. This warning is also 1823enabled if -Weffc++ is specified. 1824 1825@item -Wreorder @r{(C++ only)} 1826@opindex Wreorder 1827@cindex reordering, warning 1828@cindex warning for reordering of member initializers 1829Warn when the order of member initializers given in the code does not 1830match the order in which they must be executed. For instance: 1831 1832@smallexample 1833struct A @{ 1834 int i; 1835 int j; 1836 A(): j (0), i (1) @{ @} 1837@}; 1838@end smallexample 1839 1840The compiler will rearrange the member initializers for @samp{i} 1841and @samp{j} to match the declaration order of the members, emitting 1842a warning to that effect. This warning is enabled by @option{-Wall}. 1843@end table 1844 1845The following @option{-W@dots{}} options are not affected by @option{-Wall}. 1846 1847@table @gcctabopt 1848@item -Weffc++ @r{(C++ only)} 1849@opindex Weffc++ 1850Warn about violations of the following style guidelines from Scott Meyers' 1851@cite{Effective C++} book: 1852 1853@itemize @bullet 1854@item 1855Item 11: Define a copy constructor and an assignment operator for classes 1856with dynamically allocated memory. 1857 1858@item 1859Item 12: Prefer initialization to assignment in constructors. 1860 1861@item 1862Item 14: Make destructors virtual in base classes. 1863 1864@item 1865Item 15: Have @code{operator=} return a reference to @code{*this}. 1866 1867@item 1868Item 23: Don't try to return a reference when you must return an object. 1869 1870@end itemize 1871 1872Also warn about violations of the following style guidelines from 1873Scott Meyers' @cite{More Effective C++} book: 1874 1875@itemize @bullet 1876@item 1877Item 6: Distinguish between prefix and postfix forms of increment and 1878decrement operators. 1879 1880@item 1881Item 7: Never overload @code{&&}, @code{||}, or @code{,}. 1882 1883@end itemize 1884 1885When selecting this option, be aware that the standard library 1886headers do not obey all of these guidelines; use @samp{grep -v} 1887to filter out those warnings. 1888 1889@item -Wno-deprecated @r{(C++ only)} 1890@opindex Wno-deprecated 1891Do not warn about usage of deprecated features. @xref{Deprecated Features}. 1892 1893@item -Wstrict-null-sentinel @r{(C++ only)} 1894@opindex Wstrict-null-sentinel 1895Warn also about the use of an uncasted @code{NULL} as sentinel. When 1896compiling only with GCC this is a valid sentinel, as @code{NULL} is defined 1897to @code{__null}. Although it is a null pointer constant not a null pointer, 1898it is guaranteed to of the same size as a pointer. But this use is 1899not portable across different compilers. 1900 1901@item -Wno-non-template-friend @r{(C++ only)} 1902@opindex Wno-non-template-friend 1903Disable warnings when non-templatized friend functions are declared 1904within a template. Since the advent of explicit template specification 1905support in G++, if the name of the friend is an unqualified-id (i.e., 1906@samp{friend foo(int)}), the C++ language specification demands that the 1907friend declare or define an ordinary, nontemplate function. (Section 190814.5.3). Before G++ implemented explicit specification, unqualified-ids 1909could be interpreted as a particular specialization of a templatized 1910function. Because this non-conforming behavior is no longer the default 1911behavior for G++, @option{-Wnon-template-friend} allows the compiler to 1912check existing code for potential trouble spots and is on by default. 1913This new compiler behavior can be turned off with 1914@option{-Wno-non-template-friend} which keeps the conformant compiler code 1915but disables the helpful warning. 1916 1917@item -Wold-style-cast @r{(C++ only)} 1918@opindex Wold-style-cast 1919Warn if an old-style (C-style) cast to a non-void type is used within 1920a C++ program. The new-style casts (@samp{dynamic_cast}, 1921@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are 1922less vulnerable to unintended effects and much easier to search for. 1923 1924@item -Woverloaded-virtual @r{(C++ only)} 1925@opindex Woverloaded-virtual 1926@cindex overloaded virtual fn, warning 1927@cindex warning for overloaded virtual fn 1928Warn when a function declaration hides virtual functions from a 1929base class. For example, in: 1930 1931@smallexample 1932struct A @{ 1933 virtual void f(); 1934@}; 1935 1936struct B: public A @{ 1937 void f(int); 1938@}; 1939@end smallexample 1940 1941the @code{A} class version of @code{f} is hidden in @code{B}, and code 1942like: 1943 1944@smallexample 1945B* b; 1946b->f(); 1947@end smallexample 1948 1949will fail to compile. 1950 1951@item -Wno-pmf-conversions @r{(C++ only)} 1952@opindex Wno-pmf-conversions 1953Disable the diagnostic for converting a bound pointer to member function 1954to a plain pointer. 1955 1956@item -Wsign-promo @r{(C++ only)} 1957@opindex Wsign-promo 1958Warn when overload resolution chooses a promotion from unsigned or 1959enumerated type to a signed type, over a conversion to an unsigned type of 1960the same size. Previous versions of G++ would try to preserve 1961unsignedness, but the standard mandates the current behavior. 1962 1963@smallexample 1964struct A @{ 1965 operator int (); 1966 A& operator = (int); 1967@}; 1968 1969main () 1970@{ 1971 A a,b; 1972 a = b; 1973@} 1974@end smallexample 1975 1976In this example, G++ will synthesize a default @samp{A& operator = 1977(const A&);}, while cfront will use the user-defined @samp{operator =}. 1978@end table 1979 1980@node Language Independent Options 1981@section Options to Control Diagnostic Messages Formatting 1982@cindex options to control diagnostics formatting 1983@cindex diagnostic messages 1984@cindex message formatting 1985 1986Traditionally, diagnostic messages have been formatted irrespective of 1987the output device's aspect (e.g.@: its width, @dots{}). The options described 1988below can be used to control the diagnostic messages formatting 1989algorithm, e.g.@: how many characters per line, how often source location 1990information should be reported. Right now, only the C++ front end can 1991honor these options. However it is expected, in the near future, that 1992the remaining front ends would be able to digest them correctly. 1993 1994@table @gcctabopt 1995@item -fmessage-length=@var{n} 1996@opindex fmessage-length 1997Try to format error messages so that they fit on lines of about @var{n} 1998characters. The default is 72 characters for @command{g++} and 0 for the rest of 1999the front ends supported by GCC@. If @var{n} is zero, then no 2000line-wrapping will be done; each error message will appear on a single 2001line. 2002 2003@opindex fdiagnostics-show-location 2004@item -fdiagnostics-show-location=once 2005Only meaningful in line-wrapping mode. Instructs the diagnostic messages 2006reporter to emit @emph{once} source location information; that is, in 2007case the message is too long to fit on a single physical line and has to 2008be wrapped, the source location won't be emitted (as prefix) again, 2009over and over, in subsequent continuation lines. This is the default 2010behavior. 2011 2012@item -fdiagnostics-show-location=every-line 2013Only meaningful in line-wrapping mode. Instructs the diagnostic 2014messages reporter to emit the same source location information (as 2015prefix) for physical lines that result from the process of breaking 2016a message which is too long to fit on a single line. 2017 2018@item -fdiagnostics-show-option 2019@opindex fdiagnostics-show-option 2020This option instructs the diagnostic machinery to add text to each 2021diagnostic emitted, which indicates which command line option directly 2022controls that diagnostic, when such an option is known to the 2023diagnostic machinery. 2024 2025@end table 2026 2027@node Warning Options 2028@section Options to Request or Suppress Warnings 2029@cindex options to control warnings 2030@cindex warning messages 2031@cindex messages, warning 2032@cindex suppressing warnings 2033 2034Warnings are diagnostic messages that report constructions which 2035are not inherently erroneous but which are risky or suggest there 2036may have been an error. 2037 2038You can request many specific warnings with options beginning @samp{-W}, 2039for example @option{-Wimplicit} to request warnings on implicit 2040declarations. Each of these specific warning options also has a 2041negative form beginning @samp{-Wno-} to turn off warnings; 2042for example, @option{-Wno-implicit}. This manual lists only one of the 2043two forms, whichever is not the default. 2044 2045The following options control the amount and kinds of warnings produced 2046by GCC; for further, language-specific options also refer to 2047@ref{C++ Dialect Options}. 2048 2049@table @gcctabopt 2050@cindex syntax checking 2051@item -fsyntax-only 2052@opindex fsyntax-only 2053Check the code for syntax errors, but don't do anything beyond that. 2054 2055@item -pedantic 2056@opindex pedantic 2057Issue all the warnings demanded by strict ISO C and ISO C++; 2058reject all programs that use forbidden extensions, and some other 2059programs that do not follow ISO C and ISO C++. For ISO C, follows the 2060version of the ISO C standard specified by any @option{-std} option used. 2061 2062Valid ISO C and ISO C++ programs should compile properly with or without 2063this option (though a rare few will require @option{-ansi} or a 2064@option{-std} option specifying the required version of ISO C)@. However, 2065without this option, certain GNU extensions and traditional C and C++ 2066features are supported as well. With this option, they are rejected. 2067 2068@option{-pedantic} does not cause warning messages for use of the 2069alternate keywords whose names begin and end with @samp{__}. Pedantic 2070warnings are also disabled in the expression that follows 2071@code{__extension__}. However, only system header files should use 2072these escape routes; application programs should avoid them. 2073@xref{Alternate Keywords}. 2074 2075Some users try to use @option{-pedantic} to check programs for strict ISO 2076C conformance. They soon find that it does not do quite what they want: 2077it finds some non-ISO practices, but not all---only those for which 2078ISO C @emph{requires} a diagnostic, and some others for which 2079diagnostics have been added. 2080 2081A feature to report any failure to conform to ISO C might be useful in 2082some instances, but would require considerable additional work and would 2083be quite different from @option{-pedantic}. We don't have plans to 2084support such a feature in the near future. 2085 2086Where the standard specified with @option{-std} represents a GNU 2087extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a 2088corresponding @dfn{base standard}, the version of ISO C on which the GNU 2089extended dialect is based. Warnings from @option{-pedantic} are given 2090where they are required by the base standard. (It would not make sense 2091for such warnings to be given only for features not in the specified GNU 2092C dialect, since by definition the GNU dialects of C include all 2093features the compiler supports with the given option, and there would be 2094nothing to warn about.) 2095 2096@item -pedantic-errors 2097@opindex pedantic-errors 2098Like @option{-pedantic}, except that errors are produced rather than 2099warnings. 2100 2101@item -w 2102@opindex w 2103Inhibit all warning messages. 2104 2105@item -Wno-import 2106@opindex Wno-import 2107Inhibit warning messages about the use of @samp{#import}. 2108 2109@c APPLE LOCAL begin -Wnewline-eof 2001-08-23 --sts ** 2110@item -Wnewline-eof 2111@opindex Wnewline-eof 2112Warn about files missing a newline at the end of the file. (Apple compatible) 2113@c APPLE LOCAL end -Wnewline-eof 2001-08-23 --sts ** 2114 2115@item -Wchar-subscripts 2116@opindex Wchar-subscripts 2117Warn if an array subscript has type @code{char}. This is a common cause 2118of error, as programmers often forget that this type is signed on some 2119machines. 2120This warning is enabled by @option{-Wall}. 2121 2122@item -Wcomment 2123@opindex Wcomment 2124Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 2125comment, or whenever a Backslash-Newline appears in a @samp{//} comment. 2126This warning is enabled by @option{-Wall}. 2127 2128@item -Wfatal-errors 2129@opindex Wfatal-errors 2130This option causes the compiler to abort compilation on the first error 2131occurred rather than trying to keep going and printing further error 2132messages. 2133 2134@item -Wformat 2135@opindex Wformat 2136@opindex ffreestanding 2137@opindex fno-builtin 2138Check calls to @code{printf} and @code{scanf}, etc., to make sure that 2139the arguments supplied have types appropriate to the format string 2140specified, and that the conversions specified in the format string make 2141sense. This includes standard functions, and others specified by format 2142attributes (@pxref{Function Attributes}), in the @code{printf}, 2143@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 2144not in the C standard) families (or other target-specific families). 2145Which functions are checked without format attributes having been 2146specified depends on the standard version selected, and such checks of 2147functions without the attribute specified are disabled by 2148@option{-ffreestanding} or @option{-fno-builtin}. 2149 2150The formats are checked against the format features supported by GNU 2151libc version 2.2. These include all ISO C90 and C99 features, as well 2152as features from the Single Unix Specification and some BSD and GNU 2153extensions. Other library implementations may not support all these 2154features; GCC does not support warning about features that go beyond a 2155particular library's limitations. However, if @option{-pedantic} is used 2156with @option{-Wformat}, warnings will be given about format features not 2157in the selected standard version (but not for @code{strfmon} formats, 2158since those are not in any version of the C standard). @xref{C Dialect 2159Options,,Options Controlling C Dialect}. 2160 2161Since @option{-Wformat} also checks for null format arguments for 2162several functions, @option{-Wformat} also implies @option{-Wnonnull}. 2163 2164@option{-Wformat} is included in @option{-Wall}. For more control over some 2165aspects of format checking, the options @option{-Wformat-y2k}, 2166@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length}, 2167@option{-Wformat-nonliteral}, @option{-Wformat-security}, and 2168@option{-Wformat=2} are available, but are not included in @option{-Wall}. 2169 2170@item -Wformat-y2k 2171@opindex Wformat-y2k 2172If @option{-Wformat} is specified, also warn about @code{strftime} 2173formats which may yield only a two-digit year. 2174 2175@item -Wno-format-extra-args 2176@opindex Wno-format-extra-args 2177If @option{-Wformat} is specified, do not warn about excess arguments to a 2178@code{printf} or @code{scanf} format function. The C standard specifies 2179that such arguments are ignored. 2180 2181Where the unused arguments lie between used arguments that are 2182specified with @samp{$} operand number specifications, normally 2183warnings are still given, since the implementation could not know what 2184type to pass to @code{va_arg} to skip the unused arguments. However, 2185in the case of @code{scanf} formats, this option will suppress the 2186warning if the unused arguments are all pointers, since the Single 2187Unix Specification says that such unused arguments are allowed. 2188 2189@item -Wno-format-zero-length 2190@opindex Wno-format-zero-length 2191If @option{-Wformat} is specified, do not warn about zero-length formats. 2192The C standard specifies that zero-length formats are allowed. 2193 2194@item -Wformat-nonliteral 2195@opindex Wformat-nonliteral 2196If @option{-Wformat} is specified, also warn if the format string is not a 2197string literal and so cannot be checked, unless the format function 2198takes its format arguments as a @code{va_list}. 2199 2200@item -Wformat-security 2201@opindex Wformat-security 2202If @option{-Wformat} is specified, also warn about uses of format 2203functions that represent possible security problems. At present, this 2204warns about calls to @code{printf} and @code{scanf} functions where the 2205format string is not a string literal and there are no format arguments, 2206as in @code{printf (foo);}. This may be a security hole if the format 2207string came from untrusted input and contains @samp{%n}. (This is 2208currently a subset of what @option{-Wformat-nonliteral} warns about, but 2209in future warnings may be added to @option{-Wformat-security} that are not 2210included in @option{-Wformat-nonliteral}.) 2211 2212@item -Wformat=2 2213@opindex Wformat=2 2214Enable @option{-Wformat} plus format checks not included in 2215@option{-Wformat}. Currently equivalent to @samp{-Wformat 2216-Wformat-nonliteral -Wformat-security -Wformat-y2k}. 2217 2218@item -Wnonnull 2219@opindex Wnonnull 2220Warn about passing a null pointer for arguments marked as 2221requiring a non-null value by the @code{nonnull} function attribute. 2222 2223@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 2224can be disabled with the @option{-Wno-nonnull} option. 2225 2226@item -Winit-self @r{(C and C++ only)} 2227@opindex Winit-self 2228Warn about uninitialized variables which are initialized with themselves. 2229Note this option can only be used with the @option{-Wuninitialized} option, 2230which in turn only works with @option{-O1} and above. 2231 2232For example, GCC will warn about @code{i} being uninitialized in the 2233following snippet only when @option{-Winit-self} has been specified: 2234@smallexample 2235@group 2236int f() 2237@{ 2238 int i = i; 2239 return i; 2240@} 2241@end group 2242@end smallexample 2243 2244@item -Wimplicit-int 2245@opindex Wimplicit-int 2246Warn when a declaration does not specify a type. 2247This warning is enabled by @option{-Wall}. 2248 2249@item -Wimplicit-function-declaration 2250@itemx -Werror-implicit-function-declaration 2251@opindex Wimplicit-function-declaration 2252@opindex Werror-implicit-function-declaration 2253Give a warning (or error) whenever a function is used before being 2254declared. The form @option{-Wno-error-implicit-function-declaration} 2255is not supported. 2256This warning is enabled by @option{-Wall} (as a warning, not an error). 2257 2258@item -Wimplicit 2259@opindex Wimplicit 2260Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 2261This warning is enabled by @option{-Wall}. 2262 2263@item -Wmain 2264@opindex Wmain 2265Warn if the type of @samp{main} is suspicious. @samp{main} should be a 2266function with external linkage, returning int, taking either zero 2267arguments, two, or three arguments of appropriate types. 2268This warning is enabled by @option{-Wall}. 2269 2270@item -Wmissing-braces 2271@opindex Wmissing-braces 2272Warn if an aggregate or union initializer is not fully bracketed. In 2273the following example, the initializer for @samp{a} is not fully 2274bracketed, but that for @samp{b} is fully bracketed. 2275 2276@smallexample 2277int a[2][2] = @{ 0, 1, 2, 3 @}; 2278int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 2279@end smallexample 2280 2281This warning is enabled by @option{-Wall}. 2282 2283@item -Wmissing-include-dirs @r{(C and C++ only)} 2284@opindex Wmissing-include-dirs 2285Warn if a user-supplied include directory does not exist. 2286 2287@item -Wparentheses 2288@opindex Wparentheses 2289Warn if parentheses are omitted in certain contexts, such 2290as when there is an assignment in a context where a truth value 2291is expected, or when operators are nested whose precedence people 2292often get confused about. 2293 2294Also warn if a comparison like @samp{x<=y<=z} appears; this is 2295equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different 2296interpretation from that of ordinary mathematical notation. 2297 2298Also warn about constructions where there may be confusion to which 2299@code{if} statement an @code{else} branch belongs. Here is an example of 2300such a case: 2301 2302@smallexample 2303@group 2304@{ 2305 if (a) 2306 if (b) 2307 foo (); 2308 else 2309 bar (); 2310@} 2311@end group 2312@end smallexample 2313 2314In C/C++, every @code{else} branch belongs to the innermost possible 2315@code{if} statement, which in this example is @code{if (b)}. This is 2316often not what the programmer expected, as illustrated in the above 2317example by indentation the programmer chose. When there is the 2318potential for this confusion, GCC will issue a warning when this flag 2319is specified. To eliminate the warning, add explicit braces around 2320the innermost @code{if} statement so there is no way the @code{else} 2321could belong to the enclosing @code{if}. The resulting code would 2322look like this: 2323 2324@smallexample 2325@group 2326@{ 2327 if (a) 2328 @{ 2329 if (b) 2330 foo (); 2331 else 2332 bar (); 2333 @} 2334@} 2335@end group 2336@end smallexample 2337 2338This warning is enabled by @option{-Wall}. 2339 2340@item -Wsequence-point 2341@opindex Wsequence-point 2342Warn about code that may have undefined semantics because of violations 2343of sequence point rules in the C and C++ standards. 2344 2345The C and C++ standards defines the order in which expressions in a C/C++ 2346program are evaluated in terms of @dfn{sequence points}, which represent 2347a partial ordering between the execution of parts of the program: those 2348executed before the sequence point, and those executed after it. These 2349occur after the evaluation of a full expression (one which is not part 2350of a larger expression), after the evaluation of the first operand of a 2351@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 2352function is called (but after the evaluation of its arguments and the 2353expression denoting the called function), and in certain other places. 2354Other than as expressed by the sequence point rules, the order of 2355evaluation of subexpressions of an expression is not specified. All 2356these rules describe only a partial order rather than a total order, 2357since, for example, if two functions are called within one expression 2358with no sequence point between them, the order in which the functions 2359are called is not specified. However, the standards committee have 2360ruled that function calls do not overlap. 2361 2362It is not specified when between sequence points modifications to the 2363values of objects take effect. Programs whose behavior depends on this 2364have undefined behavior; the C and C++ standards specify that ``Between 2365the previous and next sequence point an object shall have its stored 2366value modified at most once by the evaluation of an expression. 2367Furthermore, the prior value shall be read only to determine the value 2368to be stored.''. If a program breaks these rules, the results on any 2369particular implementation are entirely unpredictable. 2370 2371Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 2372= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 2373diagnosed by this option, and it may give an occasional false positive 2374result, but in general it has been found fairly effective at detecting 2375this sort of problem in programs. 2376 2377The standard is worded confusingly, therefore there is some debate 2378over the precise meaning of the sequence point rules in subtle cases. 2379Links to discussions of the problem, including proposed formal 2380definitions, may be found on the GCC readings page, at 2381@w{@uref{http://gcc.gnu.org/readings.html}}. 2382 2383This warning is enabled by @option{-Wall} for C and C++. 2384 2385@item -Wreturn-type 2386@opindex Wreturn-type 2387Warn whenever a function is defined with a return-type that defaults to 2388@code{int}. Also warn about any @code{return} statement with no 2389return-value in a function whose return-type is not @code{void}. 2390 2391For C, also warn if the return type of a function has a type qualifier 2392such as @code{const}. Such a type qualifier has no effect, since the 2393value returned by a function is not an lvalue. ISO C prohibits 2394qualified @code{void} return types on function definitions, so such 2395return types always receive a warning even without this option. 2396 2397For C++, a function without return type always produces a diagnostic 2398message, even when @option{-Wno-return-type} is specified. The only 2399exceptions are @samp{main} and functions defined in system headers. 2400 2401This warning is enabled by @option{-Wall}. 2402 2403@item -Wswitch 2404@opindex Wswitch 2405Warn whenever a @code{switch} statement has an index of enumerated type 2406and lacks a @code{case} for one or more of the named codes of that 2407enumeration. (The presence of a @code{default} label prevents this 2408warning.) @code{case} labels outside the enumeration range also 2409provoke warnings when this option is used. 2410This warning is enabled by @option{-Wall}. 2411 2412@item -Wswitch-default 2413@opindex Wswitch-switch 2414Warn whenever a @code{switch} statement does not have a @code{default} 2415case. 2416 2417@item -Wswitch-enum 2418@opindex Wswitch-enum 2419Warn whenever a @code{switch} statement has an index of enumerated type 2420and lacks a @code{case} for one or more of the named codes of that 2421enumeration. @code{case} labels outside the enumeration range also 2422provoke warnings when this option is used. 2423 2424@item -Wtrigraphs 2425@opindex Wtrigraphs 2426Warn if any trigraphs are encountered that might change the meaning of 2427the program (trigraphs within comments are not warned about). 2428This warning is enabled by @option{-Wall}. 2429 2430@item -Wunused-function 2431@opindex Wunused-function 2432Warn whenever a static function is declared but not defined or a 2433non-inline static function is unused. 2434This warning is enabled by @option{-Wall}. 2435 2436@item -Wunused-label 2437@opindex Wunused-label 2438Warn whenever a label is declared but not used. 2439This warning is enabled by @option{-Wall}. 2440 2441To suppress this warning use the @samp{unused} attribute 2442(@pxref{Variable Attributes}). 2443 2444@item -Wunused-parameter 2445@opindex Wunused-parameter 2446Warn whenever a function parameter is unused aside from its declaration. 2447 2448To suppress this warning use the @samp{unused} attribute 2449(@pxref{Variable Attributes}). 2450 2451@item -Wunused-variable 2452@opindex Wunused-variable 2453Warn whenever a local variable or non-constant static variable is unused 2454aside from its declaration. 2455This warning is enabled by @option{-Wall}. 2456 2457To suppress this warning use the @samp{unused} attribute 2458(@pxref{Variable Attributes}). 2459 2460@item -Wunused-value 2461@opindex Wunused-value 2462Warn whenever a statement computes a result that is explicitly not used. 2463This warning is enabled by @option{-Wall}. 2464 2465To suppress this warning cast the expression to @samp{void}. 2466 2467@item -Wunused 2468@opindex Wunused 2469All the above @option{-Wunused} options combined. 2470 2471In order to get a warning about an unused function parameter, you must 2472either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies 2473@samp{-Wunused}), or separately specify @option{-Wunused-parameter}. 2474 2475@item -Wuninitialized 2476@opindex Wuninitialized 2477Warn if an automatic variable is used without first being initialized or 2478if a variable may be clobbered by a @code{setjmp} call. 2479 2480These warnings are possible only in optimizing compilation, 2481because they require data flow information that is computed only 2482when optimizing. If you do not specify @option{-O}, you will not get 2483these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized} 2484requiring @option{-O}. 2485 2486If you want to warn about code which uses the uninitialized value of the 2487variable in its own initializer, use the @option{-Winit-self} option. 2488 2489These warnings occur for individual uninitialized or clobbered 2490elements of structure, union or array variables as well as for 2491variables which are uninitialized or clobbered as a whole. They do 2492not occur for variables or elements declared @code{volatile}. Because 2493these warnings depend on optimization, the exact variables or elements 2494for which there are warnings will depend on the precise optimization 2495options and version of GCC used. 2496 2497Note that there may be no warning about a variable that is used only 2498to compute a value that itself is never used, because such 2499computations may be deleted by data flow analysis before the warnings 2500are printed. 2501 2502These warnings are made optional because GCC is not smart 2503enough to see all the reasons why the code might be correct 2504despite appearing to have an error. Here is one example of how 2505this can happen: 2506 2507@smallexample 2508@group 2509@{ 2510 int x; 2511 switch (y) 2512 @{ 2513 case 1: x = 1; 2514 break; 2515 case 2: x = 4; 2516 break; 2517 case 3: x = 5; 2518 @} 2519 foo (x); 2520@} 2521@end group 2522@end smallexample 2523 2524@noindent 2525If the value of @code{y} is always 1, 2 or 3, then @code{x} is 2526always initialized, but GCC doesn't know this. Here is 2527another common case: 2528 2529@smallexample 2530@{ 2531 int save_y; 2532 if (change_y) save_y = y, y = new_y; 2533 @dots{} 2534 if (change_y) y = save_y; 2535@} 2536@end smallexample 2537 2538@noindent 2539This has no bug because @code{save_y} is used only if it is set. 2540 2541@cindex @code{longjmp} warnings 2542This option also warns when a non-volatile automatic variable might be 2543changed by a call to @code{longjmp}. These warnings as well are possible 2544only in optimizing compilation. 2545 2546The compiler sees only the calls to @code{setjmp}. It cannot know 2547where @code{longjmp} will be called; in fact, a signal handler could 2548call it at any point in the code. As a result, you may get a warning 2549even when there is in fact no problem because @code{longjmp} cannot 2550in fact be called at the place which would cause a problem. 2551 2552Some spurious warnings can be avoided if you declare all the functions 2553you use that never return as @code{noreturn}. @xref{Function 2554Attributes}. 2555 2556This warning is enabled by @option{-Wall}. 2557 2558@item -Wunknown-pragmas 2559@opindex Wunknown-pragmas 2560@cindex warning for unknown pragmas 2561@cindex unknown pragmas, warning 2562@cindex pragmas, warning of unknown 2563Warn when a #pragma directive is encountered which is not understood by 2564GCC@. If this command line option is used, warnings will even be issued 2565for unknown pragmas in system header files. This is not the case if 2566the warnings were only enabled by the @option{-Wall} command line option. 2567 2568@item -Wno-pragmas 2569@opindex Wno-pragmas 2570@opindex Wpragmas 2571Do not warn about misuses of pragmas, such as incorrect parameters, 2572invalid syntax, or conflicts between pragmas. See also 2573@samp{-Wunknown-pragmas}. 2574 2575@item -Wstrict-aliasing 2576@opindex Wstrict-aliasing 2577This option is only active when @option{-fstrict-aliasing} is active. 2578It warns about code which might break the strict aliasing rules that the 2579compiler is using for optimization. The warning does not catch all 2580cases, but does attempt to catch the more common pitfalls. It is 2581included in @option{-Wall}. 2582It is equivalent to -Wstrict-aliasing=3 2583 2584@item -Wstrict-aliasing=n 2585@opindex Wstrict-aliasing=n 2586This option is only active when @option{-fstrict-aliasing} is active. 2587It warns about code which might break the strict aliasing rules that the 2588compiler is using for optimization. 2589Higher levels correspond to higher accuracy (fewer false positives). 2590Higher levels also correspond to more effort, similar to the way -O works. 2591@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n}, 2592with n=3. 2593 2594Level 1: Most aggressive, quick, least accurate. 2595Possibly useful when higher levels 2596do not warn but -fstrict-aliasing still breaks the code, as it has very few 2597false negatives. However, it has many false positives. 2598Warns for all pointer conversions between possibly incompatible types, 2599even if never dereferenced. Runs in the frontend only. 2600 2601Level 2: Aggressive, quick, not too precise. 2602May still have many false positives (not as many as level 1 though), 2603and few false negatives (but possibly more than level 1). 2604Unlike level 1, it only warns when an address is taken. Warns about 2605incomplete types. Runs in the frontend only. 2606 2607Level 3 (default for @option{-Wstrict-aliasing}): 2608Should have very few false positives and few false 2609negatives. Slightly slower than levels 1 or 2 when optimization is enabled. 2610Takes care of the common punn+dereference pattern in the frontend: 2611@code{*(int*)&some_float}. 2612If optimization is enabled, it also runs in the backend, where it deals 2613with multiple statement cases using flow-sensitive points-to information. 2614Only warns when the converted pointer is dereferenced. 2615Does not warn about incomplete types. 2616 2617@item -Wstrict-overflow 2618@item -Wstrict-overflow=@var{n} 2619@opindex Wstrict-overflow 2620This option is only active when @option{-fstrict-overflow} is active. 2621It warns about cases where the compiler optimizes based on the 2622assumption that signed overflow does not occur. Note that it does not 2623warn about all cases where the code might overflow: it only warns 2624about cases where the compiler implements some optimization. Thus 2625this warning depends on the optimization level. 2626 2627An optimization which assumes that signed overflow does not occur is 2628perfectly safe if the values of the variables involved are such that 2629overflow never does, in fact, occur. Therefore this warning can 2630easily give a false positive: a warning about code which is not 2631actually a problem. To help focus on important issues, several 2632warning levels are defined. No warnings are issued for the use of 2633undefined signed overflow when estimating how many iterations a loop 2634will require, in particular when determining whether a loop will be 2635executed at all. 2636 2637@table @option 2638@item -Wstrict-overflow=1 2639Warn about cases which are both questionable and easy to avoid. For 2640example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the 2641compiler will simplify this to @code{1}. This level of 2642@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 2643are not, and must be explicitly requested. 2644 2645@item -Wstrict-overflow=2 2646Also warn about other cases where a comparison is simplified to a 2647constant. For example: @code{abs (x) >= 0}. This can only be 2648simplified when @option{-fstrict-overflow} is in effect, because 2649@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 2650zero. @option{-Wstrict-overflow} (with no level) is the same as 2651@option{-Wstrict-overflow=2}. 2652 2653@item -Wstrict-overflow=3 2654Also warn about other cases where a comparison is simplified. For 2655example: @code{x + 1 > 1} will be simplified to @code{x > 0}. 2656 2657@item -Wstrict-overflow=4 2658Also warn about other simplifications not covered by the above cases. 2659For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}. 2660 2661@item -Wstrict-overflow=5 2662Also warn about cases where the compiler reduces the magnitude of a 2663constant involved in a comparison. For example: @code{x + 2 > y} will 2664be simplified to @code{x + 1 >= y}. This is reported only at the 2665highest warning level because this simplification applies to many 2666comparisons, so this warning level will give a very large number of 2667false positives. 2668@end table 2669 2670@item -Wall 2671@opindex Wall 2672All of the above @samp{-W} options combined. This enables all the 2673warnings about constructions that some users consider questionable, and 2674that are easy to avoid (or modify to prevent the warning), even in 2675conjunction with macros. This also enables some language-specific 2676warnings described in @ref{C++ Dialect Options}. 2677@c APPLE LOCAL begin -Wmost 2678@item -Wmost 2679@opindex Wmost 2680This is equivalent to -Wall -Wno-parentheses. (Apple compatible) 2681@end table 2682@c APPLE LOCAL end -Wmost 2683 2684The following @option{-W@dots{}} options are not implied by @option{-Wall}. 2685Some of them warn about constructions that users generally do not 2686consider questionable, but which occasionally you might wish to check 2687for; others warn about constructions that are necessary or hard to avoid 2688in some cases, and there is no simple way to modify the code to suppress 2689the warning. 2690 2691@table @gcctabopt 2692@item -Wextra 2693@opindex W 2694@opindex Wextra 2695(This option used to be called @option{-W}. The older name is still 2696supported, but the newer name is more descriptive.) Print extra warning 2697messages for these events: 2698 2699@itemize @bullet 2700@item 2701A function can return either with or without a value. (Falling 2702off the end of the function body is considered returning without 2703a value.) For example, this function would evoke such a 2704warning: 2705 2706@smallexample 2707@group 2708foo (a) 2709@{ 2710 if (a > 0) 2711 return a; 2712@} 2713@end group 2714@end smallexample 2715 2716@item 2717An expression-statement or the left-hand side of a comma expression 2718contains no side effects. 2719To suppress the warning, cast the unused expression to void. 2720For example, an expression such as @samp{x[i,j]} will cause a warning, 2721but @samp{x[(void)i,j]} will not. 2722 2723@item 2724An unsigned value is compared against zero with @samp{<} or @samp{>=}. 2725 2726@item 2727Storage-class specifiers like @code{static} are not the first things in 2728a declaration. According to the C Standard, this usage is obsolescent. 2729 2730@item 2731If @option{-Wall} or @option{-Wunused} is also specified, warn about unused 2732arguments. 2733 2734@item 2735A comparison between signed and unsigned values could produce an 2736incorrect result when the signed value is converted to unsigned. 2737(But don't warn if @option{-Wno-sign-compare} is also specified.) 2738 2739@item 2740An aggregate has an initializer which does not initialize all members. 2741This warning can be independently controlled by 2742@option{-Wmissing-field-initializers}. 2743 2744@item 2745An initialized field without side effects is overridden when using 2746designated initializers (@pxref{Designated Inits, , Designated 2747Initializers}). This warning can be independently controlled by 2748@option{-Woverride-init}. 2749 2750@item 2751A function parameter is declared without a type specifier in K&R-style 2752functions: 2753 2754@smallexample 2755void foo(bar) @{ @} 2756@end smallexample 2757 2758@item 2759An empty body occurs in an @samp{if} or @samp{else} statement. 2760 2761@item 2762A pointer is compared against integer zero with @samp{<}, @samp{<=}, 2763@samp{>}, or @samp{>=}. 2764 2765@item 2766A variable might be changed by @samp{longjmp} or @samp{vfork}. 2767 2768@item @r{(C++ only)} 2769An enumerator and a non-enumerator both appear in a conditional expression. 2770 2771@item @r{(C++ only)} 2772A non-static reference or non-static @samp{const} member appears in a 2773class without constructors. 2774 2775@item @r{(C++ only)} 2776Ambiguous virtual bases. 2777 2778@item @r{(C++ only)} 2779Subscripting an array which has been declared @samp{register}. 2780 2781@item @r{(C++ only)} 2782Taking the address of a variable which has been declared @samp{register}. 2783 2784@item @r{(C++ only)} 2785A base class is not initialized in a derived class' copy constructor. 2786@end itemize 2787 2788@item -Wno-div-by-zero 2789@opindex Wno-div-by-zero 2790@opindex Wdiv-by-zero 2791Do not warn about compile-time integer division by zero. Floating point 2792division by zero is not warned about, as it can be a legitimate way of 2793obtaining infinities and NaNs. 2794 2795@item -Wsystem-headers 2796@opindex Wsystem-headers 2797@cindex warnings from system headers 2798@cindex system headers, warnings from 2799Print warning messages for constructs found in system header files. 2800Warnings from system headers are normally suppressed, on the assumption 2801that they usually do not indicate real problems and would only make the 2802compiler output harder to read. Using this command line option tells 2803GCC to emit warnings from system headers as if they occurred in user 2804code. However, note that using @option{-Wall} in conjunction with this 2805option will @emph{not} warn about unknown pragmas in system 2806headers---for that, @option{-Wunknown-pragmas} must also be used. 2807 2808@item -Wfloat-equal 2809@opindex Wfloat-equal 2810Warn if floating point values are used in equality comparisons. 2811 2812The idea behind this is that sometimes it is convenient (for the 2813programmer) to consider floating-point values as approximations to 2814infinitely precise real numbers. If you are doing this, then you need 2815to compute (by analyzing the code, or in some other way) the maximum or 2816likely maximum error that the computation introduces, and allow for it 2817when performing comparisons (and when producing output, but that's a 2818different problem). In particular, instead of testing for equality, you 2819would check to see whether the two values have ranges that overlap; and 2820this is done with the relational operators, so equality comparisons are 2821probably mistaken. 2822 2823@item -Wtraditional @r{(C only)} 2824@opindex Wtraditional 2825Warn about certain constructs that behave differently in traditional and 2826ISO C@. Also warn about ISO C constructs that have no traditional C 2827equivalent, and/or problematic constructs which should be avoided. 2828 2829@itemize @bullet 2830@item 2831Macro parameters that appear within string literals in the macro body. 2832In traditional C macro replacement takes place within string literals, 2833but does not in ISO C@. 2834 2835@item 2836In traditional C, some preprocessor directives did not exist. 2837Traditional preprocessors would only consider a line to be a directive 2838if the @samp{#} appeared in column 1 on the line. Therefore 2839@option{-Wtraditional} warns about directives that traditional C 2840understands but would ignore because the @samp{#} does not appear as the 2841first character on the line. It also suggests you hide directives like 2842@samp{#pragma} not understood by traditional C by indenting them. Some 2843traditional implementations would not recognize @samp{#elif}, so it 2844suggests avoiding it altogether. 2845 2846@item 2847A function-like macro that appears without arguments. 2848 2849@item 2850The unary plus operator. 2851 2852@item 2853The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point 2854constant suffixes. (Traditional C does support the @samp{L} suffix on integer 2855constants.) Note, these suffixes appear in macros defined in the system 2856headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 2857Use of these macros in user code might normally lead to spurious 2858warnings, however GCC's integrated preprocessor has enough context to 2859avoid warning in these cases. 2860 2861@item 2862A function declared external in one block and then used after the end of 2863the block. 2864 2865@item 2866A @code{switch} statement has an operand of type @code{long}. 2867 2868@item 2869A non-@code{static} function declaration follows a @code{static} one. 2870This construct is not accepted by some traditional C compilers. 2871 2872@item 2873The ISO type of an integer constant has a different width or 2874signedness from its traditional type. This warning is only issued if 2875the base of the constant is ten. I.e.@: hexadecimal or octal values, which 2876typically represent bit patterns, are not warned about. 2877 2878@item 2879Usage of ISO string concatenation is detected. 2880 2881@item 2882Initialization of automatic aggregates. 2883 2884@item 2885Identifier conflicts with labels. Traditional C lacks a separate 2886namespace for labels. 2887 2888@item 2889Initialization of unions. If the initializer is zero, the warning is 2890omitted. This is done under the assumption that the zero initializer in 2891user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 2892initializer warnings and relies on default initialization to zero in the 2893traditional C case. 2894 2895@item 2896Conversions by prototypes between fixed/floating point values and vice 2897versa. The absence of these prototypes when compiling with traditional 2898C would cause serious problems. This is a subset of the possible 2899conversion warnings, for the full set use @option{-Wconversion}. 2900 2901@item 2902Use of ISO C style function definitions. This warning intentionally is 2903@emph{not} issued for prototype declarations or variadic functions 2904because these ISO C features will appear in your code when using 2905libiberty's traditional C compatibility macros, @code{PARAMS} and 2906@code{VPARAMS}. This warning is also bypassed for nested functions 2907because that feature is already a GCC extension and thus not relevant to 2908traditional C compatibility. 2909@end itemize 2910 2911@item -Wdeclaration-after-statement @r{(C only)} 2912@opindex Wdeclaration-after-statement 2913Warn when a declaration is found after a statement in a block. This 2914construct, known from C++, was introduced with ISO C99 and is by default 2915allowed in GCC@. It is not supported by ISO C90 and was not supported by 2916GCC versions before GCC 3.0. @xref{Mixed Declarations}. 2917 2918@item -Wundef 2919@opindex Wundef 2920Warn if an undefined identifier is evaluated in an @samp{#if} directive. 2921 2922@item -Wno-endif-labels 2923@opindex Wno-endif-labels 2924@opindex Wendif-labels 2925Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text. 2926 2927@item -Wshadow 2928@opindex Wshadow 2929Warn whenever a local variable shadows another local variable, parameter or 2930global variable or whenever a built-in function is shadowed. 2931 2932@item -Wlarger-than-@var{len} 2933@opindex Wlarger-than 2934Warn whenever an object of larger than @var{len} bytes is defined. 2935 2936@item -Wframe-larger-than-@var{len} 2937@opindex Wframe-larger-than 2938Warn whenever the frame size of a function is larger than @var{len} bytes. 2939 2940@item -Wunsafe-loop-optimizations 2941@opindex Wunsafe-loop-optimizations 2942Warn if the loop cannot be optimized because the compiler could not 2943assume anything on the bounds of the loop indices. With 2944@option{-funsafe-loop-optimizations} warn if the compiler made 2945such assumptions. 2946 2947@item -Wpointer-arith 2948@opindex Wpointer-arith 2949Warn about anything that depends on the ``size of'' a function type or 2950of @code{void}. GNU C assigns these types a size of 1, for 2951convenience in calculations with @code{void *} pointers and pointers 2952to functions. 2953 2954@item -Wbad-function-cast @r{(C only)} 2955@opindex Wbad-function-cast 2956Warn whenever a function call is cast to a non-matching type. 2957For example, warn if @code{int malloc()} is cast to @code{anything *}. 2958 2959@item -Wc++-compat 2960Warn about ISO C constructs that are outside of the common subset of 2961ISO C and ISO C++, e.g.@: request for implicit conversion from 2962@code{void *} to a pointer to non-@code{void} type. 2963 2964@item -Wcast-qual 2965@opindex Wcast-qual 2966Warn whenever a pointer is cast so as to remove a type qualifier from 2967the target type. For example, warn if a @code{const char *} is cast 2968to an ordinary @code{char *}. 2969 2970@item -Wcast-align 2971@opindex Wcast-align 2972Warn whenever a pointer is cast such that the required alignment of the 2973target is increased. For example, warn if a @code{char *} is cast to 2974an @code{int *} on machines where integers can only be accessed at 2975two- or four-byte boundaries. 2976 2977@item -Wwrite-strings 2978@opindex Wwrite-strings 2979When compiling C, give string constants the type @code{const 2980char[@var{length}]} so that 2981copying the address of one into a non-@code{const} @code{char *} 2982pointer will get a warning; when compiling C++, warn about the 2983deprecated conversion from string literals to @code{char *}. This 2984warning, by default, is enabled for C++ programs. 2985These warnings will help you find at 2986compile time code that can try to write into a string constant, but 2987only if you have been very careful about using @code{const} in 2988declarations and prototypes. Otherwise, it will just be a nuisance; 2989this is why we did not make @option{-Wall} request these warnings. 2990 2991@item -Wconversion 2992@opindex Wconversion 2993Warn if a prototype causes a type conversion that is different from what 2994would happen to the same argument in the absence of a prototype. This 2995includes conversions of fixed point to floating and vice versa, and 2996conversions changing the width or signedness of a fixed point argument 2997except when the same as the default promotion. 2998 2999Also, warn if a negative integer constant expression is implicitly 3000converted to an unsigned type. For example, warn about the assignment 3001@code{x = -1} if @code{x} is unsigned. But do not warn about explicit 3002casts like @code{(unsigned) -1}. 3003 3004@item -Wsign-compare 3005@opindex Wsign-compare 3006@cindex warning for comparison of signed and unsigned values 3007@cindex comparison of signed and unsigned values, warning 3008@cindex signed and unsigned values, comparison warning 3009Warn when a comparison between signed and unsigned values could produce 3010an incorrect result when the signed value is converted to unsigned. 3011This warning is also enabled by @option{-Wextra}; to get the other warnings 3012of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}. 3013 3014@item -Waddress 3015@opindex Waddress 3016@opindex Wno-address 3017Warn about suspicious uses of memory addresses. These include using 3018the address of a function in a conditional expression, such as 3019@code{void func(void); if (func)}, and comparisons against the memory 3020address of a string literal, such as @code{if (x == "abc")}. Such 3021uses typically indicate a programmer error: the address of a function 3022always evaluates to true, so their use in a conditional usually 3023indicate that the programmer forgot the parentheses in a function 3024call; and comparisons against string literals result in unspecified 3025behavior and are not portable in C, so they usually indicate that the 3026programmer intended to use @code{strcmp}. This warning is enabled by 3027@option{-Wall}. 3028 3029@item -Waggregate-return 3030@opindex Waggregate-return 3031Warn if any functions that return structures or unions are defined or 3032called. (In languages where you can return an array, this also elicits 3033a warning.) 3034 3035@item -Wno-attributes 3036@opindex Wno-attributes 3037@opindex Wattributes 3038Do not warn if an unexpected @code{__attribute__} is used, such as 3039unrecognized attributes, function attributes applied to variables, 3040etc. This will not stop errors for incorrect use of supported 3041attributes. 3042 3043@item -Wstrict-prototypes @r{(C only)} 3044@opindex Wstrict-prototypes 3045Warn if a function is declared or defined without specifying the 3046argument types. (An old-style function definition is permitted without 3047a warning if preceded by a declaration which specifies the argument 3048types.) 3049 3050@item -Wold-style-definition @r{(C only)} 3051@opindex Wold-style-definition 3052Warn if an old-style function definition is used. A warning is given 3053even if there is a previous prototype. 3054 3055@item -Wmissing-prototypes @r{(C only)} 3056@opindex Wmissing-prototypes 3057Warn if a global function is defined without a previous prototype 3058declaration. This warning is issued even if the definition itself 3059provides a prototype. The aim is to detect global functions that fail 3060to be declared in header files. 3061 3062@item -Wmissing-declarations @r{(C only)} 3063@opindex Wmissing-declarations 3064Warn if a global function is defined without a previous declaration. 3065Do so even if the definition itself provides a prototype. 3066Use this option to detect global functions that are not declared in 3067header files. 3068 3069@item -Wmissing-field-initializers 3070@opindex Wmissing-field-initializers 3071@opindex W 3072@opindex Wextra 3073Warn if a structure's initializer has some fields missing. For 3074example, the following code would cause such a warning, because 3075@code{x.h} is implicitly zero: 3076 3077@smallexample 3078struct s @{ int f, g, h; @}; 3079struct s x = @{ 3, 4 @}; 3080@end smallexample 3081 3082This option does not warn about designated initializers, so the following 3083modification would not trigger a warning: 3084 3085@smallexample 3086struct s @{ int f, g, h; @}; 3087struct s x = @{ .f = 3, .g = 4 @}; 3088@end smallexample 3089 3090This warning is included in @option{-Wextra}. To get other @option{-Wextra} 3091warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}. 3092 3093@item -Wmissing-noreturn 3094@opindex Wmissing-noreturn 3095Warn about functions which might be candidates for attribute @code{noreturn}. 3096Note these are only possible candidates, not absolute ones. Care should 3097be taken to manually verify functions actually do not ever return before 3098adding the @code{noreturn} attribute, otherwise subtle code generation 3099bugs could be introduced. You will not get a warning for @code{main} in 3100hosted C environments. 3101 3102@item -Wmissing-format-attribute 3103@opindex Wmissing-format-attribute 3104@opindex Wformat 3105Warn about function pointers which might be candidates for @code{format} 3106attributes. Note these are only possible candidates, not absolute ones. 3107GCC will guess that function pointers with @code{format} attributes that 3108are used in assignment, initialization, parameter passing or return 3109statements should have a corresponding @code{format} attribute in the 3110resulting type. I.e.@: the left-hand side of the assignment or 3111initialization, the type of the parameter variable, or the return type 3112of the containing function respectively should also have a @code{format} 3113attribute to avoid the warning. 3114 3115GCC will also warn about function definitions which might be 3116candidates for @code{format} attributes. Again, these are only 3117possible candidates. GCC will guess that @code{format} attributes 3118might be appropriate for any function that calls a function like 3119@code{vprintf} or @code{vscanf}, but this might not always be the 3120case, and some functions for which @code{format} attributes are 3121appropriate may not be detected. 3122 3123@item -Wno-multichar 3124@opindex Wno-multichar 3125@opindex Wmultichar 3126Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 3127Usually they indicate a typo in the user's code, as they have 3128implementation-defined values, and should not be used in portable code. 3129 3130@item -Wnormalized=<none|id|nfc|nfkc> 3131@opindex Wnormalized 3132@cindex NFC 3133@cindex NFKC 3134@cindex character set, input normalization 3135In ISO C and ISO C++, two identifiers are different if they are 3136different sequences of characters. However, sometimes when characters 3137outside the basic ASCII character set are used, you can have two 3138different character sequences that look the same. To avoid confusion, 3139the ISO 10646 standard sets out some @dfn{normalization rules} which 3140when applied ensure that two sequences that look the same are turned into 3141the same sequence. GCC can warn you if you are using identifiers which 3142have not been normalized; this option controls that warning. 3143 3144There are four levels of warning that GCC supports. The default is 3145@option{-Wnormalized=nfc}, which warns about any identifier which is 3146not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 3147recommended form for most uses. 3148 3149Unfortunately, there are some characters which ISO C and ISO C++ allow 3150in identifiers that when turned into NFC aren't allowable as 3151identifiers. That is, there's no way to use these symbols in portable 3152ISO C or C++ and have all your identifiers in NFC. 3153@option{-Wnormalized=id} suppresses the warning for these characters. 3154It is hoped that future versions of the standards involved will correct 3155this, which is why this option is not the default. 3156 3157You can switch the warning off for all characters by writing 3158@option{-Wnormalized=none}. You would only want to do this if you 3159were using some other normalization scheme (like ``D''), because 3160otherwise you can easily create bugs that are literally impossible to see. 3161 3162Some characters in ISO 10646 have distinct meanings but look identical 3163in some fonts or display methodologies, especially once formatting has 3164been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 3165LETTER N'', will display just like a regular @code{n} which has been 3166placed in a superscript. ISO 10646 defines the @dfn{NFKC} 3167normalization scheme to convert all these into a standard form as 3168well, and GCC will warn if your code is not in NFKC if you use 3169@option{-Wnormalized=nfkc}. This warning is comparable to warning 3170about every identifier that contains the letter O because it might be 3171confused with the digit 0, and so is not the default, but may be 3172useful as a local coding convention if the programming environment is 3173unable to be fixed to display these characters distinctly. 3174 3175@item -Wno-deprecated-declarations 3176@opindex Wno-deprecated-declarations 3177Do not warn about uses of functions (@pxref{Function Attributes}), 3178variables (@pxref{Variable Attributes}), and types (@pxref{Type 3179Attributes}) marked as deprecated by using the @code{deprecated} 3180attribute. 3181 3182@item -Wno-overflow 3183@opindex Wno-overflow 3184Do not warn about compile-time overflow in constant expressions. 3185 3186@item -Woverride-init 3187@opindex Woverride-init 3188@opindex W 3189@opindex Wextra 3190Warn if an initialized field without side effects is overridden when 3191using designated initializers (@pxref{Designated Inits, , Designated 3192Initializers}). 3193 3194This warning is included in @option{-Wextra}. To get other 3195@option{-Wextra} warnings without this one, use @samp{-Wextra 3196-Wno-override-init}. 3197 3198@item -Wpacked 3199@opindex Wpacked 3200Warn if a structure is given the packed attribute, but the packed 3201attribute has no effect on the layout or size of the structure. 3202Such structures may be mis-aligned for little benefit. For 3203instance, in this code, the variable @code{f.x} in @code{struct bar} 3204will be misaligned even though @code{struct bar} does not itself 3205have the packed attribute: 3206 3207@smallexample 3208@group 3209struct foo @{ 3210 int x; 3211 char a, b, c, d; 3212@} __attribute__((packed)); 3213struct bar @{ 3214 char z; 3215 struct foo f; 3216@}; 3217@end group 3218@end smallexample 3219 3220@item -Wpadded 3221@opindex Wpadded 3222Warn if padding is included in a structure, either to align an element 3223of the structure or to align the whole structure. Sometimes when this 3224happens it is possible to rearrange the fields of the structure to 3225reduce the padding and so make the structure smaller. 3226 3227@item -Wredundant-decls 3228@opindex Wredundant-decls 3229Warn if anything is declared more than once in the same scope, even in 3230cases where multiple declaration is valid and changes nothing. 3231 3232@item -Wnested-externs @r{(C only)} 3233@opindex Wnested-externs 3234Warn if an @code{extern} declaration is encountered within a function. 3235 3236@item -Wunreachable-code 3237@opindex Wunreachable-code 3238Warn if the compiler detects that code will never be executed. 3239 3240This option is intended to warn when the compiler detects that at 3241least a whole line of source code will never be executed, because 3242some condition is never satisfied or because it is after a 3243procedure that never returns. 3244 3245It is possible for this option to produce a warning even though there 3246are circumstances under which part of the affected line can be executed, 3247so care should be taken when removing apparently-unreachable code. 3248 3249For instance, when a function is inlined, a warning may mean that the 3250line is unreachable in only one inlined copy of the function. 3251 3252This option is not made part of @option{-Wall} because in a debugging 3253version of a program there is often substantial code which checks 3254correct functioning of the program and is, hopefully, unreachable 3255because the program does work. Another common use of unreachable 3256code is to provide behavior which is selectable at compile-time. 3257 3258@item -Winline 3259@opindex Winline 3260Warn if a function can not be inlined and it was declared as inline. 3261Even with this option, the compiler will not warn about failures to 3262inline functions declared in system headers. 3263 3264The compiler uses a variety of heuristics to determine whether or not 3265to inline a function. For example, the compiler takes into account 3266the size of the function being inlined and the amount of inlining 3267that has already been done in the current function. Therefore, 3268seemingly insignificant changes in the source program can cause the 3269warnings produced by @option{-Winline} to appear or disappear. 3270 3271@item -Wno-invalid-offsetof @r{(C++ only)} 3272@opindex Wno-invalid-offsetof 3273Suppress warnings from applying the @samp{offsetof} macro to a non-POD 3274type. According to the 1998 ISO C++ standard, applying @samp{offsetof} 3275to a non-POD type is undefined. In existing C++ implementations, 3276however, @samp{offsetof} typically gives meaningful results even when 3277applied to certain kinds of non-POD types. (Such as a simple 3278@samp{struct} that fails to be a POD type only by virtue of having a 3279constructor.) This flag is for users who are aware that they are 3280writing nonportable code and who have deliberately chosen to ignore the 3281warning about it. 3282 3283The restrictions on @samp{offsetof} may be relaxed in a future version 3284of the C++ standard. 3285 3286@item -Wno-int-to-pointer-cast @r{(C only)} 3287@opindex Wno-int-to-pointer-cast 3288Suppress warnings from casts to pointer type of an integer of a 3289different size. 3290 3291@item -Wno-pointer-to-int-cast @r{(C only)} 3292@opindex Wno-pointer-to-int-cast 3293Suppress warnings from casts from a pointer to an integer type of a 3294different size. 3295 3296@item -Winvalid-pch 3297@opindex Winvalid-pch 3298Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 3299the search path but can't be used. 3300 3301@item -Wlong-long 3302@opindex Wlong-long 3303@opindex Wno-long-long 3304Warn if @samp{long long} type is used. This is default. To inhibit 3305the warning messages, use @option{-Wno-long-long}. Flags 3306@option{-Wlong-long} and @option{-Wno-long-long} are taken into account 3307only when @option{-pedantic} flag is used. 3308 3309@item -Wvariadic-macros 3310@opindex Wvariadic-macros 3311@opindex Wno-variadic-macros 3312Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU 3313alternate syntax when in pedantic ISO C99 mode. This is default. 3314To inhibit the warning messages, use @option{-Wno-variadic-macros}. 3315 3316@item -Wvla 3317@opindex Wvla 3318@opindex Wno-vla 3319Warn if variable length array is used in the code. 3320@option{-Wno-vla} will prevent the @option{-pedantic} warning of 3321the variable length array. 3322 3323@item -Wvolatile-register-var 3324@opindex Wvolatile-register-var 3325@opindex Wno-volatile-register-var 3326Warn if a register variable is declared volatile. The volatile 3327modifier does not inhibit all optimizations that may eliminate reads 3328and/or writes to register variables. 3329 3330@item -Wdisabled-optimization 3331@opindex Wdisabled-optimization 3332Warn if a requested optimization pass is disabled. This warning does 3333not generally indicate that there is anything wrong with your code; it 3334merely indicates that GCC's optimizers were unable to handle the code 3335effectively. Often, the problem is that your code is too big or too 3336complex; GCC will refuse to optimize programs when the optimization 3337itself is likely to take inordinate amounts of time. 3338 3339@item -Wpointer-sign 3340@opindex Wpointer-sign 3341@opindex Wno-pointer-sign 3342Warn for pointer argument passing or assignment with different signedness. 3343This option is only supported for C. It is implied by @option{-Wall} 3344and by @option{-pedantic}, which can be disabled with 3345@option{-Wno-pointer-sign}. 3346 3347@item -Werror 3348@opindex Werror 3349Make all warnings into errors. 3350 3351@item -Werror= 3352@opindex Werror= 3353Make the specified warning into an errors. The specifier for a 3354warning is appended, for example @option{-Werror=switch} turns the 3355warnings controlled by @option{-Wswitch} into errors. This switch 3356takes a negative form, to be used to negate @option{-Werror} for 3357specific warnings, for example @option{-Wno-error=switch} makes 3358@option{-Wswitch} warnings not be errors, even when @option{-Werror} 3359is in effect. You can use the @option{-fdiagnostics-show-option} 3360option to have each controllable warning amended with the option which 3361controls it, to determine what to use with this option. 3362 3363Note that specifying @option{-Werror=}@var{foo} automatically implies 3364@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 3365imply anything. 3366 3367@item -Wstack-protector 3368@opindex Wstack-protector 3369This option is only active when @option{-fstack-protector} is active. It 3370warns about functions that will not be protected against stack smashing. 3371 3372@item -Woverlength-strings 3373@opindex Woverlength-strings 3374Warn about string constants which are longer than the ``minimum 3375maximum'' length specified in the C standard. Modern compilers 3376generally allow string constants which are much longer than the 3377standard's minimum limit, but very portable programs should avoid 3378using longer strings. 3379 3380The limit applies @emph{after} string constant concatenation, and does 3381not count the trailing NUL@. In C89, the limit was 509 characters; in 3382C99, it was raised to 4095. C++98 does not specify a normative 3383minimum maximum, so we do not diagnose overlength strings in C++@. 3384 3385This option is implied by @option{-pedantic}, and can be disabled with 3386@option{-Wno-overlength-strings}. 3387@end table 3388 3389@node Debugging Options 3390@section Options for Debugging Your Program or GCC 3391@cindex options, debugging 3392@cindex debugging information options 3393 3394GCC has various special options that are used for debugging 3395either your program or GCC: 3396 3397@table @gcctabopt 3398@item -g 3399@opindex g 3400Produce debugging information in the operating system's native format 3401(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging 3402information. 3403 3404On most systems that use stabs format, @option{-g} enables use of extra 3405debugging information that only GDB can use; this extra information 3406makes debugging work better in GDB but will probably make other debuggers 3407crash or 3408refuse to read the program. If you want to control for certain whether 3409to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 3410@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 3411 3412GCC allows you to use @option{-g} with 3413@option{-O}. The shortcuts taken by optimized code may occasionally 3414produce surprising results: some variables you declared may not exist 3415at all; flow of control may briefly move where you did not expect it; 3416some statements may not be executed because they compute constant 3417results or their values were already at hand; some statements may 3418execute in different places because they were moved out of loops. 3419 3420Nevertheless it proves possible to debug optimized output. This makes 3421it reasonable to use the optimizer for programs that might have bugs. 3422 3423The following options are useful when GCC is generated with the 3424capability for more than one debugging format. 3425 3426@item -ggdb 3427@opindex ggdb 3428Produce debugging information for use by GDB@. This means to use the 3429most expressive format available (DWARF 2, stabs, or the native format 3430if neither of those are supported), including GDB extensions if at all 3431possible. 3432 3433@item -gstabs 3434@opindex gstabs 3435Produce debugging information in stabs format (if that is supported), 3436without GDB extensions. This is the format used by DBX on most BSD 3437systems. On MIPS, Alpha and System V Release 4 systems this option 3438produces stabs debugging output which is not understood by DBX or SDB@. 3439On System V Release 4 systems this option requires the GNU assembler. 3440 3441@item -feliminate-unused-debug-symbols 3442@opindex feliminate-unused-debug-symbols 3443Produce debugging information in stabs format (if that is supported), 3444for only symbols that are actually used. 3445 3446@item -femit-class-debug-always 3447Instead of emitting debugging information for a C++ class in only one 3448object file, emit it in all object files using the class. This option 3449should be used only with debuggers that are unable to handle the way GCC 3450normally emits debugging information for classes because using this 3451option will increase the size of debugging information by as much as a 3452factor of two. 3453 3454@item -gstabs+ 3455@opindex gstabs+ 3456Produce debugging information in stabs format (if that is supported), 3457using GNU extensions understood only by the GNU debugger (GDB)@. The 3458use of these extensions is likely to make other debuggers crash or 3459refuse to read the program. 3460 3461@item -gcoff 3462@opindex gcoff 3463Produce debugging information in COFF format (if that is supported). 3464This is the format used by SDB on most System V systems prior to 3465System V Release 4. 3466 3467@item -gxcoff 3468@opindex gxcoff 3469Produce debugging information in XCOFF format (if that is supported). 3470This is the format used by the DBX debugger on IBM RS/6000 systems. 3471 3472@item -gxcoff+ 3473@opindex gxcoff+ 3474Produce debugging information in XCOFF format (if that is supported), 3475using GNU extensions understood only by the GNU debugger (GDB)@. The 3476use of these extensions is likely to make other debuggers crash or 3477refuse to read the program, and may cause assemblers other than the GNU 3478assembler (GAS) to fail with an error. 3479 3480@item -gdwarf-2 3481@opindex gdwarf-2 3482Produce debugging information in DWARF version 2 format (if that is 3483supported). This is the format used by DBX on IRIX 6. With this 3484option, GCC uses features of DWARF version 3 when they are useful; 3485version 3 is upward compatible with version 2, but may still cause 3486problems for older debuggers. 3487 3488@item -gvms 3489@opindex gvms 3490Produce debugging information in VMS debug format (if that is 3491supported). This is the format used by DEBUG on VMS systems. 3492 3493@item -g@var{level} 3494@itemx -ggdb@var{level} 3495@itemx -gstabs@var{level} 3496@itemx -gcoff@var{level} 3497@itemx -gxcoff@var{level} 3498@itemx -gvms@var{level} 3499Request debugging information and also use @var{level} to specify how 3500much information. The default level is 2. 3501 3502Level 1 produces minimal information, enough for making backtraces in 3503parts of the program that you don't plan to debug. This includes 3504descriptions of functions and external variables, but no information 3505about local variables and no line numbers. 3506 3507Level 3 includes extra information, such as all the macro definitions 3508present in the program. Some debuggers support macro expansion when 3509you use @option{-g3}. 3510 3511@option{-gdwarf-2} does not accept a concatenated debug level, because 3512GCC used to support an option @option{-gdwarf} that meant to generate 3513debug information in version 1 of the DWARF format (which is very 3514different from version 2), and it would have been too confusing. That 3515debug format is long obsolete, but the option cannot be changed now. 3516Instead use an additional @option{-g@var{level}} option to change the 3517debug level for DWARF2. 3518 3519@item -feliminate-dwarf2-dups 3520@opindex feliminate-dwarf2-dups 3521Compress DWARF2 debugging information by eliminating duplicated 3522information about each symbol. This option only makes sense when 3523generating DWARF2 debugging information with @option{-gdwarf-2}. 3524 3525@item -femit-struct-debug-baseonly 3526Emit debug information for struct-like types 3527only when the base name of the compilation source file 3528matches the base name of file in which the struct was defined. 3529 3530This option substantially reduces the size of debugging information, 3531but at significant potential loss in type information to the debugger. 3532See @option{-femit-struct-debug-reduced} for a less aggressive option. 3533See @option{-femit-struct-debug-detailed} for more detailed control. 3534 3535This option works only with DWARF 2. 3536 3537@item -femit-struct-debug-reduced 3538Emit debug information for struct-like types 3539only when the base name of the compilation source file 3540matches the base name of file in which the type was defined, 3541unless the struct is a template or defined in a system header. 3542 3543This option significantly reduces the size of debugging information, 3544with some potential loss in type information to the debugger. 3545See @option{-femit-struct-debug-baseonly} for a more aggressive option. 3546See @option{-femit-struct-debug-detailed} for more detailed control. 3547 3548This option works only with DWARF 2. 3549 3550@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 3551Specify the struct-like types 3552for which the compiler will generate debug information. 3553The intent is to reduce duplicate struct debug information 3554between different object files within the same program. 3555 3556This option is a detailed version of 3557@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 3558which will serve for most needs. 3559 3560A specification has the syntax 3561[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 3562 3563The optional first word limits the specification to 3564structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 3565A struct type is used directly when it is the type of a variable, member. 3566Indirect uses arise through pointers to structs. 3567That is, when use of an incomplete struct would be legal, the use is indirect. 3568An example is 3569@samp{struct one direct; struct two * indirect;}. 3570 3571The optional second word limits the specification to 3572ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 3573Generic structs are a bit complicated to explain. 3574For C++, these are non-explicit specializations of template classes, 3575or non-template classes within the above. 3576Other programming languages have generics, 3577but @samp{-femit-struct-debug-detailed} does not yet implement them. 3578 3579The third word specifies the source files for those 3580structs for which the compiler will emit debug information. 3581The values @samp{none} and @samp{any} have the normal meaning. 3582The value @samp{base} means that 3583the base of name of the file in which the type declaration appears 3584must match the base of the name of the main compilation file. 3585In practice, this means that 3586types declared in @file{foo.c} and @file{foo.h} will have debug information, 3587but types declared in other header will not. 3588The value @samp{sys} means those types satisfying @samp{base} 3589or declared in system or compiler headers. 3590 3591You may need to experiment to determine the best settings for your application. 3592 3593The default is @samp{-femit-struct-debug-detailed=all}. 3594 3595This option works only with DWARF 2. 3596 3597@cindex @command{prof} 3598@item -p 3599@opindex p 3600Generate extra code to write profile information suitable for the 3601analysis program @command{prof}. You must use this option when compiling 3602the source files you want data about, and you must also use it when 3603linking. 3604 3605@cindex @command{gprof} 3606@item -pg 3607@opindex pg 3608Generate extra code to write profile information suitable for the 3609analysis program @command{gprof}. You must use this option when compiling 3610the source files you want data about, and you must also use it when 3611linking. 3612 3613@item -Q 3614@opindex Q 3615Makes the compiler print out each function name as it is compiled, and 3616print some statistics about each pass when it finishes. 3617 3618@item -ftime-report 3619@opindex ftime-report 3620Makes the compiler print some statistics about the time consumed by each 3621pass when it finishes. 3622 3623@item -fmem-report 3624@opindex fmem-report 3625Makes the compiler print some statistics about permanent memory 3626allocation when it finishes. 3627 3628@item -fprofile-arcs 3629@opindex fprofile-arcs 3630Add code so that program flow @dfn{arcs} are instrumented. During 3631execution the program records how many times each branch and call is 3632executed and how many times it is taken or returns. When the compiled 3633program exits it saves this data to a file called 3634@file{@var{auxname}.gcda} for each source file. The data may be used for 3635profile-directed optimizations (@option{-fbranch-probabilities}), or for 3636test coverage analysis (@option{-ftest-coverage}). Each object file's 3637@var{auxname} is generated from the name of the output file, if 3638explicitly specified and it is not the final executable, otherwise it is 3639the basename of the source file. In both cases any suffix is removed 3640(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 3641@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 3642@xref{Cross-profiling}. 3643 3644@cindex @command{gcov} 3645@item --coverage 3646@opindex coverage 3647 3648This option is used to compile and link code instrumented for coverage 3649analysis. The option is a synonym for @option{-fprofile-arcs} 3650@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 3651linking). See the documentation for those options for more details. 3652 3653@itemize 3654 3655@item 3656Compile the source files with @option{-fprofile-arcs} plus optimization 3657and code generation options. For test coverage analysis, use the 3658additional @option{-ftest-coverage} option. You do not need to profile 3659every source file in a program. 3660 3661@item 3662Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 3663(the latter implies the former). 3664 3665@item 3666Run the program on a representative workload to generate the arc profile 3667information. This may be repeated any number of times. You can run 3668concurrent instances of your program, and provided that the file system 3669supports locking, the data files will be correctly updated. Also 3670@code{fork} calls are detected and correctly handled (double counting 3671will not happen). 3672 3673@item 3674For profile-directed optimizations, compile the source files again with 3675the same optimization and code generation options plus 3676@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 3677Control Optimization}). 3678 3679@item 3680For test coverage analysis, use @command{gcov} to produce human readable 3681information from the @file{.gcno} and @file{.gcda} files. Refer to the 3682@command{gcov} documentation for further information. 3683 3684@end itemize 3685 3686With @option{-fprofile-arcs}, for each function of your program GCC 3687creates a program flow graph, then finds a spanning tree for the graph. 3688Only arcs that are not on the spanning tree have to be instrumented: the 3689compiler adds code to count the number of times that these arcs are 3690executed. When an arc is the only exit or only entrance to a block, the 3691instrumentation code can be added to the block; otherwise, a new basic 3692block must be created to hold the instrumentation code. 3693 3694@need 2000 3695@item -ftest-coverage 3696@opindex ftest-coverage 3697Produce a notes file that the @command{gcov} code-coverage utility 3698(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 3699show program coverage. Each source file's note file is called 3700@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 3701above for a description of @var{auxname} and instructions on how to 3702generate test coverage data. Coverage data will match the source files 3703more closely, if you do not optimize. 3704 3705@item -d@var{letters} 3706@item -fdump-rtl-@var{pass} 3707@opindex d 3708Says to make debugging dumps during compilation at times specified by 3709@var{letters}. This is used for debugging the RTL-based passes of the 3710compiler. The file names for most of the dumps are made by appending a 3711pass number and a word to the @var{dumpname}. @var{dumpname} is generated 3712from the name of the output file, if explicitly specified and it is not 3713an executable, otherwise it is the basename of the source file. These 3714switches may have different effects when @option{-E} is used for 3715preprocessing. 3716 3717Most debug dumps can be enabled either passing a letter to the @option{-d} 3718option, or with a long @option{-fdump-rtl} switch; here are the possible 3719letters for use in @var{letters} and @var{pass}, and their meanings: 3720 3721@table @gcctabopt 3722@item -dA 3723@opindex dA 3724Annotate the assembler output with miscellaneous debugging information. 3725 3726@item -dB 3727@itemx -fdump-rtl-bbro 3728@opindex dB 3729@opindex fdump-rtl-bbro 3730Dump after block reordering, to @file{@var{file}.148r.bbro}. 3731 3732@item -dc 3733@itemx -fdump-rtl-combine 3734@opindex dc 3735@opindex fdump-rtl-combine 3736Dump after instruction combination, to the file @file{@var{file}.129r.combine}. 3737 3738@item -dC 3739@itemx -fdump-rtl-ce1 3740@itemx -fdump-rtl-ce2 3741@opindex dC 3742@opindex fdump-rtl-ce1 3743@opindex fdump-rtl-ce2 3744@option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the 3745first if conversion, to the file @file{@var{file}.117r.ce1}. @option{-dC} 3746and @option{-fdump-rtl-ce2} enable dumping after the second if 3747conversion, to the file @file{@var{file}.130r.ce2}. 3748 3749@item -dd 3750@itemx -fdump-rtl-btl 3751@itemx -fdump-rtl-dbr 3752@opindex dd 3753@opindex fdump-rtl-btl 3754@opindex fdump-rtl-dbr 3755@option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch 3756target load optimization, to @file{@var{file}.31.btl}. @option{-dd} 3757and @option{-fdump-rtl-dbr} enable dumping after delayed branch 3758scheduling, to @file{@var{file}.36.dbr}. 3759 3760@item -dD 3761@opindex dD 3762Dump all macro definitions, at the end of preprocessing, in addition to 3763normal output. 3764 3765@item -dE 3766@itemx -fdump-rtl-ce3 3767@opindex dE 3768@opindex fdump-rtl-ce3 3769Dump after the third if conversion, to @file{@var{file}.146r.ce3}. 3770 3771@item -df 3772@itemx -fdump-rtl-cfg 3773@itemx -fdump-rtl-life 3774@opindex df 3775@opindex fdump-rtl-cfg 3776@opindex fdump-rtl-life 3777@option{-df} and @option{-fdump-rtl-cfg} enable dumping after control 3778and data flow analysis, to @file{@var{file}.116r.cfg}. @option{-df} 3779and @option{-fdump-rtl-cfg} enable dumping dump after life analysis, 3780to @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}. 3781 3782@item -dg 3783@itemx -fdump-rtl-greg 3784@opindex dg 3785@opindex fdump-rtl-greg 3786Dump after global register allocation, to @file{@var{file}.139r.greg}. 3787 3788@item -dG 3789@itemx -fdump-rtl-gcse 3790@itemx -fdump-rtl-bypass 3791@opindex dG 3792@opindex fdump-rtl-gcse 3793@opindex fdump-rtl-bypass 3794@option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to 3795@file{@var{file}.114r.gcse}. @option{-dG} and @option{-fdump-rtl-bypass} 3796enable dumping after jump bypassing and control flow optimizations, to 3797@file{@var{file}.115r.bypass}. 3798 3799@item -dh 3800@itemx -fdump-rtl-eh 3801@opindex dh 3802@opindex fdump-rtl-eh 3803Dump after finalization of EH handling code, to @file{@var{file}.02.eh}. 3804 3805@item -di 3806@itemx -fdump-rtl-sibling 3807@opindex di 3808@opindex fdump-rtl-sibling 3809Dump after sibling call optimizations, to @file{@var{file}.106r.sibling}. 3810 3811@item -dj 3812@itemx -fdump-rtl-jump 3813@opindex dj 3814@opindex fdump-rtl-jump 3815Dump after the first jump optimization, to @file{@var{file}.112r.jump}. 3816 3817@item -dk 3818@itemx -fdump-rtl-stack 3819@opindex dk 3820@opindex fdump-rtl-stack 3821Dump after conversion from registers to stack, to @file{@var{file}.152r.stack}. 3822 3823@item -dl 3824@itemx -fdump-rtl-lreg 3825@opindex dl 3826@opindex fdump-rtl-lreg 3827Dump after local register allocation, to @file{@var{file}.138r.lreg}. 3828 3829@item -dL 3830@itemx -fdump-rtl-loop2 3831@opindex dL 3832@opindex fdump-rtl-loop2 3833@option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the 3834loop optimization pass, to @file{@var{file}.119r.loop2}, 3835@file{@var{file}.120r.loop2_init}, 3836@file{@var{file}.121r.loop2_invariant}, and 3837@file{@var{file}.125r.loop2_done}. 3838 3839@item -dm 3840@itemx -fdump-rtl-sms 3841@opindex dm 3842@opindex fdump-rtl-sms 3843Dump after modulo scheduling, to @file{@var{file}.136r.sms}. 3844 3845@item -dM 3846@itemx -fdump-rtl-mach 3847@opindex dM 3848@opindex fdump-rtl-mach 3849Dump after performing the machine dependent reorganization pass, to 3850@file{@var{file}.155r.mach} if that pass exists. 3851 3852@item -dn 3853@itemx -fdump-rtl-rnreg 3854@opindex dn 3855@opindex fdump-rtl-rnreg 3856Dump after register renumbering, to @file{@var{file}.147r.rnreg}. 3857 3858@item -dN 3859@itemx -fdump-rtl-regmove 3860@opindex dN 3861@opindex fdump-rtl-regmove 3862Dump after the register move pass, to @file{@var{file}.132r.regmove}. 3863 3864@item -do 3865@itemx -fdump-rtl-postreload 3866@opindex do 3867@opindex fdump-rtl-postreload 3868Dump after post-reload optimizations, to @file{@var{file}.24.postreload}. 3869 3870@item -dr 3871@itemx -fdump-rtl-expand 3872@opindex dr 3873@opindex fdump-rtl-expand 3874Dump after RTL generation, to @file{@var{file}.104r.expand}. 3875 3876@item -dR 3877@itemx -fdump-rtl-sched2 3878@opindex dR 3879@opindex fdump-rtl-sched2 3880Dump after the second scheduling pass, to @file{@var{file}.150r.sched2}. 3881 3882@item -ds 3883@itemx -fdump-rtl-cse 3884@opindex ds 3885@opindex fdump-rtl-cse 3886Dump after CSE (including the jump optimization that sometimes follows 3887CSE), to @file{@var{file}.113r.cse}. 3888 3889@item -dS 3890@itemx -fdump-rtl-sched 3891@opindex dS 3892@opindex fdump-rtl-sched 3893Dump after the first scheduling pass, to @file{@var{file}.21.sched}. 3894 3895@item -dt 3896@itemx -fdump-rtl-cse2 3897@opindex dt 3898@opindex fdump-rtl-cse2 3899Dump after the second CSE pass (including the jump optimization that 3900sometimes follows CSE), to @file{@var{file}.127r.cse2}. 3901 3902@item -dT 3903@itemx -fdump-rtl-tracer 3904@opindex dT 3905@opindex fdump-rtl-tracer 3906Dump after running tracer, to @file{@var{file}.118r.tracer}. 3907 3908@item -dV 3909@itemx -fdump-rtl-vpt 3910@itemx -fdump-rtl-vartrack 3911@opindex dV 3912@opindex fdump-rtl-vpt 3913@opindex fdump-rtl-vartrack 3914@option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value 3915profile transformations, to @file{@var{file}.10.vpt}. @option{-dV} 3916and @option{-fdump-rtl-vartrack} enable dumping after variable tracking, 3917to @file{@var{file}.154r.vartrack}. 3918 3919@item -dw 3920@itemx -fdump-rtl-flow2 3921@opindex dw 3922@opindex fdump-rtl-flow2 3923Dump after the second flow pass, to @file{@var{file}.142r.flow2}. 3924 3925@item -dz 3926@itemx -fdump-rtl-peephole2 3927@opindex dz 3928@opindex fdump-rtl-peephole2 3929Dump after the peephole pass, to @file{@var{file}.145r.peephole2}. 3930 3931@item -dZ 3932@itemx -fdump-rtl-web 3933@opindex dZ 3934@opindex fdump-rtl-web 3935Dump after live range splitting, to @file{@var{file}.126r.web}. 3936 3937@item -da 3938@itemx -fdump-rtl-all 3939@opindex da 3940@opindex fdump-rtl-all 3941Produce all the dumps listed above. 3942 3943@item -dH 3944@opindex dH 3945Produce a core dump whenever an error occurs. 3946 3947@item -dm 3948@opindex dm 3949Print statistics on memory usage, at the end of the run, to 3950standard error. 3951 3952@item -dp 3953@opindex dp 3954Annotate the assembler output with a comment indicating which 3955pattern and alternative was used. The length of each instruction is 3956also printed. 3957 3958@item -dP 3959@opindex dP 3960Dump the RTL in the assembler output as a comment before each instruction. 3961Also turns on @option{-dp} annotation. 3962 3963@item -dv 3964@opindex dv 3965For each of the other indicated dump files (either with @option{-d} or 3966@option{-fdump-rtl-@var{pass}}), dump a representation of the control flow 3967graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}. 3968 3969@item -dx 3970@opindex dx 3971Just generate RTL for a function instead of compiling it. Usually used 3972with @samp{r} (@option{-fdump-rtl-expand}). 3973 3974@item -dy 3975@opindex dy 3976Dump debugging information during parsing, to standard error. 3977@end table 3978 3979@item -fdump-noaddr 3980@opindex fdump-noaddr 3981When doing debugging dumps (see @option{-d} option above), suppress 3982address output. This makes it more feasible to use diff on debugging 3983dumps for compiler invocations with different compiler binaries and/or 3984different text / bss / data / heap / stack / dso start locations. 3985 3986@item -fdump-unnumbered 3987@opindex fdump-unnumbered 3988When doing debugging dumps (see @option{-d} option above), suppress instruction 3989numbers, line number note and address output. This makes it more feasible to 3990use diff on debugging dumps for compiler invocations with different 3991options, in particular with and without @option{-g}. 3992 3993@item -fdump-translation-unit @r{(C++ only)} 3994@itemx -fdump-translation-unit-@var{options} @r{(C++ only)} 3995@opindex fdump-translation-unit 3996Dump a representation of the tree structure for the entire translation 3997unit to a file. The file name is made by appending @file{.tu} to the 3998source file name. If the @samp{-@var{options}} form is used, @var{options} 3999controls the details of the dump as described for the 4000@option{-fdump-tree} options. 4001 4002@item -fdump-class-hierarchy @r{(C++ only)} 4003@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} 4004@opindex fdump-class-hierarchy 4005Dump a representation of each class's hierarchy and virtual function 4006table layout to a file. The file name is made by appending @file{.class} 4007to the source file name. If the @samp{-@var{options}} form is used, 4008@var{options} controls the details of the dump as described for the 4009@option{-fdump-tree} options. 4010 4011@item -fdump-ipa-@var{switch} 4012@opindex fdump-ipa 4013Control the dumping at various stages of inter-procedural analysis 4014language tree to a file. The file name is generated by appending a switch 4015specific suffix to the source file name. The following dumps are possible: 4016 4017@table @samp 4018@item all 4019Enables all inter-procedural analysis dumps; currently the only produced 4020dump is the @samp{cgraph} dump. 4021 4022@item cgraph 4023Dumps information about call-graph optimization, unused function removal, 4024and inlining decisions. 4025@end table 4026 4027@item -fdump-tree-@var{switch} 4028@itemx -fdump-tree-@var{switch}-@var{options} 4029@opindex fdump-tree 4030Control the dumping at various stages of processing the intermediate 4031language tree to a file. The file name is generated by appending a switch 4032specific suffix to the source file name. If the @samp{-@var{options}} 4033form is used, @var{options} is a list of @samp{-} separated options that 4034control the details of the dump. Not all options are applicable to all 4035dumps, those which are not meaningful will be ignored. The following 4036options are available 4037 4038@table @samp 4039@item address 4040Print the address of each node. Usually this is not meaningful as it 4041changes according to the environment and source file. Its primary use 4042is for tying up a dump file with a debug environment. 4043@item slim 4044Inhibit dumping of members of a scope or body of a function merely 4045because that scope has been reached. Only dump such items when they 4046are directly reachable by some other path. When dumping pretty-printed 4047trees, this option inhibits dumping the bodies of control structures. 4048@item raw 4049Print a raw representation of the tree. By default, trees are 4050pretty-printed into a C-like representation. 4051@item details 4052Enable more detailed dumps (not honored by every dump option). 4053@item stats 4054Enable dumping various statistics about the pass (not honored by every dump 4055option). 4056@item blocks 4057Enable showing basic block boundaries (disabled in raw dumps). 4058@item vops 4059Enable showing virtual operands for every statement. 4060@item lineno 4061Enable showing line numbers for statements. 4062@item uid 4063Enable showing the unique ID (@code{DECL_UID}) for each variable. 4064@item all 4065Turn on all options, except @option{raw}, @option{slim} and @option{lineno}. 4066@end table 4067 4068The following tree dumps are possible: 4069@table @samp 4070 4071@item original 4072Dump before any tree based optimization, to @file{@var{file}.original}. 4073 4074@item optimized 4075Dump after all tree based optimization, to @file{@var{file}.optimized}. 4076 4077@item inlined 4078Dump after function inlining, to @file{@var{file}.inlined}. 4079 4080@item gimple 4081@opindex fdump-tree-gimple 4082Dump each function before and after the gimplification pass to a file. The 4083file name is made by appending @file{.gimple} to the source file name. 4084 4085@item cfg 4086@opindex fdump-tree-cfg 4087Dump the control flow graph of each function to a file. The file name is 4088made by appending @file{.cfg} to the source file name. 4089 4090@item vcg 4091@opindex fdump-tree-vcg 4092Dump the control flow graph of each function to a file in VCG format. The 4093file name is made by appending @file{.vcg} to the source file name. Note 4094that if the file contains more than one function, the generated file cannot 4095be used directly by VCG@. You will need to cut and paste each function's 4096graph into its own separate file first. 4097 4098@item ch 4099@opindex fdump-tree-ch 4100Dump each function after copying loop headers. The file name is made by 4101appending @file{.ch} to the source file name. 4102 4103@item ssa 4104@opindex fdump-tree-ssa 4105Dump SSA related information to a file. The file name is made by appending 4106@file{.ssa} to the source file name. 4107 4108@item salias 4109@opindex fdump-tree-salias 4110Dump structure aliasing variable information to a file. This file name 4111is made by appending @file{.salias} to the source file name. 4112 4113@item alias 4114@opindex fdump-tree-alias 4115Dump aliasing information for each function. The file name is made by 4116appending @file{.alias} to the source file name. 4117 4118@item ccp 4119@opindex fdump-tree-ccp 4120Dump each function after CCP@. The file name is made by appending 4121@file{.ccp} to the source file name. 4122 4123@item storeccp 4124@opindex fdump-tree-storeccp 4125Dump each function after STORE-CCP. The file name is made by appending 4126@file{.storeccp} to the source file name. 4127 4128@item pre 4129@opindex fdump-tree-pre 4130Dump trees after partial redundancy elimination. The file name is made 4131by appending @file{.pre} to the source file name. 4132 4133@item fre 4134@opindex fdump-tree-fre 4135Dump trees after full redundancy elimination. The file name is made 4136by appending @file{.fre} to the source file name. 4137 4138@item copyprop 4139@opindex fdump-tree-copyprop 4140Dump trees after copy propagation. The file name is made 4141by appending @file{.copyprop} to the source file name. 4142 4143@item store_copyprop 4144@opindex fdump-tree-store_copyprop 4145Dump trees after store copy-propagation. The file name is made 4146by appending @file{.store_copyprop} to the source file name. 4147 4148@item dce 4149@opindex fdump-tree-dce 4150Dump each function after dead code elimination. The file name is made by 4151appending @file{.dce} to the source file name. 4152 4153@item mudflap 4154@opindex fdump-tree-mudflap 4155Dump each function after adding mudflap instrumentation. The file name is 4156made by appending @file{.mudflap} to the source file name. 4157 4158@item sra 4159@opindex fdump-tree-sra 4160Dump each function after performing scalar replacement of aggregates. The 4161file name is made by appending @file{.sra} to the source file name. 4162 4163@item sink 4164@opindex fdump-tree-sink 4165Dump each function after performing code sinking. The file name is made 4166by appending @file{.sink} to the source file name. 4167 4168@item dom 4169@opindex fdump-tree-dom 4170Dump each function after applying dominator tree optimizations. The file 4171name is made by appending @file{.dom} to the source file name. 4172 4173@item dse 4174@opindex fdump-tree-dse 4175Dump each function after applying dead store elimination. The file 4176name is made by appending @file{.dse} to the source file name. 4177 4178@item phiopt 4179@opindex fdump-tree-phiopt 4180Dump each function after optimizing PHI nodes into straightline code. The file 4181name is made by appending @file{.phiopt} to the source file name. 4182 4183@item forwprop 4184@opindex fdump-tree-forwprop 4185Dump each function after forward propagating single use variables. The file 4186name is made by appending @file{.forwprop} to the source file name. 4187 4188@item copyrename 4189@opindex fdump-tree-copyrename 4190Dump each function after applying the copy rename optimization. The file 4191name is made by appending @file{.copyrename} to the source file name. 4192 4193@item nrv 4194@opindex fdump-tree-nrv 4195Dump each function after applying the named return value optimization on 4196generic trees. The file name is made by appending @file{.nrv} to the source 4197file name. 4198 4199@item vect 4200@opindex fdump-tree-vect 4201Dump each function after applying vectorization of loops. The file name is 4202made by appending @file{.vect} to the source file name. 4203 4204@item vrp 4205@opindex fdump-tree-vrp 4206Dump each function after Value Range Propagation (VRP). The file name 4207is made by appending @file{.vrp} to the source file name. 4208 4209@item all 4210@opindex fdump-tree-all 4211Enable all the available tree dumps with the flags provided in this option. 4212@end table 4213 4214@item -ftree-vectorizer-verbose=@var{n} 4215@opindex ftree-vectorizer-verbose 4216This option controls the amount of debugging output the vectorizer prints. 4217This information is written to standard error, unless 4218@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified, 4219in which case it is output to the usual dump listing file, @file{.vect}. 4220For @var{n}=0 no diagnostic information is reported. 4221If @var{n}=1 the vectorizer reports each loop that got vectorized, 4222and the total number of loops that got vectorized. 4223If @var{n}=2 the vectorizer also reports non-vectorized loops that passed 4224the first analysis phase (vect_analyze_loop_form) - i.e. countable, 4225inner-most, single-bb, single-entry/exit loops. This is the same verbosity 4226level that @option{-fdump-tree-vect-stats} uses. 4227Higher verbosity levels mean either more information dumped for each 4228reported loop, or same amount of information reported for more loops: 4229If @var{n}=3, alignment related information is added to the reports. 4230If @var{n}=4, data-references related information (e.g. memory dependences, 4231memory access-patterns) is added to the reports. 4232If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops 4233that did not pass the first analysis phase (i.e. may not be countable, or 4234may have complicated control-flow). 4235If @var{n}=6, the vectorizer reports also non-vectorized nested loops. 4236For @var{n}=7, all the information the vectorizer generates during its 4237analysis and transformation is reported. This is the same verbosity level 4238that @option{-fdump-tree-vect-details} uses. 4239 4240@item -frandom-seed=@var{string} 4241@opindex frandom-string 4242This option provides a seed that GCC uses when it would otherwise use 4243random numbers. It is used to generate certain symbol names 4244that have to be different in every compiled file. It is also used to 4245place unique stamps in coverage data files and the object files that 4246produce them. You can use the @option{-frandom-seed} option to produce 4247reproducibly identical object files. 4248 4249The @var{string} should be different for every file you compile. 4250 4251@item -fsched-verbose=@var{n} 4252@opindex fsched-verbose 4253On targets that use instruction scheduling, this option controls the 4254amount of debugging output the scheduler prints. This information is 4255written to standard error, unless @option{-dS} or @option{-dR} is 4256specified, in which case it is output to the usual dump 4257listing file, @file{.sched} or @file{.sched2} respectively. However 4258for @var{n} greater than nine, the output is always printed to standard 4259error. 4260 4261For @var{n} greater than zero, @option{-fsched-verbose} outputs the 4262same information as @option{-dRS}. For @var{n} greater than one, it 4263also output basic block probabilities, detailed ready list information 4264and unit/insn info. For @var{n} greater than two, it includes RTL 4265at abort point, control-flow and regions info. And for @var{n} over 4266four, @option{-fsched-verbose} also includes dependence info. 4267 4268@item -save-temps 4269@opindex save-temps 4270Store the usual ``temporary'' intermediate files permanently; place them 4271in the current directory and name them based on the source file. Thus, 4272compiling @file{foo.c} with @samp{-c -save-temps} would produce files 4273@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 4274preprocessed @file{foo.i} output file even though the compiler now 4275normally uses an integrated preprocessor. 4276 4277When used in combination with the @option{-x} command line option, 4278@option{-save-temps} is sensible enough to avoid over writing an 4279input source file with the same extension as an intermediate file. 4280The corresponding intermediate file may be obtained by renaming the 4281source file before using @option{-save-temps}. 4282 4283@item -time 4284@opindex time 4285Report the CPU time taken by each subprocess in the compilation 4286sequence. For C source files, this is the compiler proper and assembler 4287(plus the linker if linking is done). The output looks like this: 4288 4289@smallexample 4290# cc1 0.12 0.01 4291# as 0.00 0.01 4292@end smallexample 4293 4294The first number on each line is the ``user time'', that is time spent 4295executing the program itself. The second number is ``system time'', 4296time spent executing operating system routines on behalf of the program. 4297Both numbers are in seconds. 4298 4299@item -fvar-tracking 4300@opindex fvar-tracking 4301Run variable tracking pass. It computes where variables are stored at each 4302position in code. Better debugging information is then generated 4303(if the debugging information format supports this information). 4304 4305It is enabled by default when compiling with optimization (@option{-Os}, 4306@option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and 4307the debug info format supports it. 4308 4309@item -print-file-name=@var{library} 4310@opindex print-file-name 4311Print the full absolute name of the library file @var{library} that 4312would be used when linking---and don't do anything else. With this 4313option, GCC does not compile or link anything; it just prints the 4314file name. 4315 4316@item -print-multi-directory 4317@opindex print-multi-directory 4318Print the directory name corresponding to the multilib selected by any 4319other switches present in the command line. This directory is supposed 4320to exist in @env{GCC_EXEC_PREFIX}. 4321 4322@item -print-multi-lib 4323@opindex print-multi-lib 4324Print the mapping from multilib directory names to compiler switches 4325that enable them. The directory name is separated from the switches by 4326@samp{;}, and each switch starts with an @samp{@@} instead of the 4327@samp{-}, without spaces between multiple switches. This is supposed to 4328ease shell-processing. 4329 4330@item -print-prog-name=@var{program} 4331@opindex print-prog-name 4332Like @option{-print-file-name}, but searches for a program such as @samp{cpp}. 4333 4334@item -print-libgcc-file-name 4335@opindex print-libgcc-file-name 4336Same as @option{-print-file-name=libgcc.a}. 4337 4338This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 4339but you do want to link with @file{libgcc.a}. You can do 4340 4341@smallexample 4342gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 4343@end smallexample 4344 4345@item -print-search-dirs 4346@opindex print-search-dirs 4347Print the name of the configured installation directory and a list of 4348program and library directories @command{gcc} will search---and don't do anything else. 4349 4350This is useful when @command{gcc} prints the error message 4351@samp{installation problem, cannot exec cpp0: No such file or directory}. 4352To resolve this you either need to put @file{cpp0} and the other compiler 4353components where @command{gcc} expects to find them, or you can set the environment 4354variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 4355Don't forget the trailing @samp{/}. 4356@xref{Environment Variables}. 4357 4358@item -dumpmachine 4359@opindex dumpmachine 4360Print the compiler's target machine (for example, 4361@samp{i686-pc-linux-gnu})---and don't do anything else. 4362 4363@item -dumpversion 4364@opindex dumpversion 4365Print the compiler version (for example, @samp{3.0})---and don't do 4366anything else. 4367 4368@item -dumpspecs 4369@opindex dumpspecs 4370Print the compiler's built-in specs---and don't do anything else. (This 4371is used when GCC itself is being built.) @xref{Spec Files}. 4372 4373@item -feliminate-unused-debug-types 4374@opindex feliminate-unused-debug-types 4375Normally, when producing DWARF2 output, GCC will emit debugging 4376information for all types declared in a compilation 4377unit, regardless of whether or not they are actually used 4378in that compilation unit. Sometimes this is useful, such as 4379if, in the debugger, you want to cast a value to a type that is 4380not actually used in your program (but is declared). More often, 4381however, this results in a significant amount of wasted space. 4382With this option, GCC will avoid producing debug symbol output 4383for types that are nowhere used in the source file being compiled. 4384@end table 4385 4386@node Optimize Options 4387@section Options That Control Optimization 4388@cindex optimize options 4389@cindex options, optimization 4390 4391These options control various sorts of optimizations. 4392 4393Without any optimization option, the compiler's goal is to reduce the 4394cost of compilation and to make debugging produce the expected 4395results. Statements are independent: if you stop the program with a 4396breakpoint between statements, you can then assign a new value to any 4397variable or change the program counter to any other statement in the 4398function and get exactly the results you would expect from the source 4399code. 4400 4401Turning on optimization flags makes the compiler attempt to improve 4402the performance and/or code size at the expense of compilation time 4403and possibly the ability to debug the program. 4404 4405The compiler performs optimization based on the knowledge it has of 4406the program. Optimization levels @option{-O} and above, in 4407particular, enable @emph{unit-at-a-time} mode, which allows the 4408compiler to consider information gained from later functions in 4409the file when compiling a function. Compiling multiple files at 4410once to a single output file in @emph{unit-at-a-time} mode allows 4411the compiler to use information gained from all of the files when 4412compiling each of them. 4413 4414Not all optimizations are controlled directly by a flag. Only 4415optimizations that have a flag are listed. 4416 4417@table @gcctabopt 4418@item -O 4419@itemx -O1 4420@opindex O 4421@opindex O1 4422Optimize. Optimizing compilation takes somewhat more time, and a lot 4423more memory for a large function. 4424 4425With @option{-O}, the compiler tries to reduce code size and execution 4426time, without performing any optimizations that take a great deal of 4427compilation time. 4428 4429@option{-O} turns on the following optimization flags: 4430@gccoptlist{-fdefer-pop @gol 4431-fdelayed-branch @gol 4432-fguess-branch-probability @gol 4433-fcprop-registers @gol 4434-fif-conversion @gol 4435-fif-conversion2 @gol 4436-ftree-ccp @gol 4437-ftree-dce @gol 4438-ftree-dominator-opts @gol 4439-ftree-dse @gol 4440-ftree-ter @gol 4441-ftree-lrs @gol 4442-ftree-sra @gol 4443-ftree-copyrename @gol 4444-ftree-fre @gol 4445-ftree-ch @gol 4446-funit-at-a-time @gol 4447-fmerge-constants} 4448 4449@option{-O} also turns on @option{-fomit-frame-pointer} on machines 4450where doing so does not interfere with debugging. 4451 4452@item -O2 4453@opindex O2 4454Optimize even more. GCC performs nearly all supported optimizations 4455that do not involve a space-speed tradeoff. The compiler does not 4456perform loop unrolling or function inlining when you specify @option{-O2}. 4457As compared to @option{-O}, this option increases both compilation time 4458and the performance of the generated code. 4459 4460@option{-O2} turns on all optimization flags specified by @option{-O}. It 4461also turns on the following optimization flags: 4462@gccoptlist{-fthread-jumps @gol 4463-fcrossjumping @gol 4464-foptimize-sibling-calls @gol 4465-fcse-follow-jumps -fcse-skip-blocks @gol 4466-fgcse -fgcse-lm @gol 4467-fexpensive-optimizations @gol 4468-frerun-cse-after-loop @gol 4469-fcaller-saves @gol 4470-fpeephole2 @gol 4471-fschedule-insns -fschedule-insns2 @gol 4472-fsched-interblock -fsched-spec @gol 4473-fregmove @gol 4474-fstrict-aliasing -fstrict-overflow @gol 4475-fdelete-null-pointer-checks @gol 4476-freorder-blocks -freorder-functions @gol 4477-falign-functions -falign-jumps @gol 4478-falign-loops -falign-labels @gol 4479-ftree-vrp @gol 4480-ftree-pre} 4481 4482Please note the warning under @option{-fgcse} about 4483invoking @option{-O2} on programs that use computed gotos. 4484 4485@option{-O2} doesn't turn on @option{-ftree-vrp} for the Ada compiler. 4486This option must be explicitly specified on the command line to be 4487enabled for the Ada compiler. 4488 4489@item -O3 4490@opindex O3 4491Optimize yet more. @option{-O3} turns on all optimizations specified by 4492@option{-O2} and also turns on the @option{-finline-functions}, 4493@option{-funswitch-loops} and @option{-fgcse-after-reload} options. 4494 4495@item -O0 4496@opindex O0 4497Do not optimize. This is the default. 4498 4499@item -Os 4500@opindex Os 4501Optimize for size. @option{-Os} enables all @option{-O2} optimizations that 4502do not typically increase code size. It also performs further 4503optimizations designed to reduce code size. 4504 4505@option{-Os} disables the following optimization flags: 4506@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol 4507-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol 4508-fprefetch-loop-arrays -ftree-vect-loop-version} 4509 4510If you use multiple @option{-O} options, with or without level numbers, 4511the last such option is the one that is effective. 4512@end table 4513 4514Options of the form @option{-f@var{flag}} specify machine-independent 4515flags. Most flags have both positive and negative forms; the negative 4516form of @option{-ffoo} would be @option{-fno-foo}. In the table 4517below, only one of the forms is listed---the one you typically will 4518use. You can figure out the other form by either removing @samp{no-} 4519or adding it. 4520 4521The following options control specific optimizations. They are either 4522activated by @option{-O} options or are related to ones that are. You 4523can use the following flags in the rare cases when ``fine-tuning'' of 4524optimizations to be performed is desired. 4525 4526@table @gcctabopt 4527@item -fno-default-inline 4528@opindex fno-default-inline 4529Do not make member functions inline by default merely because they are 4530defined inside the class scope (C++ only). Otherwise, when you specify 4531@w{@option{-O}}, member functions defined inside class scope are compiled 4532inline by default; i.e., you don't need to add @samp{inline} in front of 4533the member function name. 4534 4535@item -fno-defer-pop 4536@opindex fno-defer-pop 4537Always pop the arguments to each function call as soon as that function 4538returns. For machines which must pop arguments after a function call, 4539the compiler normally lets arguments accumulate on the stack for several 4540function calls and pops them all at once. 4541 4542Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4543 4544@item -fforce-mem 4545@opindex fforce-mem 4546Force memory operands to be copied into registers before doing 4547arithmetic on them. This produces better code by making all memory 4548references potential common subexpressions. When they are not common 4549subexpressions, instruction combination should eliminate the separate 4550register-load. This option is now a nop and will be removed in 4.3. 4551 4552@item -fforce-addr 4553@opindex fforce-addr 4554Force memory address constants to be copied into registers before 4555doing arithmetic on them. 4556 4557@item -fomit-frame-pointer 4558@opindex fomit-frame-pointer 4559Don't keep the frame pointer in a register for functions that 4560don't need one. This avoids the instructions to save, set up and 4561restore frame pointers; it also makes an extra register available 4562in many functions. @strong{It also makes debugging impossible on 4563some machines.} 4564 4565On some machines, such as the VAX, this flag has no effect, because 4566the standard calling sequence automatically handles the frame pointer 4567and nothing is saved by pretending it doesn't exist. The 4568machine-description macro @code{FRAME_POINTER_REQUIRED} controls 4569whether a target machine supports this flag. @xref{Registers,,Register 4570Usage, gccint, GNU Compiler Collection (GCC) Internals}. 4571 4572Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4573 4574@item -foptimize-sibling-calls 4575@opindex foptimize-sibling-calls 4576Optimize sibling and tail recursive calls. 4577 4578Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4579 4580@item -fno-inline 4581@opindex fno-inline 4582Don't pay attention to the @code{inline} keyword. Normally this option 4583is used to keep the compiler from expanding any functions inline. 4584Note that if you are not optimizing, no functions can be expanded inline. 4585 4586@item -finline-functions 4587@opindex finline-functions 4588Integrate all simple functions into their callers. The compiler 4589heuristically decides which functions are simple enough to be worth 4590integrating in this way. 4591 4592If all calls to a given function are integrated, and the function is 4593declared @code{static}, then the function is normally not output as 4594assembler code in its own right. 4595 4596Enabled at level @option{-O3}. 4597 4598@item -finline-functions-called-once 4599@opindex finline-functions-called-once 4600Consider all @code{static} functions called once for inlining into their 4601caller even if they are not marked @code{inline}. If a call to a given 4602function is integrated, then the function is not output as assembler code 4603in its own right. 4604 4605Enabled if @option{-funit-at-a-time} is enabled. 4606 4607@item -fearly-inlining 4608@opindex fearly-inlining 4609Inline functions marked by @code{always_inline} and functions whose body seems 4610smaller than the function call overhead early before doing 4611@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 4612makes profiling significantly cheaper and usually inlining faster on programs 4613having large chains of nested wrapper functions. 4614 4615Enabled by default. 4616 4617@item -finline-limit=@var{n} 4618@opindex finline-limit 4619By default, GCC limits the size of functions that can be inlined. This flag 4620allows the control of this limit for functions that are explicitly marked as 4621inline (i.e., marked with the inline keyword or defined within the class 4622definition in c++). @var{n} is the size of functions that can be inlined in 4623number of pseudo instructions (not counting parameter handling). The default 4624value of @var{n} is 600. 4625Increasing this value can result in more inlined code at 4626the cost of compilation time and memory consumption. Decreasing usually makes 4627the compilation faster and less code will be inlined (which presumably 4628means slower programs). This option is particularly useful for programs that 4629use inlining heavily such as those based on recursive templates with C++. 4630 4631Inlining is actually controlled by a number of parameters, which may be 4632specified individually by using @option{--param @var{name}=@var{value}}. 4633The @option{-finline-limit=@var{n}} option sets some of these parameters 4634as follows: 4635 4636@table @gcctabopt 4637@item max-inline-insns-single 4638 is set to @var{n}/2. 4639@item max-inline-insns-auto 4640 is set to @var{n}/2. 4641@item min-inline-insns 4642 is set to 130 or @var{n}/4, whichever is smaller. 4643@item max-inline-insns-rtl 4644 is set to @var{n}. 4645@end table 4646 4647See below for a documentation of the individual 4648parameters controlling inlining. 4649 4650@emph{Note:} pseudo instruction represents, in this particular context, an 4651abstract measurement of function's size. In no way does it represent a count 4652of assembly instructions and as such its exact meaning might change from one 4653release to an another. 4654 4655@item -fkeep-inline-functions 4656@opindex fkeep-inline-functions 4657In C, emit @code{static} functions that are declared @code{inline} 4658into the object file, even if the function has been inlined into all 4659of its callers. This switch does not affect functions using the 4660@code{extern inline} extension in GNU C@. In C++, emit any and all 4661inline functions into the object file. 4662 4663@item -fkeep-static-consts 4664@opindex fkeep-static-consts 4665Emit variables declared @code{static const} when optimization isn't turned 4666on, even if the variables aren't referenced. 4667 4668GCC enables this option by default. If you want to force the compiler to 4669check if the variable was referenced, regardless of whether or not 4670optimization is turned on, use the @option{-fno-keep-static-consts} option. 4671 4672@item -fmerge-constants 4673Attempt to merge identical constants (string constants and floating point 4674constants) across compilation units. 4675 4676This option is the default for optimized compilation if the assembler and 4677linker support it. Use @option{-fno-merge-constants} to inhibit this 4678behavior. 4679 4680Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4681 4682@item -fmerge-all-constants 4683Attempt to merge identical constants and identical variables. 4684 4685This option implies @option{-fmerge-constants}. In addition to 4686@option{-fmerge-constants} this considers e.g.@: even constant initialized 4687arrays or initialized constant variables with integral or floating point 4688types. Languages like C or C++ require each non-automatic variable to 4689have distinct location, so using this option will result in non-conforming 4690behavior. 4691 4692@item -fmodulo-sched 4693@opindex fmodulo-sched 4694Perform swing modulo scheduling immediately before the first scheduling 4695pass. This pass looks at innermost loops and reorders their 4696instructions by overlapping different iterations. 4697 4698@item -fno-branch-count-reg 4699@opindex fno-branch-count-reg 4700Do not use ``decrement and branch'' instructions on a count register, 4701but instead generate a sequence of instructions that decrement a 4702register, compare it against zero, then branch based upon the result. 4703This option is only meaningful on architectures that support such 4704instructions, which include x86, PowerPC, IA-64 and S/390. 4705 4706The default is @option{-fbranch-count-reg}. 4707 4708@item -fno-function-cse 4709@opindex fno-function-cse 4710Do not put function addresses in registers; make each instruction that 4711calls a constant function contain the function's address explicitly. 4712 4713This option results in less efficient code, but some strange hacks 4714that alter the assembler output may be confused by the optimizations 4715performed when this option is not used. 4716 4717The default is @option{-ffunction-cse} 4718 4719@item -fno-zero-initialized-in-bss 4720@opindex fno-zero-initialized-in-bss 4721If the target supports a BSS section, GCC by default puts variables that 4722are initialized to zero into BSS@. This can save space in the resulting 4723code. 4724 4725This option turns off this behavior because some programs explicitly 4726rely on variables going to the data section. E.g., so that the 4727resulting executable can find the beginning of that section and/or make 4728assumptions based on that. 4729 4730The default is @option{-fzero-initialized-in-bss}. 4731 4732@item -fbounds-check 4733@opindex fbounds-check 4734For front-ends that support it, generate additional code to check that 4735indices used to access arrays are within the declared range. This is 4736currently only supported by the Java and Fortran front-ends, where 4737this option defaults to true and false respectively. 4738 4739@item -fmudflap -fmudflapth -fmudflapir 4740@opindex fmudflap 4741@opindex fmudflapth 4742@opindex fmudflapir 4743@cindex bounds checking 4744@cindex mudflap 4745For front-ends that support it (C and C++), instrument all risky 4746pointer/array dereferencing operations, some standard library 4747string/heap functions, and some other associated constructs with 4748range/validity tests. Modules so instrumented should be immune to 4749buffer overflows, invalid heap use, and some other classes of C/C++ 4750programming errors. The instrumentation relies on a separate runtime 4751library (@file{libmudflap}), which will be linked into a program if 4752@option{-fmudflap} is given at link time. Run-time behavior of the 4753instrumented program is controlled by the @env{MUDFLAP_OPTIONS} 4754environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out} 4755for its options. 4756 4757Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to 4758link if your program is multi-threaded. Use @option{-fmudflapir}, in 4759addition to @option{-fmudflap} or @option{-fmudflapth}, if 4760instrumentation should ignore pointer reads. This produces less 4761instrumentation (and therefore faster execution) and still provides 4762some protection against outright memory corrupting writes, but allows 4763erroneously read data to propagate within a program. 4764 4765@item -fthread-jumps 4766@opindex fthread-jumps 4767Perform optimizations where we check to see if a jump branches to a 4768location where another comparison subsumed by the first is found. If 4769so, the first branch is redirected to either the destination of the 4770second branch or a point immediately following it, depending on whether 4771the condition is known to be true or false. 4772 4773Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4774 4775@item -fcse-follow-jumps 4776@opindex fcse-follow-jumps 4777In common subexpression elimination, scan through jump instructions 4778when the target of the jump is not reached by any other path. For 4779example, when CSE encounters an @code{if} statement with an 4780@code{else} clause, CSE will follow the jump when the condition 4781tested is false. 4782 4783Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4784 4785@item -fcse-skip-blocks 4786@opindex fcse-skip-blocks 4787This is similar to @option{-fcse-follow-jumps}, but causes CSE to 4788follow jumps which conditionally skip over blocks. When CSE 4789encounters a simple @code{if} statement with no else clause, 4790@option{-fcse-skip-blocks} causes CSE to follow the jump around the 4791body of the @code{if}. 4792 4793Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4794 4795@item -frerun-cse-after-loop 4796@opindex frerun-cse-after-loop 4797Re-run common subexpression elimination after loop optimizations has been 4798performed. 4799 4800Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4801 4802@item -fgcse 4803@opindex fgcse 4804Perform a global common subexpression elimination pass. 4805This pass also performs global constant and copy propagation. 4806 4807@emph{Note:} When compiling a program using computed gotos, a GCC 4808extension, you may get better runtime performance if you disable 4809the global common subexpression elimination pass by adding 4810@option{-fno-gcse} to the command line. 4811 4812Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4813 4814@item -fgcse-lm 4815@opindex fgcse-lm 4816When @option{-fgcse-lm} is enabled, global common subexpression elimination will 4817attempt to move loads which are only killed by stores into themselves. This 4818allows a loop containing a load/store sequence to be changed to a load outside 4819the loop, and a copy/store within the loop. 4820 4821Enabled by default when gcse is enabled. 4822 4823@item -fgcse-sm 4824@opindex fgcse-sm 4825When @option{-fgcse-sm} is enabled, a store motion pass is run after 4826global common subexpression elimination. This pass will attempt to move 4827stores out of loops. When used in conjunction with @option{-fgcse-lm}, 4828loops containing a load/store sequence can be changed to a load before 4829the loop and a store after the loop. 4830 4831Not enabled at any optimization level. 4832 4833@item -fgcse-las 4834@opindex fgcse-las 4835When @option{-fgcse-las} is enabled, the global common subexpression 4836elimination pass eliminates redundant loads that come after stores to the 4837same memory location (both partial and full redundancies). 4838 4839Not enabled at any optimization level. 4840 4841@item -fgcse-after-reload 4842@opindex fgcse-after-reload 4843When @option{-fgcse-after-reload} is enabled, a redundant load elimination 4844pass is performed after reload. The purpose of this pass is to cleanup 4845redundant spilling. 4846 4847@item -funsafe-loop-optimizations 4848@opindex funsafe-loop-optimizations 4849If given, the loop optimizer will assume that loop indices do not 4850overflow, and that the loops with nontrivial exit condition are not 4851infinite. This enables a wider range of loop optimizations even if 4852the loop optimizer itself cannot prove that these assumptions are valid. 4853Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you 4854if it finds this kind of loop. 4855 4856@item -fcrossjumping 4857@opindex crossjumping 4858Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The 4859resulting code may or may not perform better than without cross-jumping. 4860 4861Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4862 4863@item -fif-conversion 4864@opindex if-conversion 4865Attempt to transform conditional jumps into branch-less equivalents. This 4866include use of conditional moves, min, max, set flags and abs instructions, and 4867some tricks doable by standard arithmetics. The use of conditional execution 4868on chips where it is available is controlled by @code{if-conversion2}. 4869 4870Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4871 4872@item -fif-conversion2 4873@opindex if-conversion2 4874Use conditional execution (where available) to transform conditional jumps into 4875branch-less equivalents. 4876 4877Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4878 4879@item -fdelete-null-pointer-checks 4880@opindex fdelete-null-pointer-checks 4881Use global dataflow analysis to identify and eliminate useless checks 4882for null pointers. The compiler assumes that dereferencing a null 4883pointer would have halted the program. If a pointer is checked after 4884it has already been dereferenced, it cannot be null. 4885 4886In some environments, this assumption is not true, and programs can 4887safely dereference null pointers. Use 4888@option{-fno-delete-null-pointer-checks} to disable this optimization 4889for programs which depend on that behavior. 4890 4891Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4892 4893@item -fexpensive-optimizations 4894@opindex fexpensive-optimizations 4895Perform a number of minor optimizations that are relatively expensive. 4896 4897Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4898 4899@item -foptimize-register-move 4900@itemx -fregmove 4901@opindex foptimize-register-move 4902@opindex fregmove 4903Attempt to reassign register numbers in move instructions and as 4904operands of other simple instructions in order to maximize the amount of 4905register tying. This is especially helpful on machines with two-operand 4906instructions. 4907 4908Note @option{-fregmove} and @option{-foptimize-register-move} are the same 4909optimization. 4910 4911Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4912 4913@item -fdelayed-branch 4914@opindex fdelayed-branch 4915If supported for the target machine, attempt to reorder instructions 4916to exploit instruction slots available after delayed branch 4917instructions. 4918 4919Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4920 4921@item -fschedule-insns 4922@opindex fschedule-insns 4923If supported for the target machine, attempt to reorder instructions to 4924eliminate execution stalls due to required data being unavailable. This 4925helps machines that have slow floating point or memory load instructions 4926by allowing other instructions to be issued until the result of the load 4927or floating point instruction is required. 4928 4929Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4930 4931@item -fschedule-insns2 4932@opindex fschedule-insns2 4933Similar to @option{-fschedule-insns}, but requests an additional pass of 4934instruction scheduling after register allocation has been done. This is 4935especially useful on machines with a relatively small number of 4936registers and where memory load instructions take more than one cycle. 4937 4938Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4939 4940@item -fno-sched-interblock 4941@opindex fno-sched-interblock 4942Don't schedule instructions across basic blocks. This is normally 4943enabled by default when scheduling before register allocation, i.e.@: 4944with @option{-fschedule-insns} or at @option{-O2} or higher. 4945 4946@item -fno-sched-spec 4947@opindex fno-sched-spec 4948Don't allow speculative motion of non-load instructions. This is normally 4949enabled by default when scheduling before register allocation, i.e.@: 4950with @option{-fschedule-insns} or at @option{-O2} or higher. 4951 4952@item -fsched-spec-load 4953@opindex fsched-spec-load 4954Allow speculative motion of some load instructions. This only makes 4955sense when scheduling before register allocation, i.e.@: with 4956@option{-fschedule-insns} or at @option{-O2} or higher. 4957 4958@item -fsched-spec-load-dangerous 4959@opindex fsched-spec-load-dangerous 4960Allow speculative motion of more load instructions. This only makes 4961sense when scheduling before register allocation, i.e.@: with 4962@option{-fschedule-insns} or at @option{-O2} or higher. 4963 4964@item -fsched-stalled-insns=@var{n} 4965@opindex fsched-stalled-insns 4966Define how many insns (if any) can be moved prematurely from the queue 4967of stalled insns into the ready list, during the second scheduling pass. 4968 4969@item -fsched-stalled-insns-dep=@var{n} 4970@opindex fsched-stalled-insns-dep 4971Define how many insn groups (cycles) will be examined for a dependency 4972on a stalled insn that is candidate for premature removal from the queue 4973of stalled insns. Has an effect only during the second scheduling pass, 4974and only if @option{-fsched-stalled-insns} is used and its value is not zero. 4975 4976@item -fsched2-use-superblocks 4977@opindex fsched2-use-superblocks 4978When scheduling after register allocation, do use superblock scheduling 4979algorithm. Superblock scheduling allows motion across basic block boundaries 4980resulting on faster schedules. This option is experimental, as not all machine 4981descriptions used by GCC model the CPU closely enough to avoid unreliable 4982results from the algorithm. 4983 4984This only makes sense when scheduling after register allocation, i.e.@: with 4985@option{-fschedule-insns2} or at @option{-O2} or higher. 4986 4987@item -fsched2-use-traces 4988@opindex fsched2-use-traces 4989Use @option{-fsched2-use-superblocks} algorithm when scheduling after register 4990allocation and additionally perform code duplication in order to increase the 4991size of superblocks using tracer pass. See @option{-ftracer} for details on 4992trace formation. 4993 4994This mode should produce faster but significantly longer programs. Also 4995without @option{-fbranch-probabilities} the traces constructed may not 4996match the reality and hurt the performance. This only makes 4997sense when scheduling after register allocation, i.e.@: with 4998@option{-fschedule-insns2} or at @option{-O2} or higher. 4999 5000@item -fsee 5001@opindex fsee 5002Eliminates redundant extension instructions and move the non redundant 5003ones to optimal placement using LCM. 5004 5005@item -freschedule-modulo-scheduled-loops 5006@opindex fscheduling-in-modulo-scheduled-loops 5007The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled 5008we may want to prevent the later scheduling passes from changing its schedule, we use this 5009option to control that. 5010 5011@item -fcaller-saves 5012@opindex fcaller-saves 5013Enable values to be allocated in registers that will be clobbered by 5014function calls, by emitting extra instructions to save and restore the 5015registers around such calls. Such allocation is done only when it 5016seems to result in better code than would otherwise be produced. 5017 5018This option is always enabled by default on certain machines, usually 5019those which have no call-preserved registers to use instead. 5020 5021Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5022 5023@item -ftree-pre 5024Perform Partial Redundancy Elimination (PRE) on trees. This flag is 5025enabled by default at @option{-O2} and @option{-O3}. 5026 5027@item -ftree-fre 5028Perform Full Redundancy Elimination (FRE) on trees. The difference 5029between FRE and PRE is that FRE only considers expressions 5030that are computed on all paths leading to the redundant computation. 5031This analysis faster than PRE, though it exposes fewer redundancies. 5032This flag is enabled by default at @option{-O} and higher. 5033 5034@item -ftree-copy-prop 5035Perform copy propagation on trees. This pass eliminates unnecessary 5036copy operations. This flag is enabled by default at @option{-O} and 5037higher. 5038 5039@item -ftree-store-copy-prop 5040Perform copy propagation of memory loads and stores. This pass 5041eliminates unnecessary copy operations in memory references 5042(structures, global variables, arrays, etc). This flag is enabled by 5043default at @option{-O2} and higher. 5044 5045@item -ftree-salias 5046Perform structural alias analysis on trees. This flag 5047is enabled by default at @option{-O} and higher. 5048 5049@item -fipa-pta 5050Perform interprocedural pointer analysis. 5051 5052@item -ftree-sink 5053Perform forward store motion on trees. This flag is 5054enabled by default at @option{-O} and higher. 5055 5056@item -ftree-ccp 5057Perform sparse conditional constant propagation (CCP) on trees. This 5058pass only operates on local scalar variables and is enabled by default 5059at @option{-O} and higher. 5060 5061@item -ftree-store-ccp 5062Perform sparse conditional constant propagation (CCP) on trees. This 5063pass operates on both local scalar variables and memory stores and 5064loads (global variables, structures, arrays, etc). This flag is 5065enabled by default at @option{-O2} and higher. 5066 5067@item -ftree-dce 5068Perform dead code elimination (DCE) on trees. This flag is enabled by 5069default at @option{-O} and higher. 5070 5071@item -ftree-dominator-opts 5072Perform a variety of simple scalar cleanups (constant/copy 5073propagation, redundancy elimination, range propagation and expression 5074simplification) based on a dominator tree traversal. This also 5075performs jump threading (to reduce jumps to jumps). This flag is 5076enabled by default at @option{-O} and higher. 5077 5078@item -ftree-ch 5079Perform loop header copying on trees. This is beneficial since it increases 5080effectiveness of code motion optimizations. It also saves one jump. This flag 5081is enabled by default at @option{-O} and higher. It is not enabled 5082for @option{-Os}, since it usually increases code size. 5083 5084@item -ftree-loop-optimize 5085Perform loop optimizations on trees. This flag is enabled by default 5086at @option{-O} and higher. 5087 5088@item -ftree-loop-linear 5089Perform linear loop transformations on tree. This flag can improve cache 5090performance and allow further loop optimizations to take place. 5091 5092@item -ftree-loop-im 5093Perform loop invariant motion on trees. This pass moves only invariants that 5094would be hard to handle at RTL level (function calls, operations that expand to 5095nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 5096operands of conditions that are invariant out of the loop, so that we can use 5097just trivial invariantness analysis in loop unswitching. The pass also includes 5098store motion. 5099 5100@item -ftree-loop-ivcanon 5101Create a canonical counter for number of iterations in the loop for that 5102determining number of iterations requires complicated analysis. Later 5103optimizations then may determine the number easily. Useful especially 5104in connection with unrolling. 5105 5106@item -fivopts 5107Perform induction variable optimizations (strength reduction, induction 5108variable merging and induction variable elimination) on trees. 5109 5110@item -ftree-sra 5111Perform scalar replacement of aggregates. This pass replaces structure 5112references with scalars to prevent committing structures to memory too 5113early. This flag is enabled by default at @option{-O} and higher. 5114 5115@item -ftree-copyrename 5116Perform copy renaming on trees. This pass attempts to rename compiler 5117temporaries to other variables at copy locations, usually resulting in 5118variable names which more closely resemble the original variables. This flag 5119is enabled by default at @option{-O} and higher. 5120 5121@item -ftree-ter 5122Perform temporary expression replacement during the SSA->normal phase. Single 5123use/single def temporaries are replaced at their use location with their 5124defining expression. This results in non-GIMPLE code, but gives the expanders 5125much more complex trees to work on resulting in better RTL generation. This is 5126enabled by default at @option{-O} and higher. 5127 5128@item -ftree-lrs 5129Perform live range splitting during the SSA->normal phase. Distinct live 5130ranges of a variable are split into unique variables, allowing for better 5131optimization later. This is enabled by default at @option{-O} and higher. 5132 5133@item -ftree-vectorize 5134Perform loop vectorization on trees. 5135 5136@item -ftree-vect-loop-version 5137@opindex ftree-vect-loop-version 5138Perform loop versioning when doing loop vectorization on trees. When a loop 5139appears to be vectorizable except that data alignment or data dependence cannot 5140be determined at compile time then vectorized and non-vectorized versions of 5141the loop are generated along with runtime checks for alignment or dependence 5142to control which version is executed. This option is enabled by default 5143except at level @option{-Os} where it is disabled. 5144 5145@item -ftree-vrp 5146Perform Value Range Propagation on trees. This is similar to the 5147constant propagation pass, but instead of values, ranges of values are 5148propagated. This allows the optimizers to remove unnecessary range 5149checks like array bound checks and null pointer checks. This is 5150enabled by default at @option{-O2} and higher. Null pointer check 5151elimination is only done if @option{-fdelete-null-pointer-checks} is 5152enabled. 5153 5154@item -ftracer 5155@opindex ftracer 5156Perform tail duplication to enlarge superblock size. This transformation 5157simplifies the control flow of the function allowing other optimizations to do 5158better job. 5159 5160@item -funroll-loops 5161@opindex funroll-loops 5162Unroll loops whose number of iterations can be determined at compile 5163time or upon entry to the loop. @option{-funroll-loops} implies 5164@option{-frerun-cse-after-loop}. This option makes code larger, 5165and may or may not make it run faster. 5166 5167@item -funroll-all-loops 5168@opindex funroll-all-loops 5169Unroll all loops, even if their number of iterations is uncertain when 5170the loop is entered. This usually makes programs run more slowly. 5171@option{-funroll-all-loops} implies the same options as 5172@option{-funroll-loops}, 5173 5174@item -fsplit-ivs-in-unroller 5175@opindex fsplit-ivs-in-unroller 5176Enables expressing of values of induction variables in later iterations 5177of the unrolled loop using the value in the first iteration. This breaks 5178long dependency chains, thus improving efficiency of the scheduling passes. 5179 5180Combination of @option{-fweb} and CSE is often sufficient to obtain the 5181same effect. However in cases the loop body is more complicated than 5182a single basic block, this is not reliable. It also does not work at all 5183on some of the architectures due to restrictions in the CSE pass. 5184 5185This optimization is enabled by default. 5186 5187@item -fvariable-expansion-in-unroller 5188@opindex fvariable-expansion-in-unroller 5189With this option, the compiler will create multiple copies of some 5190local variables when unrolling a loop which can result in superior code. 5191 5192@item -fprefetch-loop-arrays 5193@opindex fprefetch-loop-arrays 5194If supported by the target machine, generate instructions to prefetch 5195memory to improve the performance of loops that access large arrays. 5196 5197This option may generate better or worse code; results are highly 5198dependent on the structure of loops within the source code. 5199 5200Disabled at level @option{-Os}. 5201 5202@item -fno-peephole 5203@itemx -fno-peephole2 5204@opindex fno-peephole 5205@opindex fno-peephole2 5206Disable any machine-specific peephole optimizations. The difference 5207between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 5208are implemented in the compiler; some targets use one, some use the 5209other, a few use both. 5210 5211@option{-fpeephole} is enabled by default. 5212@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5213 5214@item -fno-guess-branch-probability 5215@opindex fno-guess-branch-probability 5216Do not guess branch probabilities using heuristics. 5217 5218GCC will use heuristics to guess branch probabilities if they are 5219not provided by profiling feedback (@option{-fprofile-arcs}). These 5220heuristics are based on the control flow graph. If some branch probabilities 5221are specified by @samp{__builtin_expect}, then the heuristics will be 5222used to guess branch probabilities for the rest of the control flow graph, 5223taking the @samp{__builtin_expect} info into account. The interactions 5224between the heuristics and @samp{__builtin_expect} can be complex, and in 5225some cases, it may be useful to disable the heuristics so that the effects 5226of @samp{__builtin_expect} are easier to understand. 5227 5228The default is @option{-fguess-branch-probability} at levels 5229@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5230 5231@item -freorder-blocks 5232@opindex freorder-blocks 5233Reorder basic blocks in the compiled function in order to reduce number of 5234taken branches and improve code locality. 5235 5236Enabled at levels @option{-O2}, @option{-O3}. 5237 5238@item -freorder-blocks-and-partition 5239@opindex freorder-blocks-and-partition 5240In addition to reordering basic blocks in the compiled function, in order 5241to reduce number of taken branches, partitions hot and cold basic blocks 5242into separate sections of the assembly and .o files, to improve 5243paging and cache locality performance. 5244 5245This optimization is automatically turned off in the presence of 5246exception handling, for linkonce sections, for functions with a user-defined 5247section attribute and on any architecture that does not support named 5248sections. 5249 5250@item -freorder-functions 5251@opindex freorder-functions 5252Reorder functions in the object file in order to 5253improve code locality. This is implemented by using special 5254subsections @code{.text.hot} for most frequently executed functions and 5255@code{.text.unlikely} for unlikely executed functions. Reordering is done by 5256the linker so object file format must support named sections and linker must 5257place them in a reasonable way. 5258 5259Also profile feedback must be available in to make this option effective. See 5260@option{-fprofile-arcs} for details. 5261 5262Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5263 5264@item -fstrict-aliasing 5265@opindex fstrict-aliasing 5266Allows the compiler to assume the strictest aliasing rules applicable to 5267the language being compiled. For C (and C++), this activates 5268optimizations based on the type of expressions. In particular, an 5269object of one type is assumed never to reside at the same address as an 5270object of a different type, unless the types are almost the same. For 5271example, an @code{unsigned int} can alias an @code{int}, but not a 5272@code{void*} or a @code{double}. A character type may alias any other 5273type. 5274 5275Pay special attention to code like this: 5276@smallexample 5277union a_union @{ 5278 int i; 5279 double d; 5280@}; 5281 5282int f() @{ 5283 a_union t; 5284 t.d = 3.0; 5285 return t.i; 5286@} 5287@end smallexample 5288The practice of reading from a different union member than the one most 5289recently written to (called ``type-punning'') is common. Even with 5290@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 5291is accessed through the union type. So, the code above will work as 5292expected. However, this code might not: 5293@smallexample 5294int f() @{ 5295 a_union t; 5296 int* ip; 5297 t.d = 3.0; 5298 ip = &t.i; 5299 return *ip; 5300@} 5301@end smallexample 5302 5303Every language that wishes to perform language-specific alias analysis 5304should define a function that computes, given an @code{tree} 5305node, an alias set for the node. Nodes in different alias sets are not 5306allowed to alias. For an example, see the C front-end function 5307@code{c_get_alias_set}. 5308 5309Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5310 5311@item -fstrict-overflow 5312@opindex fstrict-overflow 5313Allow the compiler to assume strict signed overflow rules, depending 5314on the language being compiled. For C (and C++) this means that 5315overflow when doing arithmetic with signed numbers is undefined, which 5316means that the compiler may assume that it will not happen. This 5317permits various optimizations. For example, the compiler will assume 5318that an expression like @code{i + 10 > i} will always be true for 5319signed @code{i}. This assumption is only valid if signed overflow is 5320undefined, as the expression is false if @code{i + 10} overflows when 5321using twos complement arithmetic. When this option is in effect any 5322attempt to determine whether an operation on signed numbers will 5323overflow must be written carefully to not actually involve overflow. 5324 5325See also the @option{-fwrapv} option. Using @option{-fwrapv} means 5326that signed overflow is fully defined: it wraps. When 5327@option{-fwrapv} is used, there is no difference between 5328@option{-fstrict-overflow} and @option{-fno-strict-overflow}. With 5329@option{-fwrapv} certain types of overflow are permitted. For 5330example, if the compiler gets an overflow when doing arithmetic on 5331constants, the overflowed value can still be used with 5332@option{-fwrapv}, but not otherwise. 5333 5334The @option{-fstrict-overflow} option is enabled at levels 5335@option{-O2}, @option{-O3}, @option{-Os}. 5336 5337@item -falign-functions 5338@itemx -falign-functions=@var{n} 5339@opindex falign-functions 5340Align the start of functions to the next power-of-two greater than 5341@var{n}, skipping up to @var{n} bytes. For instance, 5342@option{-falign-functions=32} aligns functions to the next 32-byte 5343boundary, but @option{-falign-functions=24} would align to the next 534432-byte boundary only if this can be done by skipping 23 bytes or less. 5345 5346@option{-fno-align-functions} and @option{-falign-functions=1} are 5347equivalent and mean that functions will not be aligned. 5348 5349Some assemblers only support this flag when @var{n} is a power of two; 5350in that case, it is rounded up. 5351 5352If @var{n} is not specified or is zero, use a machine-dependent default. 5353 5354Enabled at levels @option{-O2}, @option{-O3}. 5355 5356@item -falign-labels 5357@itemx -falign-labels=@var{n} 5358@opindex falign-labels 5359Align all branch targets to a power-of-two boundary, skipping up to 5360@var{n} bytes like @option{-falign-functions}. This option can easily 5361make code slower, because it must insert dummy operations for when the 5362branch target is reached in the usual flow of the code. 5363 5364@option{-fno-align-labels} and @option{-falign-labels=1} are 5365equivalent and mean that labels will not be aligned. 5366 5367If @option{-falign-loops} or @option{-falign-jumps} are applicable and 5368are greater than this value, then their values are used instead. 5369 5370If @var{n} is not specified or is zero, use a machine-dependent default 5371which is very likely to be @samp{1}, meaning no alignment. 5372 5373Enabled at levels @option{-O2}, @option{-O3}. 5374 5375@item -falign-loops 5376@itemx -falign-loops=@var{n} 5377@opindex falign-loops 5378Align loops to a power-of-two boundary, skipping up to @var{n} bytes 5379like @option{-falign-functions}. The hope is that the loop will be 5380executed many times, which will make up for any execution of the dummy 5381operations. 5382 5383@option{-fno-align-loops} and @option{-falign-loops=1} are 5384equivalent and mean that loops will not be aligned. 5385 5386If @var{n} is not specified or is zero, use a machine-dependent default. 5387 5388Enabled at levels @option{-O2}, @option{-O3}. 5389 5390@item -falign-jumps 5391@itemx -falign-jumps=@var{n} 5392@opindex falign-jumps 5393Align branch targets to a power-of-two boundary, for branch targets 5394where the targets can only be reached by jumping, skipping up to @var{n} 5395bytes like @option{-falign-functions}. In this case, no dummy operations 5396need be executed. 5397 5398@option{-fno-align-jumps} and @option{-falign-jumps=1} are 5399equivalent and mean that loops will not be aligned. 5400 5401If @var{n} is not specified or is zero, use a machine-dependent default. 5402 5403Enabled at levels @option{-O2}, @option{-O3}. 5404 5405@item -funit-at-a-time 5406@opindex funit-at-a-time 5407Parse the whole compilation unit before starting to produce code. 5408This allows some extra optimizations to take place but consumes 5409more memory (in general). There are some compatibility issues 5410with @emph{unit-at-a-time} mode: 5411@itemize @bullet 5412@item 5413enabling @emph{unit-at-a-time} mode may change the order 5414in which functions, variables, and top-level @code{asm} statements 5415are emitted, and will likely break code relying on some particular 5416ordering. The majority of such top-level @code{asm} statements, 5417though, can be replaced by @code{section} attributes. The 5418@option{fno-toplevel-reorder} option may be used to keep the ordering 5419used in the input file, at the cost of some optimizations. 5420 5421@item 5422@emph{unit-at-a-time} mode removes unreferenced static variables 5423and functions. This may result in undefined references 5424when an @code{asm} statement refers directly to variables or functions 5425that are otherwise unused. In that case either the variable/function 5426shall be listed as an operand of the @code{asm} statement operand or, 5427in the case of top-level @code{asm} statements the attribute @code{used} 5428shall be used on the declaration. 5429 5430@item 5431Static functions now can use non-standard passing conventions that 5432may break @code{asm} statements calling functions directly. Again, 5433attribute @code{used} will prevent this behavior. 5434@end itemize 5435 5436As a temporary workaround, @option{-fno-unit-at-a-time} can be used, 5437but this scheme may not be supported by future releases of GCC@. 5438 5439Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5440 5441@item -fno-toplevel-reorder 5442Do not reorder top-level functions, variables, and @code{asm} 5443statements. Output them in the same order that they appear in the 5444input file. When this option is used, unreferenced static variables 5445will not be removed. This option is intended to support existing code 5446which relies on a particular ordering. For new code, it is better to 5447use attributes. 5448 5449@item -fweb 5450@opindex fweb 5451Constructs webs as commonly used for register allocation purposes and assign 5452each web individual pseudo register. This allows the register allocation pass 5453to operate on pseudos directly, but also strengthens several other optimization 5454passes, such as CSE, loop optimizer and trivial dead code remover. It can, 5455however, make debugging impossible, since variables will no longer stay in a 5456``home register''. 5457 5458Enabled by default with @option{-funroll-loops}. 5459 5460@item -fwhole-program 5461@opindex fwhole-program 5462Assume that the current compilation unit represents whole program being 5463compiled. All public functions and variables with the exception of @code{main} 5464and those merged by attribute @code{externally_visible} become static functions 5465and in a affect gets more aggressively optimized by interprocedural optimizers. 5466While this option is equivalent to proper use of @code{static} keyword for 5467programs consisting of single file, in combination with option 5468@option{--combine} this flag can be used to compile most of smaller scale C 5469programs since the functions and variables become local for the whole combined 5470compilation unit, not for the single source file itself. 5471 5472 5473@item -fno-cprop-registers 5474@opindex fno-cprop-registers 5475After register allocation and post-register allocation instruction splitting, 5476we perform a copy-propagation pass to try to reduce scheduling dependencies 5477and occasionally eliminate the copy. 5478 5479Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5480 5481@item -fprofile-generate 5482@opindex fprofile-generate 5483 5484Enable options usually used for instrumenting application to produce 5485profile useful for later recompilation with profile feedback based 5486optimization. You must use @option{-fprofile-generate} both when 5487compiling and when linking your program. 5488 5489The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}. 5490 5491@item -fprofile-use 5492@opindex fprofile-use 5493Enable profile feedback directed optimizations, and optimizations 5494generally profitable only with profile feedback available. 5495 5496The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt}, 5497@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer} 5498 5499@end table 5500 5501The following options control compiler behavior regarding floating 5502point arithmetic. These options trade off between speed and 5503correctness. All must be specifically enabled. 5504 5505@table @gcctabopt 5506@item -ffloat-store 5507@opindex ffloat-store 5508Do not store floating point variables in registers, and inhibit other 5509options that might change whether a floating point value is taken from a 5510register or memory. 5511 5512@cindex floating point precision 5513This option prevents undesirable excess precision on machines such as 5514the 68000 where the floating registers (of the 68881) keep more 5515precision than a @code{double} is supposed to have. Similarly for the 5516x86 architecture. For most programs, the excess precision does only 5517good, but a few programs rely on the precise definition of IEEE floating 5518point. Use @option{-ffloat-store} for such programs, after modifying 5519them to store all pertinent intermediate computations into variables. 5520 5521@item -ffast-math 5522@opindex ffast-math 5523Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @* 5524@option{-fno-trapping-math}, @option{-ffinite-math-only}, 5525@option{-fno-rounding-math}, @option{-fno-signaling-nans} 5526and @option{fcx-limited-range}. 5527 5528This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 5529 5530This option should never be turned on by any @option{-O} option since 5531it can result in incorrect output for programs which depend on 5532an exact implementation of IEEE or ISO rules/specifications for 5533math functions. 5534 5535@item -fno-math-errno 5536@opindex fno-math-errno 5537Do not set ERRNO after calling math functions that are executed 5538with a single instruction, e.g., sqrt. A program that relies on 5539IEEE exceptions for math error handling may want to use this flag 5540for speed while maintaining IEEE arithmetic compatibility. 5541 5542This option should never be turned on by any @option{-O} option since 5543it can result in incorrect output for programs which depend on 5544an exact implementation of IEEE or ISO rules/specifications for 5545math functions. 5546 5547The default is @option{-fmath-errno}. 5548 5549On Darwin and FreeBSD systems, the math library never sets @code{errno}. 5550There is therefore 5551no reason for the compiler to consider the possibility that it might, 5552and @option{-fno-math-errno} is the default. 5553 5554@item -funsafe-math-optimizations 5555@opindex funsafe-math-optimizations 5556Allow optimizations for floating-point arithmetic that (a) assume 5557that arguments and results are valid and (b) may violate IEEE or 5558ANSI standards. When used at link-time, it may include libraries 5559or startup files that change the default FPU control word or other 5560similar optimizations. 5561 5562This option should never be turned on by any @option{-O} option since 5563it can result in incorrect output for programs which depend on 5564an exact implementation of IEEE or ISO rules/specifications for 5565math functions. 5566 5567The default is @option{-fno-unsafe-math-optimizations}. 5568 5569@item -ffinite-math-only 5570@opindex ffinite-math-only 5571Allow optimizations for floating-point arithmetic that assume 5572that arguments and results are not NaNs or +-Infs. 5573 5574This option should never be turned on by any @option{-O} option since 5575it can result in incorrect output for programs which depend on 5576an exact implementation of IEEE or ISO rules/specifications. 5577 5578The default is @option{-fno-finite-math-only}. 5579 5580@item -fno-trapping-math 5581@opindex fno-trapping-math 5582Compile code assuming that floating-point operations cannot generate 5583user-visible traps. These traps include division by zero, overflow, 5584underflow, inexact result and invalid operation. This option implies 5585@option{-fno-signaling-nans}. Setting this option may allow faster 5586code if one relies on ``non-stop'' IEEE arithmetic, for example. 5587 5588This option should never be turned on by any @option{-O} option since 5589it can result in incorrect output for programs which depend on 5590an exact implementation of IEEE or ISO rules/specifications for 5591math functions. 5592 5593The default is @option{-ftrapping-math}. 5594 5595@item -frounding-math 5596@opindex frounding-math 5597Disable transformations and optimizations that assume default floating 5598point rounding behavior. This is round-to-zero for all floating point 5599to integer conversions, and round-to-nearest for all other arithmetic 5600truncations. This option should be specified for programs that change 5601the FP rounding mode dynamically, or that may be executed with a 5602non-default rounding mode. This option disables constant folding of 5603floating point expressions at compile-time (which may be affected by 5604rounding mode) and arithmetic transformations that are unsafe in the 5605presence of sign-dependent rounding modes. 5606 5607The default is @option{-fno-rounding-math}. 5608 5609This option is experimental and does not currently guarantee to 5610disable all GCC optimizations that are affected by rounding mode. 5611Future versions of GCC may provide finer control of this setting 5612using C99's @code{FENV_ACCESS} pragma. This command line option 5613will be used to specify the default state for @code{FENV_ACCESS}. 5614 5615@item -frtl-abstract-sequences 5616@opindex frtl-abstract-sequences 5617It is a size optimization method. This option is to find identical 5618sequences of code, which can be turned into pseudo-procedures and 5619then replace all occurrences with calls to the newly created 5620subroutine. It is kind of an opposite of @option{-finline-functions}. 5621This optimization runs at RTL level. 5622 5623@item -fsignaling-nans 5624@opindex fsignaling-nans 5625Compile code assuming that IEEE signaling NaNs may generate user-visible 5626traps during floating-point operations. Setting this option disables 5627optimizations that may change the number of exceptions visible with 5628signaling NaNs. This option implies @option{-ftrapping-math}. 5629 5630This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 5631be defined. 5632 5633The default is @option{-fno-signaling-nans}. 5634 5635This option is experimental and does not currently guarantee to 5636disable all GCC optimizations that affect signaling NaN behavior. 5637 5638@item -fsingle-precision-constant 5639@opindex fsingle-precision-constant 5640Treat floating point constant as single precision constant instead of 5641implicitly converting it to double precision constant. 5642 5643@item -fcx-limited-range 5644@itemx -fno-cx-limited-range 5645@opindex fcx-limited-range 5646@opindex fno-cx-limited-range 5647When enabled, this option states that a range reduction step is not 5648needed when performing complex division. The default is 5649@option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}. 5650 5651This option controls the default setting of the ISO C99 5652@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 5653all languages. 5654 5655@end table 5656 5657The following options control optimizations that may improve 5658performance, but are not enabled by any @option{-O} options. This 5659section includes experimental options that may produce broken code. 5660 5661@table @gcctabopt 5662@item -fbranch-probabilities 5663@opindex fbranch-probabilities 5664After running a program compiled with @option{-fprofile-arcs} 5665(@pxref{Debugging Options,, Options for Debugging Your Program or 5666@command{gcc}}), you can compile it a second time using 5667@option{-fbranch-probabilities}, to improve optimizations based on 5668the number of times each branch was taken. When the program 5669compiled with @option{-fprofile-arcs} exits it saves arc execution 5670counts to a file called @file{@var{sourcename}.gcda} for each source 5671file The information in this data file is very dependent on the 5672structure of the generated code, so you must use the same source code 5673and the same optimization options for both compilations. 5674 5675With @option{-fbranch-probabilities}, GCC puts a 5676@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 5677These can be used to improve optimization. Currently, they are only 5678used in one place: in @file{reorg.c}, instead of guessing which path a 5679branch is mostly to take, the @samp{REG_BR_PROB} values are used to 5680exactly determine which path is taken more often. 5681 5682@item -fprofile-values 5683@opindex fprofile-values 5684If combined with @option{-fprofile-arcs}, it adds code so that some 5685data about values of expressions in the program is gathered. 5686 5687With @option{-fbranch-probabilities}, it reads back the data gathered 5688from profiling values of expressions and adds @samp{REG_VALUE_PROFILE} 5689notes to instructions for their later usage in optimizations. 5690 5691Enabled with @option{-fprofile-generate} and @option{-fprofile-use}. 5692 5693@item -fvpt 5694@opindex fvpt 5695If combined with @option{-fprofile-arcs}, it instructs the compiler to add 5696a code to gather information about values of expressions. 5697 5698With @option{-fbranch-probabilities}, it reads back the data gathered 5699and actually performs the optimizations based on them. 5700Currently the optimizations include specialization of division operation 5701using the knowledge about the value of the denominator. 5702 5703@item -frename-registers 5704@opindex frename-registers 5705Attempt to avoid false dependencies in scheduled code by making use 5706of registers left over after register allocation. This optimization 5707will most benefit processors with lots of registers. Depending on the 5708debug information format adopted by the target, however, it can 5709make debugging impossible, since variables will no longer stay in 5710a ``home register''. 5711 5712Enabled by default with @option{-funroll-loops}. 5713 5714@item -ftracer 5715@opindex ftracer 5716Perform tail duplication to enlarge superblock size. This transformation 5717simplifies the control flow of the function allowing other optimizations to do 5718better job. 5719 5720Enabled with @option{-fprofile-use}. 5721 5722@item -funroll-loops 5723@opindex funroll-loops 5724Unroll loops whose number of iterations can be determined at compile time or 5725upon entry to the loop. @option{-funroll-loops} implies 5726@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 5727It also turns on complete loop peeling (i.e.@: complete removal of loops with 5728small constant number of iterations). This option makes code larger, and may 5729or may not make it run faster. 5730 5731Enabled with @option{-fprofile-use}. 5732 5733@item -funroll-all-loops 5734@opindex funroll-all-loops 5735Unroll all loops, even if their number of iterations is uncertain when 5736the loop is entered. This usually makes programs run more slowly. 5737@option{-funroll-all-loops} implies the same options as 5738@option{-funroll-loops}. 5739 5740@item -fpeel-loops 5741@opindex fpeel-loops 5742Peels the loops for that there is enough information that they do not 5743roll much (from profile feedback). It also turns on complete loop peeling 5744(i.e.@: complete removal of loops with small constant number of iterations). 5745 5746Enabled with @option{-fprofile-use}. 5747 5748@item -fmove-loop-invariants 5749@opindex fmove-loop-invariants 5750Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 5751at level @option{-O1} 5752 5753@item -funswitch-loops 5754@opindex funswitch-loops 5755Move branches with loop invariant conditions out of the loop, with duplicates 5756of the loop on both branches (modified according to result of the condition). 5757 5758@item -ffunction-sections 5759@itemx -fdata-sections 5760@opindex ffunction-sections 5761@opindex fdata-sections 5762Place each function or data item into its own section in the output 5763file if the target supports arbitrary sections. The name of the 5764function or the name of the data item determines the section's name 5765in the output file. 5766 5767Use these options on systems where the linker can perform optimizations 5768to improve locality of reference in the instruction space. Most systems 5769using the ELF object format and SPARC processors running Solaris 2 have 5770linkers with such optimizations. AIX may have these optimizations in 5771the future. 5772 5773Only use these options when there are significant benefits from doing 5774so. When you specify these options, the assembler and linker will 5775create larger object and executable files and will also be slower. 5776You will not be able to use @code{gprof} on all systems if you 5777specify this option and you may have problems with debugging if 5778you specify both this option and @option{-g}. 5779 5780@item -fbranch-target-load-optimize 5781@opindex fbranch-target-load-optimize 5782Perform branch target register load optimization before prologue / epilogue 5783threading. 5784The use of target registers can typically be exposed only during reload, 5785thus hoisting loads out of loops and doing inter-block scheduling needs 5786a separate optimization pass. 5787 5788@item -fbranch-target-load-optimize2 5789@opindex fbranch-target-load-optimize2 5790Perform branch target register load optimization after prologue / epilogue 5791threading. 5792 5793@item -fbtr-bb-exclusive 5794@opindex fbtr-bb-exclusive 5795When performing branch target register load optimization, don't reuse 5796branch target registers in within any basic block. 5797 5798@item -fstack-protector 5799Emit extra code to check for buffer overflows, such as stack smashing 5800attacks. This is done by adding a guard variable to functions with 5801vulnerable objects. This includes functions that call alloca, and 5802functions with buffers larger than 8 bytes. The guards are initialized 5803when a function is entered and then checked when the function exits. 5804If a guard check fails, an error message is printed and the program exits. 5805 5806@item -fstack-protector-all 5807Like @option{-fstack-protector} except that all functions are protected. 5808 5809@item -fsection-anchors 5810@opindex fsection-anchors 5811Try to reduce the number of symbolic address calculations by using 5812shared ``anchor'' symbols to address nearby objects. This transformation 5813can help to reduce the number of GOT entries and GOT accesses on some 5814targets. 5815 5816For example, the implementation of the following function @code{foo}: 5817 5818@smallexample 5819static int a, b, c; 5820int foo (void) @{ return a + b + c; @} 5821@end smallexample 5822 5823would usually calculate the addresses of all three variables, but if you 5824compile it with @option{-fsection-anchors}, it will access the variables 5825from a common anchor point instead. The effect is similar to the 5826following pseudocode (which isn't valid C): 5827 5828@smallexample 5829int foo (void) 5830@{ 5831 register int *xr = &x; 5832 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 5833@} 5834@end smallexample 5835 5836Not all targets support this option. 5837 5838@item --param @var{name}=@var{value} 5839@opindex param 5840In some places, GCC uses various constants to control the amount of 5841optimization that is done. For example, GCC will not inline functions 5842that contain more that a certain number of instructions. You can 5843control some of these constants on the command-line using the 5844@option{--param} option. 5845 5846The names of specific parameters, and the meaning of the values, are 5847tied to the internals of the compiler, and are subject to change 5848without notice in future releases. 5849 5850In each case, the @var{value} is an integer. The allowable choices for 5851@var{name} are given in the following table: 5852 5853@table @gcctabopt 5854@item salias-max-implicit-fields 5855The maximum number of fields in a variable without direct 5856structure accesses for which structure aliasing will consider trying 5857to track each field. The default is 5 5858 5859@item salias-max-array-elements 5860The maximum number of elements an array can have and its elements 5861still be tracked individually by structure aliasing. The default is 4 5862 5863@item sra-max-structure-size 5864The maximum structure size, in bytes, at which the scalar replacement 5865of aggregates (SRA) optimization will perform block copies. The 5866default value, 0, implies that GCC will select the most appropriate 5867size itself. 5868 5869@item sra-field-structure-ratio 5870The threshold ratio (as a percentage) between instantiated fields and 5871the complete structure size. We say that if the ratio of the number 5872of bytes in instantiated fields to the number of bytes in the complete 5873structure exceeds this parameter, then block copies are not used. The 5874default is 75. 5875 5876@item max-crossjump-edges 5877The maximum number of incoming edges to consider for crossjumping. 5878The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 5879the number of edges incoming to each block. Increasing values mean 5880more aggressive optimization, making the compile time increase with 5881probably small improvement in executable size. 5882 5883@item min-crossjump-insns 5884The minimum number of instructions which must be matched at the end 5885of two blocks before crossjumping will be performed on them. This 5886value is ignored in the case where all instructions in the block being 5887crossjumped from are matched. The default value is 5. 5888 5889@item max-grow-copy-bb-insns 5890The maximum code size expansion factor when copying basic blocks 5891instead of jumping. The expansion is relative to a jump instruction. 5892The default value is 8. 5893 5894@item max-goto-duplication-insns 5895The maximum number of instructions to duplicate to a block that jumps 5896to a computed goto. To avoid @math{O(N^2)} behavior in a number of 5897passes, GCC factors computed gotos early in the compilation process, 5898and unfactors them as late as possible. Only computed jumps at the 5899end of a basic blocks with no more than max-goto-duplication-insns are 5900unfactored. The default value is 8. 5901 5902@item max-delay-slot-insn-search 5903The maximum number of instructions to consider when looking for an 5904instruction to fill a delay slot. If more than this arbitrary number of 5905instructions is searched, the time savings from filling the delay slot 5906will be minimal so stop searching. Increasing values mean more 5907aggressive optimization, making the compile time increase with probably 5908small improvement in executable run time. 5909 5910@item max-delay-slot-live-search 5911When trying to fill delay slots, the maximum number of instructions to 5912consider when searching for a block with valid live register 5913information. Increasing this arbitrarily chosen value means more 5914aggressive optimization, increasing the compile time. This parameter 5915should be removed when the delay slot code is rewritten to maintain the 5916control-flow graph. 5917 5918@item max-gcse-memory 5919The approximate maximum amount of memory that will be allocated in 5920order to perform the global common subexpression elimination 5921optimization. If more memory than specified is required, the 5922optimization will not be done. 5923 5924@item max-gcse-passes 5925The maximum number of passes of GCSE to run. The default is 1. 5926 5927@item max-pending-list-length 5928The maximum number of pending dependencies scheduling will allow 5929before flushing the current state and starting over. Large functions 5930with few branches or calls can create excessively large lists which 5931needlessly consume memory and resources. 5932 5933@item max-inline-insns-single 5934Several parameters control the tree inliner used in gcc. 5935This number sets the maximum number of instructions (counted in GCC's 5936internal representation) in a single function that the tree inliner 5937will consider for inlining. This only affects functions declared 5938inline and methods implemented in a class declaration (C++). 5939The default value is 450. 5940 5941@item max-inline-insns-auto 5942When you use @option{-finline-functions} (included in @option{-O3}), 5943a lot of functions that would otherwise not be considered for inlining 5944by the compiler will be investigated. To those functions, a different 5945(more restrictive) limit compared to functions declared inline can 5946be applied. 5947The default value is 90. 5948 5949@item large-function-insns 5950The limit specifying really large functions. For functions larger than this 5951limit after inlining inlining is constrained by 5952@option{--param large-function-growth}. This parameter is useful primarily 5953to avoid extreme compilation time caused by non-linear algorithms used by the 5954backend. 5955This parameter is ignored when @option{-funit-at-a-time} is not used. 5956The default value is 2700. 5957 5958@item large-function-growth 5959Specifies maximal growth of large function caused by inlining in percents. 5960This parameter is ignored when @option{-funit-at-a-time} is not used. 5961The default value is 100 which limits large function growth to 2.0 times 5962the original size. 5963 5964@item large-unit-insns 5965The limit specifying large translation unit. Growth caused by inlining of 5966units larger than this limit is limited by @option{--param inline-unit-growth}. 5967For small units this might be too tight (consider unit consisting of function A 5968that is inline and B that just calls A three time. If B is small relative to 5969A, the growth of unit is 300\% and yet such inlining is very sane. For very 5970large units consisting of small inlininable functions however the overall unit 5971growth limit is needed to avoid exponential explosion of code size. Thus for 5972smaller units, the size is increased to @option{--param large-unit-insns} 5973before applying @option{--param inline-unit-growth}. The default is 10000 5974 5975@item inline-unit-growth 5976Specifies maximal overall growth of the compilation unit caused by inlining. 5977This parameter is ignored when @option{-funit-at-a-time} is not used. 5978The default value is 50 which limits unit growth to 1.5 times the original 5979size. 5980 5981@item max-inline-insns-recursive 5982@itemx max-inline-insns-recursive-auto 5983Specifies maximum number of instructions out-of-line copy of self recursive inline 5984function can grow into by performing recursive inlining. 5985 5986For functions declared inline @option{--param max-inline-insns-recursive} is 5987taken into account. For function not declared inline, recursive inlining 5988happens only when @option{-finline-functions} (included in @option{-O3}) is 5989enabled and @option{--param max-inline-insns-recursive-auto} is used. The 5990default value is 450. 5991 5992@item max-inline-recursive-depth 5993@itemx max-inline-recursive-depth-auto 5994Specifies maximum recursion depth used by the recursive inlining. 5995 5996For functions declared inline @option{--param max-inline-recursive-depth} is 5997taken into account. For function not declared inline, recursive inlining 5998happens only when @option{-finline-functions} (included in @option{-O3}) is 5999enabled and @option{--param max-inline-recursive-depth-auto} is used. The 6000default value is 450. 6001 6002@item min-inline-recursive-probability 6003Recursive inlining is profitable only for function having deep recursion 6004in average and can hurt for function having little recursion depth by 6005increasing the prologue size or complexity of function body to other 6006optimizers. 6007 6008When profile feedback is available (see @option{-fprofile-generate}) the actual 6009recursion depth can be guessed from probability that function will recurse via 6010given call expression. This parameter limits inlining only to call expression 6011whose probability exceeds given threshold (in percents). The default value is 601210. 6013 6014@item inline-call-cost 6015Specify cost of call instruction relative to simple arithmetics operations 6016(having cost of 1). Increasing this cost disqualifies inlining of non-leaf 6017functions and at the same time increases size of leaf function that is believed to 6018reduce function size by being inlined. In effect it increases amount of 6019inlining for code having large abstraction penalty (many functions that just 6020pass the arguments to other functions) and decrease inlining for code with low 6021abstraction penalty. The default value is 16. 6022 6023@item max-unrolled-insns 6024The maximum number of instructions that a loop should have if that loop 6025is unrolled, and if the loop is unrolled, it determines how many times 6026the loop code is unrolled. 6027 6028@item max-average-unrolled-insns 6029The maximum number of instructions biased by probabilities of their execution 6030that a loop should have if that loop is unrolled, and if the loop is unrolled, 6031it determines how many times the loop code is unrolled. 6032 6033@item max-unroll-times 6034The maximum number of unrollings of a single loop. 6035 6036@item max-peeled-insns 6037The maximum number of instructions that a loop should have if that loop 6038is peeled, and if the loop is peeled, it determines how many times 6039the loop code is peeled. 6040 6041@item max-peel-times 6042The maximum number of peelings of a single loop. 6043 6044@item max-completely-peeled-insns 6045The maximum number of insns of a completely peeled loop. 6046 6047@item max-completely-peel-times 6048The maximum number of iterations of a loop to be suitable for complete peeling. 6049 6050@item max-unswitch-insns 6051The maximum number of insns of an unswitched loop. 6052 6053@item max-unswitch-level 6054The maximum number of branches unswitched in a single loop. 6055 6056@item lim-expensive 6057The minimum cost of an expensive expression in the loop invariant motion. 6058 6059@item iv-consider-all-candidates-bound 6060Bound on number of candidates for induction variables below that 6061all candidates are considered for each use in induction variable 6062optimizations. Only the most relevant candidates are considered 6063if there are more candidates, to avoid quadratic time complexity. 6064 6065@item iv-max-considered-uses 6066The induction variable optimizations give up on loops that contain more 6067induction variable uses. 6068 6069@item iv-always-prune-cand-set-bound 6070If number of candidates in the set is smaller than this value, 6071we always try to remove unnecessary ivs from the set during its 6072optimization when a new iv is added to the set. 6073 6074@item scev-max-expr-size 6075Bound on size of expressions used in the scalar evolutions analyzer. 6076Large expressions slow the analyzer. 6077 6078@item vect-max-version-checks 6079The maximum number of runtime checks that can be performed when doing 6080loop versioning in the vectorizer. See option ftree-vect-loop-version 6081for more information. 6082 6083@item max-iterations-to-track 6084 6085The maximum number of iterations of a loop the brute force algorithm 6086for analysis of # of iterations of the loop tries to evaluate. 6087 6088@item hot-bb-count-fraction 6089Select fraction of the maximal count of repetitions of basic block in program 6090given basic block needs to have to be considered hot. 6091 6092@item hot-bb-frequency-fraction 6093Select fraction of the maximal frequency of executions of basic block in 6094function given basic block needs to have to be considered hot 6095 6096@item max-predicted-iterations 6097The maximum number of loop iterations we predict statically. This is useful 6098in cases where function contain single loop with known bound and other loop 6099with unknown. We predict the known number of iterations correctly, while 6100the unknown number of iterations average to roughly 10. This means that the 6101loop without bounds would appear artificially cold relative to the other one. 6102 6103@item tracer-dynamic-coverage 6104@itemx tracer-dynamic-coverage-feedback 6105 6106This value is used to limit superblock formation once the given percentage of 6107executed instructions is covered. This limits unnecessary code size 6108expansion. 6109 6110The @option{tracer-dynamic-coverage-feedback} is used only when profile 6111feedback is available. The real profiles (as opposed to statically estimated 6112ones) are much less balanced allowing the threshold to be larger value. 6113 6114@item tracer-max-code-growth 6115Stop tail duplication once code growth has reached given percentage. This is 6116rather hokey argument, as most of the duplicates will be eliminated later in 6117cross jumping, so it may be set to much higher values than is the desired code 6118growth. 6119 6120@item tracer-min-branch-ratio 6121 6122Stop reverse growth when the reverse probability of best edge is less than this 6123threshold (in percent). 6124 6125@item tracer-min-branch-ratio 6126@itemx tracer-min-branch-ratio-feedback 6127 6128Stop forward growth if the best edge do have probability lower than this 6129threshold. 6130 6131Similarly to @option{tracer-dynamic-coverage} two values are present, one for 6132compilation for profile feedback and one for compilation without. The value 6133for compilation with profile feedback needs to be more conservative (higher) in 6134order to make tracer effective. 6135 6136@item max-cse-path-length 6137 6138Maximum number of basic blocks on path that cse considers. The default is 10. 6139 6140@item max-cse-insns 6141The maximum instructions CSE process before flushing. The default is 1000. 6142 6143@item global-var-threshold 6144 6145Counts the number of function calls (@var{n}) and the number of 6146call-clobbered variables (@var{v}). If @var{n}x@var{v} is larger than this limit, a 6147single artificial variable will be created to represent all the 6148call-clobbered variables at function call sites. This artificial 6149variable will then be made to alias every call-clobbered variable. 6150(done as @code{int * size_t} on the host machine; beware overflow). 6151 6152@item max-aliased-vops 6153 6154Maximum number of virtual operands allowed to represent aliases 6155before triggering the alias grouping heuristic. Alias grouping 6156reduces compile times and memory consumption needed for aliasing at 6157the expense of precision loss in alias information. 6158 6159@item ggc-min-expand 6160 6161GCC uses a garbage collector to manage its own memory allocation. This 6162parameter specifies the minimum percentage by which the garbage 6163collector's heap should be allowed to expand between collections. 6164Tuning this may improve compilation speed; it has no effect on code 6165generation. 6166 6167The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 6168RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is 6169the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 6170GCC is not able to calculate RAM on a particular platform, the lower 6171bound of 30% is used. Setting this parameter and 6172@option{ggc-min-heapsize} to zero causes a full collection to occur at 6173every opportunity. This is extremely slow, but can be useful for 6174debugging. 6175 6176@item ggc-min-heapsize 6177 6178Minimum size of the garbage collector's heap before it begins bothering 6179to collect garbage. The first collection occurs after the heap expands 6180by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 6181tuning this may improve compilation speed, and has no effect on code 6182generation. 6183 6184The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which 6185tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 6186with a lower bound of 4096 (four megabytes) and an upper bound of 6187131072 (128 megabytes). If GCC is not able to calculate RAM on a 6188particular platform, the lower bound is used. Setting this parameter 6189very large effectively disables garbage collection. Setting this 6190parameter and @option{ggc-min-expand} to zero causes a full collection 6191to occur at every opportunity. 6192 6193@item max-reload-search-insns 6194The maximum number of instruction reload should look backward for equivalent 6195register. Increasing values mean more aggressive optimization, making the 6196compile time increase with probably slightly better performance. The default 6197value is 100. 6198 6199@item max-cselib-memory-locations 6200The maximum number of memory locations cselib should take into account. 6201Increasing values mean more aggressive optimization, making the compile time 6202increase with probably slightly better performance. The default value is 500. 6203 6204@item max-flow-memory-locations 6205Similar as @option{max-cselib-memory-locations} but for dataflow liveness. 6206The default value is 100. 6207 6208@item reorder-blocks-duplicate 6209@itemx reorder-blocks-duplicate-feedback 6210 6211Used by basic block reordering pass to decide whether to use unconditional 6212branch or duplicate the code on its destination. Code is duplicated when its 6213estimated size is smaller than this value multiplied by the estimated size of 6214unconditional jump in the hot spots of the program. 6215 6216The @option{reorder-block-duplicate-feedback} is used only when profile 6217feedback is available and may be set to higher values than 6218@option{reorder-block-duplicate} since information about the hot spots is more 6219accurate. 6220 6221@item max-sched-ready-insns 6222The maximum number of instructions ready to be issued the scheduler should 6223consider at any given time during the first scheduling pass. Increasing 6224values mean more thorough searches, making the compilation time increase 6225with probably little benefit. The default value is 100. 6226 6227@item max-sched-region-blocks 6228The maximum number of blocks in a region to be considered for 6229interblock scheduling. The default value is 10. 6230 6231@item max-sched-region-insns 6232The maximum number of insns in a region to be considered for 6233interblock scheduling. The default value is 100. 6234 6235@item min-spec-prob 6236The minimum probability (in percents) of reaching a source block 6237for interblock speculative scheduling. The default value is 40. 6238 6239@item max-sched-extend-regions-iters 6240The maximum number of iterations through CFG to extend regions. 62410 - disable region extension, 6242N - do at most N iterations. 6243The default value is 0. 6244 6245@item max-sched-insn-conflict-delay 6246The maximum conflict delay for an insn to be considered for speculative motion. 6247The default value is 3. 6248 6249@item sched-spec-prob-cutoff 6250The minimal probability of speculation success (in percents), so that 6251speculative insn will be scheduled. 6252The default value is 40. 6253 6254@item max-last-value-rtl 6255 6256The maximum size measured as number of RTLs that can be recorded in an expression 6257in combiner for a pseudo register as last known value of that register. The default 6258is 10000. 6259 6260@item integer-share-limit 6261Small integer constants can use a shared data structure, reducing the 6262compiler's memory usage and increasing its speed. This sets the maximum 6263value of a shared integer constant's. The default value is 256. 6264 6265@item min-virtual-mappings 6266Specifies the minimum number of virtual mappings in the incremental 6267SSA updater that should be registered to trigger the virtual mappings 6268heuristic defined by virtual-mappings-ratio. The default value is 6269100. 6270 6271@item virtual-mappings-ratio 6272If the number of virtual mappings is virtual-mappings-ratio bigger 6273than the number of virtual symbols to be updated, then the incremental 6274SSA updater switches to a full update for those symbols. The default 6275ratio is 3. 6276 6277@item ssp-buffer-size 6278The minimum size of buffers (i.e. arrays) that will receive stack smashing 6279protection when @option{-fstack-protection} is used. 6280 6281@item max-jump-thread-duplication-stmts 6282Maximum number of statements allowed in a block that needs to be 6283duplicated when threading jumps. 6284 6285@item max-fields-for-field-sensitive 6286Maximum number of fields in a structure we will treat in 6287a field sensitive manner during pointer analysis. 6288 6289@end table 6290@end table 6291 6292@node Preprocessor Options 6293@section Options Controlling the Preprocessor 6294@cindex preprocessor options 6295@cindex options, preprocessor 6296 6297These options control the C preprocessor, which is run on each C source 6298file before actual compilation. 6299 6300If you use the @option{-E} option, nothing is done except preprocessing. 6301Some of these options make sense only together with @option{-E} because 6302they cause the preprocessor output to be unsuitable for actual 6303compilation. 6304 6305@table @gcctabopt 6306@opindex Wp 6307You can use @option{-Wp,@var{option}} to bypass the compiler driver 6308and pass @var{option} directly through to the preprocessor. If 6309@var{option} contains commas, it is split into multiple options at the 6310commas. However, many options are modified, translated or interpreted 6311by the compiler driver before being passed to the preprocessor, and 6312@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 6313interface is undocumented and subject to change, so whenever possible 6314you should avoid using @option{-Wp} and let the driver handle the 6315options instead. 6316 6317@item -Xpreprocessor @var{option} 6318@opindex preprocessor 6319Pass @var{option} as an option to the preprocessor. You can use this to 6320supply system-specific preprocessor options which GCC does not know how to 6321recognize. 6322 6323If you want to pass an option that takes an argument, you must use 6324@option{-Xpreprocessor} twice, once for the option and once for the argument. 6325@end table 6326 6327@include cppopts.texi 6328 6329@node Assembler Options 6330@section Passing Options to the Assembler 6331 6332@c prevent bad page break with this line 6333You can pass options to the assembler. 6334 6335@table @gcctabopt 6336@item -Wa,@var{option} 6337@opindex Wa 6338Pass @var{option} as an option to the assembler. If @var{option} 6339contains commas, it is split into multiple options at the commas. 6340 6341@item -Xassembler @var{option} 6342@opindex Xassembler 6343Pass @var{option} as an option to the assembler. You can use this to 6344supply system-specific assembler options which GCC does not know how to 6345recognize. 6346 6347If you want to pass an option that takes an argument, you must use 6348@option{-Xassembler} twice, once for the option and once for the argument. 6349 6350@end table 6351 6352@node Link Options 6353@section Options for Linking 6354@cindex link options 6355@cindex options, linking 6356 6357These options come into play when the compiler links object files into 6358an executable output file. They are meaningless if the compiler is 6359not doing a link step. 6360 6361@table @gcctabopt 6362@cindex file names 6363@item @var{object-file-name} 6364A file name that does not end in a special recognized suffix is 6365considered to name an object file or library. (Object files are 6366distinguished from libraries by the linker according to the file 6367contents.) If linking is done, these object files are used as input 6368to the linker. 6369 6370@item -c 6371@itemx -S 6372@itemx -E 6373@opindex c 6374@opindex S 6375@opindex E 6376If any of these options is used, then the linker is not run, and 6377object file names should not be used as arguments. @xref{Overall 6378Options}. 6379 6380@cindex Libraries 6381@item -l@var{library} 6382@itemx -l @var{library} 6383@opindex l 6384Search the library named @var{library} when linking. (The second 6385alternative with the library as a separate argument is only for 6386POSIX compliance and is not recommended.) 6387 6388It makes a difference where in the command you write this option; the 6389linker searches and processes libraries and object files in the order they 6390are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 6391after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 6392to functions in @samp{z}, those functions may not be loaded. 6393 6394The linker searches a standard list of directories for the library, 6395which is actually a file named @file{lib@var{library}.a}. The linker 6396then uses this file as if it had been specified precisely by name. 6397 6398The directories searched include several standard system directories 6399plus any that you specify with @option{-L}. 6400 6401Normally the files found this way are library files---archive files 6402whose members are object files. The linker handles an archive file by 6403scanning through it for members which define symbols that have so far 6404been referenced but not defined. But if the file that is found is an 6405ordinary object file, it is linked in the usual fashion. The only 6406difference between using an @option{-l} option and specifying a file name 6407is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 6408and searches several directories. 6409 6410@item -nostartfiles 6411@opindex nostartfiles 6412Do not use the standard system startup files when linking. 6413The standard system libraries are used normally, unless @option{-nostdlib} 6414or @option{-nodefaultlibs} is used. 6415 6416@item -nodefaultlibs 6417@opindex nodefaultlibs 6418Do not use the standard system libraries when linking. 6419Only the libraries you specify will be passed to the linker. 6420The standard startup files are used normally, unless @option{-nostartfiles} 6421is used. The compiler may generate calls to @code{memcmp}, 6422@code{memset}, @code{memcpy} and @code{memmove}. 6423These entries are usually resolved by entries in 6424libc. These entry points should be supplied through some other 6425mechanism when this option is specified. 6426 6427@item -nostdlib 6428@opindex nostdlib 6429Do not use the standard system startup files or libraries when linking. 6430No startup files and only the libraries you specify will be passed to 6431the linker. The compiler may generate calls to @code{memcmp}, @code{memset}, 6432@code{memcpy} and @code{memmove}. 6433These entries are usually resolved by entries in 6434libc. These entry points should be supplied through some other 6435mechanism when this option is specified. 6436 6437@cindex @option{-lgcc}, use with @option{-nostdlib} 6438@cindex @option{-nostdlib} and unresolved references 6439@cindex unresolved references and @option{-nostdlib} 6440@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 6441@cindex @option{-nodefaultlibs} and unresolved references 6442@cindex unresolved references and @option{-nodefaultlibs} 6443One of the standard libraries bypassed by @option{-nostdlib} and 6444@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 6445that GCC uses to overcome shortcomings of particular machines, or special 6446needs for some languages. 6447(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 6448Collection (GCC) Internals}, 6449for more discussion of @file{libgcc.a}.) 6450In most cases, you need @file{libgcc.a} even when you want to avoid 6451other standard libraries. In other words, when you specify @option{-nostdlib} 6452or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 6453This ensures that you have no unresolved references to internal GCC 6454library subroutines. (For example, @samp{__main}, used to ensure C++ 6455constructors will be called; @pxref{Collect2,,@code{collect2}, gccint, 6456GNU Compiler Collection (GCC) Internals}.) 6457 6458@item -pie 6459@opindex pie 6460Produce a position independent executable on targets which support it. 6461For predictable results, you must also specify the same set of options 6462that were used to generate code (@option{-fpie}, @option{-fPIE}, 6463or model suboptions) when you specify this option. 6464 6465@item -rdynamic 6466@opindex rdynamic 6467Pass the flag @option{-export-dynamic} to the ELF linker, on targets 6468that support it. This instructs the linker to add all symbols, not 6469only used ones, to the dynamic symbol table. This option is needed 6470for some uses of @code{dlopen} or to allow obtaining backtraces 6471from within a program. 6472 6473@item -s 6474@opindex s 6475Remove all symbol table and relocation information from the executable. 6476 6477@item -static 6478@opindex static 6479On systems that support dynamic linking, this prevents linking with the shared 6480libraries. On other systems, this option has no effect. 6481 6482@item -shared 6483@opindex shared 6484Produce a shared object which can then be linked with other objects to 6485form an executable. Not all systems support this option. For predictable 6486results, you must also specify the same set of options that were used to 6487generate code (@option{-fpic}, @option{-fPIC}, or model suboptions) 6488when you specify this option.@footnote{On some systems, @samp{gcc -shared} 6489needs to build supplementary stub code for constructors to work. On 6490multi-libbed systems, @samp{gcc -shared} must select the correct support 6491libraries to link against. Failing to supply the correct flags may lead 6492to subtle defects. Supplying them in cases where they are not necessary 6493is innocuous.} 6494 6495@item -shared-libgcc 6496@itemx -static-libgcc 6497@opindex shared-libgcc 6498@opindex static-libgcc 6499On systems that provide @file{libgcc} as a shared library, these options 6500force the use of either the shared or static version respectively. 6501If no shared version of @file{libgcc} was built when the compiler was 6502configured, these options have no effect. 6503 6504There are several situations in which an application should use the 6505shared @file{libgcc} instead of the static version. The most common 6506of these is when the application wishes to throw and catch exceptions 6507across different shared libraries. In that case, each of the libraries 6508as well as the application itself should use the shared @file{libgcc}. 6509 6510Therefore, the G++ and GCJ drivers automatically add 6511@option{-shared-libgcc} whenever you build a shared library or a main 6512executable, because C++ and Java programs typically use exceptions, so 6513this is the right thing to do. 6514 6515If, instead, you use the GCC driver to create shared libraries, you may 6516find that they will not always be linked with the shared @file{libgcc}. 6517If GCC finds, at its configuration time, that you have a non-GNU linker 6518or a GNU linker that does not support option @option{--eh-frame-hdr}, 6519it will link the shared version of @file{libgcc} into shared libraries 6520by default. Otherwise, it will take advantage of the linker and optimize 6521away the linking with the shared version of @file{libgcc}, linking with 6522the static version of libgcc by default. This allows exceptions to 6523propagate through such shared libraries, without incurring relocation 6524costs at library load time. 6525 6526However, if a library or main executable is supposed to throw or catch 6527exceptions, you must link it using the G++ or GCJ driver, as appropriate 6528for the languages used in the program, or using the option 6529@option{-shared-libgcc}, such that it is linked with the shared 6530@file{libgcc}. 6531 6532@item -symbolic 6533@opindex symbolic 6534Bind references to global symbols when building a shared object. Warn 6535about any unresolved references (unless overridden by the link editor 6536option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support 6537this option. 6538 6539@item -Xlinker @var{option} 6540@opindex Xlinker 6541Pass @var{option} as an option to the linker. You can use this to 6542supply system-specific linker options which GCC does not know how to 6543recognize. 6544 6545If you want to pass an option that takes an argument, you must use 6546@option{-Xlinker} twice, once for the option and once for the argument. 6547For example, to pass @option{-assert definitions}, you must write 6548@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write 6549@option{-Xlinker "-assert definitions"}, because this passes the entire 6550string as a single argument, which is not what the linker expects. 6551 6552@item -Wl,@var{option} 6553@opindex Wl 6554Pass @var{option} as an option to the linker. If @var{option} contains 6555commas, it is split into multiple options at the commas. 6556 6557@item -u @var{symbol} 6558@opindex u 6559Pretend the symbol @var{symbol} is undefined, to force linking of 6560library modules to define it. You can use @option{-u} multiple times with 6561different symbols to force loading of additional library modules. 6562@end table 6563 6564@node Directory Options 6565@section Options for Directory Search 6566@cindex directory options 6567@cindex options, directory search 6568@cindex search path 6569 6570These options specify directories to search for header files, for 6571libraries and for parts of the compiler: 6572 6573@table @gcctabopt 6574@item -I@var{dir} 6575@opindex I 6576Add the directory @var{dir} to the head of the list of directories to be 6577searched for header files. This can be used to override a system header 6578file, substituting your own version, since these directories are 6579searched before the system header file directories. However, you should 6580not use this option to add directories that contain vendor-supplied 6581system header files (use @option{-isystem} for that). If you use more than 6582one @option{-I} option, the directories are scanned in left-to-right 6583order; the standard system directories come after. 6584 6585If a standard system include directory, or a directory specified with 6586@option{-isystem}, is also specified with @option{-I}, the @option{-I} 6587option will be ignored. The directory will still be searched but as a 6588system directory at its normal position in the system include chain. 6589This is to ensure that GCC's procedure to fix buggy system headers and 6590the ordering for the include_next directive are not inadvertently changed. 6591If you really need to change the search order for system directories, 6592use the @option{-nostdinc} and/or @option{-isystem} options. 6593 6594@item -iquote@var{dir} 6595@opindex iquote 6596Add the directory @var{dir} to the head of the list of directories to 6597be searched for header files only for the case of @samp{#include 6598"@var{file}"}; they are not searched for @samp{#include <@var{file}>}, 6599otherwise just like @option{-I}. 6600 6601@item -L@var{dir} 6602@opindex L 6603Add directory @var{dir} to the list of directories to be searched 6604for @option{-l}. 6605 6606@item -B@var{prefix} 6607@opindex B 6608This option specifies where to find the executables, libraries, 6609include files, and data files of the compiler itself. 6610 6611The compiler driver program runs one or more of the subprograms 6612@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries 6613@var{prefix} as a prefix for each program it tries to run, both with and 6614without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). 6615 6616For each subprogram to be run, the compiler driver first tries the 6617@option{-B} prefix, if any. If that name is not found, or if @option{-B} 6618was not specified, the driver tries two standard prefixes, which are 6619@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 6620those results in a file name that is found, the unmodified program 6621name is searched for using the directories specified in your 6622@env{PATH} environment variable. 6623 6624The compiler will check to see if the path provided by the @option{-B} 6625refers to a directory, and if necessary it will add a directory 6626separator character at the end of the path. 6627 6628@option{-B} prefixes that effectively specify directory names also apply 6629to libraries in the linker, because the compiler translates these 6630options into @option{-L} options for the linker. They also apply to 6631includes files in the preprocessor, because the compiler translates these 6632options into @option{-isystem} options for the preprocessor. In this case, 6633the compiler appends @samp{include} to the prefix. 6634 6635The run-time support file @file{libgcc.a} can also be searched for using 6636the @option{-B} prefix, if needed. If it is not found there, the two 6637standard prefixes above are tried, and that is all. The file is left 6638out of the link if it is not found by those means. 6639 6640Another way to specify a prefix much like the @option{-B} prefix is to use 6641the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 6642Variables}. 6643 6644As a special kludge, if the path provided by @option{-B} is 6645@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 66469, then it will be replaced by @file{[dir/]include}. This is to help 6647with boot-strapping the compiler. 6648 6649@item -specs=@var{file} 6650@opindex specs 6651Process @var{file} after the compiler reads in the standard @file{specs} 6652file, in order to override the defaults that the @file{gcc} driver 6653program uses when determining what switches to pass to @file{cc1}, 6654@file{cc1plus}, @file{as}, @file{ld}, etc. More than one 6655@option{-specs=@var{file}} can be specified on the command line, and they 6656are processed in order, from left to right. 6657 6658@item --sysroot=@var{dir} 6659@opindex sysroot 6660Use @var{dir} as the logical root directory for headers and libraries. 6661For example, if the compiler would normally search for headers in 6662@file{/usr/include} and libraries in @file{/usr/lib}, it will instead 6663search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 6664 6665If you use both this option and the @option{-isysroot} option, then 6666the @option{--sysroot} option will apply to libraries, but the 6667@option{-isysroot} option will apply to header files. 6668 6669The GNU linker (beginning with version 2.16) has the necessary support 6670for this option. If your linker does not support this option, the 6671header file aspect of @option{--sysroot} will still work, but the 6672library aspect will not. 6673 6674@item -I- 6675@opindex I- 6676This option has been deprecated. Please use @option{-iquote} instead for 6677@option{-I} directories before the @option{-I-} and remove the @option{-I-}. 6678Any directories you specify with @option{-I} options before the @option{-I-} 6679option are searched only for the case of @samp{#include "@var{file}"}; 6680they are not searched for @samp{#include <@var{file}>}. 6681 6682If additional directories are specified with @option{-I} options after 6683the @option{-I-}, these directories are searched for all @samp{#include} 6684directives. (Ordinarily @emph{all} @option{-I} directories are used 6685this way.) 6686 6687In addition, the @option{-I-} option inhibits the use of the current 6688directory (where the current input file came from) as the first search 6689directory for @samp{#include "@var{file}"}. There is no way to 6690override this effect of @option{-I-}. With @option{-I.} you can specify 6691searching the directory which was current when the compiler was 6692invoked. That is not exactly the same as what the preprocessor does 6693by default, but it is often satisfactory. 6694 6695@option{-I-} does not inhibit the use of the standard system directories 6696for header files. Thus, @option{-I-} and @option{-nostdinc} are 6697independent. 6698@end table 6699 6700@c man end 6701 6702@node Spec Files 6703@section Specifying subprocesses and the switches to pass to them 6704@cindex Spec Files 6705 6706@command{gcc} is a driver program. It performs its job by invoking a 6707sequence of other programs to do the work of compiling, assembling and 6708linking. GCC interprets its command-line parameters and uses these to 6709deduce which programs it should invoke, and which command-line options 6710it ought to place on their command lines. This behavior is controlled 6711by @dfn{spec strings}. In most cases there is one spec string for each 6712program that GCC can invoke, but a few programs have multiple spec 6713strings to control their behavior. The spec strings built into GCC can 6714be overridden by using the @option{-specs=} command-line switch to specify 6715a spec file. 6716 6717@dfn{Spec files} are plaintext files that are used to construct spec 6718strings. They consist of a sequence of directives separated by blank 6719lines. The type of directive is determined by the first non-whitespace 6720character on the line and it can be one of the following: 6721 6722@table @code 6723@item %@var{command} 6724Issues a @var{command} to the spec file processor. The commands that can 6725appear here are: 6726 6727@table @code 6728@item %include <@var{file}> 6729@cindex %include 6730Search for @var{file} and insert its text at the current point in the 6731specs file. 6732 6733@item %include_noerr <@var{file}> 6734@cindex %include_noerr 6735Just like @samp{%include}, but do not generate an error message if the include 6736file cannot be found. 6737 6738@item %rename @var{old_name} @var{new_name} 6739@cindex %rename 6740Rename the spec string @var{old_name} to @var{new_name}. 6741 6742@end table 6743 6744@item *[@var{spec_name}]: 6745This tells the compiler to create, override or delete the named spec 6746string. All lines after this directive up to the next directive or 6747blank line are considered to be the text for the spec string. If this 6748results in an empty string then the spec will be deleted. (Or, if the 6749spec did not exist, then nothing will happened.) Otherwise, if the spec 6750does not currently exist a new spec will be created. If the spec does 6751exist then its contents will be overridden by the text of this 6752directive, unless the first character of that text is the @samp{+} 6753character, in which case the text will be appended to the spec. 6754 6755@item [@var{suffix}]: 6756Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 6757and up to the next directive or blank line are considered to make up the 6758spec string for the indicated suffix. When the compiler encounters an 6759input file with the named suffix, it will processes the spec string in 6760order to work out how to compile that file. For example: 6761 6762@smallexample 6763.ZZ: 6764z-compile -input %i 6765@end smallexample 6766 6767This says that any input file whose name ends in @samp{.ZZ} should be 6768passed to the program @samp{z-compile}, which should be invoked with the 6769command-line switch @option{-input} and with the result of performing the 6770@samp{%i} substitution. (See below.) 6771 6772As an alternative to providing a spec string, the text that follows a 6773suffix directive can be one of the following: 6774 6775@table @code 6776@item @@@var{language} 6777This says that the suffix is an alias for a known @var{language}. This is 6778similar to using the @option{-x} command-line switch to GCC to specify a 6779language explicitly. For example: 6780 6781@smallexample 6782.ZZ: 6783@@c++ 6784@end smallexample 6785 6786Says that .ZZ files are, in fact, C++ source files. 6787 6788@item #@var{name} 6789This causes an error messages saying: 6790 6791@smallexample 6792@var{name} compiler not installed on this system. 6793@end smallexample 6794@end table 6795 6796GCC already has an extensive list of suffixes built into it. 6797This directive will add an entry to the end of the list of suffixes, but 6798since the list is searched from the end backwards, it is effectively 6799possible to override earlier entries using this technique. 6800 6801@end table 6802 6803GCC has the following spec strings built into it. Spec files can 6804override these strings or create their own. Note that individual 6805targets can also add their own spec strings to this list. 6806 6807@smallexample 6808asm Options to pass to the assembler 6809asm_final Options to pass to the assembler post-processor 6810cpp Options to pass to the C preprocessor 6811cc1 Options to pass to the C compiler 6812cc1plus Options to pass to the C++ compiler 6813endfile Object files to include at the end of the link 6814link Options to pass to the linker 6815lib Libraries to include on the command line to the linker 6816libgcc Decides which GCC support library to pass to the linker 6817linker Sets the name of the linker 6818predefines Defines to be passed to the C preprocessor 6819signed_char Defines to pass to CPP to say whether @code{char} is signed 6820 by default 6821startfile Object files to include at the start of the link 6822@end smallexample 6823 6824Here is a small example of a spec file: 6825 6826@smallexample 6827%rename lib old_lib 6828 6829*lib: 6830--start-group -lgcc -lc -leval1 --end-group %(old_lib) 6831@end smallexample 6832 6833This example renames the spec called @samp{lib} to @samp{old_lib} and 6834then overrides the previous definition of @samp{lib} with a new one. 6835The new definition adds in some extra command-line options before 6836including the text of the old definition. 6837 6838@dfn{Spec strings} are a list of command-line options to be passed to their 6839corresponding program. In addition, the spec strings can contain 6840@samp{%}-prefixed sequences to substitute variable text or to 6841conditionally insert text into the command line. Using these constructs 6842it is possible to generate quite complex command lines. 6843 6844Here is a table of all defined @samp{%}-sequences for spec 6845strings. Note that spaces are not generated automatically around the 6846results of expanding these sequences. Therefore you can concatenate them 6847together or combine them with constant text in a single argument. 6848 6849@table @code 6850@item %% 6851Substitute one @samp{%} into the program name or argument. 6852 6853@item %i 6854Substitute the name of the input file being processed. 6855 6856@item %b 6857Substitute the basename of the input file being processed. 6858This is the substring up to (and not including) the last period 6859and not including the directory. 6860 6861@item %B 6862This is the same as @samp{%b}, but include the file suffix (text after 6863the last period). 6864 6865@item %d 6866Marks the argument containing or following the @samp{%d} as a 6867temporary file name, so that that file will be deleted if GCC exits 6868successfully. Unlike @samp{%g}, this contributes no text to the 6869argument. 6870 6871@item %g@var{suffix} 6872Substitute a file name that has suffix @var{suffix} and is chosen 6873once per compilation, and mark the argument in the same way as 6874@samp{%d}. To reduce exposure to denial-of-service attacks, the file 6875name is now chosen in a way that is hard to predict even when previously 6876chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 6877might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 6878the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 6879treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 6880was simply substituted with a file name chosen once per compilation, 6881without regard to any appended suffix (which was therefore treated 6882just like ordinary text), making such attacks more likely to succeed. 6883 6884@item %u@var{suffix} 6885Like @samp{%g}, but generates a new temporary file name even if 6886@samp{%u@var{suffix}} was already seen. 6887 6888@item %U@var{suffix} 6889Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 6890new one if there is no such last file name. In the absence of any 6891@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 6892the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 6893would involve the generation of two distinct file names, one 6894for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 6895simply substituted with a file name chosen for the previous @samp{%u}, 6896without regard to any appended suffix. 6897 6898@item %j@var{suffix} 6899Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 6900writable, and if save-temps is off; otherwise, substitute the name 6901of a temporary file, just like @samp{%u}. This temporary file is not 6902meant for communication between processes, but rather as a junk 6903disposal mechanism. 6904 6905@item %|@var{suffix} 6906@itemx %m@var{suffix} 6907Like @samp{%g}, except if @option{-pipe} is in effect. In that case 6908@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 6909all. These are the two most common ways to instruct a program that it 6910should read from standard input or write to standard output. If you 6911need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 6912construct: see for example @file{f/lang-specs.h}. 6913 6914@item %.@var{SUFFIX} 6915Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 6916when it is subsequently output with @samp{%*}. @var{SUFFIX} is 6917terminated by the next space or %. 6918 6919@item %w 6920Marks the argument containing or following the @samp{%w} as the 6921designated output file of this compilation. This puts the argument 6922into the sequence of arguments that @samp{%o} will substitute later. 6923 6924@item %o 6925Substitutes the names of all the output files, with spaces 6926automatically placed around them. You should write spaces 6927around the @samp{%o} as well or the results are undefined. 6928@samp{%o} is for use in the specs for running the linker. 6929Input files whose names have no recognized suffix are not compiled 6930at all, but they are included among the output files, so they will 6931be linked. 6932 6933@item %O 6934Substitutes the suffix for object files. Note that this is 6935handled specially when it immediately follows @samp{%g, %u, or %U}, 6936because of the need for those to form complete file names. The 6937handling is such that @samp{%O} is treated exactly as if it had already 6938been substituted, except that @samp{%g, %u, and %U} do not currently 6939support additional @var{suffix} characters following @samp{%O} as they would 6940following, for example, @samp{.o}. 6941 6942@item %p 6943Substitutes the standard macro predefinitions for the 6944current target machine. Use this when running @code{cpp}. 6945 6946@item %P 6947Like @samp{%p}, but puts @samp{__} before and after the name of each 6948predefined macro, except for macros that start with @samp{__} or with 6949@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 6950C@. 6951 6952@item %I 6953Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 6954@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 6955@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 6956and @option{-imultilib} as necessary. 6957 6958@item %s 6959Current argument is the name of a library or startup file of some sort. 6960Search for that file in a standard list of directories and substitute 6961the full name found. 6962 6963@item %e@var{str} 6964Print @var{str} as an error message. @var{str} is terminated by a newline. 6965Use this when inconsistent options are detected. 6966 6967@item %(@var{name}) 6968Substitute the contents of spec string @var{name} at this point. 6969 6970@item %[@var{name}] 6971Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments. 6972 6973@item %x@{@var{option}@} 6974Accumulate an option for @samp{%X}. 6975 6976@item %X 6977Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 6978spec string. 6979 6980@item %Y 6981Output the accumulated assembler options specified by @option{-Wa}. 6982 6983@item %Z 6984Output the accumulated preprocessor options specified by @option{-Wp}. 6985 6986@item %a 6987Process the @code{asm} spec. This is used to compute the 6988switches to be passed to the assembler. 6989 6990@item %A 6991Process the @code{asm_final} spec. This is a spec string for 6992passing switches to an assembler post-processor, if such a program is 6993needed. 6994 6995@item %l 6996Process the @code{link} spec. This is the spec for computing the 6997command line passed to the linker. Typically it will make use of the 6998@samp{%L %G %S %D and %E} sequences. 6999 7000@item %D 7001Dump out a @option{-L} option for each directory that GCC believes might 7002contain startup files. If the target supports multilibs then the 7003current multilib directory will be prepended to each of these paths. 7004 7005@item %L 7006Process the @code{lib} spec. This is a spec string for deciding which 7007libraries should be included on the command line to the linker. 7008 7009@item %G 7010Process the @code{libgcc} spec. This is a spec string for deciding 7011which GCC support library should be included on the command line to the linker. 7012 7013@item %S 7014Process the @code{startfile} spec. This is a spec for deciding which 7015object files should be the first ones passed to the linker. Typically 7016this might be a file named @file{crt0.o}. 7017 7018@item %E 7019Process the @code{endfile} spec. This is a spec string that specifies 7020the last object files that will be passed to the linker. 7021 7022@item %C 7023Process the @code{cpp} spec. This is used to construct the arguments 7024to be passed to the C preprocessor. 7025 7026@item %1 7027Process the @code{cc1} spec. This is used to construct the options to be 7028passed to the actual C compiler (@samp{cc1}). 7029 7030@item %2 7031Process the @code{cc1plus} spec. This is used to construct the options to be 7032passed to the actual C++ compiler (@samp{cc1plus}). 7033 7034@item %* 7035Substitute the variable part of a matched option. See below. 7036Note that each comma in the substituted string is replaced by 7037a single space. 7038 7039@item %<@code{S} 7040Remove all occurrences of @code{-S} from the command line. Note---this 7041command is position dependent. @samp{%} commands in the spec string 7042before this one will see @code{-S}, @samp{%} commands in the spec string 7043after this one will not. 7044 7045@item %:@var{function}(@var{args}) 7046Call the named function @var{function}, passing it @var{args}. 7047@var{args} is first processed as a nested spec string, then split 7048into an argument vector in the usual fashion. The function returns 7049a string which is processed as if it had appeared literally as part 7050of the current spec. 7051 7052The following built-in spec functions are provided: 7053 7054@table @code 7055@item @code{if-exists} 7056The @code{if-exists} spec function takes one argument, an absolute 7057pathname to a file. If the file exists, @code{if-exists} returns the 7058pathname. Here is a small example of its usage: 7059 7060@smallexample 7061*startfile: 7062crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 7063@end smallexample 7064 7065@item @code{if-exists-else} 7066The @code{if-exists-else} spec function is similar to the @code{if-exists} 7067spec function, except that it takes two arguments. The first argument is 7068an absolute pathname to a file. If the file exists, @code{if-exists-else} 7069returns the pathname. If it does not exist, it returns the second argument. 7070This way, @code{if-exists-else} can be used to select one file or another, 7071based on the existence of the first. Here is a small example of its usage: 7072 7073@smallexample 7074*startfile: 7075crt0%O%s %:if-exists(crti%O%s) \ 7076%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 7077@end smallexample 7078 7079@item @code{replace-outfile} 7080The @code{replace-outfile} spec function takes two arguments. It looks for the 7081first argument in the outfiles array and replaces it with the second argument. Here 7082is a small example of its usage: 7083 7084@smallexample 7085%@{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ \ 7086libstdc++.a%s)@} 7087 7088@end smallexample 7089 7090@end table 7091 7092@item %@{@code{S}@} 7093Substitutes the @code{-S} switch, if that switch was given to GCC@. 7094If that switch was not specified, this substitutes nothing. Note that 7095the leading dash is omitted when specifying this option, and it is 7096automatically inserted if the substitution is performed. Thus the spec 7097string @samp{%@{foo@}} would match the command-line option @option{-foo} 7098and would output the command line option @option{-foo}. 7099 7100@item %W@{@code{S}@} 7101Like %@{@code{S}@} but mark last argument supplied within as a file to be 7102deleted on failure. 7103 7104@item %@{@code{S}*@} 7105Substitutes all the switches specified to GCC whose names start 7106with @code{-S}, but which also take an argument. This is used for 7107switches like @option{-o}, @option{-D}, @option{-I}, etc. 7108GCC considers @option{-o foo} as being 7109one switch whose names starts with @samp{o}. %@{o*@} would substitute this 7110text, including the space. Thus two arguments would be generated. 7111 7112@item %@{@code{S}*&@code{T}*@} 7113Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 7114(the order of @code{S} and @code{T} in the spec is not significant). 7115There can be any number of ampersand-separated variables; for each the 7116wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 7117 7118@item %@{@code{S}:@code{X}@} 7119Substitutes @code{X}, if the @samp{-S} switch was given to GCC@. 7120 7121@item %@{!@code{S}:@code{X}@} 7122Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@. 7123 7124@item %@{@code{S}*:@code{X}@} 7125Substitutes @code{X} if one or more switches whose names start with 7126@code{-S} are specified to GCC@. Normally @code{X} is substituted only 7127once, no matter how many such switches appeared. However, if @code{%*} 7128appears somewhere in @code{X}, then @code{X} will be substituted once 7129for each matching switch, with the @code{%*} replaced by the part of 7130that switch that matched the @code{*}. 7131 7132@item %@{.@code{S}:@code{X}@} 7133Substitutes @code{X}, if processing a file with suffix @code{S}. 7134 7135@item %@{!.@code{S}:@code{X}@} 7136Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 7137 7138@item %@{@code{S}|@code{P}:@code{X}@} 7139Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. 7140This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well, 7141although they have a stronger binding than the @samp{|}. If @code{%*} 7142appears in @code{X}, all of the alternatives must be starred, and only 7143the first matching alternative is substituted. 7144 7145For example, a spec string like this: 7146 7147@smallexample 7148%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 7149@end smallexample 7150 7151will output the following command-line options from the following input 7152command-line options: 7153 7154@smallexample 7155fred.c -foo -baz 7156jim.d -bar -boggle 7157-d fred.c -foo -baz -boggle 7158-d jim.d -bar -baz -boggle 7159@end smallexample 7160 7161@item %@{S:X; T:Y; :D@} 7162 7163If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was 7164given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 7165be as many clauses as you need. This may be combined with @code{.}, 7166@code{!}, @code{|}, and @code{*} as needed. 7167 7168 7169@end table 7170 7171The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar 7172construct may contain other nested @samp{%} constructs or spaces, or 7173even newlines. They are processed as usual, as described above. 7174Trailing white space in @code{X} is ignored. White space may also 7175appear anywhere on the left side of the colon in these constructs, 7176except between @code{.} or @code{*} and the corresponding word. 7177 7178The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 7179handled specifically in these constructs. If another value of 7180@option{-O} or the negated form of a @option{-f}, @option{-m}, or 7181@option{-W} switch is found later in the command line, the earlier 7182switch value is ignored, except with @{@code{S}*@} where @code{S} is 7183just one letter, which passes all matching options. 7184 7185The character @samp{|} at the beginning of the predicate text is used to 7186indicate that a command should be piped to the following command, but 7187only if @option{-pipe} is specified. 7188 7189It is built into GCC which switches take arguments and which do not. 7190(You might think it would be useful to generalize this to allow each 7191compiler's spec to say which switches take arguments. But this cannot 7192be done in a consistent fashion. GCC cannot even decide which input 7193files have been specified without knowing which switches take arguments, 7194and it must know which input files to compile in order to tell which 7195compilers to run). 7196 7197GCC also knows implicitly that arguments starting in @option{-l} are to be 7198treated as compiler output files, and passed to the linker in their 7199proper position among the other output files. 7200 7201@c man begin OPTIONS 7202 7203@node Target Options 7204@section Specifying Target Machine and Compiler Version 7205@cindex target options 7206@cindex cross compiling 7207@cindex specifying machine version 7208@cindex specifying compiler version and target machine 7209@cindex compiler version, specifying 7210@cindex target machine, specifying 7211 7212The usual way to run GCC is to run the executable called @file{gcc}, or 7213@file{<machine>-gcc} when cross-compiling, or 7214@file{<machine>-gcc-<version>} to run a version other than the one that 7215was installed last. Sometimes this is inconvenient, so GCC provides 7216options that will switch to another cross-compiler or version. 7217 7218@table @gcctabopt 7219@item -b @var{machine} 7220@opindex b 7221The argument @var{machine} specifies the target machine for compilation. 7222 7223The value to use for @var{machine} is the same as was specified as the 7224machine type when configuring GCC as a cross-compiler. For 7225example, if a cross-compiler was configured with @samp{configure 7226arm-elf}, meaning to compile for an arm processor with elf binaries, 7227then you would specify @option{-b arm-elf} to run that cross compiler. 7228Because there are other options beginning with @option{-b}, the 7229configuration must contain a hyphen. 7230 7231@item -V @var{version} 7232@opindex V 7233The argument @var{version} specifies which version of GCC to run. 7234This is useful when multiple versions are installed. For example, 7235@var{version} might be @samp{4.0}, meaning to run GCC version 4.0. 7236@end table 7237 7238The @option{-V} and @option{-b} options work by running the 7239@file{<machine>-gcc-<version>} executable, so there's no real reason to 7240use them if you can just run that directly. 7241 7242@node Submodel Options 7243@section Hardware Models and Configurations 7244@cindex submodel options 7245@cindex specifying hardware config 7246@cindex hardware models and configurations, specifying 7247@cindex machine dependent options 7248 7249Earlier we discussed the standard option @option{-b} which chooses among 7250different installed compilers for completely different target 7251machines, such as VAX vs.@: 68000 vs.@: 80386. 7252 7253In addition, each of these target machine types can have its own 7254special options, starting with @samp{-m}, to choose among various 7255hardware models or configurations---for example, 68010 vs 68020, 7256floating coprocessor or none. A single installed version of the 7257compiler can compile for any model or configuration, according to the 7258options specified. 7259 7260Some configurations of the compiler also support additional special 7261options, usually for compatibility with other compilers on the same 7262platform. 7263 7264@c This list is ordered alphanumerically by subsection name. 7265@c It should be the same order and spelling as these options are listed 7266@c in Machine Dependent Options 7267 7268@menu 7269* ARC Options:: 7270* ARM Options:: 7271* AVR Options:: 7272* Blackfin Options:: 7273* CRIS Options:: 7274* CRX Options:: 7275* Darwin Options:: 7276* DEC Alpha Options:: 7277* DEC Alpha/VMS Options:: 7278* FRV Options:: 7279* GNU/Linux Options:: 7280* H8/300 Options:: 7281* HPPA Options:: 7282* i386 and x86-64 Options:: 7283* IA-64 Options:: 7284* M32C Options:: 7285* M32R/D Options:: 7286* M680x0 Options:: 7287* M68hc1x Options:: 7288* MCore Options:: 7289* MIPS Options:: 7290* MMIX Options:: 7291* MN10300 Options:: 7292* MT Options:: 7293* PDP-11 Options:: 7294* PowerPC Options:: 7295* RS/6000 and PowerPC Options:: 7296* S/390 and zSeries Options:: 7297* Score Options:: 7298* SH Options:: 7299* SPARC Options:: 7300* System V Options:: 7301* TMS320C3x/C4x Options:: 7302* V850 Options:: 7303* VAX Options:: 7304* x86-64 Options:: 7305* Xstormy16 Options:: 7306* Xtensa Options:: 7307* zSeries Options:: 7308@end menu 7309 7310@node ARC Options 7311@subsection ARC Options 7312@cindex ARC Options 7313 7314These options are defined for ARC implementations: 7315 7316@table @gcctabopt 7317@item -EL 7318@opindex EL 7319Compile code for little endian mode. This is the default. 7320 7321@item -EB 7322@opindex EB 7323Compile code for big endian mode. 7324 7325@item -mmangle-cpu 7326@opindex mmangle-cpu 7327Prepend the name of the cpu to all public symbol names. 7328In multiple-processor systems, there are many ARC variants with different 7329instruction and register set characteristics. This flag prevents code 7330compiled for one cpu to be linked with code compiled for another. 7331No facility exists for handling variants that are ``almost identical''. 7332This is an all or nothing option. 7333 7334@item -mcpu=@var{cpu} 7335@opindex mcpu 7336Compile code for ARC variant @var{cpu}. 7337Which variants are supported depend on the configuration. 7338All variants support @option{-mcpu=base}, this is the default. 7339 7340@item -mtext=@var{text-section} 7341@itemx -mdata=@var{data-section} 7342@itemx -mrodata=@var{readonly-data-section} 7343@opindex mtext 7344@opindex mdata 7345@opindex mrodata 7346Put functions, data, and readonly data in @var{text-section}, 7347@var{data-section}, and @var{readonly-data-section} respectively 7348by default. This can be overridden with the @code{section} attribute. 7349@xref{Variable Attributes}. 7350 7351@end table 7352 7353@node ARM Options 7354@subsection ARM Options 7355@cindex ARM options 7356 7357These @samp{-m} options are defined for Advanced RISC Machines (ARM) 7358architectures: 7359 7360@table @gcctabopt 7361@item -mabi=@var{name} 7362@opindex mabi 7363Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 7364@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 7365 7366@item -mapcs-frame 7367@opindex mapcs-frame 7368Generate a stack frame that is compliant with the ARM Procedure Call 7369Standard for all functions, even if this is not strictly necessary for 7370correct execution of the code. Specifying @option{-fomit-frame-pointer} 7371with this option will cause the stack frames not to be generated for 7372leaf functions. The default is @option{-mno-apcs-frame}. 7373 7374@item -mapcs 7375@opindex mapcs 7376This is a synonym for @option{-mapcs-frame}. 7377 7378@ignore 7379@c not currently implemented 7380@item -mapcs-stack-check 7381@opindex mapcs-stack-check 7382Generate code to check the amount of stack space available upon entry to 7383every function (that actually uses some stack space). If there is 7384insufficient space available then either the function 7385@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be 7386called, depending upon the amount of stack space required. The run time 7387system is required to provide these functions. The default is 7388@option{-mno-apcs-stack-check}, since this produces smaller code. 7389 7390@c not currently implemented 7391@item -mapcs-float 7392@opindex mapcs-float 7393Pass floating point arguments using the float point registers. This is 7394one of the variants of the APCS@. This option is recommended if the 7395target hardware has a floating point unit or if a lot of floating point 7396arithmetic is going to be performed by the code. The default is 7397@option{-mno-apcs-float}, since integer only code is slightly increased in 7398size if @option{-mapcs-float} is used. 7399 7400@c not currently implemented 7401@item -mapcs-reentrant 7402@opindex mapcs-reentrant 7403Generate reentrant, position independent code. The default is 7404@option{-mno-apcs-reentrant}. 7405@end ignore 7406 7407@item -mthumb-interwork 7408@opindex mthumb-interwork 7409Generate code which supports calling between the ARM and Thumb 7410instruction sets. Without this option the two instruction sets cannot 7411be reliably used inside one program. The default is 7412@option{-mno-thumb-interwork}, since slightly larger code is generated 7413when @option{-mthumb-interwork} is specified. 7414 7415@item -mno-sched-prolog 7416@opindex mno-sched-prolog 7417Prevent the reordering of instructions in the function prolog, or the 7418merging of those instruction with the instructions in the function's 7419body. This means that all functions will start with a recognizable set 7420of instructions (or in fact one of a choice from a small set of 7421different function prologues), and this information can be used to 7422locate the start if functions inside an executable piece of code. The 7423default is @option{-msched-prolog}. 7424 7425@item -mhard-float 7426@opindex mhard-float 7427Generate output containing floating point instructions. This is the 7428default. 7429 7430@item -msoft-float 7431@opindex msoft-float 7432Generate output containing library calls for floating point. 7433@strong{Warning:} the requisite libraries are not available for all ARM 7434targets. Normally the facilities of the machine's usual C compiler are 7435used, but this cannot be done directly in cross-compilation. You must make 7436your own arrangements to provide suitable library functions for 7437cross-compilation. 7438 7439@option{-msoft-float} changes the calling convention in the output file; 7440therefore, it is only useful if you compile @emph{all} of a program with 7441this option. In particular, you need to compile @file{libgcc.a}, the 7442library that comes with GCC, with @option{-msoft-float} in order for 7443this to work. 7444 7445@item -mfloat-abi=@var{name} 7446@opindex mfloat-abi 7447Specifies which ABI to use for floating point values. Permissible values 7448are: @samp{soft}, @samp{softfp} and @samp{hard}. 7449 7450@samp{soft} and @samp{hard} are equivalent to @option{-msoft-float} 7451and @option{-mhard-float} respectively. @samp{softfp} allows the generation 7452of floating point instructions, but still uses the soft-float calling 7453conventions. 7454 7455@item -mlittle-endian 7456@opindex mlittle-endian 7457Generate code for a processor running in little-endian mode. This is 7458the default for all standard configurations. 7459 7460@item -mbig-endian 7461@opindex mbig-endian 7462Generate code for a processor running in big-endian mode; the default is 7463to compile code for a little-endian processor. 7464 7465@item -mwords-little-endian 7466@opindex mwords-little-endian 7467This option only applies when generating code for big-endian processors. 7468Generate code for a little-endian word order but a big-endian byte 7469order. That is, a byte order of the form @samp{32107654}. Note: this 7470option should only be used if you require compatibility with code for 7471big-endian ARM processors generated by versions of the compiler prior to 74722.8. 7473 7474@item -mcpu=@var{name} 7475@opindex mcpu 7476This specifies the name of the target ARM processor. GCC uses this name 7477to determine what kind of instructions it can emit when generating 7478assembly code. Permissible names are: @samp{arm2}, @samp{arm250}, 7479@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 7480@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 7481@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 7482@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 7483@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s}, 7484@samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 7485@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 7486@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s}, 7487@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi}, 7488@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s}, 7489@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 7490@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 7491@samp{arm1176jz-s}, @samp{arm1176jzf-s}, @samp{xscale}, @samp{iwmmxt}, 7492@samp{ep9312}. 7493 7494@itemx -mtune=@var{name} 7495@opindex mtune 7496This option is very similar to the @option{-mcpu=} option, except that 7497instead of specifying the actual target processor type, and hence 7498restricting which instructions can be used, it specifies that GCC should 7499tune the performance of the code as if the target were of the type 7500specified in this option, but still choosing the instructions that it 7501will generate based on the cpu specified by a @option{-mcpu=} option. 7502For some ARM implementations better performance can be obtained by using 7503this option. 7504 7505@item -march=@var{name} 7506@opindex march 7507This specifies the name of the target ARM architecture. GCC uses this 7508name to determine what kind of instructions it can emit when generating 7509assembly code. This option can be used in conjunction with or instead 7510of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, 7511@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, 7512@samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j}, 7513@samp{iwmmxt}, @samp{ep9312}. 7514 7515@item -mfpu=@var{name} 7516@itemx -mfpe=@var{number} 7517@itemx -mfp=@var{number} 7518@opindex mfpu 7519@opindex mfpe 7520@opindex mfp 7521This specifies what floating point hardware (or hardware emulation) is 7522available on the target. Permissible names are: @samp{fpa}, @samp{fpe2}, 7523@samp{fpe3}, @samp{maverick}, @samp{vfp}. @option{-mfp} and @option{-mfpe} 7524are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility 7525with older versions of GCC@. 7526 7527If @option{-msoft-float} is specified this specifies the format of 7528floating point values. 7529 7530@item -mstructure-size-boundary=@var{n} 7531@opindex mstructure-size-boundary 7532The size of all structures and unions will be rounded up to a multiple 7533of the number of bits set by this option. Permissible values are 8, 32 7534and 64. The default value varies for different toolchains. For the COFF 7535targeted toolchain the default value is 8. A value of 64 is only allowed 7536if the underlying ABI supports it. 7537 7538Specifying the larger number can produce faster, more efficient code, but 7539can also increase the size of the program. Different values are potentially 7540incompatible. Code compiled with one value cannot necessarily expect to 7541work with code or libraries compiled with another value, if they exchange 7542information using structures or unions. 7543 7544@item -mabort-on-noreturn 7545@opindex mabort-on-noreturn 7546Generate a call to the function @code{abort} at the end of a 7547@code{noreturn} function. It will be executed if the function tries to 7548return. 7549 7550@item -mlong-calls 7551@itemx -mno-long-calls 7552@opindex mlong-calls 7553@opindex mno-long-calls 7554Tells the compiler to perform function calls by first loading the 7555address of the function into a register and then performing a subroutine 7556call on this register. This switch is needed if the target function 7557will lie outside of the 64 megabyte addressing range of the offset based 7558version of subroutine call instruction. 7559 7560Even if this switch is enabled, not all function calls will be turned 7561into long calls. The heuristic is that static functions, functions 7562which have the @samp{short-call} attribute, functions that are inside 7563the scope of a @samp{#pragma no_long_calls} directive and functions whose 7564definitions have already been compiled within the current compilation 7565unit, will not be turned into long calls. The exception to this rule is 7566that weak function definitions, functions with the @samp{long-call} 7567attribute or the @samp{section} attribute, and functions that are within 7568the scope of a @samp{#pragma long_calls} directive, will always be 7569turned into long calls. 7570 7571This feature is not enabled by default. Specifying 7572@option{-mno-long-calls} will restore the default behavior, as will 7573placing the function calls within the scope of a @samp{#pragma 7574long_calls_off} directive. Note these switches have no effect on how 7575the compiler generates code to handle function calls via function 7576pointers. 7577 7578@item -mnop-fun-dllimport 7579@opindex mnop-fun-dllimport 7580Disable support for the @code{dllimport} attribute. 7581 7582@item -msingle-pic-base 7583@opindex msingle-pic-base 7584Treat the register used for PIC addressing as read-only, rather than 7585loading it in the prologue for each function. The run-time system is 7586responsible for initializing this register with an appropriate value 7587before execution begins. 7588 7589@item -mpic-register=@var{reg} 7590@opindex mpic-register 7591Specify the register to be used for PIC addressing. The default is R10 7592unless stack-checking is enabled, when R9 is used. 7593 7594@item -mcirrus-fix-invalid-insns 7595@opindex mcirrus-fix-invalid-insns 7596@opindex mno-cirrus-fix-invalid-insns 7597Insert NOPs into the instruction stream to in order to work around 7598problems with invalid Maverick instruction combinations. This option 7599is only valid if the @option{-mcpu=ep9312} option has been used to 7600enable generation of instructions for the Cirrus Maverick floating 7601point co-processor. This option is not enabled by default, since the 7602problem is only present in older Maverick implementations. The default 7603can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns} 7604switch. 7605 7606@item -mpoke-function-name 7607@opindex mpoke-function-name 7608Write the name of each function into the text section, directly 7609preceding the function prologue. The generated code is similar to this: 7610 7611@smallexample 7612 t0 7613 .ascii "arm_poke_function_name", 0 7614 .align 7615 t1 7616 .word 0xff000000 + (t1 - t0) 7617 arm_poke_function_name 7618 mov ip, sp 7619 stmfd sp!, @{fp, ip, lr, pc@} 7620 sub fp, ip, #4 7621@end smallexample 7622 7623When performing a stack backtrace, code can inspect the value of 7624@code{pc} stored at @code{fp + 0}. If the trace function then looks at 7625location @code{pc - 12} and the top 8 bits are set, then we know that 7626there is a function name embedded immediately preceding this location 7627and has length @code{((pc[-3]) & 0xff000000)}. 7628 7629@item -mthumb 7630@opindex mthumb 7631Generate code for the 16-bit Thumb instruction set. The default is to 7632use the 32-bit ARM instruction set. 7633 7634@item -mtpcs-frame 7635@opindex mtpcs-frame 7636Generate a stack frame that is compliant with the Thumb Procedure Call 7637Standard for all non-leaf functions. (A leaf function is one that does 7638not call any other functions.) The default is @option{-mno-tpcs-frame}. 7639 7640@item -mtpcs-leaf-frame 7641@opindex mtpcs-leaf-frame 7642Generate a stack frame that is compliant with the Thumb Procedure Call 7643Standard for all leaf functions. (A leaf function is one that does 7644not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 7645 7646@item -mcallee-super-interworking 7647@opindex mcallee-super-interworking 7648Gives all externally visible functions in the file being compiled an ARM 7649instruction set header which switches to Thumb mode before executing the 7650rest of the function. This allows these functions to be called from 7651non-interworking code. 7652 7653@item -mcaller-super-interworking 7654@opindex mcaller-super-interworking 7655Allows calls via function pointers (including virtual functions) to 7656execute correctly regardless of whether the target code has been 7657compiled for interworking or not. There is a small overhead in the cost 7658of executing a function pointer if this option is enabled. 7659 7660@item -mtp=@var{name} 7661@opindex mtp 7662Specify the access model for the thread local storage pointer. The valid 7663models are @option{soft}, which generates calls to @code{__aeabi_read_tp}, 7664@option{cp15}, which fetches the thread pointer from @code{cp15} directly 7665(supported in the arm6k architecture), and @option{auto}, which uses the 7666best available method for the selected processor. The default setting is 7667@option{auto}. 7668 7669@end table 7670 7671@node AVR Options 7672@subsection AVR Options 7673@cindex AVR Options 7674 7675These options are defined for AVR implementations: 7676 7677@table @gcctabopt 7678@item -mmcu=@var{mcu} 7679@opindex mmcu 7680Specify ATMEL AVR instruction set or MCU type. 7681 7682Instruction set avr1 is for the minimal AVR core, not supported by the C 7683compiler, only for assembler programs (MCU types: at90s1200, attiny10, 7684attiny11, attiny12, attiny15, attiny28). 7685 7686Instruction set avr2 (default) is for the classic AVR core with up to 76878K program memory space (MCU types: at90s2313, at90s2323, attiny22, 7688at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, 7689at90c8534, at90s8535). 7690 7691Instruction set avr3 is for the classic AVR core with up to 128K program 7692memory space (MCU types: atmega103, atmega603, at43usb320, at76c711). 7693 7694Instruction set avr4 is for the enhanced AVR core with up to 8K program 7695memory space (MCU types: atmega8, atmega83, atmega85). 7696 7697Instruction set avr5 is for the enhanced AVR core with up to 128K program 7698memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323, 7699atmega64, atmega128, at43usb355, at94k). 7700 7701@item -msize 7702@opindex msize 7703Output instruction sizes to the asm file. 7704 7705@item -minit-stack=@var{N} 7706@opindex minit-stack 7707Specify the initial stack address, which may be a symbol or numeric value, 7708@samp{__stack} is the default. 7709 7710@item -mno-interrupts 7711@opindex mno-interrupts 7712Generated code is not compatible with hardware interrupts. 7713Code size will be smaller. 7714 7715@item -mcall-prologues 7716@opindex mcall-prologues 7717Functions prologues/epilogues expanded as call to appropriate 7718subroutines. Code size will be smaller. 7719 7720@item -mno-tablejump 7721@opindex mno-tablejump 7722Do not generate tablejump insns which sometimes increase code size. 7723 7724@item -mtiny-stack 7725@opindex mtiny-stack 7726Change only the low 8 bits of the stack pointer. 7727 7728@item -mint8 7729@opindex mint8 7730Assume int to be 8 bit integer. This affects the sizes of all types: A 7731char will be 1 byte, an int will be 1 byte, an long will be 2 bytes 7732and long long will be 4 bytes. Please note that this option does not 7733comply to the C standards, but it will provide you with smaller code 7734size. 7735@end table 7736 7737@node Blackfin Options 7738@subsection Blackfin Options 7739@cindex Blackfin Options 7740 7741@table @gcctabopt 7742@item -momit-leaf-frame-pointer 7743@opindex momit-leaf-frame-pointer 7744Don't keep the frame pointer in a register for leaf functions. This 7745avoids the instructions to save, set up and restore frame pointers and 7746makes an extra register available in leaf functions. The option 7747@option{-fomit-frame-pointer} removes the frame pointer for all functions 7748which might make debugging harder. 7749 7750@item -mspecld-anomaly 7751@opindex mspecld-anomaly 7752When enabled, the compiler will ensure that the generated code does not 7753contain speculative loads after jump instructions. This option is enabled 7754by default. 7755 7756@item -mno-specld-anomaly 7757@opindex mno-specld-anomaly 7758Don't generate extra code to prevent speculative loads from occurring. 7759 7760@item -mcsync-anomaly 7761@opindex mcsync-anomaly 7762When enabled, the compiler will ensure that the generated code does not 7763contain CSYNC or SSYNC instructions too soon after conditional branches. 7764This option is enabled by default. 7765 7766@item -mno-csync-anomaly 7767@opindex mno-csync-anomaly 7768Don't generate extra code to prevent CSYNC or SSYNC instructions from 7769occurring too soon after a conditional branch. 7770 7771@item -mlow-64k 7772@opindex mlow-64k 7773When enabled, the compiler is free to take advantage of the knowledge that 7774the entire program fits into the low 64k of memory. 7775 7776@item -mno-low-64k 7777@opindex mno-low-64k 7778Assume that the program is arbitrarily large. This is the default. 7779 7780@item -mid-shared-library 7781@opindex mid-shared-library 7782Generate code that supports shared libraries via the library ID method. 7783This allows for execute in place and shared libraries in an environment 7784without virtual memory management. This option implies @option{-fPIC}. 7785 7786@item -mno-id-shared-library 7787@opindex mno-id-shared-library 7788Generate code that doesn't assume ID based shared libraries are being used. 7789This is the default. 7790 7791@item -mshared-library-id=n 7792@opindex mshared-library-id 7793Specified the identification number of the ID based shared library being 7794compiled. Specifying a value of 0 will generate more compact code, specifying 7795other values will force the allocation of that number to the current 7796library but is no more space or time efficient than omitting this option. 7797 7798@item -mlong-calls 7799@itemx -mno-long-calls 7800@opindex mlong-calls 7801@opindex mno-long-calls 7802Tells the compiler to perform function calls by first loading the 7803address of the function into a register and then performing a subroutine 7804call on this register. This switch is needed if the target function 7805will lie outside of the 24 bit addressing range of the offset based 7806version of subroutine call instruction. 7807 7808This feature is not enabled by default. Specifying 7809@option{-mno-long-calls} will restore the default behavior. Note these 7810switches have no effect on how the compiler generates code to handle 7811function calls via function pointers. 7812@end table 7813 7814@node CRIS Options 7815@subsection CRIS Options 7816@cindex CRIS Options 7817 7818These options are defined specifically for the CRIS ports. 7819 7820@table @gcctabopt 7821@item -march=@var{architecture-type} 7822@itemx -mcpu=@var{architecture-type} 7823@opindex march 7824@opindex mcpu 7825Generate code for the specified architecture. The choices for 7826@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 7827respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 7828Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 7829@samp{v10}. 7830 7831@item -mtune=@var{architecture-type} 7832@opindex mtune 7833Tune to @var{architecture-type} everything applicable about the generated 7834code, except for the ABI and the set of available instructions. The 7835choices for @var{architecture-type} are the same as for 7836@option{-march=@var{architecture-type}}. 7837 7838@item -mmax-stack-frame=@var{n} 7839@opindex mmax-stack-frame 7840Warn when the stack frame of a function exceeds @var{n} bytes. 7841 7842@item -melinux-stacksize=@var{n} 7843@opindex melinux-stacksize 7844Only available with the @samp{cris-axis-aout} target. Arranges for 7845indications in the program to the kernel loader that the stack of the 7846program should be set to @var{n} bytes. 7847 7848@item -metrax4 7849@itemx -metrax100 7850@opindex metrax4 7851@opindex metrax100 7852The options @option{-metrax4} and @option{-metrax100} are synonyms for 7853@option{-march=v3} and @option{-march=v8} respectively. 7854 7855@item -mmul-bug-workaround 7856@itemx -mno-mul-bug-workaround 7857@opindex mmul-bug-workaround 7858@opindex mno-mul-bug-workaround 7859Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 7860models where it applies. This option is active by default. 7861 7862@item -mpdebug 7863@opindex mpdebug 7864Enable CRIS-specific verbose debug-related information in the assembly 7865code. This option also has the effect to turn off the @samp{#NO_APP} 7866formatted-code indicator to the assembler at the beginning of the 7867assembly file. 7868 7869@item -mcc-init 7870@opindex mcc-init 7871Do not use condition-code results from previous instruction; always emit 7872compare and test instructions before use of condition codes. 7873 7874@item -mno-side-effects 7875@opindex mno-side-effects 7876Do not emit instructions with side-effects in addressing modes other than 7877post-increment. 7878 7879@item -mstack-align 7880@itemx -mno-stack-align 7881@itemx -mdata-align 7882@itemx -mno-data-align 7883@itemx -mconst-align 7884@itemx -mno-const-align 7885@opindex mstack-align 7886@opindex mno-stack-align 7887@opindex mdata-align 7888@opindex mno-data-align 7889@opindex mconst-align 7890@opindex mno-const-align 7891These options (no-options) arranges (eliminate arrangements) for the 7892stack-frame, individual data and constants to be aligned for the maximum 7893single data access size for the chosen CPU model. The default is to 7894arrange for 32-bit alignment. ABI details such as structure layout are 7895not affected by these options. 7896 7897@item -m32-bit 7898@itemx -m16-bit 7899@itemx -m8-bit 7900@opindex m32-bit 7901@opindex m16-bit 7902@opindex m8-bit 7903Similar to the stack- data- and const-align options above, these options 7904arrange for stack-frame, writable data and constants to all be 32-bit, 790516-bit or 8-bit aligned. The default is 32-bit alignment. 7906 7907@item -mno-prologue-epilogue 7908@itemx -mprologue-epilogue 7909@opindex mno-prologue-epilogue 7910@opindex mprologue-epilogue 7911With @option{-mno-prologue-epilogue}, the normal function prologue and 7912epilogue that sets up the stack-frame are omitted and no return 7913instructions or return sequences are generated in the code. Use this 7914option only together with visual inspection of the compiled code: no 7915warnings or errors are generated when call-saved registers must be saved, 7916or storage for local variable needs to be allocated. 7917 7918@item -mno-gotplt 7919@itemx -mgotplt 7920@opindex mno-gotplt 7921@opindex mgotplt 7922With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 7923instruction sequences that load addresses for functions from the PLT part 7924of the GOT rather than (traditional on other architectures) calls to the 7925PLT@. The default is @option{-mgotplt}. 7926 7927@item -maout 7928@opindex maout 7929Legacy no-op option only recognized with the cris-axis-aout target. 7930 7931@item -melf 7932@opindex melf 7933Legacy no-op option only recognized with the cris-axis-elf and 7934cris-axis-linux-gnu targets. 7935 7936@item -melinux 7937@opindex melinux 7938Only recognized with the cris-axis-aout target, where it selects a 7939GNU/linux-like multilib, include files and instruction set for 7940@option{-march=v8}. 7941 7942@item -mlinux 7943@opindex mlinux 7944Legacy no-op option only recognized with the cris-axis-linux-gnu target. 7945 7946@item -sim 7947@opindex sim 7948This option, recognized for the cris-axis-aout and cris-axis-elf arranges 7949to link with input-output functions from a simulator library. Code, 7950initialized data and zero-initialized data are allocated consecutively. 7951 7952@item -sim2 7953@opindex sim2 7954Like @option{-sim}, but pass linker options to locate initialized data at 79550x40000000 and zero-initialized data at 0x80000000. 7956@end table 7957 7958@node CRX Options 7959@subsection CRX Options 7960@cindex CRX Options 7961 7962These options are defined specifically for the CRX ports. 7963 7964@table @gcctabopt 7965 7966@item -mmac 7967@opindex mmac 7968Enable the use of multiply-accumulate instructions. Disabled by default. 7969 7970@item -mpush-args 7971@opindex mpush-args 7972Push instructions will be used to pass outgoing arguments when functions 7973are called. Enabled by default. 7974@end table 7975 7976@node Darwin Options 7977@subsection Darwin Options 7978@cindex Darwin options 7979 7980These options are defined for all architectures running the Darwin operating 7981system. 7982 7983FSF GCC on Darwin does not create ``fat'' object files; it will create 7984an object file for the single architecture that it was built to 7985target. Apple's GCC on Darwin does create ``fat'' files if multiple 7986@option{-arch} options are used; it does so by running the compiler or 7987linker multiple times and joining the results together with 7988@file{lipo}. 7989 7990The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 7991@samp{i686}) is determined by the flags that specify the ISA 7992that GCC is targetting, like @option{-mcpu} or @option{-march}. The 7993@option{-force_cpusubtype_ALL} option can be used to override this. 7994 7995The Darwin tools vary in their behavior when presented with an ISA 7996mismatch. The assembler, @file{as}, will only permit instructions to 7997be used that are valid for the subtype of the file it is generating, 7998so you cannot put 64-bit instructions in an @samp{ppc750} object file. 7999The linker for shared libraries, @file{/usr/bin/libtool}, will fail 8000and print an error if asked to create a shared library with a less 8001restrictive subtype than its input files (for instance, trying to put 8002a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 8003for executables, @file{ld}, will quietly give the executable the most 8004restrictive subtype of any of its input files. 8005 8006@table @gcctabopt 8007@item -F@var{dir} 8008@opindex F 8009Add the framework directory @var{dir} to the head of the list of 8010directories to be searched for header files. These directories are 8011interleaved with those specified by @option{-I} options and are 8012scanned in a left-to-right order. 8013 8014A framework directory is a directory with frameworks in it. A 8015framework is a directory with a @samp{"Headers"} and/or 8016@samp{"PrivateHeaders"} directory contained directly in it that ends 8017in @samp{".framework"}. The name of a framework is the name of this 8018directory excluding the @samp{".framework"}. Headers associated with 8019the framework are found in one of those two directories, with 8020@samp{"Headers"} being searched first. A subframework is a framework 8021directory that is in a framework's @samp{"Frameworks"} directory. 8022Includes of subframework headers can only appear in a header of a 8023framework that contains the subframework, or in a sibling subframework 8024header. Two subframeworks are siblings if they occur in the same 8025framework. A subframework should not have the same name as a 8026framework, a warning will be issued if this is violated. Currently a 8027subframework cannot have subframeworks, in the future, the mechanism 8028may be extended to support this. The standard frameworks can be found 8029in @samp{"/System/Library/Frameworks"} and 8030@samp{"/Library/Frameworks"}. An example include looks like 8031@code{#include <Framework/header.h>}, where @samp{Framework} denotes 8032the name of the framework and header.h is found in the 8033@samp{"PrivateHeaders"} or @samp{"Headers"} directory. 8034 8035@item -gused 8036@opindex gused 8037Emit debugging information for symbols that are used. For STABS 8038debugging format, this enables @option{-feliminate-unused-debug-symbols}. 8039This is by default ON@. 8040 8041@item -gfull 8042@opindex gfull 8043Emit debugging information for all symbols and types. 8044 8045@item -mmacosx-version-min=@var{version} 8046The earliest version of MacOS X that this executable will run on 8047is @var{version}. Typical values of @var{version} include @code{10.1}, 8048@code{10.2}, and @code{10.3.9}. 8049 8050The default for this option is to make choices that seem to be most 8051useful. 8052 8053@item -mkernel 8054@opindex mkernel 8055Enable kernel development mode. The @option{-mkernel} option sets 8056@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit}, 8057@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 8058@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 8059applicable. This mode also sets @option{-mno-altivec}, 8060@option{-msoft-float}, @option{-fno-builtin} and 8061@option{-mlong-branch} for PowerPC targets. 8062 8063@item -mone-byte-bool 8064@opindex mone-byte-bool 8065Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}. 8066By default @samp{sizeof(bool)} is @samp{4} when compiling for 8067Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this 8068option has no effect on x86. 8069 8070@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 8071to generate code that is not binary compatible with code generated 8072without that switch. Using this switch may require recompiling all 8073other modules in a program, including system libraries. Use this 8074switch to conform to a non-default data model. 8075 8076@item -mfix-and-continue 8077@itemx -ffix-and-continue 8078@itemx -findirect-data 8079@opindex mfix-and-continue 8080@opindex ffix-and-continue 8081@opindex findirect-data 8082Generate code suitable for fast turn around development. Needed to 8083enable gdb to dynamically load @code{.o} files into already running 8084programs. @option{-findirect-data} and @option{-ffix-and-continue} 8085are provided for backwards compatibility. 8086 8087@item -all_load 8088@opindex all_load 8089Loads all members of static archive libraries. 8090See man ld(1) for more information. 8091 8092@item -arch_errors_fatal 8093@opindex arch_errors_fatal 8094Cause the errors having to do with files that have the wrong architecture 8095to be fatal. 8096 8097@item -bind_at_load 8098@opindex bind_at_load 8099Causes the output file to be marked such that the dynamic linker will 8100bind all undefined references when the file is loaded or launched. 8101 8102@item -bundle 8103@opindex bundle 8104Produce a Mach-o bundle format file. 8105See man ld(1) for more information. 8106 8107@item -bundle_loader @var{executable} 8108@opindex bundle_loader 8109This option specifies the @var{executable} that will be loading the build 8110output file being linked. See man ld(1) for more information. 8111 8112@item -dynamiclib 8113@opindex dynamiclib 8114When passed this option, GCC will produce a dynamic library instead of 8115an executable when linking, using the Darwin @file{libtool} command. 8116 8117@item -force_cpusubtype_ALL 8118@opindex force_cpusubtype_ALL 8119This causes GCC's output file to have the @var{ALL} subtype, instead of 8120one controlled by the @option{-mcpu} or @option{-march} option. 8121 8122@item -allowable_client @var{client_name} 8123@itemx -client_name 8124@itemx -compatibility_version 8125@itemx -current_version 8126@itemx -dead_strip 8127@itemx -dependency-file 8128@itemx -dylib_file 8129@itemx -dylinker_install_name 8130@itemx -dynamic 8131@itemx -exported_symbols_list 8132@itemx -filelist 8133@itemx -flat_namespace 8134@itemx -force_flat_namespace 8135@itemx -headerpad_max_install_names 8136@itemx -image_base 8137@itemx -init 8138@itemx -install_name 8139@itemx -keep_private_externs 8140@itemx -multi_module 8141@itemx -multiply_defined 8142@itemx -multiply_defined_unused 8143@itemx -noall_load 8144@itemx -no_dead_strip_inits_and_terms 8145@itemx -nofixprebinding 8146@itemx -nomultidefs 8147@itemx -noprebind 8148@itemx -noseglinkedit 8149@itemx -pagezero_size 8150@itemx -prebind 8151@itemx -prebind_all_twolevel_modules 8152@itemx -private_bundle 8153@itemx -read_only_relocs 8154@itemx -sectalign 8155@itemx -sectobjectsymbols 8156@itemx -whyload 8157@itemx -seg1addr 8158@itemx -sectcreate 8159@itemx -sectobjectsymbols 8160@itemx -sectorder 8161@itemx -segaddr 8162@itemx -segs_read_only_addr 8163@itemx -segs_read_write_addr 8164@itemx -seg_addr_table 8165@itemx -seg_addr_table_filename 8166@itemx -seglinkedit 8167@itemx -segprot 8168@itemx -segs_read_only_addr 8169@itemx -segs_read_write_addr 8170@itemx -single_module 8171@itemx -static 8172@itemx -sub_library 8173@itemx -sub_umbrella 8174@itemx -twolevel_namespace 8175@itemx -umbrella 8176@itemx -undefined 8177@itemx -unexported_symbols_list 8178@itemx -weak_reference_mismatches 8179@itemx -whatsloaded 8180 8181@opindex allowable_client 8182@opindex client_name 8183@opindex compatibility_version 8184@opindex current_version 8185@opindex dead_strip 8186@opindex dependency-file 8187@opindex dylib_file 8188@opindex dylinker_install_name 8189@opindex dynamic 8190@opindex exported_symbols_list 8191@opindex filelist 8192@opindex flat_namespace 8193@opindex force_flat_namespace 8194@opindex headerpad_max_install_names 8195@opindex image_base 8196@opindex init 8197@opindex install_name 8198@opindex keep_private_externs 8199@opindex multi_module 8200@opindex multiply_defined 8201@opindex multiply_defined_unused 8202@opindex noall_load 8203@opindex no_dead_strip_inits_and_terms 8204@opindex nofixprebinding 8205@opindex nomultidefs 8206@opindex noprebind 8207@opindex noseglinkedit 8208@opindex pagezero_size 8209@opindex prebind 8210@opindex prebind_all_twolevel_modules 8211@opindex private_bundle 8212@opindex read_only_relocs 8213@opindex sectalign 8214@opindex sectobjectsymbols 8215@opindex whyload 8216@opindex seg1addr 8217@opindex sectcreate 8218@opindex sectobjectsymbols 8219@opindex sectorder 8220@opindex segaddr 8221@opindex segs_read_only_addr 8222@opindex segs_read_write_addr 8223@opindex seg_addr_table 8224@opindex seg_addr_table_filename 8225@opindex seglinkedit 8226@opindex segprot 8227@opindex segs_read_only_addr 8228@opindex segs_read_write_addr 8229@opindex single_module 8230@opindex static 8231@opindex sub_library 8232@opindex sub_umbrella 8233@opindex twolevel_namespace 8234@opindex umbrella 8235@opindex undefined 8236@opindex unexported_symbols_list 8237@opindex weak_reference_mismatches 8238@opindex whatsloaded 8239 8240These options are passed to the Darwin linker. The Darwin linker man page 8241describes them in detail. 8242@end table 8243 8244@node DEC Alpha Options 8245@subsection DEC Alpha Options 8246 8247These @samp{-m} options are defined for the DEC Alpha implementations: 8248 8249@table @gcctabopt 8250@item -mno-soft-float 8251@itemx -msoft-float 8252@opindex mno-soft-float 8253@opindex msoft-float 8254Use (do not use) the hardware floating-point instructions for 8255floating-point operations. When @option{-msoft-float} is specified, 8256functions in @file{libgcc.a} will be used to perform floating-point 8257operations. Unless they are replaced by routines that emulate the 8258floating-point operations, or compiled in such a way as to call such 8259emulations routines, these routines will issue floating-point 8260operations. If you are compiling for an Alpha without floating-point 8261operations, you must ensure that the library is built so as not to call 8262them. 8263 8264Note that Alpha implementations without floating-point operations are 8265required to have floating-point registers. 8266 8267@item -mfp-reg 8268@itemx -mno-fp-regs 8269@opindex mfp-reg 8270@opindex mno-fp-regs 8271Generate code that uses (does not use) the floating-point register set. 8272@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 8273register set is not used, floating point operands are passed in integer 8274registers as if they were integers and floating-point results are passed 8275in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 8276so any function with a floating-point argument or return value called by code 8277compiled with @option{-mno-fp-regs} must also be compiled with that 8278option. 8279 8280A typical use of this option is building a kernel that does not use, 8281and hence need not save and restore, any floating-point registers. 8282 8283@item -mieee 8284@opindex mieee 8285The Alpha architecture implements floating-point hardware optimized for 8286maximum performance. It is mostly compliant with the IEEE floating 8287point standard. However, for full compliance, software assistance is 8288required. This option generates code fully IEEE compliant code 8289@emph{except} that the @var{inexact-flag} is not maintained (see below). 8290If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 8291defined during compilation. The resulting code is less efficient but is 8292able to correctly support denormalized numbers and exceptional IEEE 8293values such as not-a-number and plus/minus infinity. Other Alpha 8294compilers call this option @option{-ieee_with_no_inexact}. 8295 8296@item -mieee-with-inexact 8297@opindex mieee-with-inexact 8298This is like @option{-mieee} except the generated code also maintains 8299the IEEE @var{inexact-flag}. Turning on this option causes the 8300generated code to implement fully-compliant IEEE math. In addition to 8301@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 8302macro. On some Alpha implementations the resulting code may execute 8303significantly slower than the code generated by default. Since there is 8304very little code that depends on the @var{inexact-flag}, you should 8305normally not specify this option. Other Alpha compilers call this 8306option @option{-ieee_with_inexact}. 8307 8308@item -mfp-trap-mode=@var{trap-mode} 8309@opindex mfp-trap-mode 8310This option controls what floating-point related traps are enabled. 8311Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 8312The trap mode can be set to one of four values: 8313 8314@table @samp 8315@item n 8316This is the default (normal) setting. The only traps that are enabled 8317are the ones that cannot be disabled in software (e.g., division by zero 8318trap). 8319 8320@item u 8321In addition to the traps enabled by @samp{n}, underflow traps are enabled 8322as well. 8323 8324@item su 8325Like @samp{u}, but the instructions are marked to be safe for software 8326completion (see Alpha architecture manual for details). 8327 8328@item sui 8329Like @samp{su}, but inexact traps are enabled as well. 8330@end table 8331 8332@item -mfp-rounding-mode=@var{rounding-mode} 8333@opindex mfp-rounding-mode 8334Selects the IEEE rounding mode. Other Alpha compilers call this option 8335@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 8336of: 8337 8338@table @samp 8339@item n 8340Normal IEEE rounding mode. Floating point numbers are rounded towards 8341the nearest machine number or towards the even machine number in case 8342of a tie. 8343 8344@item m 8345Round towards minus infinity. 8346 8347@item c 8348Chopped rounding mode. Floating point numbers are rounded towards zero. 8349 8350@item d 8351Dynamic rounding mode. A field in the floating point control register 8352(@var{fpcr}, see Alpha architecture reference manual) controls the 8353rounding mode in effect. The C library initializes this register for 8354rounding towards plus infinity. Thus, unless your program modifies the 8355@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 8356@end table 8357 8358@item -mtrap-precision=@var{trap-precision} 8359@opindex mtrap-precision 8360In the Alpha architecture, floating point traps are imprecise. This 8361means without software assistance it is impossible to recover from a 8362floating trap and program execution normally needs to be terminated. 8363GCC can generate code that can assist operating system trap handlers 8364in determining the exact location that caused a floating point trap. 8365Depending on the requirements of an application, different levels of 8366precisions can be selected: 8367 8368@table @samp 8369@item p 8370Program precision. This option is the default and means a trap handler 8371can only identify which program caused a floating point exception. 8372 8373@item f 8374Function precision. The trap handler can determine the function that 8375caused a floating point exception. 8376 8377@item i 8378Instruction precision. The trap handler can determine the exact 8379instruction that caused a floating point exception. 8380@end table 8381 8382Other Alpha compilers provide the equivalent options called 8383@option{-scope_safe} and @option{-resumption_safe}. 8384 8385@item -mieee-conformant 8386@opindex mieee-conformant 8387This option marks the generated code as IEEE conformant. You must not 8388use this option unless you also specify @option{-mtrap-precision=i} and either 8389@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 8390is to emit the line @samp{.eflag 48} in the function prologue of the 8391generated assembly file. Under DEC Unix, this has the effect that 8392IEEE-conformant math library routines will be linked in. 8393 8394@item -mbuild-constants 8395@opindex mbuild-constants 8396Normally GCC examines a 32- or 64-bit integer constant to 8397see if it can construct it from smaller constants in two or three 8398instructions. If it cannot, it will output the constant as a literal and 8399generate code to load it from the data segment at runtime. 8400 8401Use this option to require GCC to construct @emph{all} integer constants 8402using code, even if it takes more instructions (the maximum is six). 8403 8404You would typically use this option to build a shared library dynamic 8405loader. Itself a shared library, it must relocate itself in memory 8406before it can find the variables and constants in its own data segment. 8407 8408@item -malpha-as 8409@itemx -mgas 8410@opindex malpha-as 8411@opindex mgas 8412Select whether to generate code to be assembled by the vendor-supplied 8413assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}. 8414 8415@item -mbwx 8416@itemx -mno-bwx 8417@itemx -mcix 8418@itemx -mno-cix 8419@itemx -mfix 8420@itemx -mno-fix 8421@itemx -mmax 8422@itemx -mno-max 8423@opindex mbwx 8424@opindex mno-bwx 8425@opindex mcix 8426@opindex mno-cix 8427@opindex mfix 8428@opindex mno-fix 8429@opindex mmax 8430@opindex mno-max 8431Indicate whether GCC should generate code to use the optional BWX, 8432CIX, FIX and MAX instruction sets. The default is to use the instruction 8433sets supported by the CPU type specified via @option{-mcpu=} option or that 8434of the CPU on which GCC was built if none was specified. 8435 8436@item -mfloat-vax 8437@itemx -mfloat-ieee 8438@opindex mfloat-vax 8439@opindex mfloat-ieee 8440Generate code that uses (does not use) VAX F and G floating point 8441arithmetic instead of IEEE single and double precision. 8442 8443@item -mexplicit-relocs 8444@itemx -mno-explicit-relocs 8445@opindex mexplicit-relocs 8446@opindex mno-explicit-relocs 8447Older Alpha assemblers provided no way to generate symbol relocations 8448except via assembler macros. Use of these macros does not allow 8449optimal instruction scheduling. GNU binutils as of version 2.12 8450supports a new syntax that allows the compiler to explicitly mark 8451which relocations should apply to which instructions. This option 8452is mostly useful for debugging, as GCC detects the capabilities of 8453the assembler when it is built and sets the default accordingly. 8454 8455@item -msmall-data 8456@itemx -mlarge-data 8457@opindex msmall-data 8458@opindex mlarge-data 8459When @option{-mexplicit-relocs} is in effect, static data is 8460accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 8461is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 8462(the @code{.sdata} and @code{.sbss} sections) and are accessed via 846316-bit relocations off of the @code{$gp} register. This limits the 8464size of the small data area to 64KB, but allows the variables to be 8465directly accessed via a single instruction. 8466 8467The default is @option{-mlarge-data}. With this option the data area 8468is limited to just below 2GB@. Programs that require more than 2GB of 8469data must use @code{malloc} or @code{mmap} to allocate the data in the 8470heap instead of in the program's data segment. 8471 8472When generating code for shared libraries, @option{-fpic} implies 8473@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 8474 8475@item -msmall-text 8476@itemx -mlarge-text 8477@opindex msmall-text 8478@opindex mlarge-text 8479When @option{-msmall-text} is used, the compiler assumes that the 8480code of the entire program (or shared library) fits in 4MB, and is 8481thus reachable with a branch instruction. When @option{-msmall-data} 8482is used, the compiler can assume that all local symbols share the 8483same @code{$gp} value, and thus reduce the number of instructions 8484required for a function call from 4 to 1. 8485 8486The default is @option{-mlarge-text}. 8487 8488@item -mcpu=@var{cpu_type} 8489@opindex mcpu 8490Set the instruction set and instruction scheduling parameters for 8491machine type @var{cpu_type}. You can specify either the @samp{EV} 8492style name or the corresponding chip number. GCC supports scheduling 8493parameters for the EV4, EV5 and EV6 family of processors and will 8494choose the default values for the instruction set from the processor 8495you specify. If you do not specify a processor type, GCC will default 8496to the processor on which the compiler was built. 8497 8498Supported values for @var{cpu_type} are 8499 8500@table @samp 8501@item ev4 8502@itemx ev45 8503@itemx 21064 8504Schedules as an EV4 and has no instruction set extensions. 8505 8506@item ev5 8507@itemx 21164 8508Schedules as an EV5 and has no instruction set extensions. 8509 8510@item ev56 8511@itemx 21164a 8512Schedules as an EV5 and supports the BWX extension. 8513 8514@item pca56 8515@itemx 21164pc 8516@itemx 21164PC 8517Schedules as an EV5 and supports the BWX and MAX extensions. 8518 8519@item ev6 8520@itemx 21264 8521Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 8522 8523@item ev67 8524@itemx 21264a 8525Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 8526@end table 8527 8528@item -mtune=@var{cpu_type} 8529@opindex mtune 8530Set only the instruction scheduling parameters for machine type 8531@var{cpu_type}. The instruction set is not changed. 8532 8533@item -mmemory-latency=@var{time} 8534@opindex mmemory-latency 8535Sets the latency the scheduler should assume for typical memory 8536references as seen by the application. This number is highly 8537dependent on the memory access patterns used by the application 8538and the size of the external cache on the machine. 8539 8540Valid options for @var{time} are 8541 8542@table @samp 8543@item @var{number} 8544A decimal number representing clock cycles. 8545 8546@item L1 8547@itemx L2 8548@itemx L3 8549@itemx main 8550The compiler contains estimates of the number of clock cycles for 8551``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 8552(also called Dcache, Scache, and Bcache), as well as to main memory. 8553Note that L3 is only valid for EV5. 8554 8555@end table 8556@end table 8557 8558@node DEC Alpha/VMS Options 8559@subsection DEC Alpha/VMS Options 8560 8561These @samp{-m} options are defined for the DEC Alpha/VMS implementations: 8562 8563@table @gcctabopt 8564@item -mvms-return-codes 8565@opindex mvms-return-codes 8566Return VMS condition codes from main. The default is to return POSIX 8567style condition (e.g.@ error) codes. 8568@end table 8569 8570@node FRV Options 8571@subsection FRV Options 8572@cindex FRV Options 8573 8574@table @gcctabopt 8575@item -mgpr-32 8576@opindex mgpr-32 8577 8578Only use the first 32 general purpose registers. 8579 8580@item -mgpr-64 8581@opindex mgpr-64 8582 8583Use all 64 general purpose registers. 8584 8585@item -mfpr-32 8586@opindex mfpr-32 8587 8588Use only the first 32 floating point registers. 8589 8590@item -mfpr-64 8591@opindex mfpr-64 8592 8593Use all 64 floating point registers 8594 8595@item -mhard-float 8596@opindex mhard-float 8597 8598Use hardware instructions for floating point operations. 8599 8600@item -msoft-float 8601@opindex msoft-float 8602 8603Use library routines for floating point operations. 8604 8605@item -malloc-cc 8606@opindex malloc-cc 8607 8608Dynamically allocate condition code registers. 8609 8610@item -mfixed-cc 8611@opindex mfixed-cc 8612 8613Do not try to dynamically allocate condition code registers, only 8614use @code{icc0} and @code{fcc0}. 8615 8616@item -mdword 8617@opindex mdword 8618 8619Change ABI to use double word insns. 8620 8621@item -mno-dword 8622@opindex mno-dword 8623 8624Do not use double word instructions. 8625 8626@item -mdouble 8627@opindex mdouble 8628 8629Use floating point double instructions. 8630 8631@item -mno-double 8632@opindex mno-double 8633 8634Do not use floating point double instructions. 8635 8636@item -mmedia 8637@opindex mmedia 8638 8639Use media instructions. 8640 8641@item -mno-media 8642@opindex mno-media 8643 8644Do not use media instructions. 8645 8646@item -mmuladd 8647@opindex mmuladd 8648 8649Use multiply and add/subtract instructions. 8650 8651@item -mno-muladd 8652@opindex mno-muladd 8653 8654Do not use multiply and add/subtract instructions. 8655 8656@item -mfdpic 8657@opindex mfdpic 8658 8659Select the FDPIC ABI, that uses function descriptors to represent 8660pointers to functions. Without any PIC/PIE-related options, it 8661implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 8662assumes GOT entries and small data are within a 12-bit range from the 8663GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 8664are computed with 32 bits. 8665 8666@item -minline-plt 8667@opindex minline-plt 8668 8669Enable inlining of PLT entries in function calls to functions that are 8670not known to bind locally. It has no effect without @option{-mfdpic}. 8671It's enabled by default if optimizing for speed and compiling for 8672shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 8673optimization option such as @option{-O3} or above is present in the 8674command line. 8675 8676@item -mTLS 8677@opindex TLS 8678 8679Assume a large TLS segment when generating thread-local code. 8680 8681@item -mtls 8682@opindex tls 8683 8684Do not assume a large TLS segment when generating thread-local code. 8685 8686@item -mgprel-ro 8687@opindex mgprel-ro 8688 8689Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 8690that is known to be in read-only sections. It's enabled by default, 8691except for @option{-fpic} or @option{-fpie}: even though it may help 8692make the global offset table smaller, it trades 1 instruction for 4. 8693With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 8694one of which may be shared by multiple symbols, and it avoids the need 8695for a GOT entry for the referenced symbol, so it's more likely to be a 8696win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 8697 8698@item -multilib-library-pic 8699@opindex multilib-library-pic 8700 8701Link with the (library, not FD) pic libraries. It's implied by 8702@option{-mlibrary-pic}, as well as by @option{-fPIC} and 8703@option{-fpic} without @option{-mfdpic}. You should never have to use 8704it explicitly. 8705 8706@item -mlinked-fp 8707@opindex mlinked-fp 8708 8709Follow the EABI requirement of always creating a frame pointer whenever 8710a stack frame is allocated. This option is enabled by default and can 8711be disabled with @option{-mno-linked-fp}. 8712 8713@item -mlong-calls 8714@opindex mlong-calls 8715 8716Use indirect addressing to call functions outside the current 8717compilation unit. This allows the functions to be placed anywhere 8718within the 32-bit address space. 8719 8720@item -malign-labels 8721@opindex malign-labels 8722 8723Try to align labels to an 8-byte boundary by inserting nops into the 8724previous packet. This option only has an effect when VLIW packing 8725is enabled. It doesn't create new packets; it merely adds nops to 8726existing ones. 8727 8728@item -mlibrary-pic 8729@opindex mlibrary-pic 8730 8731Generate position-independent EABI code. 8732 8733@item -macc-4 8734@opindex macc-4 8735 8736Use only the first four media accumulator registers. 8737 8738@item -macc-8 8739@opindex macc-8 8740 8741Use all eight media accumulator registers. 8742 8743@item -mpack 8744@opindex mpack 8745 8746Pack VLIW instructions. 8747 8748@item -mno-pack 8749@opindex mno-pack 8750 8751Do not pack VLIW instructions. 8752 8753@item -mno-eflags 8754@opindex mno-eflags 8755 8756Do not mark ABI switches in e_flags. 8757 8758@item -mcond-move 8759@opindex mcond-move 8760 8761Enable the use of conditional-move instructions (default). 8762 8763This switch is mainly for debugging the compiler and will likely be removed 8764in a future version. 8765 8766@item -mno-cond-move 8767@opindex mno-cond-move 8768 8769Disable the use of conditional-move instructions. 8770 8771This switch is mainly for debugging the compiler and will likely be removed 8772in a future version. 8773 8774@item -mscc 8775@opindex mscc 8776 8777Enable the use of conditional set instructions (default). 8778 8779This switch is mainly for debugging the compiler and will likely be removed 8780in a future version. 8781 8782@item -mno-scc 8783@opindex mno-scc 8784 8785Disable the use of conditional set instructions. 8786 8787This switch is mainly for debugging the compiler and will likely be removed 8788in a future version. 8789 8790@item -mcond-exec 8791@opindex mcond-exec 8792 8793Enable the use of conditional execution (default). 8794 8795This switch is mainly for debugging the compiler and will likely be removed 8796in a future version. 8797 8798@item -mno-cond-exec 8799@opindex mno-cond-exec 8800 8801Disable the use of conditional execution. 8802 8803This switch is mainly for debugging the compiler and will likely be removed 8804in a future version. 8805 8806@item -mvliw-branch 8807@opindex mvliw-branch 8808 8809Run a pass to pack branches into VLIW instructions (default). 8810 8811This switch is mainly for debugging the compiler and will likely be removed 8812in a future version. 8813 8814@item -mno-vliw-branch 8815@opindex mno-vliw-branch 8816 8817Do not run a pass to pack branches into VLIW instructions. 8818 8819This switch is mainly for debugging the compiler and will likely be removed 8820in a future version. 8821 8822@item -mmulti-cond-exec 8823@opindex mmulti-cond-exec 8824 8825Enable optimization of @code{&&} and @code{||} in conditional execution 8826(default). 8827 8828This switch is mainly for debugging the compiler and will likely be removed 8829in a future version. 8830 8831@item -mno-multi-cond-exec 8832@opindex mno-multi-cond-exec 8833 8834Disable optimization of @code{&&} and @code{||} in conditional execution. 8835 8836This switch is mainly for debugging the compiler and will likely be removed 8837in a future version. 8838 8839@item -mnested-cond-exec 8840@opindex mnested-cond-exec 8841 8842Enable nested conditional execution optimizations (default). 8843 8844This switch is mainly for debugging the compiler and will likely be removed 8845in a future version. 8846 8847@item -mno-nested-cond-exec 8848@opindex mno-nested-cond-exec 8849 8850Disable nested conditional execution optimizations. 8851 8852This switch is mainly for debugging the compiler and will likely be removed 8853in a future version. 8854 8855@item -moptimize-membar 8856@opindex moptimize-membar 8857 8858This switch removes redundant @code{membar} instructions from the 8859compiler generated code. It is enabled by default. 8860 8861@item -mno-optimize-membar 8862@opindex mno-optimize-membar 8863 8864This switch disables the automatic removal of redundant @code{membar} 8865instructions from the generated code. 8866 8867@item -mtomcat-stats 8868@opindex mtomcat-stats 8869 8870Cause gas to print out tomcat statistics. 8871 8872@item -mcpu=@var{cpu} 8873@opindex mcpu 8874 8875Select the processor type for which to generate code. Possible values are 8876@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 8877@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 8878 8879@end table 8880 8881@node GNU/Linux Options 8882@subsection GNU/Linux Options 8883 8884These @samp{-m} options are defined for GNU/Linux targets: 8885 8886@table @gcctabopt 8887@item -mglibc 8888@opindex mglibc 8889Use the GNU C library instead of uClibc. This is the default except 8890on @samp{*-*-linux-*uclibc*} targets. 8891 8892@item -muclibc 8893@opindex muclibc 8894Use uClibc instead of the GNU C library. This is the default on 8895@samp{*-*-linux-*uclibc*} targets. 8896@end table 8897 8898@node H8/300 Options 8899@subsection H8/300 Options 8900 8901These @samp{-m} options are defined for the H8/300 implementations: 8902 8903@table @gcctabopt 8904@item -mrelax 8905@opindex mrelax 8906Shorten some address references at link time, when possible; uses the 8907linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 8908ld, Using ld}, for a fuller description. 8909 8910@item -mh 8911@opindex mh 8912Generate code for the H8/300H@. 8913 8914@item -ms 8915@opindex ms 8916Generate code for the H8S@. 8917 8918@item -mn 8919@opindex mn 8920Generate code for the H8S and H8/300H in the normal mode. This switch 8921must be used either with @option{-mh} or @option{-ms}. 8922 8923@item -ms2600 8924@opindex ms2600 8925Generate code for the H8S/2600. This switch must be used with @option{-ms}. 8926 8927@item -mint32 8928@opindex mint32 8929Make @code{int} data 32 bits by default. 8930 8931@item -malign-300 8932@opindex malign-300 8933On the H8/300H and H8S, use the same alignment rules as for the H8/300. 8934The default for the H8/300H and H8S is to align longs and floats on 4 8935byte boundaries. 8936@option{-malign-300} causes them to be aligned on 2 byte boundaries. 8937This option has no effect on the H8/300. 8938@end table 8939 8940@node HPPA Options 8941@subsection HPPA Options 8942@cindex HPPA Options 8943 8944These @samp{-m} options are defined for the HPPA family of computers: 8945 8946@table @gcctabopt 8947@item -march=@var{architecture-type} 8948@opindex march 8949Generate code for the specified architecture. The choices for 8950@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 89511.1, and @samp{2.0} for PA 2.0 processors. Refer to 8952@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 8953architecture option for your machine. Code compiled for lower numbered 8954architectures will run on higher numbered architectures, but not the 8955other way around. 8956 8957@item -mpa-risc-1-0 8958@itemx -mpa-risc-1-1 8959@itemx -mpa-risc-2-0 8960@opindex mpa-risc-1-0 8961@opindex mpa-risc-1-1 8962@opindex mpa-risc-2-0 8963Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 8964 8965@item -mbig-switch 8966@opindex mbig-switch 8967Generate code suitable for big switch tables. Use this option only if 8968the assembler/linker complain about out of range branches within a switch 8969table. 8970 8971@item -mjump-in-delay 8972@opindex mjump-in-delay 8973Fill delay slots of function calls with unconditional jump instructions 8974by modifying the return pointer for the function call to be the target 8975of the conditional jump. 8976 8977@item -mdisable-fpregs 8978@opindex mdisable-fpregs 8979Prevent floating point registers from being used in any manner. This is 8980necessary for compiling kernels which perform lazy context switching of 8981floating point registers. If you use this option and attempt to perform 8982floating point operations, the compiler will abort. 8983 8984@item -mdisable-indexing 8985@opindex mdisable-indexing 8986Prevent the compiler from using indexing address modes. This avoids some 8987rather obscure problems when compiling MIG generated code under MACH@. 8988 8989@item -mno-space-regs 8990@opindex mno-space-regs 8991Generate code that assumes the target has no space registers. This allows 8992GCC to generate faster indirect calls and use unscaled index address modes. 8993 8994Such code is suitable for level 0 PA systems and kernels. 8995 8996@item -mfast-indirect-calls 8997@opindex mfast-indirect-calls 8998Generate code that assumes calls never cross space boundaries. This 8999allows GCC to emit code which performs faster indirect calls. 9000 9001This option will not work in the presence of shared libraries or nested 9002functions. 9003 9004@item -mfixed-range=@var{register-range} 9005@opindex mfixed-range 9006Generate code treating the given register range as fixed registers. 9007A fixed register is one that the register allocator can not use. This is 9008useful when compiling kernel code. A register range is specified as 9009two registers separated by a dash. Multiple register ranges can be 9010specified separated by a comma. 9011 9012@item -mlong-load-store 9013@opindex mlong-load-store 9014Generate 3-instruction load and store sequences as sometimes required by 9015the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 9016the HP compilers. 9017 9018@item -mportable-runtime 9019@opindex mportable-runtime 9020Use the portable calling conventions proposed by HP for ELF systems. 9021 9022@item -mgas 9023@opindex mgas 9024Enable the use of assembler directives only GAS understands. 9025 9026@item -mschedule=@var{cpu-type} 9027@opindex mschedule 9028Schedule code according to the constraints for the machine type 9029@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 9030@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 9031to @file{/usr/lib/sched.models} on an HP-UX system to determine the 9032proper scheduling option for your machine. The default scheduling is 9033@samp{8000}. 9034 9035@item -mlinker-opt 9036@opindex mlinker-opt 9037Enable the optimization pass in the HP-UX linker. Note this makes symbolic 9038debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 9039linkers in which they give bogus error messages when linking some programs. 9040 9041@item -msoft-float 9042@opindex msoft-float 9043Generate output containing library calls for floating point. 9044@strong{Warning:} the requisite libraries are not available for all HPPA 9045targets. Normally the facilities of the machine's usual C compiler are 9046used, but this cannot be done directly in cross-compilation. You must make 9047your own arrangements to provide suitable library functions for 9048cross-compilation. The embedded target @samp{hppa1.1-*-pro} 9049does provide software floating point support. 9050 9051@option{-msoft-float} changes the calling convention in the output file; 9052therefore, it is only useful if you compile @emph{all} of a program with 9053this option. In particular, you need to compile @file{libgcc.a}, the 9054library that comes with GCC, with @option{-msoft-float} in order for 9055this to work. 9056 9057@item -msio 9058@opindex msio 9059Generate the predefine, @code{_SIO}, for server IO@. The default is 9060@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 9061@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 9062options are available under HP-UX and HI-UX@. 9063 9064@item -mgnu-ld 9065@opindex gnu-ld 9066Use GNU ld specific options. This passes @option{-shared} to ld when 9067building a shared library. It is the default when GCC is configured, 9068explicitly or implicitly, with the GNU linker. This option does not 9069have any affect on which ld is called, it only changes what parameters 9070are passed to that ld. The ld that is called is determined by the 9071@option{--with-ld} configure option, GCC's program search path, and 9072finally by the user's @env{PATH}. The linker used by GCC can be printed 9073using @samp{which `gcc -print-prog-name=ld`}. This option is only available 9074on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. 9075 9076@item -mhp-ld 9077@opindex hp-ld 9078Use HP ld specific options. This passes @option{-b} to ld when building 9079a shared library and passes @option{+Accept TypeMismatch} to ld on all 9080links. It is the default when GCC is configured, explicitly or 9081implicitly, with the HP linker. This option does not have any affect on 9082which ld is called, it only changes what parameters are passed to that 9083ld. The ld that is called is determined by the @option{--with-ld} 9084configure option, GCC's program search path, and finally by the user's 9085@env{PATH}. The linker used by GCC can be printed using @samp{which 9086`gcc -print-prog-name=ld`}. This option is only available on the 64 bit 9087HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. 9088 9089@item -mlong-calls 9090@opindex mno-long-calls 9091Generate code that uses long call sequences. This ensures that a call 9092is always able to reach linker generated stubs. The default is to generate 9093long calls only when the distance from the call site to the beginning 9094of the function or translation unit, as the case may be, exceeds a 9095predefined limit set by the branch type being used. The limits for 9096normal calls are 7,600,000 and 240,000 bytes, respectively for the 9097PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 9098240,000 bytes. 9099 9100Distances are measured from the beginning of functions when using the 9101@option{-ffunction-sections} option, or when using the @option{-mgas} 9102and @option{-mno-portable-runtime} options together under HP-UX with 9103the SOM linker. 9104 9105It is normally not desirable to use this option as it will degrade 9106performance. However, it may be useful in large applications, 9107particularly when partial linking is used to build the application. 9108 9109The types of long calls used depends on the capabilities of the 9110assembler and linker, and the type of code being generated. The 9111impact on systems that support long absolute calls, and long pic 9112symbol-difference or pc-relative calls should be relatively small. 9113However, an indirect call is used on 32-bit ELF systems in pic code 9114and it is quite long. 9115 9116@item -munix=@var{unix-std} 9117@opindex march 9118Generate compiler predefines and select a startfile for the specified 9119UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 9120and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 9121is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 912211.11 and later. The default values are @samp{93} for HP-UX 10.00, 9123@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 9124and later. 9125 9126@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 9127@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 9128and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 9129@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 9130@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 9131@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 9132 9133It is @emph{important} to note that this option changes the interfaces 9134for various library routines. It also affects the operational behavior 9135of the C library. Thus, @emph{extreme} care is needed in using this 9136option. 9137 9138Library code that is intended to operate with more than one UNIX 9139standard must test, set and restore the variable @var{__xpg4_extended_mask} 9140as appropriate. Most GNU software doesn't provide this capability. 9141 9142@item -nolibdld 9143@opindex nolibdld 9144Suppress the generation of link options to search libdld.sl when the 9145@option{-static} option is specified on HP-UX 10 and later. 9146 9147@item -static 9148@opindex static 9149The HP-UX implementation of setlocale in libc has a dependency on 9150libdld.sl. There isn't an archive version of libdld.sl. Thus, 9151when the @option{-static} option is specified, special link options 9152are needed to resolve this dependency. 9153 9154On HP-UX 10 and later, the GCC driver adds the necessary options to 9155link with libdld.sl when the @option{-static} option is specified. 9156This causes the resulting binary to be dynamic. On the 64-bit port, 9157the linkers generate dynamic binaries by default in any case. The 9158@option{-nolibdld} option can be used to prevent the GCC driver from 9159adding these link options. 9160 9161@item -threads 9162@opindex threads 9163Add support for multithreading with the @dfn{dce thread} library 9164under HP-UX@. This option sets flags for both the preprocessor and 9165linker. 9166@end table 9167 9168@node i386 and x86-64 Options 9169@subsection Intel 386 and AMD x86-64 Options 9170@cindex i386 Options 9171@cindex x86-64 Options 9172@cindex Intel 386 Options 9173@cindex AMD x86-64 Options 9174 9175These @samp{-m} options are defined for the i386 and x86-64 family of 9176computers: 9177 9178@table @gcctabopt 9179@item -mtune=@var{cpu-type} 9180@opindex mtune 9181Tune to @var{cpu-type} everything applicable about the generated code, except 9182for the ABI and the set of available instructions. The choices for 9183@var{cpu-type} are: 9184@table @emph 9185@item generic 9186Produce code optimized for the most common IA32/AMD64/EM64T processors. 9187If you know the CPU on which your code will run, then you should use 9188the corresponding @option{-mtune} option instead of 9189@option{-mtune=generic}. But, if you do not know exactly what CPU users 9190of your application will have, then you should use this option. 9191 9192As new processors are deployed in the marketplace, the behavior of this 9193option will change. Therefore, if you upgrade to a newer version of 9194GCC, the code generated option will change to reflect the processors 9195that were most common when that version of GCC was released. 9196 9197There is no @option{-march=generic} option because @option{-march} 9198indicates the instruction set the compiler can use, and there is no 9199generic instruction set applicable to all processors. In contrast, 9200@option{-mtune} indicates the processor (or, in this case, collection of 9201processors) for which the code is optimized. 9202@item native 9203This selects the CPU to tune for at compilation time by determining 9204the processor type of the compiling machine. Using @option{-mtune=native} 9205will produce code optimized for the local machine under the constraints 9206of the selected instruction set. Using @option{-march=native} will 9207enable all instruction subsets supported by the local machine (hence 9208the result might not run on different machines). 9209@item i386 9210Original Intel's i386 CPU@. 9211@item i486 9212Intel's i486 CPU@. (No scheduling is implemented for this chip.) 9213@item i586, pentium 9214Intel Pentium CPU with no MMX support. 9215@item pentium-mmx 9216Intel PentiumMMX CPU based on Pentium core with MMX instruction set support. 9217@item pentiumpro 9218Intel PentiumPro CPU@. 9219@item i686 9220Same as @code{generic}, but when used as @code{march} option, PentiumPro 9221instruction set will be used, so the code will run on all i686 family chips. 9222@item pentium2 9223Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support. 9224@item pentium3, pentium3m 9225Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set 9226support. 9227@item pentium-m 9228Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set 9229support. Used by Centrino notebooks. 9230@item pentium4, pentium4m 9231Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support. 9232@item prescott 9233Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction 9234set support. 9235@item nocona 9236Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE, 9237SSE2 and SSE3 instruction set support. 9238@item core2 9239Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 9240instruction set support. 9241@item k6 9242AMD K6 CPU with MMX instruction set support. 9243@item k6-2, k6-3 9244Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support. 9245@item athlon, athlon-tbird 9246AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions 9247support. 9248@item athlon-4, athlon-xp, athlon-mp 9249Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE 9250instruction set support. 9251@item k8, opteron, athlon64, athlon-fx 9252AMD K8 core based CPUs with x86-64 instruction set support. (This supersets 9253MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.) 9254@item k8-sse3, opteron-sse3, athlon64-sse3 9255Improved versions of k8, opteron and athlon64 with SSE3 instruction set support. 9256@item amdfam10, barcelona 9257AMD Family 10h core based CPUs with x86-64 instruction set support. (This 9258supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit 9259instruction set extensions.) 9260@item winchip-c6 9261IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction 9262set support. 9263@item winchip2 9264IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW! 9265instruction set support. 9266@item c3 9267Via C3 CPU with MMX and 3dNOW! instruction set support. (No scheduling is 9268implemented for this chip.) 9269@item c3-2 9270Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is 9271implemented for this chip.) 9272@item geode 9273Embedded AMD CPU with MMX and 3dNOW! instruction set support. 9274@end table 9275 9276While picking a specific @var{cpu-type} will schedule things appropriately 9277for that particular chip, the compiler will not generate any code that 9278does not run on the i386 without the @option{-march=@var{cpu-type}} option 9279being used. 9280 9281@item -march=@var{cpu-type} 9282@opindex march 9283Generate instructions for the machine type @var{cpu-type}. The choices 9284for @var{cpu-type} are the same as for @option{-mtune}. Moreover, 9285specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}. 9286 9287@item -mcpu=@var{cpu-type} 9288@opindex mcpu 9289A deprecated synonym for @option{-mtune}. 9290 9291@item -m386 9292@itemx -m486 9293@itemx -mpentium 9294@itemx -mpentiumpro 9295@opindex m386 9296@opindex m486 9297@opindex mpentium 9298@opindex mpentiumpro 9299These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486}, 9300@option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively. 9301These synonyms are deprecated. 9302 9303@item -mfpmath=@var{unit} 9304@opindex march 9305Generate floating point arithmetics for selected unit @var{unit}. The choices 9306for @var{unit} are: 9307 9308@table @samp 9309@item 387 9310Use the standard 387 floating point coprocessor present majority of chips and 9311emulated otherwise. Code compiled with this option will run almost everywhere. 9312The temporary results are computed in 80bit precision instead of precision 9313specified by the type resulting in slightly different results compared to most 9314of other chips. See @option{-ffloat-store} for more detailed description. 9315 9316This is the default choice for i386 compiler. 9317 9318@item sse 9319Use scalar floating point instructions present in the SSE instruction set. 9320This instruction set is supported by Pentium3 and newer chips, in the AMD line 9321by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE 9322instruction set supports only single precision arithmetics, thus the double and 9323extended precision arithmetics is still done using 387. Later version, present 9324only in Pentium4 and the future AMD x86-64 chips supports double precision 9325arithmetics too. 9326 9327For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse} 9328or @option{-msse2} switches to enable SSE extensions and make this option 9329effective. For the x86-64 compiler, these extensions are enabled by default. 9330 9331The resulting code should be considerably faster in the majority of cases and avoid 9332the numerical instability problems of 387 code, but may break some existing 9333code that expects temporaries to be 80bit. 9334 9335This is the default choice for the x86-64 compiler. 9336 9337@item sse,387 9338Attempt to utilize both instruction sets at once. This effectively double the 9339amount of available registers and on chips with separate execution units for 9340387 and SSE the execution resources too. Use this option with care, as it is 9341still experimental, because the GCC register allocator does not model separate 9342functional units well resulting in instable performance. 9343@end table 9344 9345@item -masm=@var{dialect} 9346@opindex masm=@var{dialect} 9347Output asm instructions using selected @var{dialect}. Supported 9348choices are @samp{intel} or @samp{att} (the default one). Darwin does 9349not support @samp{intel}. 9350 9351@item -mieee-fp 9352@itemx -mno-ieee-fp 9353@opindex mieee-fp 9354@opindex mno-ieee-fp 9355Control whether or not the compiler uses IEEE floating point 9356comparisons. These handle correctly the case where the result of a 9357comparison is unordered. 9358 9359@item -msoft-float 9360@opindex msoft-float 9361Generate output containing library calls for floating point. 9362@strong{Warning:} the requisite libraries are not part of GCC@. 9363Normally the facilities of the machine's usual C compiler are used, but 9364this can't be done directly in cross-compilation. You must make your 9365own arrangements to provide suitable library functions for 9366cross-compilation. 9367 9368On machines where a function returns floating point results in the 80387 9369register stack, some floating point opcodes may be emitted even if 9370@option{-msoft-float} is used. 9371 9372@item -mno-fp-ret-in-387 9373@opindex mno-fp-ret-in-387 9374Do not use the FPU registers for return values of functions. 9375 9376The usual calling convention has functions return values of types 9377@code{float} and @code{double} in an FPU register, even if there 9378is no FPU@. The idea is that the operating system should emulate 9379an FPU@. 9380 9381The option @option{-mno-fp-ret-in-387} causes such values to be returned 9382in ordinary CPU registers instead. 9383 9384@item -mno-fancy-math-387 9385@opindex mno-fancy-math-387 9386Some 387 emulators do not support the @code{sin}, @code{cos} and 9387@code{sqrt} instructions for the 387. Specify this option to avoid 9388generating those instructions. This option is the default on 9389OpenBSD and NetBSD@. This option is overridden when @option{-march} 9390indicates that the target cpu will always have an FPU and so the 9391instruction will not need emulation. As of revision 2.6.1, these 9392instructions are not generated unless you also use the 9393@option{-funsafe-math-optimizations} switch. 9394 9395@item -malign-double 9396@itemx -mno-align-double 9397@opindex malign-double 9398@opindex mno-align-double 9399Control whether GCC aligns @code{double}, @code{long double}, and 9400@code{long long} variables on a two word boundary or a one word 9401boundary. Aligning @code{double} variables on a two word boundary will 9402produce code that runs somewhat faster on a @samp{Pentium} at the 9403expense of more memory. 9404 9405On x86-64, @option{-malign-double} is enabled by default. 9406 9407@strong{Warning:} if you use the @option{-malign-double} switch, 9408structures containing the above types will be aligned differently than 9409the published application binary interface specifications for the 386 9410and will not be binary compatible with structures in code compiled 9411without that switch. 9412 9413@item -m96bit-long-double 9414@itemx -m128bit-long-double 9415@opindex m96bit-long-double 9416@opindex m128bit-long-double 9417These switches control the size of @code{long double} type. The i386 9418application binary interface specifies the size to be 96 bits, 9419so @option{-m96bit-long-double} is the default in 32 bit mode. 9420 9421Modern architectures (Pentium and newer) would prefer @code{long double} 9422to be aligned to an 8 or 16 byte boundary. In arrays or structures 9423conforming to the ABI, this would not be possible. So specifying a 9424@option{-m128bit-long-double} will align @code{long double} 9425to a 16 byte boundary by padding the @code{long double} with an additional 942632 bit zero. 9427 9428In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 9429its ABI specifies that @code{long double} is to be aligned on 16 byte boundary. 9430 9431Notice that neither of these options enable any extra precision over the x87 9432standard of 80 bits for a @code{long double}. 9433 9434@strong{Warning:} if you override the default value for your target ABI, the 9435structures and arrays containing @code{long double} variables will change 9436their size as well as function calling convention for function taking 9437@code{long double} will be modified. Hence they will not be binary 9438compatible with arrays or structures in code compiled without that switch. 9439 9440@item -mmlarge-data-threshold=@var{number} 9441@opindex mlarge-data-threshold=@var{number} 9442When @option{-mcmodel=medium} is specified, the data greater than 9443@var{threshold} are placed in large data section. This value must be the 9444same across all object linked into the binary and defaults to 65535. 9445 9446@item -msvr3-shlib 9447@itemx -mno-svr3-shlib 9448@opindex msvr3-shlib 9449@opindex mno-svr3-shlib 9450Control whether GCC places uninitialized local variables into the 9451@code{bss} or @code{data} segments. @option{-msvr3-shlib} places them 9452into @code{bss}. These options are meaningful only on System V Release 3. 9453 9454@item -mrtd 9455@opindex mrtd 9456Use a different function-calling convention, in which functions that 9457take a fixed number of arguments return with the @code{ret} @var{num} 9458instruction, which pops their arguments while returning. This saves one 9459instruction in the caller since there is no need to pop the arguments 9460there. 9461 9462You can specify that an individual function is called with this calling 9463sequence with the function attribute @samp{stdcall}. You can also 9464override the @option{-mrtd} option by using the function attribute 9465@samp{cdecl}. @xref{Function Attributes}. 9466 9467@strong{Warning:} this calling convention is incompatible with the one 9468normally used on Unix, so you cannot use it if you need to call 9469libraries compiled with the Unix compiler. 9470 9471Also, you must provide function prototypes for all functions that 9472take variable numbers of arguments (including @code{printf}); 9473otherwise incorrect code will be generated for calls to those 9474functions. 9475 9476In addition, seriously incorrect code will result if you call a 9477function with too many arguments. (Normally, extra arguments are 9478harmlessly ignored.) 9479 9480@item -mregparm=@var{num} 9481@opindex mregparm 9482Control how many registers are used to pass integer arguments. By 9483default, no registers are used to pass arguments, and at most 3 9484registers can be used. You can control this behavior for a specific 9485function by using the function attribute @samp{regparm}. 9486@xref{Function Attributes}. 9487 9488@strong{Warning:} if you use this switch, and 9489@var{num} is nonzero, then you must build all modules with the same 9490value, including any libraries. This includes the system libraries and 9491startup modules. 9492 9493@item -msseregparm 9494@opindex msseregparm 9495Use SSE register passing conventions for float and double arguments 9496and return values. You can control this behavior for a specific 9497function by using the function attribute @samp{sseregparm}. 9498@xref{Function Attributes}. 9499 9500@strong{Warning:} if you use this switch then you must build all 9501modules with the same value, including any libraries. This includes 9502the system libraries and startup modules. 9503 9504@item -mstackrealign 9505@opindex mstackrealign 9506Realign the stack at entry. On the Intel x86, the 9507@option{-mstackrealign} option will generate an alternate prologue and 9508epilogue that realigns the runtime stack. This supports mixing legacy 9509codes that keep a 4-byte aligned stack with modern codes that keep a 951016-byte stack for SSE compatibility. The alternate prologue and 9511epilogue are slower and bigger than the regular ones, and the 9512alternate prologue requires an extra scratch register; this lowers the 9513number of registers available if used in conjunction with the 9514@code{regparm} attribute. The @option{-mstackrealign} option is 9515incompatible with the nested function prologue; this is considered a 9516hard error. See also the attribute @code{force_align_arg_pointer}, 9517applicable to individual functions. 9518 9519@item -mpreferred-stack-boundary=@var{num} 9520@opindex mpreferred-stack-boundary 9521Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 9522byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 9523the default is 4 (16 bytes or 128 bits). 9524 9525On Pentium and PentiumPro, @code{double} and @code{long double} values 9526should be aligned to an 8 byte boundary (see @option{-malign-double}) or 9527suffer significant run time performance penalties. On Pentium III, the 9528Streaming SIMD Extension (SSE) data type @code{__m128} may not work 9529properly if it is not 16 byte aligned. 9530 9531To ensure proper alignment of this values on the stack, the stack boundary 9532must be as aligned as that required by any value stored on the stack. 9533Further, every function must be generated such that it keeps the stack 9534aligned. Thus calling a function compiled with a higher preferred 9535stack boundary from a function compiled with a lower preferred stack 9536boundary will most likely misalign the stack. It is recommended that 9537libraries that use callbacks always use the default setting. 9538 9539This extra alignment does consume extra stack space, and generally 9540increases code size. Code that is sensitive to stack space usage, such 9541as embedded systems and operating system kernels, may want to reduce the 9542preferred alignment to @option{-mpreferred-stack-boundary=2}. 9543 9544@item -mmmx 9545@itemx -mno-mmx 9546@item -msse 9547@itemx -mno-sse 9548@item -msse2 9549@itemx -mno-sse2 9550@item -msse3 9551@itemx -mno-sse3 9552@item -mssse3 9553@itemx -mno-ssse3 9554@item -msse4a 9555@item -mno-sse4a 9556@item -m3dnow 9557@itemx -mno-3dnow 9558@item -mpopcnt 9559@itemx -mno-popcnt 9560@item -mabm 9561@itemx -mno-abm 9562@item -maes 9563@itemx -mno-aes 9564@opindex mmmx 9565@opindex mno-mmx 9566@opindex msse 9567@opindex mno-sse 9568@opindex m3dnow 9569@opindex mno-3dnow 9570These switches enable or disable the use of instructions in the MMX, 9571SSE, SSE2, SSE3, SSSE3, SSE4A, ABM, AES or 3DNow! extended 9572instruction sets. These extensions are also available as built-in 9573functions: see @ref{X86 Built-in Functions}, for details of the functions 9574enabled and disabled by these switches. 9575 9576To have SSE/SSE2 instructions generated automatically from floating-point 9577code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 9578 9579These options will enable GCC to use these extended instructions in 9580generated code, even without @option{-mfpmath=sse}. Applications which 9581perform runtime CPU detection must compile separate files for each 9582supported architecture, using the appropriate flags. In particular, 9583the file containing the CPU detection code should be compiled without 9584these options. 9585 9586@item -mpush-args 9587@itemx -mno-push-args 9588@opindex mpush-args 9589@opindex mno-push-args 9590Use PUSH operations to store outgoing parameters. This method is shorter 9591and usually equally fast as method using SUB/MOV operations and is enabled 9592by default. In some cases disabling it may improve performance because of 9593improved scheduling and reduced dependencies. 9594 9595@item -maccumulate-outgoing-args 9596@opindex maccumulate-outgoing-args 9597If enabled, the maximum amount of space required for outgoing arguments will be 9598computed in the function prologue. This is faster on most modern CPUs 9599because of reduced dependencies, improved scheduling and reduced stack usage 9600when preferred stack boundary is not equal to 2. The drawback is a notable 9601increase in code size. This switch implies @option{-mno-push-args}. 9602 9603@item -mthreads 9604@opindex mthreads 9605Support thread-safe exception handling on @samp{Mingw32}. Code that relies 9606on thread-safe exception handling must compile and link all code with the 9607@option{-mthreads} option. When compiling, @option{-mthreads} defines 9608@option{-D_MT}; when linking, it links in a special thread helper library 9609@option{-lmingwthrd} which cleans up per thread exception handling data. 9610 9611@item -mno-align-stringops 9612@opindex mno-align-stringops 9613Do not align destination of inlined string operations. This switch reduces 9614code size and improves performance in case the destination is already aligned, 9615but GCC doesn't know about it. 9616 9617@item -minline-all-stringops 9618@opindex minline-all-stringops 9619By default GCC inlines string operations only when destination is known to be 9620aligned at least to 4 byte boundary. This enables more inlining, increase code 9621size, but may improve performance of code that depends on fast memcpy, strlen 9622and memset for short lengths. 9623 9624@item -momit-leaf-frame-pointer 9625@opindex momit-leaf-frame-pointer 9626Don't keep the frame pointer in a register for leaf functions. This 9627avoids the instructions to save, set up and restore frame pointers and 9628makes an extra register available in leaf functions. The option 9629@option{-fomit-frame-pointer} removes the frame pointer for all functions 9630which might make debugging harder. 9631 9632@item -mtls-direct-seg-refs 9633@itemx -mno-tls-direct-seg-refs 9634@opindex mtls-direct-seg-refs 9635Controls whether TLS variables may be accessed with offsets from the 9636TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 9637or whether the thread base pointer must be added. Whether or not this 9638is legal depends on the operating system, and whether it maps the 9639segment to cover the entire TLS area. 9640 9641For systems that use GNU libc, the default is on. 9642@end table 9643 9644These @samp{-m} switches are supported in addition to the above 9645on AMD x86-64 processors in 64-bit environments. 9646 9647@table @gcctabopt 9648@item -m32 9649@itemx -m64 9650@opindex m32 9651@opindex m64 9652Generate code for a 32-bit or 64-bit environment. 9653The 32-bit environment sets int, long and pointer to 32 bits and 9654generates code that runs on any i386 system. 9655The 64-bit environment sets int to 32 bits and long and pointer 9656to 64 bits and generates code for AMD's x86-64 architecture. For 9657darwin only the -m64 option turns off the @option{-fno-pic} and 9658@option{-mdynamic-no-pic} options. 9659 9660@item -mno-red-zone 9661@opindex no-red-zone 9662Do not use a so called red zone for x86-64 code. The red zone is mandated 9663by the x86-64 ABI, it is a 128-byte area beyond the location of the 9664stack pointer that will not be modified by signal or interrupt handlers 9665and therefore can be used for temporary data without adjusting the stack 9666pointer. The flag @option{-mno-red-zone} disables this red zone. 9667 9668@item -mcmodel=small 9669@opindex mcmodel=small 9670Generate code for the small code model: the program and its symbols must 9671be linked in the lower 2 GB of the address space. Pointers are 64 bits. 9672Programs can be statically or dynamically linked. This is the default 9673code model. 9674 9675@item -mcmodel=kernel 9676@opindex mcmodel=kernel 9677Generate code for the kernel code model. The kernel runs in the 9678negative 2 GB of the address space. 9679This model has to be used for Linux kernel code. 9680 9681@item -mcmodel=medium 9682@opindex mcmodel=medium 9683Generate code for the medium model: The program is linked in the lower 2 9684GB of the address space but symbols can be located anywhere in the 9685address space. Programs can be statically or dynamically linked, but 9686building of shared libraries are not supported with the medium model. 9687 9688@item -mcmodel=large 9689@opindex mcmodel=large 9690Generate code for the large model: This model makes no assumptions 9691about addresses and sizes of sections. Currently GCC does not implement 9692this model. 9693@end table 9694 9695@node IA-64 Options 9696@subsection IA-64 Options 9697@cindex IA-64 Options 9698 9699These are the @samp{-m} options defined for the Intel IA-64 architecture. 9700 9701@table @gcctabopt 9702@item -mbig-endian 9703@opindex mbig-endian 9704Generate code for a big endian target. This is the default for HP-UX@. 9705 9706@item -mlittle-endian 9707@opindex mlittle-endian 9708Generate code for a little endian target. This is the default for AIX5 9709and GNU/Linux. 9710 9711@item -mgnu-as 9712@itemx -mno-gnu-as 9713@opindex mgnu-as 9714@opindex mno-gnu-as 9715Generate (or don't) code for the GNU assembler. This is the default. 9716@c Also, this is the default if the configure option @option{--with-gnu-as} 9717@c is used. 9718 9719@item -mgnu-ld 9720@itemx -mno-gnu-ld 9721@opindex mgnu-ld 9722@opindex mno-gnu-ld 9723Generate (or don't) code for the GNU linker. This is the default. 9724@c Also, this is the default if the configure option @option{--with-gnu-ld} 9725@c is used. 9726 9727@item -mno-pic 9728@opindex mno-pic 9729Generate code that does not use a global pointer register. The result 9730is not position independent code, and violates the IA-64 ABI@. 9731 9732@item -mvolatile-asm-stop 9733@itemx -mno-volatile-asm-stop 9734@opindex mvolatile-asm-stop 9735@opindex mno-volatile-asm-stop 9736Generate (or don't) a stop bit immediately before and after volatile asm 9737statements. 9738 9739@item -mregister-names 9740@itemx -mno-register-names 9741@opindex mregister-names 9742@opindex mno-register-names 9743Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 9744the stacked registers. This may make assembler output more readable. 9745 9746@item -mno-sdata 9747@itemx -msdata 9748@opindex mno-sdata 9749@opindex msdata 9750Disable (or enable) optimizations that use the small data section. This may 9751be useful for working around optimizer bugs. 9752 9753@item -mconstant-gp 9754@opindex mconstant-gp 9755Generate code that uses a single constant global pointer value. This is 9756useful when compiling kernel code. 9757 9758@item -mauto-pic 9759@opindex mauto-pic 9760Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 9761This is useful when compiling firmware code. 9762 9763@item -minline-float-divide-min-latency 9764@opindex minline-float-divide-min-latency 9765Generate code for inline divides of floating point values 9766using the minimum latency algorithm. 9767 9768@item -minline-float-divide-max-throughput 9769@opindex minline-float-divide-max-throughput 9770Generate code for inline divides of floating point values 9771using the maximum throughput algorithm. 9772 9773@item -minline-int-divide-min-latency 9774@opindex minline-int-divide-min-latency 9775Generate code for inline divides of integer values 9776using the minimum latency algorithm. 9777 9778@item -minline-int-divide-max-throughput 9779@opindex minline-int-divide-max-throughput 9780Generate code for inline divides of integer values 9781using the maximum throughput algorithm. 9782 9783@item -minline-sqrt-min-latency 9784@opindex minline-sqrt-min-latency 9785Generate code for inline square roots 9786using the minimum latency algorithm. 9787 9788@item -minline-sqrt-max-throughput 9789@opindex minline-sqrt-max-throughput 9790Generate code for inline square roots 9791using the maximum throughput algorithm. 9792 9793@item -mno-dwarf2-asm 9794@itemx -mdwarf2-asm 9795@opindex mno-dwarf2-asm 9796@opindex mdwarf2-asm 9797Don't (or do) generate assembler code for the DWARF2 line number debugging 9798info. This may be useful when not using the GNU assembler. 9799 9800@item -mearly-stop-bits 9801@itemx -mno-early-stop-bits 9802@opindex mearly-stop-bits 9803@opindex mno-early-stop-bits 9804Allow stop bits to be placed earlier than immediately preceding the 9805instruction that triggered the stop bit. This can improve instruction 9806scheduling, but does not always do so. 9807 9808@item -mfixed-range=@var{register-range} 9809@opindex mfixed-range 9810Generate code treating the given register range as fixed registers. 9811A fixed register is one that the register allocator can not use. This is 9812useful when compiling kernel code. A register range is specified as 9813two registers separated by a dash. Multiple register ranges can be 9814specified separated by a comma. 9815 9816@item -mtls-size=@var{tls-size} 9817@opindex mtls-size 9818Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 981964. 9820 9821@item -mtune=@var{cpu-type} 9822@opindex mtune 9823Tune the instruction scheduling for a particular CPU, Valid values are 9824itanium, itanium1, merced, itanium2, and mckinley. 9825 9826@item -mt 9827@itemx -pthread 9828@opindex mt 9829@opindex pthread 9830Add support for multithreading using the POSIX threads library. This 9831option sets flags for both the preprocessor and linker. It does 9832not affect the thread safety of object code produced by the compiler or 9833that of libraries supplied with it. These are HP-UX specific flags. 9834 9835@item -milp32 9836@itemx -mlp64 9837@opindex milp32 9838@opindex mlp64 9839Generate code for a 32-bit or 64-bit environment. 9840The 32-bit environment sets int, long and pointer to 32 bits. 9841The 64-bit environment sets int to 32 bits and long and pointer 9842to 64 bits. These are HP-UX specific flags. 9843 9844@item -mno-sched-br-data-spec 9845@itemx -msched-br-data-spec 9846@opindex mno-sched-br-data-spec 9847@opindex msched-br-data-spec 9848(Dis/En)able data speculative scheduling before reload. 9849This will result in generation of the ld.a instructions and 9850the corresponding check instructions (ld.c / chk.a). 9851The default is 'disable'. 9852 9853@item -msched-ar-data-spec 9854@itemx -mno-sched-ar-data-spec 9855@opindex msched-ar-data-spec 9856@opindex mno-sched-ar-data-spec 9857(En/Dis)able data speculative scheduling after reload. 9858This will result in generation of the ld.a instructions and 9859the corresponding check instructions (ld.c / chk.a). 9860The default is 'enable'. 9861 9862@item -mno-sched-control-spec 9863@itemx -msched-control-spec 9864@opindex mno-sched-control-spec 9865@opindex msched-control-spec 9866(Dis/En)able control speculative scheduling. This feature is 9867available only during region scheduling (i.e. before reload). 9868This will result in generation of the ld.s instructions and 9869the corresponding check instructions chk.s . 9870The default is 'disable'. 9871 9872@item -msched-br-in-data-spec 9873@itemx -mno-sched-br-in-data-spec 9874@opindex msched-br-in-data-spec 9875@opindex mno-sched-br-in-data-spec 9876(En/Dis)able speculative scheduling of the instructions that 9877are dependent on the data speculative loads before reload. 9878This is effective only with @option{-msched-br-data-spec} enabled. 9879The default is 'enable'. 9880 9881@item -msched-ar-in-data-spec 9882@itemx -mno-sched-ar-in-data-spec 9883@opindex msched-ar-in-data-spec 9884@opindex mno-sched-ar-in-data-spec 9885(En/Dis)able speculative scheduling of the instructions that 9886are dependent on the data speculative loads after reload. 9887This is effective only with @option{-msched-ar-data-spec} enabled. 9888The default is 'enable'. 9889 9890@item -msched-in-control-spec 9891@itemx -mno-sched-in-control-spec 9892@opindex msched-in-control-spec 9893@opindex mno-sched-in-control-spec 9894(En/Dis)able speculative scheduling of the instructions that 9895are dependent on the control speculative loads. 9896This is effective only with @option{-msched-control-spec} enabled. 9897The default is 'enable'. 9898 9899@item -msched-ldc 9900@itemx -mno-sched-ldc 9901@opindex msched-ldc 9902@opindex mno-sched-ldc 9903(En/Dis)able use of simple data speculation checks ld.c . 9904If disabled, only chk.a instructions will be emitted to check 9905data speculative loads. 9906The default is 'enable'. 9907 9908@item -mno-sched-control-ldc 9909@itemx -msched-control-ldc 9910@opindex mno-sched-control-ldc 9911@opindex msched-control-ldc 9912(Dis/En)able use of ld.c instructions to check control speculative loads. 9913If enabled, in case of control speculative load with no speculatively 9914scheduled dependent instructions this load will be emitted as ld.sa and 9915ld.c will be used to check it. 9916The default is 'disable'. 9917 9918@item -mno-sched-spec-verbose 9919@itemx -msched-spec-verbose 9920@opindex mno-sched-spec-verbose 9921@opindex msched-spec-verbose 9922(Dis/En)able printing of the information about speculative motions. 9923 9924@item -mno-sched-prefer-non-data-spec-insns 9925@itemx -msched-prefer-non-data-spec-insns 9926@opindex mno-sched-prefer-non-data-spec-insns 9927@opindex msched-prefer-non-data-spec-insns 9928If enabled, data speculative instructions will be chosen for schedule 9929only if there are no other choices at the moment. This will make 9930the use of the data speculation much more conservative. 9931The default is 'disable'. 9932 9933@item -mno-sched-prefer-non-control-spec-insns 9934@itemx -msched-prefer-non-control-spec-insns 9935@opindex mno-sched-prefer-non-control-spec-insns 9936@opindex msched-prefer-non-control-spec-insns 9937If enabled, control speculative instructions will be chosen for schedule 9938only if there are no other choices at the moment. This will make 9939the use of the control speculation much more conservative. 9940The default is 'disable'. 9941 9942@item -mno-sched-count-spec-in-critical-path 9943@itemx -msched-count-spec-in-critical-path 9944@opindex mno-sched-count-spec-in-critical-path 9945@opindex msched-count-spec-in-critical-path 9946If enabled, speculative dependencies will be considered during 9947computation of the instructions priorities. This will make the use of the 9948speculation a bit more conservative. 9949The default is 'disable'. 9950 9951@end table 9952 9953@node M32C Options 9954@subsection M32C Options 9955@cindex M32C options 9956 9957@table @gcctabopt 9958@item -mcpu=@var{name} 9959@opindex mcpu= 9960Select the CPU for which code is generated. @var{name} may be one of 9961@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 9962/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 9963the M32C/80 series. 9964 9965@item -msim 9966@opindex msim 9967Specifies that the program will be run on the simulator. This causes 9968an alternate runtime library to be linked in which supports, for 9969example, file I/O. You must not use this option when generating 9970programs that will run on real hardware; you must provide your own 9971runtime library for whatever I/O functions are needed. 9972 9973@item -memregs=@var{number} 9974@opindex memregs= 9975Specifies the number of memory-based pseudo-registers GCC will use 9976during code generation. These pseudo-registers will be used like real 9977registers, so there is a tradeoff between GCC's ability to fit the 9978code into available registers, and the performance penalty of using 9979memory instead of registers. Note that all modules in a program must 9980be compiled with the same value for this option. Because of that, you 9981must not use this option with the default runtime libraries gcc 9982builds. 9983 9984@end table 9985 9986@node M32R/D Options 9987@subsection M32R/D Options 9988@cindex M32R/D options 9989 9990These @option{-m} options are defined for Renesas M32R/D architectures: 9991 9992@table @gcctabopt 9993@item -m32r2 9994@opindex m32r2 9995Generate code for the M32R/2@. 9996 9997@item -m32rx 9998@opindex m32rx 9999Generate code for the M32R/X@. 10000 10001@item -m32r 10002@opindex m32r 10003Generate code for the M32R@. This is the default. 10004 10005@item -mmodel=small 10006@opindex mmodel=small 10007Assume all objects live in the lower 16MB of memory (so that their addresses 10008can be loaded with the @code{ld24} instruction), and assume all subroutines 10009are reachable with the @code{bl} instruction. 10010This is the default. 10011 10012The addressability of a particular object can be set with the 10013@code{model} attribute. 10014 10015@item -mmodel=medium 10016@opindex mmodel=medium 10017Assume objects may be anywhere in the 32-bit address space (the compiler 10018will generate @code{seth/add3} instructions to load their addresses), and 10019assume all subroutines are reachable with the @code{bl} instruction. 10020 10021@item -mmodel=large 10022@opindex mmodel=large 10023Assume objects may be anywhere in the 32-bit address space (the compiler 10024will generate @code{seth/add3} instructions to load their addresses), and 10025assume subroutines may not be reachable with the @code{bl} instruction 10026(the compiler will generate the much slower @code{seth/add3/jl} 10027instruction sequence). 10028 10029@item -msdata=none 10030@opindex msdata=none 10031Disable use of the small data area. Variables will be put into 10032one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the 10033@code{section} attribute has been specified). 10034This is the default. 10035 10036The small data area consists of sections @samp{.sdata} and @samp{.sbss}. 10037Objects may be explicitly put in the small data area with the 10038@code{section} attribute using one of these sections. 10039 10040@item -msdata=sdata 10041@opindex msdata=sdata 10042Put small global and static data in the small data area, but do not 10043generate special code to reference them. 10044 10045@item -msdata=use 10046@opindex msdata=use 10047Put small global and static data in the small data area, and generate 10048special instructions to reference them. 10049 10050@item -G @var{num} 10051@opindex G 10052@cindex smaller data references 10053Put global and static objects less than or equal to @var{num} bytes 10054into the small data or bss sections instead of the normal data or bss 10055sections. The default value of @var{num} is 8. 10056The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 10057for this option to have any effect. 10058 10059All modules should be compiled with the same @option{-G @var{num}} value. 10060Compiling with different values of @var{num} may or may not work; if it 10061doesn't the linker will give an error message---incorrect code will not be 10062generated. 10063 10064@item -mdebug 10065@opindex mdebug 10066Makes the M32R specific code in the compiler display some statistics 10067that might help in debugging programs. 10068 10069@item -malign-loops 10070@opindex malign-loops 10071Align all loops to a 32-byte boundary. 10072 10073@item -mno-align-loops 10074@opindex mno-align-loops 10075Do not enforce a 32-byte alignment for loops. This is the default. 10076 10077@item -missue-rate=@var{number} 10078@opindex missue-rate=@var{number} 10079Issue @var{number} instructions per cycle. @var{number} can only be 1 10080or 2. 10081 10082@item -mbranch-cost=@var{number} 10083@opindex mbranch-cost=@var{number} 10084@var{number} can only be 1 or 2. If it is 1 then branches will be 10085preferred over conditional code, if it is 2, then the opposite will 10086apply. 10087 10088@item -mflush-trap=@var{number} 10089@opindex mflush-trap=@var{number} 10090Specifies the trap number to use to flush the cache. The default is 1009112. Valid numbers are between 0 and 15 inclusive. 10092 10093@item -mno-flush-trap 10094@opindex mno-flush-trap 10095Specifies that the cache cannot be flushed by using a trap. 10096 10097@item -mflush-func=@var{name} 10098@opindex mflush-func=@var{name} 10099Specifies the name of the operating system function to call to flush 10100the cache. The default is @emph{_flush_cache}, but a function call 10101will only be used if a trap is not available. 10102 10103@item -mno-flush-func 10104@opindex mno-flush-func 10105Indicates that there is no OS function for flushing the cache. 10106 10107@end table 10108 10109@node M680x0 Options 10110@subsection M680x0 Options 10111@cindex M680x0 options 10112 10113These are the @samp{-m} options defined for the 68000 series. The default 10114values for these options depends on which style of 68000 was selected when 10115the compiler was configured; the defaults for the most common choices are 10116given below. 10117 10118@table @gcctabopt 10119@item -m68000 10120@itemx -mc68000 10121@opindex m68000 10122@opindex mc68000 10123Generate output for a 68000. This is the default 10124when the compiler is configured for 68000-based systems. 10125 10126Use this option for microcontrollers with a 68000 or EC000 core, 10127including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 10128 10129@item -m68020 10130@itemx -mc68020 10131@opindex m68020 10132@opindex mc68020 10133Generate output for a 68020. This is the default 10134when the compiler is configured for 68020-based systems. 10135 10136@item -m68881 10137@opindex m68881 10138Generate output containing 68881 instructions for floating point. 10139This is the default for most 68020 systems unless @option{--nfp} was 10140specified when the compiler was configured. 10141 10142@item -m68030 10143@opindex m68030 10144Generate output for a 68030. This is the default when the compiler is 10145configured for 68030-based systems. 10146 10147@item -m68040 10148@opindex m68040 10149Generate output for a 68040. This is the default when the compiler is 10150configured for 68040-based systems. 10151 10152This option inhibits the use of 68881/68882 instructions that have to be 10153emulated by software on the 68040. Use this option if your 68040 does not 10154have code to emulate those instructions. 10155 10156@item -m68060 10157@opindex m68060 10158Generate output for a 68060. This is the default when the compiler is 10159configured for 68060-based systems. 10160 10161This option inhibits the use of 68020 and 68881/68882 instructions that 10162have to be emulated by software on the 68060. Use this option if your 68060 10163does not have code to emulate those instructions. 10164 10165@item -mcpu32 10166@opindex mcpu32 10167Generate output for a CPU32. This is the default 10168when the compiler is configured for CPU32-based systems. 10169 10170Use this option for microcontrollers with a 10171CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 1017268336, 68340, 68341, 68349 and 68360. 10173 10174@item -m5200 10175@opindex m5200 10176Generate output for a 520X ``coldfire'' family cpu. This is the default 10177when the compiler is configured for 520X-based systems. 10178 10179Use this option for microcontroller with a 5200 core, including 10180the MCF5202, MCF5203, MCF5204 and MCF5202. 10181 10182@item -mcfv4e 10183@opindex mcfv4e 10184Generate output for a ColdFire V4e family cpu (e.g.@: 547x/548x). 10185This includes use of hardware floating point instructions. 10186 10187@item -m68020-40 10188@opindex m68020-40 10189Generate output for a 68040, without using any of the new instructions. 10190This results in code which can run relatively efficiently on either a 1019168020/68881 or a 68030 or a 68040. The generated code does use the 1019268881 instructions that are emulated on the 68040. 10193 10194@item -m68020-60 10195@opindex m68020-60 10196Generate output for a 68060, without using any of the new instructions. 10197This results in code which can run relatively efficiently on either a 1019868020/68881 or a 68030 or a 68040. The generated code does use the 1019968881 instructions that are emulated on the 68060. 10200 10201@item -msoft-float 10202@opindex msoft-float 10203Generate output containing library calls for floating point. 10204@strong{Warning:} the requisite libraries are not available for all m68k 10205targets. Normally the facilities of the machine's usual C compiler are 10206used, but this can't be done directly in cross-compilation. You must 10207make your own arrangements to provide suitable library functions for 10208cross-compilation. The embedded targets @samp{m68k-*-aout} and 10209@samp{m68k-*-coff} do provide software floating point support. 10210 10211@item -mshort 10212@opindex mshort 10213Consider type @code{int} to be 16 bits wide, like @code{short int}. 10214Additionally, parameters passed on the stack are also aligned to a 1021516-bit boundary even on targets whose API mandates promotion to 32-bit. 10216 10217@item -mnobitfield 10218@opindex mnobitfield 10219Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 10220and @option{-m5200} options imply @w{@option{-mnobitfield}}. 10221 10222@item -mbitfield 10223@opindex mbitfield 10224Do use the bit-field instructions. The @option{-m68020} option implies 10225@option{-mbitfield}. This is the default if you use a configuration 10226designed for a 68020. 10227 10228@item -mrtd 10229@opindex mrtd 10230Use a different function-calling convention, in which functions 10231that take a fixed number of arguments return with the @code{rtd} 10232instruction, which pops their arguments while returning. This 10233saves one instruction in the caller since there is no need to pop 10234the arguments there. 10235 10236This calling convention is incompatible with the one normally 10237used on Unix, so you cannot use it if you need to call libraries 10238compiled with the Unix compiler. 10239 10240Also, you must provide function prototypes for all functions that 10241take variable numbers of arguments (including @code{printf}); 10242otherwise incorrect code will be generated for calls to those 10243functions. 10244 10245In addition, seriously incorrect code will result if you call a 10246function with too many arguments. (Normally, extra arguments are 10247harmlessly ignored.) 10248 10249The @code{rtd} instruction is supported by the 68010, 68020, 68030, 1025068040, 68060 and CPU32 processors, but not by the 68000 or 5200. 10251 10252@item -malign-int 10253@itemx -mno-align-int 10254@opindex malign-int 10255@opindex mno-align-int 10256Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 10257@code{float}, @code{double}, and @code{long double} variables on a 32-bit 10258boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 10259Aligning variables on 32-bit boundaries produces code that runs somewhat 10260faster on processors with 32-bit busses at the expense of more memory. 10261 10262@strong{Warning:} if you use the @option{-malign-int} switch, GCC will 10263align structures containing the above types differently than 10264most published application binary interface specifications for the m68k. 10265 10266@item -mpcrel 10267@opindex mpcrel 10268Use the pc-relative addressing mode of the 68000 directly, instead of 10269using a global offset table. At present, this option implies @option{-fpic}, 10270allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 10271not presently supported with @option{-mpcrel}, though this could be supported for 1027268020 and higher processors. 10273 10274@item -mno-strict-align 10275@itemx -mstrict-align 10276@opindex mno-strict-align 10277@opindex mstrict-align 10278Do not (do) assume that unaligned memory references will be handled by 10279the system. 10280 10281@item -msep-data 10282Generate code that allows the data segment to be located in a different 10283area of memory from the text segment. This allows for execute in place in 10284an environment without virtual memory management. This option implies 10285@option{-fPIC}. 10286 10287@item -mno-sep-data 10288Generate code that assumes that the data segment follows the text segment. 10289This is the default. 10290 10291@item -mid-shared-library 10292Generate code that supports shared libraries via the library ID method. 10293This allows for execute in place and shared libraries in an environment 10294without virtual memory management. This option implies @option{-fPIC}. 10295 10296@item -mno-id-shared-library 10297Generate code that doesn't assume ID based shared libraries are being used. 10298This is the default. 10299 10300@item -mshared-library-id=n 10301Specified the identification number of the ID based shared library being 10302compiled. Specifying a value of 0 will generate more compact code, specifying 10303other values will force the allocation of that number to the current 10304library but is no more space or time efficient than omitting this option. 10305 10306@end table 10307 10308@node M68hc1x Options 10309@subsection M68hc1x Options 10310@cindex M68hc1x options 10311 10312These are the @samp{-m} options defined for the 68hc11 and 68hc12 10313microcontrollers. The default values for these options depends on 10314which style of microcontroller was selected when the compiler was configured; 10315the defaults for the most common choices are given below. 10316 10317@table @gcctabopt 10318@item -m6811 10319@itemx -m68hc11 10320@opindex m6811 10321@opindex m68hc11 10322Generate output for a 68HC11. This is the default 10323when the compiler is configured for 68HC11-based systems. 10324 10325@item -m6812 10326@itemx -m68hc12 10327@opindex m6812 10328@opindex m68hc12 10329Generate output for a 68HC12. This is the default 10330when the compiler is configured for 68HC12-based systems. 10331 10332@item -m68S12 10333@itemx -m68hcs12 10334@opindex m68S12 10335@opindex m68hcs12 10336Generate output for a 68HCS12. 10337 10338@item -mauto-incdec 10339@opindex mauto-incdec 10340Enable the use of 68HC12 pre and post auto-increment and auto-decrement 10341addressing modes. 10342 10343@item -minmax 10344@itemx -nominmax 10345@opindex minmax 10346@opindex mnominmax 10347Enable the use of 68HC12 min and max instructions. 10348 10349@item -mlong-calls 10350@itemx -mno-long-calls 10351@opindex mlong-calls 10352@opindex mno-long-calls 10353Treat all calls as being far away (near). If calls are assumed to be 10354far away, the compiler will use the @code{call} instruction to 10355call a function and the @code{rtc} instruction for returning. 10356 10357@item -mshort 10358@opindex mshort 10359Consider type @code{int} to be 16 bits wide, like @code{short int}. 10360 10361@item -msoft-reg-count=@var{count} 10362@opindex msoft-reg-count 10363Specify the number of pseudo-soft registers which are used for the 10364code generation. The maximum number is 32. Using more pseudo-soft 10365register may or may not result in better code depending on the program. 10366The default is 4 for 68HC11 and 2 for 68HC12. 10367 10368@end table 10369 10370@node MCore Options 10371@subsection MCore Options 10372@cindex MCore options 10373 10374These are the @samp{-m} options defined for the Motorola M*Core 10375processors. 10376 10377@table @gcctabopt 10378 10379@item -mhardlit 10380@itemx -mno-hardlit 10381@opindex mhardlit 10382@opindex mno-hardlit 10383Inline constants into the code stream if it can be done in two 10384instructions or less. 10385 10386@item -mdiv 10387@itemx -mno-div 10388@opindex mdiv 10389@opindex mno-div 10390Use the divide instruction. (Enabled by default). 10391 10392@item -mrelax-immediate 10393@itemx -mno-relax-immediate 10394@opindex mrelax-immediate 10395@opindex mno-relax-immediate 10396Allow arbitrary sized immediates in bit operations. 10397 10398@item -mwide-bitfields 10399@itemx -mno-wide-bitfields 10400@opindex mwide-bitfields 10401@opindex mno-wide-bitfields 10402Always treat bit-fields as int-sized. 10403 10404@item -m4byte-functions 10405@itemx -mno-4byte-functions 10406@opindex m4byte-functions 10407@opindex mno-4byte-functions 10408Force all functions to be aligned to a four byte boundary. 10409 10410@item -mcallgraph-data 10411@itemx -mno-callgraph-data 10412@opindex mcallgraph-data 10413@opindex mno-callgraph-data 10414Emit callgraph information. 10415 10416@item -mslow-bytes 10417@itemx -mno-slow-bytes 10418@opindex mslow-bytes 10419@opindex mno-slow-bytes 10420Prefer word access when reading byte quantities. 10421 10422@item -mlittle-endian 10423@itemx -mbig-endian 10424@opindex mlittle-endian 10425@opindex mbig-endian 10426Generate code for a little endian target. 10427 10428@item -m210 10429@itemx -m340 10430@opindex m210 10431@opindex m340 10432Generate code for the 210 processor. 10433@end table 10434 10435@node MIPS Options 10436@subsection MIPS Options 10437@cindex MIPS options 10438 10439@table @gcctabopt 10440 10441@item -EB 10442@opindex EB 10443Generate big-endian code. 10444 10445@item -EL 10446@opindex EL 10447Generate little-endian code. This is the default for @samp{mips*el-*-*} 10448configurations. 10449 10450@item -march=@var{arch} 10451@opindex march 10452Generate code that will run on @var{arch}, which can be the name of a 10453generic MIPS ISA, or the name of a particular processor. 10454The ISA names are: 10455@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 10456@samp{mips32}, @samp{mips32r2}, and @samp{mips64}. 10457The processor names are: 10458@samp{4kc}, @samp{4km}, @samp{4kp}, 10459@samp{5kc}, @samp{5kf}, 10460@samp{20kc}, 10461@samp{24k}, @samp{24kc}, @samp{24kf}, @samp{24kx}, 10462@samp{m4k}, 10463@samp{orion}, 10464@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 10465@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, 10466@samp{rm7000}, @samp{rm9000}, 10467@samp{sb1}, 10468@samp{sr71000}, 10469@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 10470@samp{vr5000}, @samp{vr5400} and @samp{vr5500}. 10471The special value @samp{from-abi} selects the 10472most compatible architecture for the selected ABI (that is, 10473@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 10474 10475In processor names, a final @samp{000} can be abbreviated as @samp{k} 10476(for example, @samp{-march=r2k}). Prefixes are optional, and 10477@samp{vr} may be written @samp{r}. 10478 10479GCC defines two macros based on the value of this option. The first 10480is @samp{_MIPS_ARCH}, which gives the name of target architecture, as 10481a string. The second has the form @samp{_MIPS_ARCH_@var{foo}}, 10482where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@. 10483For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH} 10484to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}. 10485 10486Note that the @samp{_MIPS_ARCH} macro uses the processor names given 10487above. In other words, it will have the full prefix and will not 10488abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 10489the macro names the resolved architecture (either @samp{"mips1"} or 10490@samp{"mips3"}). It names the default architecture when no 10491@option{-march} option is given. 10492 10493@item -mtune=@var{arch} 10494@opindex mtune 10495Optimize for @var{arch}. Among other things, this option controls 10496the way instructions are scheduled, and the perceived cost of arithmetic 10497operations. The list of @var{arch} values is the same as for 10498@option{-march}. 10499 10500When this option is not used, GCC will optimize for the processor 10501specified by @option{-march}. By using @option{-march} and 10502@option{-mtune} together, it is possible to generate code that will 10503run on a family of processors, but optimize the code for one 10504particular member of that family. 10505 10506@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and 10507@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the 10508@samp{-march} ones described above. 10509 10510@item -mips1 10511@opindex mips1 10512Equivalent to @samp{-march=mips1}. 10513 10514@item -mips2 10515@opindex mips2 10516Equivalent to @samp{-march=mips2}. 10517 10518@item -mips3 10519@opindex mips3 10520Equivalent to @samp{-march=mips3}. 10521 10522@item -mips4 10523@opindex mips4 10524Equivalent to @samp{-march=mips4}. 10525 10526@item -mips32 10527@opindex mips32 10528Equivalent to @samp{-march=mips32}. 10529 10530@item -mips32r2 10531@opindex mips32r2 10532Equivalent to @samp{-march=mips32r2}. 10533 10534@item -mips64 10535@opindex mips64 10536Equivalent to @samp{-march=mips64}. 10537 10538@item -mips16 10539@itemx -mno-mips16 10540@opindex mips16 10541@opindex mno-mips16 10542Generate (do not generate) MIPS16 code. If GCC is targetting a 10543MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@. 10544 10545@item -mabi=32 10546@itemx -mabi=o64 10547@itemx -mabi=n32 10548@itemx -mabi=64 10549@itemx -mabi=eabi 10550@opindex mabi=32 10551@opindex mabi=o64 10552@opindex mabi=n32 10553@opindex mabi=64 10554@opindex mabi=eabi 10555Generate code for the given ABI@. 10556 10557Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 10558generates 64-bit code when you select a 64-bit architecture, but you 10559can use @option{-mgp32} to get 32-bit code instead. 10560 10561For information about the O64 ABI, see 10562@w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}. 10563 10564@item -mabicalls 10565@itemx -mno-abicalls 10566@opindex mabicalls 10567@opindex mno-abicalls 10568Generate (do not generate) code that is suitable for SVR4-style 10569dynamic objects. @option{-mabicalls} is the default for SVR4-based 10570systems. 10571 10572@item -mshared 10573@itemx -mno-shared 10574Generate (do not generate) code that is fully position-independent, 10575and that can therefore be linked into shared libraries. This option 10576only affects @option{-mabicalls}. 10577 10578All @option{-mabicalls} code has traditionally been position-independent, 10579regardless of options like @option{-fPIC} and @option{-fpic}. However, 10580as an extension, the GNU toolchain allows executables to use absolute 10581accesses for locally-binding symbols. It can also use shorter GP 10582initialization sequences and generate direct calls to locally-defined 10583functions. This mode is selected by @option{-mno-shared}. 10584 10585@option{-mno-shared} depends on binutils 2.16 or higher and generates 10586objects that can only be linked by the GNU linker. However, the option 10587does not affect the ABI of the final executable; it only affects the ABI 10588of relocatable objects. Using @option{-mno-shared} will generally make 10589executables both smaller and quicker. 10590 10591@option{-mshared} is the default. 10592 10593@item -mxgot 10594@itemx -mno-xgot 10595@opindex mxgot 10596@opindex mno-xgot 10597Lift (do not lift) the usual restrictions on the size of the global 10598offset table. 10599 10600GCC normally uses a single instruction to load values from the GOT@. 10601While this is relatively efficient, it will only work if the GOT 10602is smaller than about 64k. Anything larger will cause the linker 10603to report an error such as: 10604 10605@cindex relocation truncated to fit (MIPS) 10606@smallexample 10607relocation truncated to fit: R_MIPS_GOT16 foobar 10608@end smallexample 10609 10610If this happens, you should recompile your code with @option{-mxgot}. 10611It should then work with very large GOTs, although it will also be 10612less efficient, since it will take three instructions to fetch the 10613value of a global symbol. 10614 10615Note that some linkers can create multiple GOTs. If you have such a 10616linker, you should only need to use @option{-mxgot} when a single object 10617file accesses more than 64k's worth of GOT entries. Very few do. 10618 10619These options have no effect unless GCC is generating position 10620independent code. 10621 10622@item -mgp32 10623@opindex mgp32 10624Assume that general-purpose registers are 32 bits wide. 10625 10626@item -mgp64 10627@opindex mgp64 10628Assume that general-purpose registers are 64 bits wide. 10629 10630@item -mfp32 10631@opindex mfp32 10632Assume that floating-point registers are 32 bits wide. 10633 10634@item -mfp64 10635@opindex mfp64 10636Assume that floating-point registers are 64 bits wide. 10637 10638@item -mhard-float 10639@opindex mhard-float 10640Use floating-point coprocessor instructions. 10641 10642@item -msoft-float 10643@opindex msoft-float 10644Do not use floating-point coprocessor instructions. Implement 10645floating-point calculations using library calls instead. 10646 10647@item -msingle-float 10648@opindex msingle-float 10649Assume that the floating-point coprocessor only supports single-precision 10650operations. 10651 10652@itemx -mdouble-float 10653@opindex mdouble-float 10654Assume that the floating-point coprocessor supports double-precision 10655operations. This is the default. 10656 10657@itemx -mdsp 10658@itemx -mno-dsp 10659@opindex mdsp 10660@opindex mno-dsp 10661Use (do not use) the MIPS DSP ASE. @xref{MIPS DSP Built-in Functions}. 10662 10663@itemx -mpaired-single 10664@itemx -mno-paired-single 10665@opindex mpaired-single 10666@opindex mno-paired-single 10667Use (do not use) paired-single floating-point instructions. 10668@xref{MIPS Paired-Single Support}. This option can only be used 10669when generating 64-bit code and requires hardware floating-point 10670support to be enabled. 10671 10672@itemx -mips3d 10673@itemx -mno-mips3d 10674@opindex mips3d 10675@opindex mno-mips3d 10676Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 10677The option @option{-mips3d} implies @option{-mpaired-single}. 10678 10679@item -mlong64 10680@opindex mlong64 10681Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 10682an explanation of the default and the way that the pointer size is 10683determined. 10684 10685@item -mlong32 10686@opindex mlong32 10687Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 10688 10689The default size of @code{int}s, @code{long}s and pointers depends on 10690the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 10691uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 1069232-bit @code{long}s. Pointers are the same size as @code{long}s, 10693or the same size as integer registers, whichever is smaller. 10694 10695@item -msym32 10696@itemx -mno-sym32 10697@opindex msym32 10698@opindex mno-sym32 10699Assume (do not assume) that all symbols have 32-bit values, regardless 10700of the selected ABI@. This option is useful in combination with 10701@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 10702to generate shorter and faster references to symbolic addresses. 10703 10704@item -G @var{num} 10705@opindex G 10706@cindex smaller data references (MIPS) 10707@cindex gp-relative references (MIPS) 10708Put global and static items less than or equal to @var{num} bytes into 10709the small data or bss section instead of the normal data or bss section. 10710This allows the data to be accessed using a single instruction. 10711 10712All modules should be compiled with the same @option{-G @var{num}} 10713value. 10714 10715@item -membedded-data 10716@itemx -mno-embedded-data 10717@opindex membedded-data 10718@opindex mno-embedded-data 10719Allocate variables to the read-only data section first if possible, then 10720next in the small data section if possible, otherwise in data. This gives 10721slightly slower code than the default, but reduces the amount of RAM required 10722when executing, and thus may be preferred for some embedded systems. 10723 10724@item -muninit-const-in-rodata 10725@itemx -mno-uninit-const-in-rodata 10726@opindex muninit-const-in-rodata 10727@opindex mno-uninit-const-in-rodata 10728Put uninitialized @code{const} variables in the read-only data section. 10729This option is only meaningful in conjunction with @option{-membedded-data}. 10730 10731@item -msplit-addresses 10732@itemx -mno-split-addresses 10733@opindex msplit-addresses 10734@opindex mno-split-addresses 10735Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 10736relocation operators. This option has been superseded by 10737@option{-mexplicit-relocs} but is retained for backwards compatibility. 10738 10739@item -mexplicit-relocs 10740@itemx -mno-explicit-relocs 10741@opindex mexplicit-relocs 10742@opindex mno-explicit-relocs 10743Use (do not use) assembler relocation operators when dealing with symbolic 10744addresses. The alternative, selected by @option{-mno-explicit-relocs}, 10745is to use assembler macros instead. 10746 10747@option{-mexplicit-relocs} is the default if GCC was configured 10748to use an assembler that supports relocation operators. 10749 10750@item -mcheck-zero-division 10751@itemx -mno-check-zero-division 10752@opindex mcheck-zero-division 10753@opindex mno-check-zero-division 10754Trap (do not trap) on integer division by zero. The default is 10755@option{-mcheck-zero-division}. 10756 10757@item -mdivide-traps 10758@itemx -mdivide-breaks 10759@opindex mdivide-traps 10760@opindex mdivide-breaks 10761MIPS systems check for division by zero by generating either a 10762conditional trap or a break instruction. Using traps results in 10763smaller code, but is only supported on MIPS II and later. Also, some 10764versions of the Linux kernel have a bug that prevents trap from 10765generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 10766allow conditional traps on architectures that support them and 10767@option{-mdivide-breaks} to force the use of breaks. 10768 10769The default is usually @option{-mdivide-traps}, but this can be 10770overridden at configure time using @option{--with-divide=breaks}. 10771Divide-by-zero checks can be completely disabled using 10772@option{-mno-check-zero-division}. 10773 10774@item -mmemcpy 10775@itemx -mno-memcpy 10776@opindex mmemcpy 10777@opindex mno-memcpy 10778Force (do not force) the use of @code{memcpy()} for non-trivial block 10779moves. The default is @option{-mno-memcpy}, which allows GCC to inline 10780most constant-sized copies. 10781 10782@item -mlong-calls 10783@itemx -mno-long-calls 10784@opindex mlong-calls 10785@opindex mno-long-calls 10786Disable (do not disable) use of the @code{jal} instruction. Calling 10787functions using @code{jal} is more efficient but requires the caller 10788and callee to be in the same 256 megabyte segment. 10789 10790This option has no effect on abicalls code. The default is 10791@option{-mno-long-calls}. 10792 10793@item -mmad 10794@itemx -mno-mad 10795@opindex mmad 10796@opindex mno-mad 10797Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 10798instructions, as provided by the R4650 ISA@. 10799 10800@item -mfused-madd 10801@itemx -mno-fused-madd 10802@opindex mfused-madd 10803@opindex mno-fused-madd 10804Enable (disable) use of the floating point multiply-accumulate 10805instructions, when they are available. The default is 10806@option{-mfused-madd}. 10807 10808When multiply-accumulate instructions are used, the intermediate 10809product is calculated to infinite precision and is not subject to 10810the FCSR Flush to Zero bit. This may be undesirable in some 10811circumstances. 10812 10813@item -nocpp 10814@opindex nocpp 10815Tell the MIPS assembler to not run its preprocessor over user 10816assembler files (with a @samp{.s} suffix) when assembling them. 10817 10818@item -mfix-r4000 10819@itemx -mno-fix-r4000 10820@opindex mfix-r4000 10821@opindex mno-fix-r4000 10822Work around certain R4000 CPU errata: 10823@itemize @minus 10824@item 10825A double-word or a variable shift may give an incorrect result if executed 10826immediately after starting an integer division. 10827@item 10828A double-word or a variable shift may give an incorrect result if executed 10829while an integer multiplication is in progress. 10830@item 10831An integer division may give an incorrect result if started in a delay slot 10832of a taken branch or a jump. 10833@end itemize 10834 10835@item -mfix-r4400 10836@itemx -mno-fix-r4400 10837@opindex mfix-r4400 10838@opindex mno-fix-r4400 10839Work around certain R4400 CPU errata: 10840@itemize @minus 10841@item 10842A double-word or a variable shift may give an incorrect result if executed 10843immediately after starting an integer division. 10844@end itemize 10845 10846@item -mfix-vr4120 10847@itemx -mno-fix-vr4120 10848@opindex mfix-vr4120 10849Work around certain VR4120 errata: 10850@itemize @minus 10851@item 10852@code{dmultu} does not always produce the correct result. 10853@item 10854@code{div} and @code{ddiv} do not always produce the correct result if one 10855of the operands is negative. 10856@end itemize 10857The workarounds for the division errata rely on special functions in 10858@file{libgcc.a}. At present, these functions are only provided by 10859the @code{mips64vr*-elf} configurations. 10860 10861Other VR4120 errata require a nop to be inserted between certain pairs of 10862instructions. These errata are handled by the assembler, not by GCC itself. 10863 10864@item -mfix-vr4130 10865@opindex mfix-vr4130 10866Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 10867workarounds are implemented by the assembler rather than by GCC, 10868although GCC will avoid using @code{mflo} and @code{mfhi} if the 10869VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 10870instructions are available instead. 10871 10872@item -mfix-sb1 10873@itemx -mno-fix-sb1 10874@opindex mfix-sb1 10875Work around certain SB-1 CPU core errata. 10876(This flag currently works around the SB-1 revision 2 10877``F1'' and ``F2'' floating point errata.) 10878 10879@item -mflush-func=@var{func} 10880@itemx -mno-flush-func 10881@opindex mflush-func 10882Specifies the function to call to flush the I and D caches, or to not 10883call any such function. If called, the function must take the same 10884arguments as the common @code{_flush_func()}, that is, the address of the 10885memory range for which the cache is being flushed, the size of the 10886memory range, and the number 3 (to flush both caches). The default 10887depends on the target GCC was configured for, but commonly is either 10888@samp{_flush_func} or @samp{__cpu_flush}. 10889 10890@item -mbranch-likely 10891@itemx -mno-branch-likely 10892@opindex mbranch-likely 10893@opindex mno-branch-likely 10894Enable or disable use of Branch Likely instructions, regardless of the 10895default for the selected architecture. By default, Branch Likely 10896instructions may be generated if they are supported by the selected 10897architecture. An exception is for the MIPS32 and MIPS64 architectures 10898and processors which implement those architectures; for those, Branch 10899Likely instructions will not be generated by default because the MIPS32 10900and MIPS64 architectures specifically deprecate their use. 10901 10902@item -mfp-exceptions 10903@itemx -mno-fp-exceptions 10904@opindex mfp-exceptions 10905Specifies whether FP exceptions are enabled. This affects how we schedule 10906FP instructions for some processors. The default is that FP exceptions are 10907enabled. 10908 10909For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 1091064-bit code, then we can use both FP pipes. Otherwise, we can only use one 10911FP pipe. 10912 10913@item -mvr4130-align 10914@itemx -mno-vr4130-align 10915@opindex mvr4130-align 10916The VR4130 pipeline is two-way superscalar, but can only issue two 10917instructions together if the first one is 8-byte aligned. When this 10918option is enabled, GCC will align pairs of instructions that it 10919thinks should execute in parallel. 10920 10921This option only has an effect when optimizing for the VR4130. 10922It normally makes code faster, but at the expense of making it bigger. 10923It is enabled by default at optimization level @option{-O3}. 10924@end table 10925 10926@node MMIX Options 10927@subsection MMIX Options 10928@cindex MMIX Options 10929 10930These options are defined for the MMIX: 10931 10932@table @gcctabopt 10933@item -mlibfuncs 10934@itemx -mno-libfuncs 10935@opindex mlibfuncs 10936@opindex mno-libfuncs 10937Specify that intrinsic library functions are being compiled, passing all 10938values in registers, no matter the size. 10939 10940@item -mepsilon 10941@itemx -mno-epsilon 10942@opindex mepsilon 10943@opindex mno-epsilon 10944Generate floating-point comparison instructions that compare with respect 10945to the @code{rE} epsilon register. 10946 10947@item -mabi=mmixware 10948@itemx -mabi=gnu 10949@opindex mabi-mmixware 10950@opindex mabi=gnu 10951Generate code that passes function parameters and return values that (in 10952the called function) are seen as registers @code{$0} and up, as opposed to 10953the GNU ABI which uses global registers @code{$231} and up. 10954 10955@item -mzero-extend 10956@itemx -mno-zero-extend 10957@opindex mzero-extend 10958@opindex mno-zero-extend 10959When reading data from memory in sizes shorter than 64 bits, use (do not 10960use) zero-extending load instructions by default, rather than 10961sign-extending ones. 10962 10963@item -mknuthdiv 10964@itemx -mno-knuthdiv 10965@opindex mknuthdiv 10966@opindex mno-knuthdiv 10967Make the result of a division yielding a remainder have the same sign as 10968the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 10969remainder follows the sign of the dividend. Both methods are 10970arithmetically valid, the latter being almost exclusively used. 10971 10972@item -mtoplevel-symbols 10973@itemx -mno-toplevel-symbols 10974@opindex mtoplevel-symbols 10975@opindex mno-toplevel-symbols 10976Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 10977code can be used with the @code{PREFIX} assembly directive. 10978 10979@item -melf 10980@opindex melf 10981Generate an executable in the ELF format, rather than the default 10982@samp{mmo} format used by the @command{mmix} simulator. 10983 10984@item -mbranch-predict 10985@itemx -mno-branch-predict 10986@opindex mbranch-predict 10987@opindex mno-branch-predict 10988Use (do not use) the probable-branch instructions, when static branch 10989prediction indicates a probable branch. 10990 10991@item -mbase-addresses 10992@itemx -mno-base-addresses 10993@opindex mbase-addresses 10994@opindex mno-base-addresses 10995Generate (do not generate) code that uses @emph{base addresses}. Using a 10996base address automatically generates a request (handled by the assembler 10997and the linker) for a constant to be set up in a global register. The 10998register is used for one or more base address requests within the range 0 10999to 255 from the value held in the register. The generally leads to short 11000and fast code, but the number of different data items that can be 11001addressed is limited. This means that a program that uses lots of static 11002data may require @option{-mno-base-addresses}. 11003 11004@item -msingle-exit 11005@itemx -mno-single-exit 11006@opindex msingle-exit 11007@opindex mno-single-exit 11008Force (do not force) generated code to have a single exit point in each 11009function. 11010@end table 11011 11012@node MN10300 Options 11013@subsection MN10300 Options 11014@cindex MN10300 options 11015 11016These @option{-m} options are defined for Matsushita MN10300 architectures: 11017 11018@table @gcctabopt 11019@item -mmult-bug 11020@opindex mmult-bug 11021Generate code to avoid bugs in the multiply instructions for the MN10300 11022processors. This is the default. 11023 11024@item -mno-mult-bug 11025@opindex mno-mult-bug 11026Do not generate code to avoid bugs in the multiply instructions for the 11027MN10300 processors. 11028 11029@item -mam33 11030@opindex mam33 11031Generate code which uses features specific to the AM33 processor. 11032 11033@item -mno-am33 11034@opindex mno-am33 11035Do not generate code which uses features specific to the AM33 processor. This 11036is the default. 11037 11038@item -mreturn-pointer-on-d0 11039@opindex mreturn-pointer-on-d0 11040When generating a function which returns a pointer, return the pointer 11041in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 11042only in a0, and attempts to call such functions without a prototype 11043would result in errors. Note that this option is on by default; use 11044@option{-mno-return-pointer-on-d0} to disable it. 11045 11046@item -mno-crt0 11047@opindex mno-crt0 11048Do not link in the C run-time initialization object file. 11049 11050@item -mrelax 11051@opindex mrelax 11052Indicate to the linker that it should perform a relaxation optimization pass 11053to shorten branches, calls and absolute memory addresses. This option only 11054has an effect when used on the command line for the final link step. 11055 11056This option makes symbolic debugging impossible. 11057@end table 11058 11059@node MT Options 11060@subsection MT Options 11061@cindex MT options 11062 11063These @option{-m} options are defined for Morpho MT architectures: 11064 11065@table @gcctabopt 11066 11067@item -march=@var{cpu-type} 11068@opindex march 11069Generate code that will run on @var{cpu-type}, which is the name of a system 11070representing a certain processor type. Possible values for 11071@var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002}, 11072@samp{ms1-16-003} and @samp{ms2}. 11073 11074When this option is not used, the default is @option{-march=ms1-16-002}. 11075 11076@item -mbacc 11077@opindex mbacc 11078Use byte loads and stores when generating code. 11079 11080@item -mno-bacc 11081@opindex mno-bacc 11082Do not use byte loads and stores when generating code. 11083 11084@item -msim 11085@opindex msim 11086Use simulator runtime 11087 11088@item -mno-crt0 11089@opindex mno-crt0 11090Do not link in the C run-time initialization object file 11091@file{crti.o}. Other run-time initialization and termination files 11092such as @file{startup.o} and @file{exit.o} are still included on the 11093linker command line. 11094 11095@end table 11096 11097@node PDP-11 Options 11098@subsection PDP-11 Options 11099@cindex PDP-11 Options 11100 11101These options are defined for the PDP-11: 11102 11103@table @gcctabopt 11104@item -mfpu 11105@opindex mfpu 11106Use hardware FPP floating point. This is the default. (FIS floating 11107point on the PDP-11/40 is not supported.) 11108 11109@item -msoft-float 11110@opindex msoft-float 11111Do not use hardware floating point. 11112 11113@item -mac0 11114@opindex mac0 11115Return floating-point results in ac0 (fr0 in Unix assembler syntax). 11116 11117@item -mno-ac0 11118@opindex mno-ac0 11119Return floating-point results in memory. This is the default. 11120 11121@item -m40 11122@opindex m40 11123Generate code for a PDP-11/40. 11124 11125@item -m45 11126@opindex m45 11127Generate code for a PDP-11/45. This is the default. 11128 11129@item -m10 11130@opindex m10 11131Generate code for a PDP-11/10. 11132 11133@item -mbcopy-builtin 11134@opindex bcopy-builtin 11135Use inline @code{movmemhi} patterns for copying memory. This is the 11136default. 11137 11138@item -mbcopy 11139@opindex mbcopy 11140Do not use inline @code{movmemhi} patterns for copying memory. 11141 11142@item -mint16 11143@itemx -mno-int32 11144@opindex mint16 11145@opindex mno-int32 11146Use 16-bit @code{int}. This is the default. 11147 11148@item -mint32 11149@itemx -mno-int16 11150@opindex mint32 11151@opindex mno-int16 11152Use 32-bit @code{int}. 11153 11154@item -mfloat64 11155@itemx -mno-float32 11156@opindex mfloat64 11157@opindex mno-float32 11158Use 64-bit @code{float}. This is the default. 11159 11160@item -mfloat32 11161@itemx -mno-float64 11162@opindex mfloat32 11163@opindex mno-float64 11164Use 32-bit @code{float}. 11165 11166@item -mabshi 11167@opindex mabshi 11168Use @code{abshi2} pattern. This is the default. 11169 11170@item -mno-abshi 11171@opindex mno-abshi 11172Do not use @code{abshi2} pattern. 11173 11174@item -mbranch-expensive 11175@opindex mbranch-expensive 11176Pretend that branches are expensive. This is for experimenting with 11177code generation only. 11178 11179@item -mbranch-cheap 11180@opindex mbranch-cheap 11181Do not pretend that branches are expensive. This is the default. 11182 11183@item -msplit 11184@opindex msplit 11185Generate code for a system with split I&D@. 11186 11187@item -mno-split 11188@opindex mno-split 11189Generate code for a system without split I&D@. This is the default. 11190 11191@item -munix-asm 11192@opindex munix-asm 11193Use Unix assembler syntax. This is the default when configured for 11194@samp{pdp11-*-bsd}. 11195 11196@item -mdec-asm 11197@opindex mdec-asm 11198Use DEC assembler syntax. This is the default when configured for any 11199PDP-11 target other than @samp{pdp11-*-bsd}. 11200@end table 11201 11202@node PowerPC Options 11203@subsection PowerPC Options 11204@cindex PowerPC options 11205 11206These are listed under @xref{RS/6000 and PowerPC Options}. 11207 11208@node RS/6000 and PowerPC Options 11209@subsection IBM RS/6000 and PowerPC Options 11210@cindex RS/6000 and PowerPC Options 11211@cindex IBM RS/6000 and PowerPC Options 11212 11213These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 11214@table @gcctabopt 11215@item -mpower 11216@itemx -mno-power 11217@itemx -mpower2 11218@itemx -mno-power2 11219@itemx -mpowerpc 11220@itemx -mno-powerpc 11221@itemx -mpowerpc-gpopt 11222@itemx -mno-powerpc-gpopt 11223@itemx -mpowerpc-gfxopt 11224@itemx -mno-powerpc-gfxopt 11225@itemx -mpowerpc64 11226@itemx -mno-powerpc64 11227@itemx -mmfcrf 11228@itemx -mno-mfcrf 11229@itemx -mpopcntb 11230@itemx -mno-popcntb 11231@itemx -mfprnd 11232@itemx -mno-fprnd 11233@opindex mpower 11234@opindex mno-power 11235@opindex mpower2 11236@opindex mno-power2 11237@opindex mpowerpc 11238@opindex mno-powerpc 11239@opindex mpowerpc-gpopt 11240@opindex mno-powerpc-gpopt 11241@opindex mpowerpc-gfxopt 11242@opindex mno-powerpc-gfxopt 11243@opindex mpowerpc64 11244@opindex mno-powerpc64 11245@opindex mmfcrf 11246@opindex mno-mfcrf 11247@opindex mpopcntb 11248@opindex mno-popcntb 11249@opindex mfprnd 11250@opindex mno-fprnd 11251GCC supports two related instruction set architectures for the 11252RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those 11253instructions supported by the @samp{rios} chip set used in the original 11254RS/6000 systems and the @dfn{PowerPC} instruction set is the 11255architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and 11256the IBM 4xx, 6xx, and follow-on microprocessors. 11257 11258Neither architecture is a subset of the other. However there is a 11259large common subset of instructions supported by both. An MQ 11260register is included in processors supporting the POWER architecture. 11261 11262You use these options to specify which instructions are available on the 11263processor you are using. The default value of these options is 11264determined when configuring GCC@. Specifying the 11265@option{-mcpu=@var{cpu_type}} overrides the specification of these 11266options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 11267rather than the options listed above. 11268 11269The @option{-mpower} option allows GCC to generate instructions that 11270are found only in the POWER architecture and to use the MQ register. 11271Specifying @option{-mpower2} implies @option{-power} and also allows GCC 11272to generate instructions that are present in the POWER2 architecture but 11273not the original POWER architecture. 11274 11275The @option{-mpowerpc} option allows GCC to generate instructions that 11276are found only in the 32-bit subset of the PowerPC architecture. 11277Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows 11278GCC to use the optional PowerPC architecture instructions in the 11279General Purpose group, including floating-point square root. Specifying 11280@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to 11281use the optional PowerPC architecture instructions in the Graphics 11282group, including floating-point select. 11283 11284The @option{-mmfcrf} option allows GCC to generate the move from 11285condition register field instruction implemented on the POWER4 11286processor and other processors that support the PowerPC V2.01 11287architecture. 11288The @option{-mpopcntb} option allows GCC to generate the popcount and 11289double precision FP reciprocal estimate instruction implemented on the 11290POWER5 processor and other processors that support the PowerPC V2.02 11291architecture. 11292The @option{-mfprnd} option allows GCC to generate the FP round to 11293integer instructions implemented on the POWER5+ processor and other 11294processors that support the PowerPC V2.03 architecture. 11295 11296The @option{-mpowerpc64} option allows GCC to generate the additional 1129764-bit instructions that are found in the full PowerPC64 architecture 11298and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 11299@option{-mno-powerpc64}. 11300 11301If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC 11302will use only the instructions in the common subset of both 11303architectures plus some special AIX common-mode calls, and will not use 11304the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc} 11305permits GCC to use any instruction from either architecture and to 11306allow use of the MQ register; specify this for the Motorola MPC601. 11307 11308@item -mnew-mnemonics 11309@itemx -mold-mnemonics 11310@opindex mnew-mnemonics 11311@opindex mold-mnemonics 11312Select which mnemonics to use in the generated assembler code. With 11313@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for 11314the PowerPC architecture. With @option{-mold-mnemonics} it uses the 11315assembler mnemonics defined for the POWER architecture. Instructions 11316defined in only one architecture have only one mnemonic; GCC uses that 11317mnemonic irrespective of which of these options is specified. 11318 11319GCC defaults to the mnemonics appropriate for the architecture in 11320use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the 11321value of these option. Unless you are building a cross-compiler, you 11322should normally not specify either @option{-mnew-mnemonics} or 11323@option{-mold-mnemonics}, but should instead accept the default. 11324 11325@item -mcpu=@var{cpu_type} 11326@opindex mcpu 11327Set architecture type, register usage, choice of mnemonics, and 11328instruction scheduling parameters for machine type @var{cpu_type}. 11329Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 11330@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505}, 11331@samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604}, 11332@samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400}, 11333@samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 11334@samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3}, 11335@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3}, 11336@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, 11337@samp{common}, @samp{powerpc}, @samp{powerpc64}, 11338@samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}. 11339 11340@option{-mcpu=common} selects a completely generic processor. Code 11341generated under this option will run on any POWER or PowerPC processor. 11342GCC will use only the instructions in the common subset of both 11343architectures, and will not use the MQ register. GCC assumes a generic 11344processor model for scheduling purposes. 11345 11346@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and 11347@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit 11348PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine 11349types, with an appropriate, generic processor model assumed for 11350scheduling purposes. 11351 11352The other options specify a specific processor. Code generated under 11353those options will run best on that processor, and may not run at all on 11354others. 11355 11356The @option{-mcpu} options automatically enable or disable the 11357following options: @option{-maltivec}, @option{-mfprnd}, 11358@option{-mhard-float}, @option{-mmfcrf}, @option{-mmultiple}, 11359@option{-mnew-mnemonics}, @option{-mpopcntb}, @option{-mpower}, 11360@option{-mpower2}, @option{-mpowerpc64}, @option{-mpowerpc-gpopt}, 11361@option{-mpowerpc-gfxopt}, @option{-mstring}, @option{-mmulhw}, @option{-mdlmzb}. 11362The particular options 11363set for any particular CPU will vary between compiler versions, 11364depending on what setting seems to produce optimal code for that CPU; 11365it doesn't necessarily reflect the actual hardware's capabilities. If 11366you wish to set an individual option to a particular value, you may 11367specify it after the @option{-mcpu} option, like @samp{-mcpu=970 11368-mno-altivec}. 11369 11370On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 11371not enabled or disabled by the @option{-mcpu} option at present because 11372AIX does not have full support for these options. You may still 11373enable or disable them individually if you're sure it'll work in your 11374environment. 11375 11376@item -mtune=@var{cpu_type} 11377@opindex mtune 11378Set the instruction scheduling parameters for machine type 11379@var{cpu_type}, but do not set the architecture type, register usage, or 11380choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same 11381values for @var{cpu_type} are used for @option{-mtune} as for 11382@option{-mcpu}. If both are specified, the code generated will use the 11383architecture, registers, and mnemonics set by @option{-mcpu}, but the 11384scheduling parameters set by @option{-mtune}. 11385 11386@item -mswdiv 11387@itemx -mno-swdiv 11388@opindex mswdiv 11389@opindex mno-swdiv 11390Generate code to compute division as reciprocal estimate and iterative 11391refinement, creating opportunities for increased throughput. This 11392feature requires: optional PowerPC Graphics instruction set for single 11393precision and FRE instruction for double precision, assuming divides 11394cannot generate user-visible traps, and the domain values not include 11395Infinities, denormals or zero denominator. 11396 11397@item -maltivec 11398@itemx -mno-altivec 11399@opindex maltivec 11400@opindex mno-altivec 11401Generate code that uses (does not use) AltiVec instructions, and also 11402enable the use of built-in functions that allow more direct access to 11403the AltiVec instruction set. You may also need to set 11404@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 11405enhancements. 11406 11407@item -mvrsave 11408@item -mno-vrsave 11409@opindex mvrsave 11410@opindex mno-vrsave 11411Generate VRSAVE instructions when generating AltiVec code. 11412 11413@item -msecure-plt 11414@opindex msecure-plt 11415Generate code that allows ld and ld.so to build executables and shared 11416libraries with non-exec .plt and .got sections. This is a PowerPC 1141732-bit SYSV ABI option. 11418 11419@item -mbss-plt 11420@opindex mbss-plt 11421Generate code that uses a BSS .plt section that ld.so fills in, and 11422requires .plt and .got sections that are both writable and executable. 11423This is a PowerPC 32-bit SYSV ABI option. 11424 11425@item -misel 11426@itemx -mno-isel 11427@opindex misel 11428@opindex mno-isel 11429This switch enables or disables the generation of ISEL instructions. 11430 11431@item -misel=@var{yes/no} 11432This switch has been deprecated. Use @option{-misel} and 11433@option{-mno-isel} instead. 11434 11435@item -mspe 11436@itemx -mno-spe 11437@opindex mspe 11438@opindex mno-spe 11439This switch enables or disables the generation of SPE simd 11440instructions. 11441 11442@item -mspe=@var{yes/no} 11443This option has been deprecated. Use @option{-mspe} and 11444@option{-mno-spe} instead. 11445 11446@item -mfloat-gprs=@var{yes/single/double/no} 11447@itemx -mfloat-gprs 11448@opindex mfloat-gprs 11449This switch enables or disables the generation of floating point 11450operations on the general purpose registers for architectures that 11451support it. 11452 11453The argument @var{yes} or @var{single} enables the use of 11454single-precision floating point operations. 11455 11456The argument @var{double} enables the use of single and 11457double-precision floating point operations. 11458 11459The argument @var{no} disables floating point operations on the 11460general purpose registers. 11461 11462This option is currently only available on the MPC854x. 11463 11464@item -m32 11465@itemx -m64 11466@opindex m32 11467@opindex m64 11468Generate code for 32-bit or 64-bit environments of Darwin and SVR4 11469targets (including GNU/Linux). The 32-bit environment sets int, long 11470and pointer to 32 bits and generates code that runs on any PowerPC 11471variant. The 64-bit environment sets int to 32 bits and long and 11472pointer to 64 bits, and generates code for PowerPC64, as for 11473@option{-mpowerpc64}. 11474 11475@item -mfull-toc 11476@itemx -mno-fp-in-toc 11477@itemx -mno-sum-in-toc 11478@itemx -mminimal-toc 11479@opindex mfull-toc 11480@opindex mno-fp-in-toc 11481@opindex mno-sum-in-toc 11482@opindex mminimal-toc 11483Modify generation of the TOC (Table Of Contents), which is created for 11484every executable file. The @option{-mfull-toc} option is selected by 11485default. In that case, GCC will allocate at least one TOC entry for 11486each unique non-automatic variable reference in your program. GCC 11487will also place floating-point constants in the TOC@. However, only 1148816,384 entries are available in the TOC@. 11489 11490If you receive a linker error message that saying you have overflowed 11491the available TOC space, you can reduce the amount of TOC space used 11492with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 11493@option{-mno-fp-in-toc} prevents GCC from putting floating-point 11494constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 11495generate code to calculate the sum of an address and a constant at 11496run-time instead of putting that sum into the TOC@. You may specify one 11497or both of these options. Each causes GCC to produce very slightly 11498slower and larger code at the expense of conserving TOC space. 11499 11500If you still run out of space in the TOC even when you specify both of 11501these options, specify @option{-mminimal-toc} instead. This option causes 11502GCC to make only one TOC entry for every file. When you specify this 11503option, GCC will produce code that is slower and larger but which 11504uses extremely little TOC space. You may wish to use this option 11505only on files that contain less frequently executed code. 11506 11507@item -maix64 11508@itemx -maix32 11509@opindex maix64 11510@opindex maix32 11511Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 11512@code{long} type, and the infrastructure needed to support them. 11513Specifying @option{-maix64} implies @option{-mpowerpc64} and 11514@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and 11515implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 11516 11517@item -mxl-compat 11518@itemx -mno-xl-compat 11519@opindex mxl-compat 11520@opindex mno-xl-compat 11521Produce code that conforms more closely to IBM XL compiler semantics 11522when using AIX-compatible ABI. Pass floating-point arguments to 11523prototyped functions beyond the register save area (RSA) on the stack 11524in addition to argument FPRs. Do not assume that most significant 11525double in 128-bit long double value is properly rounded when comparing 11526values and converting to double. Use XL symbol names for long double 11527support routines. 11528 11529The AIX calling convention was extended but not initially documented to 11530handle an obscure K&R C case of calling a function that takes the 11531address of its arguments with fewer arguments than declared. IBM XL 11532compilers access floating point arguments which do not fit in the 11533RSA from the stack when a subroutine is compiled without 11534optimization. Because always storing floating-point arguments on the 11535stack is inefficient and rarely needed, this option is not enabled by 11536default and only is necessary when calling subroutines compiled by IBM 11537XL compilers without optimization. 11538 11539@item -mpe 11540@opindex mpe 11541Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 11542application written to use message passing with special startup code to 11543enable the application to run. The system must have PE installed in the 11544standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 11545must be overridden with the @option{-specs=} option to specify the 11546appropriate directory location. The Parallel Environment does not 11547support threads, so the @option{-mpe} option and the @option{-pthread} 11548option are incompatible. 11549 11550@item -malign-natural 11551@itemx -malign-power 11552@opindex malign-natural 11553@opindex malign-power 11554On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 11555@option{-malign-natural} overrides the ABI-defined alignment of larger 11556types, such as floating-point doubles, on their natural size-based boundary. 11557The option @option{-malign-power} instructs GCC to follow the ABI-specified 11558alignment rules. GCC defaults to the standard alignment defined in the ABI@. 11559 11560On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 11561is not supported. 11562 11563@item -msoft-float 11564@itemx -mhard-float 11565@opindex msoft-float 11566@opindex mhard-float 11567Generate code that does not use (uses) the floating-point register set. 11568Software floating point emulation is provided if you use the 11569@option{-msoft-float} option, and pass the option to GCC when linking. 11570 11571@item -mmultiple 11572@itemx -mno-multiple 11573@opindex mmultiple 11574@opindex mno-multiple 11575Generate code that uses (does not use) the load multiple word 11576instructions and the store multiple word instructions. These 11577instructions are generated by default on POWER systems, and not 11578generated on PowerPC systems. Do not use @option{-mmultiple} on little 11579endian PowerPC systems, since those instructions do not work when the 11580processor is in little endian mode. The exceptions are PPC740 and 11581PPC750 which permit the instructions usage in little endian mode. 11582 11583@item -mstring 11584@itemx -mno-string 11585@opindex mstring 11586@opindex mno-string 11587Generate code that uses (does not use) the load string instructions 11588and the store string word instructions to save multiple registers and 11589do small block moves. These instructions are generated by default on 11590POWER systems, and not generated on PowerPC systems. Do not use 11591@option{-mstring} on little endian PowerPC systems, since those 11592instructions do not work when the processor is in little endian mode. 11593The exceptions are PPC740 and PPC750 which permit the instructions 11594usage in little endian mode. 11595 11596@item -mupdate 11597@itemx -mno-update 11598@opindex mupdate 11599@opindex mno-update 11600Generate code that uses (does not use) the load or store instructions 11601that update the base register to the address of the calculated memory 11602location. These instructions are generated by default. If you use 11603@option{-mno-update}, there is a small window between the time that the 11604stack pointer is updated and the address of the previous frame is 11605stored, which means code that walks the stack frame across interrupts or 11606signals may get corrupted data. 11607 11608@item -mfused-madd 11609@itemx -mno-fused-madd 11610@opindex mfused-madd 11611@opindex mno-fused-madd 11612Generate code that uses (does not use) the floating point multiply and 11613accumulate instructions. These instructions are generated by default if 11614hardware floating is used. 11615 11616@item -mmulhw 11617@itemx -mno-mulhw 11618@opindex mmulhw 11619@opindex mno-mulhw 11620Generate code that uses (does not use) the half-word multiply and 11621multiply-accumulate instructions on the IBM 405 and 440 processors. 11622These instructions are generated by default when targetting those 11623processors. 11624 11625@item -mdlmzb 11626@itemx -mno-dlmzb 11627@opindex mdlmzb 11628@opindex mno-dlmzb 11629Generate code that uses (does not use) the string-search @samp{dlmzb} 11630instruction on the IBM 405 and 440 processors. This instruction is 11631generated by default when targetting those processors. 11632 11633@item -mno-bit-align 11634@itemx -mbit-align 11635@opindex mno-bit-align 11636@opindex mbit-align 11637On System V.4 and embedded PowerPC systems do not (do) force structures 11638and unions that contain bit-fields to be aligned to the base type of the 11639bit-field. 11640 11641For example, by default a structure containing nothing but 8 11642@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte 11643boundary and have a size of 4 bytes. By using @option{-mno-bit-align}, 11644the structure would be aligned to a 1 byte boundary and be one byte in 11645size. 11646 11647@item -mno-strict-align 11648@itemx -mstrict-align 11649@opindex mno-strict-align 11650@opindex mstrict-align 11651On System V.4 and embedded PowerPC systems do not (do) assume that 11652unaligned memory references will be handled by the system. 11653 11654@item -mrelocatable 11655@itemx -mno-relocatable 11656@opindex mrelocatable 11657@opindex mno-relocatable 11658On embedded PowerPC systems generate code that allows (does not allow) 11659the program to be relocated to a different address at runtime. If you 11660use @option{-mrelocatable} on any module, all objects linked together must 11661be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}. 11662 11663@item -mrelocatable-lib 11664@itemx -mno-relocatable-lib 11665@opindex mrelocatable-lib 11666@opindex mno-relocatable-lib 11667On embedded PowerPC systems generate code that allows (does not allow) 11668the program to be relocated to a different address at runtime. Modules 11669compiled with @option{-mrelocatable-lib} can be linked with either modules 11670compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or 11671with modules compiled with the @option{-mrelocatable} options. 11672 11673@item -mno-toc 11674@itemx -mtoc 11675@opindex mno-toc 11676@opindex mtoc 11677On System V.4 and embedded PowerPC systems do not (do) assume that 11678register 2 contains a pointer to a global area pointing to the addresses 11679used in the program. 11680 11681@item -mlittle 11682@itemx -mlittle-endian 11683@opindex mlittle 11684@opindex mlittle-endian 11685On System V.4 and embedded PowerPC systems compile code for the 11686processor in little endian mode. The @option{-mlittle-endian} option is 11687the same as @option{-mlittle}. 11688 11689@item -mbig 11690@itemx -mbig-endian 11691@opindex mbig 11692@opindex mbig-endian 11693On System V.4 and embedded PowerPC systems compile code for the 11694processor in big endian mode. The @option{-mbig-endian} option is 11695the same as @option{-mbig}. 11696 11697@item -mdynamic-no-pic 11698@opindex mdynamic-no-pic 11699On Darwin and Mac OS X systems, compile code so that it is not 11700relocatable, but that its external references are relocatable. The 11701resulting code is suitable for applications, but not shared 11702libraries. 11703 11704@item -mprioritize-restricted-insns=@var{priority} 11705@opindex mprioritize-restricted-insns 11706This option controls the priority that is assigned to 11707dispatch-slot restricted instructions during the second scheduling 11708pass. The argument @var{priority} takes the value @var{0/1/2} to assign 11709@var{no/highest/second-highest} priority to dispatch slot restricted 11710instructions. 11711 11712@item -msched-costly-dep=@var{dependence_type} 11713@opindex msched-costly-dep 11714This option controls which dependences are considered costly 11715by the target during instruction scheduling. The argument 11716@var{dependence_type} takes one of the following values: 11717@var{no}: no dependence is costly, 11718@var{all}: all dependences are costly, 11719@var{true_store_to_load}: a true dependence from store to load is costly, 11720@var{store_to_load}: any dependence from store to load is costly, 11721@var{number}: any dependence which latency >= @var{number} is costly. 11722 11723@item -minsert-sched-nops=@var{scheme} 11724@opindex minsert-sched-nops 11725This option controls which nop insertion scheme will be used during 11726the second scheduling pass. The argument @var{scheme} takes one of the 11727following values: 11728@var{no}: Don't insert nops. 11729@var{pad}: Pad with nops any dispatch group which has vacant issue slots, 11730according to the scheduler's grouping. 11731@var{regroup_exact}: Insert nops to force costly dependent insns into 11732separate groups. Insert exactly as many nops as needed to force an insn 11733to a new group, according to the estimated processor grouping. 11734@var{number}: Insert nops to force costly dependent insns into 11735separate groups. Insert @var{number} nops to force an insn to a new group. 11736 11737@item -mcall-sysv 11738@opindex mcall-sysv 11739On System V.4 and embedded PowerPC systems compile code using calling 11740conventions that adheres to the March 1995 draft of the System V 11741Application Binary Interface, PowerPC processor supplement. This is the 11742default unless you configured GCC using @samp{powerpc-*-eabiaix}. 11743 11744@item -mcall-sysv-eabi 11745@opindex mcall-sysv-eabi 11746Specify both @option{-mcall-sysv} and @option{-meabi} options. 11747 11748@item -mcall-sysv-noeabi 11749@opindex mcall-sysv-noeabi 11750Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 11751 11752@item -mcall-solaris 11753@opindex mcall-solaris 11754On System V.4 and embedded PowerPC systems compile code for the Solaris 11755operating system. 11756 11757@item -mcall-linux 11758@opindex mcall-linux 11759On System V.4 and embedded PowerPC systems compile code for the 11760Linux-based GNU system. 11761 11762@item -mcall-gnu 11763@opindex mcall-gnu 11764On System V.4 and embedded PowerPC systems compile code for the 11765Hurd-based GNU system. 11766 11767@item -mcall-netbsd 11768@opindex mcall-netbsd 11769On System V.4 and embedded PowerPC systems compile code for the 11770NetBSD operating system. 11771 11772@item -maix-struct-return 11773@opindex maix-struct-return 11774Return all structures in memory (as specified by the AIX ABI)@. 11775 11776@item -msvr4-struct-return 11777@opindex msvr4-struct-return 11778Return structures smaller than 8 bytes in registers (as specified by the 11779SVR4 ABI)@. 11780 11781@item -mabi=@var{abi-type} 11782@opindex mabi 11783Extend the current ABI with a particular extension, or remove such extension. 11784Valid values are @var{altivec}, @var{no-altivec}, @var{spe}, 11785@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@. 11786 11787@item -mabi=spe 11788@opindex mabi=spe 11789Extend the current ABI with SPE ABI extensions. This does not change 11790the default ABI, instead it adds the SPE ABI extensions to the current 11791ABI@. 11792 11793@item -mabi=no-spe 11794@opindex mabi=no-spe 11795Disable Booke SPE ABI extensions for the current ABI@. 11796 11797@item -mabi=ibmlongdouble 11798@opindex mabi=ibmlongdouble 11799Change the current ABI to use IBM extended precision long double. 11800This is a PowerPC 32-bit SYSV ABI option. 11801 11802@item -mabi=ieeelongdouble 11803@opindex mabi=ieeelongdouble 11804Change the current ABI to use IEEE extended precision long double. 11805This is a PowerPC 32-bit Linux ABI option. 11806 11807@item -mprototype 11808@itemx -mno-prototype 11809@opindex mprototype 11810@opindex mno-prototype 11811On System V.4 and embedded PowerPC systems assume that all calls to 11812variable argument functions are properly prototyped. Otherwise, the 11813compiler must insert an instruction before every non prototyped call to 11814set or clear bit 6 of the condition code register (@var{CR}) to 11815indicate whether floating point values were passed in the floating point 11816registers in case the function takes a variable arguments. With 11817@option{-mprototype}, only calls to prototyped variable argument functions 11818will set or clear the bit. 11819 11820@item -msim 11821@opindex msim 11822On embedded PowerPC systems, assume that the startup module is called 11823@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 11824@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}. 11825configurations. 11826 11827@item -mmvme 11828@opindex mmvme 11829On embedded PowerPC systems, assume that the startup module is called 11830@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 11831@file{libc.a}. 11832 11833@item -mads 11834@opindex mads 11835On embedded PowerPC systems, assume that the startup module is called 11836@file{crt0.o} and the standard C libraries are @file{libads.a} and 11837@file{libc.a}. 11838 11839@item -myellowknife 11840@opindex myellowknife 11841On embedded PowerPC systems, assume that the startup module is called 11842@file{crt0.o} and the standard C libraries are @file{libyk.a} and 11843@file{libc.a}. 11844 11845@item -mvxworks 11846@opindex mvxworks 11847On System V.4 and embedded PowerPC systems, specify that you are 11848compiling for a VxWorks system. 11849 11850@item -mwindiss 11851@opindex mwindiss 11852Specify that you are compiling for the WindISS simulation environment. 11853 11854@item -memb 11855@opindex memb 11856On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags 11857header to indicate that @samp{eabi} extended relocations are used. 11858 11859@item -meabi 11860@itemx -mno-eabi 11861@opindex meabi 11862@opindex mno-eabi 11863On System V.4 and embedded PowerPC systems do (do not) adhere to the 11864Embedded Applications Binary Interface (eabi) which is a set of 11865modifications to the System V.4 specifications. Selecting @option{-meabi} 11866means that the stack is aligned to an 8 byte boundary, a function 11867@code{__eabi} is called to from @code{main} to set up the eabi 11868environment, and the @option{-msdata} option can use both @code{r2} and 11869@code{r13} to point to two separate small data areas. Selecting 11870@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary, 11871do not call an initialization function from @code{main}, and the 11872@option{-msdata} option will only use @code{r13} to point to a single 11873small data area. The @option{-meabi} option is on by default if you 11874configured GCC using one of the @samp{powerpc*-*-eabi*} options. 11875 11876@item -msdata=eabi 11877@opindex msdata=eabi 11878On System V.4 and embedded PowerPC systems, put small initialized 11879@code{const} global and static data in the @samp{.sdata2} section, which 11880is pointed to by register @code{r2}. Put small initialized 11881non-@code{const} global and static data in the @samp{.sdata} section, 11882which is pointed to by register @code{r13}. Put small uninitialized 11883global and static data in the @samp{.sbss} section, which is adjacent to 11884the @samp{.sdata} section. The @option{-msdata=eabi} option is 11885incompatible with the @option{-mrelocatable} option. The 11886@option{-msdata=eabi} option also sets the @option{-memb} option. 11887 11888@item -msdata=sysv 11889@opindex msdata=sysv 11890On System V.4 and embedded PowerPC systems, put small global and static 11891data in the @samp{.sdata} section, which is pointed to by register 11892@code{r13}. Put small uninitialized global and static data in the 11893@samp{.sbss} section, which is adjacent to the @samp{.sdata} section. 11894The @option{-msdata=sysv} option is incompatible with the 11895@option{-mrelocatable} option. 11896 11897@item -msdata=default 11898@itemx -msdata 11899@opindex msdata=default 11900@opindex msdata 11901On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 11902compile code the same as @option{-msdata=eabi}, otherwise compile code the 11903same as @option{-msdata=sysv}. 11904 11905@item -msdata-data 11906@opindex msdata-data 11907On System V.4 and embedded PowerPC systems, put small global 11908data in the @samp{.sdata} section. Put small uninitialized global 11909data in the @samp{.sbss} section. Do not use register @code{r13} 11910to address small data however. This is the default behavior unless 11911other @option{-msdata} options are used. 11912 11913@item -msdata=none 11914@itemx -mno-sdata 11915@opindex msdata=none 11916@opindex mno-sdata 11917On embedded PowerPC systems, put all initialized global and static data 11918in the @samp{.data} section, and all uninitialized data in the 11919@samp{.bss} section. 11920 11921@item -G @var{num} 11922@opindex G 11923@cindex smaller data references (PowerPC) 11924@cindex .sdata/.sdata2 references (PowerPC) 11925On embedded PowerPC systems, put global and static items less than or 11926equal to @var{num} bytes into the small data or bss sections instead of 11927the normal data or bss section. By default, @var{num} is 8. The 11928@option{-G @var{num}} switch is also passed to the linker. 11929All modules should be compiled with the same @option{-G @var{num}} value. 11930 11931@item -mregnames 11932@itemx -mno-regnames 11933@opindex mregnames 11934@opindex mno-regnames 11935On System V.4 and embedded PowerPC systems do (do not) emit register 11936names in the assembly language output using symbolic forms. 11937 11938@item -mlongcall 11939@itemx -mno-longcall 11940@opindex mlongcall 11941@opindex mno-longcall 11942By default assume that all calls are far away so that a longer more 11943expensive calling sequence is required. This is required for calls 11944further than 32 megabytes (33,554,432 bytes) from the current location. 11945A short call will be generated if the compiler knows 11946the call cannot be that far away. This setting can be overridden by 11947the @code{shortcall} function attribute, or by @code{#pragma 11948longcall(0)}. 11949 11950Some linkers are capable of detecting out-of-range calls and generating 11951glue code on the fly. On these systems, long calls are unnecessary and 11952generate slower code. As of this writing, the AIX linker can do this, 11953as can the GNU linker for PowerPC/64. It is planned to add this feature 11954to the GNU linker for 32-bit PowerPC systems as well. 11955 11956On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr 11957callee, L42'', plus a ``branch island'' (glue code). The two target 11958addresses represent the callee and the ``branch island''. The 11959Darwin/PPC linker will prefer the first address and generate a ``bl 11960callee'' if the PPC ``bl'' instruction will reach the callee directly; 11961otherwise, the linker will generate ``bl L42'' to call the ``branch 11962island''. The ``branch island'' is appended to the body of the 11963calling function; it computes the full 32-bit address of the callee 11964and jumps to it. 11965 11966On Mach-O (Darwin) systems, this option directs the compiler emit to 11967the glue for every direct call, and the Darwin linker decides whether 11968to use or discard it. 11969 11970In the future, we may cause GCC to ignore all longcall specifications 11971when the linker is known to generate glue. 11972 11973@item -pthread 11974@opindex pthread 11975Adds support for multithreading with the @dfn{pthreads} library. 11976This option sets flags for both the preprocessor and linker. 11977 11978@end table 11979 11980@node S/390 and zSeries Options 11981@subsection S/390 and zSeries Options 11982@cindex S/390 and zSeries Options 11983 11984These are the @samp{-m} options defined for the S/390 and zSeries architecture. 11985 11986@table @gcctabopt 11987@item -mhard-float 11988@itemx -msoft-float 11989@opindex mhard-float 11990@opindex msoft-float 11991Use (do not use) the hardware floating-point instructions and registers 11992for floating-point operations. When @option{-msoft-float} is specified, 11993functions in @file{libgcc.a} will be used to perform floating-point 11994operations. When @option{-mhard-float} is specified, the compiler 11995generates IEEE floating-point instructions. This is the default. 11996 11997@item -mlong-double-64 11998@itemx -mlong-double-128 11999@opindex mlong-double-64 12000@opindex mlong-double-128 12001These switches control the size of @code{long double} type. A size 12002of 64bit makes the @code{long double} type equivalent to the @code{double} 12003type. This is the default. 12004 12005@item -mbackchain 12006@itemx -mno-backchain 12007@opindex mbackchain 12008@opindex mno-backchain 12009Store (do not store) the address of the caller's frame as backchain pointer 12010into the callee's stack frame. 12011A backchain may be needed to allow debugging using tools that do not understand 12012DWARF-2 call frame information. 12013When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 12014at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 12015the backchain is placed into the topmost word of the 96/160 byte register 12016save area. 12017 12018In general, code compiled with @option{-mbackchain} is call-compatible with 12019code compiled with @option{-mmo-backchain}; however, use of the backchain 12020for debugging purposes usually requires that the whole binary is built with 12021@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 12022@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 12023to build a linux kernel use @option{-msoft-float}. 12024 12025The default is to not maintain the backchain. 12026 12027@item -mpacked-stack 12028@item -mno-packed-stack 12029@opindex mpacked-stack 12030@opindex mno-packed-stack 12031Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 12032specified, the compiler uses the all fields of the 96/160 byte register save 12033area only for their default purpose; unused fields still take up stack space. 12034When @option{-mpacked-stack} is specified, register save slots are densely 12035packed at the top of the register save area; unused space is reused for other 12036purposes, allowing for more efficient use of the available stack space. 12037However, when @option{-mbackchain} is also in effect, the topmost word of 12038the save area is always used to store the backchain, and the return address 12039register is always saved two words below the backchain. 12040 12041As long as the stack frame backchain is not used, code generated with 12042@option{-mpacked-stack} is call-compatible with code generated with 12043@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 12044S/390 or zSeries generated code that uses the stack frame backchain at run 12045time, not just for debugging purposes. Such code is not call-compatible 12046with code compiled with @option{-mpacked-stack}. Also, note that the 12047combination of @option{-mbackchain}, 12048@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 12049to build a linux kernel use @option{-msoft-float}. 12050 12051The default is to not use the packed stack layout. 12052 12053@item -msmall-exec 12054@itemx -mno-small-exec 12055@opindex msmall-exec 12056@opindex mno-small-exec 12057Generate (or do not generate) code using the @code{bras} instruction 12058to do subroutine calls. 12059This only works reliably if the total executable size does not 12060exceed 64k. The default is to use the @code{basr} instruction instead, 12061which does not have this limitation. 12062 12063@item -m64 12064@itemx -m31 12065@opindex m64 12066@opindex m31 12067When @option{-m31} is specified, generate code compliant to the 12068GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 12069code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 12070particular to generate 64-bit instructions. For the @samp{s390} 12071targets, the default is @option{-m31}, while the @samp{s390x} 12072targets default to @option{-m64}. 12073 12074@item -mzarch 12075@itemx -mesa 12076@opindex mzarch 12077@opindex mesa 12078When @option{-mzarch} is specified, generate code using the 12079instructions available on z/Architecture. 12080When @option{-mesa} is specified, generate code using the 12081instructions available on ESA/390. Note that @option{-mesa} is 12082not possible with @option{-m64}. 12083When generating code compliant to the GNU/Linux for S/390 ABI, 12084the default is @option{-mesa}. When generating code compliant 12085to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 12086 12087@item -mmvcle 12088@itemx -mno-mvcle 12089@opindex mmvcle 12090@opindex mno-mvcle 12091Generate (or do not generate) code using the @code{mvcle} instruction 12092to perform block moves. When @option{-mno-mvcle} is specified, 12093use a @code{mvc} loop instead. This is the default unless optimizing for 12094size. 12095 12096@item -mdebug 12097@itemx -mno-debug 12098@opindex mdebug 12099@opindex mno-debug 12100Print (or do not print) additional debug information when compiling. 12101The default is to not print debug information. 12102 12103@item -march=@var{cpu-type} 12104@opindex march 12105Generate code that will run on @var{cpu-type}, which is the name of a system 12106representing a certain processor type. Possible values for 12107@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}. 12108When generating code using the instructions available on z/Architecture, 12109the default is @option{-march=z900}. Otherwise, the default is 12110@option{-march=g5}. 12111 12112@item -mtune=@var{cpu-type} 12113@opindex mtune 12114Tune to @var{cpu-type} everything applicable about the generated code, 12115except for the ABI and the set of available instructions. 12116The list of @var{cpu-type} values is the same as for @option{-march}. 12117The default is the value used for @option{-march}. 12118 12119@item -mtpf-trace 12120@itemx -mno-tpf-trace 12121@opindex mtpf-trace 12122@opindex mno-tpf-trace 12123Generate code that adds (does not add) in TPF OS specific branches to trace 12124routines in the operating system. This option is off by default, even 12125when compiling for the TPF OS@. 12126 12127@item -mfused-madd 12128@itemx -mno-fused-madd 12129@opindex mfused-madd 12130@opindex mno-fused-madd 12131Generate code that uses (does not use) the floating point multiply and 12132accumulate instructions. These instructions are generated by default if 12133hardware floating point is used. 12134 12135@item -mwarn-framesize=@var{framesize} 12136@opindex mwarn-framesize 12137Emit a warning if the current function exceeds the given frame size. Because 12138this is a compile time check it doesn't need to be a real problem when the program 12139runs. It is intended to identify functions which most probably cause 12140a stack overflow. It is useful to be used in an environment with limited stack 12141size e.g.@: the linux kernel. 12142 12143@item -mwarn-dynamicstack 12144@opindex mwarn-dynamicstack 12145Emit a warning if the function calls alloca or uses dynamically 12146sized arrays. This is generally a bad idea with a limited stack size. 12147 12148@item -mstack-guard=@var{stack-guard} 12149@item -mstack-size=@var{stack-size} 12150@opindex mstack-guard 12151@opindex mstack-size 12152These arguments always have to be used in conjunction. If they are present the s390 12153back end emits additional instructions in the function prologue which trigger a trap 12154if the stack size is @var{stack-guard} bytes above the @var{stack-size} 12155(remember that the stack on s390 grows downward). These options are intended to 12156be used to help debugging stack overflow problems. The additionally emitted code 12157causes only little overhead and hence can also be used in production like systems 12158without greater performance degradation. The given values have to be exact 12159powers of 2 and @var{stack-size} has to be greater than @var{stack-guard} without 12160exceeding 64k. 12161In order to be efficient the extra code makes the assumption that the stack starts 12162at an address aligned to the value given by @var{stack-size}. 12163@end table 12164 12165@node Score Options 12166@subsection Score Options 12167@cindex Score Options 12168 12169These options are defined for Score implementations: 12170 12171@table @gcctabopt 12172@item -meb 12173@opindex meb 12174Compile code for big endian mode. This is the default. 12175 12176@item -mel 12177@opindex mel 12178Compile code for little endian mode. 12179 12180@item -mnhwloop 12181@opindex mnhwloop 12182Disable generate bcnz instruction. 12183 12184@item -muls 12185@opindex muls 12186Enable generate unaligned load and store instruction. 12187 12188@item -mmac 12189@opindex mmac 12190Enable the use of multiply-accumulate instructions. Disabled by default. 12191 12192@item -mscore5 12193@opindex mscore5 12194Specify the SCORE5 as the target architecture. 12195 12196@item -mscore5u 12197@opindex mscore5u 12198Specify the SCORE5U of the target architecture. 12199 12200@item -mscore7 12201@opindex mscore7 12202Specify the SCORE7 as the target architecture. This is the default. 12203 12204@item -mscore7d 12205@opindex mscore7d 12206Specify the SCORE7D as the target architecture. 12207@end table 12208 12209@node SH Options 12210@subsection SH Options 12211 12212These @samp{-m} options are defined for the SH implementations: 12213 12214@table @gcctabopt 12215@item -m1 12216@opindex m1 12217Generate code for the SH1. 12218 12219@item -m2 12220@opindex m2 12221Generate code for the SH2. 12222 12223@item -m2e 12224Generate code for the SH2e. 12225 12226@item -m3 12227@opindex m3 12228Generate code for the SH3. 12229 12230@item -m3e 12231@opindex m3e 12232Generate code for the SH3e. 12233 12234@item -m4-nofpu 12235@opindex m4-nofpu 12236Generate code for the SH4 without a floating-point unit. 12237 12238@item -m4-single-only 12239@opindex m4-single-only 12240Generate code for the SH4 with a floating-point unit that only 12241supports single-precision arithmetic. 12242 12243@item -m4-single 12244@opindex m4-single 12245Generate code for the SH4 assuming the floating-point unit is in 12246single-precision mode by default. 12247 12248@item -m4 12249@opindex m4 12250Generate code for the SH4. 12251 12252@item -m4a-nofpu 12253@opindex m4a-nofpu 12254Generate code for the SH4al-dsp, or for a SH4a in such a way that the 12255floating-point unit is not used. 12256 12257@item -m4a-single-only 12258@opindex m4a-single-only 12259Generate code for the SH4a, in such a way that no double-precision 12260floating point operations are used. 12261 12262@item -m4a-single 12263@opindex m4a-single 12264Generate code for the SH4a assuming the floating-point unit is in 12265single-precision mode by default. 12266 12267@item -m4a 12268@opindex m4a 12269Generate code for the SH4a. 12270 12271@item -m4al 12272@opindex m4al 12273Same as @option{-m4a-nofpu}, except that it implicitly passes 12274@option{-dsp} to the assembler. GCC doesn't generate any DSP 12275instructions at the moment. 12276 12277@item -mb 12278@opindex mb 12279Compile code for the processor in big endian mode. 12280 12281@item -ml 12282@opindex ml 12283Compile code for the processor in little endian mode. 12284 12285@item -mdalign 12286@opindex mdalign 12287Align doubles at 64-bit boundaries. Note that this changes the calling 12288conventions, and thus some functions from the standard C library will 12289not work unless you recompile it first with @option{-mdalign}. 12290 12291@item -mrelax 12292@opindex mrelax 12293Shorten some address references at link time, when possible; uses the 12294linker option @option{-relax}. 12295 12296@item -mbigtable 12297@opindex mbigtable 12298Use 32-bit offsets in @code{switch} tables. The default is to use 1229916-bit offsets. 12300 12301@item -mfmovd 12302@opindex mfmovd 12303Enable the use of the instruction @code{fmovd}. 12304 12305@item -mhitachi 12306@opindex mhitachi 12307Comply with the calling conventions defined by Renesas. 12308 12309@item -mrenesas 12310@opindex mhitachi 12311Comply with the calling conventions defined by Renesas. 12312 12313@item -mno-renesas 12314@opindex mhitachi 12315Comply with the calling conventions defined for GCC before the Renesas 12316conventions were available. This option is the default for all 12317targets of the SH toolchain except for @samp{sh-symbianelf}. 12318 12319@item -mnomacsave 12320@opindex mnomacsave 12321Mark the @code{MAC} register as call-clobbered, even if 12322@option{-mhitachi} is given. 12323 12324@item -mieee 12325@opindex mieee 12326Increase IEEE-compliance of floating-point code. 12327At the moment, this is equivalent to @option{-fno-finite-math-only}. 12328When generating 16 bit SH opcodes, getting IEEE-conforming results for 12329comparisons of NANs / infinities incurs extra overhead in every 12330floating point comparison, therefore the default is set to 12331@option{-ffinite-math-only}. 12332 12333@item -misize 12334@opindex misize 12335Dump instruction size and location in the assembly code. 12336 12337@item -mpadstruct 12338@opindex mpadstruct 12339This option is deprecated. It pads structures to multiple of 4 bytes, 12340which is incompatible with the SH ABI@. 12341 12342@item -mspace 12343@opindex mspace 12344Optimize for space instead of speed. Implied by @option{-Os}. 12345 12346@item -mprefergot 12347@opindex mprefergot 12348When generating position-independent code, emit function calls using 12349the Global Offset Table instead of the Procedure Linkage Table. 12350 12351@item -musermode 12352@opindex musermode 12353Generate a library function call to invalidate instruction cache 12354entries, after fixing up a trampoline. This library function call 12355doesn't assume it can write to the whole memory address space. This 12356is the default when the target is @code{sh-*-linux*}. 12357 12358@item -multcost=@var{number} 12359@opindex multcost=@var{number} 12360Set the cost to assume for a multiply insn. 12361 12362@item -mdiv=@var{strategy} 12363@opindex mdiv=@var{strategy} 12364Set the division strategy to use for SHmedia code. @var{strategy} must be 12365one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call, 12366inv:call2, inv:fp . 12367"fp" performs the operation in floating point. This has a very high latency, 12368but needs only a few instructions, so it might be a good choice if 12369your code has enough easily exploitable ILP to allow the compiler to 12370schedule the floating point instructions together with other instructions. 12371Division by zero causes a floating point exception. 12372"inv" uses integer operations to calculate the inverse of the divisor, 12373and then multiplies the dividend with the inverse. This strategy allows 12374cse and hoisting of the inverse calculation. Division by zero calculates 12375an unspecified result, but does not trap. 12376"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities 12377have been found, or if the entire operation has been hoisted to the same 12378place, the last stages of the inverse calculation are intertwined with the 12379final multiply to reduce the overall latency, at the expense of using a few 12380more instructions, and thus offering fewer scheduling opportunities with 12381other code. 12382"call" calls a library function that usually implements the inv:minlat 12383strategy. 12384This gives high code density for m5-*media-nofpu compilations. 12385"call2" uses a different entry point of the same library function, where it 12386assumes that a pointer to a lookup table has already been set up, which 12387exposes the pointer load to cse / code hoisting optimizations. 12388"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial 12389code generation, but if the code stays unoptimized, revert to the "call", 12390"call2", or "fp" strategies, respectively. Note that the 12391potentially-trapping side effect of division by zero is carried by a 12392separate instruction, so it is possible that all the integer instructions 12393are hoisted out, but the marker for the side effect stays where it is. 12394A recombination to fp operations or a call is not possible in that case. 12395"inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case 12396that the inverse calculation was nor separated from the multiply, they speed 12397up division where the dividend fits into 20 bits (plus sign where applicable), 12398by inserting a test to skip a number of operations in this case; this test 12399slows down the case of larger dividends. inv20u assumes the case of a such 12400a small dividend to be unlikely, and inv20l assumes it to be likely. 12401 12402@item -mdivsi3_libfunc=@var{name} 12403@opindex mdivsi3_libfunc=@var{name} 12404Set the name of the library function used for 32 bit signed division to 12405@var{name}. This only affect the name used in the call and inv:call 12406division strategies, and the compiler will still expect the same 12407sets of input/output/clobbered registers as if this option was not present. 12408 12409@item -madjust-unroll 12410@opindex madjust-unroll 12411Throttle unrolling to avoid thrashing target registers. 12412This option only has an effect if the gcc code base supports the 12413TARGET_ADJUST_UNROLL_MAX target hook. 12414 12415@item -mindexed-addressing 12416@opindex mindexed-addressing 12417Enable the use of the indexed addressing mode for SHmedia32/SHcompact. 12418This is only safe if the hardware and/or OS implement 32 bit wrap-around 12419semantics for the indexed addressing mode. The architecture allows the 12420implementation of processors with 64 bit MMU, which the OS could use to 12421get 32 bit addressing, but since no current hardware implementation supports 12422this or any other way to make the indexed addressing mode safe to use in 12423the 32 bit ABI, the default is -mno-indexed-addressing. 12424 12425@item -mgettrcost=@var{number} 12426@opindex mgettrcost=@var{number} 12427Set the cost assumed for the gettr instruction to @var{number}. 12428The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise. 12429 12430@item -mpt-fixed 12431@opindex mpt-fixed 12432Assume pt* instructions won't trap. This will generally generate better 12433scheduled code, but is unsafe on current hardware. The current architecture 12434definition says that ptabs and ptrel trap when the target anded with 3 is 3. 12435This has the unintentional effect of making it unsafe to schedule ptabs / 12436ptrel before a branch, or hoist it out of a loop. For example, 12437__do_global_ctors, a part of libgcc that runs constructors at program 12438startup, calls functions in a list which is delimited by -1. With the 12439-mpt-fixed option, the ptabs will be done before testing against -1. 12440That means that all the constructors will be run a bit quicker, but when 12441the loop comes to the end of the list, the program crashes because ptabs 12442loads -1 into a target register. Since this option is unsafe for any 12443hardware implementing the current architecture specification, the default 12444is -mno-pt-fixed. Unless the user specifies a specific cost with 12445@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100}; 12446this deters register allocation using target registers for storing 12447ordinary integers. 12448 12449@item -minvalid-symbols 12450@opindex minvalid-symbols 12451Assume symbols might be invalid. Ordinary function symbols generated by 12452the compiler will always be valid to load with movi/shori/ptabs or 12453movi/shori/ptrel, but with assembler and/or linker tricks it is possible 12454to generate symbols that will cause ptabs / ptrel to trap. 12455This option is only meaningful when @option{-mno-pt-fixed} is in effect. 12456It will then prevent cross-basic-block cse, hoisting and most scheduling 12457of symbol loads. The default is @option{-mno-invalid-symbols}. 12458@end table 12459 12460@node SPARC Options 12461@subsection SPARC Options 12462@cindex SPARC options 12463 12464These @samp{-m} options are supported on the SPARC: 12465 12466@table @gcctabopt 12467@item -mno-app-regs 12468@itemx -mapp-regs 12469@opindex mno-app-regs 12470@opindex mapp-regs 12471Specify @option{-mapp-regs} to generate output using the global registers 124722 through 4, which the SPARC SVR4 ABI reserves for applications. This 12473is the default. 12474 12475To be fully SVR4 ABI compliant at the cost of some performance loss, 12476specify @option{-mno-app-regs}. You should compile libraries and system 12477software with this option. 12478 12479@item -mfpu 12480@itemx -mhard-float 12481@opindex mfpu 12482@opindex mhard-float 12483Generate output containing floating point instructions. This is the 12484default. 12485 12486@item -mno-fpu 12487@itemx -msoft-float 12488@opindex mno-fpu 12489@opindex msoft-float 12490Generate output containing library calls for floating point. 12491@strong{Warning:} the requisite libraries are not available for all SPARC 12492targets. Normally the facilities of the machine's usual C compiler are 12493used, but this cannot be done directly in cross-compilation. You must make 12494your own arrangements to provide suitable library functions for 12495cross-compilation. The embedded targets @samp{sparc-*-aout} and 12496@samp{sparclite-*-*} do provide software floating point support. 12497 12498@option{-msoft-float} changes the calling convention in the output file; 12499therefore, it is only useful if you compile @emph{all} of a program with 12500this option. In particular, you need to compile @file{libgcc.a}, the 12501library that comes with GCC, with @option{-msoft-float} in order for 12502this to work. 12503 12504@item -mhard-quad-float 12505@opindex mhard-quad-float 12506Generate output containing quad-word (long double) floating point 12507instructions. 12508 12509@item -msoft-quad-float 12510@opindex msoft-quad-float 12511Generate output containing library calls for quad-word (long double) 12512floating point instructions. The functions called are those specified 12513in the SPARC ABI@. This is the default. 12514 12515As of this writing, there are no SPARC implementations that have hardware 12516support for the quad-word floating point instructions. They all invoke 12517a trap handler for one of these instructions, and then the trap handler 12518emulates the effect of the instruction. Because of the trap handler overhead, 12519this is much slower than calling the ABI library routines. Thus the 12520@option{-msoft-quad-float} option is the default. 12521 12522@item -mno-unaligned-doubles 12523@itemx -munaligned-doubles 12524@opindex mno-unaligned-doubles 12525@opindex munaligned-doubles 12526Assume that doubles have 8 byte alignment. This is the default. 12527 12528With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte 12529alignment only if they are contained in another type, or if they have an 12530absolute address. Otherwise, it assumes they have 4 byte alignment. 12531Specifying this option avoids some rare compatibility problems with code 12532generated by other compilers. It is not the default because it results 12533in a performance loss, especially for floating point code. 12534 12535@item -mno-faster-structs 12536@itemx -mfaster-structs 12537@opindex mno-faster-structs 12538@opindex mfaster-structs 12539With @option{-mfaster-structs}, the compiler assumes that structures 12540should have 8 byte alignment. This enables the use of pairs of 12541@code{ldd} and @code{std} instructions for copies in structure 12542assignment, in place of twice as many @code{ld} and @code{st} pairs. 12543However, the use of this changed alignment directly violates the SPARC 12544ABI@. Thus, it's intended only for use on targets where the developer 12545acknowledges that their resulting code will not be directly in line with 12546the rules of the ABI@. 12547 12548@item -mimpure-text 12549@opindex mimpure-text 12550@option{-mimpure-text}, used in addition to @option{-shared}, tells 12551the compiler to not pass @option{-z text} to the linker when linking a 12552shared object. Using this option, you can link position-dependent 12553code into a shared object. 12554 12555@option{-mimpure-text} suppresses the ``relocations remain against 12556allocatable but non-writable sections'' linker error message. 12557However, the necessary relocations will trigger copy-on-write, and the 12558shared object is not actually shared across processes. Instead of 12559using @option{-mimpure-text}, you should compile all source code with 12560@option{-fpic} or @option{-fPIC}. 12561 12562This option is only available on SunOS and Solaris. 12563 12564@item -mcpu=@var{cpu_type} 12565@opindex mcpu 12566Set the instruction set, register set, and instruction scheduling parameters 12567for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 12568@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite}, 12569@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x}, 12570@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, 12571@samp{ultrasparc3}, and @samp{niagara}. 12572 12573Default instruction scheduling parameters are used for values that select 12574an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 12575@samp{sparclite}, @samp{sparclet}, @samp{v9}. 12576 12577Here is a list of each supported architecture and their supported 12578implementations. 12579 12580@smallexample 12581 v7: cypress 12582 v8: supersparc, hypersparc 12583 sparclite: f930, f934, sparclite86x 12584 sparclet: tsc701 12585 v9: ultrasparc, ultrasparc3, niagara 12586@end smallexample 12587 12588By default (unless configured otherwise), GCC generates code for the V7 12589variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 12590additionally optimizes it for the Cypress CY7C602 chip, as used in the 12591SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 12592SPARCStation 1, 2, IPX etc. 12593 12594With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 12595architecture. The only difference from V7 code is that the compiler emits 12596the integer multiply and integer divide instructions which exist in SPARC-V8 12597but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 12598optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 125992000 series. 12600 12601With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 12602the SPARC architecture. This adds the integer multiply, integer divide step 12603and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 12604With @option{-mcpu=f930}, the compiler additionally optimizes it for the 12605Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 12606@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 12607MB86934 chip, which is the more recent SPARClite with FPU@. 12608 12609With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 12610the SPARC architecture. This adds the integer multiply, multiply/accumulate, 12611integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 12612but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 12613optimizes it for the TEMIC SPARClet chip. 12614 12615With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 12616architecture. This adds 64-bit integer and floating-point move instructions, 126173 additional floating-point condition code registers and conditional move 12618instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 12619optimizes it for the Sun UltraSPARC I/II/IIi chips. With 12620@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 12621Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 12622@option{-mcpu=niagara}, the compiler additionally optimizes it for 12623Sun UltraSPARC T1 chips. 12624 12625@item -mtune=@var{cpu_type} 12626@opindex mtune 12627Set the instruction scheduling parameters for machine type 12628@var{cpu_type}, but do not set the instruction set or register set that the 12629option @option{-mcpu=@var{cpu_type}} would. 12630 12631The same values for @option{-mcpu=@var{cpu_type}} can be used for 12632@option{-mtune=@var{cpu_type}}, but the only useful values are those 12633that select a particular cpu implementation. Those are @samp{cypress}, 12634@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934}, 12635@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, 12636@samp{ultrasparc3}, and @samp{niagara}. 12637 12638@item -mv8plus 12639@itemx -mno-v8plus 12640@opindex mv8plus 12641@opindex mno-v8plus 12642With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 12643difference from the V8 ABI is that the global and out registers are 12644considered 64-bit wide. This is enabled by default on Solaris in 32-bit 12645mode for all SPARC-V9 processors. 12646 12647@item -mvis 12648@itemx -mno-vis 12649@opindex mvis 12650@opindex mno-vis 12651With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 12652Visual Instruction Set extensions. The default is @option{-mno-vis}. 12653@end table 12654 12655These @samp{-m} options are supported in addition to the above 12656on SPARC-V9 processors in 64-bit environments: 12657 12658@table @gcctabopt 12659@item -mlittle-endian 12660@opindex mlittle-endian 12661Generate code for a processor running in little-endian mode. It is only 12662available for a few configurations and most notably not on Solaris and Linux. 12663 12664@item -m32 12665@itemx -m64 12666@opindex m32 12667@opindex m64 12668Generate code for a 32-bit or 64-bit environment. 12669The 32-bit environment sets int, long and pointer to 32 bits. 12670The 64-bit environment sets int to 32 bits and long and pointer 12671to 64 bits. 12672 12673@item -mcmodel=medlow 12674@opindex mcmodel=medlow 12675Generate code for the Medium/Low code model: 64-bit addresses, programs 12676must be linked in the low 32 bits of memory. Programs can be statically 12677or dynamically linked. 12678 12679@item -mcmodel=medmid 12680@opindex mcmodel=medmid 12681Generate code for the Medium/Middle code model: 64-bit addresses, programs 12682must be linked in the low 44 bits of memory, the text and data segments must 12683be less than 2GB in size and the data segment must be located within 2GB of 12684the text segment. 12685 12686@item -mcmodel=medany 12687@opindex mcmodel=medany 12688Generate code for the Medium/Anywhere code model: 64-bit addresses, programs 12689may be linked anywhere in memory, the text and data segments must be less 12690than 2GB in size and the data segment must be located within 2GB of the 12691text segment. 12692 12693@item -mcmodel=embmedany 12694@opindex mcmodel=embmedany 12695Generate code for the Medium/Anywhere code model for embedded systems: 1269664-bit addresses, the text and data segments must be less than 2GB in 12697size, both starting anywhere in memory (determined at link time). The 12698global register %g4 points to the base of the data segment. Programs 12699are statically linked and PIC is not supported. 12700 12701@item -mstack-bias 12702@itemx -mno-stack-bias 12703@opindex mstack-bias 12704@opindex mno-stack-bias 12705With @option{-mstack-bias}, GCC assumes that the stack pointer, and 12706frame pointer if present, are offset by @minus{}2047 which must be added back 12707when making stack frame references. This is the default in 64-bit mode. 12708Otherwise, assume no such offset is present. 12709@end table 12710 12711These switches are supported in addition to the above on Solaris: 12712 12713@table @gcctabopt 12714@item -threads 12715@opindex threads 12716Add support for multithreading using the Solaris threads library. This 12717option sets flags for both the preprocessor and linker. This option does 12718not affect the thread safety of object code produced by the compiler or 12719that of libraries supplied with it. 12720 12721@item -pthreads 12722@opindex pthreads 12723Add support for multithreading using the POSIX threads library. This 12724option sets flags for both the preprocessor and linker. This option does 12725not affect the thread safety of object code produced by the compiler or 12726that of libraries supplied with it. 12727 12728@item -pthread 12729@opindex pthread 12730This is a synonym for @option{-pthreads}. 12731@end table 12732 12733@node System V Options 12734@subsection Options for System V 12735 12736These additional options are available on System V Release 4 for 12737compatibility with other compilers on those systems: 12738 12739@table @gcctabopt 12740@item -G 12741@opindex G 12742Create a shared object. 12743It is recommended that @option{-symbolic} or @option{-shared} be used instead. 12744 12745@item -Qy 12746@opindex Qy 12747Identify the versions of each tool used by the compiler, in a 12748@code{.ident} assembler directive in the output. 12749 12750@item -Qn 12751@opindex Qn 12752Refrain from adding @code{.ident} directives to the output file (this is 12753the default). 12754 12755@item -YP,@var{dirs} 12756@opindex YP 12757Search the directories @var{dirs}, and no others, for libraries 12758specified with @option{-l}. 12759 12760@item -Ym,@var{dir} 12761@opindex Ym 12762Look in the directory @var{dir} to find the M4 preprocessor. 12763The assembler uses this option. 12764@c This is supposed to go with a -Yd for predefined M4 macro files, but 12765@c the generic assembler that comes with Solaris takes just -Ym. 12766@end table 12767 12768@node TMS320C3x/C4x Options 12769@subsection TMS320C3x/C4x Options 12770@cindex TMS320C3x/C4x Options 12771 12772These @samp{-m} options are defined for TMS320C3x/C4x implementations: 12773 12774@table @gcctabopt 12775 12776@item -mcpu=@var{cpu_type} 12777@opindex mcpu 12778Set the instruction set, register set, and instruction scheduling 12779parameters for machine type @var{cpu_type}. Supported values for 12780@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and 12781@samp{c44}. The default is @samp{c40} to generate code for the 12782TMS320C40. 12783 12784@item -mbig-memory 12785@itemx -mbig 12786@itemx -msmall-memory 12787@itemx -msmall 12788@opindex mbig-memory 12789@opindex mbig 12790@opindex msmall-memory 12791@opindex msmall 12792Generates code for the big or small memory model. The small memory 12793model assumed that all data fits into one 64K word page. At run-time 12794the data page (DP) register must be set to point to the 64K page 12795containing the .bss and .data program sections. The big memory model is 12796the default and requires reloading of the DP register for every direct 12797memory access. 12798 12799@item -mbk 12800@itemx -mno-bk 12801@opindex mbk 12802@opindex mno-bk 12803Allow (disallow) allocation of general integer operands into the block 12804count register BK@. 12805 12806@item -mdb 12807@itemx -mno-db 12808@opindex mdb 12809@opindex mno-db 12810Enable (disable) generation of code using decrement and branch, 12811DBcond(D), instructions. This is enabled by default for the C4x. To be 12812on the safe side, this is disabled for the C3x, since the maximum 12813iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than 12814@math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so 12815that it can utilize the decrement and branch instruction, but will give 12816up if there is more than one memory reference in the loop. Thus a loop 12817where the loop counter is decremented can generate slightly more 12818efficient code, in cases where the RPTB instruction cannot be utilized. 12819 12820@item -mdp-isr-reload 12821@itemx -mparanoid 12822@opindex mdp-isr-reload 12823@opindex mparanoid 12824Force the DP register to be saved on entry to an interrupt service 12825routine (ISR), reloaded to point to the data section, and restored on 12826exit from the ISR@. This should not be required unless someone has 12827violated the small memory model by modifying the DP register, say within 12828an object library. 12829 12830@item -mmpyi 12831@itemx -mno-mpyi 12832@opindex mmpyi 12833@opindex mno-mpyi 12834For the C3x use the 24-bit MPYI instruction for integer multiplies 12835instead of a library call to guarantee 32-bit results. Note that if one 12836of the operands is a constant, then the multiplication will be performed 12837using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x, 12838then squaring operations are performed inline instead of a library call. 12839 12840@item -mfast-fix 12841@itemx -mno-fast-fix 12842@opindex mfast-fix 12843@opindex mno-fast-fix 12844The C3x/C4x FIX instruction to convert a floating point value to an 12845integer value chooses the nearest integer less than or equal to the 12846floating point value rather than to the nearest integer. Thus if the 12847floating point number is negative, the result will be incorrectly 12848truncated an additional code is necessary to detect and correct this 12849case. This option can be used to disable generation of the additional 12850code required to correct the result. 12851 12852@item -mrptb 12853@itemx -mno-rptb 12854@opindex mrptb 12855@opindex mno-rptb 12856Enable (disable) generation of repeat block sequences using the RPTB 12857instruction for zero overhead looping. The RPTB construct is only used 12858for innermost loops that do not call functions or jump across the loop 12859boundaries. There is no advantage having nested RPTB loops due to the 12860overhead required to save and restore the RC, RS, and RE registers. 12861This is enabled by default with @option{-O2}. 12862 12863@item -mrpts=@var{count} 12864@itemx -mno-rpts 12865@opindex mrpts 12866@opindex mno-rpts 12867Enable (disable) the use of the single instruction repeat instruction 12868RPTS@. If a repeat block contains a single instruction, and the loop 12869count can be guaranteed to be less than the value @var{count}, GCC will 12870emit a RPTS instruction instead of a RPTB@. If no value is specified, 12871then a RPTS will be emitted even if the loop count cannot be determined 12872at compile time. Note that the repeated instruction following RPTS does 12873not have to be reloaded from memory each iteration, thus freeing up the 12874CPU buses for operands. However, since interrupts are blocked by this 12875instruction, it is disabled by default. 12876 12877@item -mloop-unsigned 12878@itemx -mno-loop-unsigned 12879@opindex mloop-unsigned 12880@opindex mno-loop-unsigned 12881The maximum iteration count when using RPTS and RPTB (and DB on the C40) 12882is @math{2^{31} + 1} since these instructions test if the iteration count is 12883negative to terminate the loop. If the iteration count is unsigned 12884there is a possibility than the @math{2^{31} + 1} maximum iteration count may be 12885exceeded. This switch allows an unsigned iteration count. 12886 12887@item -mti 12888@opindex mti 12889Try to emit an assembler syntax that the TI assembler (asm30) is happy 12890with. This also enforces compatibility with the API employed by the TI 12891C3x C compiler. For example, long doubles are passed as structures 12892rather than in floating point registers. 12893 12894@item -mregparm 12895@itemx -mmemparm 12896@opindex mregparm 12897@opindex mmemparm 12898Generate code that uses registers (stack) for passing arguments to functions. 12899By default, arguments are passed in registers where possible rather 12900than by pushing arguments on to the stack. 12901 12902@item -mparallel-insns 12903@itemx -mno-parallel-insns 12904@opindex mparallel-insns 12905@opindex mno-parallel-insns 12906Allow the generation of parallel instructions. This is enabled by 12907default with @option{-O2}. 12908 12909@item -mparallel-mpy 12910@itemx -mno-parallel-mpy 12911@opindex mparallel-mpy 12912@opindex mno-parallel-mpy 12913Allow the generation of MPY||ADD and MPY||SUB parallel instructions, 12914provided @option{-mparallel-insns} is also specified. These instructions have 12915tight register constraints which can pessimize the code generation 12916of large functions. 12917 12918@end table 12919 12920@node V850 Options 12921@subsection V850 Options 12922@cindex V850 Options 12923 12924These @samp{-m} options are defined for V850 implementations: 12925 12926@table @gcctabopt 12927@item -mlong-calls 12928@itemx -mno-long-calls 12929@opindex mlong-calls 12930@opindex mno-long-calls 12931Treat all calls as being far away (near). If calls are assumed to be 12932far away, the compiler will always load the functions address up into a 12933register, and call indirect through the pointer. 12934 12935@item -mno-ep 12936@itemx -mep 12937@opindex mno-ep 12938@opindex mep 12939Do not optimize (do optimize) basic blocks that use the same index 12940pointer 4 or more times to copy pointer into the @code{ep} register, and 12941use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 12942option is on by default if you optimize. 12943 12944@item -mno-prolog-function 12945@itemx -mprolog-function 12946@opindex mno-prolog-function 12947@opindex mprolog-function 12948Do not use (do use) external functions to save and restore registers 12949at the prologue and epilogue of a function. The external functions 12950are slower, but use less code space if more than one function saves 12951the same number of registers. The @option{-mprolog-function} option 12952is on by default if you optimize. 12953 12954@item -mspace 12955@opindex mspace 12956Try to make the code as small as possible. At present, this just turns 12957on the @option{-mep} and @option{-mprolog-function} options. 12958 12959@item -mtda=@var{n} 12960@opindex mtda 12961Put static or global variables whose size is @var{n} bytes or less into 12962the tiny data area that register @code{ep} points to. The tiny data 12963area can hold up to 256 bytes in total (128 bytes for byte references). 12964 12965@item -msda=@var{n} 12966@opindex msda 12967Put static or global variables whose size is @var{n} bytes or less into 12968the small data area that register @code{gp} points to. The small data 12969area can hold up to 64 kilobytes. 12970 12971@item -mzda=@var{n} 12972@opindex mzda 12973Put static or global variables whose size is @var{n} bytes or less into 12974the first 32 kilobytes of memory. 12975 12976@item -mv850 12977@opindex mv850 12978Specify that the target processor is the V850. 12979 12980@item -mbig-switch 12981@opindex mbig-switch 12982Generate code suitable for big switch tables. Use this option only if 12983the assembler/linker complain about out of range branches within a switch 12984table. 12985 12986@item -mapp-regs 12987@opindex mapp-regs 12988This option will cause r2 and r5 to be used in the code generated by 12989the compiler. This setting is the default. 12990 12991@item -mno-app-regs 12992@opindex mno-app-regs 12993This option will cause r2 and r5 to be treated as fixed registers. 12994 12995@item -mv850e1 12996@opindex mv850e1 12997Specify that the target processor is the V850E1. The preprocessor 12998constants @samp{__v850e1__} and @samp{__v850e__} will be defined if 12999this option is used. 13000 13001@item -mv850e 13002@opindex mv850e 13003Specify that the target processor is the V850E@. The preprocessor 13004constant @samp{__v850e__} will be defined if this option is used. 13005 13006If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 13007are defined then a default target processor will be chosen and the 13008relevant @samp{__v850*__} preprocessor constant will be defined. 13009 13010The preprocessor constants @samp{__v850} and @samp{__v851__} are always 13011defined, regardless of which processor variant is the target. 13012 13013@item -mdisable-callt 13014@opindex mdisable-callt 13015This option will suppress generation of the CALLT instruction for the 13016v850e and v850e1 flavors of the v850 architecture. The default is 13017@option{-mno-disable-callt} which allows the CALLT instruction to be used. 13018 13019@end table 13020 13021@node VAX Options 13022@subsection VAX Options 13023@cindex VAX options 13024 13025These @samp{-m} options are defined for the VAX: 13026 13027@table @gcctabopt 13028@item -munix 13029@opindex munix 13030Do not output certain jump instructions (@code{aobleq} and so on) 13031that the Unix assembler for the VAX cannot handle across long 13032ranges. 13033 13034@item -mgnu 13035@opindex mgnu 13036Do output those jump instructions, on the assumption that you 13037will assemble with the GNU assembler. 13038 13039@item -mg 13040@opindex mg 13041Output code for g-format floating point numbers instead of d-format. 13042@end table 13043 13044@node x86-64 Options 13045@subsection x86-64 Options 13046@cindex x86-64 options 13047 13048These are listed under @xref{i386 and x86-64 Options}. 13049 13050@node Xstormy16 Options 13051@subsection Xstormy16 Options 13052@cindex Xstormy16 Options 13053 13054These options are defined for Xstormy16: 13055 13056@table @gcctabopt 13057@item -msim 13058@opindex msim 13059Choose startup files and linker script suitable for the simulator. 13060@end table 13061 13062@node Xtensa Options 13063@subsection Xtensa Options 13064@cindex Xtensa Options 13065 13066These options are supported for Xtensa targets: 13067 13068@table @gcctabopt 13069@item -mconst16 13070@itemx -mno-const16 13071@opindex mconst16 13072@opindex mno-const16 13073Enable or disable use of @code{CONST16} instructions for loading 13074constant values. The @code{CONST16} instruction is currently not a 13075standard option from Tensilica. When enabled, @code{CONST16} 13076instructions are always used in place of the standard @code{L32R} 13077instructions. The use of @code{CONST16} is enabled by default only if 13078the @code{L32R} instruction is not available. 13079 13080@item -mfused-madd 13081@itemx -mno-fused-madd 13082@opindex mfused-madd 13083@opindex mno-fused-madd 13084Enable or disable use of fused multiply/add and multiply/subtract 13085instructions in the floating-point option. This has no effect if the 13086floating-point option is not also enabled. Disabling fused multiply/add 13087and multiply/subtract instructions forces the compiler to use separate 13088instructions for the multiply and add/subtract operations. This may be 13089desirable in some cases where strict IEEE 754-compliant results are 13090required: the fused multiply add/subtract instructions do not round the 13091intermediate result, thereby producing results with @emph{more} bits of 13092precision than specified by the IEEE standard. Disabling fused multiply 13093add/subtract instructions also ensures that the program output is not 13094sensitive to the compiler's ability to combine multiply and add/subtract 13095operations. 13096 13097@item -mtext-section-literals 13098@itemx -mno-text-section-literals 13099@opindex mtext-section-literals 13100@opindex mno-text-section-literals 13101Control the treatment of literal pools. The default is 13102@option{-mno-text-section-literals}, which places literals in a separate 13103section in the output file. This allows the literal pool to be placed 13104in a data RAM/ROM, and it also allows the linker to combine literal 13105pools from separate object files to remove redundant literals and 13106improve code size. With @option{-mtext-section-literals}, the literals 13107are interspersed in the text section in order to keep them as close as 13108possible to their references. This may be necessary for large assembly 13109files. 13110 13111@item -mtarget-align 13112@itemx -mno-target-align 13113@opindex mtarget-align 13114@opindex mno-target-align 13115When this option is enabled, GCC instructs the assembler to 13116automatically align instructions to reduce branch penalties at the 13117expense of some code density. The assembler attempts to widen density 13118instructions to align branch targets and the instructions following call 13119instructions. If there are not enough preceding safe density 13120instructions to align a target, no widening will be performed. The 13121default is @option{-mtarget-align}. These options do not affect the 13122treatment of auto-aligned instructions like @code{LOOP}, which the 13123assembler will always align, either by widening density instructions or 13124by inserting no-op instructions. 13125 13126@item -mlongcalls 13127@itemx -mno-longcalls 13128@opindex mlongcalls 13129@opindex mno-longcalls 13130When this option is enabled, GCC instructs the assembler to translate 13131direct calls to indirect calls unless it can determine that the target 13132of a direct call is in the range allowed by the call instruction. This 13133translation typically occurs for calls to functions in other source 13134files. Specifically, the assembler translates a direct @code{CALL} 13135instruction into an @code{L32R} followed by a @code{CALLX} instruction. 13136The default is @option{-mno-longcalls}. This option should be used in 13137programs where the call target can potentially be out of range. This 13138option is implemented in the assembler, not the compiler, so the 13139assembly code generated by GCC will still show direct call 13140instructions---look at the disassembled object code to see the actual 13141instructions. Note that the assembler will use an indirect call for 13142every cross-file call, not just those that really will be out of range. 13143@end table 13144 13145@node zSeries Options 13146@subsection zSeries Options 13147@cindex zSeries options 13148 13149These are listed under @xref{S/390 and zSeries Options}. 13150 13151@node Code Gen Options 13152@section Options for Code Generation Conventions 13153@cindex code generation conventions 13154@cindex options, code generation 13155@cindex run-time options 13156 13157These machine-independent options control the interface conventions 13158used in code generation. 13159 13160Most of them have both positive and negative forms; the negative form 13161of @option{-ffoo} would be @option{-fno-foo}. In the table below, only 13162one of the forms is listed---the one which is not the default. You 13163can figure out the other form by either removing @samp{no-} or adding 13164it. 13165 13166@table @gcctabopt 13167@item -fbounds-check 13168@opindex fbounds-check 13169For front-ends that support it, generate additional code to check that 13170indices used to access arrays are within the declared range. This is 13171currently only supported by the Java and Fortran front-ends, where 13172this option defaults to true and false respectively. 13173 13174@item -ftrapv 13175@opindex ftrapv 13176This option generates traps for signed overflow on addition, subtraction, 13177multiplication operations. 13178 13179@item -fwrapv 13180@opindex fwrapv 13181This option instructs the compiler to assume that signed arithmetic 13182overflow of addition, subtraction and multiplication wraps around 13183using twos-complement representation. This flag enables some optimizations 13184and disables others. This option is enabled by default for the Java 13185front-end, as required by the Java language specification. 13186 13187@item -fexceptions 13188@opindex fexceptions 13189Enable exception handling. Generates extra code needed to propagate 13190exceptions. For some targets, this implies GCC will generate frame 13191unwind information for all functions, which can produce significant data 13192size overhead, although it does not affect execution. If you do not 13193specify this option, GCC will enable it by default for languages like 13194C++ which normally require exception handling, and disable it for 13195languages like C that do not normally require it. However, you may need 13196to enable this option when compiling C code that needs to interoperate 13197properly with exception handlers written in C++. You may also wish to 13198disable this option if you are compiling older C++ programs that don't 13199use exception handling. 13200 13201@item -fnon-call-exceptions 13202@opindex fnon-call-exceptions 13203Generate code that allows trapping instructions to throw exceptions. 13204Note that this requires platform-specific runtime support that does 13205not exist everywhere. Moreover, it only allows @emph{trapping} 13206instructions to throw exceptions, i.e.@: memory references or floating 13207point instructions. It does not allow exceptions to be thrown from 13208arbitrary signal handlers such as @code{SIGALRM}. 13209 13210@item -funwind-tables 13211@opindex funwind-tables 13212Similar to @option{-fexceptions}, except that it will just generate any needed 13213static data, but will not affect the generated code in any other way. 13214You will normally not enable this option; instead, a language processor 13215that needs this handling would enable it on your behalf. 13216 13217@item -fasynchronous-unwind-tables 13218@opindex fasynchronous-unwind-tables 13219Generate unwind table in dwarf2 format, if supported by target machine. The 13220table is exact at each instruction boundary, so it can be used for stack 13221unwinding from asynchronous events (such as debugger or garbage collector). 13222 13223@item -fpcc-struct-return 13224@opindex fpcc-struct-return 13225Return ``short'' @code{struct} and @code{union} values in memory like 13226longer ones, rather than in registers. This convention is less 13227efficient, but it has the advantage of allowing intercallability between 13228GCC-compiled files and files compiled with other compilers, particularly 13229the Portable C Compiler (pcc). 13230 13231The precise convention for returning structures in memory depends 13232on the target configuration macros. 13233 13234Short structures and unions are those whose size and alignment match 13235that of some integer type. 13236 13237@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 13238switch is not binary compatible with code compiled with the 13239@option{-freg-struct-return} switch. 13240Use it to conform to a non-default application binary interface. 13241 13242@item -freg-struct-return 13243@opindex freg-struct-return 13244Return @code{struct} and @code{union} values in registers when possible. 13245This is more efficient for small structures than 13246@option{-fpcc-struct-return}. 13247 13248If you specify neither @option{-fpcc-struct-return} nor 13249@option{-freg-struct-return}, GCC defaults to whichever convention is 13250standard for the target. If there is no standard convention, GCC 13251defaults to @option{-fpcc-struct-return}, except on targets where GCC is 13252the principal compiler. In those cases, we can choose the standard, and 13253we chose the more efficient register return alternative. 13254 13255@strong{Warning:} code compiled with the @option{-freg-struct-return} 13256switch is not binary compatible with code compiled with the 13257@option{-fpcc-struct-return} switch. 13258Use it to conform to a non-default application binary interface. 13259 13260@item -fshort-enums 13261@opindex fshort-enums 13262Allocate to an @code{enum} type only as many bytes as it needs for the 13263declared range of possible values. Specifically, the @code{enum} type 13264will be equivalent to the smallest integer type which has enough room. 13265 13266@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 13267code that is not binary compatible with code generated without that switch. 13268Use it to conform to a non-default application binary interface. 13269 13270@item -fshort-double 13271@opindex fshort-double 13272Use the same size for @code{double} as for @code{float}. 13273 13274@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate 13275code that is not binary compatible with code generated without that switch. 13276Use it to conform to a non-default application binary interface. 13277 13278@item -fshort-wchar 13279@opindex fshort-wchar 13280Override the underlying type for @samp{wchar_t} to be @samp{short 13281unsigned int} instead of the default for the target. This option is 13282useful for building programs to run under WINE@. 13283 13284@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 13285code that is not binary compatible with code generated without that switch. 13286Use it to conform to a non-default application binary interface. 13287 13288@item -fno-common 13289@opindex fno-common 13290In C, allocate even uninitialized global variables in the data section of the 13291object file, rather than generating them as common blocks. This has the 13292effect that if the same variable is declared (without @code{extern}) in 13293two different compilations, you will get an error when you link them. 13294The only reason this might be useful is if you wish to verify that the 13295program will work on other systems which always work this way. 13296 13297@item -fno-ident 13298@opindex fno-ident 13299Ignore the @samp{#ident} directive. 13300 13301@item -finhibit-size-directive 13302@opindex finhibit-size-directive 13303Don't output a @code{.size} assembler directive, or anything else that 13304would cause trouble if the function is split in the middle, and the 13305two halves are placed at locations far apart in memory. This option is 13306used when compiling @file{crtstuff.c}; you should not need to use it 13307for anything else. 13308 13309@item -fverbose-asm 13310@opindex fverbose-asm 13311Put extra commentary information in the generated assembly code to 13312make it more readable. This option is generally only of use to those 13313who actually need to read the generated assembly code (perhaps while 13314debugging the compiler itself). 13315 13316@option{-fno-verbose-asm}, the default, causes the 13317extra information to be omitted and is useful when comparing two assembler 13318files. 13319 13320@item -fpic 13321@opindex fpic 13322@cindex global offset table 13323@cindex PIC 13324Generate position-independent code (PIC) suitable for use in a shared 13325library, if supported for the target machine. Such code accesses all 13326constant addresses through a global offset table (GOT)@. The dynamic 13327loader resolves the GOT entries when the program starts (the dynamic 13328loader is not part of GCC; it is part of the operating system). If 13329the GOT size for the linked executable exceeds a machine-specific 13330maximum size, you get an error message from the linker indicating that 13331@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 13332instead. (These maximums are 8k on the SPARC and 32k 13333on the m68k and RS/6000. The 386 has no such limit.) 13334 13335Position-independent code requires special support, and therefore works 13336only on certain machines. For the 386, GCC supports PIC for System V 13337but not for the Sun 386i. Code generated for the IBM RS/6000 is always 13338position-independent. 13339 13340When this flag is set, the macros @code{__pic__} and @code{__PIC__} 13341are defined to 1. 13342 13343@item -fPIC 13344@opindex fPIC 13345If supported for the target machine, emit position-independent code, 13346suitable for dynamic linking and avoiding any limit on the size of the 13347global offset table. This option makes a difference on the m68k, 13348PowerPC and SPARC@. 13349 13350Position-independent code requires special support, and therefore works 13351only on certain machines. 13352 13353When this flag is set, the macros @code{__pic__} and @code{__PIC__} 13354are defined to 2. 13355 13356@item -fpie 13357@itemx -fPIE 13358@opindex fpie 13359@opindex fPIE 13360These options are similar to @option{-fpic} and @option{-fPIC}, but 13361generated position independent code can be only linked into executables. 13362Usually these options are used when @option{-pie} GCC option will be 13363used during linking. 13364 13365@item -fno-jump-tables 13366@opindex fno-jump-tables 13367Do not use jump tables for switch statements even where it would be 13368more efficient than other code generation strategies. This option is 13369of use in conjunction with @option{-fpic} or @option{-fPIC} for 13370building code which forms part of a dynamic linker and cannot 13371reference the address of a jump table. On some targets, jump tables 13372do not require a GOT and this option is not needed. 13373 13374@item -ffixed-@var{reg} 13375@opindex ffixed 13376Treat the register named @var{reg} as a fixed register; generated code 13377should never refer to it (except perhaps as a stack pointer, frame 13378pointer or in some other fixed role). 13379 13380@var{reg} must be the name of a register. The register names accepted 13381are machine-specific and are defined in the @code{REGISTER_NAMES} 13382macro in the machine description macro file. 13383 13384This flag does not have a negative form, because it specifies a 13385three-way choice. 13386 13387@item -fcall-used-@var{reg} 13388@opindex fcall-used 13389Treat the register named @var{reg} as an allocable register that is 13390clobbered by function calls. It may be allocated for temporaries or 13391variables that do not live across a call. Functions compiled this way 13392will not save and restore the register @var{reg}. 13393 13394It is an error to used this flag with the frame pointer or stack pointer. 13395Use of this flag for other registers that have fixed pervasive roles in 13396the machine's execution model will produce disastrous results. 13397 13398This flag does not have a negative form, because it specifies a 13399three-way choice. 13400 13401@item -fcall-saved-@var{reg} 13402@opindex fcall-saved 13403Treat the register named @var{reg} as an allocable register saved by 13404functions. It may be allocated even for temporaries or variables that 13405live across a call. Functions compiled this way will save and restore 13406the register @var{reg} if they use it. 13407 13408It is an error to used this flag with the frame pointer or stack pointer. 13409Use of this flag for other registers that have fixed pervasive roles in 13410the machine's execution model will produce disastrous results. 13411 13412A different sort of disaster will result from the use of this flag for 13413a register in which function values may be returned. 13414 13415This flag does not have a negative form, because it specifies a 13416three-way choice. 13417 13418@item -fpack-struct[=@var{n}] 13419@opindex fpack-struct 13420Without a value specified, pack all structure members together without 13421holes. When a value is specified (which must be a small power of two), pack 13422structure members according to this value, representing the maximum 13423alignment (that is, objects with default alignment requirements larger than 13424this will be output potentially unaligned at the next fitting location. 13425 13426@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 13427code that is not binary compatible with code generated without that switch. 13428Additionally, it makes the code suboptimal. 13429Use it to conform to a non-default application binary interface. 13430 13431@item -finstrument-functions 13432@opindex finstrument-functions 13433Generate instrumentation calls for entry and exit to functions. Just 13434after function entry and just before function exit, the following 13435profiling functions will be called with the address of the current 13436function and its call site. (On some platforms, 13437@code{__builtin_return_address} does not work beyond the current 13438function, so the call site information may not be available to the 13439profiling functions otherwise.) 13440 13441@smallexample 13442void __cyg_profile_func_enter (void *this_fn, 13443 void *call_site); 13444void __cyg_profile_func_exit (void *this_fn, 13445 void *call_site); 13446@end smallexample 13447 13448The first argument is the address of the start of the current function, 13449which may be looked up exactly in the symbol table. 13450 13451This instrumentation is also done for functions expanded inline in other 13452functions. The profiling calls will indicate where, conceptually, the 13453inline function is entered and exited. This means that addressable 13454versions of such functions must be available. If all your uses of a 13455function are expanded inline, this may mean an additional expansion of 13456code size. If you use @samp{extern inline} in your C code, an 13457addressable version of such functions must be provided. (This is 13458normally the case anyways, but if you get lucky and the optimizer always 13459expands the functions inline, you might have gotten away without 13460providing static copies.) 13461 13462A function may be given the attribute @code{no_instrument_function}, in 13463which case this instrumentation will not be done. This can be used, for 13464example, for the profiling functions listed above, high-priority 13465interrupt routines, and any functions from which the profiling functions 13466cannot safely be called (perhaps signal handlers, if the profiling 13467routines generate output or allocate memory). 13468 13469@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} 13470@opindex finstrument-functions-exclude-file-list 13471 13472Set the list of functions that are excluded from instrumentation (see 13473the description of @code{-finstrument-functions}). If the file that 13474contains a function definition matches with one of @var{file}, then 13475that function is not instrumented. The match is done on substrings: 13476if the @var{file} parameter is a substring of the file name, it is 13477considered to be a match. 13478 13479For example, 13480@code{-finstrument-functions-exclude-file-list=/bits/stl,include/sys} 13481will exclude any inline function defined in files whose pathnames 13482contain @code{/bits/stl} or @code{include/sys}. 13483 13484If, for some reason, you want to include letter @code{','} in one of 13485@var{sym}, write @code{'\,'}. For example, 13486@code{-finstrument-functions-exclude-file-list='\,\,tmp'} 13487(note the single quote surrounding the option). 13488 13489@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} 13490@opindex finstrument-functions-exclude-function-list 13491 13492This is similar to @code{-finstrument-functions-exclude-file-list}, 13493but this option sets the list of function names to be excluded from 13494instrumentation. The function name to be matched is its user-visible 13495name, such as @code{vector<int> blah(const vector<int> &)}, not the 13496internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The 13497match is done on substrings: if the @var{sym} parameter is a substring 13498of the function name, it is considered to be a match. 13499 13500@item -fstack-check 13501@opindex fstack-check 13502Generate code to verify that you do not go beyond the boundary of the 13503stack. You should specify this flag if you are running in an 13504environment with multiple threads, but only rarely need to specify it in 13505a single-threaded environment since stack overflow is automatically 13506detected on nearly all systems if there is only one stack. 13507 13508Note that this switch does not actually cause checking to be done; the 13509operating system must do that. The switch causes generation of code 13510to ensure that the operating system sees the stack being extended. 13511 13512@item -fstack-limit-register=@var{reg} 13513@itemx -fstack-limit-symbol=@var{sym} 13514@itemx -fno-stack-limit 13515@opindex fstack-limit-register 13516@opindex fstack-limit-symbol 13517@opindex fno-stack-limit 13518Generate code to ensure that the stack does not grow beyond a certain value, 13519either the value of a register or the address of a symbol. If the stack 13520would grow beyond the value, a signal is raised. For most targets, 13521the signal is raised before the stack overruns the boundary, so 13522it is possible to catch the signal without taking special precautions. 13523 13524For instance, if the stack starts at absolute address @samp{0x80000000} 13525and grows downwards, you can use the flags 13526@option{-fstack-limit-symbol=__stack_limit} and 13527@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 13528of 128KB@. Note that this may only work with the GNU linker. 13529 13530@cindex aliasing of parameters 13531@cindex parameters, aliased 13532@item -fargument-alias 13533@itemx -fargument-noalias 13534@itemx -fargument-noalias-global 13535@itemx -fargument-noalias-anything 13536@opindex fargument-alias 13537@opindex fargument-noalias 13538@opindex fargument-noalias-global 13539@opindex fargument-noalias-anything 13540Specify the possible relationships among parameters and between 13541parameters and global data. 13542 13543@option{-fargument-alias} specifies that arguments (parameters) may 13544alias each other and may alias global storage.@* 13545@option{-fargument-noalias} specifies that arguments do not alias 13546each other, but may alias global storage.@* 13547@option{-fargument-noalias-global} specifies that arguments do not 13548alias each other and do not alias global storage. 13549@option{-fargument-noalias-anything} specifies that arguments do not 13550alias any other storage. 13551 13552Each language will automatically use whatever option is required by 13553the language standard. You should not need to use these options yourself. 13554 13555@item -fleading-underscore 13556@opindex fleading-underscore 13557This option and its counterpart, @option{-fno-leading-underscore}, forcibly 13558change the way C symbols are represented in the object file. One use 13559is to help link with legacy assembly code. 13560 13561@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 13562generate code that is not binary compatible with code generated without that 13563switch. Use it to conform to a non-default application binary interface. 13564Not all targets provide complete support for this switch. 13565 13566@item -ftls-model=@var{model} 13567Alter the thread-local storage model to be used (@pxref{Thread-Local}). 13568The @var{model} argument should be one of @code{global-dynamic}, 13569@code{local-dynamic}, @code{initial-exec} or @code{local-exec}. 13570 13571The default without @option{-fpic} is @code{initial-exec}; with 13572@option{-fpic} the default is @code{global-dynamic}. 13573 13574@item -fvisibility=@var{default|internal|hidden|protected} 13575@opindex fvisibility 13576Set the default ELF image symbol visibility to the specified option---all 13577symbols will be marked with this unless overridden within the code. 13578Using this feature can very substantially improve linking and 13579load times of shared object libraries, produce more optimized 13580code, provide near-perfect API export and prevent symbol clashes. 13581It is @strong{strongly} recommended that you use this in any shared objects 13582you distribute. 13583 13584Despite the nomenclature, @code{default} always means public ie; 13585available to be linked against from outside the shared object. 13586@code{protected} and @code{internal} are pretty useless in real-world 13587usage so the only other commonly used option will be @code{hidden}. 13588The default if @option{-fvisibility} isn't specified is 13589@code{default}, i.e., make every 13590symbol public---this causes the same behavior as previous versions of 13591GCC@. 13592 13593A good explanation of the benefits offered by ensuring ELF 13594symbols have the correct visibility is given by ``How To Write 13595Shared Libraries'' by Ulrich Drepper (which can be found at 13596@w{@uref{http://people.redhat.com/~drepper/}})---however a superior 13597solution made possible by this option to marking things hidden when 13598the default is public is to make the default hidden and mark things 13599public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden} 13600and @code{__attribute__ ((visibility("default")))} instead of 13601@code{__declspec(dllexport)} you get almost identical semantics with 13602identical syntax. This is a great boon to those working with 13603cross-platform projects. 13604 13605For those adding visibility support to existing code, you may find 13606@samp{#pragma GCC visibility} of use. This works by you enclosing 13607the declarations you wish to set visibility for with (for example) 13608@samp{#pragma GCC visibility push(hidden)} and 13609@samp{#pragma GCC visibility pop}. 13610Bear in mind that symbol visibility should be viewed @strong{as 13611part of the API interface contract} and thus all new code should 13612always specify visibility when it is not the default ie; declarations 13613only for use within the local DSO should @strong{always} be marked explicitly 13614as hidden as so to avoid PLT indirection overheads---making this 13615abundantly clear also aids readability and self-documentation of the code. 13616Note that due to ISO C++ specification requirements, operator new and 13617operator delete must always be of default visibility. 13618 13619Be aware that headers from outside your project, in particular system 13620headers and headers from any other library you use, may not be 13621expecting to be compiled with visibility other than the default. You 13622may need to explicitly say @samp{#pragma GCC visibility push(default)} 13623before including any such headers. 13624 13625@samp{extern} declarations are not affected by @samp{-fvisibility}, so 13626a lot of code can be recompiled with @samp{-fvisibility=hidden} with 13627no modifications. However, this means that calls to @samp{extern} 13628functions with no explicit visibility will use the PLT, so it is more 13629effective to use @samp{__attribute ((visibility))} and/or 13630@samp{#pragma GCC visibility} to tell the compiler which @samp{extern} 13631declarations should be treated as hidden. 13632 13633Note that @samp{-fvisibility} does affect C++ vague linkage 13634entities. This means that, for instance, an exception class that will 13635be thrown between DSOs must be explicitly marked with default 13636visibility so that the @samp{type_info} nodes will be unified between 13637the DSOs. 13638 13639An overview of these techniques, their benefits and how to use them 13640is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}. 13641 13642@end table 13643 13644@c man end 13645 13646@node Environment Variables 13647@section Environment Variables Affecting GCC 13648@cindex environment variables 13649 13650@c man begin ENVIRONMENT 13651This section describes several environment variables that affect how GCC 13652operates. Some of them work by specifying directories or prefixes to use 13653when searching for various kinds of files. Some are used to specify other 13654aspects of the compilation environment. 13655 13656Note that you can also specify places to search using options such as 13657@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 13658take precedence over places specified using environment variables, which 13659in turn take precedence over those specified by the configuration of GCC@. 13660@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 13661GNU Compiler Collection (GCC) Internals}. 13662 13663@table @env 13664@item LANG 13665@itemx LC_CTYPE 13666@c @itemx LC_COLLATE 13667@itemx LC_MESSAGES 13668@c @itemx LC_MONETARY 13669@c @itemx LC_NUMERIC 13670@c @itemx LC_TIME 13671@itemx LC_ALL 13672@findex LANG 13673@findex LC_CTYPE 13674@c @findex LC_COLLATE 13675@findex LC_MESSAGES 13676@c @findex LC_MONETARY 13677@c @findex LC_NUMERIC 13678@c @findex LC_TIME 13679@findex LC_ALL 13680@cindex locale 13681These environment variables control the way that GCC uses 13682localization information that allow GCC to work with different 13683national conventions. GCC inspects the locale categories 13684@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 13685so. These locale categories can be set to any value supported by your 13686installation. A typical value is @samp{en_GB.UTF-8} for English in the United 13687Kingdom encoded in UTF-8. 13688 13689The @env{LC_CTYPE} environment variable specifies character 13690classification. GCC uses it to determine the character boundaries in 13691a string; this is needed for some multibyte encodings that contain quote 13692and escape characters that would otherwise be interpreted as a string 13693end or escape. 13694 13695The @env{LC_MESSAGES} environment variable specifies the language to 13696use in diagnostic messages. 13697 13698If the @env{LC_ALL} environment variable is set, it overrides the value 13699of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 13700and @env{LC_MESSAGES} default to the value of the @env{LANG} 13701environment variable. If none of these variables are set, GCC 13702defaults to traditional C English behavior. 13703 13704@item TMPDIR 13705@findex TMPDIR 13706If @env{TMPDIR} is set, it specifies the directory to use for temporary 13707files. GCC uses temporary files to hold the output of one stage of 13708compilation which is to be used as input to the next stage: for example, 13709the output of the preprocessor, which is the input to the compiler 13710proper. 13711 13712@item GCC_EXEC_PREFIX 13713@findex GCC_EXEC_PREFIX 13714If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 13715names of the subprograms executed by the compiler. No slash is added 13716when this prefix is combined with the name of a subprogram, but you can 13717specify a prefix that ends with a slash if you wish. 13718 13719If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out 13720an appropriate prefix to use based on the pathname it was invoked with. 13721 13722If GCC cannot find the subprogram using the specified prefix, it 13723tries looking in the usual places for the subprogram. 13724 13725The default value of @env{GCC_EXEC_PREFIX} is 13726@file{@var{prefix}/lib/gcc/} where @var{prefix} is the value 13727of @code{prefix} when you ran the @file{configure} script. 13728 13729Other prefixes specified with @option{-B} take precedence over this prefix. 13730 13731This prefix is also used for finding files such as @file{crt0.o} that are 13732used for linking. 13733 13734In addition, the prefix is used in an unusual way in finding the 13735directories to search for header files. For each of the standard 13736directories whose name normally begins with @samp{/usr/local/lib/gcc} 13737(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 13738replacing that beginning with the specified prefix to produce an 13739alternate directory name. Thus, with @option{-Bfoo/}, GCC will search 13740@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}. 13741These alternate directories are searched first; the standard directories 13742come next. 13743 13744@item COMPILER_PATH 13745@findex COMPILER_PATH 13746The value of @env{COMPILER_PATH} is a colon-separated list of 13747directories, much like @env{PATH}. GCC tries the directories thus 13748specified when searching for subprograms, if it can't find the 13749subprograms using @env{GCC_EXEC_PREFIX}. 13750 13751@item LIBRARY_PATH 13752@findex LIBRARY_PATH 13753The value of @env{LIBRARY_PATH} is a colon-separated list of 13754directories, much like @env{PATH}. When configured as a native compiler, 13755GCC tries the directories thus specified when searching for special 13756linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking 13757using GCC also uses these directories when searching for ordinary 13758libraries for the @option{-l} option (but directories specified with 13759@option{-L} come first). 13760 13761@item LANG 13762@findex LANG 13763@cindex locale definition 13764This variable is used to pass locale information to the compiler. One way in 13765which this information is used is to determine the character set to be used 13766when character literals, string literals and comments are parsed in C and C++. 13767When the compiler is configured to allow multibyte characters, 13768the following values for @env{LANG} are recognized: 13769 13770@table @samp 13771@item C-JIS 13772Recognize JIS characters. 13773@item C-SJIS 13774Recognize SJIS characters. 13775@item C-EUCJP 13776Recognize EUCJP characters. 13777@end table 13778 13779If @env{LANG} is not defined, or if it has some other value, then the 13780compiler will use mblen and mbtowc as defined by the default locale to 13781recognize and translate multibyte characters. 13782@end table 13783 13784@noindent 13785Some additional environments variables affect the behavior of the 13786preprocessor. 13787 13788@include cppenv.texi 13789 13790@c man end 13791 13792@node Precompiled Headers 13793@section Using Precompiled Headers 13794@cindex precompiled headers 13795@cindex speed of compilation 13796 13797Often large projects have many header files that are included in every 13798source file. The time the compiler takes to process these header files 13799over and over again can account for nearly all of the time required to 13800build the project. To make builds faster, GCC allows users to 13801`precompile' a header file; then, if builds can use the precompiled 13802header file they will be much faster. 13803 13804To create a precompiled header file, simply compile it as you would any 13805other file, if necessary using the @option{-x} option to make the driver 13806treat it as a C or C++ header file. You will probably want to use a 13807tool like @command{make} to keep the precompiled header up-to-date when 13808the headers it contains change. 13809 13810A precompiled header file will be searched for when @code{#include} is 13811seen in the compilation. As it searches for the included file 13812(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 13813compiler looks for a precompiled header in each directory just before it 13814looks for the include file in that directory. The name searched for is 13815the name specified in the @code{#include} with @samp{.gch} appended. If 13816the precompiled header file can't be used, it is ignored. 13817 13818For instance, if you have @code{#include "all.h"}, and you have 13819@file{all.h.gch} in the same directory as @file{all.h}, then the 13820precompiled header file will be used if possible, and the original 13821header will be used otherwise. 13822 13823Alternatively, you might decide to put the precompiled header file in a 13824directory and use @option{-I} to ensure that directory is searched 13825before (or instead of) the directory containing the original header. 13826Then, if you want to check that the precompiled header file is always 13827used, you can put a file of the same name as the original header in this 13828directory containing an @code{#error} command. 13829 13830This also works with @option{-include}. So yet another way to use 13831precompiled headers, good for projects not designed with precompiled 13832header files in mind, is to simply take most of the header files used by 13833a project, include them from another header file, precompile that header 13834file, and @option{-include} the precompiled header. If the header files 13835have guards against multiple inclusion, they will be skipped because 13836they've already been included (in the precompiled header). 13837 13838If you need to precompile the same header file for different 13839languages, targets, or compiler options, you can instead make a 13840@emph{directory} named like @file{all.h.gch}, and put each precompiled 13841header in the directory, perhaps using @option{-o}. It doesn't matter 13842what you call the files in the directory, every precompiled header in 13843the directory will be considered. The first precompiled header 13844encountered in the directory that is valid for this compilation will 13845be used; they're searched in no particular order. 13846 13847There are many other possibilities, limited only by your imagination, 13848good sense, and the constraints of your build system. 13849 13850A precompiled header file can be used only when these conditions apply: 13851 13852@itemize 13853@item 13854Only one precompiled header can be used in a particular compilation. 13855 13856@item 13857A precompiled header can't be used once the first C token is seen. You 13858can have preprocessor directives before a precompiled header; you can 13859even include a precompiled header from inside another header, so long as 13860there are no C tokens before the @code{#include}. 13861 13862@item 13863The precompiled header file must be produced for the same language as 13864the current compilation. You can't use a C precompiled header for a C++ 13865compilation. 13866 13867@item 13868The precompiled header file must have been produced by the same compiler 13869binary as the current compilation is using. 13870 13871@item 13872Any macros defined before the precompiled header is included must 13873either be defined in the same way as when the precompiled header was 13874generated, or must not affect the precompiled header, which usually 13875means that they don't appear in the precompiled header at all. 13876 13877The @option{-D} option is one way to define a macro before a 13878precompiled header is included; using a @code{#define} can also do it. 13879There are also some options that define macros implicitly, like 13880@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 13881defined this way. 13882 13883@item If debugging information is output when using the precompiled 13884header, using @option{-g} or similar, the same kind of debugging information 13885must have been output when building the precompiled header. However, 13886a precompiled header built using @option{-g} can be used in a compilation 13887when no debugging information is being output. 13888 13889@item The same @option{-m} options must generally be used when building 13890and using the precompiled header. @xref{Submodel Options}, 13891for any cases where this rule is relaxed. 13892 13893@item Each of the following options must be the same when building and using 13894the precompiled header: 13895 13896@gccoptlist{-fexceptions -funit-at-a-time} 13897 13898@item 13899Some other command-line options starting with @option{-f}, 13900@option{-p}, or @option{-O} must be defined in the same way as when 13901the precompiled header was generated. At present, it's not clear 13902which options are safe to change and which are not; the safest choice 13903is to use exactly the same options when generating and using the 13904precompiled header. The following are known to be safe: 13905 13906@gccoptlist{-fmessage-length= -fpreprocessed 13907-fsched-interblock -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous 13908-fsched-verbose=<number> -fschedule-insns -fvisibility= 13909-pedantic-errors} 13910 13911@end itemize 13912 13913For all of these except the last, the compiler will automatically 13914ignore the precompiled header if the conditions aren't met. If you 13915find an option combination that doesn't work and doesn't cause the 13916precompiled header to be ignored, please consider filing a bug report, 13917see @ref{Bugs}. 13918 13919If you do use differing options when generating and using the 13920precompiled header, the actual behavior will be a mixture of the 13921behavior for the options. For instance, if you use @option{-g} to 13922generate the precompiled header but not when using it, you may or may 13923not get debugging information for routines in the precompiled header. 13924 13925@node Running Protoize 13926@section Running Protoize 13927 13928The program @code{protoize} is an optional part of GCC@. You can use 13929it to add prototypes to a program, thus converting the program to ISO 13930C in one respect. The companion program @code{unprotoize} does the 13931reverse: it removes argument types from any prototypes that are found. 13932 13933When you run these programs, you must specify a set of source files as 13934command line arguments. The conversion programs start out by compiling 13935these files to see what functions they define. The information gathered 13936about a file @var{foo} is saved in a file named @file{@var{foo}.X}. 13937 13938After scanning comes actual conversion. The specified files are all 13939eligible to be converted; any files they include (whether sources or 13940just headers) are eligible as well. 13941 13942But not all the eligible files are converted. By default, 13943@code{protoize} and @code{unprotoize} convert only source and header 13944files in the current directory. You can specify additional directories 13945whose files should be converted with the @option{-d @var{directory}} 13946option. You can also specify particular files to exclude with the 13947@option{-x @var{file}} option. A file is converted if it is eligible, its 13948directory name matches one of the specified directory names, and its 13949name within the directory has not been excluded. 13950 13951Basic conversion with @code{protoize} consists of rewriting most 13952function definitions and function declarations to specify the types of 13953the arguments. The only ones not rewritten are those for varargs 13954functions. 13955 13956@code{protoize} optionally inserts prototype declarations at the 13957beginning of the source file, to make them available for any calls that 13958precede the function's definition. Or it can insert prototype 13959declarations with block scope in the blocks where undeclared functions 13960are called. 13961 13962Basic conversion with @code{unprotoize} consists of rewriting most 13963function declarations to remove any argument types, and rewriting 13964function definitions to the old-style pre-ISO form. 13965 13966Both conversion programs print a warning for any function declaration or 13967definition that they can't convert. You can suppress these warnings 13968with @option{-q}. 13969 13970The output from @code{protoize} or @code{unprotoize} replaces the 13971original source file. The original file is renamed to a name ending 13972with @samp{.save} (for DOS, the saved filename ends in @samp{.sav} 13973without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav} 13974for DOS) file already exists, then the source file is simply discarded. 13975 13976@code{protoize} and @code{unprotoize} both depend on GCC itself to 13977scan the program and collect information about the functions it uses. 13978So neither of these programs will work until GCC is installed. 13979 13980Here is a table of the options you can use with @code{protoize} and 13981@code{unprotoize}. Each option works with both programs unless 13982otherwise stated. 13983 13984@table @code 13985@item -B @var{directory} 13986Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the 13987usual directory (normally @file{/usr/local/lib}). This file contains 13988prototype information about standard system functions. This option 13989applies only to @code{protoize}. 13990 13991@item -c @var{compilation-options} 13992Use @var{compilation-options} as the options when running @command{gcc} to 13993produce the @samp{.X} files. The special option @option{-aux-info} is 13994always passed in addition, to tell @command{gcc} to write a @samp{.X} file. 13995 13996Note that the compilation options must be given as a single argument to 13997@code{protoize} or @code{unprotoize}. If you want to specify several 13998@command{gcc} options, you must quote the entire set of compilation options 13999to make them a single word in the shell. 14000 14001There are certain @command{gcc} arguments that you cannot use, because they 14002would produce the wrong kind of output. These include @option{-g}, 14003@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in 14004the @var{compilation-options}, they are ignored. 14005 14006@item -C 14007Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file 14008systems) instead of @samp{.c}. This is convenient if you are converting 14009a C program to C++. This option applies only to @code{protoize}. 14010 14011@item -g 14012Add explicit global declarations. This means inserting explicit 14013declarations at the beginning of each source file for each function 14014that is called in the file and was not declared. These declarations 14015precede the first function definition that contains a call to an 14016undeclared function. This option applies only to @code{protoize}. 14017 14018@item -i @var{string} 14019Indent old-style parameter declarations with the string @var{string}. 14020This option applies only to @code{protoize}. 14021 14022@code{unprotoize} converts prototyped function definitions to old-style 14023function definitions, where the arguments are declared between the 14024argument list and the initial @samp{@{}. By default, @code{unprotoize} 14025uses five spaces as the indentation. If you want to indent with just 14026one space instead, use @option{-i " "}. 14027 14028@item -k 14029Keep the @samp{.X} files. Normally, they are deleted after conversion 14030is finished. 14031 14032@item -l 14033Add explicit local declarations. @code{protoize} with @option{-l} inserts 14034a prototype declaration for each function in each block which calls the 14035function without any declaration. This option applies only to 14036@code{protoize}. 14037 14038@item -n 14039Make no real changes. This mode just prints information about the conversions 14040that would have been done without @option{-n}. 14041 14042@item -N 14043Make no @samp{.save} files. The original files are simply deleted. 14044Use this option with caution. 14045 14046@item -p @var{program} 14047Use the program @var{program} as the compiler. Normally, the name 14048@file{gcc} is used. 14049 14050@item -q 14051Work quietly. Most warnings are suppressed. 14052 14053@item -v 14054Print the version number, just like @option{-v} for @command{gcc}. 14055@end table 14056 14057If you need special compiler options to compile one of your program's 14058source files, then you should generate that file's @samp{.X} file 14059specially, by running @command{gcc} on that source file with the 14060appropriate options and the option @option{-aux-info}. Then run 14061@code{protoize} on the entire set of files. @code{protoize} will use 14062the existing @samp{.X} file because it is newer than the source file. 14063For example: 14064 14065@smallexample 14066gcc -Dfoo=bar file1.c -aux-info file1.X 14067protoize *.c 14068@end smallexample 14069 14070@noindent 14071You need to include the special files along with the rest in the 14072@code{protoize} command, even though their @samp{.X} files already 14073exist, because otherwise they won't get converted. 14074 14075@xref{Protoize Caveats}, for more information on how to use 14076@code{protoize} successfully. 14077 14078